/* ============================================================
   Rhythm & Ink — "Guess the Artist" game
   Editorial, restrained, not gamey. All values come from the
   design tokens in css/theme/ — never hardcode (see project
   convention). The credibility work is done by the sourced
   dossier, not by visual noise.
   ============================================================ */

.game-page {
  max-width: 48rem;
  margin: 0 auto;
  /* --space-xl, the site-wide opening inset, above the LOCKED 4.5rem
     .main-content clearance. The old --space-2xl cited a 3.5rem clearance that
     no longer exists (it was locked at 4.5rem), so the extra step was a stale
     compensator. */
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
}

/* The HTML `hidden` attribute must win over any component `display` rule
   (e.g. the flex guess form), so JS toggling `hidden` actually hides things. */
.game-page [hidden] {
  display: none !important;
}

/* --- Header --- */
.game-header {
  text-align: center;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.game-kicker {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-subtle-text);
}

.game-number {
  color: var(--color-accent);
}

.game-deck {
  font-family: var(--font-content);
  font-size: var(--font-size-md);
  color: var(--color-body-text);
  line-height: var(--line-height-body);
  margin-top: var(--space-xs);
}

/* --- Board --- */
.game-board {
  text-align: center;
}

/* Once the round is over the dossier replaces the playable board, so collapse
   the graph, clues, guess form, and track — leaving nothing to interact with
   (and no stale "N guesses left"). */
.game-board--done .game-prompt,
.game-board--done .game-prompt-help,
.game-board--done .game-graph,
.game-board--done .game-clues,
.game-board--done .game-guess,
.game-board--done .game-guess-meta,
.game-board--done .game-guess-track,
.game-board--done .game-wrong {
  display: none;
}

.game-prompt {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold-heading);
  line-height: var(--line-height-tight);
  color: var(--color-heading);
  margin-bottom: var(--space-xs);
}

.game-prompt-help {
  font-family: var(--font-content);
  color: var(--color-subtle-text);
  margin-bottom: var(--space-lg);
}

/* --- Graph (hidden center) --- */
.game-graph {
  width: 100%;
  height: 22rem;
  margin: 0 auto var(--space-lg);
}

.game-graph-link {
  stroke: var(--color-border);
  stroke-width: 1;
}

.game-graph-node {
  fill: var(--color-viz-influence);
  stroke: var(--color-bg);
  stroke-width: 2;
}

.game-graph-label {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  fill: var(--color-body-text);
}

/* The hidden subject reads as a "redacted" medallion: a calm tan disc ringed in
   the brand accent, with a single editorial serif "?" — deliberate, not the
   gamey dashed-circle-plus-heavy-glyph default. */
.game-graph-center {
  fill: var(--color-background-tan);
  stroke: var(--color-accent);
  stroke-width: 1.5;
}

.game-graph-center-mark {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold-heading);
  font-style: italic;
  fill: var(--color-accent);
}

/* --- Clues --- */
.game-clues {
  margin-bottom: var(--space-lg);
  text-align: left;
}

.game-clues-label {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-subtle-text);
  margin-bottom: var(--space-xs);
}

.game-clues-count {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.game-clue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.game-clue {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
}

.game-clue-type {
  font-family: var(--font-ui);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent);
  white-space: nowrap;
}

.game-clue-name {
  font-family: var(--font-content);
  font-size: var(--font-size-md);
  color: var(--color-heading);
}

/* --- Guess form + typeahead --- */
.game-guess {
  display: flex;
  align-items: stretch;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.game-guess-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0; /* let the field shrink instead of crowding the button */
}

.game-guess-input {
  width: 100%;
  box-sizing: border-box; /* keep padding/border inside the field, not under the button */
  font-family: var(--font-content);
  font-size: var(--font-size-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-body-text);
}

.game-guess-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

.game-guess-button {
  flex: 0 0 auto; /* never compress into the input */
  font-family: var(--font-ui);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-white);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.game-guess-button:hover {
  background: var(--color-accent-hover);
}

.game-typeahead {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--space-xxs));
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  display: none;
  text-align: left;
}

.game-typeahead.open {
  display: block;
}

.game-typeahead-item {
  font-family: var(--font-content);
  padding: var(--space-xs) var(--space-md);
  cursor: pointer;
}

.game-typeahead-item:hover {
  background: var(--color-bg-subtle);
}

/* --- Guess meta + track --- */
.game-guess-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  color: var(--color-subtle-text);
  margin-bottom: var(--space-sm);
}

