/* AlibiGrid: a 1970s daytime game-show set, rebuilt for the phone. */

:root {
  --page: #E8AE3C;          /* harvest gold */
  --page-ray: rgba(255, 236, 170, 0.22);
  --set: #3A2417;           /* walnut set frame */
  --set-shadow: rgba(58, 36, 23, 0.3);
  --ink: #2B1A10;
  --ink-soft: #6A4A34;
  --booth: #FFF3D6;         /* lit booth */
  --booth-ink: #2B1A10;     /* text on booths and the spotlight card, both themes */
  --booth-ink-soft: #6A4A34;
  --booth-line: #E6CFA0;
  --x-ink: #CF3E28;         /* X and O glyphs on cream surfaces */
  --o-ink: #1D6F9C;
  --booth-done: #F3E2BC;
  --paper: #FFFCF3;         /* receipt paper */
  --x: #CF3E28;             /* tomato */
  --o: #1D6F9C;             /* pool blue */
  --bulb-off: rgba(58, 36, 23, 0.16);
  --bulb-on: #FFD24A;
  --gold: #F4C430;
  --panel: #FFF3D6;
  --panel-line: #E6CFA0;
  --btn: #3A2417;
  --btn-ink: #FFF3D6;
  --btn-shadow: #1E120A;
  --chip: rgba(58, 36, 23, 0.1);
  --scrim: rgba(43, 26, 16, 0.38);

  --font-display: "Caprasimo", "Cooper Black", "Cooper Std", Georgia, serif;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --ease-spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #23170E;
    --page-ray: rgba(232, 174, 60, 0.05);
    --set: #0F0905;
    --set-shadow: rgba(0, 0, 0, 0.45);
    --ink: #F7E8C9;
    --ink-soft: #CDB28C;
    --booth: #F6E7C6;
    --booth-done: #E2CFA6;
    --paper: #FBF4E2;
    --x: #F0573C;
    --o: #4AA6DA;
    --bulb-off: rgba(58, 36, 23, 0.2);
    --panel: #34241A;
    --panel-line: #523A28;
    --btn: #E8AE3C;
    --btn-ink: #23170E;
    --btn-shadow: #8A5E14;
    --chip: rgba(247, 232, 201, 0.1);
    --scrim: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #23170E;
  --page-ray: rgba(232, 174, 60, 0.05);
  --set: #0F0905;
  --set-shadow: rgba(0, 0, 0, 0.45);
  --ink: #F7E8C9;
  --ink-soft: #CDB28C;
  --booth: #F6E7C6;
  --booth-done: #E2CFA6;
  --paper: #FBF4E2;
  --x: #F0573C;
  --o: #4AA6DA;
  --bulb-off: rgba(58, 36, 23, 0.2);
  --panel: #34241A;
  --panel-line: #523A28;
  --btn: #E8AE3C;
  --btn-ink: #23170E;
  --btn-shadow: #8A5E14;
  --chip: rgba(247, 232, 201, 0.1);
  --scrim: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

/* Keep content clear of phone system bars (matches the artifact host's reset). */
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  margin: 0;
  background-color: var(--page);
  background-image: repeating-conic-gradient(from 0deg at 50% 46%, var(--page-ray) 0deg 6deg, transparent 6deg 15deg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px 6px;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 27px;
  line-height: 1;
  letter-spacing: 0.01em;
}

.logo-mark {
  display: grid;
  grid-template-columns: repeat(3, 6px);
  gap: 2px;
  padding: 3px;
  background: var(--set);
  border-radius: 5px;
}
.logo-mark i { width: 6px; height: 6px; border-radius: 1.5px; background: var(--booth); }
.logo-mark i:nth-child(1), .logo-mark i:nth-child(5), .logo-mark i:nth-child(9) { background: var(--x); }

.edition {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 500;
}
.edition strong { font-weight: 800; }
.edition-date::before { content: ", "; }

.tools { display: flex; gap: 2px; }

.tool {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.tool:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.tool svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#btn-sound .snd-off { display: none; }
#btn-sound[aria-pressed="false"] .snd-on { display: none; }
#btn-sound[aria-pressed="false"] .snd-off { display: block; }

/* ---------- Stage ---------- */

.stage {
  min-height: 0;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.play {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-block: 0 6px;
}

.board-fit {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}

.board {
  --gap: clamp(5px, 1.7cqi, 11px);
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 0.86;
  display: grid;
  grid-template-columns: 19% minmax(0, 1fr);
  grid-template-rows: 12.5% minmax(0, 1fr);
  container-type: inline-size;
}

/* Fit the board to the space it has. On tall phones the booths grow taller. */
@supports (width: 1cqh) {
  .board {
    --w: min(100cqw, calc(100cqh * 0.86), 600px);
    width: var(--w);
    height: min(100cqh, calc(var(--w) * 1.32));
    aspect-ratio: auto;
  }
}

.corner { grid-area: 1 / 1; }

.col-heads {
  grid-area: 1 / 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: 0 var(--gap) 6px;
  align-items: end;
}

.row-heads {
  grid-area: 2 / 1;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: var(--gap) 6px var(--gap) 0;
}

.head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: center;
  font-size: clamp(12.5px, 3.7cqi, 16px);
  font-weight: 800;
  line-height: 1.08;
  cursor: help;
}
.col-heads .head { justify-content: flex-end; }
.head:focus-visible { outline: 3px solid var(--ink); }
.head-ico { font-size: 1.2em; line-height: 1; }
.head-lbl { overflow-wrap: normal; }

/* The set: a walnut slab with nine lit booths */
.set {
  grid-area: 2 / 2;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: var(--gap);
  background: var(--set);
  border-radius: clamp(12px, 3.2cqi, 20px);
  box-shadow: 0 clamp(5px, 1.4cqi, 9px) 0 var(--set-shadow);
}

.booth {
  --c: #7A5C3E;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 2.2cqi, 13px);
  padding: clamp(12px, 3.6cqi, 19px) 6% 9%;
  border: 0;
  border-radius: clamp(7px, 1.9cqi, 12px);
  background: var(--booth);
  color: #2B1A10;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s var(--ease-out), background-color 0.3s;
}
.booth:active { transform: scale(0.97); }
.booth:focus-visible { outline: 3px solid var(--bulb-on); outline-offset: 2px; }

/* Ring of bulbs around each booth */
.bulbs {
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  padding: clamp(4px, 1.15cqi, 6px);
  background: radial-gradient(circle, var(--bulb) 0 1.4px, transparent 2px) 0 0 / clamp(8px, 2.2cqi, 11px) clamp(8px, 2.2cqi, 11px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  --bulb: var(--bulb-off);
  pointer-events: none;
  transition: filter 0.25s;
}
.booth.is-selected .bulbs,
.booth.boss .bulbs,
.booth.in-line .bulbs {
  --bulb: var(--bulb-on);
  filter: drop-shadow(0 0 3px rgba(255, 196, 40, 0.9));
}
.booth.boss .bulbs { --bulb: #E9A825; filter: none; }
.booth.boss.is-selected .bulbs { --bulb: var(--bulb-on); filter: drop-shadow(0 0 3px rgba(255, 196, 40, 0.9)); }
.booth.is-selected { transform: translateY(-2px); }
.booth.in-line .bulbs { animation: chase 0.9s steps(2) infinite; }

/* Before the first call, a wave of light runs across the open booths */
.bulbs::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, var(--bulb-on) 0 1.4px, transparent 2px) 0 0 / clamp(8px, 2.2cqi, 11px) clamp(8px, 2.2cqi, 11px);
  opacity: 0;
}
.set.is-inviting .booth .bulbs::after {
  animation: invite 3.4s ease-in-out infinite;
  animation-delay: calc(var(--k) * 0.2s);
}
@keyframes invite { 0%, 34%, 100% { opacity: 0; } 14% { opacity: 1; } }
@keyframes chase { 50% { background-position: 4px 4px; } }

/* Headshot: fills most of the booth, and gives up room before the name does */
.photo-wrap {
  position: relative;
  flex: 0 1 clamp(40px, 18.5cqi, 112px);
  min-height: 0;
  aspect-ratio: 1;
  max-width: 100%;
}
.photo {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: clamp(6px, 1.7cqi, 11px);
  overflow: hidden;
  background: var(--c);
  color: #FFF3D6;
  font-family: var(--font-display);
  font-size: clamp(12px, 3.6cqi, 21px);
  line-height: 1;
  box-shadow: 0 0 0 2px var(--booth-ink);
}
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pin-slot {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  transform: translate(-50%, 50%);
}

.name {
  flex-shrink: 0;
  /* Room for two lines at the regular name size in every booth, so all photos match */
  min-height: calc(2.08 * clamp(11.5px, 3.45cqi, 19px));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(11.5px, 3.45cqi, 19px);
  line-height: 1.04;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.name.is-long { font-size: clamp(10px, 2.9cqi, 16.5px); }
.name.is-xlong { font-size: clamp(9px, 2.55cqi, 15px); }

/* Slots only hold absolutely placed pieces, so they shouldn't take up a gap in the booth */
.tag-slot, .status-slot { display: contents; }

.booth-tag {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px 2px;
  border-radius: 0 0 8px 8px;
  background: var(--gold);
  color: #2B1A10;
  font-family: var(--font-display);
  font-size: clamp(9px, 2.3cqi, 12px);
  line-height: 1.25;
  white-space: nowrap;
}

.badge {
  display: block;
  padding: 1px 7px 2px;
  border-radius: 99px;
  font-size: clamp(8.5px, 2.2cqi, 11.5px);
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  color: #FFF3D6;
}
.badge.win { background: var(--x); }
.badge.danger { background: var(--o); }

/* X and O marks drawn over the star */
.booth.mark-x { background: var(--x-ink); }
.booth.mark-o { background: var(--o-ink); }
.booth.is-marked .photo { opacity: 0.2; filter: grayscale(1); box-shadow: none; }
.booth.is-marked .name { color: #FFF3D6; opacity: 0.75; }
.booth.is-marked .bulbs { --bulb: rgba(255, 243, 214, 0.3); }
.mark {
  position: absolute;
  inset: 0;
  width: 86%;
  height: 86%;
  margin: auto;
  pointer-events: none;
  fill: none;
  stroke: #FFF3D6;
  stroke-linecap: round;
  stroke-width: 13;
  overflow: visible;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.22));
}
.mark path, .mark circle { stroke-dasharray: 100; stroke-dashoffset: 0; }
.booth.fresh .mark path:nth-child(1) { animation: draw 0.28s var(--ease-out) both; }
.booth.fresh .mark path:nth-child(2) { animation: draw 0.28s 0.2s var(--ease-out) both; }
.booth.fresh .mark circle { animation: draw 0.5s var(--ease-out) both; }
.booth.fresh { animation: thump 0.5s var(--ease-spring); }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes thump { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* Line through three in a row */
.strike {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.strike .strike-edge { stroke: #2B1A10; stroke-width: 14; opacity: 0.55; }
.strike .strike-gold { stroke: var(--gold); stroke-width: 8; }
.strike line {
  stroke-linecap: round;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: strike 0.55s 0.15s var(--ease-out) forwards;
}
@keyframes strike { to { stroke-dashoffset: 0; } }

/* Clinch announcement */
.clinch {
  position: absolute;
  left: 59.5%;
  top: 56%;
  z-index: 5;
  width: max-content;
  max-width: 84%;
  padding: 14px 22px 16px;
  border: 4px solid #2B1A10;
  border-radius: 18px;
  background: var(--gold);
  color: #2B1A10;
  text-align: center;
  box-shadow: 0 8px 0 rgba(43, 26, 16, 0.35);
  transform: translate(-50%, -50%) rotate(-3deg);
  animation: pop 0.55s var(--ease-spring) both;
  cursor: pointer;
}
.clinch.is-lost { background: #BFE1F2; }
.clinch h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 9cqi, 48px);
  line-height: 1;
}
.clinch p { margin: 6px 0 0; font-weight: 700; font-size: clamp(13px, 3.4cqi, 16px); line-height: 1.3; }
@keyframes pop {
  from { transform: translate(-50%, -50%) rotate(-12deg) scale(0.4); opacity: 0; }
  to { transform: translate(-50%, -50%) rotate(-3deg) scale(1); opacity: 1; }
}

/* ---------- Tote board under the grid ---------- */

.tote {
  width: 100%;
  max-width: 600px;
  margin: 8px auto 0;
}
.tally {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px 4px 9px;
  border-radius: 99px;
  background: var(--chip);
  white-space: nowrap;
}
.chip strong { font-variant-numeric: tabular-nums; font-weight: 800; }
/* Drawn X / O that sit inline with text */
.mi { width: 0.95em; height: 0.95em; flex: none; fill: none; stroke-width: 15; stroke-linecap: round; vertical-align: -0.12em; }
.mi-x { stroke: var(--x); }
.mi-o { stroke: var(--o); }
.calls-left { margin-left: auto; font-weight: 600; white-space: nowrap; }
.msg {
  margin: 6px 0 0;
  min-height: 1.4em;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.msg button {
  margin-left: 6px;
  padding: 3px 12px;
  border: 0;
  border-radius: 99px;
  background: var(--btn);
  color: var(--btn-ink);
  font-weight: 800;
  cursor: pointer;
}

/* ---------- The desk: how-to panel on desktop, results sheet on phones ---------- */

.desk {
  background: var(--panel);
  color: var(--ink);
}
.desk-body > * + * { margin-top: 14px; }

.grabber { display: none; }

.desk h2, .modal h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
  text-wrap: balance;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border: 1.5px solid var(--panel-line);
  border-bottom-width: 3px;
  border-radius: 5px;
  font: 700 12px/1.5 var(--font-ui);
  text-align: center;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  flex: 1 1 auto;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: 0 5px 0 var(--btn-shadow);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--btn-shadow); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn.ghost { background: var(--chip); color: var(--ink); box-shadow: none; }
.btn.gold { background: var(--gold); color: var(--booth-ink); box-shadow: 0 5px 0 #A9811A; }

/* Keep "Share result" in reach while the receipt scrolls */
.share-row {
  position: sticky;
  z-index: 2;
  bottom: calc(-1 * var(--desk-pad-b));
  padding: 12px 0 var(--desk-pad-b);
  background: var(--panel);
}
.share-row .btn { min-height: 56px; font-size: 17px; }
.share-label { display: block; font-size: 13.5px; font-weight: 700; }
.share-text {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 2px solid var(--panel-line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--booth-ink);
  font: 500 14px/1.45 var(--font-ui);
  resize: none;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- The spotlight card: a booth that turns over and grows ---------- */

.head.is-lit { background: var(--gold); color: var(--booth-ink); }

.spot {
  position: absolute;
  z-index: 4;
  perspective: 1400px;
}
.spot-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
}
.spot-face {
  position: absolute;
  inset: 0;
  border-radius: clamp(8px, 2.2cqi, 14px);
  background: var(--booth);
  color: var(--booth-ink);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.spot-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.spot-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 0 0 clamp(3px, 0.9cqi, 5px) var(--gold), 0 14px 30px rgba(20, 10, 4, 0.45);
}
.spot-back .bulbs { --bulb: var(--bulb-on); filter: drop-shadow(0 0 3px rgba(255, 196, 40, 0.9)); }

.spot-body {
  position: relative;
  margin-block: auto;
  display: grid;
  gap: clamp(5px, 1.6cqi, 11px);
  padding: clamp(11px, 3.3cqi, 22px) clamp(12px, 3.6cqi, 22px);
}
.spot-body p { margin: 0; }
.spot-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 2.4cqi, 14px);
}
.spot-top .photo { width: clamp(46px, 14cqi, 80px); height: auto; aspect-ratio: 1; font-size: clamp(13px, 3.8cqi, 20px); }
.spot-front .photo { width: clamp(40px, 18.5cqi, 112px); height: auto; aspect-ratio: 1; }
.spot-id { min-width: 0; }
.spot-id h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(18px, 5.4cqi, 28px);
  line-height: 1.05;
  text-wrap: balance;
}
.spot-id h2:focus { outline: none; }
.spot-claim { margin-top: 3px !important; font-size: clamp(11.5px, 3.2cqi, 14px); font-weight: 800; color: var(--booth-ink-soft); }
.spot-claim span { white-space: nowrap; }
.spot-x {
  align-self: start;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(58, 36, 23, 0.1);
  color: var(--booth-ink);
  cursor: pointer;
}
.spot-x:focus-visible { outline: 3px solid var(--booth-ink); }
.spot-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.spot-boss {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--gold);
  font-size: clamp(12px, 3.3cqi, 14.5px);
  line-height: 1.3;
}
.spot-zinger {
  font-style: italic;
  font-size: clamp(12.5px, 3.5cqi, 15.5px);
  line-height: 1.35;
  color: var(--booth-ink-soft);
}
.spot-alibi {
  font-size: clamp(14.5px, 4.3cqi, 20px);
  font-weight: 700;
  line-height: 1.32;
  text-wrap: pretty;
}
.spot-calls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.4cqi, 12px);
  padding-top: 2px;
}
.call-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: clamp(46px, 12.5cqi, 62px);
  border: 0;
  border-radius: 14px;
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: 0 5px 0 var(--btn-shadow);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.call-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-shadow); }
.call-btn:focus-visible { outline: 3px solid var(--booth-ink); outline-offset: 3px; }
.call-btn .big { font-family: var(--font-display); font-size: clamp(19px, 5.6cqi, 26px); line-height: 1; }
.call-btn .small { margin-top: 2px; font-size: clamp(11px, 3cqi, 12.5px); font-weight: 600; opacity: 0.85; }

