/* Fredoka 700 (SIL Open Font License, fonts/OFL.txt), self-hosted and subset to
   Latin: the title's layout is measured from this exact font (content/glyphs.json) */
@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/fredoka-700.woff2) format("woff2");
}
:root {
  --bg: #fdf6ee;
  --fg: #1c1917;
  --accent: #e75480;
  --accent-deep: #b8325e;
  --title-shadow: rgba(120, 30, 60, 0.18);
  --muted: #6f6762;
  --line: rgba(28, 25, 23, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17141f;
    --fg: #f4ede4;
    --accent: #ff7aa8;
    --accent-deep: #c2416f;
    --title-shadow: rgba(0, 0, 0, 0.45);
    --muted: #9a8f98;
    --line: rgba(244, 237, 228, 0.08);
  }
}

/* the gear lab can force a theme */
:root[data-theme="dark"] {
  --bg: #17141f;
  --fg: #f4ede4;
  --accent: #ff7aa8;
  --accent-deep: #c2416f;
  --title-shadow: rgba(0, 0, 0, 0.45);
  --muted: #9a8f98;
  --line: rgba(244, 237, 228, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="light"] {
    --bg: #fdf6ee;
    --fg: #1c1917;
    --accent: #e75480;
    --accent-deep: #b8325e;
    --title-shadow: rgba(120, 30, 60, 0.18);
    --muted: #6f6762;
    --line: rgba(28, 25, 23, 0.08);
  }
}
* { margin: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, system-ui, sans-serif;
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 0;
}
main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px;
}
/* letters are placed one by one (render/title.js) on the shared world layout */
#title {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: Fredoka, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 0.05em 0 var(--accent-deep), 0 0.1em 0.18em var(--title-shadow);
}
#title .ch {
  position: absolute;
  display: block;
  will-change: transform;
}
footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.sig {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 14px;
  row-gap: 2px;
}
.mark {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  opacity: 0.85;
  white-space: nowrap;
}
#add {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.12s ease, opacity 0.2s ease;
}
#add:hover { transform: translateY(-1px) scale(1.04); }
#add:active { transform: scale(0.94); }
#add:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.mods {
  display: grid;
  grid-template-columns: repeat(var(--n, 6), auto);
  gap: 6px;
}
.mod {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.mod:hover { transform: translateY(-1px) scale(1.04); }
.mod:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
/* the slot a picked-up modifier came from; drop it back here to cancel */
.mod.empty {
  border-style: dashed;
  color: var(--muted);
  opacity: 0.6;
}
#held {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  white-space: nowrap;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
#held[hidden] { display: none; }
#held.returning { transition: transform 0.18s ease-in, opacity 0.18s ease-in; opacity: 0; }
#held.used { transition: opacity 0.22s ease-out; opacity: 0; }
.fx, .fx-hand, .fx-burst {
  position: fixed;
  z-index: 9;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.fx {
  font-family: Fredoka, ui-rounded, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg), 0 2px 0 var(--bg);
  animation: fx-rise 1.1s ease-out forwards;
}
.fx.slapped {
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  animation: fx-slapped 0.9s ease-out forwards;
}
.fx-hand {
  font-size: 2.6rem;
  line-height: 1;
  animation: fx-swing 0.38s ease-in forwards;
}
.fx-burst {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  animation: fx-burst 0.4s ease-out forwards;
}
@keyframes fx-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}
@keyframes fx-slapped {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(0.95); }
  28% { transform: translate(-50%, -50%) rotate(4deg) scale(1.05); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -110%) rotate(-3deg) scale(1); }
}
@keyframes fx-swing {
  0% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1.3); }
  45% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot)) scale(0.9); }
}
@keyframes fx-burst {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}
body.holding { user-select: none; -webkit-user-select: none; touch-action: none; }
.score {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.score b {
  display: inline-block;
  font-family: Fredoka, ui-rounded, system-ui, sans-serif;
  font-size: 1.15rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.score b.bump { animation: score-bump 0.3s ease-out; }
@keyframes score-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.fx.points { font-size: 0.95rem; animation-duration: 0.8s; }
.fx.bump { font-size: 0.75rem; opacity: 0.85; animation-duration: 0.6s; }
.fx.jackpot { font-size: 1.8rem; color: var(--accent-deep); animation-duration: 1.4s; }
.sig small {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}
/* narrower screens: signature and add button on top, modifiers below in a 3x2 grid
   with opposites stacked */
@media (max-width: 1200px) {
  footer { flex-wrap: wrap; row-gap: 8px; padding-top: 8px; }
  .tools { display: contents; }
  .sig { flex: 1; min-width: 0; }
  .mods {
    order: 3;
    width: 100%;
    max-width: 560px;
    max-width: min(560px, calc(var(--cols, 3) * 190px));  /* one or two chips stay thumb-sized */
    grid-template-columns: repeat(var(--cols, 3), 1fr);
    grid-template-rows: repeat(var(--rows, 2), auto);
    grid-auto-flow: column;
  }
  .mod { padding: 0.4rem 0.15rem; font-size: clamp(0.68rem, 3.5vw, 0.85rem); min-width: 0; }
  #add { padding: 0.55rem 1rem; }
}
/* phones: drop the tagline so the mark, score and add button share one row */
@media (max-width: 560px) {
  .sig small { display: none; }
}
@media (max-width: 400px) {
  .mark { letter-spacing: 0.04em; font-size: 1.05rem; }
  .sig { column-gap: 10px; }
  #add { padding: 0.5rem 0.8rem; font-size: 0.9rem; }
}

/* ---------- run: round bar, screens, combo callouts ---------- */
.hud {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.hud[hidden], .hud-combo[hidden], .screen[hidden] { display: none; }
.hud-round { color: var(--muted); }
.hud-time, .hud-pts, .hud-combo {
  font-family: Fredoka, ui-rounded, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.hud-time { font-size: 1.05rem; min-width: 2.6em; text-align: center; }
.hud-time.low { color: var(--accent-deep); animation: hud-pulse 1s ease-in-out infinite; }
.hud-goal { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hud-bar {
  width: 110px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.hud-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease-out; }
.hud.met .hud-fill { background: #3fae6a; }
.hud.met .hud-pts { color: #3fae6a; }
.hud-combo { color: var(--accent); font-size: 1.05rem; }
.hud-combo.bump { animation: score-bump 0.3s ease-out; }
@keyframes hud-pulse { 50% { transform: scale(1.12); } }

main { grid-template-rows: 1fr; }
.screen {
  grid-area: 1 / 1;
  align-self: end;
  z-index: 4;
  margin-bottom: 4vh;
  pointer-events: none;
}
.card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 18px 22px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  text-align: center;
  animation: card-in 0.25s ease-out;
}
.screen .card.again { animation: none; }
.screen[data-state=title] .card { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
.card h2 { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 1.5rem; color: var(--accent-deep); }
.card .lede { font-size: 0.85rem; color: var(--muted); }
.card .tally { font-size: 1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .tally b { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 1.6rem; color: var(--fg); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin: 4px 0; }
.stats div { display: flex; flex-direction: column; }
.stats dt { font-size: 0.72rem; color: var(--muted); }
.stats dd { margin: 0; font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 1.25rem; }
.stats dd small { font-size: 0.75rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.12s ease;
}
.btn:hover { transform: translateY(-1px) scale(1.04); }
.btn:active { transform: scale(0.94); }
.btn:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
.btn.ghost { color: var(--fg); background: transparent; box-shadow: none; }
.screen[data-state=title] .btn { font-size: 1.2rem; padding: 0.8rem 1.8rem; white-space: nowrap; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
/* modifiers only work during a round */
body:not(.live) .mods { opacity: 0.4; }
.fx.callout {
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  animation: fx-slapped 1.2s ease-out forwards;
}
.fx.callout.c1 { font-size: 2.5rem; }
.fx.callout.c2 { font-size: 2.8rem; }
.fx.callout.c3 { font-size: 3.2rem; }
@media (max-width: 480px) {
  .hud { gap: 9px; padding: 5px 11px; font-size: 0.78rem; }
  .hud-bar { width: 76px; }
  /* keep result cards in the space under the title */
  .screen { margin-bottom: 2vh; }
  .card { gap: 6px; padding: 12px 16px; }
  .card h2 { font-size: 1.2rem; }
  .card .tally b { font-size: 1.3rem; }
  .card .lede { font-size: 0.75rem; }
  .stats { gap: 4px 18px; }
  .stats dd { font-size: 1.05rem; }
  .actions { flex-wrap: nowrap; }
  .btn { font-size: 0.92rem; padding: 0.55rem 1rem; }
}

/* ---------- ability chips: charges badge, cooldown sweep, used up ---------- */
.mod { position: relative; overflow: visible; }
.mod .charges {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 1.35em;
  height: 1.35em;
  padding: 0 0.3em;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.35em;
  text-align: center;
  color: var(--bg);
  background: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
/* the cooldown: a shaded fill that drains toward the left as it runs down */
.mod::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fg) 16%, transparent) calc(var(--cd, 0) * 100%), transparent 0);
  opacity: 0;
}
.mod.cooling::after { opacity: 1; }
.mod.cooling { color: var(--muted); cursor: progress; }
.mod.out {
  border-style: dashed;
  color: var(--muted);
  opacity: 0.45;
  cursor: not-allowed;
}
.mod.out .charges { background: var(--muted); }
.mod.nope { animation: chip-nope 0.3s ease; }
@keyframes chip-nope {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ---------- leveling: level-up label, perk picks ---------- */
.fx.levelup {
  font-size: 1.5rem;
  color: var(--accent-deep);
  animation: fx-slapped 1.1s ease-out forwards;
}
.fx-burst.level { border-width: 3px; animation-duration: 0.6s; }
.card .pick-head { font-size: 0.95rem; }
.card .pick-head b { color: var(--accent-deep); }
.card .pick-head small { color: var(--muted); }
.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.btn.choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-radius: 16px;
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
  box-shadow: none;
  min-width: 0;
}
.btn.choice b { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 1.02rem; color: var(--accent-deep); }
.btn.choice span { font-size: 0.74rem; font-weight: 600; color: var(--muted); line-height: 1.25; }
.btn.choice:hover { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); }
@media (max-width: 480px) {
  .choices { gap: 6px; }
  .btn.choice { padding: 0.55rem 0.3rem; }
  .btn.choice b { font-size: 0.9rem; }
  .btn.choice span { font-size: 0.66rem; }
}

/* ---------- first-run tip (slap) ---------- */
.tip {
  position: fixed;
  z-index: 8;
  max-width: min(300px, calc(100vw - 16px));
  padding: 10px 30px 10px 14px;
  border-radius: 14px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.85rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  animation: card-in 0.25s ease-out;
}
.tip[hidden] { display: none; }
.tip b { color: color-mix(in srgb, var(--accent) 70%, var(--bg)); }
.tip::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: calc(var(--arrow, 50%) - 7px);
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: var(--fg);
}
.tip-x {
  position: absolute;
  top: 2px;
  right: 4px;
  pointer-events: auto;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.7;
}
.mod.hint { animation: chip-hint 1.2s ease-in-out infinite; }
@keyframes chip-hint {
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .mod.hint { animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
}

/* ---------- draft: reward cards ---------- */
.btn.choice .tag {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--bg);
  background: var(--muted);
}
.btn.choice .tag.uncommon { background: #3f8fd2; }
.btn.choice .tag.rare { background: #b45ad6; }
.btn.choice .tag.ability { background: var(--accent-deep); }
.btn.choice .tag.pair { background: #3fae6a; }
.btn.choice .tag.shape { background: #1f9a93; }
.card .pick-head small { font-weight: 600; }

/* ---------- between rounds: one screen (rewards + perk cards, then a countdown) ---------- */
.card .tally .earned { display: block; font-size: 0.78rem; font-weight: 700; color: var(--accent-deep); }
.choices { grid-template-columns: repeat(auto-fit, minmax(min(30%, 140px), 1fr)); }
.btn.choice em { font-style: normal; font-size: 0.66rem; font-weight: 700; color: var(--accent-deep); opacity: 0.8; }
.btn.choice .tag.perk { background: #e0892b; }
.btn.choice.taken { opacity: 0.55; cursor: default; transform: none; border-style: dashed; }
.btn.choice.taken .check { font-size: 0.72rem; color: #3fae6a; }
.card .countdown { font-size: 0.95rem; color: var(--muted); }
.card .countdown b { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-size: 1.3rem; color: var(--accent-deep); }

/* ---------- words and bosses ---------- */
/* the word's spelling chunk: underlined, and lit letter by letter as it's spelled */
#title .ch.spell { text-decoration: underline 0.06em color-mix(in srgb, var(--accent-deep) 55%, transparent); text-underline-offset: 0.12em; }
#title .ch.spell.lit { color: #ffb238; text-decoration-color: #ffb238; }
/* Prude: censored letters get a black bar (and score nothing) */
#title .ch.censored::after {
  content: "";
  position: absolute;
  left: -6%; right: -6%;
  top: 30%; height: 42%;
  background: #141014;
  border-radius: 0.06em;
  transform: rotate(-4deg);
}
.hud-boss { color: var(--accent-deep); }
.card .next-up { font-size: 0.82rem; color: var(--muted); }
.card .next-up b { color: var(--fg); }
.boss-tag { font-style: normal; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 999px; color: var(--bg); background: var(--accent-deep); }
.fx.callout.boss { font-size: 2.4rem; color: var(--fg); }

/* ---------- sound toggle ---------- */
.mute {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  align-self: center;
}
.mute[aria-pressed="true"] { opacity: 0.55; }
.mute:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
/* personal bests on the title card; the run's mode and any record on the run-end card */
.card .records { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .records b { color: var(--fg); }
.card .mode { font-size: 0.8rem; color: var(--muted); }
.card .mode .record { color: var(--accent-deep); }

/* ---------- the slap counter (slap is aimed with the slingshot, not picked up) ---------- */
.slaps {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 2px solid var(--accent);
  font-family: Fredoka, ui-rounded, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
  user-select: none;
  -webkit-user-select: none;
}
.slaps .hand { font-size: 1.1em; line-height: 1; }
.slaps::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fg) 16%, transparent) calc(var(--cd, 0) * 100%), transparent 0);
  opacity: 0;
}
.slaps.cooling::after { opacity: 1; }
.slaps.cooling { color: var(--muted); }
.slaps.out { border-style: dashed; color: var(--muted); opacity: 0.5; background: transparent; }
.slaps.nope { animation: chip-nope 0.3s ease; }
.slaps.hint { animation: chip-hint 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .slaps.hint { animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
}
/* during a round, a drag on the play area aims a slap; the page mustn't scroll or zoom */
body.live { touch-action: none; overscroll-behavior: none; }
body.live main { cursor: crosshair; }

/* ---------- the draft: pairs above the menu, selections previewed on them ---------- */
.showcase {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 8px;
  max-width: min(460px, calc(100vw - 24px));
  --pvh: clamp(84px, 24vw, 116px);
}
.showcase.n1 { --pvh: clamp(130px, 40vw, 190px); }
.showcase.n2 { --pvh: clamp(96px, 28vw, 140px); }
.showcase .pv {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 calc((100% - 16px) / 3);
  min-width: 0;
  padding: 6px 4px 5px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
}
.showcase .pv.changed { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), 0 6px 20px rgba(0, 0, 0, 0.1); }
.showcase.n1 .pv { flex-basis: min(340px, 86vw); padding: 10px 8px 8px; }
.showcase.n2 .pv { flex-basis: calc((100% - 8px) / 2); }
.showcase canvas { width: 100%; height: var(--pvh); display: block; }
.showcase.n1 figcaption { font-size: 0.86rem; }
.showcase.n1 figcaption .add { font-size: 0.8rem; }
.showcase figcaption { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-align: center; display: flex; flex-direction: column; gap: 1px; }
.showcase figcaption .add { color: var(--accent-deep); font-size: 0.68rem; line-height: 1.15; }
.showcase figcaption .add.perk { color: #3a8f5c; }
.showcase .pv.tap { cursor: pointer; border-style: dashed; border-color: var(--accent); }
.showcase .pv.tap:hover, .showcase .pv.tap:focus-visible { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); outline: none; }
/* a selection waiting for a pair: the pairs it can go on pulse */
.showcase .pv.want { animation: pv-want 1.2s ease-in-out infinite; }
@keyframes pv-want { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  .showcase .pv.want { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
}
.showcase figcaption .hint { color: var(--muted); font-weight: 600; font-size: 0.66rem; }
.showcase .ghost {
  height: var(--pvh);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  width: 92%;
}
.btn.choice.selected {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 2px var(--accent-deep) inset;
}
.btn.choice.full { opacity: 0.55; }
.btn.choice.nope { animation: chip-nope 0.3s ease; }
.btn.choice { position: relative; }
.btn.choice.selected .check {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem; color: var(--bg); background: var(--accent-deep);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ---------- picking a pair for gear (draft and shop), prices ---------- */
.choices .cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.choices .cell > .btn.choice { flex: 1; }
.choices .wear { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.choices .wear small { width: 100%; text-align: center; font-size: 0.66rem; font-weight: 700; color: var(--muted); }
.btn.pairpick { font-size: 0.72rem; padding: 0.3rem 0.55rem; box-shadow: none; color: var(--fg); background: transparent; }
.btn.pairpick.on { color: var(--bg); background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.pairpick.buy { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.btn.choice .price { color: var(--accent-deep); font-size: 0.78rem; }
body.showcasing .hud { visibility: hidden; }

/* ---------- restart the round (in the round bar, during a round) ---------- */
.hud .restart { pointer-events: auto; }
.restart {
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.restart:hover { color: var(--fg); border-color: var(--muted); }
.restart.armed { color: var(--bg); background: var(--accent-deep); border-color: var(--accent-deep); }
.restart[hidden] { display: none; }
@media (max-width: 360px) {
  .hud { gap: 7px; padding: 5px 9px; }
  .hud-bar { width: 56px; }
}
/* phones: the restart button gets its own line under the round bar */
@media (max-width: 560px) {
  .hud { flex-wrap: wrap; justify-content: center; row-gap: 4px; border-radius: 16px; width: max-content; max-width: calc(100vw - 24px); }
  .hud .restart { flex-basis: 100%; }
}
/* waiting on a tap (Lock in or Buy before a pair is chosen) */
.actions .btn:disabled, .btn.pairpick:disabled { opacity: 0.6; cursor: default; box-shadow: none; transform: none; }
.btn.pairpick:disabled { border-style: dashed; color: var(--muted); }
