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

:root {
    --p1-color: #ff4136;
    --p2-color: #0074d9;
    --bg-dark: #0a0a0f;
    --bg-panel: #141420;
    --text-bright: #ffffff;
    --text-dim: #888899;
    --accent-gold: #ffd700;
    --success: #2ecc40;
    --danger: #ff4136;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-dark);
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-bright);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0a0a0f 100%);
    border-bottom: 2px solid #333;
    z-index: 100;
    height: 80px;
}

.header-left h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--p1-color), var(--accent-gold), var(--p2-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#target-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.target-label {
    font-size: 0.7rem;
    color: var(--accent-gold);
    letter-spacing: 2px;
}

#target-preview {
    width: 120px;
    height: 50px;
    background: #1a1a2e;
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
}

.action-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
    border: none;
    border-radius: 6px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #000;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.action-btn.hidden {
    display: none;
}

/* Main Game Area */
main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.player-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.player1 {
    border-right: 3px solid var(--p1-color);
}

.player1 .player-header {
    background: linear-gradient(90deg, var(--p1-color), transparent);
}

.player2 {
    border-left: 3px solid var(--p2-color);
}

.player2 .player-header {
    background: linear-gradient(-90deg, var(--p2-color), transparent);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 3px;
}

.player-controls {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.player-timer {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    letter-spacing: 2px;
}

.game-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.player1 .game-area {
    flex-direction: row;
}

.player2 .game-area {
    flex-direction: row-reverse;
}

.scene-container {
    flex: 1;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 160px;
    background: var(--bg-panel);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #333;
}

.part-bin h3 {
    font-size: 0.75rem;
    color: var(--accent-gold);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.parts-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.part-item {
    aspect-ratio: 1;
    background: #222;
    border: 2px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.part-item:hover {
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.part-item.selected {
    border-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.part-item.correct {
    border-color: var(--success);
}

.part-item .part-color {
    width: 70%;
    height: 70%;
    border-radius: 3px;
}

.part-item .part-type {
    position: absolute;
    bottom: 2px;
    font-size: 0.5rem;
    color: var(--text-dim);
}

.current-part {
    background: #1a1a2e;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #333;
}

.current-part .label {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.part-preview {
    height: 40px;
    margin-top: 4px;
    background: #222;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar {
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #7bed9f);
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
}

.mistakes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px;
    background: rgba(255, 65, 54, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(255, 65, 54, 0.3);
}

.mistake-label {
    font-size: 0.65rem;
    color: var(--danger);
}

.mistake-value {
    font-size: 0.9rem;
    color: var(--danger);
    font-weight: bold;
}

/* Ghost Brick Indicator */
.ghost-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 0, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--success);
    border: 1px solid var(--success);
}

/* Cursor indicator */
.cursor-pos {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-bright);
}

/* Winner Overlay */
#winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.5s ease;
}

#winner-overlay.hidden {
    display: none;
}

.winner-content {
    text-align: center;
    animation: scaleIn 0.5s ease;
}

.trophy {
    font-size: 6rem;
    animation: bounce 1s ease infinite;
}

.winner-content h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    letter-spacing: 8px;
    background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
}

.winner-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 30px 0;
}

.winner-stats .stat {
    text-align: center;
}

.winner-stats .stat-value {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    color: var(--accent-gold);
}

.winner-stats .stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 2px;
}

/* Countdown */
#countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#countdown-overlay.hidden {
    display: none;
}

.countdown-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15rem;
    color: var(--accent-gold);
    text-shadow: 0 0 50px var(--accent-gold);
    animation: pulse 1s ease infinite;
}

/* Footer */
footer {
    padding: 8px 24px;
    background: var(--bg-panel);
    color: var(--text-dim);
    text-align: center;
    font-size: 0.75rem;
    border-top: 1px solid #333;
}

footer a {
    color: var(--accent-gold);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.5);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Mobile Warning */
@media (max-width: 900px) {
    main {
        flex-direction: column;
    }
    
    .player-side {
        border: none !important;
    }
    
    .player1 {
        border-bottom: 3px solid var(--p1-color) !important;
    }
    
    .player2 {
        border-top: 3px solid var(--p2-color) !important;
    }
    
    .sidebar {
        width: 120px;
    }
    
    .player-name {
        font-size: 1rem;
    }
    
    .player-timer {
        font-size: 1.4rem;
    }
}