/* Fléchettes — thème sombre « scoring pro ». Mobile-first, sans dépendance externe.
   Aucun style en ligne n'est nécessaire : compatible avec une CSP stricte. */

:root {
  --bg: #0a0f1c;
  --bg2: #0e1526;
  --surface: #121a2e;
  --surface2: #19233d;
  --line: #263252;
  --text: #eaf0ff;
  --muted: #93a3c4;
  /* Les deux couleurs réglables par l'utilisateur (Profil > Couleurs du jeu), surchargées par theme.js :
     principale (scores, boutons, sélections)  et  accent (finish, victoire, meilleurs scores). */
  --green: #2ee59d;
  --green-rgb: 46, 229, 157;
  --green-ink: #04281b;
  --amber: #ffb84d;
  --amber-rgb: 255, 184, 77;
  --amber-ink: #2b1b00;
  --red: #ff5d73;
  --blue: #5aa9ff;
  --violet: #b18cff;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Sora", "Space Grotesk", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* Nexiom (popup) */
  --nx-navy: #0b2545;
  --nx-paper: #f6f4ee;
  --nx-green: #17a673;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0; min-height: 100dvh; background: radial-gradient(1200px 600px at 50% -10%, #14213f 0%, var(--bg) 60%) fixed;
  color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
}
body.in-game { padding-bottom: 0; overscroll-behavior: none; }
body.busy { cursor: progress; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--green); }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--green); color: var(--green-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }

