/* The Liar. Tokens, buttons and home layout follow Wordle Party, Thulla and Guesstimate;
   the drawing is a sheet of dotted paper where every player has their own pen colour. */
:root {
  --bg: #e9ecf7;
  --surface: #ffffff;
  --ink: #1b1e3a;
  --muted: #5d6285;
  --line: #c4c9e3;
  --key: #d3d8ee;
  --hit: #3e9b5e;
  --danger: #c2334d;
  --liar: #d63c58;
  --paper: #fdfdfb;
  --dot: rgba(27, 30, 58, 0.16);
  /* pens */
  --p0: #2f6fe0; --p1: #d63f86; --p2: #7c4ddb; --p3: #0b958f;
  --p4: #e0622a; --p5: #4f8f23; --p6: #b47f06; --p7: #8a5a3c;
  --shadow: 0 1px 0 rgba(27, 30, 58, 0.04), 0 18px 40px -24px rgba(27, 30, 58, 0.35);
  --font: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --surface: #15171b;
    --ink: #e8e9ec;
    --muted: #8d919b;
    --line: #2a2d33;
    --key: #30333a;
    --hit: #4fb477;
    --danger: #e0566e;
    --liar: #ff6a80;
    --paper: #121418;
    --dot: rgba(255, 255, 255, 0.09);
    --p0: #5f9cff; --p1: #ff6fae; --p2: #a98bff; --p3: #2fd0c6;
    --p4: #ff8a50; --p5: #7fc94f; --p6: #f2c14e; --p7: #c79a78;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.9);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.15; margin: 0; }
:focus-visible { outline: 3px solid var(--p0); outline-offset: 2px; }
.pc0 { --pc: var(--p0); } .pc1 { --pc: var(--p1); } .pc2 { --pc: var(--p2); } .pc3 { --pc: var(--p3); }
.pc4 { --pc: var(--p4); } .pc5 { --pc: var(--p5); } .pc6 { --pc: var(--p6); } .pc7 { --pc: var(--p7); }
.pen-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--pc, var(--muted)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, var(--muted)) 18%, transparent); }

