/* ============================================================
   DOODLE JUMP — INSOMNIACT EDITION v4
   Performance-first · Fixed visuals · Combo x2 works
   ============================================================ */

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: src: url('../font/PlusJakartaSans-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../font/SpaceGrotesk-Variable.woff2') format('woff2'),
}

:root {
    --bg-base:      #07070c;
    --bg-elev-1:    #0e0e15;
    --bg-elev-2:    #15151f;
    --bg-elev-3:    #1c1c28;
    --bg-void:      #06060a;
    --bg-glass:     rgba(22, 22, 31, 0.6);

    --text-primary:   #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-muted:     #8f8f9e;

    --gold:       #facc15;
    --gold-soft:  #fde047;
    --gold-dark:  #ca8a04;
    --cyan:       #22d3ee;
    --purple:     #8b5cf6;
    --green:      #22c55e;
    --red:        #ef4444;
    --orange:     #f97316;
    --pink:       #ec4899;

    --border-soft: rgba(255, 255, 255, 0.06);
    --border-mid:  rgba(255, 255, 255, 0.10);
    --border-hi:   rgba(250, 204, 21, 0.35);

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;

    --container: 1280px;

    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
}

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: clip;
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 10px;
    border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-soft); }
::selection { background: var(--gold); color: #0a0a0f; }

.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    pointer-events: none;
}
.icon-brand {
    fill: currentColor;
    stroke: none;
}

