/* Typo: a proofreader's desk. Graph paper, navy ink, a red pen, a yellow highlighter, keycaps. */

@font-face {
  font-family: "Bricolage";
  src: url(/fonts/bricolage-grotesque-latin-standard-normal.woff2) format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url(/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2) format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Martian";
  src: url(/fonts/martian-mono-latin-standard-normal.woff2) format("woff2");
  font-weight: 100 800; font-stretch: 75% 112.5%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Martian";
  src: url(/fonts/martian-mono-latin-ext-standard-normal.woff2) format("woff2");
  font-weight: 100 800; font-stretch: 75% 112.5%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f3f5f8;
  --grid: #dfe5ef;
  --ink: #1b2340;
  --ink-2: #4b5474;
  --ink-3: #8a93ad;
  --pen: #e3342f;
  --hi: #ffe45c;
  --white: #fff;
  --ui: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --mono: "Martian", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --lift: 0 4px 0 var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  font: 400 17px/1.45 var(--ui);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.mono { font-family: var(--mono); }
.fine { font-size: 14px; color: var(--ink-2); }
.wait { color: var(--ink-2); font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.err { color: var(--pen); font-weight: 600; min-height: 1.4em; margin-top: 10px; }

/* ---------- keycaps ---------- */

.key {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 650 16px/1.1 var(--ui);
  color: var(--ink); text-decoration: none;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 11px 17px 12px;
  box-shadow: var(--lift);
  cursor: pointer;
  transition: transform .05s ease-out, box-shadow .05s ease-out;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.key:hover { background: #fbfbf3; }
.key:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.key.primary { background: var(--hi); }
.key.primary:hover { background: #ffea7a; }
.key.big { font-size: 19px; padding: 15px 24px 16px; }
.key.sm { padding: 6px 11px 7px; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.key:disabled { opacity: .5; cursor: not-allowed; box-shadow: 0 2px 0 var(--ink); }
.key.chosen { background: var(--hi); }
.key.enter { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.key.enter span { font-size: 1.15em; }
.icon { background: none; border: 0; cursor: pointer; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.icon:hover { background: rgba(27, 35, 64, .07); color: var(--ink); }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: var(--ink-2); }

kbd {
  font: 700 1em/1 var(--mono);
  display: inline-grid; place-items: center;
  min-width: 1.75em; height: 1.85em;
  padding: 0 .3em;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--ink);
}
.caps { display: inline-flex; gap: .3em; vertical-align: middle; font-size: 24px; }
.caps.sm { font-size: 15px; gap: .2em; }
.caps.sm kbd { box-shadow: 0 2px 0 var(--ink); border-width: 1.5px; }

/* ---------- logo ---------- */

.logo { font-family: var(--mono); font-weight: 800; font-stretch: 112.5%; letter-spacing: -0.03em; text-decoration: none; color: var(--ink); display: inline-flex; align-items: baseline; }
.logo.big { font-size: clamp(64px, 11.5vw, 156px); line-height: 1; white-space: nowrap; padding-bottom: .12em; }
.logo.small { font-size: 22px; }
.logo .caret, .caret {
  display: inline-block;
  width: .13em; height: .95em;
  margin-left: .04em;
  background: var(--hi);
  border: 2px solid var(--ink);
  border-radius: 2px;
  vertical-align: -0.1em;
  animation: blink 1.05s steps(1) infinite;
}
.logo.small .caret { border-width: 1.5px; }
.logo .word span { display: inline-block; }
.logo .word .struck { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--pen); text-decoration-thickness: .08em; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- home ---------- */

body[data-kind="home"] { background-image:
    linear-gradient(90deg, transparent 54px, rgba(227, 52, 47, .45) 54px, rgba(227, 52, 47, .45) 56px, transparent 56px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px; }
.home {
  max-width: 1160px; margin: 0 auto; padding: 56px 28px 40px 84px;
  display: grid; gap: 48px 56px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-areas: "hero demo" "how how" "foot foot";
}
.hero { grid-area: hero; align-self: center; }
.lede { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.35; max-width: 30ch; margin: 22px 0 30px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.join { display: flex; gap: 10px; }
.code-in {
  width: 9.5em; font: 700 20px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 12px 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--white);
}
.code-in::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--ui); font-weight: 500; color: var(--ink-3); }
.code-in:focus, .name-in:focus, .answer:focus { outline: none; box-shadow: 0 0 0 4px var(--hi); }
.demo { grid-area: demo; align-self: center; display: grid; gap: 14px; }
.demo-q { font: 700 22px/1.2 var(--ui); }
.demo-q span { background: linear-gradient(transparent 55%, var(--hi) 55%, var(--hi) 92%, transparent 92%); }
.demo-note { color: var(--pen); font-weight: 700; opacity: 0; transition: opacity .3s; }
.demo-note.show { opacity: 1; }
.how { grid-area: how; max-width: 760px; }
.how ol { margin: 16px 0 12px; padding: 0; list-style: none; counter-reset: how; display: grid; gap: 12px; }
.how li { counter-increment: how; display: grid; grid-template-columns: 2.4em 1fr; align-items: baseline; font-size: 18px; max-width: 64ch; }
.how li::before { content: counter(how); font: 800 20px var(--mono); color: var(--pen); }
.how .note { color: var(--ink-2); }
.foot { grid-area: foot; display: flex; gap: 18px; color: var(--ink-2); font-size: 14px; }

/* ---------- message pages ---------- */

.msg { max-width: 560px; margin: 0 auto; padding: 48px 24px; display: grid; gap: 18px; }
.msg h1 { font-size: 34px; }
.msg .row { flex-wrap: wrap; }
.name-in { font: 600 20px var(--ui); padding: 12px 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--white); min-width: 0; flex: 1; }
.code-note { color: var(--ink-2); }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- top bar ---------- */

.top { display: flex; align-items: center; gap: 6px; padding: 10px 18px; white-space: nowrap; }
.top .logo { margin-right: 10px; }
.onair { display: none; font-size: 13px; font-weight: 700; color: var(--pen); align-items: center; gap: 6px; }
.onair:not([hidden]) { display: inline-flex; }
.onair::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--pen); animation: blink 1.4s steps(1) infinite; }
.net { display: none; font-size: 13px; font-weight: 700; color: var(--pen); }
body.offline .net { display: inline; }
.watching { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }

/* ---------- lobby ---------- */

.lobby {
  max-width: 1120px; margin: 0 auto; padding: 10px 24px 48px;
  display: grid; gap: 28px 40px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas: "room people" "settings settings" "start start";
}
.lobby .room { grid-area: room; display: grid; gap: 26px; align-content: start; }
.lobby .people { grid-area: people; display: grid; gap: 16px; align-content: start; }
.lobby .settings { grid-area: settings; }
.lobby .start-row { grid-area: start; display: flex; justify-content: center; padding-top: 4px; }
.roomline { font: 700 18px var(--ui); display: flex; align-items: center; gap: 12px; }
.invite, .streamhelp { display: grid; gap: 12px; justify-items: start; }
.invite .row { flex-wrap: wrap; }
.qr { display: grid; gap: 10px; }
.qr-img { width: 168px; aspect-ratio: 1; background: var(--white); border: 2px solid var(--ink); border-radius: 10px; padding: 6px; }
.qr-img svg { width: 100%; height: 100%; display: block; }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.pl { display: inline-flex; align-items: center; gap: 6px; }
.pl.off { opacity: .45; }
.pl.me .chip { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.crown, .away { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.crown { color: var(--pen); }
.x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 2px 4px; border-radius: 6px; }
.x:hover { color: var(--pen); background: rgba(227, 52, 47, .08); }
.players.big { gap: 16px; }
.players.big .chip { font-size: 1.3em; padding: .2em .8em; }
.chip {
  display: inline-flex; align-items: center; max-width: 100%;
  background: var(--pc, var(--white));
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 11px 2px;
  font-weight: 700; font-size: 15px; color: var(--ink);
}
.chip b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-edit { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; padding-top: 6px; }
.me-edit .lbl { font-weight: 700; }
.me-edit .swatches { grid-column: 1 / -1; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); background: var(--c); cursor: pointer; padding: 0; }
.sw[aria-checked="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.sw:disabled { opacity: .25; cursor: not-allowed; }
.settings { display: grid; gap: 16px; background: var(--white); border: 2px solid var(--ink); border-radius: 14px; padding: 18px 20px 20px; box-shadow: var(--lift); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segb { text-align: left; display: grid; gap: 2px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); cursor: pointer; }
.segb small { color: var(--ink-2); font-size: 14px; }
.segb.on { background: var(--hi); box-shadow: 0 3px 0 var(--ink); }
.segb:disabled { cursor: default; }
.segb:disabled:not(.on) { opacity: .55; }
.sets { display: flex; flex-wrap: wrap; gap: 14px 30px; }
.set { display: flex; align-items: center; gap: 12px; }
.set .lbl { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper output { font: 700 20px var(--mono); min-width: 2.2ch; text-align: center; }
.more summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.more[open] { display: grid; gap: 14px; }
.more[open] summary { margin-bottom: 2px; }
.tog { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog-ui { flex: none; width: 44px; height: 26px; border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); position: relative; margin-top: 1px; }
.tog-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.tog input:checked + .tog-ui { background: var(--hi); }
.tog input:checked + .tog-ui::after { transform: translateX(18px); }
.tog input:focus-visible + .tog-ui { outline: 3px solid var(--ink); outline-offset: 2px; }
.tog input:disabled + .tog-ui { opacity: .55; }
.tog small { display: block; color: var(--ink-2); font-size: 14px; }

/* ---------- the round ---------- */

.game, .viewer { max-width: 1240px; margin: 0 auto; padding: 0 22px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; overflow-x: clip; }
.game > *, .viewer > * { min-width: 0; }
.phasebar { display: flex; align-items: baseline; gap: 14px; padding-top: 4px; }
.round { color: var(--ink-2); font-weight: 600; font-size: 15px; white-space: nowrap; }
.phase { font-size: 22px; font-weight: 750; flex: 1; }
.timer { font: 700 30px/1 var(--mono); font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: right; }
.timer.urgent { color: var(--pen); }

.card {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 14px 20px 16px;
  box-shadow: var(--lift);
}
.card .q { font: 750 clamp(22px, 3.1vw, 36px)/1.15 var(--ui); letter-spacing: -0.015em; text-wrap: balance; }
.card .sub { color: var(--ink-2); margin-top: 4px; font-weight: 500; }
.card .hint { margin-top: 8px; font-weight: 600; }
.card .hint b { background: var(--hi); color: var(--ink); padding: 0 6px 1px; border-radius: 4px; }
.card.is-imp { background: var(--ink); color: var(--white); }
.card.is-imp .q { color: var(--hi); }
.card.is-imp .sub { color: #c8cde2; }
.card.covered .card-body { visibility: hidden; }
.card.covered.peek .card-body { visibility: visible; }
.lid {
  position: absolute; inset: 0; width: 100%;
  border: 0; border-radius: 6px; cursor: pointer;
  background: repeating-linear-gradient(-45deg, var(--white) 0 12px, #eef1f6 12px 24px);
  font: 700 17px var(--ui); color: var(--ink-2);
}
.card.peek .lid { background: transparent; color: transparent; }

/* bubbles */
.board { display: grid; gap: 20px 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.board[data-n="3"], .board[data-n="4"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.bubble {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 11px 15px 16px;
  min-height: 112px;
  box-shadow: var(--lift);
  transition: box-shadow .12s, background .15s, opacity .3s;
}
.bubble::before, .bubble::after { content: ""; position: absolute; left: 26px; width: 0; height: 0; border-style: solid; }
.bubble::before { bottom: -19px; border-width: 15px 14px 0 0; border-color: var(--ink) transparent transparent transparent; }
.bubble::after { bottom: -12px; left: 28px; border-width: 11px 10px 0 0; border-color: var(--white) transparent transparent transparent; }
.bubble.chosen { background: var(--hi); }
.bubble.chosen::after { border-top-color: var(--hi); }
.bubble.me { border-width: 3px; }
.bubble.off { opacity: .55; }
.bubble.cleared { opacity: .5; }
.bubble.typing { box-shadow: var(--lift), 0 0 0 5px color-mix(in srgb, var(--pc) 60%, transparent); }
.tag { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 28px; }
.you { display: none; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.bubble.me .you { display: inline; }
.status { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.status[data-s="locked"]::before { content: "⏎ "; font-family: var(--mono); }
.status[data-s="voted"]::before { content: "✓ "; }
.status[data-s="away"] { color: var(--ink-3); }
.drafts { display: flex; flex-wrap: wrap; gap: 2px 12px; font: 500 15px/1.3 var(--mono); color: var(--ink-2); }
.drafts s { text-decoration: line-through; text-decoration-color: var(--pen); text-decoration-thickness: 3px; }
.line {
  position: relative;
  font: 650 clamp(22px, 2.5vw, 32px)/1.3 var(--mono);
  font-stretch: 104%;
  min-height: 1.3em;
  overflow-wrap: anywhere;
}
.text span { display: inline-block; white-space: pre; }
.text span.in { animation: pop .16s ease-out; }
.text .dot { color: var(--ink-3); font-weight: 800; margin-right: .08em; }
@keyframes pop { from { transform: translateY(-.3em) scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
.ghosts { position: absolute; inset: 0; pointer-events: none; }
.ghost { position: absolute; color: var(--pen); white-space: pre; animation: fall .75s cubic-bezier(.45, .05, .8, .55) forwards; }
@keyframes fall { to { transform: translateY(1.5em) rotate(28deg); opacity: 0; } }
.bubble .caret { display: none; width: .14em; height: 1.05em; vertical-align: -0.17em; background: var(--pc); border-width: 1.5px; }
body[data-phase="type"] .bubble:not(.locked):not(.blind) .caret { display: inline-block; }
body[data-phase="type"] .bubble.empty:not(.locked) .line::before { content: ""; }
.bubble.blind .caret { display: none; }
.bubble.locked .line { color: var(--ink); }
.meta { margin-top: 8px; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.meta span { display: block; }
.meta span:first-child { color: var(--ink); font-weight: 600; }
.meta:empty { display: none; }
.marks { position: absolute; right: 10px; bottom: 6px; display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.tickmark { width: 30px; height: 30px; }
.tickmark path { fill: none; stroke: var(--pen); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.tickmark.draw path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .3s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.loop { position: absolute; left: -14px; top: -14px; pointer-events: none; overflow: visible; z-index: 2; }
.loop path { fill: none; stroke: var(--pen); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.stamp {
  position: absolute; right: -6px; top: -20px; z-index: 3;
  font: 800 22px/1 var(--ui); font-stretch: 90%;
  color: var(--pen); background: rgba(255, 255, 255, .94);
  border: 3px solid var(--pen); border-radius: 8px;
  padding: 5px 10px 6px;
  transform: rotate(var(--rot, -4deg));
  animation: stamp .28s cubic-bezier(.2, 1.6, .4, 1);
}
.stamp.ink { color: var(--ink); border-color: var(--ink); }
@keyframes stamp { from { transform: rotate(var(--rot, -4deg)) scale(1.8); opacity: 0; } }
.badge:empty { display: none; }
.badge.pts { position: absolute; left: -12px; top: -16px; z-index: 3; font: 800 30px/1 var(--ui); color: var(--pen); transform: rotate(-9deg); text-shadow: 0 2px 0 var(--white), 2px 0 0 var(--white), -2px 0 0 var(--white); }
.badge.had { margin-top: 8px; color: var(--pen); font-weight: 700; font-size: 15px; }
.bubble.pulse { animation: nudge .25s; }
@keyframes nudge { 40% { transform: translateY(-3px) rotate(-.6deg); } }
body[data-phase="vote"] .bubble:not(.me) { cursor: pointer; }
body[data-phase="vote"] .bubble:not(.me):hover { box-shadow: var(--lift), 0 0 0 5px color-mix(in srgb, var(--hi) 80%, transparent); }

/* timeline */
.tl-wrap:empty { display: none; }
.timeline { position: relative; display: grid; gap: 4px; padding: 10px 12px; background: var(--white); border: 2px solid var(--ink); border-radius: 12px; }
.tl-row { display: grid; grid-template-columns: 76px 1fr; align-items: center; height: 18px; }
.tl-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.tl-lane { position: relative; height: 2px; background: var(--grid); }
.tl-lane i { position: absolute; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.tl-key { width: 8px; height: 8px; background: var(--pc); border: 1.5px solid var(--ink); }
.tl-del { width: 9px; height: 9px; background: var(--pen); }
.tl-lock { width: 10px; height: 14px; border-radius: 3px !important; background: var(--ink); }
.tl-over { position: absolute; left: 88px; right: 12px; top: 6px; bottom: 6px; }
.tl-over.seekable { cursor: ew-resize; }
.tl-live { position: absolute; top: -2px; bottom: -2px; border-left: 2px dashed var(--pen); }
.tl-live span { position: absolute; top: -4px; left: 4px; font-size: 11px; font-weight: 700; color: var(--pen); white-space: nowrap; background: var(--white); padding: 0 3px; }
.tl-head { position: absolute; top: -4px; bottom: -4px; left: 0; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; }

/* dock */
.dock { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.dock:empty { display: none; }
.answer-row { display: flex; gap: 12px; align-items: stretch; }
.answer {
  flex: 1; min-width: 0; width: 100%;
  font: 650 26px var(--mono);
  padding: 12px 16px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--white);
}
.answer:disabled { background: #eef1f6; color: var(--ink-3); }
.answer::placeholder { color: var(--ink-3); font-family: var(--ui); font-weight: 500; font-size: 20px; }
.locked-msg { font-weight: 700; display: flex; gap: 10px; align-items: center; }
.vote-help { font-weight: 700; font-size: 18px; }
.guess { display: grid; gap: 10px; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.opt {
  text-align: left; font: 650 17px/1.25 var(--ui);
  padding: 12px 14px; background: var(--white);
  border: 2px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.opt:disabled { cursor: default; color: var(--ink); opacity: 1; }
.opt.right span, .opt.chosen span { background: linear-gradient(transparent 50%, var(--hi) 50%, var(--hi) 92%, transparent 92%); }
.opt.chosen { background: var(--hi); }
.opt:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.result { display: grid; gap: 12px; justify-items: start; }
.was { font-size: 18px; }
.theq { font-size: 22px; background: linear-gradient(transparent 55%, var(--hi) 55%, var(--hi) 90%, transparent 90%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.guessed.ok b { color: var(--ink); }
.guessed.no b { text-decoration: line-through; text-decoration-color: var(--pen); text-decoration-thickness: 2px; }
.scores { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; min-width: min(100%, 360px); }
.scores li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; }
.scores .chip { justify-self: start; }
.scores .plus { color: var(--pen); font-weight: 800; }
.scores .sc { font: 700 18px var(--mono); min-width: 2ch; text-align: right; }
.scores li.me .chip { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }

/* stage */
.stage { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 40; padding: 0 4vw; }
.stage.top { place-items: start center; padding-top: 16vh; }
.stage.low { place-items: end center; padding-bottom: 7vh; }
.stage.top .banner, .stage.low .banner { font-size: clamp(30px, 5.2vw, 72px); }
.banner {
  font: 800 clamp(40px, 8vw, 112px)/1 var(--ui); font-stretch: 85%;
  max-width: 90vw; text-align: center;
  color: var(--ink); background: var(--hi);
  padding: .12em .4em .18em;
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 7px 0 var(--ink);
  transform: rotate(-2deg);
  animation: bin .32s cubic-bezier(.2, 1.5, .4, 1);
}
.banner.out { animation: bout .3s forwards; }
.banner.still { animation: none; }
.banner.live { background: var(--pen); color: var(--white); }
.banner.bad { background: var(--white); color: var(--pen); border-color: var(--pen); box-shadow: 0 7px 0 var(--pen); }
.banner.good { background: var(--hi); }
.banner.count { font-family: var(--mono); background: var(--white); font-size: clamp(70px, 14vw, 180px); padding: .05em .45em .1em; }
@keyframes bin { from { transform: rotate(-2deg) scale(.6); opacity: 0; } }
@keyframes bout { to { transform: rotate(-2deg) scale(1.08); opacity: 0; } }

/* final */
.final { max-width: 860px; margin: 0 auto; padding: 18px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
.over { font-size: clamp(36px, 6vw, 64px); }
.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.podium li { display: grid; grid-template-columns: 2.2em auto 1fr; gap: 14px; align-items: center; font-size: 18px; }
.podium .place { font: 800 22px var(--mono); color: var(--ink-2); }
.podium .sc { text-align: right; font: 700 18px var(--mono); }
.podium li.first { font-size: 26px; padding: 10px 14px; background: var(--hi); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--lift); }
.podium li.first .place { color: var(--ink); }
.podium li.me .chip { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.awards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.award { display: grid; gap: 6px; justify-items: start; padding: 14px 16px; background: var(--white); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--lift); }
.award > b { font-size: 18px; }
.award small { color: var(--ink-2); font-size: 14px; }
.viewers ol { margin: 10px 0 0; padding-left: 1.4em; display: grid; gap: 4px; }

/* ---------- stream screen ---------- */

body[data-kind="screen"] { overflow: hidden; font-size: clamp(14px, 1.05vw, 30px); }
.screen {
  height: 100vh; height: 100dvh;
  display: grid; gap: 1.2vw 1.6vw;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 21vw, 520px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top side" "main side";
  padding: 1.4vw 1.6vw;
}
.s-top { grid-area: top; display: flex; align-items: baseline; gap: 1.4vw; }
.s-top .logo { font-size: 2vw; }
.s-top .round { font-size: 1.1vw; }
.s-top .phase { font-size: 2.1vw; }
.s-top .timer { font-size: 2.6vw; }
.s-main { grid-area: main; display: flex; flex-direction: column; gap: 1.2vw; min-height: 0; overflow: hidden; padding-bottom: 1.3vw; }
.s-main > .board { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(0, 1fr); align-content: stretch; }
.s-main > .card, .s-main > .tl-wrap, .s-main > .dock { flex: none; }
.s-side { grid-area: side; display: grid; gap: .9vw; align-content: start; background: var(--white); border: 2px solid var(--ink); border-radius: 1vw; padding: 1.2vw; box-shadow: var(--lift); }
.s-side h2 { font-size: 1.6vw; }
.s-side h3 { font-size: 1.1vw; margin-top: .6vw; }
.s-side .qr-img { width: 100%; border-radius: .6vw; }
.s-link { font: 700 1.05vw var(--mono); overflow-wrap: anywhere; }
.s-side .fine { font-size: .95vw; }
.screen .card .q { font-size: 2.3vw; }
.screen .card .sub { font-size: 1vw; }
.screen .board { gap: 1.6vw 1.3vw; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.screen .board[data-n="5"], .screen .board[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.screen .board[data-n="7"], .screen .board[data-n="8"], .screen .board[data-n="9"], .screen .board[data-n="10"], .screen .board[data-n="11"], .screen .board[data-n="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.screen .bubble { min-height: 6vw; padding: .7vw 1vw 1vw; border-radius: 1.2vw; display: flex; flex-direction: column; }
.screen .bubble .body { flex: 1; display: flex; flex-direction: column; justify-content: safe center; min-height: 0; }
.screen .meta span:nth-child(n+3) { display: none; }
.screen .chip { font-size: 1.05vw; }
.screen .status, .screen .meta { font-size: .85vw; }
.screen .line { font-size: 3.4vw; }
.screen .board[data-n="5"] .line, .screen .board[data-n="6"] .line { font-size: 2.6vw; }
.screen .board[data-n="7"] .line, .screen .board[data-n="8"] .line { font-size: 2vw; }
.screen .board[data-n="9"] .line, .screen .board[data-n="10"] .line, .screen .board[data-n="11"] .line, .screen .board[data-n="12"] .line { font-size: 1.6vw; }
.screen .meta { margin-top: .4vw; }
.screen .drafts { font-size: 1vw; }
.screen .tl-row { height: 1.1vw; }
.screen .tl-name { font-size: .85vw; }
.screen .opt { font-size: 1.1vw; }
.screen .guess h2 { font-size: 1.5vw; }
.screen .guessed { font-size: 1.4vw; }
.s-lobby { display: grid; gap: 2vw; align-content: center; justify-items: start; height: 100%; padding-left: 2vw; }
.s-lobby .logo.big { font-size: 11vw; }
.s-lobby .lede { font-size: 1.9vw; max-width: 34ch; margin: 0; }
.s-lobby .players.big .chip { font-size: 1.5vw; }
.s-lobby .wait { font-size: 1.4vw; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .45vw; }
.bars li { position: relative; display: flex; justify-content: space-between; padding: .25vw .55vw; border: 2px solid var(--ink); border-radius: .5vw; overflow: hidden; font-size: 1vw; font-weight: 700; isolation: isolate; }
.bars li::before { content: ""; position: absolute; inset: 0; width: var(--w); background: var(--pc); z-index: -1; transition: width .4s; }
.chatq { font-weight: 700; font-size: 1.05vw; }
.top { margin: 0; padding-left: 1.3em; font-size: 1vw; }
.screen .final { padding: 0; margin: 0; max-width: 62vw; gap: 1.4vw; }
.screen .final .over { font-size: 3.4vw; }
.screen .podium li { font-size: 1.4vw; }
.screen .podium li.first { font-size: 2vw; }
.screen .award > b { font-size: 1.2vw; }
.screen .award small { font-size: .9vw; }
.soundgate { justify-self: start; margin-top: .6vw; }
.screen .banner { font-size: 7vw; }
.screen .stamp { font-size: 1.4vw; }
.screen .badge.pts { font-size: 2.2vw; }
.screen .tickmark { width: 2vw; height: 2vw; }

/* ---------- viewers ---------- */

.viewer { gap: 14px; padding-bottom: 40px; }
.board.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 14px 12px; }
.board.compact .bubble { min-height: 76px; padding: 8px 11px 11px; border-radius: 16px; }
.board.compact .line { font-size: 19px; }
.board.compact .chip { font-size: 13px; }
.board.compact .status { font-size: 12px; }
.board.compact .meta { display: none; }
.board.compact .drafts { font-size: 13px; }
.board.compact .stamp { font-size: 16px; padding: 3px 7px; }
.board.compact .tickmark { width: 22px; height: 22px; }
.vpanel { display: grid; gap: 12px; margin-top: 10px; }
.vbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.vb { padding: 8px 12px 9px; }
.vme { font-weight: 700; color: var(--ink-2); }
.viewer .card .q { font-size: 22px; }

/* ---------- toast, dialog ---------- */

#toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 70;
  transform: translate(-50%, 140%);
  background: var(--ink); color: var(--white);
  padding: 10px 16px; border-radius: 10px; font-weight: 600;
  max-width: min(92vw, 460px);
  transition: transform .25s;
}
#toast.show { transform: translate(-50%, 0); }
dialog.about { max-width: 480px; border: 2px solid var(--ink); border-radius: 14px; padding: 22px 24px; box-shadow: 0 6px 0 var(--ink); color: var(--ink); }
dialog.about::backdrop { background: rgba(27, 35, 64, .35); }
dialog.about p { margin: 10px 0; }
dialog.about .ver { color: var(--ink-2); font-size: 14px; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; grid-template-areas: "hero" "demo" "how" "foot"; padding: 36px 20px 32px 76px; gap: 36px; }
  .lobby { grid-template-columns: 1fr; grid-template-areas: "people" "room" "settings" "start"; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  body[data-kind="home"] { background-image:
    linear-gradient(90deg, transparent 22px, rgba(227, 52, 47, .45) 22px, rgba(227, 52, 47, .45) 24px, transparent 24px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px); }
  .home { padding: 28px 16px 28px 40px; }
  .top { padding: 8px 12px; gap: 2px; }
  .icon { padding: 6px 6px; font-size: 13px; }
  .game, .viewer { padding: 0 12px 0; gap: 12px; }
  .lobby { padding: 6px 14px 40px; }
  .phase { font-size: 18px; }
  .timer { font-size: 24px; }
  .card { padding: 10px 14px 12px; }
  .card .q { font-size: 21px; }
  .board, .board[data-n] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  .board[data-n="1"], .board[data-n="2"] { grid-template-columns: 1fr; }
  .meta span:nth-child(n+3) { display: none; }
  .cover { display: none; }
  .onair { font-size: 0; gap: 0; }
  .game > .phasebar { order: -3; }
  body[data-phase="guess"] .game > .dock, body[data-phase="result"] .game > .dock { order: -2; }
  .bubble { min-height: 84px; padding: 8px 10px 12px; border-radius: 16px; }
  .bubble::before { left: 18px; }
  .bubble::after { left: 20px; }
  .line { font-size: 19px; }
  .chip { font-size: 13px; padding: 0 8px 1px; }
  .status { font-size: 11.5px; }
  .meta { font-size: 12px; }
  .drafts { font-size: 13px; }
  .stamp { font-size: 16px; padding: 3px 7px 4px; }
  .tickmark { width: 22px; height: 22px; }
  .dock { position: sticky; bottom: 0; z-index: 5; background: var(--paper); padding: 10px 0 12px; margin: 0 -12px; padding-inline: 12px; border-top: 2px solid var(--ink); }
  .dock-result, .dock-guess, .dock-vote { position: static; border-top: 0; }
  .answer { font-size: 20px; padding: 10px 12px; }
  .key.enter { padding: 8px 12px; }
  .seg { grid-template-columns: 1fr; }
  .settings { padding: 14px; }
  .tl-row { grid-template-columns: 54px 1fr; }
  .tl-over { left: 66px; }
}

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