* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  :root {
    /* ── Backgrounds ─────────────────────────────── */
    --bg-sky:        oklch(0.84 0.086 221);   /* var(--bg-sky) */
    --bg-sky-light:  oklch(0.91 0.054 220);   /* var(--bg-sky-light) */
    --bg-cream:      oklch(0.96 0.017 80);    /* var(--bg-cream) */
    --bg-body:       #1a1a2e;

    /* ── Text — OKLCH tiers, all pass 4.5:1 on glass surfaces ── */
    --text-primary:   oklch(0.18 0.07 258);   /* deep navy  ~17:1 */
    --text-secondary: oklch(0.38 0.09 248);   /* mid navy   ~6.6:1 */
    --text-muted:     oklch(0.45 0.09 245);   /* light navy ~4.7:1 */

    /* ── Brand colours ───────────────────────────── */
    --color-blue-text:  oklch(0.44 0.104 237); /* var(--color-blue-text) */
    --color-orange:     oklch(0.76 0.164 67);  /* #F5A623 */
    --color-orange-dk:  oklch(0.60 0.16  67);  /* #d4880a */
    --color-green:      oklch(0.62 0.170 147); /* var(--color-green) */
    --color-green-dk:   oklch(0.49 0.131 147); /* var(--color-green-dk) */
    --color-blue:       oklch(0.79 0.121 215); /* var(--color-blue) */
    --color-blue-dk:    oklch(0.63 0.108 218); /* var(--color-blue-dk) */
    --color-navy:       oklch(0.54 0.089 228); /* var(--color-navy) */
    --color-navy-dk:    oklch(0.42 0.083 231); /* var(--color-navy-dk) */
    --color-blue-mid:   oklch(0.65 0.123 222); /* var(--color-blue-mid) */
    --color-red:        oklch(0.57 0.194 27);  /* var(--color-red) */
    --color-red-dk:     oklch(0.47 0.182 27);  /* #c0392b */
    --color-danger:     oklch(0.55 0.208 33);  /* var(--color-danger) */
    --color-fire:       oklch(0.69 0.207 55);  /* var(--color-fire) */
    --color-insane:     oklch(0.52 0.305 326); /* var(--color-insane) */

    /* ── Surfaces — three-tier material system ─────── */
    --surface-ghost:  rgba(255,255,255,0.12);  /* Tier 3: stat cards, info-only */
    --surface-low:    rgba(255,255,255,0.28);  /* Tier 2: rows, secondary actions */
    --surface:        rgba(255,255,255,0.32);  /* Tier 2: panels, result boxes, cards */
    --surface-mid:    rgba(255,255,255,0.42);  /* Tier 2+: interactive secondary */
    --surface-solid:  #ffffff;                 /* Tier 1: HUD, overlays, dialogs */

    /* ── Shadows ─────────────────────────────────── */
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:  0 20px 40px rgba(0,0,0,0.10);

    /* ── Borders ─────────────────────────────────── */
    --border:        rgba(255,255,255,0.70);
    --border-strong: rgba(255,255,255,0.82);

    /* ── Typography ──────────────────────────────── */
    --display-font: "Teko", "Arial Narrow", Arial, sans-serif;

    /* ── Easing ──────────────────────────────────── */
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  }

  :focus-visible {
    outline: 3px solid var(--color-orange);
    outline-offset: 2px;
    border-radius: 4px;
  }

  @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;
    }
  }

  @font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-ExtraBold.ttf") format("truetype");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "Nunito";
    src: url("../fonts/Nunito-Black.ttf") format("truetype");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
  }

  :root {
    --app-font: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --app-height: 100vh;
  }

  /* Prevent long press context menu and text selection on buttons */
  button, .menu-btn, .icon-btn, .btn-plus1, .btn-plus5, .btn-lock, .b-card, .daily-banner {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
  }

  /* Prevent selection on the whole phone */
  .phone {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  body {
    font-family: var(--app-font);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--app-height);
    background: #1a1a2e;
    overflow: hidden;
  }

  .phone {
    width: min(480px, 92vw);
    height: min(calc(100vh - 60px), min(calc(100dvh - 60px), 900px));
    background: linear-gradient(170deg, var(--bg-sky) 0%, var(--bg-sky-light) 40%, var(--bg-cream) 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    position: relative;
    overflow: hidden;
  }

  /* Mobile — fill full screen, account for browser chrome */
  @media (hover: none) and (pointer: coarse), (max-width: 900px) and (orientation: portrait) {
    html {
      height: 100%;
      height: 100dvh;
      height: var(--app-height);
      overflow: hidden;
    }
    html, body {
      height: 100%;
      height: 100dvh;
      height: var(--app-height);
      overflow: hidden;
    }
    body {
      background: linear-gradient(170deg, var(--bg-sky) 0%, var(--bg-sky-light) 40%, var(--bg-cream) 100%);
      align-items: flex-start;
      padding: 0;
    }
    .phone {
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      height: var(--app-height);
      min-height: var(--app-height);
      border-radius: 0;
      box-shadow: none;
      transform: none !important;
    }
    .screen {
      padding: calc(18px + env(safe-area-inset-top)) 24px max(28px, calc(18px + env(safe-area-inset-bottom))) !important;
    }
  }
  
  .bg-flash { position: absolute; top:0; left:0; width:100%; height:100%; background: linear-gradient(170deg, var(--color-fire) 0%, var(--color-orange) 100%); opacity: 0; transition: opacity 0.4s ease-out; z-index: 0; }
  .bg-flash.show { opacity: 0.4; }
  .damage-overlay { position: absolute; top:0; left:0; width:100%; height:100%; box-shadow: inset 0 0 0 rgba(231,76,60,0); transition: box-shadow 0.2s; z-index: 90; pointer-events: none; }
  .damage-overlay.flash { box-shadow: inset 0 0 60px rgba(231,76,60,0.8); }

  .floating-numbers { position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; overflow: hidden; z-index: 1;}
  .float-num { position: absolute; font-size: 26px; font-weight: 900; opacity: 0.03; color: var(--color-blue-text); animation: floatUp linear infinite; }
  @keyframes floatUp { 0% { transform: translateY(900px) rotate(-10deg); opacity: 0; } 10% { opacity: 0.03; } 90% { opacity: 0.03; } 100% { transform: translateY(-100px) rotate(10deg); opacity: 0; } }

  .screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column;
    padding: 50px 30px 55px;
    padding-bottom: max(55px, calc(55px + env(safe-area-inset-bottom)));
    z-index: 10;
    transition: transform 0.35s var(--ease-out-quint);
    overflow: hidden;
  }
  .screen.active { transform: translateX(0); }
  .screen.left { transform: translateX(-100%); }
  .screen.right { transform: translateX(100%); }

  /* ================================ */
  /* HOME SCREEN — Option A           */
  /* ================================ */
  /* Logo */
  .logo-glow {
    position: absolute;
    width: 88px; height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91,200,245,0.35) 0%, transparent 70%);
    animation: glowPulse 2s ease-in-out infinite;
  }
  @keyframes glowPulse { 0%,100% { opacity:0.4; } 50% { opacity:0.75; } }
  .logo-float { animation: logoFloat 5s ease-in-out infinite; }
  @keyframes logoFloat { 0%,100% { transform:translateY(0) rotate(-1deg); } 50% { transform:translateY(-6px) rotate(1deg); } }

  .player-name-row {
    display: grid;
    grid-template-columns: 1fr 70px;
    gap: 8px;
  }
  .player-name-row input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 2px solid rgba(42,100,150,0.20);
    background: oklch(0.97 0.012 220);
    color: var(--text-primary);
    font-family: var(--app-font);
    font-size: 15px;
    font-weight: 900;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
  }
  .player-name-row input:focus {
    border-color: var(--color-orange);
    outline: none;
  }
  .player-name-row button {
    min-height: 44px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: var(--color-navy);
    box-shadow: 0 4px 0 var(--color-navy-dk);
    color: white;
    font-family: var(--app-font);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s;
  }
  .player-name-row button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--color-navy-dk);
  }
  .player-name-status {
    min-height: 16px;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .menu-btn {
    width: 100%;
    border: none;
    font-family: var(--app-font);
    font-weight: 900;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: filter 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .menu-btn.primary {
    height: 66px;
    border-radius: 18px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.14);
    margin-bottom: 0;
  }

  #btnPlayEndless { background: var(--color-blue); }
  #btnPlayDaily   { background: linear-gradient(135deg, #2ecc71, #1abc9c); }

  .menu-btn.secondary {
    height: 56px;
    border-radius: 14px;
    font-size: 16px;
    background: var(--color-blue);
    box-shadow: 0 5px 0 var(--color-blue-dk);
    margin-bottom: 0;
    gap: 2px;
  }
  .menu-btn.secondary:active { box-shadow: 0 2px 0 var(--color-blue-dk); }
  .menu-btn.secondary small { font-size: 12px; opacity: 0.85; letter-spacing: 2px; }

  .menu-btn.locked {
    background: rgba(255,255,255,0.3);
    box-shadow: 0 4px 0 rgba(0,0,0,0.06);
    color: var(--text-secondary);
    border: 2px solid rgba(255,255,255,0.6);
    pointer-events: none;
    text-shadow: none;
  }

  .icon-btn {
    flex: 1;
    height: 44px;
    border-radius: 14px;
    border: none;
    font-family: var(--app-font);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    background: rgba(255,255,255,0.35);
    border: 2px solid rgba(255,255,255,0.65);
    color: var(--color-blue-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: transform 0.08s, background 0.2s;
    text-shadow: none;
  }
  .icon-btn:active { transform: scale(0.96); }

  .btn-exit-game { cursor: pointer; transition: background 0.12s; }
  .btn-exit-game:active { background: rgba(42,100,150,0.14); }
  .exit-icon { font-size: 20px; line-height: 1; }
  .exit-label { font-size: 12px; font-weight: 900; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px; }

  .score-box-value { transition: color 0.3s; }
  .score-box-value.daily-mode { color: var(--color-fire); } 
  
  .timer-label { transition: color 0.3s; font-variant-numeric: tabular-nums; }
  .timer-label span { font-family: var(--display-font); font-size: 20px; color: var(--color-navy); transition: color 0.3s; font-variant-numeric: tabular-nums; }
  @keyframes pulseText { 0% { transform: scale(1); text-shadow: 0 0 10px rgba(232, 58, 26, 0.4); } 100% { transform: scale(1.05); text-shadow: 0 0 20px rgba(232, 58, 26, 0.8); } }
  .timer-label.danger { color: var(--color-danger); display: block; animation: pulseText 0.4s infinite alternate; }
  .timer-label.danger span { color: var(--color-danger); }
  @keyframes shakeTimer { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-4px); } }
  .timer-label.shake { animation: shakeTimer 0.3s ease; color: var(--color-red); }
  .timer-label.shake span { color: var(--color-red); }
  
  .timer-bar-bg { width: 100%; height: 18px; background: rgba(255,255,255,0.34); border-radius: 999px; overflow: hidden; border: 2px solid rgba(255,255,255,0.62); }
  .timer-bar-bg:has(.danger) { animation: barDangerGlow 0.45s ease-in-out infinite alternate; }
  @keyframes barDangerGlow { 0% { filter: drop-shadow(0 0 3px rgba(231,76,60,0.3)); } 100% { filter: drop-shadow(0 0 14px rgba(231,76,60,0.9)); } }
  .timer-bar-fill { height: 100%; background: linear-gradient(90deg, var(--color-blue), var(--color-blue-mid)); border-radius: 999px; transition: transform 0.08s linear, background 0.3s; transform-origin: left center; transform: scaleX(1); width: 100%; will-change: transform; position: relative; overflow: hidden; }
  .timer-bar-fill::after { content: ''; position: absolute; top: 0; left: -60%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.38), transparent); animation: shimmerSweep 2.5s ease-in-out infinite; }
  @keyframes shimmerSweep { 0% { left: -60%; } 100% { left: 160%; } }
  .timer-bar-fill.warning { background: linear-gradient(90deg, #f5c623, #e8a21a); }
  .timer-bar-fill.danger  { background: linear-gradient(90deg, #f55c23, var(--color-danger)); }
  .timer-bar-fill.daily   { background: linear-gradient(90deg, var(--color-green), #2ecc71); }

  .question-text { display: inline-flex; align-items: center; justify-content: center; gap: 12px; line-height: 1; }
  .question-text .n1, .question-text .n2 { font-family: var(--display-font); display: inline-block; opacity: 0; font-size: clamp(72px, 14dvh, 110px); font-weight: 900; color: var(--color-blue-text); letter-spacing: -2px; }
  .question-text .operator { display: inline-block; opacity: 0; font-size: clamp(48px, 9dvh, 72px); font-weight: 900; color: var(--color-orange); margin-bottom: 4px; }
  @keyframes slideInLeft { 0% { transform: translateX(-30px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
  @keyframes slideInRight { 0% { transform: translateX(30px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
  @keyframes popIn { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
  .question-text.animate .n1 { animation: slideInLeft 0.22s var(--ease-out-quart) forwards; }
  .question-text.animate .operator { animation: popIn 0.18s ease-out 0.05s both; display: inline-block; }
  .question-text.animate .n2 { animation: slideInRight 0.22s var(--ease-out-quart) 0.03s both; }
  
  .tap-circle-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0px; transition: transform 0.08s ease; }
  .tap-circle-inner.punch { transform: scale(1.15); }
  @keyframes shakeWrong { 0% { transform: translateX(0) scale(1); } 20% { transform: translateX(-12px) scale(0.95); } 40% { transform: translateX(12px) scale(0.95); } 55% { transform: translateX(-8px); } 70% { transform: translateX(8px); } 100% { transform: translateX(0) scale(1); } }
  .tap-circle-inner.wrong { animation: shakeWrong 0.6s ease forwards; }
  .tap-number { font-family: var(--display-font); font-size: clamp(72px, 14dvh, 120px); font-weight: 900; letter-spacing: -2px; color: var(--text-primary); text-shadow: 0 4px 12px rgba(0,0,0,0.07); line-height: 1; position: relative; z-index: 2; font-variant-numeric: tabular-nums; }
  .tap-label { font-size: 12px; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 2px; position: relative; z-index: 2; }
  
.feedback-text {
  min-height: 28px;
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: transparent;
}

.feedback-text.wrong { color: var(--color-red); }
  .hint-text { transition: opacity 0.4s ease; opacity: 1; }
  .hint-text.hidden { opacity: 0; pointer-events: none; }
  #screenGame .question-counter {
    margin-top: 24px;
    margin-bottom: 34px;
  }
  #screenGame .middle-section {
    padding-bottom: clamp(8px, 1.5dvh, 16px) !important;
  }
  #screenGame .buttons-section {
    margin-top: clamp(22px, 4dvh, 38px);
  }
  .kb-hint { display: flex; gap: 3px; justify-content: center; }
  .kb-hint kbd { font-family: var(--app-font); font-size: 10px; font-weight: 900; background: rgba(255,255,255,0.55); border: 1.5px solid rgba(42,100,150,0.2); border-bottom-width: 2.5px; border-radius: 4px; padding: 1px 5px; color: var(--text-secondary); line-height: 1.6; }

  @media (hover: none) and (pointer: coarse), (max-width: 900px) and (orientation: portrait) {
    .kb-hint { display: none; }
    .buttons-section { display: grid; grid-template-columns: 1fr 1fr 1.5fr; align-items: end; }
    .btn-keyed, .btn-keyed--lock { width: 100%; }
    .btn-plus1, .btn-plus5, .btn-lock { width: 100%; }
  }
  .btn-plus1 { cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.14); }
  .btn-plus5 { cursor: default; pointer-events: none; flex-shrink: 0; }
  .btn-plus5.unlocked { opacity: 1; cursor: pointer; pointer-events: all; box-shadow: 0 4px 12px rgba(0,0,0,0.14); animation: unlockPop 0.5s var(--ease-out-quart); }
  @keyframes unlockPop { 0% { transform: scale(0.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
  .btn-keyed--lock { flex: 1; }
  .btn-lock { cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.14); }

  .name-prompt-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,32,68,0.62); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .name-prompt-overlay.show { opacity: 1; pointer-events: all; }
  .go-box { display: none; }
  .go-box.active { display: block; }
  .leaderboard-status { color: var(--color-orange); }
  .leaderboard-status.pending { font-size: 12px; color: var(--text-muted); }

  .go-action-btn { height: 58px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; transition: transform 0.08s, background 0.15s; }
  .go-action-btn:active { transform: translateY(2px); background: var(--surface-mid); }
  .leaderboard-tab { cursor: pointer; }
  .leaderboard-tab.active { background: var(--color-green); color: white; border-color: var(--color-green); }
  .leaderboard-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; min-height: 46px; padding: 10px 14px; background: rgba(255,255,255,0.45); border: 2px solid rgba(255,255,255,0.65); border-radius: 10px; color: var(--text-primary); font-weight: 900; font-size: 15px; }
  .leaderboard-row.rank-1 { background: rgba(255,215,0,0.22); border-color: rgba(255,190,0,0.5); font-size: 17px; min-height: 54px; }
  .leaderboard-row.rank-2 { background: rgba(200,210,220,0.35); border-color: rgba(180,195,210,0.6); font-size: 16px; min-height: 50px; }
  .leaderboard-row.rank-3 { background: rgba(205,140,80,0.18); border-color: rgba(180,110,50,0.35); font-size: 15px; }
  .leaderboard-rank { color: var(--color-orange); font-variant-numeric: tabular-nums; }
  .leaderboard-row.rank-1 .leaderboard-rank { color: #d4a000; font-size: 20px; }
  .leaderboard-row.rank-2 .leaderboard-rank { color: #8a9baa; }
  .leaderboard-row.rank-3 .leaderboard-rank { color: #b07840; }
  .leaderboard-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .leaderboard-score { color: var(--color-blue-text); font-variant-numeric: tabular-nums; }
  .leaderboard-row.rank-1 .leaderboard-score { color: #b8860b; }
  .leaderboard-empty { display: flex; align-items: center; justify-content: center; flex: 1; color: var(--text-secondary); font-size: 13px; font-weight: 800; line-height: 1.4; }
  .leaderboard-home-btn { min-height: 46px; cursor: pointer; transition: transform 0.08s, background 0.15s; }
  .leaderboard-home-btn:active { transform: translateY(2px); background: rgba(255,255,255,0.68); }
  .leaderboard-tool { cursor: pointer; transition: transform 0.08s, background 0.15s; }
  .leaderboard-tool:active { transform: translateY(2px); background: rgba(255,255,255,0.68); }
  
  .daily-grid { font-size: 32px; letter-spacing: 5px; line-height: 1.4; margin: 15px 0; display: block; min-height: 90px; }
  .grid-emoji { display: inline-block; transform: scale(0); opacity: 0; transition: transform 0.3s var(--ease-out-quart), opacity 0.2s; }
  .grid-emoji.pop { transform: scale(1); opacity: 1; }
  .speed-tier-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; pointer-events: none; opacity: 0; }
  .speed-tier-overlay.show { animation: tierFadeInOut 0.7s ease forwards; }
  @keyframes tierFadeInOut { 0% { opacity: 0; } 15% { opacity: 1; } 65% { opacity: 1; } 100% { opacity: 0; } }
  .speed-tier-word { font-family: var(--display-font); font-size: 64px; font-weight: 900; letter-spacing: -2px; line-height: 1; text-align: center; opacity: 0; }
  .godlike  .speed-tier-word { color: var(--color-fire); text-shadow: 0 0 16px rgba(255,107,0,0.5), 0 4px 0 rgba(0,0,0,0.2); }
  .insane   .speed-tier-word { color: var(--color-insane); text-shadow: 0 0 16px rgba(200,0,200,0.45), 0 4px 0 rgba(0,0,0,0.2); }
  .great    .speed-tier-word { color: var(--color-blue-mid); text-shadow: 0 0 16px rgba(42,159,214,0.45), 0 4px 0 rgba(0,0,0,0.2); }
  .nice     .speed-tier-word { color: var(--color-green); text-shadow: 0 0 16px rgba(39,174,96,0.45), 0 4px 0 rgba(0,0,0,0.2); }
  .speed-tier-sub { font-size: 18px; font-weight: 800; color: white; letter-spacing: 3px; text-transform: uppercase; margin-top: 8px; text-shadow: 0 2px 8px rgba(0,0,0,0.3); opacity: 0; }
  .tier-particles { position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; }
  .tier-particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; animation: particleFly 0.6s ease forwards; }
  @keyframes particleFly { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; } }

  .countdown-overlay {
    position: absolute;
    inset: 0;
    z-index: 180;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,32,68,0.14);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .countdown-overlay.show {
    opacity: 1;
    pointer-events: all;
  }
  #screenGame.prestart .middle-section,
  #screenGame.prestart .buttons-section,
  #screenGame.prestart .timer-section {
    opacity: 0;
  }
  .countdown-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 999px;
    border: 4px solid rgba(255,255,255,0.7);
    background: radial-gradient(circle at center, rgba(255,255,255,0.24), rgba(255,255,255,0.05) 65%, transparent 66%);
    box-shadow: 0 18px 40px rgba(15,32,68,0.14);
  }
  .countdown-value {
    position: relative;
    font-family: var(--display-font);
    font-size: 88px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
    color: white;
    text-shadow: 0 8px 30px rgba(15,32,68,0.35);
    transform: scale(0.72);
    opacity: 0;
  }
  .countdown-value.pop {
    animation: countdownPop 0.52s var(--ease-out-quart) forwards;
  }
  @keyframes countdownPop {
    0% { transform: scale(0.72); opacity: 0; }
    20% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
  }

  .toast { position: absolute; left: 50%; transform: translateX(-50%) translateY(10px); color: white; font-size: 13px; font-weight: 800; padding: 10px 22px; border-radius: 20px; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 100; letter-spacing: 1px; text-transform: uppercase; transition: opacity 0.3s, transform 0.3s; }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .unlock-toast { bottom: 135px; background: var(--color-navy); box-shadow: 0 5px 0 var(--color-navy-dk); }
  .clipboard-toast { top: 60px; background: var(--color-green); box-shadow: 0 5px 0 var(--color-green-dk); }

  .time-penalty-toast { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); font-size: 32px; font-weight: 900; color: var(--color-red); text-shadow: 0 4px 10px rgba(231,76,60,0.4); z-index: 100; pointer-events: none; opacity: 0; }
  .time-penalty-toast.show { animation: penaltyFloat 0.9s var(--ease-out-quart) forwards; }
  @keyframes penaltyFloat { 0% { transform: translateX(-50%) translateY(20px) scale(0.5); opacity: 0; } 20% { transform: translateX(-50%) translateY(0) scale(1.2); opacity: 1; } 80% { transform: translateX(-50%) translateY(-20px) scale(1); opacity: 1; } 100% { transform: translateX(-50%) translateY(-40px) scale(0.8); opacity: 0; } }

  .help-close-btn { cursor: pointer; }
  .help-close-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--color-green-dk);
  }

  .phone.on-fire { animation: phoneShake 0.5s ease; box-shadow: 0 0 32px var(--color-fire), 0 20px 48px rgba(0,0,0,0.35); transition: box-shadow 0.3s; }
  @keyframes phoneShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
  .fire-toast { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(0); font-size: 42px; font-weight: 900; color: var(--color-fire); text-shadow: 0 4px 15px rgba(255,107,0,0.5); z-index: 100; pointer-events: none; opacity: 0; white-space: nowrap; text-transform: uppercase; letter-spacing: -1px; }
  .fire-toast.show { animation: popFire 2s ease-out forwards; }
  @keyframes popFire { 0% { transform: translate(-50%, -50%) scale(0.5) rotate(-5deg); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.1) rotate(3deg); opacity: 1; } 80% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }

  /* ── Hover states (pointer devices only) ─────────────────── */
  @media (hover: hover) {
    .menu-btn:hover        { filter: brightness(1.07); }
    .icon-btn:hover        { background: rgba(255,255,255,0.52); }
    .btn-exit-game:hover   { background: rgba(255,255,255,0.68); }
    .btn-plus1:hover       { filter: brightness(1.06); }
    .btn-plus5.unlocked:hover { filter: brightness(1.06); }
    .btn-lock:hover        { filter: brightness(1.06); }
    .leaderboard-tab:not(.active):hover { background: rgba(255,255,255,0.52); }
    .leaderboard-home-btn:hover { background: rgba(255,255,255,0.68); }
    .leaderboard-tool:hover     { background: rgba(255,255,255,0.68); }
    .go-action-btn:hover        { background: rgba(255,255,255,0.60); }
    .help-close-btn:hover       { filter: brightness(1.07); }
    .player-name-row button:hover { filter: brightness(1.12); }
  }
