/* ============================================================
   Darts — Design System (mobile-first)
   Base : tokens, reset, layout, header, bottom-nav, boutons,
   cards, statut, cible visuelle, animations, safe-area iOS
   ============================================================ */

:root {
  /* Couleurs de fond */
  --bg: #070b16;
  --surface: #0f1830;
  --surface-2: #0b1326;
  --surface-3: #131e3a;
  --elevated: rgba(255, 255, 255, .03);

  /* Bordures */
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .3);

  /* Texte */
  --text: #eaf0ff;
  --muted: #8fa3c4;
  --faint: #5d6f8f;

  /* Accents néon */
  --cyan: #22d3ee;
  --violet: #a855f7;
  --green: #34d399;
  --red: #f97373;
  --amber: #fbbf24;

  --accent: linear-gradient(135deg, var(--cyan), var(--violet));
  --accent-soft: linear-gradient(135deg, rgba(34, 211, 238, .18), rgba(168, 85, 247, .18));

  /* Rayons */
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --pill: 999px;

  /* Ombres */
  --shadow: 0 18px 40px rgba(2, 6, 23, .55);
  --shadow-glow: 0 12px 40px rgba(34, 211, 238, .25);

  /* Divers */
  --tap: 48px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: 140ms var(--ease);

  /* Safe areas iOS */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --bottomnav-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(34, 211, 238, .12), transparent 60%),
    radial-gradient(1000px 600px at 100% 10%, rgba(168, 85, 247, .12), transparent 55%),
    radial-gradient(900px 600px at 0% 100%, rgba(168, 85, 247, .08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

a {
  color: var(--cyan);
}

::selection {
  background: rgba(34, 211, 238, .3);
}

/* ===================== APP SHELL ===================== */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  flex: 1;
  padding:
    calc(14px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(var(--bottomnav-h) + 24px + var(--safe-bottom))
    calc(16px + var(--safe-left));
}

/* ===================== TOPBAR ===================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background: linear-gradient(180deg, rgba(7, 11, 22, .92), rgba(7, 11, 22, .55) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(34, 211, 238, .35);
}

.brand-name {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .02em;
}

.brand-tag {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Nav desktop (cachée en mobile) */
.topnav {
  display: none;
  gap: 4px;
  padding: 4px;
  border-radius: var(--pill);
  background: rgba(15, 24, 48, .7);
  border: 1px solid var(--border);
}

.topnav a {
  padding: 8px 16px;
  border-radius: var(--pill);
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}

.topnav a.active {
  color: #06121f;
  background: var(--accent);
}

.topnav a:not(.active):hover {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}

/* ===================== BOTTOM NAV (mobile) ===================== */

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  padding: 8px calc(10px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(10px + var(--safe-left));
  background: linear-gradient(180deg, rgba(11, 19, 38, .82), rgba(7, 11, 22, .96));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.bottomnav a {
  flex: 1;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: 14px;
  transition: color var(--t-fast), background var(--t-fast);
}

.bottomnav a .ico {
  font-size: 1.3rem;
  line-height: 1;
}

.bottomnav a.active {
  color: var(--text);
  background: var(--accent-soft);
}

.bottomnav a.active .ico {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, .6));
}

.bottomnav a:active {
  transform: scale(.96);
}

/* ===================== BOUTONS ===================== */

.btn {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  border: 0;
  cursor: pointer;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: var(--pill);
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #06121f;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(34, 211, 238, .28);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast), filter var(--t-fast);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(34, 211, 238, .4);
}

.btn:active {
  transform: translateY(0) scale(.98);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 56px;
  font-size: 1.05rem;
}

/* Outline / secondaire */
.btn-outline,
.btn-ghost {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  cursor: pointer;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--pill);
  font-size: .95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border-strong);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.btn-outline:hover,
