/* Outfoxed! — styles. Layout sizes on the table use --u ("table unit"),
   set by js/ui.js so the board and cards always fit the screen. */

:root {
  --ink: #3b2a25;
  --cream: #fff8ea;
  --paper: #ffffff;
  --orange: #f26a1b;
  --orange-d: #c94f0c;
  --paw: #55a92f;
  --paw-d: #3c7d1f;
  --eye: #1d8fc0;
  --eye-d: #136a91;
  --red: #dc2733;
  --leaf: #2c8a38;
  --lip: rgba(59, 42, 37, 0.16);
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Baloo 2", "Varela Round",
    "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  font-family: var(--font);
  color: var(--ink);
  background: #eadcbf radial-gradient(circle at 25% 15%, #fbf3df, #e6d6b6 75%);
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid #ffd43b; outline-offset: 2px; }
svg { display: block; }
[hidden] { display: none !important; }

/* Text drawn inside SVG artwork */
.t-name { font-family: var(--font); font-weight: 800; }
.t-logo { font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", "Cooper Black", Georgia, serif; font-weight: 900; }
.t-script { font-family: "Snell Roundhand", "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-weight: 700; }

/* ------------------------------------------------------------------ */
/* overall layout                                                      */
/* ------------------------------------------------------------------ */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  gap: 10px;
  padding: 10px;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  justify-content: center;
}
.app.portrait { flex-direction: column; align-items: center; }

.table-wrap { position: relative; flex: none; }
.table { position: absolute; inset: 0; --u: 0.3px; }

/* ------------------------------------------------------------------ */
/* board                                                               */
/* ------------------------------------------------------------------ */

.board {
  position: absolute;
  left: calc(256 * var(--u));
  top: calc(346 * var(--u));
  width: calc(1800 * var(--u));
  height: calc(1800 * var(--u));
  border-radius: calc(30 * var(--u));
  box-shadow: 0 0 0 calc(9 * var(--u)) #3a3230, 0 calc(26 * var(--u)) calc(50 * var(--u)) rgba(40, 25, 10, 0.35);
  z-index: 2;
}
.board-svg { width: 100%; height: 100%; overflow: visible; }
.L-markers, .L-pawns { pointer-events: none; }

/* squares a detective may move to */
.hl {
  fill: #ffe94a;
  fill-opacity: 0.34;
  stroke: #fff;
  stroke-width: 5;
  cursor: pointer;
  animation: hl-pulse 1.1s ease-in-out infinite;
}
.hl.fresh { fill: #ffd000; fill-opacity: 0.5; stroke: #ff9f0a; stroke-width: 11; animation-name: hl-pulse-strong; }
@keyframes hl-pulse { 50% { fill-opacity: 0.68; } }
@keyframes hl-pulse-strong { 50% { fill-opacity: 0.85; stroke: #fff; } }

/* pawns: the outer group slides between squares, the inner one hops/bobs */
.pawn { transition: transform 0.19s ease-in-out; }
.pawn.fox { transition-duration: 0.26s; }
.pawn.dash { transition-duration: 0.07s; }
.pawn .bob { transform-box: fill-box; transform-origin: 50% 100%; }
.pawn.hat.active .bob { animation: bob 0.9s ease-in-out infinite; }
.pawn .bob.hop { animation: hop 0.26s ease-out; }
@keyframes bob { 50% { transform: translateY(-14px); } }
@keyframes hop { 40% { transform: translateY(-34px) rotate(-4deg); } }

.bm { transform-box: fill-box; transform-origin: 50% 50%; }
.bm.pop { animation: pop-in 0.55s cubic-bezier(0.2, 1.5, 0.4, 1); }

/* ------------------------------------------------------------------ */
/* suspect cards round the board                                       */
/* ------------------------------------------------------------------ */

.card {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(226 * var(--u));
  height: calc(316 * var(--u));
  padding: 0;
  border: 0;
  background: none;
  perspective: calc(1500 * var(--u));
  z-index: 1;
}
.card-inner, .flipcard .card-inner {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.9, 0.3, 1.15);
}
.card.up .card-inner, .flipcard.up .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  display: block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 7.1% / 5.1%;
  overflow: hidden;
  box-shadow: 0 calc(7 * var(--u, 0.4px)) calc(16 * var(--u, 0.4px)) rgba(40, 25, 10, 0.32);
}
.card-front { transform: rotateY(180deg); }
.card-art { width: 100%; height: 100%; }

.card:not(.up):hover .card-inner { transform: translateY(-3%); }
.card.up:hover .card-inner { transform: rotateY(180deg) translateY(-3%); }

/* face-down cards that can be flipped right now */
.card.pick .card-back { animation: glow-eye 1s ease-in-out infinite; }
@keyframes glow-eye {
  0%, 100% { box-shadow: 0 0 0 calc(7 * var(--u)) var(--eye), 0 0 calc(20 * var(--u)) calc(8 * var(--u)) rgba(29, 143, 192, 0.5); }
  50% { box-shadow: 0 0 0 calc(12 * var(--u)) #7fd3f5, 0 0 calc(40 * var(--u)) calc(16 * var(--u)) rgba(29, 143, 192, 0.7); }
}
/* hint: face-up suspects the clues rule out */
.card.hint .card-front { animation: glow-hint 0.7s ease-in-out infinite; }
@keyframes glow-hint {
  0%, 100% { box-shadow: 0 0 0 calc(8 * var(--u)) #ffd43b; }
  50% { box-shadow: 0 0 0 calc(16 * var(--u)) #ff922b, 0 0 calc(40 * var(--u)) calc(14 * var(--u)) rgba(255, 146, 43, 0.6); }
}

/* ruled-out suspects stay in place, greyed out and crossed */
.card.out .card-front .card-art, .inspect-card.out .card-art { filter: grayscale(1) brightness(1.08) contrast(0.8); opacity: 0.6; }
.card.out .card-front { background: #e9e2d6; box-shadow: none; }
.stamp {
  position: absolute;
  inset: 0;
  display: none;
  transform: rotateY(180deg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.card.out .stamp { display: block; animation: stamp 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.stamp svg { width: 100%; height: 100%; }
@keyframes stamp { from { transform: rotateY(180deg) scale(2.2); opacity: 0; } }

/* ------------------------------------------------------------------ */
/* side panel                                                          */
/* ------------------------------------------------------------------ */

.panel {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--pf, 17px);
}
.app.portrait .panel {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "turn brand" "turn tools" "turn book";
  gap: 8px;
}
.app.portrait .brand { grid-area: brand; }
.app.portrait .turn { grid-area: turn; }
.app.portrait .tools { grid-area: tools; }
.app.portrait .notebook { grid-area: book; }

.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.logo { flex: 1 1 auto; min-width: 0; max-width: 240px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 0 var(--lip); }
.logo-svg { width: 100%; height: auto; }
.brand-btns { display: flex; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 2.7em;
  height: 2.7em;
  border-radius: 50%;
  border: 0;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--lip);
  font-weight: 900;
  font-size: 1em;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn svg { width: 55%; height: 55%; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip); }
.icon-btn.off { opacity: 0.55; }

.turn, .tools, .notebook {
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--lip);
  padding: 0.7em 0.8em;
}

/* --- whose turn + the three steps --- */
.turn {
  --pc: #8fd32f;
  --pcd: #5d9612;
  flex: 1 1 auto;
  min-height: 0;
  border-top: 0.6em solid var(--pc);
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  overflow: hidden;
}
.who { display: flex; align-items: center; gap: 0.5em; }
.who-hat { width: 3.3em; flex: none; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.15)); }
.who-hat svg { width: 100%; }
.who-name { font-size: 1.3em; font-weight: 900; line-height: 1.05; }
.who-name small { display: block; font-size: 0.62em; font-weight: 700; opacity: 0.6; }

.steps { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.steps li {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  padding: 0.28em 0.2em;
  border-radius: 999px;
  background: #f1ebe0;
  color: #9a8f86;
  font-weight: 800;
  font-size: 0.78em;
  white-space: nowrap;
}
.steps li b { display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: #fff; }
.steps li.on { background: var(--ink); color: #fff; }
.steps li.on b { color: var(--ink); }
.steps li.done { background: #dff0d5; color: var(--paw-d); }

/* centred when there is room; if the text is too tall it starts at the top rather than spilling upwards */
.turn-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 0.55em; }
.turn-body > :first-child { margin-top: auto; }
.turn-body > :last-child { margin-bottom: auto; }
.say { margin: 0; font-size: 1.12em; font-weight: 800; line-height: 1.25; text-align: center; }
.tip { margin: 0; font-size: 0.9em; font-weight: 600; opacity: 0.72; text-align: center; line-height: 1.25; }
.paw-t { color: var(--paw-d); }
.eye-t { color: var(--eye-d); }
.bad-t { color: var(--red); }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.row > .btn { flex: 1 1 0; }
.row > .btn.slim { flex: 0 0 auto; }

/* --- big friendly buttons --- */
.btn {
  --bg: var(--ink);
  --lipc: #1d1512;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 3.1em;
  padding: 0.45em 0.9em;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
  color: #fff;
  font-weight: 900;
  font-size: 1.05em;
  line-height: 1.1;
  box-shadow: 0 5px 0 var(--lipc);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--lipc); }
.btn:disabled { opacity: 0.4; box-shadow: 0 2px 0 var(--lipc); }
.btn small { display: block; font-size: 0.72em; font-weight: 700; opacity: 0.9; }
.btn-ic { width: 2.1em; height: 2.1em; flex: none; display: grid; place-items: center; background: #fff; border-radius: 50%; padding: 0.22em; }
.btn-ic svg { width: 100%; height: 100%; }
.btn.paw { --bg: var(--paw); --lipc: var(--paw-d); }
.btn.eye { --bg: var(--eye); --lipc: var(--eye-d); }
.btn.roll { --bg: var(--orange); --lipc: var(--orange-d); font-size: 1.2em; }
.btn.next { --bg: var(--pcd, var(--ink)); --lipc: rgba(0, 0, 0, 0.45); }
.btn.out { --bg: var(--red); --lipc: #9a1420; }
.btn.ghost { --bg: #f1ebe0; --lipc: #d8cfc0; color: var(--ink); }
.btn.big { font-size: 1.35em; padding: 0.6em 1.4em; }
.btn.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choices .btn { flex-direction: column; text-align: center; padding: 0.6em 0.3em; gap: 0.35em; }
.choices .btn-ic { width: 3em; height: 3em; }

/* --- dice --- */
.dice { display: flex; justify-content: center; gap: 0.7em; padding: 0.2em 0 0.5em; }
.die {
  width: 4.1em;
  height: 4.1em;
  border-radius: 22%;
  background: #fff;
  box-shadow: inset 0 -0.3em 0 #e3ddd2, inset 0 0 0 2px #e9e3d8, 0 0.25em 0.4em rgba(0, 0, 0, 0.22);
  padding: 0.35em;
  position: relative;
  transition: transform 0.25s;
}
.die svg { width: 100%; height: 100%; }
.die.rolling { animation: tumble 0.32s linear infinite; }
@keyframes tumble {
  0% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-22%) rotate(90deg); }
  50% { transform: translateY(0) rotate(180deg); }
  75% { transform: translateY(-14%) rotate(270deg); }
  100% { transform: translateY(0) rotate(360deg); }
}
/* dice that match the declared action are "set aside": they drop down and get a ring */
.die.kept { transform: translateY(0.45em); }
.die.kept.clues { box-shadow: inset 0 -0.3em 0 #d5ecc8, 0 0 0 0.24em var(--paw), 0 0.25em 0.4em rgba(0, 0, 0, 0.2); }
.die.kept.suspects { box-shadow: inset 0 -0.3em 0 #cfe8f4, 0 0 0 0.24em var(--eye), 0 0.25em 0.4em rgba(0, 0, 0, 0.2); }
.die.kept::after {
  content: "✓";
  position: absolute;
  right: -0.45em;
  top: -0.45em;
  width: 1.45em;
  height: 1.45em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8em;
  font-weight: 900;
  color: #fff;
  background: var(--paw);
}
.die.kept.suspects::after { background: var(--eye); }
.die.pop { animation: die-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes die-pop { 0% { transform: translateY(0) scale(1.25); } 100% { transform: translateY(0.45em) scale(1); } }
.dice.small .die { width: 2.7em; height: 2.7em; }

/* turn timer (online games): the last few seconds as a number in a red circle, beside the detective's name */
.timer {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0.13em #fff, 0 0.12em 0.45em rgba(220, 39, 51, 0.5);
  color: #fff;
  font-weight: 900;
  font-size: 1.1em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.who .timer { margin-left: auto; }
.who .timer[hidden] { display: grid !important; visibility: hidden; }   /* keeps its place, so the name never re-wraps when the number appears */
.who-name { min-width: 0; }
/* each new second gives the number a little bounce (two names so the animation restarts) */
.timer[data-beat="0"] { animation: tick-a 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
.timer[data-beat="1"] { animation: tick-b 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes tick-a { from { transform: scale(1.5); } }
@keyframes tick-b { from { transform: scale(1.5); } }
/* the same number on the decoder pop-up, which covers the turn panel on small screens */
.sheet.decode { position: relative; }
.sheet.decode h2 { padding: 0 1.5em; }   /* keeps the title clear of the number in the corner */
.sheet.decode .timer { position: absolute; top: 0.7em; right: 0.7em; }

.pips { display: flex; align-items: center; justify-content: center; gap: 0.4em; font-size: 0.85em; font-weight: 800; opacity: 0.8; }
.pips i { width: 0.8em; height: 0.8em; border-radius: 50%; background: #e3ddd2; }
.pips i.used { background: var(--orange); }

/* --- decoder, clue pile, fox tracker --- */
.tools { flex: none; display: grid; grid-template-columns: 1fr 0.75fr 1.7fr; gap: 0.3em 0.7em; align-items: end; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 0.2em; min-width: 0; }
.tool-label { font-size: 0.76em; font-weight: 800; opacity: 0.7; text-align: center; }
.dec-mini { width: 100%; max-width: 7.5em; }
.pile { position: relative; width: 4.4em; height: 4.2em; }
.pile div { position: absolute; left: 0; width: 100%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.pile svg { width: 100%; }
.pile.empty { opacity: 0.25; }
.trail { align-items: stretch; }
.trail-bar { position: relative; height: 1.3em; margin: 0.5em 1.2em 0.2em 0.9em; border-radius: 999px; background: #d6d1d5; }
.trail-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #ffb26b, var(--orange)); transition: width 0.5s; }
.trail-fox { position: absolute; top: 50%; width: 2.2em; height: 2.2em; transform: translate(-50%, -55%); transition: left 0.5s; }
.trail-hole { position: absolute; right: -1em; top: 50%; width: 2em; height: 1.2em; transform: translateY(-50%); border-radius: 50%; background: #4a2f1c; box-shadow: 0 0 0 0.22em #8a6a4a; }

/* --- clue notebook --- */
.notebook { flex: none; }
.notebook h3 { margin: 0 0 0.35em; font-size: 0.86em; font-weight: 900; display: flex; align-items: center; justify-content: space-between; gap: 0.5em; }
.legend { font-weight: 700; font-size: 0.86em; opacity: 0.75; display: flex; gap: 0.7em; align-items: center; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 0.3em; }
.legend i { width: 0.9em; height: 0.9em; border-radius: 50%; display: inline-block; }
.legend .g { background: #3aa845; }
.legend .w { background: #fff; box-shadow: inset 0 0 0 2px #e03131; }
.chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3em; }
.chip { position: relative; min-width: 0; }
.chip svg { width: 100%; }
.chip.unknown svg { opacity: 0.5; filter: grayscale(1); }

/* ------------------------------------------------------------------ */
/* toast, modals                                                       */
/* ------------------------------------------------------------------ */

/* short messages pop up over the middle of the board, clear of the cards */
.toast {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: max-content;
  max-width: 62%;
  padding: 0.55em 1.1em;
  border-radius: 1.4em;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: clamp(16px, 2.6vmin, 24px);
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.85);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(40, 28, 20, 0.6);
  animation: fade 0.2s;
}
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }

.sheet {
  width: min(600px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(14px, 3vmin, 28px);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  text-align: center;
  font-size: clamp(16px, 2.3vmin, 20px);
  animation: pop-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
  display: flex;
  flex-direction: column;
  gap: 0.7em;
}
.sheet.wide { width: min(760px, 100%); }
.sheet > * { flex-shrink: 0; }
.sheet h2 { margin: 0; font-size: 1.6em; font-weight: 900; line-height: 1.1; }
.sheet h3 { margin: 0.2em 0 0; font-size: 1em; font-weight: 900; }
.sheet p { margin: 0; font-weight: 700; line-height: 1.3; }
.sheet .lead { font-size: 1.12em; }
.sheet .fine { font-size: 0.82em; opacity: 0.7; }

/* start screen */
.start-logo { margin: calc(-1 * clamp(14px, 3vmin, 28px)); margin-bottom: 0; border-radius: 28px 28px 0 0; overflow: hidden; }
.seg { display: flex; gap: 10px; justify-content: center; }
.seg button {
  flex: 1 1 0;
  max-width: 11em;
  min-height: 3.6em;
  border: 4px solid transparent;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 var(--lip);
  font-weight: 900;
  font-size: 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  padding: 0.4em;
}
.seg button.on { border-color: var(--orange); background: #fff1e3; }
.seg b { font-size: 1.5em; line-height: 1; }
.seg small { font-size: 0.74em; font-weight: 700; opacity: 0.75; }
.seg .hats { display: flex; gap: 2px; justify-content: center; }
.seg .hats svg { width: 1.7em; }

/* decoder pop-up */
.dec-big { width: min(100%, 520px); margin: 0 auto; }
.decoder-svg { width: 100%; height: auto; overflow: visible; }
.decoder-svg .slide { transform: translateX(var(--slide, 0px)); transition: transform 0.7s cubic-bezier(0.3, 0.9, 0.3, 1); }
.decoder-svg.open .slide { transform: translateX(var(--slide, var(--open))); }
.decoder-svg.dragging .slide { transition: none; }
.decoder-svg .handle { cursor: grab; touch-action: none; }
.dec-big .dec-marker { animation: drop-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) backwards; }
@keyframes drop-in { from { translate: 0 -120px; opacity: 0; } }
.dec-msg { min-height: 2.7em; font-size: 1.15em; display: grid; place-items: center; }
.res { display: inline-block; padding: 0.1em 0.6em; border-radius: 999px; font-weight: 900; font-size: 1.25em; margin-bottom: 0.15em; }
.res.green { background: #3aa845; color: #fff; }
.res.white { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 3px var(--ink); }

/* suspect close-up */
.inspect { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 1em; align-items: center; text-align: left; }
.inspect-card { position: relative; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }
.inspect-card .stamp { transform: none; }
.inspect-card.out .stamp { display: block; }
.wear { list-style: none; margin: 0.4em 0 0; padding: 0; display: grid; gap: 0.4em; }
.wear li { display: grid; grid-template-columns: 2.9em 1fr; grid-template-areas: "ic name" "ic res"; align-items: center; column-gap: 0.6em; padding: 0.35em 0.6em; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px #eee6d8; }
.wear .li-ic { grid-area: ic; }
.wear .li-ic svg { width: 100%; }
.wear .li-name { grid-area: name; font-weight: 900; }
.wear .li-res { grid-area: res; font-size: 0.8em; font-weight: 700; opacity: 0.75; }
.wear li.clash { background: #ffe3e3; box-shadow: inset 0 0 0 3px var(--red); }
.wear li.clash .li-res { color: #b02a37; opacity: 1; }
.wear li.match { background: #e3f6dc; box-shadow: inset 0 0 0 3px #3aa845; }
.wear li.match .li-res { color: var(--paw-d); opacity: 1; }
.wear li.missing .li-ic { opacity: 0.45; filter: grayscale(1); }
.inspect-msg { min-height: 1.4em; }

/* accusation and endings */
.lineup { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 52vh; overflow: auto; padding: 6px; }
.lineup button { padding: 0; border: 0; background: none; border-radius: 12px; overflow: hidden; box-shadow: 0 5px 0 var(--lip); transition: transform 0.1s; }
.lineup button:hover { transform: translateY(-4px) scale(1.03); }
.reveal { display: flex; justify-content: center; align-items: center; gap: clamp(10px, 4vmin, 34px); }
.flipcard, .reveal-sus { position: relative; width: min(34vmin, 190px); aspect-ratio: 226 / 316; perspective: 900px; }
.reveal-sus { border-radius: 14px; overflow: hidden; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); transition: opacity 0.5s, transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.reveal-sus.hid { opacity: 0; transform: scale(0.6); }
.reveal-msg { min-height: 2.8em; font-size: 1.15em; }
.win-t { color: var(--paw-d); }
.lose-t { color: var(--red); }

.help-list { text-align: left; display: grid; gap: 0.6em; margin: 0; padding: 0; list-style: none; }
.help-list li { display: grid; grid-template-columns: 2.6em 1fr; gap: 0.7em; align-items: center; font-weight: 700; line-height: 1.3; }
.help-list .btn-ic { width: 2.6em; height: 2.6em; box-shadow: inset 0 0 0 2px #eee6d8; }
.help-list b { font-weight: 900; color: #b8470a; }

.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -24px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ------------------------------------------------------------------ */
/* online play: room button, start screen, lobby                       */
/* ------------------------------------------------------------------ */

/* text boxes can be selected and typed in, unlike the rest of the page */
input { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }

.who-tag { display: block; font-size: 0.56em; font-weight: 800; opacity: 0.65; }
.who-tag.you { opacity: 1; color: var(--pcd); }
.wait { font-style: italic; }
.L-hl.watch .hl { cursor: default; }

.icon-btn.room-pill { width: auto; padding: 0 0.75em; border-radius: 999px; display: flex; gap: 0.35em; color: var(--eye-d); }
.icon-btn.room-pill svg { width: 1.35em; height: 1.35em; }

.start-logo { background: #2c8a38; }
.start-logo svg { width: 100%; height: auto; max-height: 24vh; }
.seg.where button { max-width: none; }
.start-here, .start-online { display: flex; flex-direction: column; gap: 0.7em; }
.join-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: stretch; }
.join-row .btn-ic { width: 1.7em; height: 1.7em; }
.join-row .btn { flex: none; }
.code-input {
  width: 8.5em;
  text-align: center;
  font-size: 1.3em;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 3px solid #d8cfc0;
  border-radius: 14px;
  padding: 0.3em 0.2em;
  background: #fff;
}
.code-input:focus, .link-input:focus { border-color: var(--eye); outline: none; }
.start-msg { min-height: 1.3em; color: #b02a37; }

.link-row { display: flex; gap: 8px; align-items: stretch; }
.link-row .btn { flex: none; }
.link-input { flex: 1 1 auto; min-width: 0; border: 3px solid #d8cfc0; border-radius: 14px; padding: 0.5em 0.7em; background: #fff; font-size: 0.85em; font-weight: 700; }
.warn { background: #fff3cd; border-radius: 12px; padding: 0.6em 0.8em; font-size: 0.9em; }

.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.seats li {
  display: grid;
  grid-template-columns: 2.8em 1fr auto;
  align-items: center;
  gap: 0.7em;
  padding: 0.3em 0.8em;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #eee6d8;
  text-align: left;
  font-weight: 800;
}
.seats li.you { box-shadow: inset 0 0 0 3px var(--orange); }
.seats li.screen .seat-hat { width: 2em; justify-self: center; }
.sheet p.tv-code { font-size: 2.4em; font-weight: 900; letter-spacing: 0.22em; line-height: 1.1; padding-left: 0.22em; }
.start-here .btn.ghost .btn-ic { width: 1.7em; height: 1.7em; }
.seats li.empty { opacity: 0.55; }
.seats li.empty .seat-hat { filter: grayscale(1); }
.seats li.away .seat-status { color: #b02a37; opacity: 1; }
.seat-hat svg { width: 100%; }
.seat-status { font-size: 0.85em; font-weight: 700; opacity: 0.7; }

@media (max-height: 780px) { .sheet.start .story, .sheet.start .fine { display: none; } }

/* ------------------------------------------------------------------ */
/* small screens / short panels                                        */
/* ------------------------------------------------------------------ */

.app.portrait .who-name small, .app.tight .who-name small { display: none; }
.app.tight .steps li { font-size: 0.7em; }
.app.tight .choices .btn-ic { width: 2.2em; height: 2.2em; }
.app.tight .die { width: 3.3em; height: 3.3em; }
.app.tight .legend { display: none; }

/* A TV screen (watch-only, online rooms): the side panel may grow, since it is read from across the room. */
.app.tv .panel { max-width: 900px; }
.app.tv.landscape .logo, .app.tv.landscape .panel.snug .logo { max-width: 300px; }
/* ...and so are the pop-ups, the decoder above all */
body.tv .sheet { width: min(900px, 100%); font-size: clamp(16px, 3.1vmin, 36px); }
body.tv .sheet.wide { width: min(1150px, 100%); }
body.tv .dec-big { width: min(100%, 800px); }

/* The side panel packed more tightly, a step at a time, for when the turn panel would not fit (fitPanel in js/ui.js). */
.app.landscape .panel.snug .logo { max-width: 170px; }
.app.landscape .panel.snug .dec-mini { max-width: 5.2em; }
.app.landscape .panel.snug .pile { width: 3.3em; height: 3.2em; }
.app.landscape .panel.compact .chips { grid-template-columns: repeat(12, 1fr); }
.panel.compact .turn { padding: 0.5em 0.7em; gap: 0.42em; border-top-width: 0.45em; }
.panel.compact .turn-body { gap: 0.42em; }
.panel.compact .who-hat { width: 2.7em; }
.app.landscape .panel.bare { gap: 6px; }
.app.landscape .panel.bare .notebook h3 { display: none; }
.app.landscape .panel.bare .logo { max-width: 110px; }
.app.landscape .panel.bare .dec-mini { max-width: 3.9em; }
.app.landscape .panel.bare .pile { width: 2.6em; height: 2.5em; }
/* Last resort on the very smallest screens: the side panel scrolls rather than cutting anything off. */
.panel.scrolls { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }
.panel.scrolls .turn { flex: none; min-height: auto; overflow: visible; }
.app.landscape .panel.scrolls .brand { order: 1; }   /* the clues stay in view; the logo and buttons go to the end */
.app.portrait .panel.scrolls { grid-template-rows: auto auto auto; align-content: start; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
