:root {
  color-scheme: dark;
  --bg: #12110f;
  --surface: #1c1915;
  --ink: #f4efe6;
  --muted: #c8bba8;
  --faint: #a39686;
  --line: #3a342c;
  --accent: #ef6a33;
  --accent-ink: #1a0d06;
  --good: #c6e3a1;
  --warn: #f0d48a;
  --bad: #f0b2a4;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f1e8;
    --surface: #fffdf8;
    --ink: #1c1612;
    --muted: #5c5348;
    --faint: #6e655b;
    --line: #e4d9c8;
    --accent: #c44b1a;
    --accent-ink: #fff8f4;
    --good: #2f6b32;
    --warn: #8a5a10;
    --bad: #9c341c;
    --shadow: 0 16px 36px rgba(70, 42, 16, 0.08);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(239, 106, 51, 0.18), transparent 55%),
    radial-gradient(700px 380px at 110% 0%, rgba(198, 227, 161, 0.08), transparent 50%),
    var(--bg);
}

.wrap {
  width: min(40rem, calc(100% - 2rem));
  margin-inline: auto;
  padding-block: 1.5rem 4rem;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark { width: 40px; height: 40px; flex: none; }

.kicker, .eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

h1, h2, .move-kicker {
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.15rem);
  line-height: 1.05;
}

h2 {
  margin: 0.2rem 0 0.4rem;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.15;
}

.streak {
  margin: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}

.streak[data-on="1"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

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

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 1rem;
}

.tabs button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 6px;
}

.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.banner {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 18%, var(--surface));
  color: var(--ink);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem 1.15rem 1.15rem;
  box-shadow: var(--shadow);
}

.why, .note, .hint, footer p, noscript p {
  color: var(--muted);
}

.why { margin: 0 0 1rem; }

fieldset {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--faint);
}

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.steps label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.steps label:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.steps input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  flex: none;
}

.log-row, .button-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.field { display: grid; gap: 6px; flex: 1; min-width: 0; }

.field span, .story-grid .field span {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--faint);
}

select, textarea, button { font: inherit; color: inherit; }

select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  font-size: 1rem;
}

textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }

.primary, .ghost, .link-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 1.05rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.note, .hint, .stats, .verdict { margin: 0.75rem 0 0; }

.verdict { color: var(--ink); font-weight: 600; }
.verdict[data-v="tight"] { color: var(--good); }
.verdict[data-v="long"], .verdict[data-v="fat"] { color: var(--warn); }
.verdict[data-v="incomplete"] { color: var(--muted); font-weight: 500; }

.story-grid { display: grid; gap: 12px; }

.bones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}

.bones li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.88rem;
  color: var(--faint);
}

.bones li.ok {
  border-color: var(--good);
  color: var(--good);
}

.bones li.miss {
  border-color: var(--bad);
  color: var(--bad);
}

.button-row { margin-top: 0.9rem; flex-wrap: wrap; }

.stack { display: grid; gap: 10px; }

.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
}

.pillar h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }

.pillar-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}

.pillar-btn .num {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-right: 0.4rem;
}

.chev {
  color: var(--faint);
  font-weight: 500;
  flex: none;
}

.pillar .line { margin: 0.15rem 0 0; color: var(--muted); }

.moves { margin: 0.75rem 0 0; padding-left: 1.15rem; display: grid; gap: 0.4rem; }
.moves li::marker { color: var(--accent); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  background: var(--bg);
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.chip:has(input:checked) {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.chip .hint-bit {
  display: block;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 500;
}

.chip:has(input:checked) .hint-bit { color: inherit; opacity: 0.75; }

#rooms { display: grid; grid-template-columns: repeat(3, 1fr); }
.room-chip { flex-direction: column; align-items: flex-start; border-radius: 14px; width: 100%; }

.move {
  border-left: 4px solid var(--accent);
  padding: 0.2rem 0 0.2rem 0.9rem;
  margin-top: 0.4rem;
}

.move-kicker {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.1;
}

.move-line { margin: 0.35rem 0 0; font-size: 1.08rem; }

footer { margin-top: 1.5rem; }
footer p, noscript p { font-size: 0.95rem; }

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

.chip:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .log-row { flex-direction: column; align-items: stretch; }
  .primary, .ghost { width: 100%; }
  #rooms { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .tabs button { font-size: 0.86rem; padding-inline: 2px; }
  .streak { font-size: 0.82rem; padding-inline: 0.65rem; }
}

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