/* ==================== Carved Pumpkin Tag — styles ==================== */

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

:root {
  --ground: #3b2a1c;
  --ground-2: #45321f;
  --glow: #ffb43a;
  --chain: #d79bff;
  --me: #ff5fa2;   /* replaced with your avatar's color */
}

/* touch-action is the only thing that actually stops a phone zooming the page.
   "manipulation" kills double-tap-to-zoom without killing panning, so a card
   taller than the screen can still be scrolled. */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  font-family: "Baloo 2", system-ui, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  background: #120a1c;
}

#game {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 90% at 50% 0%, #4a2a6b 0%, #2a1a3d 45%, #120a1c 100%);
}

[hidden] { display: none !important; }

/* -------------------------------- HUD --------------------------------- */

#hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2.4vw, 22px);
  padding: clamp(5px, 1.6vw, 12px) clamp(8px, 2vw, 16px);
  padding-top: calc(clamp(5px, 1.6vw, 12px) + env(safe-area-inset-top));
  flex-wrap: wrap;
}

.hud-item { flex: 0 0 auto; text-align: center; }

.stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(12px, 3vw, 18px);
  font-weight: 700;
  color: #e6d6f5;
  white-space: nowrap;
}

.stat-label b { font-size: 1.15em; color: #fff; }

.stat-label b.bump { display: inline-block; animation: bump 0.3s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.55); }
  100% { transform: scale(1); }
}

/* Your avatar in the top bar, in its ring. */
.me-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  font-size: 1.05em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px var(--me);
}

@media (max-width: 430px) {
  .hud-word { display: none; }
}

#quit-btn, #done-btn {
  flex: 0 0 auto;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(180deg, #5a3a7c, #36214d);
  border: 2px solid #9f7cc4;
  box-shadow: 0 3px 0 #1c1029;
}

#quit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(34px, 8.5vw, 44px);
  height: clamp(34px, 8.5vw, 44px);
  padding: 0;
  font-size: clamp(15px, 4.2vw, 21px);
  line-height: 1;
  border-radius: 50%;
}

#done-btn {
  padding: 5px clamp(10px, 2.6vw, 14px);
  font-size: clamp(12px, 3vw, 16px);
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  border-radius: 99px;
}

#quit-btn:active, #done-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1c1029; }

.practice-badge {
  padding: 3px clamp(8px, 2vw, 12px);
  font-size: clamp(12px, 3vw, 16px);
  font-weight: 800;
  color: #3a2a00;
  background: #ffd97a;
  border-radius: 99px;
  white-space: nowrap;
}

/* --------------------------- what just happened --------------------------- */

#say {
  flex: 0 0 auto;
  align-self: center;
  z-index: 30;
  max-width: 94%;
  margin-bottom: clamp(3px, 1vw, 7px);
  padding: clamp(4px, 1.2vw, 9px) clamp(11px, 3vw, 20px);
  font-size: clamp(12px, 3.2vw, 18px);
  font-weight: 700;
  color: #ffe9c9;
  background: rgba(30, 14, 40, 0.85);
  border: 2px solid #8a5aa8;
  border-radius: 99px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#say.pop { animation: sayPop 0.4s cubic-bezier(0.34, 1.6, 0.64, 1); }
@keyframes sayPop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

#say.urgent {
  color: #fff2a8;
  border-color: #ff9a3d;
  background: rgba(70, 24, 6, 0.92);
}

/* ------------------------------ the patch ------------------------------ */

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

#board {
  position: relative;
  flex: 0 0 auto;
  border-radius: 12px;
  box-shadow: 0 0 0 3px #1d1208, 0 0 40px rgba(255, 150, 40, 0.18), 0 12px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 10), 1fr);
  grid-template-rows: repeat(var(--rows, 11), 1fr);
}

/* The tiles: patchy dirt in a checkerboard, so you can count how far away a
   pumpkin is. */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--tile, 30px) * 0.62);
  line-height: 1;
  background: var(--ground);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.cell.alt { background: var(--ground-2); }

.cell.blocked {
  background: #2a1d12;
  cursor: not-allowed;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.6);
}

.cell:active:not(.blocked) { background: #5a4126; }

/* The magic chains, drawn in tile units over the patch. */
#chains {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 8;
}

