body.board {
  background: #000;
  color: #f8fafc;
  min-height: 100vh;
}
body.board .topbar {
  background: rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
body.board main {
  padding: 18px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------- lobby ---------- */
.lobby { text-align: center; padding: 24px; }
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 24px auto;
}
.qr-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.qr-card img {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 8px;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
}
.qr-card h3 { margin: 0 0 6px; color: var(--accent); }
.qr-card .status { font-size: 0.9rem; color: var(--dim); }
.qr-card .status.ready { color: var(--good); font-weight: 700; }
.qr-card .status.joined { color: var(--accent); }

/* ---------- board ---------- */
.category {
  text-align: center;
  background: var(--accent);
  color: #211a04;
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  padding: 8px 20px;
  border-radius: 10px;
  letter-spacing: 2px;
  margin: 8px auto 14px;
  display: inline-block;
}
.play { text-align: center; }

/* ------- WoF-style board: gold cross frame + emerald trilons ------- */
/* Geometry: wrap aspect = 44/14 (≈ 14.667 : 4.667 cells with ~1/3 cell gold padding).
 * Clip-path cuts the 4 outer corners so rows 1 & 4 visibly show 12 blocks while
 * rows 2 & 3 show 14 — the gold frame "steps out" at the middle band. */
.board-frame {
  position: relative;
  max-width: 1500px;
  margin: 0 auto;
  aspect-ratio: 44 / 14;
  background:
    linear-gradient(
      180deg,
      #8a6020 0%,
      #c89440 15%,
      #f3cf6b 38%,
      #fce79a 50%,
      #f3cf6b 62%,
      #c89440 85%,
      #8a6020 100%
    );
  clip-path: polygon(
    6.82% 0%, 93.18% 0%,
    93.18% 28.57%, 100% 28.57%,
    100% 71.43%, 93.18% 71.43%,
    93.18% 100%, 6.82% 100%,
    6.82% 71.43%, 0% 71.43%,
    0% 28.57%, 6.82% 28.57%
  );
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.6));
}
.board-frame::before {
  /* inner dark bevel line around the trilon grid */
  content: '';
  position: absolute;
  top: 7.14%; bottom: 7.14%; left: 2.27%; right: 2.27%;
  background: #05120a;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.9),
    inset 0 0 0 4px rgba(255, 255, 255, 0.08);
  z-index: 0;
}

