/* Town & Country — a school notebook on a warm desk: ruled paper, a red margin, ink, a pencil that
   is the clock, rubber-stamped points. Light and dark; springy, transform-only motion. */
:root {
  color-scheme: light;
  --desk: #ece3d1; --desk-hi: #f7f1e5; --paper: #fffdf8; --paper-2: #f5efe3; --paper-3: #ebe3d3;
  --ink: #1d2742; --ink-soft: #535d74;
  --rule: rgba(57, 107, 196, 0.15); --rule-strong: rgba(57, 107, 196, 0.42); --margin: rgba(214, 78, 66, 0.5);
  --line: rgba(29, 39, 66, 0.12);
  --blue: #2a4fd0; --on-blue: #fff; --red: #c8372a; --on-red: #fff; --green: #1f7a4a; --gold: #e2a92a; --gold-soft: #fbedc7;
  --pencil: #f3bb3a; --pencil-dark: #dc9b1b; --wood: #f1cd9f; --lead: #33343c; --eraser: #ee8c9c; --band: #b8bfcb;
  --c1: #c94431; --c2: #2a62c9; --c3: #1f7d50; --c4: #9a6008; --c5: #8443c2; --c6: #c23a70; --on-c: #fff;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 12px 26px -16px rgba(70, 45, 10, 0.4), 0 2px 5px -2px rgba(70, 45, 10, 0.16);
  --shadow-lg: 0 26px 50px -24px rgba(70, 45, 10, 0.5), 0 6px 14px -6px rgba(70, 45, 10, 0.2);
  --spring: cubic-bezier(0.22, 1.36, 0.36, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --round: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  --ca-accent: #2a4fd0; /* the accounts SDK's sheets and chip */
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --desk: #10131b; --desk-hi: #181d2a; --paper: #1c2131; --paper-2: #242a3c; --paper-3: #2c3347;
    --ink: #f0ebdf; --ink-soft: #b1b7c6;
    --rule: rgba(130, 160, 255, 0.11); --rule-strong: rgba(130, 160, 255, 0.34); --margin: rgba(255, 120, 105, 0.42);
    --line: rgba(255, 255, 255, 0.1);
    --blue: #7b96ff; --on-blue: #0d1222; --red: #ff7a66; --on-red: #1d0c08; --green: #5fcf92; --gold: #f2c24c; --gold-soft: #3a3322;
    --pencil: #f0b43b; --pencil-dark: #c98d16; --wood: #d9b285; --lead: #15161b; --eraser: #e07a8b; --band: #8c93a1;
    --c1: #ff8a73; --c2: #7aa6ff; --c3: #5fcf92; --c4: #f6b74a; --c5: #c595ff; --c6: #ff86b0; --on-c: #11141c;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 14px 28px -16px rgba(0, 0, 0, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 28px 56px -24px rgba(0, 0, 0, 0.8), 0 6px 14px -6px rgba(0, 0, 0, 0.5);
    --ca-accent: #7b96ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS
   fallback; this copy covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; background: var(--desk); }
body {
  margin: 0; min-height: calc(100dvh / var(--ca-zoom, 1)); display: flex; flex-direction: column;
  background: radial-gradient(120% 70% at 50% -8%, var(--desk-hi), transparent 72%) no-repeat, var(--desk);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* (--ca-space-top: the strip the call rests in while the game is played inside a Shared Space) */
  padding: calc(env(safe-area-inset-top) + var(--ca-space-top, 0px)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body[data-screen="game"], body[data-screen="podium"] { height: calc(100dvh / var(--ca-zoom, 1)); overflow: hidden; }
/* a game page: no text selection or long-press callouts anywhere, HUD and
   menus included; form fields and long text (the Help sheet) opt back in */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable], .prose p, .prose li { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }
h2:focus, h2:focus-visible { outline: none; }

/* ---- the bar ------------------------------------------------------------------------------------------ */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; width: 100%; max-width: 1180px; margin: 0 auto; }
/* the bar's round tools (App Standard §4.1) in the game's paper buttons */
.bar { --ca-tool-bg: var(--paper); --ca-tool-line: var(--rule); --ca-tool-ink: var(--ink-soft); }
.bar .ca-tool { box-shadow: var(--shadow); }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 1180px; margin: 0 auto; }

/* ---- buttons, segments, switches ----------------------------------------------------------------------- */
.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; background: var(--paper); color: var(--ink); font: 700 16px/1.15 var(--sans); box-shadow: 0 0 0 1.5px var(--line) inset, var(--shadow); transition: transform 0.25s var(--spring), background-color 0.2s, color 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.95); }
.btn.primary { background: var(--blue); color: var(--on-blue); box-shadow: 0 10px 20px -12px var(--blue), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
.btn.ghost { background: transparent; box-shadow: 0 0 0 1.5px var(--line) inset; }
.btn.big { min-height: 54px; font-size: 17px; }
.btn:disabled { cursor: default; opacity: 0.6; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 13px; background: var(--paper-2); box-shadow: 0 0 0 1px var(--line) inset; }
.seg button { min-height: 38px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft); font-weight: 700; font-size: 14.5px; transition: background-color 0.2s, color 0.2s, transform 0.25s var(--spring); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.5); }
.seg button:active { transform: scale(0.94); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--paper-3); position: relative; margin: 0; cursor: pointer; transition: background-color 0.2s; box-shadow: 0 0 0 1px var(--line) inset; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); transition: transform 0.3s var(--spring); }
.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(20px); }

