/* BOB2 - STYLE SYSTEM */
:root {
    --bg-primary: #030712;
    --card-bg: rgba(17, 24, 39, 0.7);
    --border-glow: #3b82f6;
    --border-glow-win: #10b981;
    --border-glow-lose: #ef4444;
    --text-primary: #f9fafb;
    --text-muted: #9ca3af;
    --color-electric: #fbbf24;
    
    --neon-blue: #3b82f6;
    --neon-pink: #ec4899;
    --neon-green: #10b981;
    --neon-red: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.8) 0%, transparent 60%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

/* GAME VIEWPORT */
.game-container {
    position: relative;
    width: 1000px;
    height: 750px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15), 
                0 0 2px rgba(59, 130, 246, 0.3);
    border: 3px solid rgba(59, 130, 246, 0.4);
    background-color: #020617;
    display: flex;
    flex-direction: row;
}

#gameCanvas {
    display: block;
    width: 750px;
    height: 750px;
    flex-shrink: 0;
}

/* GLASSMORPHIC HUD PANEL (Sidebar Layout) */
.hud-panel {
    width: 250px;
    height: 100%;
    background: rgba(3, 7, 18, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 2px solid rgba(59, 130, 246, 0.3);
    padding: 24px 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
}

.hud-header h2 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hud-header .subtitle {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
}

.hud-item:first-child {
    border-top: none;
    padding-top: 0;
}

.hud-label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-value {
    font-size: 11px;
    font-weight: 600;
}

.font-mono {
    font-family: 'Share Tech Mono', monospace;
}

.hearts-container {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.heart {
    font-size: 16px;
    display: inline-block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.heart.cracked {
    filter: grayscale(1) brightness(0.6) drop-shadow(0 0 2px rgba(255, 0, 0, 0.4));
    animation: heart-break 0.4s ease forwards;
}

@keyframes heart-break {
    0% { transform: scale(1.3) rotate(0deg); }
    30% { transform: scale(1.3) rotate(-15deg); }
    60% { transform: scale(1.3) rotate(15deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* SPEED BUFF INDICATOR */
.speed-boost {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 8px;
    padding: 6px;
    margin-top: 4px;
    animation: pulse-buff 1s infinite alternate;
}

.buff-label {
    color: var(--color-electric);
}

#speed-timer {
    color: var(--color-electric);
    font-weight: bold;
}

@keyframes pulse-buff {
    0% { box-shadow: 0 0 4px rgba(251, 191, 36, 0.1); }
    100% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.3); }
}

.hidden {
    display: none !important;
}

/* OVERLAYS SYSTEM */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at center, rgba(2, 6, 23, 0.75) 0%, rgba(2, 6, 23, 0.95) 100%),
        repeating-linear-gradient(rgba(59, 130, 246, 0.02) 0px, rgba(59, 130, 246, 0.02) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(90deg, rgba(59, 130, 246, 0.02) 0px, rgba(59, 130, 246, 0.02) 1px, transparent 1px, transparent 40px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.4s ease;
}

.overlay-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.82) 0%, rgba(11, 15, 26, 0.93) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 20px;
    padding: 30px;
    width: 440px;
    max-height: 540px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(59, 130, 246, 0.1),
        inset 0 0 15px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    border-top: 3px solid var(--border-glow);
}

.overlay-card.win {
    border-top-color: var(--border-glow-win);
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(16, 185, 129, 0.1),
        inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.overlay-card.lose {
    border-top-color: var(--border-glow-lose);
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(239, 68, 68, 0.1),
        inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.glow-text {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #fff;
    animation: neon-flicker 4s infinite alternate;
}

.glow-text.win {
    animation: neon-flicker-win 4s infinite alternate;
}

.glow-text.lose {
    animation: neon-flicker-lose 4s infinite alternate;
}

@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 4px #fff,
            0 0 10px #3b82f6,
            0 0 20px #3b82f6,
            0 0 40px #8b5cf6;
    }
    20%, 24%, 55% {
        text-shadow: none;
        opacity: 0.7;
    }
}

@keyframes neon-flicker-win {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 4px #fff,
            0 0 10px #10b981,
            0 0 20px #10b981,
            0 0 40px #059669;
    }
    20%, 24%, 55% {
        text-shadow: none;
        opacity: 0.7;
    }
}

@keyframes neon-flicker-lose {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 4px #fff,
            0 0 10px #ef4444,
            0 0 20px #ef4444,
            0 0 40px #b91c1c;
    }
    20%, 24%, 55% {
        text-shadow: none;
        opacity: 0.7;
    }
}

.description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* INSTRUCTIONS GRID */
.instructions {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instruction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.key {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 4px 6px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: #f3f4f6;
    min-width: 24px;
    text-align: center;
}

.key.yellow-box {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
}

.key.lightning-char {
    color: #fbbf24;
    background: transparent;
    border: none;
    font-size: 14px;
    padding: 0;
}

.key.green-box {
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.heartbeat-indicator {
    color: #ef4444;
    background: transparent;
    border: none;
    font-size: 14px;
    animation: heart-beat-anim 0.8s infinite alternate;
}

@keyframes heart-beat-anim {
    0% { transform: scale(1); }
    100% { transform: scale(1.25); }
}

.action {
    color: var(--text-primary);
    font-weight: 500;
}

/* BUTTONS */
.action-btn {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
}

.action-btn.start {
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    animation: pulse-start-btn 1.5s infinite alternate;
}

@keyframes pulse-start-btn {
    0% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.7);
        transform: scale(1.02);
    }
}

.action-btn.start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
}

.action-btn.restart {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn.restart:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn:active {
    transform: translateY(0);
}

/* RESULTS LAYOUT */
.game-results {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.success-text {
    color: var(--neon-green);
    font-weight: 700;
}

.danger-text {
    color: var(--neon-red);
    font-weight: 700;
}

.warning-text {
    color: #fbbf24;
    font-weight: 700;
}