.chain {
  fill: none;
  stroke: var(--chain);
  stroke-width: 0.13;
  stroke-linecap: round;
  stroke-dasharray: 0.22 0.12;
  filter: drop-shadow(0 0 3px #c77dff) drop-shadow(0 0 6px #ff5fe8);
  animation: chainShimmer 0.8s linear infinite;
}

@keyframes chainShimmer {
  to { stroke-dashoffset: -0.68; }
}

/* ---------------------------- everybody on it ---------------------------- */

#tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.token {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--tile, 30px) * 0.92);
  height: calc(var(--tile, 30px) * 0.92);
  font-size: calc(var(--tile, 30px) * 0.66);
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  z-index: 2;
}

.token .face { position: relative; }

.token .pumpkin-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 calc(var(--tile, 30px) * 0.12) rgba(255, 170, 40, 0.65));
}

.token.pumpkin { z-index: 3; animation: wobble 1.4s ease-in-out infinite; }
@keyframes wobble {
  0%, 100% { rotate: -4deg; }
  50% { rotate: 4deg; }
}

/* A computer pumpkin reaching out to tap somebody: it swells and glows, so a
   runner can see it coming and squirm away in time. */
.token.pumpkin.reaching { animation: reach 0.3s ease-in-out infinite; }
.token.pumpkin.reaching .pumpkin-svg { filter: drop-shadow(0 0 calc(var(--tile, 30px) * 0.22) #ffe15a); }
@keyframes reach {
  0%, 100% { scale: 1.05; }
  50% { scale: 1.22; }
}

/* Frozen 🥶: icy blue, a block of ice over the top, not moving a bit. */
.token .ice {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--tile, 30px) * 0.92);
  opacity: 0.62;
}

.token.frozen .ice { display: flex; }
.token.frozen .face { filter: hue-rotate(170deg) saturate(1.6) brightness(1.15); }
.token.frozen { animation: shiver 0.12s linear infinite; }
@keyframes shiver {
  0%, 100% { translate: -1px 0; }
  50% { translate: 1px 0; }
}

/* 🧭 or 🎯 on a teamed-up pumpkin, so you can see who's doing which job. */
.token .job-badge {
  position: absolute;
  top: -8%;
  right: -10%;
  font-size: calc(var(--tile, 30px) * 0.32);
}

/* You: a ring in your avatar's color, a YOU tag, and as a pumpkin your face
   on a little badge. */
.token.me { z-index: 6; }
.token.me::before {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  box-shadow: 0 0 0 calc(var(--tile, 30px) * 0.07) var(--me), 0 0 calc(var(--tile, 30px) * 0.3) var(--me);
  animation: meGlow 1.6s ease-in-out infinite;
}

@keyframes meGlow {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.token .me-badge {
  position: absolute;
  bottom: -10%;
  left: -12%;
  font-size: calc(var(--tile, 30px) * 0.34);
  background: var(--me);
  border-radius: 50%;
  padding: 1px;
  line-height: 1;
}

.token .you {
  position: absolute;
  top: -32%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 calc(var(--tile, 30px) * 0.08);
  font-size: calc(var(--tile, 30px) * 0.2);
  font-weight: 800;
  color: #fff;
  background: var(--me);
  border-radius: 99px;
  white-space: nowrap;
}

.token.pop { animation: tokenPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes tokenPop {
  0% { scale: 1; }
  40% { scale: 1.5; }
  100% { scale: 1; }
}

/* ------------------------------- the dock ------------------------------- */

#dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: clamp(54px, 13vw, 70px);
  padding: clamp(6px, 1.6vw, 12px) 8px calc(clamp(8px, 2vw, 14px) + env(safe-area-inset-bottom));
}

.dock-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}

/* --- the seven trap buttons --- */

.traps {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 560px;
}

.trap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px 3px;
  overflow: hidden;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(180deg, #5b2f86, #34184f);
  border: 2px solid #a978d6;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 #1d0b2e;
}