.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-outline:active,
.btn-ghost:active {
  transform: scale(.98);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Bouton connexion compact (header) */
.btn-connect {
  min-height: 40px;
  padding: 0 14px;
  font-size: .85rem;
  border-radius: var(--pill);
  white-space: nowrap;
}

/* ===================== CARDS ===================== */

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.card-sub {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}

.section-title {
  margin: 4px 0 12px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .01em;
}

.section-sub {
  margin: -6px 0 16px;
  font-size: .9rem;
  color: var(--muted);
}

/* Pills / tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--pill);
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
}

.tag-cyan { border-color: rgba(34, 211, 238, .55); color: #a9eef9; }
.tag-violet { border-color: rgba(168, 85, 247, .6); color: #e2cffb; }
.tag-green { border-color: rgba(52, 211, 153, .55); color: #b7f0d8; }
.tag-amber { border-color: rgba(251, 191, 36, .55); color: #fde2a3; }

/* ===================== STATUT ===================== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}

.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 0 rgba(148, 163, 184, .4);
  transition: background var(--t-fast), box-shadow var(--t-fast);
}

.status[data-status="ok"] { color: var(--green); }
.status[data-status="ok"]::before {
  background: var(--green);
  box-shadow: 0 0 10px rgba(52, 211, 153, .8);
  animation: pulse-dot 1.6s ease-out infinite;
}

.status[data-status="warn"] { color: var(--amber); }
.status[data-status="warn"]::before { background: var(--amber); box-shadow: 0 0 8px rgba(251, 191, 36, .7); }

.status[data-status="err"] { color: var(--red); }
.status[data-status="err"]::before { background: var(--red); box-shadow: 0 0 8px rgba(249, 115, 115, .7); }

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.note {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
}

.note-warn {
  border: 1px solid rgba(251, 191, 36, .3);
  background: rgba(251, 191, 36, .07);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: #fde2a3;
}

/* ===================== CIBLE VISUELLE (live) =====================
   IDs requis par core-target.js : #dart-target, #dart-hit-dot, #dart-target-label */

.target-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dart-target {
  position: relative;
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #0c1426 0 40%, #060a14 100%);
  border: 3px solid rgba(34, 211, 238, .25);
  box-shadow:
    0 0 0 6px rgba(7, 11, 22, .9),
    0 18px 40px rgba(0, 0, 0, .6),
    inset 0 0 40px rgba(0, 0, 0, .7);
  overflow: hidden;
}

.dart-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, .25);
}

.dart-ring.r-double { inset: 6%; border-color: rgba(249, 115, 115, .55); }
.dart-ring.r-outer  { inset: 16%; border-style: dashed; border-color: rgba(148, 163, 184, .2); }
.dart-ring.r-triple { inset: 38%; border-color: rgba(52, 211, 153, .55); }
.dart-ring.r-inner  { inset: 56%; border-color: rgba(148, 163, 184, .2); border-style: dashed; }
.dart-ring.r-bull   { inset: 76%; border-color: rgba(34, 211, 238, .6); }

.dart-cross::before,
.dart-cross::after {
  content: "";
  position: absolute;
  background: rgba(148, 163, 184, .12);
}
.dart-cross::before { left: 50%; top: 8%; bottom: 8%; width: 1px; transform: translateX(-.5px); }
.dart-cross::after { top: 50%; left: 8%; right: 8%; height: 1px; transform: translateY(-.5px); }

.dart-hit-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--amber));
  box-shadow: 0 0 0 4px rgba(251, 191, 36, .25), 0 0 22px rgba(251, 191, 36, .85);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.dart-target.has-hit .dart-hit-dot {
  opacity: 1;
}

.dart-hit-dot.pulse {
  animation: dartPulse .4s var(--ease);
}