.container-global {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.35);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.35s ease, border-color 0.35s ease;
}
.navbar.scrolled {
    background: rgba(10, 10, 15, 0.62);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo{width:36px;height:36px;border-radius:50%;object-fit:cover;border:1.5px solid var(--gold);box-shadow:0 0 20px rgba(250,204,21,0.35);transition:transform 0.4s var(--ease-spring)} /* ← BARU */
.brand:hover .brand-logo{transform:rotate(360deg) scale(1.08)} /* ← BARU */
.brand:active .brand-logo{transform:rotate(360deg) scale(1.08)} /* ← BARU */
.brand-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.02em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding: 6px 0;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.25s ease, background 0.25s ease;
    white-space: nowrap;
}
.nav-link .icon { font-size: 13px; width: 13px; height: 13px; opacity: 0.8; }
.nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.nav-link.active {
    color: var(--bg-void);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(250, 204, 21, 0.3);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-soft);
}
.hamburger span {
    display: block;
    width: 20px; height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.hamburger:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 1024px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .nav-links.open {
        display: flex;
        position: fixed;
        top: calc(68px + env(safe-area-inset-top, 0px) + 12px); left: 24px; right: 24px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 16px;
        border-radius: 24px;
        background: rgba(10, 10, 18, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid var(--border-mid);
        animation: menuIn 0.35s var(--ease-out);
        z-index: 200;
        max-height: calc(100vh - 108px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    @keyframes menuIn {
        from { opacity: 0; transform: translateY(-12px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .nav-link { padding: 14px 16px; border-radius: 10px; justify-content: flex-start; }
}

/* ============================================================
   BACK TO HUB
   ============================================================ */
.back-to-hub {
    position: fixed;
    top: calc(88px + env(safe-area-inset-top, 0px)); left: calc(24px + env(safe-area-inset-left, 0px));
    z-index: 90;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(16, 16, 24, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-mid);
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.25s ease, border-color 0.25s ease,
                transform 0.25s ease, background 0.25s ease;
    cursor: pointer;
}
.back-to-hub .icon { font-size: 14px; width: 14px; height: 14px; transition: transform 0.25s ease; }
.back-to-hub:hover {
    color: var(--gold);
    border-color: var(--border-hi);
    background: rgba(16, 16, 24, 0.95);
    transform: translateY(-2px);
}
.back-to-hub:hover .icon { transform: translateX(-4px); }
.back-to-hub:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@keyframes nudge-left {
    0%, 100% { transform: translateX(0); }
    30%      { transform: translateX(-4px); }
    60%      { transform: translateX(0); }
}
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(250, 204, 21, 0); }
    100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

@media (max-width: 640px) {
    .back-to-hub {
    top: calc(80px + env(safe-area-inset-top, 0px)); left: calc(12px + env(safe-area-inset-left, 0px));
        width: 44px; height: 44px;
        padding: 0; gap: 0;
        animation: pulse-ring 2s ease-out infinite;
    }
    .back-to-hub .back-label { display: none; }
    .back-to-hub .icon { font-size: 16px; width: 16px; height: 16px; animation: nudge-left 2s ease-in-out infinite; }
    .back-to-hub:active, .back-to-hub:active .icon { animation: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    position: relative;
    padding: 50px 0 30px;
    overflow: hidden;
    isolation: isolate;
    text-align: center;
}
.hero-grid-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
    z-index: -2;
    pointer-events: none;
}
.hero-glow { position: absolute; border-radius: 50%; filter: blur(120px); z-index: -1; pointer-events: none; }
.hero-glow-1 { width: 500px; height: 500px; top: -100px; left: -100px; background: rgba(250, 204, 21, 0.12); }
.hero-glow-2 { width: 600px; height: 600px; bottom: -200px; right: -150px; background: rgba(139, 92, 246, 0.12); }

.hero-content { max-width: 800px; margin: 0 auto; padding: 0 24px; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid var(--border-hi);
    color: var(--gold);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 18px;
}
.badge .icon { font-size: 14px; width: 14px; height: 14px; }
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 52px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}
.gradient-text {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hero-desc {
    font-size: clamp(14px, 1.5vw, 16px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ============================================================
   GAME SECTION
   ============================================================ */
.game-section {
    padding: 16px 20px 80px;
    flex: 1;
}

.game-layout {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

/* ========== GAME PANEL ========== */
.game-panel {
    position: relative;
    padding: 20px;
    background:
        radial-gradient(circle at 18% 8%, rgba(250,204,21,.06), transparent 32%),
        radial-gradient(circle at 88% 82%, rgba(139,92,246,.07), transparent 34%),
        rgba(16,16,24,.78);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: var(--r-xl);
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
    /* ✅ FIX: aspect 2:3 — match W=360,H=540 */
    aspect-ratio: 2 / 3;
    margin: 0 auto;
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(250, 204, 21, 0.15),
        0 0 60px rgba(250, 204, 21, 0.08);
    background: #0a0f1e;
    touch-action: none;
}

canvas#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    /* ✅ FIX: hapus crisp-edges — game ini vector, bukan pixel art */
}

/* ========== HUD ========== */
.game-hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    pointer-events: none;
    z-index: 5;
}
.hud-item {
    display: flex;
    flex-direction: column;
    background: rgba(7, 7, 12, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-md);
    padding: 6px 12px;
}
.hud-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2px;
}
.hud-value {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.hud-value.best {
    color: var(--gold);
    text-shadow: 0 0 12px rgba(250, 204, 21, 0.4);
}

.combo-badge {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #0a0a0f;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 16px rgba(250, 204, 21, 0.5);
    transition: transform 0.3s var(--ease-spring);
    z-index: 8;
    pointer-events: none;
}
.combo-badge.active {
    transform: translateX(-50%) scale(1);
    animation: comboPulse 1.2s ease-in-out infinite;
}
@keyframes comboPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(250, 204, 21, 0.5); }
    50%      { box-shadow: 0 4px 28px rgba(250, 204, 21, 0.85); }
}

/* ✅ FIX: top-bar z-index dinaikkan agar tetap accessible saat overlay terbuka */
.top-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 25;
}
.icon-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 7, 12, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease,
                color 0.25s ease, transform 0.25s var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.icon-btn .icon { width: 14px; height: 14px; }
.icon-btn:hover {
    background: rgba(250, 204, 21, 0.15);
    border-color: var(--border-hi);
    color: var(--gold);
    transform: translateY(-2px);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.hud-score-pop {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.8), 0 2px 0 rgba(0,0,0,0.5);
    pointer-events: none;
    opacity: 0;
    z-index: 10;
    white-space: nowrap;
}
.hud-score-pop.pop { animation: scorePop 1.2s var(--ease-out); }
@keyframes scorePop {
    0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.5); }
    20%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.2); }
    70%  { opacity: 1; transform: translateX(-50%) translateY(-40px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(0.9); }
}

/* ========== OVERLAY ========== */
/* ✅ FIX: visibility transition delay */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    background: radial-gradient(circle at 50% 30%, rgba(250, 204, 21, 0.08), rgba(7, 7, 12, 0.92) 60%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 20;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0s 0s;
}
.overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0s 0.35s;
}
.overlay-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
    filter: drop-shadow(0 4px 20px rgba(250, 204, 21, 0.4));
    animation: iconBounce 1.2s ease-in-out infinite;
}
@keyframes iconBounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%      { transform: translateY(-8px) rotate(3deg); }
}
.overlay-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 7vw, 38px);
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 40%, var(--purple) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: gradientShift 5s ease infinite;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.overlay-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 300px;
    line-height: 1.6;
}