/* ---- the first screen ----------------------------------------------------------------------------------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; padding: 2px 16px 28px; }
.cover { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.cover-art { width: min(100%, 380px); max-width: 100%; height: auto; overflow: hidden; }
.cover-art .card rect { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; filter: drop-shadow(0 8px 10px rgba(70, 45, 10, 0.16)); }
.cover-art .card path { stroke: var(--rule-strong); stroke-width: 2; stroke-linecap: round; }
.cover-art .card text { font: 800 46px var(--round); fill: var(--ink); text-anchor: middle; }
.cover-art .c-a text { fill: var(--c1); }
.cover-art .c-c text { fill: var(--c2); }
.cover-art .pa-body { fill: var(--pencil); } .cover-art .pa-rubber { fill: var(--eraser); } .cover-art .pa-band { fill: var(--band); }
.cover-art .pa-wood { fill: var(--wood); } .cover-art .pa-lead { fill: var(--lead); }
.cover-art .card { transition: transform 0.5s var(--spring); transform-box: fill-box; transform-origin: center; }
.tagline { margin: 0; max-width: 30ch; font: 700 19px/1.3 var(--round); color: var(--ink); }
.modes { display: grid; gap: 10px; }
.mode { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 16px 12px 12px; border: 0; border-radius: 20px; background: var(--paper); color: var(--ink); text-align: left; box-shadow: var(--shadow); transition: transform 0.3s var(--spring); }
.mode:active:not(:disabled) { transform: scale(0.97); }
.mode:disabled { opacity: 0.6; cursor: default; }
.mode-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--paper-2); }
.mode-ic.day { font: 800 22px var(--round); color: var(--red); background: var(--paper); box-shadow: 0 0 0 2px var(--line) inset; position: relative; overflow: hidden; }
.mode-ic.day::before { content: ""; position: absolute; inset: 0 0 auto; height: 11px; background: var(--red); }
.mode-ic.day { padding-top: 9px; }
.mode-ic.day[data-done] { color: var(--paper); background: var(--red); box-shadow: none; }
.mode-ic.day[data-done]::before { background: rgba(0, 0, 0, 0.18); }
.mode-tx { display: flex; flex-direction: column; min-width: 0; }
.mode-tx b { font: 800 18px/1.2 var(--round); }
.mode-tx small { font-size: 13.5px; color: var(--ink-soft); line-height: 1.3; margin-top: 2px; }
.mode.primary { background: var(--blue); color: var(--on-blue); box-shadow: 0 14px 26px -14px var(--blue), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
.mode.primary .mode-ic { background: rgba(255, 255, 255, 0.18); }
.mode.primary small { color: var(--on-blue); opacity: 0.9; }
.offline { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--paper-2); color: var(--ink-soft); font-size: 14px; text-align: center; }
.setup { position: relative; margin: 0; padding: 14px 16px 6px 52px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.setup::before { content: ""; position: absolute; left: 36px; top: 0; bottom: 0; width: 2px; background: var(--margin); }
.setup h2 { margin: 0 0 8px; font: 800 18px/30px var(--round); }
.setup-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--rule); }
.setup-row .lbl { font-weight: 650; font-size: 15px; }
.cats-row { width: 100%; border: 0; background: transparent; text-align: left; padding: 6px 0; flex-wrap: nowrap; }
.cats-now { display: flex; align-items: center; gap: 1px; margin-left: auto; font-size: 18px; min-width: 0; overflow: hidden; }
.cats-now b { margin-left: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 800 13px var(--round); }
.chev { font-size: 22px; color: var(--ink-soft); }
@media (min-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; padding-top: 24px; }
  .cover, .modes, .offline { grid-column: 1; }
  .setup { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  .cover-art { width: min(100%, 440px); }
  .tagline { font-size: 22px; }
}

/* ---- the play screen: the head --------------------------------------------------------------------------- */
.game { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 900px; margin: 0 auto; padding: 2px 14px 12px; }
.hud { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.hud-x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink-soft); font-weight: 800; box-shadow: var(--shadow); }
.tile { flex: none; position: relative; width: 52px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); box-shadow: var(--shadow); transform: rotate(-4deg); font: 800 28px/1 var(--round); color: var(--ink); }
.tile::before { content: ""; position: absolute; top: -6px; left: 50%; width: 30px; height: 12px; transform: translateX(-50%) rotate(3deg); background: color-mix(in srgb, var(--pencil) 55%, transparent); border-radius: 2px; }
.tile.blank b::before { content: "?"; color: var(--ink-soft); }
.tile.flip { animation: tile-flip 0.6s var(--spring); }
@keyframes tile-flip { 0% { transform: rotate(-4deg) rotateY(90deg) scale(0.7); } 100% { transform: rotate(-4deg) rotateY(0) scale(1); } }
.hud-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.round { font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { display: flex; align-items: center; gap: 10px; height: 24px; }
.timer.off .pencil, .timer.off .secs { visibility: hidden; }
.pencil { flex: 1; min-width: 0; display: flex; align-items: center; height: 16px; filter: drop-shadow(0 2px 2px rgba(70, 45, 10, 0.2)); }
.p-cap { flex: none; width: 14px; height: 14px; border-radius: 5px 1px 1px 5px; background: linear-gradient(90deg, var(--eraser) 0 55%, var(--band) 55% 100%); }
.p-track { position: relative; flex: 1; height: 14px; overflow: hidden; }
.p-run { position: absolute; inset: 0; display: flex; will-change: transform; transform: translateX(var(--from, 0%)); }
.p-body { flex: 1; background: linear-gradient(var(--pencil) 0 30%, var(--pencil-dark) 30% 38%, var(--pencil) 38% 62%, var(--pencil-dark) 62% 70%, var(--pencil) 70%); }
.p-tip { flex: none; width: 22px; background: linear-gradient(90deg, var(--wood) 0 66%, var(--lead) 66%); clip-path: polygon(0 0, 100% 50%, 0 100%); transition: filter 0.3s; }
@keyframes pencil { from { transform: translateX(var(--from, 0%)); } to { transform: translateX(-100%); } }
.secs { flex: none; min-width: 2.4ch; font: 800 19px/1 var(--round); font-variant-numeric: tabular-nums; text-align: right; }
.timer.low .secs { color: var(--red); animation: beat 1s var(--ease) infinite; }
.timer.low .p-tip { background: linear-gradient(90deg, var(--wood) 0 66%, var(--red) 66%); }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.18); } }

/* the players */
.players { list-style: none; margin: 0; padding: 3px 2px 5px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.players::-webkit-scrollbar { display: none; }
body[data-mode="solo"] .players { display: none; }
.pl { flex: 0 0 auto; position: relative; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; column-gap: 7px; padding: 5px 12px 7px 5px; border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); animation: pop-in 0.45s var(--spring) both; }
.pl .av { grid-row: span 2; }
.pl .nm { font-size: 12px; font-weight: 700; line-height: 1.1; color: var(--ink-soft); max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .sc { font: 800 15px/1.1 var(--round); font-variant-numeric: tabular-nums; }
.pl .prog { position: absolute; left: 44px; right: 12px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; opacity: 0; transition: opacity 0.3s; }
.pl[data-writing] .prog { opacity: 1; }
.pl .prog > i { display: block; height: 100%; background: var(--pc); transform-origin: left; transform: scaleX(0); transition: transform 0.45s var(--spring); }
/* five or six at the table on a narrow screen: the name gives way, the score stands under the face */
@media (max-width: 560px) {
  .players[data-many] { gap: 5px; justify-content: safe center; }
  .players[data-many] .pl { grid-template-columns: auto; grid-template-rows: auto auto; justify-items: center; row-gap: 1px; padding: 5px 7px 7px; }
  .players[data-many] .pl .av { grid-row: auto; width: 30px; height: 30px; font-size: 14px; }
  .players[data-many] .pl .nm { display: none; }
  .players[data-many] .pl .sc { font-size: 14px; }
  .players[data-many] .pl .prog { left: 8px; right: 8px; bottom: 3px; }
}
.pl[data-me] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 55%, transparent), var(--shadow); }
.pl[data-done] .av::after { content: "✓"; position: absolute; right: -4px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--paper); font: 800 10px/1 var(--sans); box-shadow: 0 0 0 2px var(--paper); animation: pop-in 0.4s var(--spring) both; }
.pl[data-stop]::after { content: "STOP"; position: absolute; top: -7px; right: -4px; padding: 1px 5px; border-radius: 5px; background: var(--red); color: var(--on-red); font: 800 9.5px/1.4 var(--sans); letter-spacing: 0.06em; transform: rotate(8deg); animation: pop-in 0.4s var(--spring) both; }
.av { flex: none; position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--pc, var(--c2)); color: var(--on-c); font: 800 15px/1 var(--round); }
.av.cat { background: var(--paper-2); font-size: 18px; }
.av.big { width: 56px; height: 56px; font-size: 24px; box-shadow: 0 0 0 3px var(--paper), var(--shadow); }