/* Verdict: a banner that says right or wrong before anything else */
.verdict-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4cqi, 12px);
  padding: clamp(11px, 3.2cqi, 17px) clamp(14px, 4cqi, 22px);
}
.verdict-banner.is-right { background: var(--gold); color: var(--booth-ink); }
.verdict-banner.is-wrong { background: var(--booth-ink); color: #FFF3D6; }
.verdict-banner svg {
  flex: none;
  width: clamp(22px, 6.5cqi, 32px);
  height: clamp(22px, 6.5cqi, 32px);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vb-word {
  flex: 1;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 8cqi, 38px);
  line-height: 1;
  animation: vb-pop 0.35s 0.12s var(--ease-spring) both;
}
.vb-word:focus { outline: none; }
.vb-points { font-family: var(--font-display); font-size: clamp(18px, 5.4cqi, 26px); line-height: 1; }
@keyframes vb-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.spot-answer { font-size: clamp(13px, 3.7cqi, 15.5px); font-weight: 600; line-height: 1.35; color: var(--booth-ink-soft); }
.spot-answer b { font-weight: 800; color: var(--booth-ink); }
.spot-answer .owner { white-space: nowrap; }
.spot-answer .mi-x { stroke: var(--x-ink); }
.spot-answer .mi-o { stroke: var(--o-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.spot-fact { font-size: clamp(13.5px, 3.9cqi, 17px); line-height: 1.42; }
.spot-crowd { font-size: clamp(12px, 3.3cqi, 14px); font-weight: 700; line-height: 1.25; }
.crowd-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.crowd-bar {
  height: 8px;
  margin-top: 5px;
  border-radius: 99px;
  background: var(--booth-line);
  overflow: hidden;
}
.crowd-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--booth-ink);
  transform-origin: left;
  animation: grow 0.7s 0.3s var(--ease-out) both;
}
@keyframes grow { from { transform: scaleX(0); } }
.spot-secret {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--gold);
  font-size: clamp(12.5px, 3.4cqi, 14.5px);
  font-weight: 600;
  line-height: 1.35;
}
.spot-secret.is-missed { background: rgba(58, 36, 23, 0.1); }
.spot-body .btn { min-height: clamp(44px, 12cqi, 54px); }