@keyframes dartPulse {
  0% { transform: translate(-50%, -50%) scale(.5); }
  60% { transform: translate(-50%, -50%) scale(1.25); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.dart-target-label {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* ===================== UTILITAIRES ===================== */

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hide { display: none !important; }
.center { text-align: center; }

/* ===================== TOGGLE DE THÈME ===================== */

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  cursor: pointer;
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  border-radius: var(--pill);
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-strong);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.theme-toggle:hover {
  border-color: var(--cyan);
}

.theme-toggle:active {
  transform: scale(.92);
}

/* ===================== DESKTOP ===================== */

@media (min-width: 768px) {
  .topnav { display: inline-flex; }
  .bottomnav { display: none; }
  .content {
    padding-bottom: calc(40px + var(--safe-bottom));
  }
}

/* ===================== MODE CLAIR ===================== */

:root[data-theme="light"] {
  --bg: #eef2fb;
  --surface: #ffffff;
  --surface-2: #f4f7ff;
  --surface-3: #e7edfb;
  --elevated: rgba(15, 23, 42, .03);

  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .18);

  --text: #101a30;
  --muted: #4f5e79;
  --faint: #8493ad;

  --cyan: #0891b2;
  --violet: #7c3aed;
  --green: #059669;
  --red: #e11d48;
  --amber: #d97706;

  --accent-soft: linear-gradient(135deg, rgba(8, 145, 178, .14), rgba(124, 58, 237, .14));

  --shadow: 0 18px 40px rgba(15, 23, 42, .12);
  --shadow-glow: 0 12px 40px rgba(8, 145, 178, .2);

  color-scheme: light;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(8, 145, 178, .12), transparent 60%),
    radial-gradient(1000px 600px at 100% 10%, rgba(124, 58, 237, .12), transparent 55%),
    radial-gradient(900px 600px at 0% 100%, rgba(124, 58, 237, .08), transparent 55%),
    var(--bg);
}

:root[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(238, 242, 251, .94), rgba(238, 242, 251, .6) 70%, transparent);
}

:root[data-theme="light"] .topnav {
  background: rgba(255, 255, 255, .7);
}

:root[data-theme="light"] .topnav a:not(.active):hover,
:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .btn-outline,
:root[data-theme="light"] .tag {
  background: rgba(15, 23, 42, .04);
}

:root[data-theme="light"] .bottomnav {
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(238, 242, 251, .96));
}

:root[data-theme="light"] .btn,
:root[data-theme="light"] .topnav a.active {
  color: #f4f9ff;
}

:root[data-theme="light"] ::selection {
  background: rgba(8, 145, 178, .22);
}

/* ============================================================
   APP FEEL — splash, transitions, ripples, install, onboarding,
   settings sheet, victory modal, confetti, badges
   (chargé sur toutes les pages, compatible thème clair/sombre)
   ============================================================ */

/* ---------- Page entry / view transitions ---------- */
@view-transition { navigation: auto; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content {
  animation: pageIn .42s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .content { animation: none; }
}

/* ---------- Splash / écran de lancement ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 600px at 50% 30%, rgba(34, 211, 238, .16), transparent 60%),
    var(--bg);
  transition: opacity .5s var(--ease), visibility .5s var(--ease);
}

html.no-splash .splash { display: none; }

.splash.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: pageIn .5s var(--ease) both;
}

.splash-logo {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--surface) 0 38%, var(--surface-2) 100%);
  border: 3px solid rgba(34, 211, 238, .35);
  box-shadow: 0 0 0 8px rgba(7, 11, 22, .35), var(--shadow-glow);
}

.splash-logo::before,
.splash-logo::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(168, 85, 247, .45);
}
.splash-logo::before { inset: 16px; border-color: rgba(249, 115, 115, .4); }
.splash-logo::after  { inset: 34px; border-color: rgba(52, 211, 153, .5); }

.splash-bull {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--amber));
  box-shadow: 0 0 24px rgba(251, 191, 36, .8);
  animation: splashPulse 1.4s var(--ease) infinite;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.splash-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--cyan);
  animation: splashSpin 1s linear infinite;
}

@keyframes splashSpin { to { transform: rotate(360deg); } }

.splash-name {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-tag {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: -10px;
}

/* ---------- Ripple ---------- */
.fx-ripple-host { position: relative; overflow: hidden; }

.fx-ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255, 255, 255, .35);
  pointer-events: none;
  animation: fxRipple .55s var(--ease) forwards;
  mix-blend-mode: overlay;
}

@keyframes fxRipple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---------- Gear / settings button (injecté) ---------- */
.icon-btn {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  cursor: pointer;
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  border-radius: var(--pill);
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-strong);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
:root[data-theme="light"] .icon-btn { background: rgba(15, 23, 42, .04); }
.icon-btn:hover { border-color: var(--cyan); }
.icon-btn:active { transform: scale(.92); }

/* ---------- Overlay générique (settings / onboarding / victory) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  background: rgba(3, 6, 15, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

/* Bottom sheet (réglages) */
.sheet {
  margin-top: auto;
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow);
  padding: 10px 18px calc(22px + var(--safe-bottom));
  transform: translateY(110%);
  transition: transform .34s var(--ease);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: var(--pill);
  background: var(--border-strong);
  margin: 4px auto 14px;
}