/* ---- the panels ----------------------------------------------------------------------------------------- */
.stage { flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); position: relative; }
:where(.stage) > .panel { grid-area: 1 / 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.panel.enter { animation: panel-in 0.48s var(--spring) both; }
.panel.leave { animation: panel-out 0.2s var(--ease) both; pointer-events: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
@keyframes panel-out { to { opacity: 0; transform: translateY(-12px) scale(0.99); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } }
@keyframes row-in { from { opacity: 0; transform: translateY(14px); } }
.foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.foot.wrap { flex-wrap: wrap; justify-content: center; }
.foot .btn.primary { min-width: 9.5em; }
.ready-dots { display: inline-flex; gap: 5px; margin-right: auto; padding-left: 4px; }
.ready-dots i { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 2px var(--pc) inset; transition: background-color 0.25s, transform 0.35s var(--spring); }
.ready-dots i[data-on] { background: var(--pc); transform: scale(1.15); }
.rv-bar { flex: none; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.rv-bar > i { display: block; height: 100%; background: var(--blue); transform-origin: left; transform: scaleX(var(--from, 1)); }
@keyframes bar { from { transform: scaleX(var(--from, 1)); } to { transform: scaleX(0); } }

/* the letter is drawn */
.p-letter { align-items: center; justify-content: center; gap: 22px; text-align: center; }
.pl-label { margin: 0; font: 750 17px/1.2 var(--round); color: var(--ink-soft); }
.bigcard { position: relative; width: min(calc(52vw / var(--ca-zoom, 1)), 220px, calc(34dvh / var(--ca-zoom, 1))); aspect-ratio: 4 / 5; border-radius: 22px; display: grid; place-items: center; background: var(--paper); background-image: repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px); box-shadow: var(--shadow-lg); transform: rotate(-3deg); }
.bigcard::after { content: ""; position: absolute; left: 18%; top: 0; bottom: 0; width: 2px; background: var(--margin); }
.bigcard b { position: relative; z-index: 1; font: 800 calc(min(calc(52vw / var(--ca-zoom, 1)), 220px, calc(34dvh / var(--ca-zoom, 1))) * 0.62)/1 var(--round); color: var(--ink); letter-spacing: -0.03em; }
.bigcard .tape { position: absolute; z-index: 2; top: -13px; left: 50%; width: 42%; height: 26px; transform: translateX(-50%) rotate(-3deg); background: color-mix(in srgb, var(--pencil) 50%, transparent); border-radius: 3px; }
.bigcard .ring { position: absolute; inset: -12px; border-radius: 30px; border: 3px solid var(--pencil); opacity: 0; pointer-events: none; }
.bigcard.spin { animation: wobble 0.36s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: rotate(-5deg) translateY(-2px); } to { transform: rotate(-1deg) translateY(2px); } }
.bigcard.tk b { animation: flick 0.14s var(--ease); }
@keyframes flick { from { transform: translateY(-26%); opacity: 0.25; } }
.bigcard.landed { animation: land 0.75s var(--spring) both; }
.bigcard.landed b { color: var(--red); }
.bigcard.landed .ring { animation: ring 0.8s var(--ease); }
@keyframes land { 0% { transform: rotate(-14deg) scale(1.26); } 100% { transform: rotate(-3deg) scale(1); } }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.25); } }
.pl-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 540px; min-height: 76px; align-content: flex-start; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; }
.chip i { font-style: normal; }
.pl-cats .chip { opacity: 0; }
.pl-cats.show .chip { animation: chip-in 0.5s var(--spring) both; animation-delay: calc(var(--i) * 45ms + 120ms); }
@keyframes chip-in { from { opacity: 0; transform: translateY(10px) scale(0.85); } to { opacity: 1; transform: none; } }

/* the sheet */
.p-write { gap: 8px; }
.pips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 3px 2px 5px; scrollbar-width: none; justify-content: safe center; }
.pips::-webkit-scrollbar { display: none; }
.pip { flex: 0 0 auto; position: relative; width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--paper); box-shadow: var(--shadow); font-size: 19px; transition: transform 0.3s var(--spring), background-color 0.2s; }
.pip[aria-selected="true"] { background: var(--ink); transform: translateY(-2px) scale(1.06); }
.pip[data-filled]::after { content: ""; position: absolute; right: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--paper); animation: pop-in 0.35s var(--spring) both; }
.paper { flex: none; position: relative; margin: 0; border-radius: 18px; background-color: var(--paper); box-shadow: var(--shadow-lg); }
.paper::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: var(--margin); pointer-events: none; z-index: 1; }
.lb { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: text; }
.lb .ic { flex: none; font-size: 20px; }
.lb .nm { font: 800 17px/1.2 var(--round); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .no { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.field { position: relative; min-width: 0; }
.field input { display: block; width: 100%; border: 0; border-radius: 0; background: transparent; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none; caret-color: var(--blue); padding: 4px 2px; font: 700 22px/1.2 var(--round); }
.field input::placeholder { color: var(--ink-soft); opacity: 0.75; font-weight: 600; }
.line[data-wrong] input { color: var(--red); }
.warn { display: block; min-height: 18px; font-size: 13px; font-weight: 650; color: var(--red); }
/* one line at a time (a phone): the lines slide past on the same place */
.p-write[data-one="1"] .paper { display: grid; padding: 16px 18px 8px 38px; background-image: linear-gradient(transparent calc(100% - 46px), var(--rule) calc(100% - 46px) calc(100% - 45px), transparent calc(100% - 45px)); overflow: hidden; }
.p-write[data-one="1"] .line { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 6px; transition: transform 0.36s var(--spring), opacity 0.22s var(--ease), visibility 0s linear 0.36s; }
.p-write[data-one="1"] .line[data-pos="before"] { transform: translateX(-34px); opacity: 0; visibility: hidden; }
.p-write[data-one="1"] .line[data-pos="after"] { transform: translateX(34px); opacity: 0; visibility: hidden; }
.p-write[data-one="1"] .line[data-pos="cur"] { transition-delay: 0s; }
.p-write[data-one="1"] .field input { height: 50px; font-size: 26px; border-bottom: 2px solid var(--rule-strong); transition: border-color 0.2s; }
.p-write[data-one="1"] .field input:focus { border-bottom-color: var(--blue); }
.p-write[data-one="1"] .line[data-wrong] .field input { border-bottom-color: var(--red); }
/* every line at once (a big screen): a notebook page, Tab moves on */
.p-write[data-one="0"] .pips, .p-write[data-one="0"] .nav-btn { display: none; }
.p-write[data-one="0"] .paper { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0; }
.p-write[data-one="0"] .line { display: grid; grid-template-columns: minmax(150px, 32%) minmax(0, 1fr); align-items: center; column-gap: 14px; min-height: 58px; padding: 0 22px 0 38px; border-bottom: 1px solid var(--rule); transition: background-color 0.2s; }
.p-write[data-one="0"] .line:last-child { border-bottom: 0; }
.p-write[data-one="0"] .line[data-pos="cur"] { background: color-mix(in srgb, var(--blue) 6%, transparent); }
.p-write[data-one="0"] .lb .no { display: none; }
.p-write[data-one="0"] .lb .nm { font-size: 16px; }
.p-write[data-one="0"] .field { display: flex; align-items: center; }
.p-write[data-one="0"] .warn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); min-height: 0; padding: 2px 8px; border-radius: 8px; background: var(--paper); pointer-events: none; }
.p-write[data-one="0"] .warn:empty { display: none; }
@media (min-height: 820px) { .p-write[data-one="0"] .line { min-height: 64px; } .p-write[data-one="0"] .field input { font-size: 24px; } }
.overview { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 2px; }
.overview button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; transition: background-color 0.2s; }
.overview .ic { flex: none; width: 22px; text-align: center; }
.overview .nm { flex: none; width: 38%; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview .ov-a { min-width: 0; font: 750 16px/1.2 var(--round); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.overview li[data-filled] .ov-a { color: var(--ink); }
.overview li[data-wrong] .ov-a { color: var(--red); }
.overview li[data-cur] button { background: color-mix(in srgb, var(--paper) 70%, transparent); box-shadow: 0 0 0 1.5px var(--line) inset; }
.p-write[data-one="0"] .overview, html.kb .overview { display: none; }
.write-note { flex: none; margin: 0; min-height: 20px; font-size: 14px; font-weight: 650; color: var(--ink-soft); text-align: center; }
.write-note[data-kind="stop"] { color: var(--red); font-weight: 800; }
.write-nav { flex: none; display: flex; align-items: center; gap: 8px; margin-top: auto; }
.nav-btn { flex: none; width: 54px; height: 54px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); font: 800 28px/1 var(--round); box-shadow: var(--shadow); transition: transform 0.25s var(--spring), opacity 0.2s; }
.nav-btn:active:not(:disabled) { transform: scale(0.9); }
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.write-nav .btn { flex: 1; }
.btn.stop { background: var(--red); color: var(--on-red); font: 800 19px/1 var(--round); letter-spacing: 0.06em; text-transform: uppercase; box-shadow: 0 12px 22px -12px var(--red), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
.btn.waiting { background: var(--paper-2); color: var(--ink-soft); box-shadow: 0 0 0 1.5px var(--line) inset; }
.p-write[data-one="0"] .write-nav { justify-content: center; margin-top: 4px; }
.p-write[data-one="0"] .write-nav .btn { flex: 0 1 320px; }
/* someone has stopped */
.banner { position: absolute; z-index: 6; left: 50%; top: 26%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 26px; border-radius: 16px; background: var(--red); color: var(--on-red); box-shadow: var(--shadow-lg); transform: translateX(-50%) rotate(-4deg); animation: banner 2.2s var(--ease) both; pointer-events: none; text-align: center; max-width: calc(100% - 24px); }
.banner b { font: 800 24px/1.15 var(--round); }
.banner span { font-size: 14px; font-weight: 650; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-50%) rotate(-12deg) scale(1.8); } 14% { opacity: 1; transform: translateX(-50%) rotate(-4deg) scale(1); } 82% { opacity: 1; transform: translateX(-50%) rotate(-4deg) scale(1); } 100% { opacity: 0; transform: translateX(-50%) rotate(-4deg) scale(0.92) translateY(-12px); } }

