:root {
  --bg: #0c100c;
  --fg: #f4f1e8;
  --muted: #c5d0c2;
  --gold: #c6a15b;
  --line: #2c352b;
  --panel: #141a13;
  --green: #b6f3c6;
  --danger: #ffd0b0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--fg); overflow-x: clip; }

body {
  margin: 0 auto;
  max-width: 64rem;
  padding: 0 1rem calc(3rem + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--fg);
  font-family: Figtree, sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--fg);
  color: var(--bg);
  padding: 0.7rem 1rem;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus { top: 0.5rem; }

.prototype-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin: 0 -1rem 1rem;
  padding: 0.55rem 1rem;
  background: var(--panel);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 5;
}

.prototype-banner strong {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-end;
  margin-bottom: 0.8rem;
}

h1, h2, h3 {
  font-family: Newsreader, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 { font-size: clamp(2.2rem, 8vw, 3.4rem); line-height: 1.02; }

h2 { font-size: 1.55rem; line-height: 1.15; }

h3 { font-size: 1.28rem; line-height: 1.2; }

.kicker {
  margin: 0 0 0.2rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede { margin: 0.35rem 0 0; color: var(--muted); max-width: 38rem; }

.seat-note { margin: 0.2rem 0 0.8rem; color: var(--muted); font-size: 0.95rem; }
.seat-note a { color: var(--fg); }

.head-actions, .dialog-actions, .suggestion-actions, .capture-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.suggestion-actions { flex-direction: column; }
.suggestion-actions button { width: 100%; }

button, .page-foot a {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 999px;
  min-height: 48px;
  min-width: 48px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

button.primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  font-weight: 700;
}

button.quiet, button.soon { border-style: dashed; color: var(--muted); }

button.soon { cursor: not-allowed; }

button.plus {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
  flex: 0 0 auto;
}

.guardrails {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  list-style: none;
  background: #10160f;
  border: 1px solid var(--gold);
  border-radius: 14px;
}

.guardrails li {
  margin: 0;
  padding-left: 0.15rem;
  font-weight: 600;
}

.summary, .cards {
  display: grid;
  gap: 0.8rem;
}

.tile, .card, .suggestion, .deed, dialog {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.tile, .card, .suggestion, .deed { padding: 0.95rem 1rem 1rem; }

.big { margin: 0.25rem 0 0.7rem; font-size: 1.05rem; }

.figure {
  font-family: Newsreader, serif;
  font-size: 2rem;
  line-height: 1;
  margin-right: 0.25rem;
}

.fine { margin: 0.25rem 0 0; color: var(--muted); }

.gauge-track, .hours {
  position: relative;
  height: 14px;
  background: #0c100c;
  border: 1px solid var(--muted);
  border-radius: 999px;
  margin-top: 0.35rem;
}

.gauge-fill, .hours-fill {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: inherit;
}

.gauge-marker, .gauge-zero {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 24px;
  background: var(--fg);
  border-radius: 2px;
  transform: translateX(-50%);
}

.gauge-zero { background: var(--muted); width: 2px; }

.gauge-ends {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.section-head { margin: 1.35rem 0 0.7rem; }

.section-head h2 { margin-bottom: 0.2rem; }

.suggestion.is-serendipity { border-style: dashed; border-color: var(--gold); }

.rank {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  letter-spacing: 0;
}

.why-panel {
  margin: 0.55rem 0 0;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--gold);
  background: #10160f;
}

.card-head, .record {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.record { flex-wrap: wrap; }
.record > div { flex: 1 1 12rem; min-width: 0; }

.card-head { margin-bottom: 0.8rem; }

.ring {
  position: relative;
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
}

.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track { fill: none; stroke: #2c352b; stroke-width: 10; }

.ring-value { fill: none; stroke: var(--gold); stroke-width: 10; stroke-linecap: round; }

.tone-cream .ring-value { stroke: var(--fg); }

.tone-green .ring-value { stroke: var(--green); }

.ring-figure {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Newsreader, serif;
  font-size: 1.25rem;
}

.records, .countdown, .stages, .learned-list, .urgent-list, .guardrails {
  list-style: none;
  margin: 0;
  padding: 0;
}

.records li, .countdown-item, .learned-list li, .urgent-list li {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.item-title { margin: 0; font-weight: 600; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.status-new { color: var(--bg); background: var(--gold); border-color: var(--gold); }

.status-viewed { color: var(--fg); background: #243024; }

.status-matched, .status-open { color: #08210f; background: var(--green); border-color: var(--green); }

.status-open { color: var(--bg); background: var(--fg); border-color: var(--fg); }

.tape {
  min-width: 48px;
  padding: 0.35rem 0.7rem;
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.tape svg { width: 22px; height: 22px; }

.countdown {
  margin: 0.2rem 0 0 0.35rem;
  border-left: 3px solid var(--gold);
}

.countdown-item { position: relative; padding-left: 0.95rem; }

.countdown-item::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 1.15rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--panel);
}

.stages { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.6rem; }

.stages li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  color: var(--muted);
}

.stages li.done, .stages li[aria-current="step"] { color: var(--fg); font-weight: 600; }

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  flex: 0 0 auto;
}

.stages li.done .dot, .stages li[aria-current="step"] .dot {
  background: var(--gold);
  border-color: var(--gold);
}

.now {
  margin-left: 0.35rem;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#bell { position: relative; }

#bell-count {
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

dialog[open] {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  z-index: 40;
  margin: 0;
  transform: translateX(-50%);
}

dialog {
  width: min(40rem, calc(100vw - 1.25rem));
  max-height: 92vh;
  overflow: auto;
  padding: 1.1rem 1rem 1rem;
  box-shadow: 0 24px 70px #000c;
}

dialog::backdrop { background: rgba(6, 8, 6, 0.78); }

dialog h2 { margin-bottom: 0.45rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

.chips [role="radio"][aria-checked="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  font-weight: 700;
}

.review {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.45rem 0.75rem;
  margin: 0.8rem 0;
}

.review dt { color: var(--gold); font-weight: 700; }

.review dd { margin: 0; }

.hash {
  font-family: ui-monospace, monospace;
  font-size: 1rem;
  background: #0c100c;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  overflow-wrap: anywhere;
}

.master {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  margin: 0.9rem 0;
  font-weight: 700;
}

.master input { width: 1.4rem; height: 1.4rem; accent-color: var(--gold); }

.learned-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.learned-list li { padding: 0.4rem 0; }
.learned-list .item-title { flex: 1 1 auto; }
.learned-list button { flex: 0 0 auto; }

.urgent-list li { border-left: 3px solid var(--danger); padding-left: 0.7rem; }

.page-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.4rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

button.primary:focus-visible,
.chips [role="radio"][aria-checked="true"]:focus-visible {
  outline-color: #0c100c;
}

::selection { background: var(--gold); color: var(--bg); }

@media (min-width: 800px) {
  .summary { grid-template-columns: 1.35fr 0.85fr 0.85fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .stages { flex-direction: row; flex-wrap: wrap; gap: 0.4rem 1rem; }
  .suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; align-items: stretch; }
  .suggestion.is-serendipity { grid-column: 1 / -1; }
}

@media (max-width: 799px) {
  dialog { padding: 0.8rem 0.75rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .head-actions button { flex: 1 1 0; }
  .suggestions, .timeline { display: grid; gap: 0.8rem; }
  .dialog-actions button, .suggestion-actions button, .capture-row button, .page-foot button, .page-foot a {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
