/* =============================================================================
   DEBT RUNNER v2.0 — Styles
   Forward-perspective endless runner · $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;
    -webkit-font-smoothing: antialiased;
}

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

.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;
}

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

.back-btn {
    position: absolute; left: 0; top: 0;
    background: rgba(16,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.3);
    backdrop-filter: blur(6px); z-index: 20;
}
.back-btn:hover { background: rgba(255,60,60,0.12); }

.game-title {
    font-size: 1.5rem; font-weight: 900; color: #ff3333;
    text-shadow: 0 0 30px rgba(255,50,50,0.5);
    text-align: center; letter-spacing: 0.1em;
}
.game-subtitle {
    font-size: 0.6rem; color: #ff555566;
    text-transform: uppercase; letter-spacing: 0.3em; text-align: center;
}

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

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

.mobile-controls {
    display: none; margin-top: 6px; width: 100%; max-width: 800px;
    padding: 0 4px; gap: 6px; flex-direction: column; align-items: center;
}
.mobile-pause-row { display: flex; justify-content: center; margin-bottom: 4px; }
.mobile-pause-btn {
    background: rgba(16,8,8,0.9); border: 1px solid rgba(255,60,60,0.25);
    color: #fff; padding: 6px 16px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 700; font-family: 'Inter', sans-serif;
    cursor: pointer; touch-action: manipulation;
}
.mobile-hint { font-size: 0.7rem; color: #ff444455; text-align: center; letter-spacing: 0.05em; }

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

/* --- Screens --- */

.start-screen, .game-over-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;
}
.game-over-screen { display: none; }
.game-over-screen.active { display: flex; }

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

.start-title {
    font-size: 2.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.65rem; color: #ff555566; text-transform: uppercase; letter-spacing: 0.25em; margin-bottom: 22px; }
.start-description { color: #bbb; font-size: 0.95rem; line-height: 1.7; margin-bottom: 18px; }
.start-mechanics { text-align: left; color: #999; font-size: 0.85rem; line-height: 1.9; margin-bottom: 18px; padding: 0 10px; }
.start-mechanics strong { color: #ff6666; }
.start-flavor { color: #ff666688; font-size: 0.8rem; font-style: italic; margin-bottom: 22px; }

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

.vanity-stats {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
    margin: 16px 0; padding: 12px; background: rgba(0,0,0,0.4);
    border-radius: 8px; border: 1px solid rgba(255,50,50,0.12);
}
.vanity-stat { text-align: center; }
.vanity-stat .vanity-label { display: block; font-size: 0.55rem; color: #666; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 3px; }
.vanity-stat .vanity-value { display: block; font-size: 0.9rem; font-weight: 900; color: #ff5555; }

.hero-stat { font-size: 1.4rem; font-weight: 900; color: #ffcc00; text-shadow: 0 0 15px rgba(255,200,0,0.3); margin: 12px 0 4px; }
.hero-stat-sub { font-size: 0.7rem; color: #ff888866; margin-bottom: 12px; }

.almost-message {
    font-size: 0.85rem; color: #ffcc00; font-weight: 700;
    padding: 8px 14px; margin: 8px 0 4px;
    background: rgba(255,200,0,0.06); border: 1px solid rgba(255,200,0,0.2);
    border-radius: 6px; font-style: italic;
}

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

.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.35); }
.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-notice {
    margin-top: 14px; padding: 10px 14px; background: rgba(255,200,0,0.08);
    border: 1px solid rgba(255,200,0,0.25); border-radius: 8px;
    color: #ffcc00; font-weight: 700; font-size: 0.85rem; display: none;
}
.high-score-notice.active { display: block; }
.score-submit-form { margin: 14px 0; padding: 12px; background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px solid rgba(255,50,50,0.15); }
.submit-score-btn { width: 100%; margin-bottom: 6px; }
.submit-status { margin-top: 6px; font-size: 0.8rem; min-height: 16px; }
.submit-status.error { color: #ff4444; }
.submit-status.success { color: #44bb44; }

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

@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.6rem; padding: 4px 8px; }
    .game-title { font-size: 1.05rem; padding-top: 22px; }
    .game-subtitle { font-size: 0.5rem; }
    .pause-btn:not(.mobile-pause-btn) { display: none !important; }
    .mobile-controls { display: flex; }
    .desktop-instructions { display: none; }
    .start-content, .game-over-content { padding: 22px 16px; margin: 10px; }
    .start-title { font-size: 1.6rem; }
    .game-over-title { font-size: 1.5rem; }
    .game-over-buttons { flex-direction: column; }
    .game-btn { width: 100%; }
    .vanity-stats { gap: 6px; }
    .vanity-stat .vanity-value { font-size: 0.8rem; }
}
@media (max-width: 400px) { .game-title { font-size: 0.9rem; } .vanity-stats { grid-template-columns: 1fr 1fr; } }