.game-guess-error {
  color: var(--color-error);
}

.game-guess-track {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: var(--space-xxs);
  padding: 0;
  margin: 0 0 var(--space-xl);
}

.game-track-cell {
  width: var(--space-md);
  height: var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.game-track-cell.miss {
  background: var(--color-heading);
  border-color: var(--color-heading);
}

/* --- Already-tried guesses ---
   Named list of the player's spent wrong guesses, so they don't re-try an
   artist they've already ruled out. Quiet and struck-through — a record, not
   an error. */
.game-wrong {
  margin: 0 0 var(--space-xl);
  text-align: center;
}

.game-wrong-label {
  font-family: var(--font-ui);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-subtle-text);
  margin-bottom: var(--space-xs);
}

.game-wrong-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.game-wrong-item {
  font-family: var(--font-content);
  font-size: var(--font-size-sm);
  color: var(--color-subtle-text);
  text-decoration: line-through;
  text-decoration-color: var(--color-border);
  padding: var(--space-xxs) var(--space-sm);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
}

/* --- Dossier (after the round) --- */
.game-dossier {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 2px solid var(--color-divider);
  text-align: left;
  /* When JS scrolls the reveal into view, keep it clear of the fixed header. */
  scroll-margin-top: var(--space-3xl);
}

.game-dossier-heading {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent);
}

.game-dossier-reveal {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  color: var(--color-heading);
  margin-bottom: var(--space-sm);
}

.game-dossier-lead {
  font-size: var(--font-size-lg);
  color: var(--color-subtle-text);
}

.game-dossier-credibility {
  font-family: var(--font-content);
  font-style: italic;
  color: var(--color-body-text);
  line-height: var(--line-height-body);
  margin-bottom: var(--space-xl);
}

.game-dossier-group-title {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-subtle-text);
  margin: var(--space-lg) 0 var(--space-xs);
}

.game-dossier-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.game-dossier-item {
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-divider);
}

.game-dossier-neighbor {
  font-family: var(--font-content);
  font-size: var(--font-size-lg);
  color: var(--color-heading);
}

/* Co-answers ("Also matches today's clues") — genuine peers, rendered as
   links, never as runner-ups. */
.game-dossier-peer {
  font-family: var(--font-content);
  font-size: var(--font-size-lg);
  color: var(--color-accent);
  text-decoration: none;
}

.game-dossier-peer:hover {
  text-decoration: underline;
}

.game-dossier-sources {
  list-style: none;
  padding: 0;
  margin: var(--space-xxs) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
}

.game-dossier-source {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  color: var(--color-accent);
  text-decoration: none;
}

.game-dossier-source:hover {
  text-decoration: underline;
}

.game-dossier-cta {
  display: inline-block;
  margin-top: var(--space-xl);
  font-family: var(--font-ui);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  text-decoration: none;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.game-dossier-cta:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

/* --- Replay state --- */
.game-share {
  text-align: center;
  margin-top: var(--space-xl);
}

.game-come-back {
  font-family: var(--font-content);
  font-style: italic;
  color: var(--color-subtle-text);
  margin-top: var(--space-sm);
}

/* --- Stats / invite --- */
.game-stats,
.game-invite {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-divider);
  text-align: center;
}

.game-stats-heading,
.game-invite-heading {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-subtle-text);
  margin-bottom: var(--space-md);
}

.game-stats-grid {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin: 0;
}

.game-stat {
  text-align: center;
}

.game-stat dd {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  color: var(--color-heading);
  margin: 0;
}

.game-stat dt {
  font-family: var(--font-ui);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-subtle-text);
}

.game-invite-body {
  font-family: var(--font-content);
  color: var(--color-body-text);
  margin-bottom: var(--space-md);
}

.game-invite-cta {
  display: inline-block;
  font-family: var(--font-ui);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-white);
  text-decoration: none;
}

/* --- Responsive --- */
@media (max-width: 54rem) { /* --bp-phone */
  /* The shorter mobile header doesn't need the full desktop top padding,
     and the kicker no longer tucks under it — pull the board up. */
  .game-page {
    padding-top: var(--space-lg);
  }

  .game-header {
    margin-top: var(--space-md);
  }
}

@media (max-width: 36rem) { /* --bp-phone-sm */
  .game-guess {
    flex-direction: column;
  }

  .game-stats-grid {
    gap: var(--space-md);
  }

  .game-dossier-reveal {
    font-size: var(--font-size-2xl);
  }
}
