@import url('https://fonts.googleapis.com/css2?family=Creepster&family=Rubik:wght@500;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* Design system v2: tokens and components shared by phone, TV and cockpit (see design/board.html, section 05). */
:root {
  --night: #0e0a17;
  --night-2: #160f24;
  --card: #1c1530;
  --card-2: #241a3d;
  --line: rgba(255, 255, 255, .09);
  --ink: #f3eefc;
  --mute: #b4a8cc;
  --pump: #ff7a1a;
  --pump-2: #ffb347;
  --viol: #a77bff;
  --slime: #8be04e;
  --blood: #ff4b5c;
  --gold: #ffd23f;
  --radius: 20px;
  --tap: 52px;
  --nav-h: calc(78px + env(safe-area-inset-bottom, 0px));
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(.2, .9, .3, 1.2);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--night); }
body {
  min-height: 100dvh;
  color: var(--ink);
  font: 16px/1.45 Inter, system-ui, sans-serif;
  background:
    radial-gradient(120% 55% at 50% -10%, #2d1650 0, transparent 60%),
    radial-gradient(90% 45% at 0 110%, #3a1a07 0, transparent 60%),
    var(--night);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* — Type — */
.title { font: 400 2.75rem/.95 Creepster, cursive; color: var(--pump); text-shadow: 0 0 18px rgba(255, 122, 26, .5); letter-spacing: .01em; }
.kicker { font: 800 .7rem Rubik; letter-spacing: .28em; text-transform: uppercase; color: var(--pump-2); }
.h { font: 800 1rem Rubik; text-transform: uppercase; letter-spacing: .03em; }
.big { font: 900 1.5rem/1.15 Rubik; }
.mute { color: var(--mute); }
.small { font-size: .82rem; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* — Layout helpers — */
.wrap { position: relative; z-index: 2; max-width: 560px; margin: 0 auto; padding: 8px 18px calc(var(--nav-h) + 24px); display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrapx { flex-wrap: wrap; }
.sp { flex: 1; }
.stack { display: grid; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.cta-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 14px 18px calc(18px + var(--safe-b)); background: linear-gradient(transparent, rgba(14, 10, 23, .94) 32%); }
.cta-bottom > * { max-width: 524px; margin-left: auto; margin-right: auto; }
.cta-bottom > * + * { margin-top: 10px; }

/* — Cards — */
.card { position: relative; overflow: hidden; display: grid; gap: 10px; padding: 14px; border-radius: var(--radius); background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025)); border: 1px solid var(--line); }
.card.hot { border-color: rgba(255, 122, 26, .55); }
.card.danger { border-color: rgba(255, 75, 92, .5); }
.card.gold { border-color: rgba(255, 210, 63, .5); }
.card.viol { border-color: rgba(167, 123, 255, .5); }
.card.row { display: flex; }
.card.striped { background: repeating-linear-gradient(45deg, #1d1530 0 12px, #241a3a 12px 24px); }

/* — Buttons — */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 0 18px; border-radius: 16px; font: 800 1rem Rubik; color: #1a0d00; background: linear-gradient(160deg, var(--pump-2), var(--pump)); box-shadow: 0 8px 20px rgba(255, 122, 26, .3); transition: transform .12s, filter .12s, opacity .2s; user-select: none; }
.btn:active { transform: scale(.97); filter: brightness(1.1); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.g { background: rgba(255, 255, 255, .04); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.r { background: linear-gradient(160deg, #ff8a96, var(--blood)); color: #2a0006; box-shadow: 0 8px 20px rgba(255, 75, 92, .3); }
.btn.s { background: linear-gradient(160deg, #b7f28c, var(--slime)); color: #0d2100; box-shadow: 0 8px 20px rgba(139, 224, 78, .3); }
.btn.v { background: linear-gradient(160deg, #c6a8ff, var(--viol)); color: #16052f; box-shadow: 0 8px 20px rgba(167, 123, 255, .3); }
.btn.sm { min-height: 40px; font-size: .9rem; border-radius: 12px; }
.btn.auto { width: auto; }
.btn.confirm { background: linear-gradient(160deg, #ff8a96, var(--blood)); color: #2a0006; }
.link { font: 700 .9rem Rubik; color: var(--pump-2); text-decoration: underline; text-underline-offset: 3px; }

/* — Chips — */
.chip { display: inline-flex; align-items: center; gap: 4px; font: 700 .75rem Rubik; padding: 4px 10px; border-radius: 99px; background: rgba(139, 224, 78, .13); color: var(--slime); border: 1px solid rgba(139, 224, 78, .3); white-space: nowrap; }
.chip.n { background: rgba(255, 75, 92, .12); color: var(--blood); border-color: rgba(255, 75, 92, .3); }
.chip.gd { background: rgba(255, 210, 63, .12); color: var(--gold); border-color: rgba(255, 210, 63, .32); }
.chip.v { background: rgba(167, 123, 255, .14); color: var(--viol); border-color: rgba(167, 123, 255, .32); }
.chip.w { background: rgba(255, 255, 255, .07); color: var(--mute); border-color: var(--line); }

/* — Avatars & people grid — */
.av { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 23px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.s { width: 32px; height: 32px; font-size: 18px; }
.av.l { width: 72px; height: 72px; font-size: 40px; }
.av.xl { width: 116px; height: 116px; font-size: 66px; }
.ppl { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 11px 4px; min-height: 92px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font: 700 .82rem Rubik; text-align: center; transition: transform .12s, border-color .15s, background .15s; }
.ppl:active { transform: scale(.96); }
.ppl.on { border-color: var(--pump); background: rgba(255, 122, 26, .15); box-shadow: 0 0 0 3px rgba(255, 122, 26, .25); }
.ppl.gold.on { border-color: var(--gold); background: rgba(255, 210, 63, .14); box-shadow: 0 0 0 3px rgba(255, 210, 63, .25); }
.ppl.off { opacity: .4; }
.ppl small { font: 600 .65rem Inter; color: var(--mute); }
.ppl .av { width: 48px; height: 48px; font-size: 27px; }
.ppl .av.photo { border-radius: 14px; width: 64px; height: 64px; }

/* — Inputs — */
.input { width: 100%; min-height: 50px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); padding: 0 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--pump); box-shadow: 0 0 0 3px rgba(255, 122, 26, .22); }
textarea.input { padding: 12px 16px; min-height: 84px; resize: vertical; }
.search { position: relative; }
.search::before { content: "🔎"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; pointer-events: none; }
.search .input { padding-left: 42px; }

/* — Stepper dots, segmented control, switch — */
.stepper { display: flex; gap: 6px; justify-content: center; }
.stepper i { width: 26px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); transition: width .3s var(--ease-out), background .3s; }
.stepper i.on { background: var(--pump); width: 40px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.seg button { flex: 1; padding: 8px 4px; border-radius: 9px; font: 700 .78rem Rubik; color: var(--mute); }
.seg button.on { background: var(--card-2); color: var(--ink); }
.sw { position: relative; width: 50px; height: 30px; flex: none; border-radius: 99px; background: #3a2f55; transition: background .2s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s var(--ease-out); }
.sw.on { background: var(--slime); }
.sw.on::after { left: 23px; }

/* — Top bar & bottom nav (phone) — */
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(18px, calc(50% - 262px)) 12px; border-bottom: 1px solid var(--line); background: rgba(14, 10, 23, .8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.topbar > div { max-width: 524px; }
.score { font: 900 1.65rem/1 Rubik; color: var(--gold); text-shadow: 0 0 14px rgba(255, 210, 63, .35); font-variant-numeric: tabular-nums; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--nav-h); padding: 8px max(8px, calc(50% - 280px)) calc(8px + var(--safe-b)); display: flex; justify-content: space-around; align-items: center; background: rgba(14, 10, 23, .95); border-top: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.nav .t { position: relative; display: grid; justify-items: center; gap: 2px; width: 64px; font: 700 .66rem Rubik; color: var(--mute); }
.nav .t i { font-style: normal; font-size: 21px; line-height: 1.2; }
.nav .t.on { color: var(--pump); }
.nav .t.on::before { content: ""; position: absolute; top: -9px; width: 26px; height: 3px; border-radius: 3px; background: var(--pump); }
.nav .t .b { position: absolute; top: -4px; right: 10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--blood); color: #fff; font-size: 10px; display: grid; place-items: center; }
.fab { width: 64px; height: 64px; margin-top: -30px; border-radius: 50%; display: grid; place-items: center; font-size: 27px; background: linear-gradient(160deg, var(--pump-2), var(--pump)); box-shadow: 0 10px 26px rgba(255, 122, 26, .5), 0 0 0 6px var(--night); transition: transform .12s; }
.fab:active { transform: scale(.92); }

/* — Sheets, scrim, toast, banners — */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(5, 3, 10, .65); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 92dvh; overflow-y: auto; display: grid; gap: 12px; padding: 14px 18px calc(26px + var(--safe-b)); border-radius: 30px 30px 0 0; background: var(--night-2); border-top: 1px solid var(--line); box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); animation: sheet-up .35s var(--ease-out); }
.sheet > * { width: 100%; max-width: 524px; margin: 0 auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); }
.sheet.out { animation: sheet-up .25s reverse forwards; }
.toasts { position: fixed; left: 14px; right: 14px; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 524px; margin: 0 auto; width: 100%; display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px; background: #241a3d; border: 1px solid var(--line); font: 700 .9rem Rubik; box-shadow: 0 14px 30px rgba(0, 0, 0, .5); animation: toast-in .35s var(--ease-out); }
.toast.error { background: var(--blood); color: #2a0006; }
.toast.good { border-color: rgba(139, 224, 78, .5); }
.toast.out { animation: fade .25s reverse forwards; }
.banner { position: fixed; left: 0; right: 0; top: 0; z-index: 75; padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px; text-align: center; font: 800 .8rem Rubik; background: var(--blood); color: #2a0006; }

/* — Ring countdown — */
.ring { --p: 0; --c: var(--viol); width: 150px; height: 150px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .08) 0); }
.ring > div { width: calc(100% - 22px); height: calc(100% - 22px); border-radius: 50%; display: grid; place-items: center; background: var(--night-2); font: 900 1.9rem Rubik; font-variant-numeric: tabular-nums; }
.ring.spin { background: conic-gradient(var(--c) 0 25%, rgba(255, 255, 255, .08) 0); animation: spin 1.4s linear infinite; }
.ring.spin > div { animation: spin 1.4s linear infinite reverse; }
.ring.s { width: 54px; height: 54px; }
.ring.s > div { width: 44px; height: 44px; font-size: .75rem; }

/* — Leaderboard rows — */
.board { display: grid; gap: 7px; }
.bl { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font: 700 .9rem Rubik; }
.bl .rk { width: 22px; text-align: center; color: var(--mute); font-weight: 900; }
.bl .pt { margin-left: auto; color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
.bl.me { background: rgba(255, 122, 26, .14); border-color: rgba(255, 122, 26, .5); }
.bl.sticky { position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 5; box-shadow: 0 -8px 24px rgba(0, 0, 0, .5); }

/* — Timeline (history) — */
.tl { display: grid; }
.tl .e { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.tl .e:last-child { border-bottom: 0; }
.tl .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); font-size: 17px; }
.tl .p { font: 900 1.05rem Rubik; }
.pos { color: var(--slime); }
.neg { color: var(--blood); }

/* — Keypad & PIN dots — */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 58px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font: 800 1.35rem Rubik; transition: transform .1s, background .1s; }
.keypad button:active { transform: scale(.95); background: var(--card-2); }
.dots { display: flex; gap: 14px; justify-content: center; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--pump); transition: background .15s; }
.dots i.f { background: var(--pump); }
.shake { animation: shake .4s; }

/* — Hidden mission (hold to reveal) — */
.secret { position: relative; border-radius: var(--radius); overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.secret .veil { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; font: 800 .95rem Rubik; border: 1px dashed rgba(167, 123, 255, .45); border-radius: var(--radius); background: repeating-linear-gradient(-45deg, rgba(28, 21, 48, .92) 0 12px, rgba(33, 24, 56, .92) 12px 24px); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .2s; }
.secret .veil small { display: block; margin-top: 4px; font: 600 .72rem Inter; color: var(--mute); }
.secret .veil .fill { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--viol); }
.secret.holding .veil .fill { width: 100%; transition: width var(--hold, 350ms) linear; }
.secret.revealed .veil { opacity: 0; pointer-events: none; }
.secret:not(.revealed) .card .btn { pointer-events: none; }

/* — Skeleton & empty states — */
.skel { border-radius: 12px; background: linear-gradient(90deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .1), rgba(255, 255, 255, .05)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 22px; text-align: center; }
.empty .e { font-size: 46px; }

/* — Chip colour counters (casino) — */
.chips { display: grid; gap: 8px; }
.chipc { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.token { width: 38px; height: 38px; border-radius: 50%; border: 5px dashed rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25); }
.token.blanc { background: #f1f1f1; border-color: #c9c9c9; }
.token.rouge { background: #d7263d; }
.token.bleu { background: #2459d6; }
.token.vert { background: #1f9d55; }
.token.noir { background: #1b1b1b; border-color: #8a8a8a; }
.cnt { display: flex; align-items: center; gap: 6px; }
.cnt button { width: 40px; height: 40px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); font: 900 1.2rem Rubik; }
.cnt input { width: 52px; height: 40px; text-align: center; border-radius: 12px; background: var(--night); border: 1px solid var(--line); font: 900 1.1rem Rubik; }

/* — Motion — */
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes up-soft { from { opacity: 0; transform: translateY(12px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pulse-red { 50% { box-shadow: 0 0 0 6px rgba(255, 75, 92, .25), 0 0 30px rgba(255, 75, 92, .45); } }
.pop { animation: pop .5s var(--ease-out) both; }
.in { animation: up-soft .4s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
