/*
 * game-ui.css — shared component library for the quiz-night game prototypes
 * (game/price-is-right, game/two-truths-one-lie, game/emoji-movie, and any
 * future one).
 *
 * Each game defines its own color/font tokens in its own <style> block
 * (--bg, --surface, --surface-2, --surface-3, --ink, --ink-soft, --accent,
 * --accent-ink, --focus, --shadow, --font-display, --font-body, --font-mono)
 * and its own unique set pieces (price tag, case file, cinema ticket).
 * This file only styles the chrome every game shares: layout shell, buttons,
 * form fields, chips, scoreboard, progress bar, and the end screen — all
 * driven purely through those variables so each game keeps its own identity.
 *
 * It also owns the one cross-cutting behavior change all three games needed:
 * scaling everything up on large screens, for when a phone/laptop is cast or
 * mirrored onto a TV and read from across the room.
 */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- TV-friendly scaling ----------
 * Everything below is sized in rem, so growing the root font-size on large
 * viewports scales every game's UI together — text, buttons, cards — without
 * touching each page's own CSS. Thresholds roughly track: phone/tablet (no
 * change), laptop/desktop mirrored to a TV (moderate bump), a TV browser or
 * a laptop actually cast at 1080p+ across a room (larger bump).
 */
html { font-size: 16px; }

@media (min-width: 900px) {
  html { font-size: clamp(16px, 0.6vw + 12px, 20px); }
}

@media (min-width: 1400px) {
  html { font-size: clamp(20px, 0.75vw + 12px, 26px); }
}

@media (min-width: 2200px) {
  html { font-size: clamp(26px, 0.5vw + 20px, 34px); }
}

.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

@media (min-width: 900px) {
  .wrap { max-width: 760px; padding-bottom: 5rem; }
}

@media (min-width: 1400px) {
  .wrap { max-width: 880px; }
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.wordmark small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.theme-toggle {
  border: 1px solid var(--surface-3);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  cursor: pointer;
  flex: none;
}

/* ---------- Buttons ---------- */
button { font: inherit; }
.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.12s ease, filter 0.12s ease;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-ghost:hover { filter: brightness(0.97); }
.btn-quiet {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.5rem 0.6rem;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Panel / card shell ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 26px -14px var(--shadow);
}
.panel h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
  text-wrap: balance;
}
.panel p.lede {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  max-width: 48ch;
}
.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

/* ---------- Text inputs ---------- */
.name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}
.name-grid label { display: block; }
.name-grid input[type="text"] {
  width: 100%;
  margin-top: 0.4rem;
  border: 1.5px solid var(--surface-3);
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font-body);
}

/* ---------- Chips ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.3rem;
}
.chip {
  appearance: none;
  border: 1.5px solid var(--surface-3);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip .count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.8;
  margin-left: 0.3em;
}

/* ---------- Scoreboard ---------- */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.score-pill {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: 14px;
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.score-pill.active { border-color: var(--accent); }
.score-pill .name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-pill .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 700;
}

/* ---------- Progress ---------- */
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  margin: 0 0.75rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- Action rows ---------- */
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.action-row.solo { grid-template-columns: 1fr; }

/* ---------- End screen ---------- */
.end-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.2rem;
  margin: 1.3rem 0;
}
.end-score .who { text-align: center; }
.end-score .who .n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 2.4rem;
  display: block;
  color: var(--accent);
}
.end-score .who .l { font-size: 0.8rem; color: var(--ink-soft); font-weight: 700; }
.end-score .vs { color: var(--ink-soft); font-size: 1rem; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

footer.credit {
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
}
