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

body {
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#scene-container canvas {
    display: block;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#ui-overlay * {
    pointer-events: auto;
}

/* Top Bar */
#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(10, 10, 30, 0.85) 0%, rgba(10, 10, 30, 0) 100%);
}

#top-bar h1 {
    font-size: 20px;
    font-weight: 600;
    color: #d4af37;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#turn-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

#turn-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #888;
    transition: background 0.3s;
}

#turn-dot.black {
    background: #222;
    border-color: #555;
}

#turn-text {
    color: #ccc;
}

/* Side Panel */
#side-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 240px;
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    background: linear-gradient(270deg, rgba(10, 10, 30, 0.9) 0%, rgba(10, 10, 30, 0) 100%);
    overflow-y: auto;
}

/* Captured Pieces */
.captured-area {
    padding: 8px;
}

.captured-area h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 4px;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 20px;
    min-height: 28px;
}

.score-advantage {
    font-size: 12px;
    color: #d4af37;
    margin-top: 2px;
    font-weight: 600;
}

/* Move History */
#move-history {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

#move-history h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 6px;
}

#move-list {
    flex: 1;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

#move-list::-webkit-scrollbar {
    width: 4px;
}

#move-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

.move-row {
    display: flex;
    gap: 4px;
    padding: 1px 4px;
    border-radius: 3px;
}

.move-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.move-number {
    color: #666;
    min-width: 28px;
    text-align: right;
}

.move-white, .move-black {
    min-width: 60px;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 2px;
}

.move-white:hover, .move-black:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
}

.move-current {
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
}

/* Controls */
#controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

#controls button {
    padding: 8px 12px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #d4af37;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#controls button:hover {
    background: rgba(212, 175, 55, 0.3);
    border-color: rgba(212, 175, 55, 0.5);
}

#controls button:active {
    transform: scale(0.97);
}

#difficulty-control, #play-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #999;
}

#difficulty-control label, #play-mode label {
    white-space: nowrap;
}

#ai-depth, #game-mode {
    flex: 1;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    border-radius: 4px;
    font-size: 12px;
}

/* Promotion Dialog */
#promotion-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 20px;
    z-index: 100;
    text-align: center;
    backdrop-filter: blur(10px);
}

#promotion-dialog h3 {
    color: #d4af37;
    margin-bottom: 12px;
    font-size: 16px;
}

#promotion-options {
    display: flex;
    gap: 8px;
}

#promotion-options button {
    width: 56px;
    height: 56px;
    font-size: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    line-height: 1;
}

#promotion-options button:hover {
    background: rgba(212, 175, 55, 0.3);
    border-color: #d4af37;
    transform: scale(1.1);
}

/* Game Over Dialog */
#game-over-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #d4af37;
    border-radius: 16px;
    padding: 32px 48px;
    z-index: 100;
    text-align: center;
    backdrop-filter: blur(10px);
}

#game-over-title {
    color: #d4af37;
    font-size: 28px;
    margin-bottom: 8px;
}

#game-over-message {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
}

#btn-play-again {
    padding: 10px 28px;
    background: linear-gradient(135deg, #d4af37, #b8942e);
    border: none;
    color: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

#btn-play-again:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

/* Thinking Indicator */
#thinking-indicator {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(20, 20, 40, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 24px;
    z-index: 50;
    font-size: 13px;
    color: #d4af37;
    backdrop-filter: blur(8px);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Check highlight flash */
@keyframes check-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    #side-panel {
        width: 180px;
        padding: 6px;
        gap: 4px;
        overflow-y: auto;
    }

    .captured-area {
        padding: 4px;
    }

    #move-history {
        padding: 4px;
    }

    #controls {
        padding: 4px;
        gap: 4px;
    }

    #controls button {
        min-height: 40px;
    }

    #top-bar h1 {
        font-size: 16px;
    }

    #top-bar {
        padding: 8px 16px;
    }
}

@media (max-width: 500px) {
    #side-panel {
        width: 140px;
        padding: 4px;
        gap: 3px;
        font-size: 11px;
        overflow-y: auto;
    }

    .captured-area {
        padding: 3px;
    }

    .captured-area h3 {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .captured-pieces {
        font-size: 16px;
        min-height: 22px;
    }

    #move-history {
        padding: 4px;
    }

    #move-history h3 {
        font-size: 10px;
        margin-bottom: 3px;
    }

    #move-list {
        font-size: 11px;
        line-height: 1.4;
    }

    #controls {
        padding: 3px;
        gap: 3px;
    }

    #controls button {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 38px;
    }

    #difficulty-control, #play-mode {
        gap: 4px;
        font-size: 11px;
    }

    #ai-depth, #game-mode {
        padding: 4px 6px;
        font-size: 11px;
        min-height: 34px;
    }

    #top-bar {
        padding: 6px 12px;
    }

    #top-bar h1 {
        font-size: 14px;
        letter-spacing: 1px;
    }
}
