:root {
  color-scheme: dark;
  --paper: #16110d;
  --panel: #1c1510;
  --ink: #f3e7d3;
  --muted: #b8a48b;
  --faint: #8c7a66;
  --line: #3a2e25;
  --accent: #e9a65e;
  --rust: #ec7c58;
  --rain: #7eaac4;
  --select: #fff1d2;
  --pin: #9fd0e6;
  --serif: "Songti SC", "AppleMyungjo", "Noto Serif KR", "Batang", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-width: 280px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 60% at 22% 40%, #2a1d14 0%, transparent 70%),
    var(--paper);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
a, button, input { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #ffd39b; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead, .chronicle { width: min(1480px, calc(100% - 80px)); margin-inline: auto; }
.masthead { display: flex; justify-content: space-between; align-items: center; padding: 19px 0 17px; border-bottom: 1px solid var(--line); }
.masthead .brand { color: var(--ink); }
.masthead .brand-mark { background: var(--accent); }
.masthead .brand-period { color: var(--accent); }
.back { color: #ddcfb9; text-decoration: none; font-size: 14px; }
.back span { margin-left: 6px; color: var(--accent); }
.back:hover { color: var(--ink); text-decoration: underline; }

.chronicle { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr); gap: clamp(28px, 4vw, 64px); align-items: start; }

/* 고정 패널 */
.panel { position: sticky; top: 0; z-index: 2; height: 100svh; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 14px; padding: 16px 0 18px; }
.stage { position: relative; min-height: 0; margin: 0; }
#section { display: block; width: 100%; height: 100%; cursor: crosshair; border-radius: 6px; touch-action: manipulation; }
#section:focus-visible { outline: 2px solid #ffd39b; outline-offset: -2px; }
.stage-head { position: absolute; top: 6px; left: 2px; display: grid; gap: 2px; pointer-events: none; }
.stage-year { font: 500 clamp(44px, 5.4vw, 76px)/1 var(--serif); letter-spacing: -.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-rings { color: var(--accent); font: 600 12px/1.4 var(--mono); letter-spacing: .04em; }
.hint { position: absolute; left: 2px; bottom: 2px; max-width: 46ch; color: var(--faint); font-size: 12px; line-height: 1.5; pointer-events: none; }

.readout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 10px 24px; padding: 13px 0 0; border-top: 1px solid var(--line); }
.readout-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; min-height: 34px; }
.readout-kind { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.readout-kind.is-selected { color: var(--select); }
.readout h2 { font: 500 26px/1.1 var(--serif); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.clear { margin-left: auto; align-self: center; min-height: 30px; padding: 2px 11px; border: 1px solid #5b4836; border-radius: 30px; background: transparent; color: var(--muted); font-size: 12px; }
.clear:hover { color: var(--ink); border-color: var(--accent); }
.values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; align-content: start; }
.values div { min-width: 0; }
.values dt { color: var(--faint); font-size: 11px; letter-spacing: .03em; }
.values dd { margin: 0; font: 600 16px/1.35 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.values dd small { margin-left: 4px; color: var(--faint); font-size: 11px; font-weight: 500; }
#value-rain { color: #a9cbe0; }
#value-width { color: #f4c185; }
.record { color: #e6d6bf; font-size: 13.5px; line-height: 1.65; text-wrap: pretty; }
.record-source { display: block; margin-bottom: 2px; color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.record-source:empty { display: none; }
.compare { grid-column: 1 / -1; padding: 7px 10px; border-left: 2px solid var(--pin); background: #1d2328; color: #d7e7ee; font-size: 12.5px; line-height: 1.5; }
.core { grid-column: 1 / -1; }
.core-label { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; letter-spacing: .03em; }
.core-label span { font-family: var(--mono); }
#core { display: block; width: 100%; height: 56px; }

.strip { padding-top: 10px; border-top: 1px solid var(--line); }
.strip-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 11px; }
.strip-legend span::before { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; content: ''; }
.key-rain::before { background: #7eaac499; }
.key-width::before { height: 2px !important; vertical-align: 3px !important; background: var(--accent); }
.key-event::before { width: 0 !important; height: 0 !important; border: 5px solid transparent; border-top: 7px solid var(--rust); border-bottom: 0; vertical-align: 1px !important; }
#spark { display: block; width: 100%; height: 64px; margin-top: 6px; cursor: pointer; }
.strip-axis { display: flex; justify-content: space-between; margin-top: 3px; color: var(--faint); font: 10.5px var(--mono); }

/* 글 */
.pages { position: relative; z-index: 1; min-width: 0; }
.opening { min-height: calc(100svh - 70px); display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 40px 0 60px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 650; letter-spacing: .03em; }
.eyebrow span { margin: 0 6px; color: var(--faint); }
h1 { font: 500 clamp(56px, 6.4vw, 104px)/1.02 var(--serif); letter-spacing: -.07em; text-wrap: balance; }
h1 span { color: var(--accent); }
.lead { max-width: 34em; color: #e8dac4; font-size: clamp(16px, 1.25vw, 18px); line-height: 1.8; text-wrap: pretty; }
.notice { max-width: 34em; padding: 12px 14px; border: 1px solid #5a4533; border-radius: 4px; background: #221a13; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.notice strong, .colophon strong { color: var(--ink); }
.cue { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid #6b533d; border-radius: 40px; text-decoration: none; font-size: 14px; font-weight: 650; }
.cue:hover { background: var(--ink); color: var(--paper); }

.chapter { min-height: 165svh; padding: 30svh 0 12svh; }
.chapter-body { position: sticky; top: 22svh; }
.chapter-body > *, .explore > * { max-width: 32em; }
.years { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--accent); font: 600 13px var(--mono); letter-spacing: .02em; }
.years span { color: var(--muted); font-family: inherit; }
.years span::after { display: inline-block; width: 18px; height: 1px; margin-left: 12px; vertical-align: middle; content: ''; background: #6b533d; }
.chapter h2 { margin-bottom: 20px; font: 500 clamp(36px, 3.6vw, 56px)/1.1 var(--serif); letter-spacing: -.06em; text-wrap: balance; }
.chapter-body > p:not(.years), .explore > p:not(.years) { color: #e6d8c2; font-size: clamp(15.5px, 1.15vw, 17.5px); line-height: 1.9; text-wrap: pretty; }
.chapter-body > p + p { margin-top: 1em; }
.marks { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.mark { display: inline-flex; align-items: baseline; gap: 8px; min-height: 40px; padding: 8px 14px; border: 1px solid #5d4733; border-radius: 40px; background: #1f1812; font-size: 13.5px; font-weight: 600; text-align: left; }
.mark span { color: var(--rust); font: 600 12px var(--mono); }
.mark.release span, .mark.seed span, .mark.present span { color: var(--accent); }
.mark:hover, .mark[aria-pressed="true"] { border-color: var(--select); background: #2c2118; }

.explore { min-height: 100svh; padding-top: 24svh; }
.explorer { margin-top: 26px; display: grid; gap: 18px; }
.year-control label { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 13px; font-weight: 600; }
.year-control output { color: var(--select); font: 500 30px/1 var(--serif); letter-spacing: -.03em; }
.year-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 10px; align-items: center; margin-top: 8px; }
.step { width: 44px; height: 44px; border: 1px solid #5d4733; border-radius: 50%; background: #1f1812; font-size: 20px; line-height: 1; }
.step:hover { border-color: var(--accent); }
input[type="range"] { width: 100%; min-height: 32px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.pin { min-height: 42px; padding: 0 16px; border: 1px solid var(--pin); border-radius: 40px; background: transparent; color: var(--pin); font-size: 13.5px; font-weight: 650; }
.pin:hover { background: #1d2a31; }
.pin[aria-pressed="true"] { background: var(--pin); color: #10202a; }
.pin-note { color: var(--muted); font-size: 13px; }
.list-title { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
.event-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; border-block: 1px solid var(--line); background: var(--line); }
.event-list button { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; width: 100%; min-height: 44px; padding: 9px 6px; border: 0; background: var(--paper); text-align: left; }
.event-list button:hover { background: #211912; }
.event-list button[aria-current="true"] { background: #2b2018; box-shadow: inset 2px 0 var(--select); }
.event-list .when { color: var(--accent); font: 600 12.5px var(--mono); }
.event-list .what { font-size: 14px; font-weight: 600; }
.event-list .ratio { color: var(--faint); font: 12px var(--mono); white-space: nowrap; }
.event-list .ratio.narrow { color: var(--rust); }

.colophon { display: grid; gap: 14px; margin: 12svh 0 0; padding: 22px 0 40px; border-top: 1px solid var(--line); }
.colophon p { max-width: 36em; color: var(--muted); font-size: 13.5px; line-height: 1.75; }
.colophon a { justify-self: start; color: var(--ink); font-size: 14px; font-weight: 650; text-decoration: none; }
.colophon a span { color: var(--accent); }
.colophon a:hover { text-decoration: underline; }

@media (max-width: 1080px) {
  .masthead, .chronicle { width: calc(100% - 48px); }
  .chronicle { grid-template-columns: minmax(0, 1fr) minmax(300px, .9fr); }
  .readout { grid-template-columns: 1fr; }
  .values { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .core { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .masthead, .chronicle { width: calc(100% - 28px); }
  .masthead { padding: 13px 0 12px; }
  .masthead .brand { font-size: 19px; }
  .masthead .brand-mark { width: 18px; }
  .chronicle { display: block; }
  .panel {
    height: auto;
    grid-template-rows: auto auto auto;
    gap: 8px;
    margin-inline: -14px;
    padding: 8px 14px 10px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 24px -14px #000;
  }
  .stage { height: min(31svh, 270px); }
  .stage-year { font-size: 34px; }
  .stage-rings { font-size: 11px; }
  .hint { display: none; }
  .readout { gap: 6px; padding-top: 8px; }
  .readout-head { min-height: 0; gap: 8px; }
  .readout h2 { font-size: 20px; }
  .readout-kind { font-size: 11px; }
  .clear { min-height: 26px; padding: 0 9px; font-size: 11px; }
  .values { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; }
  .values dd { font-size: 13.5px; }
  .values dt { font-size: 10.5px; }
  .value-late { display: none; }
  .record { font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .record-source { display: inline; margin: 0 6px 0 0; }
  .compare { padding: 4px 8px; font-size: 11.5px; }
  .strip { padding-top: 6px; }
  .strip-legend { font-size: 10px; gap: 2px 10px; }
  .key-event { display: none; }
  #spark { height: 36px; margin-top: 3px; }
  .strip-axis { font-size: 9.5px; }
  .opening { min-height: 0; padding: 30px 0 40px; gap: 16px; }
  h1 { font-size: clamp(46px, 14vw, 64px); }
  .lead { font-size: 15px; }
  .chapter { min-height: 0; padding: 7svh 0 30svh; }
  .chapter-body { position: static; }
  .chapter h2 { font-size: clamp(30px, 9vw, 40px); margin-bottom: 14px; }
  .chapter-body > p:not(.years), .explore > p:not(.years) { font-size: 15px; line-height: 1.85; }
  .explore { min-height: 0; padding-top: 6svh; }
  .event-list button { grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; }
  .event-list .what { font-size: 13px; }
  .event-list .ratio { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
