:root {
  --bg: #fbf7f2;
  --ink: #1a1814;
  --muted: #7a766e;
  --rule: #d8d2c5;
  --accent: #2a4a3c;
  --field: #ffffff;
  --field-border: #c8c1b3;
  --kbd: #f0ebe0;
  --max: 560px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-serif: "Newsreader", "Iowan Old Style", "Charter", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

header {
  padding: 32px 24px 12px;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.tagline {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

main#app {
  flex: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.screen { display: none; }
.screen.active { display: block; }

.puzzle-no {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 0 0 4px;
}

.byline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  margin: 0 0 24px;
  color: var(--ink);
}

.byline a, .author-echo {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.streak-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
  padding: 14px 16px;
  margin: 0 0 22px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: color-mix(in srgb, var(--field) 72%, var(--bg));
}

.streak-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.streak-card strong {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
}

#streak-note {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 16px;
}

.rules {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 28px;
}

/* Buttons */

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--field-border);
  background: var(--field);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 4px;
  transition: background 0.1s, border-color 0.1s;
}

button:hover { border-color: var(--ink); }

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

button.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

button.primary:hover { background: var(--accent); border-color: var(--accent); }

.actions { display: flex; gap: 12px; align-items: center; }

/* Play screen */

/* Indicators-seen panel (Move 2). Setter's-index look: small mono,
   muted text, today bolded with "today" meta; prior bullets carry their
   first-seen date. No list markers; subtle rules between entries. */
.indicators-seen {
  list-style: none;
  padding: 0;
  margin: 28px 0 16px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.indicators-seen .indicator {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.indicators-seen .indicator + .indicator {
  border-top: 1px dotted var(--rule);
}

.indicators-seen .indicator.today {
  color: var(--ink);
}

.indicators-seen .indicator.today .indicator-name {
  font-weight: 600;
  letter-spacing: 0.08em;
}

.indicators-seen .indicator .indicator-name {
  text-transform: lowercase;
}

.indicators-seen .indicator .indicator-meta {
  font-variant-numeric: tabular-nums;
  text-transform: lowercase;
}

/* Mercy chip (Move 1). Sits between timer and hint-text in the meta row.
   Subtle — same mono register as the timer. Goes 'spent' (struck-through
   muted) after the budget fires. */
.mercy-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mercy-chip.spent {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  opacity: 0.7;
}

.clue {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.3;
  font-weight: 400;
  margin: 0 0 28px;
  letter-spacing: -0.005em;
}

form#guess-form { margin-bottom: 18px; }

input#guess-input {
  display: block;
  width: 100%;
  font: 500 22px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
}

input#guess-input:focus {
  outline: none;
  border-color: var(--ink);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 28px;
}

.timer { font-variant-numeric: tabular-nums; }
.hint-text { font-style: italic; font-family: var(--font-serif); font-size: 15px; }

/* Result */

.result-line {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 8px;
}

.result-line.solved { color: var(--accent); }
.result-line.failed { color: var(--ink); }

/* Parse overlay (Move 3). Three rows in the same frame:
   - player's typed guess (mono, uppercase)
   - surface text in serif with the indicator word inline-boxed
   - the answer rendered inside its fodder context (mono, lowercase with the
     answer uppercase-bold). The diff IS the result; no separate Compare. */
.parse-overlay {
  margin: 24px 0 28px;
  padding: 0;
}

.parse-row {
  margin: 0;
  text-align: center;
  line-height: 1.35;
}

.parse-row-guess {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.parse-row-guess.matched {
  color: var(--accent);
}

.parse-row-surface {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 12px;
  letter-spacing: -0.005em;
}

.parse-indicator-box {
  /* Typographic emphasis, not a UI button. A 1px dotted underline reads as
     setter's notation rather than as an affordance. */
  border-bottom: 1px dotted var(--ink);
  padding-bottom: 1px;
  color: var(--ink);
}

.parse-row-fodder {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: lowercase;
}

.parse-answer {
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.craft-note {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  margin: 0 0 28px;
}

.craft-from {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: uppercase;
}

.craft-note p:not(.craft-from) {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  font-style: italic;
  margin: 0;
}

.share-preview {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 14px;
  background: var(--kbd);
  border-radius: 4px;
  user-select: all;
  margin-top: 16px;
  word-break: break-word;
}

/* Author screen */

.author-name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 30px;
  margin: 6px 0 16px;
}

.author-bio, .author-schedule {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 16px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 24px;
  border-top: 1px solid var(--rule);
}

footer a { color: var(--muted); }

@media (max-width: 480px) {
  .clue { font-size: 24px; }
  .answer { font-size: 28px; }
  .wordmark { font-size: 24px; }
}