/* waiting, collecting */
.p-idle { align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 0 10px; }
.p-idle h2 { margin: 6px 0 0; font: 800 24px/1.2 var(--round); }
.p-idle p { margin: 0; max-width: 34ch; color: var(--ink-soft); }
.idle-art { position: relative; width: 120px; height: 84px; }
.idle-art i { position: absolute; left: 22px; top: 8px; width: 76px; height: 70px; border-radius: 9px; background: var(--paper); box-shadow: var(--shadow); background-image: repeating-linear-gradient(transparent 0 13px, var(--rule) 13px 14px); }
.p-idle[data-kind="collect"] .idle-art i { animation: sheet-fly 1s var(--spring) both; }
.p-idle[data-kind="collect"] .idle-art i:nth-child(1) { animation-delay: 0s; --r: -9deg; --x: -70px; }
.p-idle[data-kind="collect"] .idle-art i:nth-child(2) { animation-delay: 0.14s; --r: 6deg; --x: 70px; }
.p-idle[data-kind="collect"] .idle-art i:nth-child(3) { animation-delay: 0.28s; --r: -2deg; --x: -10px; }
@keyframes sheet-fly { from { opacity: 0; transform: translate(var(--x), -60px) rotate(calc(var(--r) * 3)); } to { opacity: 1; transform: rotate(var(--r)); } }
.p-idle:not([data-kind="collect"]) .idle-art { width: 90px; height: 30px; }
.p-idle:not([data-kind="collect"]) .idle-art i { top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-soft); box-shadow: none; animation: dot 1.1s var(--ease) infinite; }
.p-idle:not([data-kind="collect"]) .idle-art i:nth-child(1) { left: 18px; }
.p-idle:not([data-kind="collect"]) .idle-art i:nth-child(2) { left: 39px; animation-delay: 0.15s; }
.p-idle:not([data-kind="collect"]) .idle-art i:nth-child(3) { left: 60px; animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-9px); opacity: 1; } }

/* the review */
.rv-head { flex: none; display: flex; align-items: baseline; gap: 10px; }
.rv-title { margin: 0; display: flex; align-items: center; gap: 9px; min-width: 0; font: 800 25px/1.2 var(--round); }
.rv-title .ic { font-size: 24px; }
.rv-step { margin-left: auto; flex: none; font-size: 14px; font-weight: 750; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rv-hint { flex: none; margin: 0; min-height: 20px; font-size: 13.5px; color: var(--ink-soft); }
.answers { list-style: none; margin: 0; padding: 4px 2px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.ans { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av who stamp" "av tags stamp"; align-items: center; column-gap: 12px; row-gap: 3px; padding: 10px 12px 10px 10px; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); animation: row-in 0.46s var(--spring) both; animation-delay: calc(var(--i) * 55ms); }
.ans[data-me] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent), var(--shadow); }
.ans .av { grid-area: av; }
.who { grid-area: who; min-width: 0; display: flex; flex-direction: column; }
.who .nm { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.who .tx { font: 750 21px/1.2 var(--round); overflow-wrap: anywhere; }
.ans[data-st="empty"] .tx { color: var(--ink-soft); }
.ans[data-st="wrong"] .tx, .ans[data-st="down"] .tx { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2.5px; }
.tags { grid-area: tags; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tags:empty { display: none; }
.tag { padding: 3px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-soft); font-size: 12.5px; font-weight: 750; white-space: nowrap; }
.tag.known { color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--paper)); }
.tag.wrong, .tag.down { color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--paper)); }
.tag.same { background: color-mix(in srgb, currentColor 11%, var(--paper)); }
.tag.same.g0 { color: var(--c2); } .tag.same.g1 { color: var(--c5); } .tag.same.g2 { color: var(--c4); } .tag.same.g3 { color: var(--c6); }
.doubt { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px 0 10px; border: 0; border-radius: 999px; background: var(--paper-2); color: var(--ink); font-size: 13.5px; font-weight: 750; box-shadow: 0 0 0 1.5px var(--line) inset; transition: background-color 0.2s, color 0.2s, transform 0.3s var(--spring); }
.doubt .thumb { display: inline-block; transition: transform 0.35s var(--spring); }
.doubt:active { transform: scale(0.92); }
.doubt[aria-pressed="true"] { background: var(--red); color: var(--on-red); box-shadow: none; }
.doubt[aria-pressed="true"] .thumb { transform: rotate(-14deg) scale(1.15); }
.stamp { grid-area: stamp; flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; color: var(--red); border: 2.5px solid currentColor; font: 800 17px/1 var(--round); opacity: 0; transform: rotate(-14deg) scale(0.4); }
.stamp.in { animation: stamp 0.46s var(--spring) both; }
.stamp.p20 { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px currentColor; }
.stamp.p5 { border-style: dashed; }
.stamp.p0 { color: var(--ink-soft); }
@keyframes stamp { 0% { opacity: 0; transform: rotate(-30deg) scale(2.2); } 55% { opacity: 1; } 100% { opacity: 1; transform: rotate(-14deg) scale(1); } }

