/* =============================================================================
   DEBT CLOCK CHALLENGE — Styles v1.0
   Dark newsroom / war room aesthetic · $DEBT branding
   ============================================================================= */

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

body {
    font-family: 'Inter', sans-serif;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --- Matrix Background (shared script canvas) --- */

#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.35;
}

/* --- Game Container --- */

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 10px 16px 16px;
    position: relative;
}

/* --- Header --- */

.game-header {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    gap: 4px;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(20, 8, 8, 0.9);
    color: #ff4444;
    padding: 7px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.78rem;
    border: 1px solid rgba(255, 60, 60, 0.35);
    transition: background 0.2s;
    backdrop-filter: blur(8px);
    z-index: 20;
}

.back-btn:hover {
    background: rgba(255, 60, 60, 0.15);
}

.game-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 0 0 30px rgba(255, 50, 50, 0.5), 0 0 60px rgba(255, 50, 50, 0.15);
    text-align: center;
    letter-spacing: 0.1em;
}

.game-subtitle {
    font-size: 0.65rem;
    color: #ff555577;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    text-align: center;
}

/* --- Canvas --- */

#gameCanvas {
    display: block;
    border: 1px solid rgba(255, 50, 50, 0.35);
    border-radius: 6px;
    box-shadow:
        0 0 20px rgba(255, 40, 40, 0.12),
        0 0 60px rgba(255, 40, 40, 0.05);
    max-width: 100%;
    cursor: pointer;
}

/* --- Pause Button (Desktop) --- */

.pause-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(20, 8, 8, 0.9);
    border: 1px solid rgba(255, 60, 60, 0.35);
    color: #fff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 100;
    display: none;
    backdrop-filter: blur(8px);
}

.pause-btn:hover {
    background: rgba(255, 60, 60, 0.15);
}

/* --- Mobile Controls --- */

.mobile-controls {
    display: none;
    margin-top: 6px;
    width: 100%;
    max-width: 800px;
    padding: 0 4px;
}

