* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a14;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #e0e0e0;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* When editor is active, game container makes room for toolbar and panel */
body.editor-active #game-container {
    top: 40px;
    right: 350px;
}

#game-canvas {
    image-rendering: auto;
    cursor: default;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a14;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 2.5em;
    color: #8899cc;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(100, 140, 220, 0.4);
}

.loading-bar-container {
    width: 300px;
    height: 6px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 15px;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4466aa, #6688cc);
    border-radius: 3px;
    transition: width 0.2s ease;
}

#loading-text {
    color: #667799;
    font-size: 0.9em;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Editor Toolbar */
#editor-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 350px;
    height: 40px;
    background: rgba(20, 20, 35, 0.97);
    border-bottom: 1px solid #334;
    display: flex;
    align-items: center;
    padding: 0 6px;
    z-index: 60;
    gap: 4px;
    overflow-x: auto;
}

#editor-toolbar button {
    padding: 4px 12px;
    background: #2a2a40;
    color: #ccd;
    border: 1px solid #445;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

#editor-toolbar button:hover {
    background: #3a3a55;
}

#editor-toolbar button.active {
    background: #4466aa;
    border-color: #5577bb;
    color: #fff;
}

#editor-toolbar .separator {
    width: 1px;
    height: 24px;
    background: #334;
    margin: 0 4px;
}

#editor-toolbar .label {
    color: #889;
    font-size: 12px;
    margin-right: 4px;
}

/* Editor Panel (right side) */
#editor-panel {
    position: fixed;
    top: 40px;
    right: 0;
    width: 350px;
    bottom: 0;
    background: rgba(16, 16, 28, 0.97);
    border-left: 1px solid #334;
    overflow-y: auto;
    padding: 12px;
    z-index: 50;
    font-size: 12px;
}


#editor-panel h3 {
    color: #8899cc;
    margin: 12px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a40;
    font-size: 13px;
}

#editor-panel h3:first-child {
    margin-top: 0;
}

#editor-panel label {
    display: block;
    color: #889;
    margin: 6px 0 2px;
    font-size: 11px;
}

#editor-panel input[type="text"],
#editor-panel input[type="number"],
#editor-panel textarea,
#editor-panel select {
    width: 100%;
    padding: 4px 6px;
    background: #1a1a2e;
    color: #dde;
    border: 1px solid #334;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

#editor-panel textarea {
    min-height: 60px;
    resize: vertical;
}

#editor-panel input:focus,
#editor-panel textarea:focus,
#editor-panel select:focus {
    outline: none;
    border-color: #4466aa;
}

#editor-panel button {
    padding: 3px 10px;
    background: #2a2a40;
    color: #ccd;
    border: 1px solid #445;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    margin: 2px;
}

#editor-panel button:hover {
    background: #3a3a55;
}

#editor-panel button.danger {
    border-color: #833;
    color: #e88;
}

#editor-panel button.danger:hover {
    background: #4a2020;
}

#editor-panel .field-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

#editor-panel .field-row input {
    flex: 1;
}

#editor-panel .list-item {
    padding: 4px 6px;
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 3px;
    margin: 3px 0;
    cursor: pointer;
}

#editor-panel .list-item:hover {
    border-color: #445;
}

#editor-panel .list-item.selected {
    border-color: #4466aa;
    background: rgba(255,255,255,0.08);
    border-left: 3px solid #c070ff;
    padding-left: 5px;
}

.sub-properties {
    margin: 4px 0 8px 0;
}

.sub-properties label {
    font-size: 11px;
}

.sub-properties input, .sub-properties select {
    font-size: 12px;
}

/* Scrollbar styling */
#editor-panel::-webkit-scrollbar {
    width: 6px;
}

#editor-panel::-webkit-scrollbar-track {
    background: #0a0a14;
}

#editor-panel::-webkit-scrollbar-thumb {
    background: #334;
    border-radius: 3px;
}

#editor-panel::-webkit-scrollbar-thumb:hover {
    background: #445;
}

#editor-panel h4 {
    color: #99aacc;
    margin: 10px 0 4px;
    font-size: 12px;
}

.action-item {
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    padding: 6px;
    margin: 4px 0;
}

.action-item select {
    margin-bottom: 4px;
}

.actions-list button {
    margin-top: 4px;
}

button.small {
    padding: 2px 8px;
    font-size: 11px;
}

.field-row select, .field-row input[list] {
    border: 1px solid #334;
    border-radius: 3px;
}