/* the round's points */
.sc-title { flex: none; margin: 0; font: 800 25px/1.2 var(--round); }
.table { list-style: none; margin: 0; padding: 4px 2px 6px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 0 1 auto; }
.table li { position: relative; flex: none; display: grid; grid-template-columns: 1.4em auto minmax(0, 1fr) auto 3.2ch; align-items: center; gap: 10px; padding: 10px 14px 12px 10px; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; animation: row-in 0.5s var(--spring) both; animation-delay: calc(var(--i) * 70ms); }
.table li[data-me] { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent), var(--shadow); }
.table li[data-out] { opacity: 0.6; }
.table .pos { font: 800 15px var(--round); color: var(--ink-soft); text-align: center; }
.table .nm { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .gain { font: 800 14px var(--round); color: var(--green); }
.table .gain.zero { color: var(--ink-soft); }
.table .tot { font: 800 22px/1 var(--round); text-align: right; font-variant-numeric: tabular-nums; }
.table .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--pc); transform-origin: left; transform: scaleX(var(--f, 0)); animation: grow 1s var(--spring) both; animation-delay: calc(var(--i) * 90ms + 220ms); }
@keyframes grow { from { transform: scaleX(0); } }
.stars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.stars li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; color: var(--ink-soft); animation: row-in 0.5s var(--spring) both; animation-delay: 0.5s; }
.p-scores .foot, .p-review .foot { flex: none; margin-top: auto; }
.p-scores .rv-bar { margin-top: auto; }

/* alone: the result */
.ck-score { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.ck-score .big { display: flex; align-items: baseline; gap: 8px; }
.ck-score .num { font: 800 56px/1 var(--round); color: var(--red); font-variant-numeric: tabular-nums; }
.ck-score .of { font: 750 18px var(--round); color: var(--ink-soft); }
.ck-score small { font-size: 13.5px; color: var(--ink-soft); }
.ck-score .best { padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--ink); font-weight: 800; font-size: 13px; animation: pop-in 0.5s var(--spring) 0.6s both; }
.answers.check { flex: 0 1 auto; }
.answers.check .stamp { opacity: 1; transform: rotate(-14deg); width: 44px; height: 44px; font-size: 15px; }
.answers.check .tags { grid-area: stamp; }
.answers.check .ans { grid-template-areas: "av who stamp"; }
.ans[data-st="unknown"] .tx { color: var(--ink-soft); }
.ans .ex { display: none; margin-top: 3px; font-size: 13px; color: var(--ink-soft); }
.show-ex .ans .ex { display: block; animation: row-in 0.4s var(--spring) both; }
.ck-note { flex: none; margin: 0; font-size: 13px; color: var(--ink-soft); text-align: center; }
.p-check .foot { flex: none; }