.mobile-controls-inner {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.lane-btn {
    flex: 1;
    max-width: 200px;
    padding: 18px 10px;
    background: rgba(255, 50, 50, 0.08);
    border: 2px solid rgba(255, 50, 50, 0.35);
    border-radius: 10px;
    color: #ff6666;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    text-align: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, border-color 0.1s;
}

.lane-btn:active {
    background: rgba(255, 50, 50, 0.25);
    border-color: #ff4444;
}

.lane-btn .lane-label {
    display: block;
    font-size: 0.65rem;
    color: #ff444488;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.mobile-pause-row {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

.mobile-pause-btn {
    background: rgba(20, 8, 8, 0.9);
    border: 1px solid rgba(255, 60, 60, 0.3);
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}

/* --- Desktop Instructions --- */

.desktop-instructions {
    margin-top: 10px;
    text-align: center;
    color: #444;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* --- Start Screen --- */

.start-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}

.start-content {
    background: rgba(16, 8, 8, 0.95);
    border: 2px solid rgba(255, 50, 50, 0.4);
    border-radius: 14px;
    padding: 36px 34px;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 40, 40, 0.12);
    margin: 20px;
}

.start-title {
    font-size: 2rem;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 0 0 30px rgba(255, 50, 50, 0.5);
    margin-bottom: 4px;
    letter-spacing: 0.08em;
}

.start-tagline {
    font-size: 0.7rem;
    color: #ff555577;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    margin-bottom: 24px;
}

.start-description {
    color: #bbb;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.start-rules {
    text-align: left;
    color: #999;
    font-size: 0.85rem;
    line-height: 1.8;
    margin-bottom: 20px;
    padding: 0 10px;
}

.rule-red    { color: #ff6666; }
.rule-blue   { color: #5599ff; }
.rule-black  { color: #bb77ff; }

.start-warning {
    color: #ff6666;
    font-size: 0.85rem;
    font-style: italic;
    margin-bottom: 24px;
}

/* --- Game Over Screen --- */

.game-over-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}

.game-over-screen.active {
    display: flex;
}

.game-over-content {
    background: rgba(16, 8, 8, 0.95);
    border: 2px solid rgba(255, 50, 50, 0.4);
    border-radius: 14px;
    padding: 34px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 40, 40, 0.12);
    margin: 20px;
}

.game-over-title {
    font-size: 2rem;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 0 0 30px rgba(255, 50, 50, 0.5);
    margin-bottom: 20px;
    letter-spacing: 0.06em;
}

.final-stat {
    font-size: 1.15rem;
    color: #ccc;
    margin-bottom: 8px;
}

.final-stat span {
    color: #ff4444;
    font-weight: 900;
}

.vanity-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 18px 0;
    padding: 14px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(255, 50, 50, 0.15);
}

.vanity-stat {
    text-align: center;
}

.vanity-stat .vanity-label {
    display: block;
    font-size: 0.6rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.vanity-stat .vanity-value {
    display: block;
    font-size: 1rem;
    font-weight: 900;
    color: #ff5555;
}

.intercepted-hero {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffcc00;
    text-shadow: 0 0 20px rgba(255, 200, 0, 0.3);
    margin: 14px 0;
    letter-spacing: 0.02em;
}

.intercepted-sub {
    font-size: 0.8rem;
    color: #ff888888;
    margin-bottom: 14px;
}

.game-over-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 22px;
}

/* --- Buttons --- */

.game-btn {
    background: #ff3333;
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
    display: inline-block;
}

.game-btn:hover {
    background: #ff5050;
    transform: translateY(-1px);
}

.game-btn:active {
    transform: scale(0.97);
}

.game-btn.secondary {
    background: rgba(40, 20, 20, 0.9);
    border: 1px solid rgba(255, 60, 60, 0.4);
}

.game-btn.secondary:hover {
    background: rgba(60, 30, 30, 0.9);
}

.start-btn {
    font-size: 1.1rem;
    padding: 16px 44px;
    letter-spacing: 0.05em;
}

/* --- High Score / Submission --- */

.high-score-notice {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 200, 0, 0.08);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: 8px;
    color: #ffcc00;
    font-weight: 700;
    font-size: 0.9rem;
    display: none;
}

.high-score-notice.active { display: block; }

.score-submit-form {
    margin: 16px 0;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 50, 50, 0.2);
}

.submit-score-btn { width: 100%; margin-bottom: 6px; }
.submit-status { margin-top: 6px; font-size: 0.8rem; min-height: 18px; }
.submit-status.error   { color: #ff4444; }
.submit-status.success { color: #44bb44; }

/* --- Hidden Utilities --- */

.nav-actions { display: none !important; }
#leaderboard-content { display: none; }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .game-container {
        padding: 4px 4px 0;
        justify-content: flex-start;
    }

    .game-header {
        margin-bottom: 3px;
    }

    .back-btn {
        font-size: 0.62rem;
        padding: 4px 9px;
    }

    .game-title {
        font-size: 1rem;
        padding-top: 24px;
    }

    .game-subtitle {
        font-size: 0.55rem;
    }

    .pause-btn:not(.mobile-pause-btn) {
        display: none !important;
    }

    #gameCanvas {
        margin-bottom: 2px;
    }

    .mobile-controls {
        display: block;
    }

    .desktop-instructions {
        display: none;
    }

    .start-content,
    .game-over-content {
        padding: 24px 18px;
        margin: 12px;
    }

    .start-title {
        font-size: 1.5rem;
    }

    .start-description {
        font-size: 0.85rem;
    }

    .start-rules {
        font-size: 0.8rem;
    }

    .game-over-title {
        font-size: 1.6rem;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .game-btn {
        width: 100%;
    }

    .vanity-stats {
        gap: 8px;
    }

    .intercepted-hero {
        font-size: 1.3rem;
    }
}

@media (max-width: 400px) {
    .game-title {
        font-size: 0.9rem;
    }

    .lane-btn {
        padding: 14px 6px;
        font-size: 0.7rem;
    }
}