.trap:active { transform: translateY(2px); box-shadow: 0 1px 0 #1d0b2e; }

.trap-e {
  position: relative;
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1.1;
}

.trap small {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(9px, 2.5vw, 12px);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Charging back up after a press: it fills from the bottom. */
.trap-fill {
  position: absolute;
  inset: 0;
  background: rgba(10, 4, 18, 0.65);
  transform-origin: top;
  transform: scaleY(calc(1 - var(--charge, 1)));
}

.trap.charging .trap-e { opacity: 0.55; }

/* Pressed and waiting for you to tap who it's for. */
.trap.armed {
  background: linear-gradient(180deg, #ffb43a, #e0660f);
  border-color: #fff3c4;
  box-shadow: 0 3px 0 #7a3006, 0 0 16px #ffb43a;
  animation: armedPulse 0.7s ease-in-out infinite;
}

@keyframes armedPulse {
  50% { scale: 1.07; }
}

.trap.locked { filter: grayscale(0.7); }
.trap.locked .trap-e { opacity: 0.6; }

/* The gaps between buttons. ✌️ Two at a Time lights them up to be tapped. */
.trap-gap {
  flex: 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  transition: flex-basis 0.15s ease;
}

.traps.double .trap-gap:not(.none) {
  flex-basis: clamp(18px, 5vw, 28px);
  margin: 0 1px;
  font-size: clamp(13px, 3.6vw, 18px);
  background: radial-gradient(circle, rgba(255, 225, 90, 0.55), rgba(255, 225, 90, 0) 70%);
  border-radius: 99px;
  cursor: pointer;
  animation: armedPulse 0.7s ease-in-out infinite;
}

.traps.double .trap:not(.armed) { opacity: 0.75; }

.team-btn {
  padding: clamp(9px, 2.4vw, 14px) clamp(18px, 5vw, 30px);
  font-family: inherit;
  font-size: clamp(17px, 4.6vw, 24px);
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #c77dff, #7b33c4);
  border: 3px solid #f0d6ff;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 5px 0 #46166f, 0 0 22px rgba(199, 125, 255, 0.6);
  animation: teamPulse 1.1s ease-in-out infinite;
}

.team-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #46166f; }

@keyframes teamPulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.06; }
}

.job {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 6px 8px 6px 16px;
  font-size: clamp(14px, 3.8vw, 19px);
  font-weight: 700;
  color: #fbeaff;
  background: rgba(60, 22, 90, 0.85);
  border: 2px solid var(--chain);
  border-radius: 99px;
}

.swap-btn {
  padding: 4px 12px;
  font-family: inherit;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 800;
  color: #3a1858;
  background: #f0d6ff;
  border: none;
  border-radius: 99px;
  cursor: pointer;
}

.hint {
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 700;
  color: #cbb2e0;
}

/* --------------------------- traps on the patch --------------------------- */

/* What trap is on somebody right now, in the top-left corner of them. */
.token .trap-badge {
  position: absolute;
  left: -14%;
  top: -14%;
  font-size: calc(var(--tile, 30px) * 0.3);
  line-height: 1;
  pointer-events: none;
}

.token.shielded::after {
  content: "";
  position: absolute;
  inset: -12%;
  border: calc(var(--tile, 30px) * 0.06) solid #7fd8ff;
  border-radius: 50%;
  background: rgba(127, 216, 255, 0.18);
  box-shadow: 0 0 calc(var(--tile, 30px) * 0.25) #7fd8ff;
}

/* 🫥 Somebody else invisible is gone; you invisible are a ghost. */
.token.invisible { opacity: 0; }
.token.ghost { opacity: 0.4; }

.token.flying { z-index: 9; scale: 1.5; transition: scale 0.2s ease; }

/* 🆘 A borrowed runner wears a pumpkin-orange glow. */
.token.helping .face { filter: drop-shadow(0 0 calc(var(--tile, 30px) * 0.18) #ff9a3d); }

/* ⛄ An Icy Blast sidekick. */
.token.sidekick {
  z-index: 4;
  font-size: calc(var(--tile, 30px) * 0.7);
  filter: drop-shadow(0 0 calc(var(--tile, 30px) * 0.18) #8fdcff);
}

.token.sidekick.mine::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  box-shadow: 0 0 0 calc(var(--tile, 30px) * 0.05) var(--me);
}

/* Things flying across the patch. */
.shot {
  position: absolute;
  z-index: 10;
  font-size: calc(var(--tile, 30px) * 0.6);
  line-height: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.shot-fire { font-size: calc(var(--tile, 30px) * 0.9); filter: drop-shadow(0 0 10px #ff6a2a); }

.tongue {
  stroke: #ff6fa5;
  stroke-width: 0.16;
  stroke-linecap: round;
  animation: tongue 0.5s ease-out forwards;
}

@keyframes tongue {
  to { opacity: 0; }
}

/* 💪 An unstoppable team's chains are gold. */
.chain.gang {
  stroke: #ffd23f;
  filter: drop-shadow(0 0 3px #ffb43a) drop-shadow(0 0 6px #ff8b3d);
}

/* 😴 You're a sleepy pumpkin: pitch black, except you and anybody getting
   tagged. */
#board.blind .cell {
  background: #000;
  color: transparent;
  text-shadow: none;
  box-shadow: none;
}

#board.blind #chains,
#board.blind .shot,
#board.blind .token:not(.me):not(.seen) { opacity: 0; }

#board.blind { box-shadow: 0 0 0 3px #000, 0 0 30px rgba(0, 0, 0, 0.8); }

/* -------------------------------- FROZEN -------------------------------- */

#frozen {
  position: fixed;
  left: 50%;
  bottom: calc(clamp(8px, 2.4vh, 22px) + env(safe-area-inset-bottom));
  z-index: 55;
  display: none;
  flex-direction: column;
  align-items: center;
  max-width: 94vw;
  padding: clamp(8px, 2.4vw, 14px) clamp(16px, 4vw, 26px);
  transform: translateX(-50%);
  background: rgba(8, 30, 52, 0.94);
  border: 4px solid #8fdcff;
  border-radius: 24px;
  box-shadow: 0 0 40px rgba(143, 220, 255, 0.6);
  pointer-events: none;
  text-align: center;
}

#frozen.show { display: flex; animation: frozenIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes frozenIn {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
}

.frozen-ice { font-size: clamp(26px, 8vw, 40px); line-height: 1.1; }
.frozen-words {
  font-size: clamp(15px, 4.4vw, 22px);
  font-weight: 800;
  color: #d8f6ff;
}

#veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#game.frozen #veil {
  opacity: 1;
  box-shadow: inset 0 0 clamp(40px, 14vw, 90px) clamp(8px, 3vw, 22px) rgba(143, 220, 255, 0.5);
  background: rgba(120, 200, 255, 0.08);
}

/* --------------------------------- banner --------------------------------- */

#banner {
  position: fixed;
  left: 50%;
  top: 30%;
  z-index: 56;
  max-width: 92vw;
  padding: 10px 22px;
  font-size: clamp(19px, 5.4vw, 30px);
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  color: #fff;
  border-radius: 18px;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner.good { background: linear-gradient(180deg, #ff9a3d, #d4580f); box-shadow: 0 6px 0 #7d2f0c; }
#banner.bad { background: linear-gradient(180deg, #5ab8f0, #1f6fae); box-shadow: 0 6px 0 #10406a; }

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 70;
}

/* --------------------------------- cards ---------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 16px;
  background: rgba(18, 8, 28, 0.66);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.overlay.show { display: flex; }

.card-box {
  margin: auto 0;
  background: #fff8ef;
  border-radius: 26px;
  border: 6px solid #e07a1f;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.35), 0 22px 40px rgba(0, 0, 0, 0.45);
  padding: clamp(16px, 4.4vw, 30px);
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: cardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardIn {
  from { transform: scale(0.6) translateY(30px); opacity: 0; }
}

.overlay.race .card-box { border-color: #8cc84b; }

.card-emoji { font-size: clamp(38px, 10vw, 58px); line-height: 1; margin-bottom: 4px; }

.card-box h1 {
  margin: 4px 0 10px;
  font-size: clamp(22px, 6.2vw, 36px);
  font-weight: 800;
  line-height: 1.15;
  color: #b4470a;
}

.overlay.race .card-box h1 { color: #3f6e1c; }

.card-box p {
  margin: 7px 0;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 500;
  color: #4a2c16;
}

.card-box p.small { font-size: clamp(12px, 3vw, 15px); color: #85664c; }
.card-box p.ask { margin: 14px 0 6px; font-weight: 800; color: #b4470a; }
.card-box .new-best { font-weight: 800; color: #e08600; font-size: clamp(16px, 4.2vw, 21px); }

.rules {
  margin: 8px 0;
  padding: 0 0 0 1.1em;
  text-align: left;
  font-size: clamp(13px, 3.4vw, 17px);
  color: #4a2c16;
}

.rules li { margin: 4px 0; }

.big-btn {
  margin-top: 14px;
  font-family: inherit;
  font-size: clamp(19px, 4.8vw, 26px);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff9a3d, #d4580f);
  border: none;
  border-radius: 99px;
  padding: 12px 32px;
  cursor: pointer;
  box-shadow: 0 6px 0 #7d2f0c, 0 10px 18px rgba(0, 0, 0, 0.3);
}

.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #7d2f0c; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 12px;
}

.big-btn.alt {
  font-size: clamp(16px, 4vw, 21px);
  padding: 10px 22px;
  color: #3a2a00;
  background: linear-gradient(180deg, #ffe08a, #f2b21f);
  box-shadow: 0 6px 0 #a8720a, 0 10px 18px rgba(0, 0, 0, 0.25);
}

.lang-btn {
  display: block;
  margin: 14px auto 0;
  padding: 4px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #b4470a;
  background: #fff1e0;
  border: 2px solid #f0b27a;
  border-radius: 99px;
  cursor: pointer;
}

.text-btn {
  display: block;
  margin: 12px auto 0;
  font-family: inherit;
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 700;
  color: #85664c;
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* --- the title's three pumpkins --- */

.title-pumpkins {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.title-pk {
  width: clamp(54px, 16vw, 78px);
  height: clamp(54px, 16vw, 78px);
  filter: drop-shadow(0 0 8px rgba(255, 170, 40, 0.6));
}

.title-pk:nth-child(2) { width: clamp(66px, 20vw, 94px); height: clamp(66px, 20vw, 94px); }

/* --- making your avatar --- */

.avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.av-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  font-size: clamp(40px, 12vw, 56px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px var(--me), 0 0 18px var(--me);
}

.av-name { font-weight: 800; font-size: clamp(16px, 4.4vw, 22px); color: #4a2c16; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

@media (max-width: 420px) {
  .choice-grid { grid-template-columns: repeat(6, 1fr); }
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-family: inherit;
  background: #fff;
  border: 3px solid #f0d4b8;
  border-radius: 14px;
  cursor: pointer;
}

.choice.on { border-color: #e07a1f; background: #fff1e0; box-shadow: 0 0 0 2px #ffb76b; }

.face-btn { aspect-ratio: 1; font-size: clamp(20px, 6vw, 28px); line-height: 1; }

.choice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.swatch {
  width: clamp(36px, 10vw, 44px);
  height: clamp(36px, 10vw, 44px);
  border-radius: 50%;
  background: var(--sw);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #e0c6ad;
  cursor: pointer;
}

.swatch.on { box-shadow: 0 0 0 4px #4a2c16; }

#name-input {
  width: 100%;
  padding: 9px 14px;
  font-family: inherit;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 800;
  text-align: center;
  color: #4a2c16;
  background: #fff;
  border: 3px solid #f0b27a;
  border-radius: 16px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

#name-input:focus { border-color: #e07a1f; }

/* --- carving --- */

.carve-pick {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carve-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1 1 0;
  max-width: 130px;
  padding: 6px 4px;
  font-family: inherit;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 800;
  color: #85664c;
  background: #2a1a3d;
  border: 3px solid transparent;
  border-radius: 18px;
  cursor: pointer;
}

.carve-slot span { color: #e6d6f5; }
.carve-slot .pumpkin-svg { width: 100%; aspect-ratio: 1; height: auto; filter: drop-shadow(0 0 8px rgba(255, 170, 40, 0.6)); }
.carve-slot.on { border-color: #ffb43a; box-shadow: 0 0 0 3px #ff9a3d; }

.part { width: clamp(64px, 17vw, 80px); padding: 4px 2px; }
.part small { font-size: clamp(10px, 2.6vw, 12px); font-weight: 700; color: #85664c; line-height: 1.1; }

.mini { width: clamp(40px, 11vw, 52px); height: clamp(40px, 11vw, 52px); }

.dice-btn {
  margin-top: 14px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 800;
  color: #3a2a00;
  background: linear-gradient(180deg, #ffd97a, #f2a20c);
  border: 3px solid #fff;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b9700a;
}

.dice-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9700a; }

/* --- runner or pumpkin, and your job on a chain --- */

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  font-family: inherit;
  color: #4a2c16;
  background: #fff;
  border: 3px solid #f0d4b8;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 5px 0 #e0c6ad;
}

.role-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #e0c6ad; }
.role-btn.last { border-color: #e07a1f; }
.role-btn b { font-size: clamp(15px, 4vw, 20px); color: #b4470a; }
.role-btn small { font-size: clamp(12px, 3vw, 14px); line-height: 1.2; color: #85664c; }

.role-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(70px, 20vw, 96px);
}

.role-pic .pumpkin-svg { width: clamp(70px, 20vw, 96px); height: 100%; filter: drop-shadow(0 0 8px rgba(255, 170, 40, 0.6)); }
.role-pic .av-face { font-size: clamp(30px, 9vw, 42px); }
.role-pic.big-emoji { font-size: clamp(44px, 12vw, 60px); }

/* --- the two winners --- */

.winners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.winner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: #2a1a3d;
  border-radius: 18px;
  color: #fff;
}

.winner b { font-size: clamp(15px, 4vw, 20px); }
.winner small { font-size: clamp(11px, 3vw, 14px); color: #e6d6f5; line-height: 1.2; }
.win-pic { display: flex; justify-content: center; gap: 2px; min-height: clamp(54px, 15vw, 70px); align-items: center; }
.win-face { font-size: clamp(38px, 11vw, 52px); }
.win-pk { width: clamp(50px, 14vw, 66px); height: clamp(50px, 14vw, 66px); filter: drop-shadow(0 0 8px rgba(255, 170, 40, 0.7)); }

/* --- one winner (the maze race after the pumpkins give up) --- */

.winners.one { grid-template-columns: 1fr; max-width: 260px; margin-inline: auto; }

/* Everybody in a tie, side by side on the race card. */
.race-pics { flex-wrap: wrap; gap: 4px 8px; }

/* ============================ the maze race ============================ */

/* A screen of its own: a corn field by moonlight, nothing like the patch. */
#maze-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(clamp(6px, 1.6vw, 12px) + env(safe-area-inset-top)) 16px calc(clamp(8px, 2vw, 14px) + env(safe-area-inset-bottom));
  background: radial-gradient(120% 80% at 50% 0%, #34563c 0%, #1a2e20 50%, #0b150e 100%);
}

.maze-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

#maze-title {
  margin: 0;
  font-size: clamp(20px, 5.4vw, 30px);
  font-weight: 800;
  line-height: 1.1;
  color: #ffe08a;
  text-shadow: 0 2px 0 #3a2a00, 0 0 18px rgba(255, 210, 90, 0.4);
}

.maze-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  max-width: 100%;
}

.mz-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 4px;
  font-size: clamp(11px, 3vw, 15px);
  font-weight: 700;
  color: #eaf6d8;
  background: rgba(10, 24, 12, 0.7);
  border: 2px solid #4f8f2f;
  border-radius: 99px;
  white-space: nowrap;
}

.mz-chip.me { border-color: var(--me); box-shadow: 0 0 8px var(--me); }
.mz-chip b { color: #fff; }
.mz-face { font-size: 1.25em; line-height: 1; }
.mz-pk { width: 1.6em; height: 1.6em; }

.maze-say {
  max-width: 100%;
  margin-top: 6px;
  padding: 3px 14px;
  font-size: clamp(12px, 3.2vw, 17px);
  font-weight: 700;
  color: #fff4cf;
  background: rgba(10, 24, 12, 0.75);
  border: 2px solid #8cc84b;
  border-radius: 99px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.maze-say:empty { visibility: hidden; }

.maze-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.maze-board {
  position: relative;
  flex: 0 0 auto;
}

#maze-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The path is trampled straw; the walls are rows of corn. */
.mz-floor { fill: #c9a55c; }
.mz-start { fill: #e8d08f; }
.mz-exit { fill: #ffe08a; }

.mz-wall-shade,
.mz-wall {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mz-wall-shade { stroke: #1d3a12; stroke-width: 0.3; }
.mz-wall { stroke: #6fb33a; stroke-width: 0.17; }

.mz-door {
  font-size: 0.72px;
  text-anchor: middle;
  dominant-baseline: middle;
}

#maze-tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* The arrows: up on top, left, down and right underneath, big enough for a
   thumb. */
.maze-pad {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, clamp(56px, 17vw, 72px));
  grid-template-rows: repeat(2, clamp(56px, 17vw, 72px));
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  margin-top: 8px;
  touch-action: none;
}

.arrow {
  font-family: inherit;
  font-size: clamp(26px, 8vw, 34px);
  line-height: 1;
  background: linear-gradient(180deg, #5d9a34, #33621a);
  border: 3px solid #b8e07a;
  border-radius: 18px;
  box-shadow: 0 5px 0 #1d3a12;
  cursor: pointer;
}

.arrow:active { transform: translateY(4px); box-shadow: 0 1px 0 #1d3a12; }
.arrow.up { grid-area: up; }
.arrow.left { grid-area: left; }
.arrow.down { grid-area: down; }
.arrow.right { grid-area: right; }