.keys-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.key-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(180deg, var(--bg-elev-3), var(--bg-elev-2));
    color: var(--gold);
    border: 1px solid var(--border-mid);
    border-bottom-width: 3px;
    border-radius: 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.key-sep { color: var(--text-muted); font-size: 11px; font-weight: 600; }

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    margin-bottom: 20px;
}
.result-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 12px 8px;
    text-align: center;
}
.result-stat-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 4px;
}
.result-stat-value.best { color: var(--cyan); }
.result-stat-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ========== BUTTONS ========== */
.btn-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 36px;
    min-height: 52px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
    color: #0a0a0f;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(250, 204, 21, 0.35), 0 4px 0 var(--gold-dark);
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn-play .icon { width: 15px; height: 15px; }
.btn-play::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    z-index: -1;
}
.btn-play:hover::before { transform: translateX(100%); }
.btn-play:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(250, 204, 21, 0.5), 0 6px 0 var(--gold-dark);
}
.btn-play:active {
    transform: translateY(2px);
    box-shadow: 0 4px 20px rgba(250, 204, 21, 0.3), 0 2px 0 var(--gold-dark);
}
.btn-play:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

/* ========== MOBILE CONTROLS ========== */
.mobile-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 6;
}
.ctrl-btn {
    pointer-events: auto;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(7, 7, 12, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
}
.ctrl-btn:active,
.ctrl-btn.active {
    background: rgba(250, 204, 21, 0.85);
    border-color: var(--gold);
    color: #0a0a0f;
    transform: scale(0.92);
}

@media (min-width: 821px) {
    .mobile-controls { display: none !important; }
}

@media (max-width: 820px) {
    .mobile-controls { display: flex; }
}

@media (max-width: 640px) {
    .ctrl-btn { width: 60px; height: 60px; font-size: 22px; }
    .mobile-controls { padding: 12px 16px; }
}

/* ============================================================
   SIDE PANEL
   ============================================================ */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 88px;
}

