:root {
  --bg: #fff7ec;
  --surface: #ffffff;
  --surface-2: #f6ebdc;
  --ink: #2b211a;
  --ink-2: #6f6158;
  --line: #ead9c4;
  --primary: #e2553b;
  --primary-ink: #ffffff;
  --good: #1f9d6b;
  --danger: #c8372d;
  --shadow: 0 1px 2px rgb(60 35 15 / 0.06), 0 6px 18px rgb(60 35 15 / 0.08);
  --radius: 18px;
  --tc: var(--primary);
  --tc-soft: #fde4dd;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1714;
    --surface: #27201b;
    --surface-2: #332a23;
    --ink: #f6ece2;
    --ink-2: #b7a597;
    --line: #42362d;
    --primary: #f06a4f;
    --good: #37b984;
    --danger: #ef5b4f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    --tc-soft: #4a2a22;
    color-scheme: dark;
  }
}

/* Team colours */
/* --tc-strong carries white text on the turn screen, in both colour schemes. */
.c0 { --tc: #e2553b; --tc-soft: #fde4dd; --tc-strong: #c9442b; }
.c1 { --tc: #138a7c; --tc-soft: #d5f1ec; --tc-strong: #0e7569; }
.c2 { --tc: #6c4fd0; --tc-soft: #e6e0fb; --tc-strong: #5b3fc0; }
.c3 { --tc: #d18a12; --tc-soft: #fbedd2; --tc-strong: #a4640a; }
@media (prefers-color-scheme: dark) {
  .c0 { --tc: #f06a4f; --tc-soft: #4a2a22; }
  .c1 { --tc: #2fb3a3; --tc-soft: #173d38; }
  .c2 { --tc: #9a83ef; --tc-soft: #2f2650; }
  .c3 { --tc: #f0aa33; --tc-soft: #4a3816; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.4; }
:focus-visible { outline: 3px solid var(--tc); outline-offset: 2px; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 24px) max(16px, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.1rem; font-weight: 800; }
.small-h { font-size: 0.85rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 14px 0 8px; }
.card .small-h:first-child { margin-top: 0; }
.hint { color: var(--ink-2); font-size: 0.92rem; margin: 6px 0; }
.center { text-align: center; }
.lead { font-size: 1.12rem; margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.82rem; font-weight: 800; color: var(--ink-2); margin: 0; }
.display { font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 900; letter-spacing: -0.01em; }
.error { color: var(--danger); font-weight: 700; text-align: center; margin: 10px 0; }
.empty { color: var(--ink-2); text-align: center; padding: 24px 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > :only-child { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card > h2 + .seg, .card > h2 + .chips { margin-top: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.08s ease, background 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.team-btn { background: var(--tc); color: #fff; }
.btn.big { min-height: 60px; font-size: 1.15rem; border-radius: 18px; width: 100%; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 0.95rem; }
.btn.ghost { background: transparent; box-shadow: none; border: 2px dashed var(--line); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: none; border: 2px solid currentColor; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; font-size: 1.5rem; line-height: 1;
  display: inline-grid; place-items: center; color: var(--ink);
}
.icon-btn.small { width: 44px; height: 44px; font-size: 1rem; }
.icon-btn:active { background: var(--surface-2); }

/* Top bar */
.topbar {
  display: grid;
  grid-template-columns: 44px 1fr minmax(44px, auto);
  align-items: center;
  gap: 8px;
  margin: 0 -6px 12px;
  min-height: 52px;
}
.topbar h1 { font-size: 1.1rem; font-weight: 800; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-extra { display: flex; justify-content: flex-end; }
.bowl-count { font-weight: 800; font-size: 0.95rem; background: var(--surface); padding: 4px 10px; border-radius: 99px; box-shadow: var(--shadow); white-space: nowrap; }

/* Segmented control */
.seg {
  display: flex;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
}
.seg button {
  flex: 1 1 0;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 700;
  font-size: 0.93rem;
  color: var(--ink-2);
  padding: 4px 6px;
  line-height: 1.15;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Toggle row */
.toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: 0;
  padding: 10px 0;
  text-align: left;
}
.toggle + .toggle { border-top: 1px solid var(--line); }
.toggle-text { display: flex; flex-direction: column; font-weight: 700; }
.toggle-text small { font-weight: 400; color: var(--ink-2); font-size: 0.86rem; }
.switch { flex: none; width: 52px; height: 32px; border-radius: 99px; background: var(--line); position: relative; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.2s; }
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(20px); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-label { flex: 1; font-weight: 700; }
.stepper output { min-width: 2.2ch; text-align: center; font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1.4rem; font-weight: 800; }

/* Chips */
.chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 38px; padding: 4px 6px 4px 14px;
  border-radius: 99px; background: var(--tc-soft); color: var(--ink);
  font-weight: 700; border: 0;
}
.chip button { border: 0; background: transparent; width: 40px; height: 40px; margin: -4px -2px; border-radius: 50%; font-size: 0.8rem; color: var(--ink-2); }
.chip.add { padding-right: 14px; background: var(--surface-2); }
.toggle-chip { padding-right: 14px; background: var(--surface-2); color: var(--ink-2); }
.toggle-chip.on { background: var(--primary); color: #fff; }

/* Forms */
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  font-size: 16px; /* keeps iOS from zooming in */
}
input[type="text"]:focus { outline: none; border-color: var(--tc); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; min-width: 0; }

/* Home */
.home { display: flex; flex-direction: column; flex: 1; gap: 12px; }
.lang-switch { align-self: flex-end; width: 120px; }
.hero { text-align: center; padding: 12px 0 20px; }
.hero-bowl { width: 160px; height: auto; }
.logo { font-size: clamp(2.6rem, 13vw, 3.6rem); font-weight: 900; letter-spacing: -0.02em; color: var(--primary); margin-top: 4px; }
.tagline { margin: 2px 0 0; color: var(--ink-2); font-weight: 700; }
.menu { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }

.bowl .slips rect { fill: #fffdf8; stroke: var(--ink); stroke-width: 2.5; }
.bowl .bowl-body { fill: #ffd166; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.bowl .bowl-rim { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.hero-bowl .slips { animation: bob 3.2s ease-in-out infinite; transform-origin: 60px 40px; }
.mid-bowl { width: 120px; margin: 8px auto; display: block; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }

/* Setup */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: s; }
.steps li { flex: 1; text-align: center; font-size: 0.82rem; font-weight: 800; color: var(--ink-2); padding-top: 8px; border-top: 4px solid var(--line); counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.on { color: var(--ink); border-color: var(--primary); }
.steps li.done { border-color: var(--good); }
.team { border-top: 6px solid var(--tc); }
.team-head { display: flex; align-items: center; gap: 8px; }
.team-name { font-weight: 800; font-size: 1.1rem !important; border-color: transparent !important; background: transparent !important; padding-left: 4px !important; }
.team-name:focus { border-color: var(--tc) !important; background: var(--bg) !important; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--tc); flex: none; margin-right: 6px; vertical-align: 0.05em; }
.bottom-bar {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 16px 0 calc(env(safe-area-inset-bottom) + 4px);
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.reveal { margin-top: 10px; }
.words-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.word-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 10px; padding-left: 10px; font-weight: 600; font-size: 0.95rem; }
.word-chip.custom { background: var(--tc-soft); }
.word-chip button { border: 0; background: transparent; width: 40px; height: 40px; color: var(--ink-2); }
.phase-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.phase-pick { display: flex; align-items: center; gap: 8px; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: transparent; font-weight: 700; padding: 6px 12px; color: var(--ink-2); }
.phase-pick.on { border-color: var(--primary); background: var(--tc-soft); color: var(--ink); }
.phase-pick span:first-child { font-size: 1.3rem; }

/* Slips */
.slip { font-size: 1.15rem !important; }
.progress-dots { display: flex; justify-content: center; gap: 6px; margin: 0 0 14px; }
.progress-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.progress-dots span.done { background: var(--good); }
.progress-dots span.on { background: var(--primary); transform: scale(1.3); }

/* Centered game screens */
.center-screen { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; flex: 1; justify-content: center; padding-bottom: 12px; }
.center-screen > .card { width: 100%; }
.center-screen > .btn { width: 100%; }
.big-name { font-size: 1.5rem; font-weight: 800; margin: 0; }
.phase-badge { font-size: 3.2rem; width: 96px; height: 96px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.phase-intro .lead { max-width: 30ch; }
.team-title { color: var(--tc); display: flex; align-items: center; gap: 6px; }
.team-title .dot { width: 18px; height: 18px; }
.pill { background: var(--tc-soft); border-radius: 99px; padding: 6px 14px; font-weight: 700; margin: 0; }
.ready .btn.big { margin-top: 6px; }

/* Score table */
.scores { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scores th, .scores td { padding: 8px 4px; text-align: center; }
.scores thead th { font-size: 1.1rem; }
.scores thead th:last-child { font-size: 0.8rem; text-transform: uppercase; color: var(--ink-2); }
.scores tbody th { text-align: left; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.scores tbody tr + tr { border-top: 1px solid var(--line); }
.scores .total { font-weight: 900; font-size: 1.25rem; color: var(--tc); }
.scores .future { color: var(--line); }

/* The turn */
body[data-screen="play-turn"] .screen { padding: 0; max-width: none; }
.turn {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--tc-strong);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 6px) max(14px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 14px) max(14px, env(safe-area-inset-left));
  user-select: none;
  -webkit-user-select: none;
}
.turn-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.turn-top .icon-btn { justify-self: end; color: #fff; font-size: 1.1rem; background: rgb(255 255 255 / 0.18); }
.turn-phase { font-weight: 800; font-size: 0.95rem; opacity: 0.9; }
.timer { font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.timebar { height: 8px; background: rgb(255 255 255 / 0.25); border-radius: 99px; overflow: hidden; margin: 10px 0 0; }
#timer-fill { height: 100%; background: #fff; transform-origin: left center; border-radius: 99px; transition: transform 0.1s linear; }
.turn.hurry .timer { animation: pulse 1s ease-in-out infinite; }
.turn.hurry #timer-fill { background: #ffe36e; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.word-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; padding: 16px 0; }
.slip-card {
  width: 100%;
  max-width: 480px;
  min-height: 30vh;
  background: #fffdf8;
  color: #2b211a;
  border-radius: 22px;
  display: grid;
  place-items: center;
  padding: 20px;
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.25);
  transform: rotate(-1deg);
  animation: slip-in 0.22s ease-out;
}
.slip-card span {
  font-size: clamp(2.1rem, 11vw, 3.6rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.slip-card.long span { font-size: clamp(1.7rem, 8.5vw, 2.8rem); }
@keyframes slip-in { from { transform: translateY(18px) rotate(3deg) scale(0.96); opacity: 0; } }
.turn-meta { margin: 0; font-weight: 700; opacity: 0.9; }
.turn-actions {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas: "undo skip" "got got";
  gap: 10px;
}
.turn-actions .btn { min-height: 60px; font-size: 1.15rem; border-radius: 20px; box-shadow: none; padding: 8px 10px; min-width: 0; }
.turn-actions .undo { grid-area: undo; background: rgb(255 255 255 / 0.18); color: #fff; font-size: 1.6rem; padding: 0; }
.turn-actions .undo.wide { grid-column: 1 / -1; font-size: 1.1rem; }
.turn-actions .skip { grid-area: skip; background: rgb(0 0 0 / 0.2); color: #fff; }
/* The button that gets hammered under time pressure: as big as the thumb zone allows. */
.turn-actions .got {
  grid-area: got;
  min-height: max(128px, 24vh);
  background: #fff;
  color: var(--tc-strong);
  font-size: clamp(1.8rem, 9vw, 2.4rem);
  font-weight: 900;
  border-radius: 26px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.22);
}
.turn-actions .got:active { transform: scale(0.98); background: #f1fff7; }
.turn.is-paused .turn-actions { grid-template-areas: "got got"; }
.turn.is-paused .slip-card span { font-size: 2rem; color: #6f6158; }

/* Review */
.review .dot { width: 14px; height: 14px; }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.review-item {
  width: 100%; display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 8px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); text-align: left; font-weight: 700; font-size: 1.1rem;
}
.review-item.on { border-color: var(--good); }
.review-item .check { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 900; color: #fff; }
.review-item.on .check { background: var(--good); border-color: var(--good); }
.rw-wrap { display: flex; flex-direction: column; min-width: 0; }
.rw { overflow-wrap: anywhere; hyphens: auto; }
.review-item:not(.on) .rw { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 2px; }
.rw-wrap small { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.review-title { animation: pop 0.5s ease-out; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } }
.points { font-size: 1.6rem; font-weight: 900; color: var(--good); margin: 4px 0 0; }

/* Results */
.finished { position: relative; overflow: hidden; }
.finished .display { color: var(--tc); }
.podium { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.podium li { display: flex; align-items: center; gap: 10px; text-align: left; }
.podium .medal { font-size: 1.5rem; }
.podium .pname { flex: 1; font-weight: 800; }
.podium .pval { color: var(--ink-2); font-weight: 700; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px;
  left: calc(var(--i) * 4.2%);
  width: 9px; height: 15px; border-radius: 2px;
  background: hsl(calc(var(--i) * 47) 85% 60%);
  animation: fall calc(2.4s + var(--i) * 0.07s) ease-in calc(var(--i) * -0.13s) 2 forwards;
  opacity: 0;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(calc(var(--i) * 70deg)); opacity: 0.9; }
}

/* Stats */
.leaderboard, .profile-list, .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 0; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); text-align: left;
}
.rank { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 900; flex: none; }
.leaderboard li:nth-child(1) .rank { background: #f5c542; color: #3b2a00; }
.leaderboard li:nth-child(2) .rank { background: #cfd5db; color: #222; }
.leaderboard li:nth-child(3) .rank { background: #e0a46c; color: #3b1f00; }
.lb-name { flex: 1; font-weight: 800; display: flex; flex-direction: column; min-width: 0; }
.lb-name small, .lb-wins small { font-weight: 600; color: var(--ink-2); font-size: 0.82rem; }
.lb-wins { display: flex; flex-direction: column; align-items: flex-end; font-weight: 900; font-size: 1.3rem; line-height: 1.1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 900; flex: none; }
.chev { color: var(--ink-2); font-size: 1.4rem; }
body[data-screen="stats"] .seg { margin-bottom: 12px; }
.backup { margin-top: 20px; }
.hist { padding: 12px 14px; }
.hist-head { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: 0.88rem; font-weight: 700; }
.hist-teams { list-style: none; margin: 4px 0 0; padding: 0; }
.hist-teams li { display: flex; align-items: center; gap: 4px; padding: 6px 0; }
.hist-teams li + li { border-top: 1px solid var(--line); }
.hist-teams .hn { flex: 1; font-weight: 700; display: flex; flex-direction: column; min-width: 0; }
.hist-teams .hn small { color: var(--ink-2); font-weight: 500; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-teams .hs { font-weight: 900; font-size: 1.2rem; color: var(--ink-2); }
.hist-teams .win .hs { color: var(--tc); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 420px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tv { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tl { font-size: 0.8rem; color: var(--ink-2); font-weight: 700; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: 8.5em 1fr 2.5em; align-items: center; gap: 8px; font-size: 0.92rem; }
.bl { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bv { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.95rem; }
.recent li + li { border-top: 1px solid var(--line); }
.recent .rs { margin-left: auto; font-variant-numeric: tabular-nums; }
.res { font-size: 0.78rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); min-width: 5.5em; text-align: center; }
.res.won { background: var(--good); color: #fff; }

/* Rules */
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.phase-card { display: flex; gap: 14px; align-items: flex-start; }
.phase-card p { margin: 4px 0 0; }
.phase-icon { font-size: 1.8rem; width: 52px; height: 52px; flex: none; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; }

/* Modal & toast */
.modal-backdrop { position: fixed; inset: 0; background: rgb(20 12 6 / 0.5); z-index: 10; animation: fade 0.15s; }
.modal {
  position: fixed; z-index: 11;
  left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  background: var(--surface); color: var(--ink);
  border-radius: 24px; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
  animation: rise 0.2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px);
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 99px; font-weight: 700; max-width: calc(100% - 32px); text-align: center;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