.sheet-title {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-of-type { border-bottom: 0; }

.setting-row .setting-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting-row .setting-name { font-weight: 700; font-size: .98rem; }
.setting-row .setting-desc { font-size: .8rem; color: var(--muted); }

/* Switch réutilisable (toggle générique) */
.fx-switch {
  flex: none;
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: var(--pill);
  border: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, .14);
  transition: background var(--t-fast);
}
:root[data-theme="light"] .fx-switch { background: rgba(15, 23, 42, .16); }
.fx-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  transition: transform var(--t-fast);
}
.fx-switch[aria-checked="true"] { background: var(--accent); }
.fx-switch[aria-checked="true"]::after { transform: translateX(20px); }

.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- Onboarding ---------- */
.onb-card {
  margin: auto;
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 26px 22px calc(22px + var(--safe-bottom));
  transform: scale(.94);
  opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.sheet-backdrop.open .onb-card { transform: scale(1); opacity: 1; }

.onb-slide { display: none; text-align: center; animation: pageIn .35s var(--ease) both; }
.onb-slide.active { display: block; }

.onb-emoji { font-size: 3rem; line-height: 1; }
.onb-slide h2 { margin: 14px 0 8px; font-size: 1.35rem; font-weight: 800; }
.onb-slide p { margin: 0; color: var(--muted); line-height: 1.55; font-size: .96rem; }

.onb-dots { display: flex; justify-content: center; gap: 8px; margin: 20px 0 18px; }
.onb-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--t-fast), transform var(--t-fast);
}
.onb-dot.active { background: var(--cyan); transform: scale(1.25); box-shadow: 0 0 10px rgba(34, 211, 238, .7); }

.onb-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Install banner ---------- */
.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottomnav-h) + 16px + var(--safe-bottom));
  transform: translateX(-50%) translateY(140%);
  z-index: 120;
  width: min(92%, 460px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  transition: transform .4s var(--ease);
}
.install-banner.show { transform: translateX(-50%) translateY(0); }
.install-banner .ib-icon {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--accent); box-shadow: 0 6px 18px rgba(34, 211, 238, .35);
}
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-title { font-weight: 800; font-size: .92rem; }
.install-banner .ib-sub { font-size: .76rem; color: var(--muted); }
.install-banner .ib-close {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 0; cursor: pointer; font-size: 1rem;
  background: rgba(255,255,255,.06); color: var(--muted);
}
@media (min-width: 768px) {
  .install-banner { bottom: calc(20px + var(--safe-bottom)); }
}

/* ---------- Victory modal ---------- */
.victory-card {
  margin: auto;
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid rgba(251, 191, 36, .4);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 70px rgba(0,0,0,.6), 0 0 60px rgba(251, 191, 36, .18);
  padding: 28px 22px calc(22px + var(--safe-bottom));
  transform: scale(.9) translateY(10px);
  opacity: 0;
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}
.sheet-backdrop.open .victory-card { transform: scale(1) translateY(0); opacity: 1; }

.victory-trophy {
  font-size: 3.4rem;
  line-height: 1;
  animation: trophyPop .6s var(--ease) both;
}
@keyframes trophyPop {
  0% { transform: scale(0) rotate(-25deg); }
  60% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

.victory-card h2 {
  margin: 12px 0 4px;
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--amber), var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.victory-sub { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }

.victory-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.victory-stat {
  padding: 12px;
  border-radius: var(--r-sm);
  background: rgba(7, 11, 22, .45);
  border: 1px solid var(--border);
}
:root[data-theme="light"] .victory-stat { background: rgba(15,23,42,.04); }
.victory-stat .vs-value {
  font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums;
}
.victory-stat .vs-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.victory-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 4px 10px 0;
  padding: 5px 12px; border-radius: var(--pill);
  font-size: .76rem; font-weight: 800;
  border: 1px solid rgba(251, 191, 36, .55);
  color: var(--amber); background: rgba(251, 191, 36, .1);
}
.victory-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Confetti canvas ---------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
}

/* ---------- New nav item helper ---------- */
.bottomnav.cols-4 a { font-size: .64rem; }
