:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --page: #f6f7fa;
  --paper: #ffffff;
  --ink: #142036;
  --muted: #4e5d73;
  --line: #dce3ed;
  --accent: #214bd0;
  --accent-soft: #ecf2ff;
  --ground-accent: #89530b;
  --radius: 20px;
  background: var(--page);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 1.25rem; }
body { margin: 0; line-height: 1.73; word-break: keep-all; overflow-wrap: break-word; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
h1, h2, h3 { line-height: 1.22; letter-spacing: -.035em; text-wrap: balance; }
a { color: #234bb0; text-underline-offset: .21em; }
a:hover { color: #172f83; }
button, input { font: inherit; }
button, summary, input[type="range"], input[type="checkbox"] { cursor: pointer; }
:focus-visible { outline: 3px solid #5074ed; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: absolute; top: .5rem; left: .5rem; padding: .6rem; background: var(--paper); transform: translateY(-150%); z-index: 5; }
.skip:focus { transform: none; }

.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.masthead-inner, main, .footer {
  width: min(calc(100% - 3rem), 1090px);
  margin-inline: auto;
}
.masthead-inner {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: .96rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.brand-wheel {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.brand-wheel::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  top: 5px;
  left: 5px;
}
nav { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem 1.35rem; }
nav a { color: var(--muted); font-weight: 640; font-size: .92rem; text-decoration: none; }
nav a:hover { text-decoration: underline; }

main { padding-bottom: 4rem; }
.flow > * + * { margin-top: .9rem; }
.intro { padding: clamp(2.25rem, 5vw, 3.65rem) 0 clamp(2.4rem, 4.2vw, 3.3rem); max-width: 840px; }
h1 { font-size: clamp(2.28rem, 6.2vw, 4.05rem); line-height: 1.12; font-weight: 790; }
.intro .lead {
  margin-top: 1.25rem;
  font-size: clamp(1.05rem, 2vw, 1.27rem);
  line-height: 1.65;
  max-width: 760px;
  color: var(--ink);
}
.intro > p:not(.lead) { color: var(--muted); max-width: 760px; }
.link-separator::before { content: ""; display: inline-block; width: .24em; height: .24em; border-radius: 50%; background: #7a879b; vertical-align: middle; margin: 0 .3em; }
.chapter + .chapter { margin-top: clamp(3.2rem, 7vw, 5.5rem); }
.section-heading { max-width: 780px; margin-bottom: 1.45rem; }
.section-heading h2 { font-size: clamp(1.71rem, 4vw, 2.75rem); margin-top: .36rem; }
.section-heading p:not(.section-label) { color: var(--muted); }
.section-label {
  color: var(--accent);
  font-size: .93rem;
  font-weight: 755;
}
.ground-label { color: var(--ground-accent); }

.experiment {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 28px #16295109;
}
.experiment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  min-width: 0;
}
.stage {
  color: #dfecff;
  position: relative;
  min-height: 350px;
  isolation: isolate;
}
.space-stage { background: #101c32; }
.ground-stage { background: #15252c; }
.stage canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-caption, .stage-key {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: 999px;
  padding: .3rem .72rem;
  background: #0f1a2bec;
  border: 1px solid #d3e4fc2c;
  color: #dce8f6;
  font-size: .86rem;
  font-weight: 650;
  pointer-events: none;
}
.stage-caption { top: 1rem; left: 1rem; }
.stage-key { right: .8rem; bottom: .75rem; }
.stage-key span { display: inline-block; width: .58rem; height: .58rem; background: #ffcf79; border-radius: 50%; }

.instrument { padding: clamp(.95rem, 2.1vw, 1.6rem); min-width: 0; }
.instrument-status { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .65rem; }
.status { font-size: 1.06rem; font-weight: 755; line-height: 1.4; min-block-size: 2.8em; }
.readout, .axis-table, .ground-metrics dd, output { font-variant-numeric: tabular-nums; }
.clock { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.measurement-note { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.axis-table { width: 100%; border-collapse: collapse; margin: 1.05rem 0 1.2rem; font-size: .94rem; }
.axis-table th, .axis-table td { padding: .39rem .28rem; border-bottom: 1px solid var(--line); }
.axis-table thead th { font-size: .88rem; color: var(--muted); }
.axis-table th:first-child { text-align: left; }
.axis-table :is(th, td):not(:first-child) { text-align: right; white-space: nowrap; }
.axis-dot { display: inline-block; width: .57rem; height: .57rem; border-radius: 50%; margin-right: .49rem; }
.axis-dot.x { background: #3868df; }
.axis-dot.y { background: #0c8273; }
.axis-dot.z { background: #ad5c1c; }
.controls { display: grid; gap: .85rem; }
.control-label { font-size: .93rem; color: var(--muted); font-weight: 720; margin-bottom: .35rem; }
.buttons { display: flex; flex-wrap: wrap; gap: .43rem; }
button {
  min-height: 41px;
  padding: .42rem .75rem;
  border: 1px solid #cbd6e7;
  border-radius: 8px;
  background: #f8faff;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 680;
  line-height: 1.35;
  text-align: center;
}
button:hover:not(:disabled) { border-color: #7996e1; background: #edf2fe; }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #153cae; border-color: #153cae; }
button.quiet { background: transparent; }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: #5575cb; color: #1b3f95; }
button:disabled { cursor: default; opacity: .5; }
.utility-buttons { margin-top: .1rem; }
button[data-space="pause"], button[data-ground="pause"] { min-inline-size: 6.1em; }
.try-it { padding: 1.05rem clamp(.95rem, 2.4vw, 1.7rem); border-top: 1px solid var(--line); background: #f1f5ff; }
.try-it p { margin-top: .24rem; color: #40526f; font-size: .96rem; }

.prose { max-width: 790px; margin: 1.9rem 0 0; color: #34435b; }
.prose h3 { margin-top: 2rem; color: var(--ink); font-size: clamp(1.14rem, 2.5vw, 1.45rem); }
.prose h3:first-child { margin-top: 0; }

.ground-experiment .try-it { background: #faf5ea; }
.ground-experiment .try-it p { color: #584931; }
.trial-phases {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .25rem;
  margin: .85rem 0 1rem;
  padding: 0;
  font-size: .8rem;
  line-height: 1.3;
  text-align: center;
  color: #546277;
}
.trial-phases li { padding: .45rem 0 .1rem; border-top: 2px solid #dce3eb; }
.trial-phases li[aria-current="step"] { border-color: #b16a16; color: #7e4108; font-weight: 750; }
.trial-phases li.is-past { border-color: #c3a172; }
.mode-picker { padding: 0; border: 0; margin: 0; min-width: 0; }
.segments { display: flex; flex-wrap: wrap; gap: .4rem; }
.segments label { position: relative; flex: 1 1 auto; cursor: pointer; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments span {
  display: grid;
  place-items: center;
  min-height: 41px;
  padding: .35rem .65rem;
  border-radius: 8px;
  border: 1px solid #cbd6e7;
  color: var(--ink);
  font-size: .91rem;
  font-weight: 650;
}
.segments input:checked + span { color: #7a460a; background: #fbf1dc; border-color: #c39056; }
.segments input:focus-visible + span { outline: 3px solid #5074ed; outline-offset: 2px; }
.segments label:hover span { border-color: #a2784b; }
.range-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .28rem .45rem; }
.range-field label, .range-field output, .checks { font-size: .91rem; }
.range-field label, .range-field output { font-weight: 650; }
.range-field output { color: var(--ground-accent); white-space: nowrap; }
.range-field input { grid-column: 1 / -1; width: 100%; margin: 0; min-height: 20px; accent-color: #9c611b; }
.checks { display: flex; flex-wrap: wrap; gap: .45rem 1rem; color: var(--muted); }
.checks label { display: inline-flex; align-items: center; min-height: 32px; gap: .28rem; cursor: pointer; }
.checks input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: #8c540f; }
.ground-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.ground-metrics > div { min-width: 0; padding: .82rem clamp(.72rem, 2.4vw, 1.45rem); }
.ground-metrics > div + div { border-left: 1px solid var(--line); }
.ground-metrics dt, .ground-metrics .metric-note { color: var(--muted); font-size: .83rem; }
.ground-metrics dd:not(.metric-note) { margin: .19rem 0; font-size: clamp(.98rem, 2vw, 1.2rem); font-weight: 745; line-height: 1.4; }
.plot-wrap { padding: .9rem clamp(.95rem, 2.4vw, 1.7rem) 1rem; border-top: 1px solid var(--line); }
.plot-wrap h3 { font-size: 1rem; }
.plot-wrap canvas { display: block; width: 100%; height: 157px; margin-top: .45rem; }
#ground-rpm-plot { height: 174px; }
.rpm-plot-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem 1rem;
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.rpm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .85rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .86rem;
  font-weight: 650;
}
.rpm-legend li { display: inline-flex; align-items: center; gap: .32rem; }
.rpm-legend li::before { content: ""; width: 1.25rem; border-top: 2px solid; }
.rpm-x { color: #2456c3; }
.rpm-y { color: #097367; }
.rpm-z { color: #9b510c; }
.rpm-legend .rpm-y::before { border-top-style: dotted; }
.rpm-legend .rpm-z::before { border-top-style: dashed; }

.principles { border-top: 1px solid var(--line); padding-top: clamp(1.7rem, 4.8vw, 3.5rem); }
.model-details { max-width: 790px; border: 1px solid var(--line); padding: .8rem 1rem; margin-top: 1.3rem; border-radius: 10px; background: var(--paper); }
.model-details summary { font-weight: 690; }
.model-details dl { display: grid; grid-template-columns: auto 1fr; column-gap: .85rem; row-gap: .35rem; margin-top: .7rem; color: var(--muted); }
.model-details dt { font-weight: 670; }
.model-details p { margin-top: .6rem; color: var(--muted); }
.footer { padding: 1.1rem 0 2rem; border-top: 1px solid var(--line); font-size: .93rem; }

@media (max-width: 750px) {
  .experiment-grid { grid-template-columns: minmax(0, 1fr); }
  .stage { min-height: clamp(285px, 62vw, 390px); }
  .instrument { padding: 1.05rem; }
}
@media (max-width: 525px) {
  .masthead-inner, main, .footer { width: calc(100% - 1.6rem); }
  .masthead-inner { flex-direction: column; align-items: flex-start; justify-content: center; padding-block: .55rem; }
  nav { gap: .23rem .85rem; }
  nav a { font-size: .87rem; }
  h1 { font-size: clamp(1.98rem, 8.3vw, 2.78rem); }
  .ground-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ground-metrics > div:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}
@media (pointer: coarse) {
  button, .segments span, .checks label { min-height: 44px; }
  .range-field input { min-height: 40px; }
}
