@font-face {
  font-family: Bricolage;
  src: url('./assets/bricolage.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  font-family: Bricolage, system-ui, sans-serif;
  color: #29143d;
  background: #fff7e8;
  --paper: #fff7e8;
  --ink: #29143d;
  --purple: #5527cb;
  --purple-pale: #eee3ff;
  --yellow: #ffdd3c;
  --mint: #a5eeac;
  --coral: #ff6c8d;
  --line: 2px solid var(--ink);
  --lift: 0 5px 0 var(--ink);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
img { display: block; width: 100%; height: auto; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #225dba; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.045em; }
p { line-height: 1.45; }

.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: var(--purple); color: white; border-bottom: var(--line); }
.topbar-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { font-size: 1.7rem; font-weight: 800; text-decoration: none; letter-spacing: -.055em; white-space: nowrap; }
.brand span { color: var(--yellow); margin-right: .18em; }
.nav-link { text-decoration: none; font-weight: 750; border: 1px solid #ffffff90; padding: 8px 16px; border-radius: 999px; }
.nav-link:hover { background: white; color: var(--purple); }
.topbar :focus-visible { outline-color: var(--yellow); }

.hero {
  display: grid;
  grid-template-columns: .86fr 1.14fr;
  align-items: center;
  min-height: 460px;
  gap: clamp(20px, 3.6vw, 56px);
  padding: clamp(24px, 5vw, 64px);
  margin-block: 36px 52px;
  position: relative;
  isolation: isolate;
  background: #eadbff;
  border: var(--line);
  border-radius: 28px;
  box-shadow: var(--lift);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 0 39%;
  background-image: radial-gradient(#623bb34a 1px, transparent 1px);
  background-size: 13px 13px;
  mask-image: radial-gradient(ellipse at 65% 52%, black, transparent 75%);
}
.hero-copy { position: relative; z-index: 1; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .35em .8em;
  background: var(--paper);
  border: var(--line);
  border-radius: 999px;
  font-weight: 800;
  transform: rotate(-3deg);
}
.hero-tag span { color: var(--purple); }
.hero h1 { font-size: clamp(3.5rem, 7.2vw, 6.7rem); line-height: .88; margin: 20px 0 18px; letter-spacing: -.075em; }
.hero h1 span { color: var(--purple); }
.hero-copy > p:not(.hero-tag) { font-size: clamp(1.05rem, 1.8vw, 1.22rem); max-width: 28ch; margin-bottom: 22px; }
.hero-art { position: relative; }
.hero-art img { width: 108%; max-width: none; margin-left: -2%; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65em;
  min-height: 46px;
  padding: 10px 17px;
  border: var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms;
}
.button:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.button:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.button.primary { background: var(--yellow); }
.button:disabled { opacity: .57; cursor: default; box-shadow: none; }
.wide { width: 100%; }

.catalogue { scroll-margin-top: 20px; }
.catalogue-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.catalogue h2 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; }
.catalogue-views { display: inline-flex; padding: 3px; background: white; border: var(--line); border-radius: 12px; }
.catalogue-views button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.catalogue-views button:hover { background: var(--purple-pale); }
.catalogue-views button[aria-pressed="true"] { background: var(--purple); color: white; }
.catalogue-views svg { width: 16px; height: 16px; }
.game-tile {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto;
  gap: clamp(12px, 2vw, 24px);
  align-items: center;
  max-width: 690px;
  padding: 10px 17px 10px 10px;
  background: white;
  border: var(--line);
  border-radius: 17px;
  box-shadow: var(--lift);
  text-decoration: none;
}
.game-tile + .game-tile { margin-top: 14px; }
.game-tile:not(.soon):hover { background: #f4eaff; }
.game-tile.soon { background: var(--purple-pale); box-shadow: none; }
.tile-soon { padding: 4px 10px; border: var(--line); border-radius: 999px; background: var(--yellow); font-size: .8rem; font-weight: 800; transform: rotate(-4deg); }
.game-tile img { border: var(--line); border-radius: 10px; }
.game-tile h3 { font-size: clamp(1.42rem, 3vw, 2.2rem); line-height: 1; margin-bottom: 5px; }
.tile-meta { display: inline-block; margin-top: 8px; font-size: .87rem; font-weight: 800; }
.tile-play { display: grid; place-items: center; width: 45px; height: 45px; border: var(--line); background: var(--mint); border-radius: 50%; padding-left: 2px; }
.catalogue[data-view="galerie"] .catalogue-games { display: grid; gap: clamp(16px, 3vw, 28px); }
.catalogue[data-view="galerie"] .game-tile {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: 12px;
  max-width: none;
  margin: 0;
  padding: 0 0 14px;
}
.catalogue[data-view="galerie"] .game-tile img {
  grid-column: 1 / -1;
  border: 0;
  border-bottom: var(--line);
  border-radius: 15px 15px 0 0;
}
.catalogue[data-view="galerie"] .game-tile > div { align-self: start; padding-inline-start: 14px; }
.catalogue[data-view="galerie"] .game-tile > span { margin-inline-end: 14px; }
@media (min-width: 620px) {
  .catalogue[data-view="galerie"] .catalogue-games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.footer { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: space-between; margin-block: 50px 0; padding-block: 16px 24px; border-top: 1px solid #29143d35; font-size: .9rem; }
.footer span:first-child { font-weight: 800; }

svg { width: 1.25em; height: 1.25em; flex: none; }
::selection { background: var(--yellow); color: var(--ink); }
.tile-play svg { width: 20px; height: 20px; }
.team-dot { display: inline-block; flex: none; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: var(--team, var(--purple)); }

/* ---------- Setup ---------- */
.game-shell { margin: clamp(25px, 5vw, 55px) auto 0; }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(18px, 4vw, 44px); align-items: start; max-width: 900px; }
.setup-art { border: var(--line); border-radius: 18px; box-shadow: var(--lift); }
.game-shell h1 { font-size: clamp(2.35rem, 6vw, 4.4rem); line-height: .98; overflow-wrap: anywhere; }
.setup-copy h1 { margin-top: 20px; }
.rules { margin: 14px 0 0; padding-left: 1.3em; font-size: 1.08rem; line-height: 1.4; }
.rules li { margin-top: 6px; padding-left: 4px; }
.rules li::marker { font-weight: 800; color: var(--purple); }
.rules-tokens { margin-top: 14px; font-size: .95rem; color: #4b3560; max-width: 46ch; }
.panel { background: white; border: var(--line); border-radius: 16px; box-shadow: var(--lift); padding: clamp(15px, 3.4vw, 30px); }
.panel h2 { font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.05; }
fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 9px; font-size: 1.07rem; font-weight: 800; }
.setup-form { display: grid; gap: 21px; }
.setup-hint { font-size: .9rem; text-align: center; color: #5d4a6b; }
.team-inputs { display: grid; gap: 7px; }
.team-input { display: flex; align-items: center; gap: 9px; }
.team-input::before { content: ''; flex: none; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: var(--team); }
.team-input input { width: 100%; min-width: 0; }
.team-input input { color: var(--ink); border: var(--line); border-radius: 9px; min-height: 44px; padding: 8px 10px; background: var(--paper); }
input::placeholder { color: #694e74; }
.remove { display: grid; place-items: center; border: var(--line); background: var(--paper); min-width: 44px; min-height: 44px; border-radius: 9px; cursor: pointer; }
.remove:hover { background: var(--coral); }
.text-button { min-height: 44px; padding: 4px 0; border: 0; background: transparent; color: var(--purple); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { color: #695877; cursor: default; }
.rounds { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rounds label { position: relative; }
.rounds input, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rounds label span { display: grid; place-items: center; min-height: 52px; border: var(--line); border-radius: 9px; background: var(--paper); font-size: 1.3rem; font-weight: 800; cursor: pointer; font-variant-numeric: tabular-nums; }
.rounds input:checked + span { background: var(--mint); box-shadow: inset 0 0 0 1px var(--ink); }
.rounds input:focus-visible + span { outline: 3px solid #225dba; outline-offset: 3px; }

/* ---------- Shared controls ---------- */
.icon-button, .nudge { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; }
.icon-button:hover, .nudge:enabled:hover { background: var(--yellow); }
.ghost-button, .team-button, .toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 14px; border: var(--line); border-radius: 12px;
  background: transparent; font-weight: 800; text-decoration: none; cursor: pointer;
}
.ghost-button:enabled:hover, a.ghost-button:hover, .team-button:hover, .toggle:enabled:hover { background: var(--purple-pale); }
.ghost-button:disabled, .toggle:disabled { opacity: .42; cursor: default; }
.button.hitster { background: var(--coral); letter-spacing: .02em; }
.toggle-box { position: relative; width: 22px; height: 22px; border: var(--line); border-radius: 6px; background: white; }
.toggle[aria-pressed="true"] { background: var(--mint); }
.toggle[aria-pressed="true"] .toggle-box::after { content: ''; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px; border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }

/* ---------- Game view: one screen, built for a phone on its side ---------- */
body.playing { overflow: hidden; overscroll-behavior: none; }
body.playing .topbar, body.playing .footer { display: none; }
body.playing #app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  -webkit-tap-highlight-color: transparent;
}
body.playing button { touch-action: manipulation; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.hud {
  display: flex; align-items: center; gap: clamp(10px, 2.4vw, 22px);
  padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  border-bottom: var(--line); background: white;
}
.hud-team { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; font-size: clamp(1.2rem, 3.4vw, 1.6rem); letter-spacing: -.03em; }
.hud-team, .hud-team * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-team .team-dot { width: 18px; height: 18px; }
.hud-stats { display: inline-flex; align-items: center; gap: 14px; min-height: 46px; padding: 4px 6px 4px 12px; border: var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; }
.hud-stats:hover { background: var(--yellow); }
.hud-cards { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-cards strong { font-size: 1.25rem; }
.hud-cards svg { width: 20px; height: 20px; color: var(--purple); }
.hud-more { display: grid; place-items: center; width: 34px; height: 34px; border-left: 2px solid #29143d30; }
.tokens { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.tokens strong { font-size: 1.25rem; font-weight: 800; }
.coin { width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 50%; background: radial-gradient(circle, var(--yellow) 0 38%, #e0a800 40% 48%, var(--yellow) 50%); }

.stage {
  --cw: clamp(84px, min(24vw, (100dvh - 190px) * .72), 146px);
  --ch: calc(var(--cw) * 1.36);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  background: radial-gradient(#6744932e 1px, transparent 1px) 0 0 / 14px 14px, var(--purple-pale);
}
.stage.holding { grid-template-columns: auto minmax(0, 1fr); }
.hand { display: grid; place-items: center; align-self: stretch; padding: 10px clamp(12px, 2.4vw, 26px); border-right: 2px dashed #5527cb50; }
.hand-empty { width: var(--cw); height: var(--ch); border: 2px dashed #5527cb80; border-radius: 12px; }
.hand-empty.round { width: 70px; height: 70px; border-radius: 50%; }
.frise { display: grid; min-width: 0; }
.track, .nudge { grid-area: 1 / 1; }
.track { display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x; outline-offset: -4px; }
.track::-webkit-scrollbar { display: none; }
.track-inner { display: flex; align-items: center; width: max-content; margin-inline: auto; padding: 16px 28px 20px; }
.nudge { z-index: 3; align-self: center; margin: 0 10px; box-shadow: 0 3px 0 var(--ink); }
.nudge.prev { justify-self: start; }
.nudge.next { justify-self: end; }
.nudge:disabled { opacity: 0; pointer-events: none; }
.fallback { grid-column: 1 / -1; justify-self: center; margin-bottom: 10px; font-weight: 800; color: var(--purple); text-underline-offset: 3px; }

.gap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; flex: 0 0 18px; height: var(--ch); border-radius: 12px; transition: flex-basis 180ms cubic-bezier(.2, .8, .2, 1); }
.gap:has(.bet-chip) { flex-basis: 44px; }
.gap.mine, .gap.pending:has(.tcard) { flex-basis: calc(var(--cw) + 12px); }
.gap.pending:has(.bet-chip.big) { flex-basis: 84px; }
.gap.open { flex-basis: calc(var(--cw) + 12px); outline: 3px dashed var(--purple); outline-offset: -6px; background: #ffffff8c; }

.tcard { flex: none; width: var(--cw); height: var(--ch); perspective: 700px; }
.track-inner > .tcard { cursor: pointer; }
.tcard-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.tcard-face, .tcard-back { position: absolute; inset: 0; border: var(--line); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); backface-visibility: hidden; }
.tcard-face { display: grid; align-content: center; justify-items: center; gap: 5px; padding: 8px 7px; background: var(--card, white); text-align: center; overflow: hidden; }
.year { font-size: calc(var(--cw) * .29); line-height: 1; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(.72rem, calc(var(--cw) * .098), 1rem); font-weight: 800; line-height: 1.12; overflow-wrap: anywhere; }
.tcard-face small { font-size: clamp(.66rem, calc(var(--cw) * .082), .86rem); line-height: 1.15; }
.tcard-label { margin-top: 3px; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 999px; background: white; font-size: .7rem; font-style: normal; font-weight: 800; }
.kept .tcard-label { background: var(--mint); }
.missed .tcard-face { filter: saturate(.25); }
.missed .tcard-label { background: #ffd6e1; }
.tcard-back { display: grid; place-items: center; background: var(--purple); }
.vinyl {
  width: 82%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink);
  background:
    radial-gradient(circle, var(--yellow) 0 19%, var(--ink) 19.5% 21%, transparent 21.5%),
    repeating-radial-gradient(circle, #1f1030 0 2px, #33204a 2.5px 4px);
}
.flip .tcard-inner { animation: turn-card 700ms cubic-bezier(.16, 1, .3, 1) both; }
.flip .tcard-back { transform: rotateY(180deg); }
@keyframes turn-card {
  0% { transform: translateY(6px) rotateY(180deg) scale(.95); }
  55% { transform: translateY(-14px) rotateY(80deg) scale(1.04); }
  100% { transform: none; }
}

[data-drag] { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.mystery-card[data-drag] { transform: rotate(-2deg); }
.mystery-card[data-drag] .tcard-back { box-shadow: 0 8px 0 var(--ink); }
.lifted { opacity: .25; }
.ghost { position: fixed; z-index: 50; top: 0; left: 0; margin: 0; pointer-events: none; filter: drop-shadow(0 14px 10px #29143d55); }
.mystery-card:has([aria-pressed="true"]) .vinyl { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.play {
  position: absolute; display: grid; place-items: center; width: 54%; aspect-ratio: 1;
  border: var(--line); border-radius: 50%; background: var(--yellow); box-shadow: 0 4px 0 var(--ink);
  cursor: pointer; transition: transform 120ms, box-shadow 120ms;
}
.play svg { width: 46%; height: 46%; position: relative; }
.play:hover { transform: scale(1.05); }
.play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.play.hint::after { content: ''; position: absolute; inset: -4px; border: 3px solid var(--yellow); border-radius: 50%; animation: call 1.6s cubic-bezier(.16, 1, .3, 1) infinite; }
@keyframes call { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.play-progress {
  position: absolute; inset: -8px; border-radius: 50%;
  background: conic-gradient(white calc(var(--progress, 0) * 1turn), transparent 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.bet-chip { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: var(--line); border-radius: 50%; background: var(--team); color: var(--ink); font-weight: 800; box-shadow: 0 3px 0 var(--ink); }
.bet-chip.big { width: 70px; height: 70px; font-size: 1.9rem; box-shadow: 0 6px 0 var(--ink); }
.pick-marker { display: grid; place-items: center; flex: none; width: 30px; height: calc(var(--ch) * .86); margin-inline: 6px; border: 2px dashed #c01848; border-radius: 10px; }
.pick-marker span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .72rem; font-weight: 800; color: #b0103f; white-space: nowrap; }
.phase-reveal .track-inner { gap: 10px; }

.bar { padding: 9px max(12px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border-top: var(--line); background: white; }
.bar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 10px; max-width: 980px; margin-inline: auto; }
.bar-row .button.primary { min-width: min(170px, 100%); }
.bar-text { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar-text .bet-chip { width: 26px; height: 26px; font-size: .8rem; }
.result.good { color: #0f7a4b; }
.result.bad { color: #b0103f; }

/* ---------- Action buttons: chunky, two-line, easy to grab ---------- */
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.actions.hitsters { justify-content: flex-start; margin-right: auto; }
.action {
  --h: 58px;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: var(--h); padding: 6px 18px 6px 9px;
  border: var(--line); border-radius: 16px; background: white; color: var(--ink);
  box-shadow: 0 4px 0 var(--ink); text-align: left; cursor: pointer;
  transition: transform 140ms cubic-bezier(.2, .8, .2, 1), box-shadow 140ms;
}
.action:enabled:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.action:enabled:active { transform: translateY(3px) scale(.97); box-shadow: 0 1px 0 var(--ink); }
.action:disabled { opacity: .45; box-shadow: none; cursor: default; }
.action-icon { display: grid; place-items: center; flex: none; width: calc(var(--h) - 18px); aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 12px; background: var(--purple-pale); }
.action-icon svg { width: 58%; height: 58%; }
.action-text { display: grid; gap: 2px; line-height: 1.05; }
.action-text strong { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.action-text small { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: #4b3560; white-space: nowrap; }
.action-text small .coin { width: 14px; height: 14px; }
.action.go { background: var(--yellow); }
.action.go .action-icon { background: white; }
.action.go:enabled { animation: ready 480ms cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes ready { from { transform: scale(.92); } }
.action.hit { background: var(--team); }
.action.hit .action-icon { border: 0; background: none; }
.action.hit .bet-chip { width: 100%; height: 100%; background: white; box-shadow: none; }
.action.hit strong { letter-spacing: .01em; }
.action.hit small { color: var(--ink); }
.action.toggle { gap: 12px; padding-left: 14px; }
.action.toggle .toggle-box { width: 28px; height: 28px; }
.action.toggle .toggle-box::after { left: 8px; top: 3px; width: 7px; height: 13px; }
.action.toggle[aria-pressed="true"] { background: var(--mint); }

@media (max-height: 460px) and (orientation: landscape) {
  .action { --h: 50px; padding-block: 4px; }
  .action-text strong { font-size: 1.05rem; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .actions { width: 100%; }
  .action { flex: 1 1 0; justify-content: center; }
}

/* ---------- iPad and tablets: the device is passed around, so everything grows ---------- */
@media (min-width: 900px) and (min-height: 600px) {
  .hud { padding: 10px 24px; gap: 26px; }
  .hud-team { font-size: 2.1rem; gap: 14px; }
  .hud-team .team-dot { width: 24px; height: 24px; }
  .hud-stats { min-height: 58px; gap: 18px; padding-left: 16px; border-radius: 16px; }
  .hud-cards strong, .tokens strong { font-size: 1.6rem; }
  .hud-cards svg { width: 26px; height: 26px; }
  .coin { width: 26px; height: 26px; }
  .hud-more { width: 44px; height: 44px; }
  .stage { --cw: clamp(130px, min(19vw, (100dvh - 300px) * .72), 232px); }
  .hand { padding-inline: 36px; }
  .track-inner { padding: 24px 40px 28px; }
  .gap { flex-basis: 24px; }
  .bet-chip.big { width: 96px; height: 96px; font-size: 2.6rem; }
  .bar { padding: 14px 24px max(14px, env(safe-area-inset-bottom)); }
  .bar-row { max-width: none; gap: 14px 20px; }
  .bar-text { font-size: 1.45rem; }
  .bar-text .bet-chip { width: 34px; height: 34px; font-size: 1rem; }
  .actions { gap: 14px; }
  .action { --h: 80px; gap: 14px; padding: 8px 28px 8px 12px; border-radius: 22px; box-shadow: 0 6px 0 var(--ink); }
  .action:enabled:hover { box-shadow: 0 8px 0 var(--ink); }
  .action-icon { border-radius: 16px; }
  .action-text strong { font-size: 1.6rem; }
  .action-text small { font-size: 1rem; }
  .action-text small .coin { width: 18px; height: 18px; }
  .action.toggle .toggle-box { width: 36px; height: 36px; }
  .action.toggle .toggle-box::after { left: 11px; top: 4px; width: 9px; height: 17px; }
  .nudge { width: 56px; height: 56px; }
}

/* ---------- Menu & finale ---------- */
.dialog { width: min(470px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; color: var(--ink); }
.dialog::backdrop { background: #29143da8; }
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.score-row { border-bottom: 1px solid #29143d25; padding-block: 4px 10px; }
.score-row .ghost-button { width: 100%; margin-top: 2px; }
.score { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding-block: 8px; text-align: left; }
.score strong { overflow-wrap: anywhere; font-size: 1.1rem; }
.score > span:nth-of-type(2) { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score svg { width: 18px; height: 18px; color: var(--purple); }
.menu-note { margin-top: 12px; font-size: .92rem; color: #5d4a6b; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.finale { max-width: 520px; margin-inline: auto; text-align: center; }
.finale > p { margin-top: 8px; font-size: 1.2rem; font-weight: 800; overflow-wrap: anywhere; }
.finale .finale-note { font-size: 1rem; font-weight: 600; color: #5d4a6b; }
.finale .score { border-bottom: 1px solid #29143d25; }
.finale .score:first-of-type { margin-top: 18px; }
.finale .button { margin-top: 20px; }
.trophy { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 10px; border: var(--line); border-radius: 50%; background: var(--yellow); }
.trophy svg { width: 32px; height: 32px; color: var(--purple); }

@media (max-width: 760px) {
  .wrap { width: min(100% - 28px, 560px); }
  .topbar-inner { min-height: 56px; }
  .brand { font-size: 1.45rem; }
  .hero { grid-template-columns: 1fr; gap: 13px; min-height: 0; padding: 22px 20px 12px; margin-block: 17px 37px; }
  .hero::before { inset: 38% 0 0; }
  .hero h1 { font-size: clamp(3.45rem, 12vw, 5.4rem); }
  .hero-art img { width: 100%; margin: 0; }
  .setup { grid-template-columns: minmax(0, 1fr); }
  .setup-art { max-height: 220px; object-fit: cover; }
  .game-tile { grid-template-columns: minmax(75px, 26%) minmax(0, 1fr) auto; }
  .tile-play { width: 37px; height: 37px; }
  .tile-meta { margin-top: 4px; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .bar { padding-block: 7px max(7px, env(safe-area-inset-bottom)); }
  .button, .ghost-button, .team-button, .toggle { min-height: 44px; padding-block: 6px; }
  .slot-label { padding-bottom: 6px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .phase-place .frise::before {
    content: 'Astuce : tourne le téléphone';
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1;
    width: max-content; max-width: calc(100% - 24px); padding: 4px 12px;
    border: 2px solid var(--ink); border-radius: 999px; background: white;
    font-size: .8rem; font-weight: 700;
  }
  .bar-row .button.primary { flex: 1; }
  .stage { --cw: clamp(84px, 30vw, 130px); }
  .stage.holding { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .hand { order: 2; border-right: 0; border-top: 2px dashed #5527cb50; }
}
@media (hover: none) {
  .nudge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.tcard-face .bet-chip { width: 28px; height: 28px; font-size: .85rem; margin-top: 2px; }

.mini-line { display: flex; gap: 5px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.mini-card { flex: none; display: grid; place-items: center; min-width: 50px; height: 34px; padding-inline: 6px; border: 2px solid var(--ink); border-radius: 7px; background: var(--card); font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums; }

/* ---------- Banco ---------- */
.hud-round { font-weight: 700; color: #5d4a6b; white-space: nowrap; }
.bstage {
  --pc: clamp(30px, min(7vw, ((100dvh - 150px) / var(--rows) - 12px) * .72), 76px);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  background: radial-gradient(ellipse at 60% 40%, #3f8f66, #1f5a40 75%);
  overflow: hidden;
}
.bstage::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(#ffffff14 1px, transparent 1px) 0 0 / 9px 9px; }

/* Playing cards */
.pc {
  --w: var(--pc);
  position: relative; display: grid; place-items: center; flex: none;
  width: var(--w); height: calc(var(--w) * 1.4); padding: 0;
  border: 2px solid var(--ink); border-radius: calc(var(--w) * .14);
  background: var(--card, white); box-shadow: 0 3px 0 var(--ink), inset 0 0 0 calc(var(--w) * .06) #ffffffb0;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.pc b { font-size: calc(var(--w) * .58); font-weight: 800; line-height: 1; letter-spacing: -.05em; text-shadow: 0 2px 0 #ffffff90; }
.pc i { position: absolute; font-style: normal; font-weight: 800; font-size: calc(var(--w) * .2); line-height: 1; }
.pc i:first-of-type { top: 7%; left: 10%; }
.pc i:last-of-type { bottom: 7%; right: 10%; transform: rotate(180deg); }
.pc svg { width: 58%; height: auto; color: var(--purple); }
.pc small { position: absolute; bottom: 6%; left: 0; right: 0; text-align: center; font-size: calc(var(--w) * .13); font-weight: 800; line-height: 1; }
.pc.add, .pc.x2 { background: repeating-linear-gradient(-45deg, var(--yellow) 0 6px, #ffe97a 6px 12px); }
.pc.add b, .pc.x2 b { font-size: calc(var(--w) * .44); }
.pc.freeze { background: #d6f1ff; }
.pc.freeze svg { color: #1c6fb8; }
.pc.three { background: #ffd9a8; }
.pc.three svg { color: #c4441c; }
.pc.second { background: #ffd6e1; }
.pc.second svg { color: #d61f55; }
.pc.back {
  background:
    radial-gradient(circle, var(--yellow) 0 14%, var(--ink) 14.5% 17%, transparent 17.5%),
    repeating-linear-gradient(45deg, #6a3df0 0 5px, var(--purple) 5px 10px);
  box-shadow: inset 0 0 0 calc(var(--w) * .07) white;
}
.pc.slot { border-style: dashed; border-color: #ffffff80; background: transparent; box-shadow: none; }

/* Player rows */
.broster { position: relative; display: grid; grid-auto-rows: minmax(0, 1fr); align-content: center; gap: 6px; min-height: 0; margin: 0; padding: 8px 6px 8px max(10px, env(safe-area-inset-left)); list-style: none; }
.brow {
  display: grid; grid-template-columns: minmax(78px, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 0; padding: 4px 12px; border: var(--line); border-radius: 14px; background: #fffdf6;
  transition: transform 200ms cubic-bezier(.2, .8, .2, 1);
}
.brow.active { background: var(--team); box-shadow: 0 4px 0 var(--ink), 0 0 0 4px #ffffffaa; transform: translateX(6px); }
.brow.bust { background: #e8dbe3; }
.brow.bust .brow-cards { filter: grayscale(.85); opacity: .6; }
.brow.stayed, .brow.frozen { background: #e9f6ee; }
.brow.frozen { background: #e3f3ff; }
.brow.seven { background: var(--mint); }
.brow-name { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 7px; align-items: center; min-width: 0; }
.brow-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.brow-name small { grid-column: 2; font-weight: 700; color: #4b3560; font-variant-numeric: tabular-nums; font-size: .78rem; }
.brow-cards { display: flex; align-items: center; min-width: 0; padding-left: 4px; }
.brow-cards { gap: 4px; }
.brow-cards .pc:nth-child(odd) { transform: rotate(-2deg); }
.brow-cards .pc:nth-child(even) { transform: rotate(2deg) translateY(-1px); }
.brow-cards .pc.held { margin-left: calc(var(--pc) * .3); transform: rotate(6deg); }
.brow-cards .pc i { display: none; }
.brow-cards .pc small { display: none; }
.brow-score { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.brow-score strong { min-width: 2.2ch; font-size: 1.6rem; font-weight: 800; text-align: right; }
.brow-score em { padding: 2px 9px; border: 2px solid var(--ink); border-radius: 999px; background: white; font-size: .75rem; font-style: normal; font-weight: 800; white-space: nowrap; }
.brow-score em.you { background: var(--yellow); animation: ready 480ms cubic-bezier(.2, 1.6, .4, 1) both; }
.bust .brow-score em { background: #ffb3c6; }
.brow .pc.new { animation: deal 460ms cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes deal { from { transform: translate(40px, -18px) rotate(14deg) scale(.7); opacity: 0; } }
.brow.bust:has(.new) { animation: shake 420ms both; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Draw pile + revealed card */
.bpile { position: relative; display: grid; grid-template-rows: auto auto; align-content: center; justify-items: center; gap: 14px; padding: 10px max(14px, env(safe-area-inset-right)) 10px 10px; --pcb: clamp(58px, min(13vw, (100dvh - 190px) / 2 / 1.4), 120px); }
.bpile .pc { --w: var(--pcb); }
.bdeck { position: relative; padding: 0; border: 0; background: none; cursor: pointer; }
.bdeck .pc { box-shadow: 3px 3px 0 #ffffffd0, 5px 5px 0 var(--ink), 7px 7px 0 #ffffffd0, 9px 9px 0 var(--ink); transition: transform 140ms; }
.bdeck:enabled:hover .pc { transform: translate(-2px, -3px) rotate(-2deg); }
.bdeck:enabled:active .pc { transform: translate(2px, 2px); }
.bdeck:disabled { cursor: default; opacity: .8; }
.bdeck-count { position: absolute; top: -9px; right: -14px; min-width: 30px; padding: 2px 7px; border: 2px solid var(--ink); border-radius: 999px; background: white; font-weight: 800; font-size: .8rem; font-variant-numeric: tabular-nums; }
.bdrawn { position: relative; display: grid; justify-items: center; perspective: 600px; }
.bdrawn .pc.flip { animation: reveal 560ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes reveal { 0% { transform: translateY(calc(var(--pcb) * -1.2)) rotateY(180deg) scale(.9); } 60% { transform: translateY(-8px) rotateY(-12deg) scale(1.06); } 100% { transform: none; } }
.bdrawn-who { position: absolute; bottom: -10px; max-width: 120%; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 999px; background: var(--team); font-size: .75rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stamp { position: absolute; top: 34%; padding: 2px 8px; border: 3px solid #c0103f; border-radius: 8px; background: #fff0f4; color: #c0103f; font-style: normal; font-weight: 800; font-size: 1rem; text-transform: uppercase; transform: rotate(-14deg); animation: stamp 420ms 300ms cubic-bezier(.2, 1.6, .4, 1) both; }
.stamp.saved { border-color: #0f7a4b; color: #0f7a4b; background: #eafff2; }
@keyframes stamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } }
.bdrawn.bust .pc { filter: saturate(.5); }

.blog { font-size: 1rem; font-weight: 600; flex-wrap: wrap; }
.blog b { font-weight: 800; }

@media (max-height: 460px) and (orientation: landscape) {
  .broster { gap: 4px; padding-block: 5px; }
  .brow { padding-block: 2px; }
  .brow-score strong { font-size: 1.3rem; }
  .bpile { gap: 10px; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .brow { grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto; border-radius: 18px; }
  .brow-name strong { font-size: 1.45rem; }
  .brow-name small { font-size: .95rem; }
  .brow-score strong { font-size: 2.2rem; }
  .brow-score em { font-size: .95rem; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .hud-round { display: none; }
  .bstage { --pc: clamp(22px, ((100dvh - 330px) / var(--rows) - 42px) / 1.4, 54px); grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .bpile { grid-template-rows: none; grid-auto-flow: column; justify-content: center; gap: 30px; padding-block: 6px 12px; --pcb: 64px; }
  .brow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding: 5px 8px; }
  .brow-cards { grid-column: 1 / -1; order: 3; flex-wrap: wrap; }
  .brow-name small { display: none; }
}

/* ---------- Banco: one player's full screen ---------- */
.hud .icon-button svg { width: 22px; height: 22px; }
.pstage { --pcb: clamp(58px, min(12vw, (100dvh - 200px) / 2 / 1.4), 110px); }
.pstage::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 6px var(--team); }
.pmain { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; min-height: 0; padding: 10px 6px 10px max(14px, env(safe-area-inset-left)); }
.phead { display: flex; align-items: center; gap: 10px; color: white; }
.pscore { font-size: clamp(2.2rem, 9dvh, 4.2rem); font-weight: 800; line-height: .9; letter-spacing: -.05em; text-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; }
.punit { font-size: .8rem; font-weight: 700; line-height: 1.1; opacity: .9; }
.pips { display: flex; gap: 5px; margin-left: auto; padding: 6px 9px; border: 2px solid var(--ink); border-radius: 999px; background: #00000030; }
.pips i { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: #ffffff40; }
.pips i.on { background: var(--yellow); }
.pcards {
  --pc: clamp(48px, min(10.5vw, (100dvh - 250px) / 1.4), 128px);
  position: relative; display: flex; flex-wrap: wrap; align-content: center; align-items: center; gap: 10px; min-height: 0;
}
.pcards .pc:nth-child(odd) { transform: rotate(-1.5deg); }
.pcards .pc:nth-child(even) { transform: rotate(1.5deg); }
.pcards .pc.held { margin-left: 8px; transform: rotate(5deg); }
.pcards .pc.new { animation: deal 520ms cubic-bezier(.2, 1.3, .4, 1) both; }
.pcards.bust .pc { filter: grayscale(.85); opacity: .6; }
.pempty { color: #ffffffc0; font-weight: 700; }
.pstamp {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  padding: 6px 18px; border: 4px solid var(--ink); border-radius: 12px; background: white;
  font-style: normal; font-weight: 800; font-size: clamp(1.4rem, 7dvh, 2.6rem); text-transform: uppercase; letter-spacing: .02em;
  rotate: -8deg; box-shadow: 0 5px 0 var(--ink); animation: stamp 420ms 250ms cubic-bezier(.2, 1.6, .4, 1) both;
}
.pstamp.bust { background: #ff6c8d; }
.pstamp.stayed, .pstamp.frozen { background: #d6f1ff; }
.pstamp.seven { background: var(--mint); }
.pothers { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pothers li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border: 2px solid var(--ink); border-radius: 999px; background: #fffdf6; font-size: .85rem; font-weight: 700; }
.pothers li strong { font-variant-numeric: tabular-nums; }
.pothers li em { font-style: normal; font-size: .7rem; font-weight: 800; color: #6b4e7a; }
.pothers li.bust { opacity: .6; }
.pothers li.next { background: var(--team); box-shadow: 0 3px 0 var(--ink); }
.pothers .team-dot { width: 11px; height: 11px; }
@media (min-width: 900px) and (min-height: 600px) {
  .pothers li { font-size: 1.1rem; padding: 5px 14px 5px 8px; }
  .punit { font-size: 1rem; }
  .pips i { width: 18px; height: 18px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  /* Vertical phone: score on top, hand in the middle, pile below, other players last. */
  .pstage { display: flex; flex-direction: column; --pcb: clamp(64px, min(22vw, 12dvh), 100px); }
  .pmain { display: contents; }
  .phead { order: 1; padding: 12px 16px 0; }
  .pscore { font-size: clamp(2.8rem, 8dvh, 4rem); }
  .pcards {
    order: 2; flex: 1; justify-content: center; align-content: center; gap: 8px 10px; padding: 8px 14px;
    --pc: min(calc((100vw - 28px - (var(--cols) - 1) * 10px) / var(--cols)), calc((100dvh - 420px) / 3 / 1.4 - 6px), 110px);
  }
  .pcards .pc i { font-size: calc(var(--w) * .18); }
  .pstage .bpile { order: 3; display: flex; justify-content: center; align-items: center; gap: 34px; padding: 6px 16px 12px; border-top: 2px dashed #ffffff40; }
  .pstage .bdrawn-who { bottom: -12px; }
  .pothers { order: 4; flex-wrap: nowrap; overflow-x: auto; padding: 8px 14px 12px; scrollbar-width: none; background: #00000026; }
  .pothers::-webkit-scrollbar { display: none; }
  .pothers li { flex: none; }
  .pstamp { top: 50%; }
}