/* Idle desk (desktop only) */
.idle h2 { font-size: 30px; }
.idle ol { margin: 14px 0 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.idle li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 15px; line-height: 1.4; }
.idle li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-ink);
  font-family: var(--font-display);
  font-size: 14px;
}
.idle .nudge { margin: 18px 0 0; font-weight: 700; }
.idle .fine { margin-top: 14px; line-height: 1.7; }

/* ---------- Results receipt ---------- */

.receipt {
  position: relative;
  margin: 10px 2px 12px;
  padding: 22px 18px 20px;
  background: var(--paper);
  color: #2B1A10;
  font-size: 14.5px;
  box-shadow: 0 3px 0 rgba(43, 26, 16, 0.12);
}
.receipt::before, .receipt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: radial-gradient(circle at 8px 0, transparent 6px, var(--paper) 6.5px) 0 0 / 16px 10px repeat-x;
}
.receipt::before { top: -10px; transform: scaleY(-1); }
.receipt::after { bottom: -10px; }
.r-head { text-align: center; }
.r-logo { font-family: var(--font-display); font-size: 26px; line-height: 1; }
.r-sub { margin: 4px 0 0; font-weight: 600; }
.r-date { margin: 0; font-size: 13px; color: #6A4A34; }
.r-result {
  margin: 14px 0 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.05;
}
.r-result small { display: block; margin-top: 4px; font-family: var(--font-ui); font-size: 13.5px; font-weight: 600; color: #6A4A34; }
.r-rule { border: 0; border-top: 2px dashed #D9C39A; margin: 14px 0; }
.mini {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 4px;
  justify-content: center;
  margin: 14px 0 0;
  padding: 5px;
  background: #3A2417;
  border-radius: 9px;
  width: max-content;
  margin-inline: auto;
}
.mini span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: #FFF3D6;
  font-weight: 900;
  font-size: 19px;
}
.mini .mx { background: var(--x-ink); }
.mini .mo { background: var(--o-ink); }
.mini .mi { width: 22px; height: 22px; stroke: #FFF3D6; stroke-width: 14; }
.mini .win { box-shadow: inset 0 0 0 3px #F4C430; }
.r-line { display: flex; align-items: baseline; gap: 6px; margin: 5px 0; font-variant-numeric: tabular-nums; }
.r-line .dots { flex: 1; border-bottom: 2px dotted #CDB48A; transform: translateY(-4px); }
.r-line b { font-weight: 800; }
.r-total { font-size: 17px; }
.r-total b { font-family: var(--font-display); font-weight: 400; font-size: 22px; }
.r-note { margin: 6px 0 0; line-height: 1.4; }
.r-note b { font-weight: 800; }
.r-foot { margin: 14px 0 0; text-align: center; font-size: 13px; color: #6A4A34; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: #2B1A10; }

/* ---------- Scrim, modal, toast ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--scrim);
  animation: fade 0.25s both;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(440px, calc(100% - 28px));
  max-height: min(86dvh, 720px);
  padding: 22px 20px 20px;
  border: 0;
  border-radius: 22px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 10px 0 rgba(43, 26, 16, 0.25);
  overflow: auto;
}
.modal::backdrop { background: var(--scrim); }
.modal[open] { animation: rise 0.3s var(--ease-out); }
.modal-close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.modal-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--chip);
  cursor: pointer;
}
.modal-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.modal h2 { padding-right: 44px; }
.modal-body p { margin: 0; }

.rules { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.rules li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; font-size: 15px; line-height: 1.45; }
.rules .r-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--chip);
  font-weight: 900;
  font-size: 17px;
}
.rules .r-ico.x { color: var(--x); }
.rules .r-ico.o { color: var(--o); }
.fine { margin: 16px 0 0; font-size: 13px; color: var(--ink-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 0; text-align: center; }
.stat-grid div { padding: 10px 4px; border-radius: 12px; background: var(--chip); }
.stat-grid b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.1; }
.stat-grid span { font-size: 12px; font-weight: 600; line-height: 1.2; display: block; }
.dist { margin: 18px 0 0; }
.dist h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.dist-row { display: grid; grid-template-columns: 58px 1fr; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; font-weight: 700; }
.dist-bar { height: 22px; min-width: 24px; border-radius: 6px; background: var(--ink-soft); color: var(--panel); display: flex; align-items: center; justify-content: flex-end; padding: 0 7px; font-size: 12px; }
.dist-bar.is-today { background: var(--x); color: #FFF3D6; }
.dist-bar.is-today-lost { background: var(--o); color: #FFF3D6; }

.modal h3 { margin: 18px 0 8px; font-size: 15px; font-weight: 800; }
.credits-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.credits-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; line-height: 1.35; }
.credits-list .photo { width: 44px; height: 44px; border-radius: 8px; box-shadow: none; font-size: 14px; }
.credits-list b { display: block; font-size: 14px; }
.credits-list a { color: inherit; text-underline-offset: 2px; overflow-wrap: anywhere; }

.archive-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.archive-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--chip);
  color: inherit;
  text-decoration: none;
}
.archive-list a:hover { outline: 2px solid var(--ink-soft); }
.archive-list a[aria-current="page"] { outline: 2.5px solid var(--ink); }
.archive-list .a-no { font-family: var(--font-display); font-size: 20px; min-width: 34px; }
.archive-list .a-main { flex: 1; line-height: 1.25; }
.archive-list .a-main b { display: block; font-weight: 800; }
.archive-list .a-main span { font-size: 13px; color: var(--ink-soft); }
.archive-list .a-status { font-size: 12.5px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--panel); white-space: nowrap; }
.a-status.won { background: var(--x); color: #FFF3D6; }
.a-status.lost { background: var(--o); color: #FFF3D6; }

.toast {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  z-index: 60;
  max-width: min(92vw, 420px);
  padding: 10px 16px;
  border-radius: 14px;
  background: #2B1A10;
  color: #FFF3D6;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  animation: drop 0.25s var(--ease-out);
}
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- Ad slot (reserved so the layout never jumps) ---------- */

.house-promo {
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.house-promo b { font-weight: 800; letter-spacing: 0.02em; }
.house-promo:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ad-slot {
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* Hover effects only where a mouse exists */
@media (hover: hover) {
  .booth:hover { transform: translateY(-2px); }
  .head:hover, .tool:hover { background: var(--chip); }
  .call-btn:hover, .btn:hover { filter: brightness(1.1); }
}

a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---------- Mobile: the desk becomes a bottom sheet ---------- */

@media (max-width: 899px) {
  .desk {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-height: 84dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    --desk-pad-b: calc(22px + env(safe-area-inset-bottom, 0px));
    padding-top: 8px;
    padding-bottom: var(--desk-pad-b);
    padding-left: max(18px, env(safe-area-inset-left, 0px));
    padding-right: max(18px, env(safe-area-inset-right, 0px));
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -6px 0 rgba(43, 26, 16, 0.18);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.34s var(--ease-out), visibility 0s 0.34s;
  }
  .desk.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.34s var(--ease-out), visibility 0s;
  }
  .grabber {
    display: block;
    width: 44px;
    height: 5px;
    margin: 0 auto 12px;
    border-radius: 99px;
    background: var(--panel-line);
  }
  .desk .idle { display: none; }
  .btn-close-sheet { display: block; }
}

@media (max-width: 380px) {
  .logo { font-size: 23px; }
  .tool { width: 36px; }
  .edition { font-size: 12px; }
  .tally { font-size: 13px; }
  .chip { padding: 3px 9px 3px 7px; }
}

/* ---------- Desktop: board and desk side by side ---------- */

@media (min-width: 900px) {
  .top { padding-block: 16px 8px; }
  .logo { font-size: 32px; }
  .stage {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
    padding-block: 0 14px;
  }
  .play { padding-block: 6px 0; }
  .desk {
    align-self: center;
    max-height: 100%;
    overflow-y: auto;
    --desk-pad-b: 26px;
    padding: 24px 24px var(--desk-pad-b);
    border-radius: 22px;
    box-shadow: 0 8px 0 var(--set-shadow);
  }
  .scrim { display: none; }
  .btn-close-sheet { display: none; }
  .ad-slot { height: 100px; }
  }

@media (min-width: 900px) and (max-height: 760px) {
  .ad-slot { height: 64px; }
  }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .booth.in-line .bulbs { animation: none; }
}