/* ---------- Buttons & fields ---------- */
.btn {
  font: 600 1rem/1 var(--font);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0.85rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.ghost { border-color: var(--line); }
.btn.link { border: 0; padding: 0.6rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.field { display: grid; gap: 0.35rem; font-weight: 600; }
.field input, .text-input {
  font: 600 1.05rem var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; width: 100%;
}
.field input:focus, .text-input:focus { border-color: var(--ink); outline: none; }
#code-input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; }
#code-input::placeholder { letter-spacing: normal; text-transform: none; }
.error { color: var(--danger); font-weight: 600; margin: 0; }
.error:empty { display: none; }
.select-field { display: grid; gap: 0.35rem; font-weight: 600; }
.select-field select {
  font: 600 1rem var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.75rem; width: 100%;
}
.small-note { font-size: 0.86rem; margin: 0; }
.small-note:empty { display: none; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 2.25rem; height: 2.25rem; padding: 0 0.4rem;
  font: 800 1rem var(--font); line-height: 1;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.toggle { display: flex; gap: 0.6rem; align-items: center; cursor: pointer; font-weight: 600; }
.toggle input { width: 1.15rem; height: 1.15rem; accent-color: var(--hit); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface); }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg button {
  display: grid; gap: 0.1rem; justify-items: center;
  font: 600 0.95rem var(--font); color: var(--muted); background: transparent;
  border: 0; border-radius: 7px; padding: 0.55rem 0.4rem; cursor: pointer;
}
.seg button small { font-size: 0.75rem; font-weight: 500; opacity: 0.85; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- Account chip ---------- */
.top-right { position: absolute; top: calc(0.9rem + env(safe-area-inset-top, 0px)); right: 1rem; display: flex; gap: 0.5rem; }
.account-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; height: 2.25rem;
  font: 700 0.92rem var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 0.85rem; cursor: pointer;
}
.avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* ---------- Home ---------- */
.screen { min-height: 100%; }
.home, .lobby { position: relative; display: grid; place-items: center; padding: 4.25rem 1.5rem 2rem; }
.home-inner { width: 100%; max-width: 1120px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 3rem; align-items: center; }
.home-intro { display: grid; gap: 1rem; align-content: start; }
.home-intro .btn.link { justify-self: start; padding-left: 0; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .home-inner { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; max-width: 560px; } }
@media (max-width: 560px) { .home-cards { grid-template-columns: minmax(0, 1fr); } }

.logo { display: grid; justify-items: start; gap: 0.5rem; margin-bottom: 0.25rem; }
.logo-row { display: flex; align-items: flex-end; gap: 5px; }
.logo-row .gap { width: 10px; }
.tile {
  display: grid; place-items: center;
  width: clamp(46px, 12vw, 62px); aspect-ratio: 1;
  border: 1.5px solid var(--ink); border-radius: 10px;
  font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 800; color: var(--ink);
  background: var(--surface);
  animation: tile-in 0.45s cubic-bezier(.3, 1.4, .5, 1) both;
}
.tile.small { width: clamp(28px, 7vw, 36px); font-size: clamp(0.95rem, 3.4vw, 1.2rem); border-color: var(--line); color: var(--muted); border-radius: 7px; }
.tile.odd {
  color: var(--liar); border-color: var(--liar);
  transform: rotate(-9deg) translateY(-6px);
  box-shadow: 0 6px 0 -3px color-mix(in srgb, var(--liar) 35%, transparent);
  animation: odd-in 0.7s 0.35s cubic-bezier(.3, 1.6, .5, 1) both;
}
.logo-row > :nth-child(2) { animation-delay: 0.04s; } .logo-row > :nth-child(3) { animation-delay: 0.08s; }
.logo-row > :nth-child(5) { animation-delay: 0.14s; } .logo-row > :nth-child(7) { animation-delay: 0.22s; } .logo-row > :nth-child(8) { animation-delay: 0.26s; }
@keyframes tile-in { from { transform: translateY(-14px); opacity: 0; } }
@keyframes odd-in { from { transform: rotate(0) translateY(-14px); opacity: 0; } }
.logo-sub { color: var(--muted); font-size: 1.05rem; font-weight: 600; letter-spacing: 0.01em; line-height: 1.3; }
.lede { font-size: 1.12rem; max-width: 42ch; margin: 0 0 0.25rem; }

.choice {
  display: grid; gap: 0.75rem; align-content: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem;
}
.choice h2 { font-size: 1.2rem; }
.choice p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.choice .btn { margin-top: auto; }
.choice.steps { grid-column: 1 / -1; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; }
.step-list li { display: grid; gap: 0.25rem; align-content: start; }
.step-list svg { width: 34px; height: 34px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.step-list li:nth-child(4) svg { stroke: var(--liar); }
.step-list b { font-size: 0.95rem; }
.step-list span { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
@media (max-width: 560px) { .step-list { grid-template-columns: 1fr 1fr; } }

/* ---------- Lobby ---------- */
.lobby-inner { width: 100%; max-width: 980px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: start; }
.lobby-room { display: grid; gap: 0.9rem; text-align: center; }
.lobby-room > .muted:first-child { margin: 0; }
.lobby-setup { display: grid; gap: 1rem; }
.lobby-setup #guest-settings > p { text-align: center; }
@media (max-width: 860px) { .lobby-inner { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; max-width: 480px; } }
.room-code { font-size: clamp(3.5rem, 18vw, 5.5rem); font-weight: 800; letter-spacing: 0.12em; line-height: 1; margin-top: -0.5rem; }
.roster { list-style: none; padding: 0; margin: 0.25rem 0; display: grid; gap: 0.5rem; text-align: left; }
.roster li {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.9rem; font-weight: 600;
}
.roster li.off { opacity: 0.5; }
.roster li.empty { border-style: dashed; background: transparent; color: var(--muted); font-weight: 400; }
.roster .tag { margin-left: auto; font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.host-settings { display: grid; gap: 0.95rem; }
.setting { display: grid; gap: 0.4rem; }
.setting-label { font-weight: 600; }
.cat-picks { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; max-height: 9.5rem; overflow-y: auto; padding: 2px; }
.cat {
  font: 600 0.82rem var(--font); color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.7rem; cursor: pointer;
}
.cat[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.public-field { display: grid; gap: 0.35rem; }
.public-field .toggle { width: fit-content; }
.crew-field { display: grid; gap: 0.35rem; }
.crew-field label { font-weight: 600; }
.crew-field label .muted { font-weight: 400; font-size: 0.9rem; }
.crew-row { display: flex; gap: 0.5rem; }
.crew-row input { flex: 1; min-width: 0; }
.crew-row .btn { padding: 0.6rem 1rem; }
.settings-summary { list-style: none; margin: 0; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 0.2rem; }

/* ---------- Game ---------- */
.game { display: flex; flex-direction: column; }
.game-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1rem; border-bottom: 1px solid var(--line); }
.bar-code { font-weight: 800; letter-spacing: 0.06em; }
.bar-phase { margin-right: auto; color: var(--muted); white-space: nowrap; }
.clock { position: relative; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; }
.clock svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 2.5; }
.clock-track { stroke: var(--key); }
.clock-fill { stroke: var(--ink); stroke-dasharray: 1; stroke-linecap: round; }
.clock b { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.clock.urgent .clock-fill { stroke: var(--danger); }
.clock.urgent b { color: var(--danger); }
.progress { display: flex; gap: 3px; padding: 0 1rem; height: 3px; margin-top: 6px; }
.progress i { flex: 3; border-radius: 3px; background: var(--key); }
.progress i.vote { flex: 1.4; }
.progress i.done { background: var(--ink); }
.progress i.now { background: var(--muted); }

/* The drawing on the left, everything else in a side panel. The desk is sized from the
   window height so the whole sheet stays in view without scrolling. */
.arena {
  --desk: max(380px, calc((100dvh - 205px) * 1.3333 + 22px));
  flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 0.9rem 1.5rem;
  display: grid; grid-template-columns: minmax(0, var(--desk)) 340px; justify-content: center;
  column-gap: 2rem; row-gap: 1rem; align-items: start;
}
.desk { display: grid; gap: 0.6rem; min-width: 0; }
.desk-head { display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; min-height: 1.75rem; }
.desk-head b { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.spectator-note { margin-left: auto; font-size: 0.85rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; }
.side { display: grid; gap: 0.8rem; align-content: start; min-width: 0; }
@media (max-width: 900px) {
  .arena { grid-template-columns: minmax(0, 1fr); padding: 0.75rem 1rem; }
}

.sheet-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 10px; transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.sheet-host { border-radius: 9px; overflow: hidden; }
.sheet-host.my-turn { box-shadow: 0 0 0 2px var(--ink); }
.sheet-svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.sheet-svg.pen-on { cursor: crosshair; }
.paper { fill: var(--paper); }
.paper-dot { fill: var(--dot); }
.stroke { fill: none; stroke: var(--pc); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.2s ease; }
.stroke.dim { opacity: 0.1; }

/* Words game: the board of words, one row per player, one column per round */
.clue-board {
  aspect-ratio: 4 / 3; overflow: auto; border-radius: 9px; background: var(--paper);
  padding: clamp(0.6rem, 2vw, 1.2rem); display: grid; align-content: center;
}
.clue-board.my-turn { box-shadow: 0 0 0 2px var(--ink); }
.clue-grid { display: grid; grid-template-columns: minmax(5.5rem, auto) repeat(3, minmax(0, 1fr)); gap: 0.45rem 0.6rem; align-items: center; }
.clue-grid .rh { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.clue-grid .who { display: flex; align-items: center; gap: 0.45rem; font-weight: 800; color: var(--pc); min-width: 0; }
.clue-grid .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clue-grid .cell {
  min-height: 2.6rem; display: grid; place-items: center; text-align: center; padding: 0.3rem 0.5rem;
  border-radius: 10px; border: 1.5px dashed color-mix(in srgb, var(--ink) 14%, transparent);
  font-weight: 800; font-size: clamp(0.95rem, 1.7vw, 1.2rem); line-height: 1.15; overflow-wrap: anywhere; transition: opacity 0.2s ease;
}
.clue-grid .cell.said { border: 1.5px solid color-mix(in srgb, var(--pc) 55%, transparent); background: color-mix(in srgb, var(--pc) 10%, var(--surface)); color: var(--ink); animation: hand-in-plain 0.35s ease both; }
.clue-grid .cell.passed { border-style: solid; color: var(--muted); font-weight: 600; font-style: italic; font-size: 0.85rem; }
.clue-grid .cell.now { border: 2px solid var(--pc); color: var(--pc); font-weight: 700; font-size: 0.85rem; animation: typing 1.2s ease-in-out infinite; }
@keyframes typing { 50% { background: color-mix(in srgb, var(--pc) 12%, transparent); } }
.clue-grid .dim { opacity: 0.18; }
.clue-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.clue-form input { font-size: 1.2rem; font-weight: 700; }
.clue-form .btn { padding: 0.7rem 1.2rem; }
.clue-hint { grid-column: 1 / -1; margin: 0; min-height: 1.3rem; font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.clue-hint.bad { color: var(--liar); }
.clue-hint.good { color: var(--hit, var(--ink)); }
@media (max-width: 560px) {
  .clue-board { aspect-ratio: auto; min-height: 15rem; }
  .clue-grid { grid-template-columns: minmax(4rem, auto) repeat(3, minmax(0, 1fr)); gap: 0.35rem 0.4rem; }
  .clue-grid .cell { min-height: 2.3rem; padding: 0.25rem 0.3rem; font-size: 0.9rem; }
  .clue-grid .who { font-size: 0.9rem; }
}

/* Time game: stop a hidden clock, then everyone's times as bars */
.time-board {
  aspect-ratio: 4 / 3; border-radius: 9px; background: var(--paper);
  padding: clamp(0.8rem, 2.5vw, 1.6rem); display: grid; align-content: center;
}
.time-play { display: grid; justify-items: center; gap: 1rem; text-align: center; width: min(420px, 100%); margin: 0 auto; }
.time-k { margin: 0; font-weight: 800; font-size: clamp(1.05rem, 2.2vw, 1.3rem); letter-spacing: -0.01em; }
.time-play .peek { min-height: 84px; }
.time-btn {
  font: inherit; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; letter-spacing: -0.01em;
  width: min(260px, 100%); aspect-ratio: 2.4 / 1; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--pc, var(--ink)); background: var(--surface); color: var(--pc, var(--ink));
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.time-btn.running { background: var(--pc, var(--ink)); color: var(--surface); }
.time-btn:disabled { opacity: 0.55; cursor: default; }
.time-status { margin: 0; min-height: 1.5rem; color: var(--muted); font-weight: 600; }
.time-results { display: grid; gap: 0.9rem; align-content: center; width: 100%; }
.time-board.results { aspect-ratio: auto; min-height: 22rem; }

/* Who's counting while the clock runs */
.time-roster { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.time-roster li {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem 0.3rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.88rem;
}
.time-roster .nm { font-weight: 800; color: var(--pc); }
.time-roster .st { color: var(--muted); font-weight: 600; }
.time-roster li.going .st { color: var(--ink); animation: counting 1.4s ease-in-out infinite; }
.time-roster li.done { border-color: color-mix(in srgb, var(--hit) 55%, transparent); background: color-mix(in srgb, var(--hit) 9%, var(--surface)); }
.time-roster li.done .st { color: var(--hit); }
.time-roster li.off { opacity: 0.5; }
@keyframes counting { 50% { opacity: 0.45; } }
#time-roster-note { margin: 0; min-height: 1.2rem; }

/* The timeline: one ruler of seconds with a pin per player */
.tl { position: relative; padding: 0 0.4rem; }
.tl.with-target { padding-top: 1.7rem; }
.tl-lanes { position: relative; }
.tl-pin { transition: opacity 0.2s ease; }
.tl-pin.dim { opacity: 0.15; }
.tl-chip {
  position: absolute; display: grid; justify-items: center; padding: 0.2rem 0.55rem; border-radius: 9px; white-space: nowrap;
  background: color-mix(in srgb, var(--pc) 14%, var(--surface)); border: 1.5px solid var(--pc); line-height: 1.15;
  animation: tl-in 0.35s ease both; z-index: 2;
}
@keyframes tl-in { from { opacity: 0; } }
.tl-chip b { font-size: 0.8rem; font-weight: 800; color: var(--pc); }
.tl-chip b em { font-style: normal; color: var(--liar); text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em; }
.tl-chip > span { font-size: 0.92rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-pin.liar .tl-chip { box-shadow: 0 0 0 3px color-mix(in srgb, var(--liar) 35%, transparent); }
.tl-stem { position: absolute; bottom: 0; width: 0; border-left: 1.5px solid var(--pc); transform: translateX(-0.75px); z-index: 1; }
.tl-dot {
  position: absolute; bottom: -6px; width: 12px; height: 12px; border-radius: 50%; transform: translateX(-50%);
  background: var(--pc); box-shadow: 0 0 0 3px var(--paper); z-index: 3;
}
.tl-axis { position: relative; height: 2.1rem; border-top: 2px solid var(--ink); }
.tl-tick { position: absolute; top: 0; height: 7px; border-left: 1.5px solid var(--ink); transform: translateX(-0.75px); }
.tl-tick.minor { height: 4px; opacity: 0.6; }
.tl-tick span { position: absolute; top: 8px; left: 0; transform: translateX(-50%); font-size: 0.72rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl.with-target .tl-axis { height: 3.5rem; }
.tl-unit { position: absolute; right: 0; top: 1.15rem; font-size: 0.68rem; color: var(--muted); }
.tl-range {
  position: absolute; top: 0; bottom: -3.5rem; background: color-mix(in srgb, var(--liar) 10%, transparent);
  border-left: 1.5px dashed color-mix(in srgb, var(--liar) 60%, transparent);
  border-right: 1.5px dashed color-mix(in srgb, var(--liar) 60%, transparent);
}
.tl-range span {
  position: absolute; bottom: 0.15rem; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 0.7rem; font-weight: 800; color: var(--liar); background: var(--paper); padding: 0 0.3rem; border-radius: 4px; z-index: 4;
}
.tl-target { position: absolute; top: -1.7rem; bottom: -0.35rem; border-left: 2.5px solid var(--ink); transform: translateX(-1.25px); z-index: 1; }
.tl-target span {
  position: absolute; top: 0; left: 0; white-space: nowrap; font-size: 0.78rem; font-weight: 800;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 0.05rem 0.55rem;
}
.tl-missing { margin: 0; font-size: 0.88rem; color: var(--muted); }
.tl-missing span { color: var(--pc); font-weight: 800; }

/* The result: closest first */
.tl-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.tl-rank li {
  display: grid; grid-template-columns: 1.4rem auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 0.55rem;
  padding: 0.35rem 0.6rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); transition: opacity 0.2s ease;
}
.tl-rank li.dim { opacity: 0.18; }
.tl-rank li.liar { border-color: color-mix(in srgb, var(--liar) 55%, transparent); background: color-mix(in srgb, var(--liar) 7%, var(--surface)); }
.tl-rank .rk { font-weight: 800; color: var(--muted); text-align: center; }
.tl-rank .nm { font-weight: 800; color: var(--pc); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-rank .nm em { font-style: normal; font-weight: 700; font-size: 0.78rem; color: var(--liar); }
.tl-rank .tm { font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-rank .off { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 6.3rem; text-align: right; }
.tl-rank .vd { font-size: 0.72rem; font-weight: 800; padding: 0.1rem 0.5rem; border-radius: 999px; text-align: center; min-width: 4.6rem; }
.tl-rank .vd.v0 { background: color-mix(in srgb, var(--hit) 18%, transparent); color: var(--hit); }
.tl-rank .vd.v1 { background: color-mix(in srgb, var(--p6) 20%, transparent); color: var(--p6); }
.tl-rank .vd.v2 { background: color-mix(in srgb, var(--p4) 18%, transparent); color: var(--p4); }
.tl-rank .vd.v3 { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
@media (max-width: 560px) {
  .time-board { aspect-ratio: auto; min-height: 17rem; }
  .tl-rank li { grid-template-columns: 1.1rem auto minmax(0, 1fr) auto auto; gap: 0.4rem; padding: 0.35rem 0.45rem; }
  .tl-rank .vd { display: none; }
  .tl-rank .off { min-width: 0; font-size: 0.78rem; }
  .tl-chip { padding: 0.15rem 0.4rem; }
}

.handoff {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 0.1rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1.5px solid var(--pc); border-radius: 16px; padding: 0.9rem 1.6rem;
  box-shadow: 0 10px 40px -12px color-mix(in srgb, var(--pc) 55%, transparent);
  pointer-events: none; animation: hand-in 0.35s cubic-bezier(.3, 1.5, .5, 1) both;
}
.handoff-name { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; color: var(--pc); letter-spacing: -0.02em; }
.handoff-sub { color: var(--muted); font-weight: 600; }
@keyframes hand-in { from { transform: translate(-50%, -40%) scale(0.92); opacity: 0; } }

/* Hold-to-peek card: the word is hidden unless the button is held down */
.peek {
  position: relative; display: grid; place-items: center; width: 100%; min-height: 96px;
  font: inherit; color: var(--ink); text-align: center; cursor: pointer;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--ink) 4%, transparent) 10px 11px),
    var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 1rem;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.peek-cover { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-weight: 700; }
.peek-cover svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.peek-secret { display: none; gap: 0.1rem; justify-items: center; }
.peek.peeking { background: var(--surface); border-color: var(--ink); }
.peek.peeking .peek-cover { display: none; }
.peek.peeking .peek-secret { display: grid; }
.card-k { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.peek-secret b { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; text-transform: capitalize; }
.peek-secret b.liar-word { color: var(--liar); text-transform: none; }
.card-cat { font-size: 0.85rem; color: var(--muted); }
.peek.big { min-height: 150px; }
.peek.big .peek-secret b { font-size: 2.4rem; }

.role-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem;
  background: color-mix(in srgb, var(--paper) 82%, transparent); border-radius: 16px;
}
.role-card { width: min(420px, 100%); display: grid; gap: 0.8rem; text-align: center; animation: hand-in-plain 0.4s ease both; }
.role-tip { margin: 0; color: var(--muted); font-size: 0.95rem; }
@keyframes hand-in-plain { from { transform: translateY(8px); opacity: 0; } }

.panel { display: grid; gap: 0.75rem; }
.panel h2 { font-size: 1.15rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.turn-status {
  display: grid; gap: 0.1rem; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--pc); border-radius: 12px; padding: 0.7rem 0.9rem;
}
.turn-status b { font-size: 1.1rem; }
.turn-status span { color: var(--muted); font-size: 0.92rem; }
.turn-status.mine { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 8%, var(--surface)); }

.order-list, .suspects, .vote-results, .score-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.order-list li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.6rem; border-radius: 10px; border: 1px solid transparent;
}
.order-list li.now { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 7%, transparent); }
.order-list li.off { opacity: 0.45; }
.order-list .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-list .tag { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.order-list li.now .tag { color: var(--pc); }
.rounds { display: flex; gap: 3px; }
.rounds i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line); }
.rounds i.done { background: var(--pc); border-color: var(--pc); }
.rounds i.now { border-color: var(--pc); }

.vote-now {
  display: grid; gap: 0.05rem; justify-items: center; width: 100%;
  font: inherit; color: var(--ink); background: transparent; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 0.7rem;
}
.vote-now b { font-weight: 700; }
.vote-now span { font-size: 0.82rem; color: var(--muted); }
.vote-now[aria-pressed="true"] { border-style: solid; border-color: var(--ink); background: var(--ink); color: var(--bg); }
.vote-now[aria-pressed="true"] span { color: color-mix(in srgb, var(--bg) 75%, transparent); }

.suspect {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem; width: 100%;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.8rem;
}
.suspect .nm { font-weight: 700; }
.suspect .tag { font-size: 0.78rem; color: var(--muted); }
.suspect:hover:not([aria-disabled="true"]), .suspect:focus-visible { border-color: var(--pc); }
.suspect.picked { border-color: var(--pc); box-shadow: 0 0 0 2px var(--pc); background: color-mix(in srgb, var(--pc) 8%, var(--surface)); }
.suspect[aria-disabled="true"] { cursor: default; opacity: 0.6; }

.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.option {
  font: 600 0.9rem var(--font); color: var(--ink); background: var(--surface); text-transform: capitalize;
  border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.35rem; cursor: pointer; line-height: 1.2;
}
.option:hover:not(:disabled) { border-color: var(--ink); }
.option:disabled { cursor: default; color: var(--muted); }
.option.picked { color: var(--bg); background: var(--ink); border-color: var(--ink); }

.result-head { border-radius: 14px; padding: 0.9rem 1rem; border: 1px solid var(--line); background: var(--surface); display: grid; gap: 0.2rem; }
.result-head h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.result-head p { margin: 0; color: var(--muted); }
.result-head.won { border-color: var(--hit); background: color-mix(in srgb, var(--hit) 9%, var(--surface)); }
.result-head.won h2 { color: var(--hit); }
.result-head.lost { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.result-head.lost h2 { color: var(--danger); }
.reveal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.reveal-row > div { display: grid; gap: 0.1rem; border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.75rem; background: var(--surface); }
.reveal-row .muted { font-size: 0.8rem; }
.reveal-word { font-size: 1.3rem; font-weight: 800; }
.reveal-liar { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; font-weight: 800; color: var(--liar); }
.vote-results li { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 0.55rem; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line); }
.vote-results li:last-child { border-bottom: 0; }
.vote-results .nm { font-weight: 700; }
.vote-results li.is-liar .nm { color: var(--liar); }
.vote-results .voted { font-size: 0.85rem; color: var(--muted); }
.vote-results .gain { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.vote-results .gain.plus { color: var(--hit); }
.result-tools, .result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.scores { display: grid; gap: 0.4rem; padding-top: 0.4rem; }
.scores h2 { font-size: 0.95rem; color: var(--muted); font-weight: 700; }
.score-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.55rem; font-size: 0.92rem; }
.score-list li.off { opacity: 0.45; }
.score-list .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-list b { font-variant-numeric: tabular-nums; }

/* ---------- Sheets, notices, toasts ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 9, 12, 0.5); z-index: 20; }
.sheet-panel {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--bg); border-left: 1px solid var(--line); padding: 1.1rem 1.2rem 2rem;
  overflow-y: auto; display: grid; align-content: start; gap: 1rem;
}
.sheet-panel.wide { width: min(560px, 100%); }
.sheet-panel header { display: flex; align-items: center; justify-content: space-between; }
.sheet-panel h2 { font-size: 1.4rem; }
.sheet-panel h3 { font-size: 1.05rem; margin-top: 0.3rem; }
.sheet-panel p { margin: 0; }
.rule-points { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.account-box { display: flex; align-items: center; gap: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem; }
.account-box .avatar { width: 40px; height: 40px; }
.account-box .who { flex: 1; min-width: 0; }
.account-box .who b { display: block; }
.account-box .who span { font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stat-grid div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.6rem; }
.stat-grid b { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 0.8rem; color: var(--muted); }
@media (max-width: 560px) {
  .sheet-panel, .sheet-panel.wide { top: auto; width: 100%; max-height: 88vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
}
.notice { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1rem; background: rgba(8, 9, 12, 0.55); }
.notice-card { width: min(380px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; display: grid; gap: 0.8rem; }
.notice-card p { margin: 0; color: var(--muted); }
.toast {
  position: fixed; z-index: 40; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-weight: 700; padding: 0.65rem 1rem; border-radius: 10px; max-width: calc(100% - 2rem);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition: none !important; }
}

/* Back to the games page (pakdragoon.github.io/office-games) */
.all-games {
  position: absolute; top: calc(0.9rem + env(safe-area-inset-top, 0px)); left: 1rem; z-index: 1;
  display: inline-flex; align-items: center; gap: 0.4rem; height: 2.25rem; padding: 0 0.85rem 0 0.7rem;
  font: 700 0.92rem var(--font); color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.all-games:hover { border-color: var(--ink); }
.all-games svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 330px) { .all-games span { display: none; } .all-games { padding: 0 0.6rem; } }

/* ---------- Shared replay ---------- */
a.btn { display: inline-block; text-align: center; text-decoration: none; }
.btn.small { padding: 0.5rem 0.9rem; font-size: 0.9rem; white-space: nowrap; }
#share-btn { width: 100%; }
.missing-card, .replay-missing { display: grid; place-items: center; }
.replay-missing { min-height: 100dvh; padding: 1.5rem; }
.missing-card { width: min(420px, 100%); gap: 0.8rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 1.6rem 1.3rem; }
.missing-card .btn { width: 100%; }
.replay .vote-results li { cursor: default; }
.replay .vote-results li.dim { opacity: 0.35; }

/* Delete my data (built by mountDeleteData in web/shared/cloud.js) */
.delete-data { display: grid; gap: 0.5rem; justify-items: start; margin-top: 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.delete-data .delete-data-btn { border-color: var(--danger); color: var(--danger); }
.delete-data .delete-data-btn.sure { background: var(--danger); border-color: var(--danger); color: #fff; }
.delete-data .delete-data-note { margin: 0; text-align: left; }
