:root {
  --bg: #e5efe8;
  --ink: #17211e;
  --muted: #5b6b65;
  --card: #fbfaf6;
  --line: #d2ddd5;
  --teal: #0c5c53;
  --teal-dark: #10211d;
  --teal-soft: #e5f3ef;
  --amber: #8a4f12;
  --amber-bg: #f8f1e2;
  --danger: #8d2f2f;
  --shadow: 0 1px 0 rgba(16, 33, 29, 0.04), 0 16px 40px rgba(16, 33, 29, 0.06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --pad: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, #f7f3e8 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100vh;
}
body.is-night {
  background: #101614;
  color: #f4efe6;
}
img, video { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--teal); }
body.is-night a { color: #d5efe8; }

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  padding: 8px 12px;
  background: white;
  z-index: 5;
}

.topbar {
  background: var(--teal-dark);
  color: #f4efe6;
  padding: calc(14px + env(safe-area-inset-top)) var(--pad) 14px;
}
.topbar-inner, .sheet, .night-main {
  width: min(40rem, 100%);
  margin: 0 auto;
}
.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.brand h1 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}
.brand p, .kicker {
  margin: 2px 0 0;
  color: #c9ddd6;
  font-size: 0.92rem;
}
.brand .pill {
  border: 1px solid rgba(244, 239, 230, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trial-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0;
  padding: 7px 14px;
  padding-top: calc(7px + env(safe-area-inset-top));
  background: #10211d;
  color: #f4efe6;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}
.sheet .kicker { color: var(--muted); }

.sheet { padding: 18px var(--pad) calc(28px + env(safe-area-inset-bottom)); }
.night-main {
  padding: calc(18px + env(safe-area-inset-top)) var(--pad) calc(24px + env(safe-area-inset-bottom));
}

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
  background: var(--teal-soft);
  border: 1px solid #c5e0d8;
}
.flash.bad {
  background: #f8e8e4;
  border-color: #e4c4bc;
  color: #6d2424;
}
body.is-night .flash.bad { background: #3a2422; color: #f3d2cb; border-color: #5a3934; }

h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 8px; }
h3 { font-size: 1.15rem; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 16px; }
body.is-night .lede, body.is-night .hint, body.is-night .muted { color: #c9d5cf; }

.choice-row { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .choice-row.two { grid-template-columns: 1fr 1fr; }
}
.choice {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  min-height: 112px;
}
.choice:hover { border-color: var(--teal); }
.choice span { display: block; color: var(--muted); margin-top: 6px; font-size: 0.95rem; }
.choice strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
body.is-night .card {
  background: #1a2420;
  border-color: #31423c;
  box-shadow: none;
}
.card + .card { margin-top: 12px; }
.card h2 { font-size: 1.35rem; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 14px;
}
.steps a, .clip-tab {
  flex: 0 0 auto;
  text-decoration: none;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
  font-size: 0.92rem;
}
.steps span {
  flex: 0 0 auto;
  opacity: 0.4;
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.opt {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  cursor: pointer;
}
.opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.opt:has(input:checked),
.steps a[aria-current="step"], .clip-tab[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
body.is-night .clip-tab[aria-pressed="true"] { background: #d7efe8; color: #10211d; }

.field { margin: 0 0 14px; }
.lbl { display: block; font-weight: 650; margin-bottom: 6px; }
.hint, .muted { color: var(--muted); font-size: 0.92rem; }
.hint { margin: 6px 0 0; }
input[type="text"], input[type="number"], textarea {
  width: 100%;
  border: 1px solid #c5d2cb;
  background: white;
  border-radius: 12px;
  padding: 12px 12px;
  font-size: 16px;
  min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
body.is-night input, body.is-night textarea {
  background: #101614;
  border-color: #3d514a;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
body.is-night .check { border-top-color: #31423c; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button, .btn {
  border-radius: 12px;
  border: 1px solid #c5d2cb;
  background: white;
  min-height: 48px;
  padding: 10px 14px;
  cursor: pointer;
}
body.is-night .seg button, body.is-night .btn {
  background: #101614;
  border-color: #3d514a;
  color: inherit;
}
.seg button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.seg button small { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; }
.seg button[aria-pressed="true"] small { color: rgba(255,255,255,.8); }
.opt { text-align: left; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: white; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: #e0b4b0; color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }

.night-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
body.is-night .night-row { border-top-color: #31423c; }
.night-row:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 560px) {
  .night-row { flex-direction: column; align-items: stretch; }
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.tag.warn { background: var(--amber-bg); color: var(--amber); }
.tag.example { background: #efe6f4; color: #5d3f78; }
.tag.neutral { background: #eef1ef; color: #3e4b46; }

.callout {
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.callout.warn {
  border-left-color: var(--amber);
  background: var(--amber-bg);
  color: #5c3b10;
}
body.is-night .callout { background: #24312c; color: inherit; }
body.is-night .callout.warn { background: #3a301f; color: #f3e6cf; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }

.clock {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-size: clamp(4.5rem, 24vw, 7rem);
  line-height: 0.9;
  text-align: center;
  margin: 8px 0 4px;
  letter-spacing: -0.04em;
}
.clock-caption { text-align: center; margin: 0 0 12px; color: #c9d5cf; }
.rec-track {
  height: 8px;
  background: #2a3833;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 16px;
}
.rec-bar { height: 100%; width: 0; background: #e2b15a; }
.video-frame {
  background: #070b09;
  border-radius: 16px;
  overflow: hidden;
  margin: 8px 0 12px;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
}
.video-frame video { width: 100%; height: 100%; object-fit: contain; background: #070b09; }
.live-dot { color: #e2b15a; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; text-align: center; }

.clip-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.big-score {
  font-family: var(--serif);
  font-size: 3.4rem;
  line-height: 0.9;
  margin: 0;
  letter-spacing: -0.03em;
}
.score-line { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.kv { margin: 8px 0 0; }
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.kv dt { font-weight: 400; color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
body.is-night .kv div { border-top-color: #31423c; }

.stratum {
  display: block;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 0 0 8px;
  background: white;
}
.stratum:has(input:checked) { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.stratum input { margin-right: 8px; }
.stratum .state { color: var(--amber); font-size: 0.85rem; font-weight: 700; }

.event { padding: 8px 0; border-top: 1px solid var(--line); }
.event strong { display: block; }
ol.flow { margin: 8px 0 0; padding-left: 1.2rem; }
ol.flow li { margin: 6px 0; }
ul.clean { margin: 8px 0 0; padding-left: 1.1rem; }
ul.clean li { margin: 6px 0; }

.summary { width: min(46rem, 100%); }
.summary h2 { font-size: 1.6rem; }
.print-disclaimer {
  border: 1.5px solid var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 650;
}
.watermark {
  border: 1px dashed #5d3f78;
  color: #5d3f78;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

footer.site {
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 4px var(--pad) calc(24px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.88rem;
}
footer.site a { color: inherit; }

details { margin-top: 8px; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

:focus-visible {
  outline: 3px solid #0c5c53;
  outline-offset: 2px;
}
body.is-night :focus-visible { outline-color: #e2b15a; }

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

.clip-block + .clip-block { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.clip-block h3 { margin-bottom: 0; }

@media print {
  html, body { min-height: 0 !important; height: auto !important; background: white !important; color: black !important; }
  .trial-bar { position: static; background: white; color: black; border-bottom: 1px solid black; padding: 4px 0; font-size: 9pt; }
  body { font-size: 10pt; line-height: 1.25; }
  .no-print { display: none !important; }
  .sheet, .summary, .topbar-inner { width: auto; max-width: none; padding: 0 !important; }
  .card { break-inside: auto; box-shadow: none; border: none; border-radius: 0; padding: 2px 0 6px; margin: 0 0 4px; border-bottom: 1px solid #ccc; }
  .clip-block, .kv div, .print-disclaimer { break-inside: avoid; }
  .kv div { padding: 1px 0; }
  h2 { font-size: 15pt; margin: 0 0 4px; }
  h3 { font-size: 11pt; margin: 2px 0; }
  .hint, p { margin: 2px 0; }
  .print-disclaimer { border-color: black; padding: 6px 8px; margin: 4px 0; }
  a { color: inherit; text-decoration: none; }
  @page { size: A4; margin: 10mm; }
}