.panel-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 16px;
}
.panel-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-soft);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-title .icon { color: var(--gold); width: 14px; height: 14px; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 10px 8px;
    text-align: center;
}
.stat-box-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.stat-box-value.gold { color: var(--gold); }
.stat-box-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 3px;
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    transition: background 0.2s ease;
}
.lb-row:hover { background: rgba(255, 255, 255, 0.05); }
.lb-rank {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.lb-row.top-1 .lb-rank { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0a0a0f; }
.lb-row.top-2 .lb-rank { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #0a0a0f; }
.lb-row.top-3 .lb-rank { background: linear-gradient(135deg, #d97706, #92400e); color: #fff; }
.lb-score {
    margin-left: auto;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--gold);
}
.lb-empty {
    text-align: center;
    padding: 16px 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.ach-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.ach-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.3s ease, border-color 0.3s ease,
                color 0.3s ease, opacity 0.3s ease;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
}
.ach-badge .ach-icon {
    font-size: 1rem;
    filter: grayscale(1) opacity(0.5);
    transition: filter 0.3s ease;
}
.ach-badge.locked { opacity: 0.55; }
.ach-badge.unlocked {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), rgba(34, 197, 94, 0.06));
    border-color: rgba(74, 222, 128, 0.35);
    color: #4ade80;
    opacity: 1;
}
.ach-badge.unlocked .ach-icon { filter: none; }
.ach-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.theme-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--r-sm);
    border: 2px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease,
                color 0.25s ease, transform 0.25s ease;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-body);
    touch-action: manipulation;
}
.theme-btn:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.theme-btn.active {
    border-color: var(--gold);
    background: rgba(250, 204, 21, 0.08);
    color: var(--gold);
}
.theme-swatch {
    width: 100%;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.2);
}
.theme-swatch.space  { background: linear-gradient(135deg, #0a0f1e 0%, #1a1a2e 50%, #07070c 100%); }
.theme-swatch.sunset { background: linear-gradient(135deg, #ff6b6b 0%, #f97316 50%, #7c2d12 100%); }
.theme-swatch.forest { background: linear-gradient(135deg, #166534 0%, #15803d 50%, #052e16 100%); }
.theme-swatch.ocean  { background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #082f49 100%); }

/* ========== INFO CHIPS ========== */
.game-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    width: 100%;
}
.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-soft);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.info-chip .icon { color: var(--gold); width: 12px; height: 12px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    background: var(--bg-elev-1);
    padding-top: 64px;
    margin-top: auto;
    position: relative;
    overflow: hidden;
}
.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--gold-dark) 20%, var(--gold) 50%, var(--gold-dark) 80%, transparent 100%);
    opacity: 0.6;
    animation: shimmer 4s ease-in-out infinite;
    z-index: 2;
}
@keyframes shimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.85; }
}
.footer::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(250, 204, 21, 0.45), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.30), transparent),
        radial-gradient(1px 1px at 80% 20%, rgba(34, 211, 238, 0.35), transparent),
        radial-gradient(1.5px 1.5px at 40% 80%, rgba(250, 204, 21, 0.35), transparent),
        radial-gradient(1px 1px at 10% 60%, rgba(255, 255, 255, 0.22), transparent),
        radial-gradient(1px 1px at 90% 85%, rgba(250, 204, 21, 0.28), transparent);
    background-size: 200% 200%;
    pointer-events: none;
    opacity: 0.5;
    animation: twinkle 8s ease-in-out infinite;
    z-index: 0;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.65; }
}
.footer > .container-global,
.footer-grid,
.footer-bottom { position: relative; z-index: 1; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
}
.footer-brand .brand { margin-bottom: 14px; }
.footer-brand .brand-logo { position: relative; animation: glow-pulse 3s ease-in-out infinite; }
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 16px rgba(250, 204, 21, 0.3); }
    50% { box-shadow: 0 0 28px rgba(250, 204, 21, 0.65); }
}
.footer-desc { color: var(--text-secondary); font-size: 14px; max-width: 300px; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 5px 12px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #4ade80;
    letter-spacing: 0.02em;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
.footer-col h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 16px;
}
.footer-col h4 .col-num {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.6;
    letter-spacing: 0;
}
.footer-col h4::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--gold-soft), transparent);
}
.footer-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}
.no-js [data-aos] {
    opacity: 1 !important;
    transform: none !important;
}
.footer-col a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 6px 0;
    margin-right: 0;
    transition: color 0.25s ease, gap 0.25s ease;
}
.footer-col a::before {
    content: '→';
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    color: var(--gold);
    font-size: 12px;
}
.footer-col a:hover { color: var(--gold); gap: 6px; }
.footer-col a:hover::before { opacity: 1; transform: translateX(0); }
.footer-col a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.footer-col a.footer-current {
    color: var(--gold);
    cursor: default;
    pointer-events: none;
    font-weight: 600;
}
.footer-current::before {
    content: '→';
    visibility: hidden;
    font-size: 12px;
    flex: 0 0 auto;
}
.socials {
    display: flex;
    gap: 12px;
    align-items: center;
}
.socials a {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elev-2);
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    transition: background 0.25s ease, color 0.25s ease,
                border-color 0.25s ease, transform 0.25s ease;
}
.socials a::before { content: none; display: none; }
.socials a .icon {
    display: block;
    width: 16px;
    height: 16px;
}
.socials a:hover {
    background: var(--gold);
    color: var(--bg-base);
    border-color: var(--gold);
    transform: translateY(-3px);
}
.socials a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.footer-bottom {
    border-top: 1px solid var(--border-soft);
    padding: 24px 0;
}
.footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}
.footer-credit strong { color: var(--gold); font-weight: 600; }
.footer-credit .icon {
    color: #ef4444;
    margin: 0 2px;
    width: 1em;
    height: 1em;
    display: inline-block;
    animation: heartbeat 1.4s ease-in-out infinite;
}
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.25); }
    30% { transform: scale(1); }
    45% { transform: scale(1.2); }
}
@media(max-width:860px) {
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media(max-width:520px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom-inner { justify-content: center; text-align: center; }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    padding: 0.7rem 1.4rem;
    border-radius: var(--r-md);
    background: rgba(16, 16, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    z-index: 10000;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.45s ease;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border: 1px solid rgba(74, 222, 128, 0.35); }
.toast.error   { border: 1px solid rgba(248, 113, 113, 0.35); }
.toast.info    { border: 1px solid rgba(250, 204, 21, 0.35); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
    .game-layout {
        grid-template-columns: 1fr;
        max-width: 560px;
    }
    .side-panel { position: static; }
}

@media (max-width: 640px) {
    .hero { padding: 100px 0 20px; }
    .game-section { padding: 8px 12px 60px; }
    .game-panel { padding: 12px; border-radius: var(--r-lg); }
    .game-layout { gap: 16px; }
    .overlay { padding: 24px 16px; }
    .overlay-icon { font-size: 2.5rem; }
    .hud-item { padding: 5px 10px; }
    .hud-value { font-size: 18px; }
    .top-bar { top: 10px; }
    .icon-btn { width: 32px; height: 32px; }
    .icon-btn .icon { width: 12px; height: 12px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .footer::before,
    .footer::after,
    .footer-brand .brand-logo,
    .status-dot,
    .footer-credit .icon,
    .overlay-icon,
    .overlay-title,
    .combo-badge,
    .back-to-hub,
    .back-to-hub .icon {
        animation: none !important;
    }
}

/* ===== Extracted inline styles ===== */


/* Extracted inline style attributes */
.inline-style-1 {display:none}
.inline-style-2 {position:fixed;top:0;left:0;right:0;padding:14px 20px;background:#7f1d1d;color:#fff;text-align:center;font-size:14px;font-weight:600;z-index:99999;}
