/* 토큰·공통 요소. 원본은 reference/oracle.html 의 :root — 값을 바꾸면 그쪽과 함께 바꾼다.
   실험 장치(instrument·pads·strip·result·dist)는 아래 공통, 실험 하나에만 쓰는 것은 그 페이지의 <style>. */
:root {
  --paper: #eceff2;
  --panel: #f7f8fa;
  --ink: #161a22;
  --muted: #5d6573;
  --rule: #cfd4dc;
  --cobalt: #2a44c9;
  --cobalt-soft: #dfe4fb;
  --miss: #9aa2af;
  --display: "Gowun Batang", "Noto Serif KR", serif;
  --body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root {
  --paper: #11141a; --panel: #181c24; --ink: #e6e9ef; --muted: #98a0ae; --rule: #2b313c;
  --cobalt: #7f95ff; --cobalt-soft: #222a4d; --miss: #5a6170; color-scheme: dark } }

* { box-sizing: border-box; }
/* display 를 지정한 요소(.stage·.choices·.result…)에서도 hidden 이 이기게 — 없으면 숨긴 단계가 화면에 남는다 */
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.65;
  -webkit-text-size-adjust: 100%; word-break: keep-all; overflow-wrap: anywhere; }
a { color: inherit; text-underline-offset: 3px; }
.wrap { max-width: 640px; margin: 0 auto; padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 28px; }

.lab { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.lab a { text-decoration: none; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 8vw, 42px); line-height: 1.2; margin: 0; text-wrap: balance; }
.lede { margin: 10px 0 0; color: var(--muted); max-width: 34em; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { appearance: none; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 4px;
  padding: 10px 16px; font: 500 14px var(--body); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn:focus-visible, .card:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.toast { font-size: 12.5px; color: var(--muted); align-self: center; }

.note h2 { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0 0 8px; }
.note { display: flex; flex-direction: column; gap: 22px; }
.note p { margin: 0 0 10px; max-width: 36em; }
.note ul { margin: 0; padding-left: 1.2em; }
.note section { border-left: 2px solid var(--rule); padding-left: 14px; }
.reading { list-style: none; padding: 0 !important; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.reading li { font-size: 14px; }
.reading .t { font-family: var(--display); font-weight: 700; }
.foot { font-family: var(--mono); font-size: 11px; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 10px; }

/* 첫 화면 실험 목록 */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: block; height: 100%; padding: 16px 18px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
a.card:hover { border-color: var(--cobalt); }
.card .no { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; color: var(--muted); }
.card h2 { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.3; margin: 4px 0 2px; }
.card .who { font-size: 13px; color: var(--muted); margin: 0; }
.card .tag { display: inline-block; margin-top: 10px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--muted); }
a.card .tag { color: var(--cobalt); }
.card.off h2 { color: var(--muted); }

/* ── 실험 장치 공통 (01 프로토타입에서 옮김) ── */
.instrument { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.readout { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.big { font-family: var(--mono); font-size: clamp(44px, 13vw, 64px); line-height: 1; font-variant-numeric: tabular-nums; font-weight: 500; }
.big small { font-size: .4em; color: var(--muted); margin-left: 4px; }
.cap { font-size: 12.5px; color: var(--muted); }
.count { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.count b { font-size: 22px; font-weight: 500; }

/* minmax(0,1fr)·overflow — 1fr 이면 칸 안 기호의 대체 글리프 폭만큼 칸이 늘어나 360px 에서 화면이 530px 로 밀린다(01 프로토타입 그대로일 때) */
.strip { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 3px; }
.cell { aspect-ratio: 1; max-width: 100%; overflow: hidden; border-radius: 2px; background: transparent; border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 9px; display: grid; place-items: center; color: var(--muted); }
.cell.hit { background: var(--cobalt); border-color: var(--cobalt); color: var(--panel); }
.cell.miss { background: transparent; border-color: var(--miss); color: var(--ink); }
.cell.now { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--miss); }
.legend i.h { background: var(--cobalt); border-color: var(--cobalt); }

.status { min-height: 1.6em; font-size: 14px; text-align: center; }
.status .seal { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.status .hitword { color: var(--cobalt); font-weight: 600; }

.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pad { appearance: none; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 6px;
  padding: 26px 0; font-family: var(--mono); font-size: 30px; cursor: pointer; touch-action: manipulation;
  transition: transform .08s ease, background .15s ease; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pad span { font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.pad:active { transform: scale(.97); }
.pad:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.pad:disabled { opacity: .35; cursor: default; }
.kbd { text-align: center; font-size: 12px; color: var(--muted); }

.result { border-top: 1px solid var(--ink); padding-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.verdict { font-family: var(--display); font-size: clamp(24px, 6.5vw, 32px); line-height: 1.35; margin: 0; text-wrap: balance; }
.verdict em { font-style: normal; color: var(--cobalt); font-family: var(--mono); }

/* 참여자 분포 — lab.js renderDist. 내 구간만 cobalt + "나" 표지 */
.dist p { margin: 8px 0 0; }
.dist .msg { font-size: 13px; color: var(--muted); }
.dist svg { display: block; width: 100%; height: auto; overflow: visible; }
.dist .ax { fill: var(--muted); font: 10px var(--mono); }
.dist .base { stroke: var(--rule); }
.dist .half { stroke: var(--muted); stroke-dasharray: 3 4; }
.dist .bar { fill: var(--muted); }
.dist .bar.me { fill: var(--cobalt); }
.dist .me-label { fill: var(--ink); font: 600 12px var(--body); }
@media (prefers-color-scheme: dark) { .dist .bar:not(.me) { fill: var(--miss); } }
.dist .tick { stroke: var(--rule); }

/* 02~06 에서 쓰는 장치 */
.stage { min-height: 220px; border: 1px dashed var(--rule); border-radius: 6px; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); }
.btn.wide { width: 100%; padding: 16px; font-size: 16px; }
.btn:disabled { opacity: .35; cursor: default; }
.step { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }
.detail { margin: 0; }
@media (prefers-reduced-motion: reduce) { .pad { transition: none; } }