/* ------------------------------------------------------------------ mise en page */
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 16px 16px; display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease both; }
.page.narrow { max-width: 480px; }
.page-title { margin-bottom: 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.center { text-align: center; justify-content: center; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.upper { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; }
.error { color: var(--red); }
.back { color: var(--muted); text-decoration: none; font-weight: 600; padding: 8px 0; }

.card { background: linear-gradient(180deg, var(--surface), #101831); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
a.card { color: inherit; text-decoration: none; }
.card.notice { align-items: center; text-align: center; padding: 28px 20px; }
.notice-icon, .hero-emoji { font-size: 2.6rem; }
.card.notice-inline { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; border-color: color-mix(in srgb, var(--amber) 40%, #0a0f1c); background: color-mix(in srgb, var(--amber) 10%, #0a0f1c); }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 0 6px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.logo-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--green), color-mix(in srgb, var(--green) 75%, black)); box-shadow: 0 6px 20px rgba(var(--green-rgb), .35); font-size: 1.5rem; }
.greet { font-size: 1.05rem; color: var(--muted); }
.greet strong { color: var(--text); }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 0; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; }
.empty { text-align: center; padding: 36px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { font-size: 2.8rem; }

/* ------------------------------------------------------------------ formulaires & boutons */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.input { width: 100%; min-height: 50px; padding: 12px 14px; background: var(--bg2); border: 1.5px solid var(--line); border-radius: var(--radius-sm); outline: none; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(var(--green-rgb), .2); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px; border-radius: var(--radius-sm); border: 1.5px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s ease, background .15s; user-select: none; text-align: center; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.05rem; border-radius: 14px; }
.btn-icon { min-width: 50px; padding: 0; font-size: 1.4rem; }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--green) 78%, white), var(--green)); color: var(--green-ink); box-shadow: 0 8px 22px rgba(var(--green-rgb), .28); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-secondary { background: var(--surface2); border-color: var(--line); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--red); color: #2b0008; }
.btn-danger-ghost { background: transparent; border-color: #5a2431; color: #ff8d9d; }
.btn-win { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 70%, white), var(--amber)); color: var(--amber-ink); box-shadow: 0 8px 22px rgba(var(--amber-rgb), .3); }
.btn-warn { background: var(--red); color: #2b0008; }
.btn-nexiom { background: var(--nx-navy); color: #fff; }
.btn-nexiom-ghost { background: transparent; border-color: #c9c4b4; color: var(--nx-navy); }
.icon-btn { width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 1.3rem; cursor: pointer; display: grid; place-items: center; }

.tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--muted); font-size: .7rem; font-weight: 700; vertical-align: middle; }
.tag.me { background: rgba(var(--green-rgb), .15); color: var(--green); margin: 0; }
.pill { padding: 4px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.pill-finished { background: rgba(var(--green-rgb), .15); color: var(--green); }
.pill-abandoned { background: rgba(255, 93, 115, .14); color: #ff8d9d; }
.pill-in_progress, .pill-live { background: rgba(var(--amber-rgb), .15); color: var(--amber); }

/* ------------------------------------------------------------------ navigation */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px; padding: 8px 10px calc(8px + var(--safe-b)); background: rgba(10, 15, 28, .92); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar[hidden] { display: none; }
.tabbar a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 700; min-height: 48px; }
.tabbar a.on { color: var(--green); background: rgba(var(--green-rgb), .1); }
.tabbar .ni { font-size: 1.25rem; line-height: 1; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 120px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; text-align: center; transition: transform .1s, border-color .15s; }
.menu-btn:active { transform: scale(.97); }
.menu-btn:hover { border-color: var(--green); }
.menu-btn .mi { font-size: 2rem; }
.menu-primary { grid-column: 1 / -1; min-height: 110px; background: linear-gradient(135deg, color-mix(in srgb, var(--green) 75%, black), var(--green)); color: var(--green-ink); border: 0; font-size: 1.25rem; box-shadow: 0 12px 30px rgba(var(--green-rgb), .28); }
.resume-head { display: flex; justify-content: space-between; align-items: center; }
.resume-body { font-weight: 700; }

/* ------------------------------------------------------------------ configuration */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-width: 78px; min-height: 52px; padding: 8px 18px; border-radius: 14px; background: var(--bg2); border: 1.5px solid var(--line); font-weight: 800; font-size: 1.15rem; cursor: pointer; }
.chip.on { background: rgba(var(--green-rgb), .14); border-color: var(--green); color: var(--green); }
.chip:disabled { opacity: .4; font-size: .9rem; font-weight: 600; cursor: not-allowed; }
.chip small { display: block; font-size: .65rem; color: var(--muted); }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg2); border: 1.5px solid var(--line); cursor: pointer; min-height: 60px; }
.radio-card.on { border-color: var(--green); background: rgba(var(--green-rgb), .09); }
.player-row { display: flex; align-items: center; gap: 10px; }
.seat { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface2); color: var(--muted); font-weight: 800; font-size: .85rem; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper output { min-width: 24px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.sticky-cta { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 5; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.avatar-opt { height: 52px; border-radius: 14px; background: var(--bg2); border: 1.5px solid var(--line); font-size: 1.5rem; cursor: pointer; color: var(--muted); }
.avatar-opt.on { border-color: var(--green); background: rgba(var(--green-rgb), .12); }

/* ------------------------------------------------------------------ écran de jeu */
.game { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding: calc(var(--safe-t) + 8px) 10px calc(var(--safe-b) + 10px); }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-title { font-size: 1.05rem; }
.board { display: flex; flex-direction: column; gap: 8px; }
.active-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 10px; border-radius: 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--green) 12%, #17234a), #121b33 70%); border: 1.5px solid color-mix(in srgb, var(--green) 30%, #2b3f73); box-shadow: 0 10px 30px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06); transition: border-color .2s, background .2s; }
.active-card.is-bust { border-color: var(--red); background: linear-gradient(160deg, #3a1420, #1a0e18 70%); }
.active-card.is-win { border-color: var(--amber); background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 24%, #0a0f1c), color-mix(in srgb, var(--amber) 8%, #0a0f1c) 70%); }
.active-card.swap { animation: swap .45s cubic-bezier(.2, .9, .3, 1.2); }
.ac-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ac-name { font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-sub { color: var(--muted); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.ac-score { font-size: clamp(3.6rem, 17dvh, 6.4rem); line-height: 1; font-weight: 900; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--green); text-shadow: 0 0 40px rgba(var(--green-rgb), .3); }
.is-bust .ac-score { color: var(--red); text-decoration: line-through; text-decoration-thickness: 4px; }
.is-win .ac-score { color: var(--amber); }
.ac-foot { display: flex; justify-content: space-between; font-size: .85rem; gap: 8px; }
.finish { color: var(--amber); font-weight: 800; }
.others { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 2px; scrollbar-width: none; }
.others::-webkit-scrollbar { display: none; }
.other { flex: 1 0 auto; min-width: 84px; scroll-snap-align: start; display: flex; flex-direction: column; padding: 6px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.other.next { border-color: #3a5b9c; }
.o-name { font-size: .75rem; color: var(--muted); font-weight: 700; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-score { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; font-weight: 600; }
.strip { display: flex; gap: 8px; overflow-x: auto; font-size: .8rem; white-space: nowrap; scrollbar-width: none; min-height: 26px; align-items: center; }
.strip-item { padding: 3px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.strip-item.bust { border-color: #5a2431; color: #ff8d9d; }
.turn-msg { min-height: 22px; text-align: center; font-weight: 700; font-size: .92rem; color: var(--muted); }
.turn-msg.bad { color: var(--red); } .turn-msg.good { color: var(--amber); }

.turn { display: grid; grid-template-columns: 1fr 1fr 1fr 1.35fr; gap: 8px; }
.slot { min-height: 56px; border-radius: 14px; background: var(--bg2); border: 1.5px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; color: var(--text); padding: 0; cursor: default; }
.slot.current { border-color: var(--green); border-style: solid; animation: pulse 1.4s ease-in-out infinite; }
.slot.filled { border-style: solid; cursor: pointer; background: var(--surface2); border-color: #3a4a76; }
.slot.filled b { font-size: 1.15rem; } .slot.filled small { color: var(--muted); font-size: .72rem; }
.slot.m2 { border-color: var(--blue); } .slot.m3 { border-color: var(--violet); }
.slot.m0 { opacity: .7; }
.validate { min-height: 56px; font-size: 1rem; padding: 6px 8px; }

.keypad { display: flex; flex-direction: column; gap: 8px; user-select: none; -webkit-user-select: none; margin-top: auto; }
.keys-row { display: grid; gap: 8px; }
.keys-row.mults { grid-template-columns: 1fr 1fr 1fr 0.8fr; }
.keys-row.specials { grid-template-columns: 1fr 1fr 1fr; }
.keys-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.key { min-height: clamp(44px, 6.6dvh, 56px); border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); color: var(--text); font-weight: 800; font-size: 1.15rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; transition: transform .06s, background .12s; }
.key:active:not(:disabled) { transform: scale(.94); background: #26365f; }
.key:disabled { opacity: .35; cursor: not-allowed; }
.key small { font-size: .62rem; color: var(--muted); font-weight: 700; }
.key-mult { font-size: .95rem; }
.key-mult.on { background: rgba(var(--green-rgb), .16); border-color: var(--green); color: var(--green); }
.key-mult[data-m="2"].on { background: rgba(90, 169, 255, .16); border-color: var(--blue); color: var(--blue); }
.key-mult[data-m="3"].on { background: rgba(177, 140, 255, .16); border-color: var(--violet); color: var(--violet); }
.key-num.d { border-color: var(--blue); } .key-num.t { border-color: var(--violet); }
.key-special b { font-size: 1.1rem; }
.key-eye { border-color: color-mix(in srgb, var(--amber) 45%, #0a0f1c); background: color-mix(in srgb, var(--amber) 14%, #0a0f1c); color: var(--amber); }
.key-back { font-size: 1.3rem; }

.turn-list { list-style: none; margin: 0; padding: 0; max-height: 55dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.turn-list li { display: grid; grid-template-columns: 1.2fr 1.4fr auto auto; gap: 8px; align-items: center; padding: 8px 10px; background: var(--bg2); border-radius: 10px; font-size: .85rem; }
.turn-list li.bust { border: 1px solid #5a2431; }
.tl-who { font-weight: 800; } .tl-score { font-weight: 800; color: var(--green); } .bust .tl-score { color: var(--red); }

/* ------------------------------------------------------------------ résultat */
.victory { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 12px 20px; border-radius: 24px; background: radial-gradient(500px 240px at 50% 0, rgba(var(--amber-rgb), .18), transparent 70%), var(--surface); border: 1px solid color-mix(in srgb, var(--amber) 40%, #0a0f1c); }
.trophy { font-size: 4.2rem; animation: pop .7s cubic-bezier(.2, 1.4, .3, 1) both; }
.winner { font-size: clamp(2rem, 9vw, 3rem); color: var(--amber); font-weight: 900; word-break: break-word; }
.confetti { position: absolute; top: -12px; left: var(--x); width: 8px; height: 14px; background: var(--c); transform: rotate(var(--r)); animation: fall 2.4s var(--d) ease-in forwards; border-radius: 2px; opacity: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 12px; text-align: center; }
.tile-v { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--green); }
.tile-l { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th[scope="row"], .table thead th:nth-child(2) { text-align: left; }
.table thead th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.win-row th, .win-row td { color: var(--amber); }
.table.turns th, .table.turns td { text-align: center; padding: 6px 4px; }
.table.turns { font-size: .8rem; }
.table.turns td.bust { background: rgba(255, 93, 115, .1); } .table.turns td.win { background: rgba(var(--amber-rgb), .14); }
.table.turns .darts { font-size: .75rem; color: var(--muted); } .table.turns .after { font-weight: 800; }

/* ------------------------------------------------------------------ historique */
.filters summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.filters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.filters-grid > .btn { grid-column: 1 / -1; }
.game-card { gap: 6px; transition: border-color .15s, transform .08s; }
.game-card:hover { border-color: #3a5b9c; } .game-card:active { transform: scale(.99); }
.gc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gc-winner { color: var(--amber); }
.gc-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .85rem; }
.kv { gap: 0; padding: 6px 16px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose { color: #cdd8f0; }

/* ------------------------------------------------------------------ graphiques */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--bg); stroke-width: 1.5; }
.chart .dot.win { stroke: var(--amber); stroke-width: 2.5; }
.s0 { stroke: var(--green); fill: var(--green); } .s1 { stroke: var(--blue); fill: var(--blue); }
.s2 { stroke: var(--amber); fill: var(--amber); } .s3 { stroke: var(--violet); fill: var(--violet); }
.s4 { stroke: var(--red); fill: var(--red); } .s5 { stroke: #5ee0ff; fill: #5ee0ff; }
.s6 { stroke: #ff9ad5; fill: #ff9ad5; } .s7 { stroke: #c8e65a; fill: #c8e65a; }
.chart .line.s0, .chart .line.s1, .chart .line.s2, .chart .line.s3, .chart .line.s4, .chart .line.s5, .chart .line.s6, .chart .line.s7 { fill: none; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; }
.swatch.s0 { background: var(--green); } .swatch.s1 { background: var(--blue); } .swatch.s2 { background: var(--amber); } .swatch.s3 { background: var(--violet); } .swatch.s4 { background: var(--red); } .swatch.s5 { background: #5ee0ff; } .swatch.s6 { background: #ff9ad5; } .swatch.s7 { background: #c8e65a; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------------ dialogues */
dialog { color: var(--text); border: 0; padding: 0; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(3, 6, 14, .72); backdrop-filter: blur(3px); }
.dlg { width: min(92vw, 420px); margin: auto; }
.dlg-body { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); animation: pop .25s ease both; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }
.dlg-actions .btn { flex: 1; }
.sheet { margin: auto auto 0; width: min(100vw, 520px); }
.sheet .dlg-body { border-radius: 22px 22px 0 0; padding-bottom: calc(20px + var(--safe-b)); animation: slide .25s ease both; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }

.toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 12px); z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { max-width: 460px; padding: 12px 16px; border-radius: 14px; background: #1c2744; border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; animation: slide-down .25s ease both; }
.toast-ok { border-color: color-mix(in srgb, var(--green) 55%, #0a0f1c); } .toast-error { border-color: var(--red); background: #2a1220; } .toast-warn { border-color: var(--amber); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .3s; }

/* ------------------------------------------------------------------ popup Nexiom */
dialog.promo { position: fixed; inset: 0; margin: auto; width: min(92vw, 440px); height: fit-content; max-height: 94dvh; overflow-y: auto; background: var(--nx-paper); color: var(--nx-navy); border-radius: 24px; padding: 22px 22px 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop .35s cubic-bezier(.2, 1.2, .3, 1) both; }
dialog.promo[open] { display: flex; flex-direction: column; gap: 12px; }
.promo-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(11, 37, 69, .08); color: var(--nx-navy); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.promo-art { width: 100%; max-height: 150px; }
.art-r1 { fill: #0b2545; } .art-r2 { fill: #f6f4ee; } .art-r3 { fill: #17a673; } .art-r4 { fill: #f6f4ee; } .art-r5 { fill: #d64545; }
.art-shaft { stroke: #5b6b86; stroke-width: 4; stroke-linecap: round; }
.art-flight { fill: #17a673; } .art-flight2 { fill: #0b2545; } .art-tip { fill: #0b2545; }
.art-spark { fill: #f2b233; }
.art-code { font: 800 34px var(--mono); fill: #0b2545; }
.promo-brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.2rem; letter-spacing: -.02em; }
.promo-brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--nx-green); }
.promo-h { font-size: 1.2rem; line-height: 1.3; font-weight: 800; }
.promo-body { display: flex; flex-direction: column; gap: 8px; font-size: .95rem; color: #2b3f5f; }
.promo-tag { font-weight: 800; color: var(--nx-green); }
.promo-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.promo-link { background: none; border: 0; color: #4a5d7d; text-decoration: underline; cursor: pointer; padding: 8px; font-size: .9rem; }
dialog.promo::backdrop { background: rgba(3, 6, 14, .75); }


/* ------------------------------------------------------------------ réglage des couleurs */
.color-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.color-text { display: flex; flex-direction: column; }
.color-input { appearance: none; -webkit-appearance: none; width: 56px; height: 56px; padding: 0; border: 2px solid var(--line); border-radius: 16px; background: none; cursor: pointer; flex: none; }
.color-input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 11px; }
.color-input::-moz-color-swatch { border: 0; border-radius: 11px; }
.theme-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.pv-score { font-size: 2rem; font-weight: 900; color: var(--green); font-variant-numeric: tabular-nums; }
.pv-btn { padding: 10px 16px; border-radius: 12px; background: var(--green); color: var(--green-ink); font-weight: 800; }
.pv-accent { color: var(--amber); font-weight: 800; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.preset { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 12px; background: var(--bg2); border: 1.5px solid var(--line); cursor: pointer; font-weight: 700; font-size: .85rem; text-align: left; }
.preset.on { border-color: var(--green); background: rgba(var(--green-rgb), .1); }
.swatch-pair { display: inline-flex; flex: none; }
.swatch-pair i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bg2); }
.swatch-pair i + i { margin-left: -8px; }

/* ------------------------------------------------------------------ animations */
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
@keyframes slide { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-down { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes swap { 0% { transform: translateX(-26px) scale(.96); opacity: .3; } 100% { transform: none; opacity: 1; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(var(--green-rgb), .18); } }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(var(--r)); } 100% { opacity: 0; transform: translateY(320px) rotate(calc(var(--r) + 540deg)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ------------------------------------------------------------------ écrans larges */
@media (min-width: 720px) {
  .page { padding-top: 32px; }
  .menu-grid { grid-template-columns: repeat(3, 1fr); } .menu-primary { grid-column: auto; }
  .tabbar { max-width: 560px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 20px; left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
  .filters-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 760px) {
  .game { gap: 5px; padding-top: calc(var(--safe-t) + 4px); padding-bottom: calc(var(--safe-b) + 6px); }
  .game-top .icon-btn { width: 40px; height: 40px; }
  .active-card { padding: 6px 14px 6px; border-radius: 16px; }
  .ac-name { font-size: 1.05rem; }
  .ac-score { font-size: 3.7rem; }
  .other { padding: 3px 10px; } .o-score { font-size: 1.1rem; }
  .strip { min-height: 22px; font-size: .75rem; } .strip-item { padding: 1px 8px; }
  .turn-msg { min-height: 18px; font-size: .85rem; }
  .slot, .validate { min-height: 46px; }
  .keypad, .keys-grid, .keys-row { gap: 5px; }
  .key { min-height: 39px; font-size: 1.05rem; border-radius: 10px; }
  .key small { font-size: .56rem; }
}
