/* Glyph One — v0
 *
 * Aesthetic: the single letter as a poster. Near-white ground (#F4F2EE,
 * Avi's brief). One typeface per round, set at 720pt. Chrome is small,
 * quiet, and out of the way. The reveal page is the artifact; everything
 * else is staging.
 *
 * Layout rule: the stage occupies the visual center. The chrome lives
 * above (puzzle no.) and below (the chips, or the craft note). The
 * stage's intrinsic size scales with viewport — at desktop the glyph
 * renders at the literal 720pt the brief specifies; on smaller viewports
 * it scales down with `clamp()` but never below ~32vh.
 */

:root {
  --bg: #F4F2EE;
  --ink: #15130E;
  --muted: #6B675E;
  --line-faint: rgba(21, 19, 14, 0.18);
  --hit: #15130E;
  --miss: #B23A1A;

  --chrome: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Inter', 'Helvetica Neue', sans-serif;

  --radius: 3px;
}

/* No dark mode for v0. The whole point is a near-white poster ground —
 * a dark reskin would be a different game. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--chrome);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header / footer chrome ─────────────────────────────────────────── */

header {
  text-align: center;
  padding: 1.75rem 1rem 0.5rem;
}

.puzzle-no {
  font-family: var(--chrome);
  font-size: 0.84rem;
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.puzzle-no .sep { padding: 0 0.1em; }

footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

footer .brand { color: var(--ink); }

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
}

/* ── Screens ────────────────────────────────────────────────────────── */

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

.round-header {
  width: 100%;
  text-align: center;
  margin-bottom: 0.5rem;
}

.round-counter {
  font-family: var(--chrome);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.round-counter .dot { padding: 0 0.4em; }

#rv-mark.hit  { color: var(--hit); }
#rv-mark.miss { color: var(--miss); }

/* ── Intro ──────────────────────────────────────────────────────────── */

#intro .rules {
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.7;
  margin: 1rem 0 2rem;
  color: var(--ink);
}

#intro .meta {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
}

/* ── The stage — where the 720pt letter lives ──────────────────────── */

.stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0 1.25rem;
  /* The brief says 720pt. 720pt = 960px at standard DPI. We let the
   * glyph use that as a target line-height-driven height; on narrow
   * viewports clamp scales it down. The stage's min-height keeps the
   * page from jumping when the glyph is replaced on reveal. */
  min-height: clamp(20rem, 60vh, 64rem);
}

.glyph {
  /* clamp(min, fluid, max):
   *   min  — readable on a phone (~20rem ≈ 240pt rendered)
   *   max  — the literal 720pt the brief calls for (≈ 960px)
   *   fluid — 90vh keeps it page-dominant on desktop
   */
  font-size: clamp(14rem, 90vh, 60rem); /* 60rem ≈ 960px ≈ 720pt */
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
  text-align: center;
  /* Subpixel hinting off — at this size we want the curves clean,
   * not snapped to pixels. */
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  /* Each glyph element's `style="font-family: ..."` is set by game.js
   * from the face's stack. */
}

/* The reveal stage: same dimensions, slightly different presence — the
 * letter on reveal is the *answer*, so we let it sit a hair calmer. */
.stage--reveal { margin-top: 0.5rem; }

/* ── Chips (the four typeface options) ─────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  max-width: 720px;
  width: 100%;
  padding: 0 0.5rem;
}

.chip {
  font-family: var(--chrome);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1.05rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-faint);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.25s ease;
  font-variant-ligatures: none;
  min-width: 8rem;
}

.chip:hover:not(:disabled) {
  border-color: var(--ink);
}

.chip:disabled {
  cursor: default;
}

.chip.hit {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.chip.truth {
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
}

.chip.miss {
  opacity: 0.32;
}

/* ── Craft note (the artifact line) ────────────────────────────────── */

.craft-note {
  /* The note is set in the typeface itself. Its inline `style` carries
   * the face stack and a refined size. Default size below is the
   * fallback; game.js sets `font-family` per round. */
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  line-height: 1.45;
  max-width: 38rem;
  text-align: center;
  color: var(--ink);
  margin: 0 auto 2rem;
  padding: 0 1rem;

  /* Fade-in. Hidden until game.js toggles `.visible`. */
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.7s ease 0.15s, transform 0.7s ease 0.15s;
}

.craft-note.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.primary {
  font-family: var(--chrome);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 0.7rem 1.6rem;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 1rem;
  transition: opacity 0.15s ease;
}

.primary:hover { opacity: 0.86; }

/* ── Finale / already-played ───────────────────────────────────────── */

#finale, #already {
  padding-top: 1rem;
}

.finale-score {
  font-family: var(--chrome);
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  margin: 0.75rem 0 1.5rem;
  font-variant-numeric: tabular-nums;
}

.finale-score .of {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 400;
}

.already-line {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0.5rem 0 0.25rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--line-faint);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 0.5rem auto 1.5rem;
  max-width: 28rem;
  width: 100%;
  text-align: center;
}

.card-title {
  font-family: var(--chrome);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.card-grid {
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  margin: 0.5rem 0 0.85rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.card-faces {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.6;
}

.card-footer {
  font-family: var(--chrome);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.1rem 0 0;
}

.share-status {
  margin: 0.5rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.84rem;
  min-height: 1.2em;
}

.next-puzzle {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  margin-top: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* ── Mobile niceties ───────────────────────────────────────────────── */

@media (max-width: 640px) {
  main { padding: 0.5rem 0.75rem 1.5rem; }
  .stage { min-height: clamp(14rem, 48vh, 24rem); }
  .glyph { font-size: clamp(9rem, 56vh, 22rem); }
  .chip { min-width: 0; flex: 1 1 calc(50% - 0.5rem); font-size: 0.86rem; padding: 0.55rem 0.5rem; }
}