/* ---- the podium ----------------------------------------------------------------------------------------- */
.podium { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 16px 18px; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.pd-title { margin: 8px 0 4px; font: 800 30px/1.15 var(--round); text-align: center; animation: pop-in 0.6s var(--spring) both; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; justify-content: center; gap: 10px; width: 100%; max-width: 460px; }
.step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step > .av, .step > .nm, .step > .pts { animation: pop-in 0.5s var(--spring) both; }
.step .nm { max-width: 100%; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .pts { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.step .block { width: 100%; margin-top: 4px; border-radius: 16px 16px 6px 6px; display: grid; place-items: start center; padding-top: 10px; background: var(--paper); box-shadow: var(--shadow-lg); font: 800 30px/1 var(--round); color: var(--pc); transform-origin: bottom; animation: rise 0.9s var(--spring) both; }
.s1 .block { height: 128px; background: linear-gradient(var(--gold-soft), var(--paper)); }
.s2 .block { height: 92px; }
.s3 .block { height: 66px; }
.s3 .block { animation-delay: 0.1s; } .s3 > :not(.block) { animation-delay: 0.45s; }
.s2 .block { animation-delay: 0.25s; } .s2 > :not(.block) { animation-delay: 0.6s; }
.s1 .block { animation-delay: 0.42s; } .s1 > :not(.block) { animation-delay: 0.8s; }
.s1 .av.big { width: 68px; height: 68px; font-size: 28px; box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--gold), var(--shadow); }
@keyframes rise { from { transform: scaleY(0); } }
.table.rest { width: 100%; max-width: 460px; flex: none; }
.table.rest li { grid-template-columns: 1.4em auto minmax(0, 1fr) auto; }
.podium .foot { flex: none; width: 100%; max-width: 460px; }
.again-wait { margin: 0; font-size: 14px; color: var(--ink-soft); text-align: center; }

/* ---- sheets ---------------------------------------------------------------------------------------------- */
.sheet { border: 0; padding: 0; width: min(calc(94vw / var(--ca-zoom, 1)), 460px); max-height: min(calc(88dvh / var(--ca-zoom, 1)), 760px); border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in 0.42s var(--spring) both; }
.sheet::backdrop { background: rgba(24, 18, 8, 0.45); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.97); } }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 6px 22px; }
.sheet-head h2 { margin: 0; font: 800 20px/1.2 var(--round); }
.x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--paper-2); color: var(--ink-soft); font-weight: 800; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 22px; }
.sheet h3 { margin: 18px 0 8px; font: 800 16px/1.2 var(--round); }
#confirm { padding: 22px; }
#confirm h2 { margin: 0 0 8px; font: 800 20px/1.2 var(--round); }
#confirm p { margin: 0 0 16px; color: var(--ink-soft); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row select { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); font: inherit; }
.prose p, .prose li { color: var(--ink); line-height: 1.5; }
.prose p { margin: 0 0 10px; }
.points { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 6px; }
.points li { display: flex; align-items: center; gap: 12px; }
.points b { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 2.5px solid var(--red); color: var(--red); font: 800 15px var(--round); transform: rotate(-12deg); }
.version { color: var(--ink-soft); font-size: 13px; }
.hint { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.cat-chip { position: relative; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px 34px 6px 10px; border: 0; border-radius: 14px; background: var(--paper-2); text-align: left; font-weight: 700; font-size: 14.5px; box-shadow: 0 0 0 1.5px var(--line) inset; transition: background-color 0.2s, box-shadow 0.2s, transform 0.25s var(--spring); }
.cat-chip:active { transform: scale(0.95); }
.cat-chip .ic { font-size: 19px; }
.cat-chip .nm { min-width: 0; line-height: 1.2; }
.cat-chip .known { font-style: normal; font-size: 12px; color: var(--green); font-weight: 800; }
.cat-chip[aria-pressed="true"] { background: var(--paper); box-shadow: 0 0 0 2px var(--ink) inset, var(--shadow); }
.cat-chip .ord { position: absolute; right: 8px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 800 12px var(--round); animation: pop-in 0.35s var(--spring) both; }
.cat-chip.own .x { all: unset; }
.cat-chip.own i.x { position: absolute; right: 34px; font-style: normal; font-size: 12px; color: var(--ink-soft); }
.cat-chip.own { padding-right: 52px; }
.own-form { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.own-form label { font-weight: 750; font-size: 14.5px; }
.own-row { display: flex; gap: 8px; }
.own-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink); font: 650 17px var(--sans); }
.own-row .btn { box-shadow: none; background: var(--ink); color: var(--paper); }
.stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats div { padding: 10px 12px; border-radius: 14px; background: var(--paper-2); }
.stats dt { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.stats dd { margin: 0; font: 800 22px/1.2 var(--round); }
@media (min-width: 520px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.seg.tabs { display: flex; margin-bottom: 8px; }
.seg.tabs button { flex: 1; }
.matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.matches .none { color: var(--ink-soft); font-size: 14px; }
.match-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 14px; background: var(--paper-2); text-align: left; }
.mr-rank { flex: none; width: 28px; text-align: center; font: 800 18px var(--round); }
.mr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mr-main b { font: 800 16px var(--round); }
.mr-main small { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-pts { font: 800 18px var(--round); }
#match { width: min(calc(96vw / var(--ca-zoom, 1)), 640px); }
.mt-players { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mt-players li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--paper-2); font-size: 14px; font-weight: 700; }
.mt-players li[data-me] { box-shadow: 0 0 0 2px var(--line) inset; }
.mt-players .pos { color: var(--ink-soft); font-size: 12.5px; }
.ini { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); color: var(--on-c); font: 800 11px/1 var(--round); font-style: normal; }
.mt-round h3 { display: flex; align-items: center; gap: 10px; }
.mt-letter { width: 34px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--paper-2); color: var(--red); font: 800 20px var(--round); transform: rotate(-4deg); }
.mt-cat { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.mt-name { display: flex; gap: 6px; font-size: 12.5px; font-weight: 750; color: var(--ink-soft); margin-bottom: 4px; }
.mt-ans { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-a { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; background: var(--paper-2); font-size: 14px; font-weight: 650; max-width: 100%; }
.mt-a .mt-tx { overflow-wrap: anywhere; }
.mt-a b { color: var(--red); font: 800 12.5px var(--round); }
.mt-a.p0 b { color: var(--ink-soft); }
.mt-a.me { box-shadow: 0 0 0 1.5px var(--line) inset; }

/* ---- the toast --------------------------------------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 20; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14.5px; font-weight: 650; box-shadow: var(--shadow-lg); animation: toast 0.45s var(--spring) both; pointer-events: none; }
@keyframes toast { from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.92); } }

/* ---- a phone's keyboard: the play screen keeps to what is above it ----------------------------------------------
   (--kbh, --kbt: the height the browser shows above the keyboard and where it shows it — iOS slides
   the page up under the keyboard instead of making it shorter) */
html.kb body[data-screen="game"] { position: fixed; left: 0; right: 0; top: var(--kbt, 0px); bottom: auto; height: var(--kbh, calc(100dvh / var(--ca-zoom, 1))); min-height: 0; padding-bottom: 0; }
html.kb .bar, html.kb .players, html.kb .write-note:not([data-kind="stop"]) { display: none; }
html.kb .game { gap: 6px; padding-bottom: 6px; }
html.kb .hud { padding-top: 8px; }
html.kb .p-write { gap: 6px; }
html.kb .p-write[data-one="1"] .paper { padding-top: 10px; }
html.kb .nav-btn, html.kb .write-nav .btn { height: 48px; min-height: 48px; }

/* ---- short screens (a phone on its side): what gives way ------------------------------------------------- */
@media (max-height: 560px) {
  body[data-screen="game"] .bar { display: none; }
  .bigcard { width: min(150px, calc(30dvh / var(--ca-zoom, 1))); }
  .p-letter { flex-direction: row; flex-wrap: wrap; gap: 14px 26px; align-content: center; }
  .pl-label { flex-basis: 100%; }
  .pl-cats { max-width: 300px; min-height: 0; }
  .rv-title, .sc-title { font-size: 21px; }
  .ans { padding-block: 7px; }
  .who .tx { font-size: 19px; }
  .pd-title { font-size: 24px; }
  .s1 .block { height: 80px; } .s2 .block { height: 60px; } .s3 .block { height: 44px; }
}
@media (max-height: 600px) {
  .stars { display: none; }
  body[data-screen="podium"] .bar { display: none; }
  .podium { gap: 8px; padding-top: 4px; }
  .av.big { width: 44px; height: 44px; font-size: 19px; }
  .s1 .av.big { width: 52px; height: 52px; font-size: 22px; }
  .pd-title { margin-top: 2px; }
}
@media (min-width: 720px) and (min-height: 700px) {
  html:not(.kb) :where(.stage) > .panel { justify-content: center; }
  html:not(.kb) .p-review .foot, html:not(.kb) .p-scores .foot, html:not(.kb) .p-scores .rv-bar, html:not(.kb) .write-nav { margin-top: 6px; }
  .answers, .table { flex: 0 1 auto; }
}
@media (max-height: 420px) {
  .players { display: none; }
  .pips { display: none; }
}
@media (max-height: 720px) { .overview { display: none; } }
@media (max-width: 360px) {
  .game { padding-inline: 10px; }
  .tile { width: 46px; height: 50px; font-size: 25px; }
  .pl { padding-right: 9px; }
  .pl .nm { max-width: 7ch; }
  .ans { column-gap: 9px; }
  .who .tx { font-size: 19px; }
  .stamp { width: 44px; height: 44px; font-size: 15px; }
  .nav-btn { width: 48px; }
}
@media (min-width: 720px) {
  .game { padding-top: 8px; gap: 12px; }
  .tile { width: 60px; height: 64px; font-size: 33px; }
  .answers, .table { padding-inline: 4px; }
}
/* a big screen (a laptop and up — past 1584 × 990 the SDK zooms this same layout): the panels sit in
   the middle of the room, larger, with their buttons right under them */
@media (min-width: 720px) and (min-height: 700px) {
  .game { max-width: 980px; gap: 14px; }
  .hud { gap: 16px; }
  .round { font-size: 14.5px; }
  .timer { height: 28px; }
  .pencil, .p-track { height: 18px; }
  .p-cap { width: 17px; height: 17px; }
  .secs { font-size: 22px; }
  .pl { padding: 6px 14px 8px 6px; }
  .pl .av { width: 36px; height: 36px; font-size: 16px; }
  .pl .prog { left: 50px; }
  .pl .nm { font-size: 13px; max-width: 12ch; }
  .pl .sc { font-size: 17px; }
  :where(.stage) > .panel { justify-content: center; }
  .p-review, .p-scores, .p-check { width: 100%; max-width: 760px; margin: 0 auto; }
  .answers, .table { flex: 0 1 auto; }
  .p-scores .foot, .p-review .foot, .p-scores .rv-bar, .write-nav { margin-top: 6px; }
  .ans { padding: 13px 16px 13px 12px; column-gap: 14px; }
  .ans .av { width: 40px; height: 40px; font-size: 17px; }
  .who .tx { font-size: 24px; }
  .who .nm { font-size: 13.5px; }
  .stamp { width: 56px; height: 56px; font-size: 19px; }
  .rv-title, .sc-title { font-size: 29px; }
  .table li { padding: 13px 16px 15px 12px; }
  .table .tot { font-size: 26px; }
  .table .av { width: 38px; height: 38px; }
  .p-write[data-one="0"] .paper { width: 100%; max-width: 820px; margin: 0 auto; padding: 10px 0; }
  .p-write[data-one="0"] .line { min-height: 66px; grid-template-columns: minmax(170px, 30%) minmax(0, 1fr); }
  .p-write[data-one="0"] .lb .nm { font-size: 18px; }
  .p-write[data-one="0"] .lb .ic { font-size: 22px; }
  .p-write[data-one="0"] .field input { font-size: 25px; }
  .write-note { font-size: 15px; }
  .bigcard { width: min(260px, calc(36dvh / var(--ca-zoom, 1))); }
  .bigcard b { font-size: calc(min(260px, calc(36dvh / var(--ca-zoom, 1))) * 0.62); }
  .chip { font-size: 15.5px; padding: 8px 14px 8px 11px; }
  .pl-label { font-size: 19px; }
  .pd-title { font-size: 38px; }
  .steps, .table.rest, .podium .foot { max-width: 560px; }
  .s1 .block { height: 160px; } .s2 .block { height: 116px; } .s3 .block { height: 84px; }
  .podium { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } .pl-cats .chip { opacity: 1; } .stamp.in { opacity: 1; transform: rotate(-14deg); } }

/* cloud-apps bar 1.30.0 */
:root { --ca-brand-icon-w: 89px; } /* the brand's width with the icon alone (the mark, the divider, the app's icon) */
.ca-start { display: flex; align-items: center; flex: 0 100 auto; min-width: min(var(--ca-brand-icon-w), 100%); }
.ca-brand { display: flex; align-items: center; min-width: 0; height: 40px; color: inherit; font-family: inherit; }
.ca-brand a { display: flex !important; align-items: center !important; box-sizing: border-box !important; color: inherit !important; text-decoration: none !important; border-radius: 12px !important; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease; }
.ca-brand-home { flex: none !important; justify-content: center !important; width: 40px !important; height: 40px !important; padding: 0 !important; margin: 0 0 0 -5px !important; }
.ca-brand-home img { display: block !important; width: 30px !important; height: 30px !important; margin: 0 !important; transition: transform .38s cubic-bezier(.34, 1.56, .64, 1); }
.ca-brand-sep { flex: none; display: block; width: 1.5px; height: 18px; margin: 0 4px; border-radius: 1px; background: currentColor; opacity: .22; transform: rotate(18deg); }
.ca-brand-app { flex: 0 1 auto !important; min-width: 44px !important; height: 40px !important; padding: 0 9px 0 5px !important; margin: 0 !important; }
.ca-brand-in { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; column-gap: 9px; min-width: 0; height: 40px; overflow: hidden; }
.ca-brand-in img { flex: none; display: block !important; width: 30px !important; height: 30px !important; margin: 5px 0 !important; border-radius: 8px; }
.ca-brand[data-ca-icon] .ca-brand-name { display: none !important; }
.ca-brand[data-ca-icon] .ca-brand-app { padding-right: 5px !important; }
.ca-brand-name { display: block; height: 40px; margin: 0 !important; padding: 0 !important; line-height: 40px !important; white-space: nowrap; font-family: var(--ca-brand-font, inherit); font-size: 17px !important; font-weight: 700; letter-spacing: -.015em; color: inherit; text-shadow: var(--ca-brand-shadow, none); }
@media (hover: hover) { .ca-brand a:hover { background-color: color-mix(in srgb, currentColor 7%, transparent); } .ca-brand-home:hover img { transform: rotate(-6deg) scale(1.06); } }
.ca-brand a:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: -3px; }
.ca-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; min-width: 0; }
.ca-tools { display: flex; align-items: center; gap: 6px; }
.ca-tools[hidden] { display: none !important; }
.ca-tool { position: relative; flex: none; display: inline-grid; place-items: center !important; box-sizing: border-box !important; width: 36px !important; height: 36px !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; padding: 0 !important; margin: 0; border-radius: 50% !important;
  border: 1px solid var(--ca-tool-line, color-mix(in srgb, currentColor 16%, transparent)) !important; background: var(--ca-tool-bg, color-mix(in srgb, currentColor 6%, transparent)) !important; color: var(--ca-tool-ink, inherit) !important;
  font: inherit; line-height: 0 !important; letter-spacing: 0; text-decoration: none !important; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, transform .12s ease; }
