/* Draw & Guess. Panels, buttons, the top bar and toasts come from
   ../shared/arcade.css, linked first in index.html. */

html, body { overflow: hidden; }

#play {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}

.scores { display: flex; gap: 7px; }
.sc {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 4px 11px;
}
.sc i { font-style: normal; font-size: 0.8rem; color: #cbbfe0; }
.sc b { font-size: 1.05rem; color: #ffd076; font-variant-numeric: tabular-nums; }
.sc.me { border-color: rgba(255, 208, 118, 0.5); }
/* a pencil against whoever is holding the pen */
.sc.drawing i::before { content: '✎ '; color: #ffd076; }

.timer {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f3ecdf;
  min-width: 2ch;
  text-align: center;
}
.timer.urgent { color: #ff6b6b; }
.round-no { margin-left: auto; font-size: 0.78rem; color: #9d8bb5; }

/* ───────── the word ───────── */
.word-line { text-align: center; }
.word {
  font-size: clamp(1.15rem, 5vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffd076;
}
/* The guesser sees only the shape of it: one dot per letter, gaps for spaces. */
.word.hint { letter-spacing: 0.22em; color: #cbbfe0; font-weight: 700; }
.role-line { text-align: center; font-size: 0.82rem; color: #9d8bb5; margin-top: -4px; }

/* ───────── the board ───────── */
/* Height is set inline by layout() to hold the 4:3 board. flex: 0 0 auto so it
   never gets stretched or squashed by the column around it. */
.board-wrap { position: relative; width: 100%; flex: 0 0 auto; }
#board {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #1b1426;
  border: 1px solid rgba(255, 255, 255, 0.14);
  touch-action: none;
}
#board.drawable { cursor: crosshair; }

.result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 14px;
  background: rgba(20, 14, 28, 0.9);
  backdrop-filter: blur(3px);
  padding: 18px;
}
.result b { font-size: clamp(1.3rem, 6vw, 1.8rem); color: #ffd076; }
.result-label { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: #9d8bb5; margin-top: 6px; }
.result-word { font-size: clamp(1.1rem, 5vw, 1.4rem); font-weight: 700; color: #f3ecdf; margin-bottom: 12px; }
.result .big { width: auto; padding: 12px 28px; }
.result-wait { font-size: 0.85rem; color: #9d8bb5; }

/* ───────── tools ───────── */
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.colours { display: flex; gap: 5px; flex: 1; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.swatch.on { border-color: #ffd076; transform: scale(1.12); }

.nibs { display: flex; gap: 5px; }
.nib {
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  padding: 0;
}
.nib i { display: block; border-radius: 50%; background: #cbbfe0; }
.nib.on { border-color: #ffd076; }
.nib.on i { background: #ffd076; }

.tool-btn {
  width: 34px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbbfe0;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
}
.tool-btn:hover { color: #f3ecdf; border-color: rgba(255, 255, 255, 0.3); }

/* ───────── guesses ───────── */
.chat {
  flex: 1 1 auto;
  min-height: 44px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  line-height: 1.35;
}
.chat-line { color: #cbbfe0; word-break: break-word; }
.chat-line.mine { color: #f3ecdf; }
.chat-line.close { color: #ffd076; font-weight: 700; font-style: italic; }

.guess-row { display: flex; gap: 8px; }
#guess-input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 12px;
  color: #f3ecdf;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
#guess-input:focus { outline: none; border-color: rgba(255, 208, 118, 0.6); }
.guess-row .alt { flex: 0 0 auto; padding: 12px 20px; }

/* ───────── word choices ───────── */
.word-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
/* Needs `.panel` in the selector, same gotcha as `.who-btn`/`.chip` in
   shared/arcade.css: `.panel button` is more specific than a bare `.word-btn`,
   so without it every choice rendered as a solid gold pill with no level
   badge instead of the intended dark card. */
.panel .word-btn {
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 18px;
  border-radius: 14px;
  color: #f3ecdf;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.panel .word-btn:hover { border-color: rgba(255, 208, 118, 0.55); background: rgba(255, 255, 255, 0.09); }
.word-word { font-size: 1.1rem; font-weight: 700; }
.word-level {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.word-btn.easy .word-level { color: #8fd3a8; }
.word-btn.medium .word-level { color: #ffd076; }
.word-btn.hard .word-level { color: #ff8a8a; }

/* Wider than the standard 360px panel: with shuffle on there can be ~100
   chips to scan, and a couple of extra columns make that far less tedious. */
#choose .panel { width: min(560px, 94vw); }

/* Shuffle mode hands back ~100 words instead of 3 — a column of full-width
   cards would make the panel absurdly tall, so this switches to a wrapped
   grid of small chips. The level still reads at a glance via border tint. */
.word-choices.many { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 7px; max-height: 55vh; overflow-y: auto; padding: 2px; }
.word-choices.many .word-btn { width: auto; padding: 8px 13px; border-radius: 999px; gap: 7px; }
.word-choices.many .word-word { font-size: 0.88rem; }
.word-choices.many .word-level { display: none; }
.word-choices.many .word-btn.easy { border-color: rgba(143, 211, 168, 0.45); }
.word-choices.many .word-btn.medium { border-color: rgba(255, 208, 118, 0.45); }
.word-choices.many .word-btn.hard { border-color: rgba(255, 138, 138, 0.45); }

/* ───────── final ───────── */
.final { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.final-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.final-row b { font-size: 1.2rem; color: #ffd076; }

@media (max-width: 430px) {
  #play .topbar { flex-wrap: wrap; }
}