.board-grid {
  position: absolute;
  top: 7.14%; bottom: 7.14%; left: 2.27%; right: 2.27%;
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 3px;
  padding: 4px;
  background: transparent;
  border: none;
  border-radius: 0;
  max-width: none;
  margin: 0;
  z-index: 1;
}
.cell {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b2d1a;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-size: clamp(1.2rem, 3.5vw, 3rem);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: background 0.3s;
}
.cell.edge {
  /* Outside this row's cap. Pure black — the stepped frame cutout above makes
   * this spot already outside the gold shape, so the page black shows through. */
  background: transparent;
  border: none;
}
.cell.blank {
  /* Space between words — empty trilon slot: subtle teal frame, no fill */
  background: #0b2a1c;
  box-shadow: inset 0 0 0 1px #0ea5a0;
}
.cell.unrevealed {
  /* Emerald trilon with sunburst — faint white radial + repeating conic rays */
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.14) 0%, transparent 55%),
    repeating-conic-gradient(
      from 0deg at 50% 50%,
      rgba(255,255,255,0.06) 0deg 6deg,
      transparent 6deg 15deg
    ),
    radial-gradient(circle at 50% 50%, #1fb366 0%, #117c43 100%);
  box-shadow:
    inset 0 0 0 2px #2fd4c0,
    inset 0 0 0 3px #0a2a1e,
    0 1px 2px rgba(0, 0, 0, 0.5);
}
.cell.revealed, .cell.punctuation {
  background: #f1ead6;
  color: #111;
  box-shadow:
    inset 0 0 0 2px #2fd4c0,
    inset 0 0 0 3px #0a2a1e;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.cell.hinted { background: var(--letter-highlight); color: var(--tile-active); }

.last-letter {
  margin: 14px auto;
  font-size: 1.1rem;
  color: var(--dim);
  min-height: 2em;
}
.last-letter .letter {
  display: inline-block;
  min-width: 56px; text-align: center;
  padding: 6px 12px;
  background: var(--panel-solid);
  border-radius: 6px;
  margin: 0 6px;
  font-weight: 700;
  color: var(--fg);
}
.last-letter.correct .letter { background: var(--good); color: #0b1912; }
.last-letter.wrong .letter { background: var(--danger); }

.status {
  min-height: 2em;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---------- scores strip ---------- */
.scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 18px auto;
  max-width: 1400px;
}
.score-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
}
.score-card.active { outline: 3px solid var(--accent); }
.score-card .name { font-weight: 700; font-size: 1.1rem; }
.score-card .round { font-size: 1.6rem; color: var(--accent); font-weight: 800; }
.score-card .total { color: var(--dim); font-size: 0.9rem; }

/* ---------- turn timer (10s pick-a-letter pie) ---------- */
.turn-timer[hidden] { display: none; }
.turn-timer {
  position: fixed;
  top: 68px;
  right: 24px;
  width: 120px;
  height: 120px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
}
.turn-timer-pie {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#fff 360deg, #000 0deg);
  border: 4px solid #e9c46a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
.turn-timer-sec {
  position: absolute;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  color: #e9c46a;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* ---------- wheel overlay ---------- */
/* The hidden HTML attribute is display:none without !important, so CSS
 * display:flex on the base rule would override it. Keep the flex layout
 * conditional on NOT being [hidden]. */
.wheel-overlay[hidden] { display: none; }
.wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.wheel-wrap {
  position: relative;
  width: min(80vmin, 720px);
  height: min(80vmin, 720px);
}
.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid #111;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
  transform: rotate(0deg);
  transition: transform 4s cubic-bezier(0.17, 0.75, 0.2, 1);
  overflow: hidden;
}
.wheel .wedge {
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 50%, 50% 0%, 60% 0%);
  transform-origin: 50% 50%;
  display: flex;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  text-shadow: 0 0 2px rgba(0,0,0,0.9);
  font-family: Impact, sans-serif;
}
.wheel .wedge span {
  margin-top: 16px;
  transform: rotate(0deg); /* rotated to point outward later */
  letter-spacing: 0;
  white-space: nowrap;
}

.wheel-hub {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 16%; height: 16%;
  background: radial-gradient(circle, #f3f4f6 0%, #9ca3af 60%, #4b5563 100%);
  border-radius: 50%;
  border: 3px solid #111;
  z-index: 2;
}
.wheel-pointer {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 36px solid var(--accent);
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.wheel-value {
  position: absolute;
  left: 50%;
  bottom: -72px;
  transform: translateX(-50%);
  background: var(--accent);
  color: #211a04;
  font-size: 2rem;
  font-weight: 900;
  padding: 10px 24px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s;
  min-width: 180px;
  text-align: center;
}
.wheel-value.show { opacity: 1; }

/* ---------- winner overlay ---------- */
.winner-overlay[hidden] { display: none; }
.winner-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #0d2b56 0%, #000 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
.winner-inner { text-align: center; }
.winner-label {
  color: #e9c46a;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2rem, 6vw, 5rem);
  letter-spacing: 8px;
  text-shadow: 0 4px 16px rgba(0,0,0,0.9);
}
.winner-name {
  color: #ffffff;
  font-family: "Cooper Black", Georgia, serif;
  font-weight: 900;
  font-size: clamp(3rem, 12vw, 10rem);
  margin: 12px 0;
  text-shadow: 0 6px 24px rgba(233,196,106,0.6), 0 2px 4px rgba(0,0,0,0.9);
}
.winner-score {
  color: #e9c46a;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2rem, 6vw, 5rem);
  text-shadow: 0 3px 10px rgba(0,0,0,0.9);
}

/* ---------- lightning ---------- */
.lightning {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
  margin: 18px auto;
  max-width: 1200px;
}
.lightning-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.timer {
  font-size: 4rem;
  font-weight: 900;
  color: var(--accent);
  font-family: Impact, sans-serif;
  min-width: 120px;
  text-align: center;
}
.timer.warn { color: var(--danger); }
.lightning-picks {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 12px 0;
}
.lightning-picks .tile {
  background: var(--tile-active);
  color: var(--tile-text);
  font-weight: 800;
  font-size: 2rem;
  width: 64px;
  height: 80px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
}
.lightning-picks .tile.empty { background: var(--board-bg-2); color: var(--dim); }
.lightning-picks .tile.vowel { outline: 2px solid var(--accent); }
.lightning-solve {
  text-align: center;
  font-size: 1.4rem;
  color: var(--fg);
  min-height: 2em;
  margin-top: 10px;
}
