/* ── RESET & BASE ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── STADIUM DESIGN TOKENS ── */
:root {
    /* Pitch & Stadium Theme */
    --stadium-dark: #040910;
    --pitch-green-dark: #071c14;
    --pitch-green-mid: #0b2e22;
    --pitch-green-light: #104735;
    --pitch-line-white: rgba(255, 255, 255, 0.45);
    
    /* Neon Accents */
    --stadium-gold: #fbbf24;
    --stadium-cyan: #38bdf8;
    --stadium-emerald: #34d399;
    --stadium-crimson: #f43f5e;
    --stadium-neon-lime: #a3e635;

    /* Glass Panels */
    --glass-bg: rgba(6, 18, 14, 0.85);
    --glass-border: rgba(52, 211, 153, 0.2);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── BODY STADIUM ATMOSPHERE ── */
body {
    background-color: var(--stadium-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.22) 0%, transparent 65%),
        radial-gradient(circle at 10% 20%, rgba(52, 211, 153, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 90% 20%, rgba(52, 211, 153, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 50% 100%, rgba(251, 191, 36, 0.12) 0%, transparent 60%),
        linear-gradient(180deg, #03070d 0%, #061611 40%, #081d16 70%, #020509 100%);
    background-size: 100% 100%;
    color: var(--text-primary);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Floodlight Beams */
body::before {
    content: '';
    position: fixed;
    top: -100px;
    left: -100px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(56, 189, 248, 0.12) 35%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    filter: blur(20px);
}

body::after {
    content: '';
    position: fixed;
    top: -100px;
    right: -100px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(52, 211, 153, 0.12) 35%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    filter: blur(20px);
}

/* ── STADIUM SCOREBOARD HEADER ── */
header.stadium-header {
    position: relative;
    z-index: 50;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: linear-gradient(180deg, rgba(8, 24, 18, 0.92) 0%, rgba(4, 12, 9, 0.95) 100%);
    border-bottom: 2px solid rgba(52, 211, 153, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(52, 211, 153, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ================= STANDARDIZED TEXT2 BRAND HEADER ================= */
.header-brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
    padding: 0;
    box-sizing: border-box;
}

.btn-back i,
.btn-back svg {
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateX(-2px);
    border-color: rgba(255, 255, 255, 0.45);
}

.btn-back:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

.brand-logo-card {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    padding: 3.5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.04);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #ffffff;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-divider {
    font-size: 14px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0.7;
    user-select: none;
}

.brand-app {
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: -0.01em;
    line-height: 1;
}

/* JUMBOTRON SCOREBOARD */
.score-area {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 16px;
    border-radius: 14px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-lbl {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.best-lbl {
    color: #fbbf24;
}

.score-val-wrap, .best-val-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.score-val-wrap {
    color: #38bdf8;
}

.best-val-wrap {
    color: #fbbf24;
}

.score-val, .best-val {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: 0.05em;
}

.icon-hdr-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring), background 0.2s;
}

.icon-hdr-btn:active {
    transform: scale(0.9);
}

/* ── MAIN CANVAS ARENA ── */
main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    z-index: 10;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    display: block;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    border-radius: 18px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.85),
        0 0 0 2px rgba(52, 211, 153, 0.3),
        0 0 30px rgba(52, 211, 153, 0.15);
}

/* ── COMBO & GOAL BANNER ── */
#combo-overlay {
    position: fixed;
    top: 26%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    text-align: center;
    transition: transform 0.35s var(--ease-spring), opacity 0.25s ease;
}

#combo-overlay.show {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.82);
}

.combo-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(6, 182, 212, 0.95));
    border: 2px solid #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 25px rgba(16, 185, 129, 0.6);
    border-radius: 16px;
    padding: 8px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.combo-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.combo-sub {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fde047;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    margin-top: 1px;
}

/* ── BOTTOM NAVIGATION ── */
nav.bottom-nav {
    position: relative;
    z-index: 50;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 16px;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(6, 18, 14, 0.92) 0%, rgba(3, 9, 7, 0.96) 100%);
    border-top: 2px solid rgba(52, 211, 153, 0.25);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s var(--ease-spring), background 0.2s;
}

.nav-btn:active {
    transform: scale(0.92);
}

.btn-new {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

.btn-shuffle {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.shuffle-badge {
    background: var(--stadium-gold);
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.btn-settings-nav {
    border-color: rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.15);
    color: #c084fc;
}

/* ── MODALS ── */
.modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-wrap.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 360px;
    background: linear-gradient(180deg, #0e221b 0%, #06120e 100%);
    border: 2px solid rgba(52, 211, 153, 0.3);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 30px rgba(52, 211, 153, 0.2);
    transform: scale(0.85);
    transition: transform 0.3s var(--ease-spring);
}

.modal-wrap.open .modal-card {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    color: #ffffff;
    text-align: center;
    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.setting-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.setting-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.setting-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    background: rgba(52, 211, 153, 0.2);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #34d399;
    padding: 4px 10px;
    border-radius: 8px;
}

.btn-danger {
    width: 100%;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #f43f5e;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 16px;
    transition: transform 0.2s var(--ease-spring);
}

.btn-danger:active {
    transform: scale(0.95);
}

.modal-footer {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 14px;
    font-weight: 700;
}

/* GAME OVER CARD */
.gameover-whistle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.18);
    border: 2px solid rgba(244, 63, 94, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
}

.gameover-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.35rem;
    font-weight: 900;
    color: #f43f5e;
    text-align: center;
    letter-spacing: 0.04em;
}

.gameover-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
}

.score-display-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 16px;
    text-align: center;
    margin-bottom: 20px;
}

.score-display-lbl {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.score-display-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: #38bdf8;
    margin-top: 4px;
}

.new-record-tag {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 4px 14px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 6px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}

.new-record-tag.hidden {
    display: none;
}

.btn-try-again {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 14px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s var(--ease-spring);
}

.btn-try-again:active {
    transform: scale(0.95);
}

/* RESPONSIVE */
@media (max-width: 640px) {
    .btn-back {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 16px;
    }

    .brand-logo-card {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        padding: 3px;
    }

    .brand-name {
        font-size: 17px;
    }

    .brand-divider {
        font-size: 13px;
    }

    .brand-app {
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    header.stadium-header {
        padding: 0 8px;
    }
    .score-area {
        gap: 8px;
        padding: 3px 8px;
    }
    .nav-btn span {
        font-size: 0.75rem;
    }
}