.ca-tool[hidden] { display: none !important; }
.ca-tool::before { content: ""; position: absolute; inset: -4px; }
.ca-tool svg { display: block; width: 20px !important; height: 20px !important; margin: 0 !important; pointer-events: none; }
.ca-tool svg[hidden] { display: none !important; }
@media (hover: hover) { .ca-tool:hover { background: var(--ca-tool-hover, color-mix(in srgb, currentColor 13%, transparent)) !important; } }
.ca-tool:active { transform: scale(.94); }
.ca-tool:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: 2px; }
.ca-tool-talk { color: var(--ca-accent, #4f6bff) !important; border-color: color-mix(in srgb, var(--ca-accent, #4f6bff) 50%, transparent) !important; background: color-mix(in srgb, var(--ca-accent, #4f6bff) 13%, transparent) !important; }
.ca-tool .ca-tlive { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 30%, transparent); }
.ca-tool-talk.ca-new::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; pointer-events: none; animation: ca-bar-ring 1.2s ease-out 2; }
@keyframes ca-bar-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ca-accent, #4f6bff) 55%, transparent); } to { box-shadow: 0 0 0 11px transparent; } }
.ca-tool .ca-tcount, .ca-tool .ca-tunread { position: absolute; right: -5px; display: grid; place-items: center; box-sizing: border-box; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: #fff; font: 700 10.5px/1 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; pointer-events: none; }
.ca-tool .ca-tcount { bottom: -5px; background: #1f9d55; }
.ca-tool .ca-tunread { top: -5px; background: #e5484d; }
@media (max-width: 599.98px), (max-height: 499.98px) { .ca-tools-app { display: none !important; } }
.ca-end[data-ca-cramped] .ca-tools-app { display: none !important; }
.ca-end[data-ca-tight] .ca-tool-friends { display: none !important; }
@media (prefers-reduced-motion: reduce) { .ca-tool, .ca-brand a, .ca-brand-home img { transition: none; } .ca-tool-talk.ca-new::after { animation: none; } }
/* end of the cloud-apps bar */
/* ---- cloud-apps: big screens (App Standard §6.5) — written by `cloud-apps vendor-sdk`; do not edit ---- */
/* Past 1584 × 990 the page is laid out at about 1440 × 900 and zoomed to fill the screen; viewport
   units in this file are divided by --ca-zoom. cloud-kit.js turns it off where the engine has no
   standard zoom (html[data-ca-zoom="off"]). */
@media (min-width: 1585px) and (min-height: 991px) { :root { --ca-zoom: 1.1; } }
@media (min-width: 1656px) and (min-height: 1035px) { :root { --ca-zoom: 1.15; } }
@media (min-width: 1728px) and (min-height: 1080px) { :root { --ca-zoom: 1.2; } }
@media (min-width: 1800px) and (min-height: 1125px) { :root { --ca-zoom: 1.25; } }
@media (min-width: 1872px) and (min-height: 1170px) { :root { --ca-zoom: 1.3; } }
@media (min-width: 1945px) and (min-height: 1215px) { :root { --ca-zoom: 1.35; } }
@media (min-width: 2016px) and (min-height: 1260px) { :root { --ca-zoom: 1.4; } }
@media (min-width: 2088px) and (min-height: 1305px) { :root { --ca-zoom: 1.45; } }
@media (min-width: 2160px) and (min-height: 1350px) { :root { --ca-zoom: 1.5; } }
@media (min-width: 2232px) and (min-height: 1395px) { :root { --ca-zoom: 1.55; } }
@media (min-width: 2304px) and (min-height: 1440px) { :root { --ca-zoom: 1.6; } }
@media (min-width: 2376px) and (min-height: 1485px) { :root { --ca-zoom: 1.65; } }
@media (min-width: 2448px) and (min-height: 1530px) { :root { --ca-zoom: 1.7; } }
@media (min-width: 2520px) and (min-height: 1575px) { :root { --ca-zoom: 1.75; } }
@media (min-width: 2592px) and (min-height: 1620px) { :root { --ca-zoom: 1.8; } }
@media (min-width: 2664px) and (min-height: 1665px) { :root { --ca-zoom: 1.85; } }
@media (min-width: 2736px) and (min-height: 1710px) { :root { --ca-zoom: 1.9; } }
@media (min-width: 2808px) and (min-height: 1755px) { :root { --ca-zoom: 1.95; } }
@media (min-width: 2880px) and (min-height: 1800px) { :root { --ca-zoom: 2; } }
@media (min-width: 2952px) and (min-height: 1845px) { :root { --ca-zoom: 2.05; } }
@media (min-width: 3024px) and (min-height: 1890px) { :root { --ca-zoom: 2.1; } }
@media (min-width: 3096px) and (min-height: 1935px) { :root { --ca-zoom: 2.15; } }
@media (min-width: 3169px) and (min-height: 1981px) { :root { --ca-zoom: 2.2; } }
@media (min-width: 3240px) and (min-height: 2025px) { :root { --ca-zoom: 2.25; } }
@media (min-width: 3312px) and (min-height: 2070px) { :root { --ca-zoom: 2.3; } }
@media (min-width: 3384px) and (min-height: 2115px) { :root { --ca-zoom: 2.35; } }
@media (min-width: 3456px) and (min-height: 2160px) { :root { --ca-zoom: 2.4; } }
@media (min-width: 3529px) and (min-height: 2205px) { :root { --ca-zoom: 2.45; } }
@media (min-width: 3600px) and (min-height: 2250px) { :root { --ca-zoom: 2.5; } }
@media (min-width: 3672px) and (min-height: 2295px) { :root { --ca-zoom: 2.55; } }
@media (min-width: 3744px) and (min-height: 2340px) { :root { --ca-zoom: 2.6; } }
@media (min-width: 3816px) and (min-height: 2385px) { :root { --ca-zoom: 2.65; } }
@media (min-width: 3889px) and (min-height: 2430px) { :root { --ca-zoom: 2.7; } }
@media (min-width: 3960px) and (min-height: 2475px) { :root { --ca-zoom: 2.75; } }
@media (min-width: 4032px) and (min-height: 2520px) { :root { --ca-zoom: 2.8; } }
@media (min-width: 4104px) and (min-height: 2565px) { :root { --ca-zoom: 2.85; } }
@media (min-width: 4176px) and (min-height: 2610px) { :root { --ca-zoom: 2.9; } }
@media (min-width: 4248px) and (min-height: 2655px) { :root { --ca-zoom: 2.95; } }
@media (min-width: 4320px) and (min-height: 2700px) { :root { --ca-zoom: 3; } }
@media (min-width: 4392px) and (min-height: 2745px) { :root { --ca-zoom: 3.05; } }
@media (min-width: 4464px) and (min-height: 2790px) { :root { --ca-zoom: 3.1; } }
@media (min-width: 4536px) and (min-height: 2835px) { :root { --ca-zoom: 3.15; } }
@media (min-width: 4608px) and (min-height: 2880px) { :root { --ca-zoom: 3.2; } }
@media (min-width: 4680px) and (min-height: 2925px) { :root { --ca-zoom: 3.25; } }
@media (min-width: 4752px) and (min-height: 2970px) { :root { --ca-zoom: 3.3; } }
@media (min-width: 4824px) and (min-height: 3015px) { :root { --ca-zoom: 3.35; } }
@media (min-width: 4896px) and (min-height: 3060px) { :root { --ca-zoom: 3.4; } }
@media (min-width: 4968px) and (min-height: 3105px) { :root { --ca-zoom: 3.45; } }
@media (min-width: 5040px) and (min-height: 3150px) { :root { --ca-zoom: 3.5; } }
@media (min-width: 5112px) and (min-height: 3195px) { :root { --ca-zoom: 3.55; } }
@media (min-width: 5184px) and (min-height: 3240px) { :root { --ca-zoom: 3.6; } }
@media (min-width: 5256px) and (min-height: 3285px) { :root { --ca-zoom: 3.65; } }
@media (min-width: 5328px) and (min-height: 3330px) { :root { --ca-zoom: 3.7; } }
@media (min-width: 5400px) and (min-height: 3375px) { :root { --ca-zoom: 3.75; } }
@media (min-width: 5472px) and (min-height: 3420px) { :root { --ca-zoom: 3.8; } }
@media (min-width: 5544px) and (min-height: 3465px) { :root { --ca-zoom: 3.85; } }
@media (min-width: 5616px) and (min-height: 3510px) { :root { --ca-zoom: 3.9; } }
@media (min-width: 5688px) and (min-height: 3555px) { :root { --ca-zoom: 3.95; } }
@media (min-width: 5760px) and (min-height: 3600px) { :root { --ca-zoom: 4; } }
@media (min-width: 5832px) and (min-height: 3645px) { :root { --ca-zoom: 4.05; } }
@media (min-width: 5904px) and (min-height: 3690px) { :root { --ca-zoom: 4.1; } }
@media (min-width: 5977px) and (min-height: 3736px) { :root { --ca-zoom: 4.15; } }
@media (min-width: 6048px) and (min-height: 3780px) { :root { --ca-zoom: 4.2; } }
@media (min-width: 6120px) and (min-height: 3825px) { :root { --ca-zoom: 4.25; } }
@media (min-width: 6192px) and (min-height: 3870px) { :root { --ca-zoom: 4.3; } }
@media (min-width: 6264px) and (min-height: 3915px) { :root { --ca-zoom: 4.35; } }
@media (min-width: 6337px) and (min-height: 3961px) { :root { --ca-zoom: 4.4; } }
@media (min-width: 6408px) and (min-height: 4005px) { :root { --ca-zoom: 4.45; } }
@media (min-width: 6480px) and (min-height: 4050px) { :root { --ca-zoom: 4.5; } }
@media (min-width: 6552px) and (min-height: 4095px) { :root { --ca-zoom: 4.55; } }
@media (min-width: 6624px) and (min-height: 4140px) { :root { --ca-zoom: 4.6; } }
@media (min-width: 6697px) and (min-height: 4185px) { :root { --ca-zoom: 4.65; } }
@media (min-width: 6768px) and (min-height: 4230px) { :root { --ca-zoom: 4.7; } }
@media (min-width: 6840px) and (min-height: 4275px) { :root { --ca-zoom: 4.75; } }
@media (min-width: 6912px) and (min-height: 4320px) { :root { --ca-zoom: 4.8; } }
@media (min-width: 6984px) and (min-height: 4365px) { :root { --ca-zoom: 4.85; } }
@media (min-width: 7057px) and (min-height: 4410px) { :root { --ca-zoom: 4.9; } }
@media (min-width: 7128px) and (min-height: 4455px) { :root { --ca-zoom: 4.95; } }
@media (min-width: 7200px) and (min-height: 4500px) { :root { --ca-zoom: 5; } }
@media (min-width: 1585px) and (min-height: 991px) {
  html { zoom: var(--ca-zoom, 1); }
  html[data-ca-zoom='off'] { --ca-zoom: 1 !important; }
}
/* ---- end of big screens ---- */
