/* 가상 분광기: '종이 위 그림' (studio/DESIGN.md, 2026-10-17)
   - 틀(위 막대·판·단추·창)은 공용 묶음 kit/paper.css(빌드가 studio/_kit에서 복사)의 토큰과 부품을 그대로 쓴다:
     .k-btn·.k-primary(단추), .k-seg·.k-on(고른 상태 = 굵은 글자 + 칸 아래 3px 막대), .k-range(슬라이더),
     .k-w(범례 낱말), .k-link(진행 지우기), .k-dark(어두운 그림 위 초점 링), [hidden] !important.
     이 파일에는 배치와 이 작품의 대상 색만 둔다.
   - 어두운 그림은 둘이다: 3D 실험실(#fig)과 분광기 접안 화면(#eyeWrap). 둘 다 흰 종이 위에 놓인 그림이다.
     5단계 에너지 준위 그림(#lvBox)은 종이 위 그래프다.
   - 같은 대상은 같은 색: 스펙트럼 선·관·광자는 그 빛의 색(파장에서 계산), 커서와 λ 읽음값은 잉크(그림 안은 흰색),
     읽은 선·들어 있음 표시는 초록 ✓, 들뜸(흡수) 전이는 보라 점선, 떨어짐(방출) 전이는 그 광자의 색 실선.
   - 반경: 단추·입력·세그먼트 var(--k-r), 판·그림·그래프·꼬리표·창 0, 끄는 점만 원. */
:root {
  --ok-p: #237032;  --ok-d: #7dffc4;    /* 읽은 선·들어 있음 ✓ */
  --bad-p: #c92a2a;
  --up-p: #6741d9;                       /* 들뜸(에너지를 얻어 올라감) */
  --scene: #05070b;  /* 3D 실험실 바탕(scene.js BG_LAB) */
  --hdr: 52px;
  --pw: clamp(260px, 30%, 380px);
  --tap: 40px;
  --specH: clamp(170px, 37vh, 300px);
  font-family: var(--k-font);
  color: var(--k-ink);
  -webkit-text-size-adjust: 100%;
}
@media (max-height: 560px) { :root { --tap: 36px; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--k-paper); color: var(--k-ink); font-family: var(--k-font);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* 줄바꿈: 한국어는 어절, 영어는 낱말, 일본어는 구절·금칙. 가운뎃점·괄호·숫자 단위는 i18n.js의 wrapText·keepWords가 맡는다 */
html { overflow-wrap: break-word; -webkit-hyphens: none; hyphens: none; }
html:lang(ko) { word-break: keep-all; }
html:lang(ja) { word-break: auto-phrase; line-break: strict; }
/* 사파리(auto-phrase 없음): 문구에 넣은 U+200B(구절 경계, i18n.js는 이때만 넣는다)에서만 줄을 바꾼다 */
@supports not (word-break: auto-phrase) { html:lang(ja) { word-break: keep-all; } }
.nb { white-space: nowrap; }
button { font-family: inherit; font-size: 14px; color: inherit; cursor: pointer; }
button:focus-visible, canvas:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--k-ink); outline-offset: 2px; }
button:disabled { cursor: default; opacity: 0.45; }
b { font-weight: 800; }
sub, sup { font-size: max(12px, 0.74em); line-height: 0; }

#app {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pw);
  grid-template-rows: var(--hdr) minmax(0, 1fr) var(--specH);
  grid-template-areas: "top top" "view side" "spec spec";
  background: var(--k-paper);
}

/* ── 위 막대 ── */
#top { grid-area: top; display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; min-width: 0; }
.icon { flex: none; width: var(--tap); height: var(--tap); border: 0; border-radius: var(--k-r); background: none; display: grid; place-items: center; padding: 0; color: var(--k-ink); }
@media (hover: hover) { .icon:hover { background: var(--k-wash); } }
#chap { flex: 1; min-width: 0; display: flex; align-items: center; padding: 0 6px; font-size: 15px; line-height: 1.3; }
#chap .in { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0; }
#chap.noSub #chName { display: none; } /* 두 줄에 다 들어가지 않으면 부제를 접는다(main.js fitChap) */
#chTag { font-weight: 800; margin-right: 0.45em; }
#chTag:empty { display: none; }
#chName { font-weight: 500; color: var(--k-ink-2); }
body.starting #chap { font-size: 17px; }
body.starting #chName { font-weight: 800; color: var(--k-ink); }
body.starting #btnMenu, body.starting #tabs { visibility: hidden; }
#tabs { display: flex; align-items: center; gap: 2px; flex: none; min-width: 0; overflow: hidden; }
#tabs .lb { flex: none; font-size: 15px; font-weight: 800; margin: 0 8px 0 4px; white-space: nowrap; }
#tabs button {
  flex: none; position: relative; height: var(--tap); min-width: 34px; padding: 0 8px; border: 0; border-radius: 0; background: none;
  color: var(--k-sub); font-size: 15px; font-weight: 650; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 5px;
}
#tabs button .n { font-variant-numeric: tabular-nums; }
#tabs button .t { display: none; }
#tabs .pip { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); display: flex; gap: 2px; }
#tabs .pip i { width: 5px; height: 5px; box-shadow: inset 0 0 0 1px var(--k-ctl); }
#tabs .pip i.on { background: var(--k-ink); box-shadow: none; }
#tabs.story button { padding-bottom: 8px; }
@media (hover: hover) { #tabs button:not(.k-on):hover { background: var(--k-wash); color: var(--k-ink); } }
html.free:not(.tabsHidden) #chap { display: none; }
html.tabsHidden #tabs { display: none; }
html.free #tabs { flex: 1; }
html.free #tabs button .t { display: inline; }
html.free #tabs.nolb .lb { display: none; }
html.free #tabs.num button:not(.k-on) .t, html.free #tabs.min button .t { display: none; }
html.free #tabs.min { gap: 0; }
html.free #tabs.min button { min-width: 32px; padding: 0 4px; }
@media (max-width: 760px) { html:not(.free) #tabs { display: none; } }

/* ── 3D 그림과 5단계 준위 그림 ── */
#view { grid-area: view; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 10px 8px 12px; }
#figRow { flex: 1; min-height: 0; display: flex; gap: 10px; }
#fig { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: var(--scene); }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
#sceneTools { position: absolute; left: 8px; top: 8px; right: 8px; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; pointer-events: none; }
#sceneTools > * { pointer-events: auto; }
#sceneTools .k-btn { height: var(--tap); }
#sceneTools .k-btn.ico { width: var(--tap); padding: 0; }
/* 분광기 각도(3단계): 장면 꼬리표처럼 반경 0, 장면과 같은 불투명 바탕 */
#angleTag { height: 30px; padding: 0 8px; background: var(--scene); color: #e8eefc; font-size: 14px; font-weight: 750; display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
#toast {
  position: absolute; left: 50%; bottom: 10px; transform: translate(-50%, 8px); z-index: 5; opacity: 0; pointer-events: none;
  background: var(--k-paper); color: var(--k-ink); padding: 7px 12px; font-size: 14px; font-weight: 650; line-height: 1.4;
  width: max-content; max-width: min(calc(100% - 24px), 480px); text-align: center; transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#lvBox { flex: 0 0 min(46%, 460px); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#lvRead { margin: 0 0 4px; min-height: 40px; font-size: 14px; line-height: 1.4; font-weight: 650; font-variant-numeric: tabular-nums; }
#lvRead .l2 { display: block; font-weight: 800; }
#lvRead .sub { color: var(--k-sub); font-weight: 650; }
#lv { flex: 1; min-height: 0; width: 100%; display: block; touch-action: none; background: var(--k-paper); }
/* 장면 이름표: 반경 0, 바탕은 장면과 같은 불투명 색, 테두리 없이 글자로 */
.lbl { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; padding: 2px 7px 4px; background: var(--scene); white-space: nowrap; line-height: 1.24; }
.lbl b { font-size: 13px; font-weight: 800; color: #eef3ff; }
.lbl small { font-size: 12px; font-weight: 600; color: #b9c0cf; }
.lbl.dim b { font-weight: 700; color: #cfd6e6; }
.lbl.core b { color: #ffe9b8; }
.lbl.atm b { color: #c6dbff; }
.lbl.solved b { color: var(--ok-d); }
.lbl.solved b::before { content: "✓ "; }
#labels.compact .lbl { padding: 1px 6px 3px; }
#labels.compact .lbl b { font-size: 12px; }
#labels.compact .lbl small { display: none; }
#labels.compact .lbl.rail { display: none !important; }
/* 촘촘한 화면: 지금 할 일은 그림 바로 아래 종이 위 */
#caption { display: none; margin: 6px 2px 0; font-size: 14px; line-height: 1.42; }
#caption .gl { font-weight: 800; margin-right: 0.4em; }
html.compact:not(.free) #caption:not(:empty) { display: block; }
body.starting #caption { display: none !important; }

/* ── 옆 판: 예측·확인·결과 옆 창, 미션 ── */
#side { grid-area: side; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; padding: 2px 14px 8px 4px; overflow: hidden; }
#mission { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 0; overflow: hidden; }
#mHead { display: block; }
#mDots { display: none; gap: 4px; }
#mDots i { width: 10px; height: 10px; display: block; box-shadow: inset 0 0 0 1.5px var(--k-ctl); }
#mDots i.on { background: var(--k-ink); box-shadow: none; }
#mDots i.cur { box-shadow: inset 0 0 0 2.5px var(--k-ink); }
#goals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
#goals li { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 6px; min-height: 34px; padding: 3px 2px; border-top: 1px solid var(--k-rule); font-size: 14.5px; line-height: 1.3; color: var(--k-sub); }
#goals li:last-child { border-bottom: 1px solid var(--k-rule); }
#goals li i { font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
#goals li.done i { color: var(--k-ink); font-weight: 800; }
#goals li.cur { color: var(--k-ink); font-weight: 750; box-shadow: inset 0 -3px 0 var(--k-ink); }
#mText { margin: 0; font-size: 15px; line-height: 1.5; }
#mText:empty { display: none; }
/* 읽은 값 칸: 아직이면 점선 밑줄, 읽으면 초록 ✓ */
.reads { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.rd { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--k-sub); line-height: 1.5; }
.rd.ok { color: var(--ok-p); }
.rd.ok::before { content: "✓"; }
#mActs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#mActs:empty { display: none; }
#mActs .k-btn { height: var(--tap); }
.picked { font-size: 14px; color: var(--k-sub); width: 100%; }
.picked b { color: var(--k-ink); font-weight: 750; }
.shoot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; }
.shoot label { flex-basis: 100%; font-size: 14px; font-weight: 700; color: var(--k-sub); white-space: nowrap; }
.shoot .k-range, .chips-shoot .k-range { flex: 1 1 0; width: auto; min-width: 60px; }
.shoot output, .chips-shoot output { flex: none; font-size: 16px; font-weight: 800; min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 광자 색 칸: 그 파장의 색(작은 네모) */
.shoot .sw, .chips-shoot .sw { width: 16px; height: 16px; flex: 0 0 16px; }
.chips-shoot { display: flex; align-items: center; gap: 6px; width: 100%; }
#mission.fit1 #goals li:not(.cur) { display: none; }
#mission.fit2 { gap: 5px; }
#mission.fit2 #mText { font-size: 14px; line-height: 1.4; }
#mission.fit3 { gap: 3px; }
#mission.fit3 #mText { font-size: 13px; line-height: 1.35; }
#mission.fit3 #mActs { gap: 5px 8px; }
#mission.fit3 #mActs .k-btn { height: 36px; }
#mission.fit3 .shoot label { display: none; }
html.free #mHead, html.free #mText { display: none; }
/* 자유 모드: 이 장면에서 쓸 수 있는 것 한 줄(미션이 아니다) */
.freeHint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--k-sub); width: 100%; }

/* 옆 창: 데스크톱은 오른쪽 칸을 위아래 끝까지 쓴다(미션 칸이 분광기 판 위라 낮으므로). 접안 화면 왼쪽은 그대로 보인다 */
#sheet { min-height: 0; display: flex; flex-direction: column; background: var(--k-paper);
  position: fixed; right: 0; top: var(--hdr); bottom: 0; width: max(var(--pw), 340px); z-index: 20; padding: 12px 16px 12px 14px; border-left: 1px solid var(--k-rule); }
#side.carded #mission { display: none; }
#side.cardOnly > #sheet { flex: 1 1 auto; border-bottom: 0; }

/* ── 분광기 판: 광원 정보, 칩, λ 읽음값, 확대, 접안 화면(어두운 그림), 기준 띠 줄 ── */
#spec {
  grid-area: spec; min-width: 0; min-height: 0; padding: 4px 10px 8px 12px; display: grid; gap: 6px 10px;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto auto; grid-template-rows: var(--tap) minmax(0, 1fr) auto;
  grid-template-areas: "src chips read zoom" "eye eye eye eye" "dock dock dock dock";
  border-top: 1px solid var(--k-rule);
}
#srcInfo { grid-area: src; display: flex; align-items: center; gap: 8px; min-width: 0; }
/* 겉보기 색 칸: 관(광원) 빛을 합친 색 */
#srcSw { width: 16px; height: 16px; flex: 0 0 16px; background: #222; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
#srcName { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#srcName .sub { font-weight: 600; color: var(--k-sub); margin-left: 6px; }
#chips { grid-area: chips; display: flex; gap: 6px; align-items: center; justify-content: center; min-width: 0; }
#readout { grid-area: read; align-self: center; min-width: 116px; padding: 0 6px; display: flex; align-items: baseline; justify-content: flex-end; gap: 5px; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--k-ink); white-space: nowrap; }
#readout.snap::after { content: "✓"; font-size: 15px; color: var(--ok-p); }
#readout i { font-style: italic; font-family: "Times New Roman", Georgia, serif; font-size: 20px; font-weight: 700; }
#readout small { font-size: 13px; font-weight: 700; color: var(--k-sub); }
#zoom { grid-area: zoom; display: flex; gap: 4px; align-items: center; }
.k-btn.zb { width: 40px; height: var(--tap); padding: 0; font-size: 19px; }
#eyeWrap { grid-area: eye; position: relative; min-height: 0; overflow: hidden; background: #020306; }
#eye { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#dockBar { grid-area: dock; display: flex; gap: 8px; align-items: center; min-height: 40px; min-width: 0; }
#dockMini { width: 52px; height: 10px; flex: 0 0 52px; }
#dockName { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.2; font-weight: 800; }
#dockBar .k-btn { height: 40px; padding: 0 10px; font-size: 14px; }
#dockMark .box { width: 16px; height: 16px; border: 2px solid var(--k-ink); border-radius: var(--k-r); display: grid; place-items: center; font-size: 12px; line-height: 1; color: var(--k-paper); }
#dockMark[aria-pressed="true"] .box { background: var(--ok-p); border-color: var(--ok-p); }
#dockClose { width: 40px; flex: none; padding: 0 !important; }
html.free #dockMark { display: none; }

/* 칩: 관·기체·기준 띠·준위. 고른 것 = 공용 .k-on, 빛의 색은 작은 네모 칸 */
.k-btn.chip { position: relative; height: var(--tap); min-width: 40px; padding: 0 10px; font-size: 14px; gap: 6px; touch-action: none; }
.chip .dot { width: 12px; height: 12px; flex: 0 0 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.chip .nm { font-weight: 600; color: var(--k-sub); }
.chip.k-on .nm { color: var(--k-ink); }
/* 들어 있음 ✓: 칩 오른쪽 위 초록 네모 */
.chip .ck { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; background: var(--ok-p); color: var(--k-paper); font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.chip.ref .mini { width: 26px; height: 10px; display: block; }
.chips-sep { width: 1px; align-self: stretch; margin: 6px 2px; background: var(--k-rule); }
#chips.tight .chip .nm { display: none; }
#chips.tighter .chip.ref .mini { display: none; }
#chips.tighter .chip.ref, html.compact .chip.ref { box-shadow: inset 0 -3px 0 var(--refc, var(--k-rule)); }
#chips.tighter .chip.ref.k-on, html.compact .chip.ref.k-on { box-shadow: inset 0 -3px 0 var(--k-ink); }

/* 기준 띠 끌기(손가락을 따라가는 띠 이름표) */
#ghost { position: fixed; z-index: 30; pointer-events: none; padding: 4px 8px; background: var(--k-paper); border: 1.5px solid var(--k-ink); font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; transform: translate(-50%, -120%); }
#ghost canvas { display: block; }

/* ── 창 ── */
#modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--k-dim); padding: 12px; }
#modal .card { display: flex; flex-direction: column; width: min(580px, 100%); max-height: calc(100% - 8px); overflow: hidden; background: var(--k-paper); color: var(--k-ink); padding: 20px 22px 18px; }
#modal .card.info { width: min(720px, 100%); }
.card > .cb { min-height: 0; overflow: auto; }
.card > .acts { flex: none; }
.card [tabindex="-1"]:focus { outline: none; }
.card h2 { font-size: 21px; font-weight: 750; margin: 0 0 10px; line-height: 1.38; }
.card h3 { font-size: 15px; font-weight: 800; margin: 14px 0 4px; }
.card p { margin: 8px 0; font-size: 15px; line-height: 1.6; }
/* 알아 둘 것: 예측 질문 위, 이 단계에서 볼 것과 처음 나오는 낱말의 뜻 */
.card p.know { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--k-sub); }
html.compact .card p.know { margin-bottom: 8px; font-size: 13.5px; line-height: 1.45; }
/* 조건을 채운 목표의 ✓ 줄(결과·확인 질문·정리는 단추를 눌러야 열린다) */
.pd { font-weight: 800; color: var(--ok-p); }
#mText .pd { display: block; }
.card .sub { font-size: 14px; color: var(--k-sub); margin: 0 0 4px; font-weight: 650; }
.res .hd { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.res .hd.ok { color: var(--ok-p); }
.res .hd.bad { color: var(--bad-p); }
.res .hd .pk { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--k-sub); }
.opts { display: grid; gap: 8px; margin-top: 12px; grid-template-columns: minmax(0, 1fr); }
.opts button {
  min-height: 46px; border: 1.5px solid var(--k-ctl); border-radius: var(--k-r); background: var(--k-paper); color: var(--k-ink);
  font-weight: 650; font-size: 15px; padding: 8px 12px; line-height: 1.35; text-align: left; display: flex; align-items: center; gap: 10px;
}
@media (hover: hover) { .opts button:not(:disabled):hover { background: var(--k-wash); border-color: var(--k-ink); } }
.opts button.ok { border-color: var(--ok-p); color: var(--ok-p); font-weight: 750; }
.opts button.ok::before { content: "✓"; }
.opts button.no { border-color: var(--bad-p); color: var(--bad-p); }
.opts button.no::before { content: "✗"; }
.opts button:disabled { opacity: 1; cursor: default; }
/* 선택지 속 작은 스펙트럼 그림(전구·수소) */
.opts .ic { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.opts .ic span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--k-sub); font-weight: 700; }
.opts .ic em { font-style: normal; min-width: 30px; }
.opts .ic img { display: block; }
.fb { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; }
.fb.ok b { color: var(--ok-p); }
.fb.no b { color: var(--bad-p); }
.stars { font-size: 24px; letter-spacing: 3px; color: var(--k-ctl); margin: 2px 0 6px; }
.stars .on { color: var(--k-ink); }
/* 우주의 원소 비율 막대(무늬로도 가른다) */
.bar { display: flex; height: 24px; margin: 6px 0 6px; }
.bar span, .mini-legend .sw { display: block; }
/* 원소 막대: 수소 진한 파랑, 헬륨 옅은 회청 바탕에 빗금, 나머지 회색. 이름은 막대 아래 범례(좁은 칸에서 잘리지 않게) */
.bar .h, .mini-legend .sw.h { background: #1c5fbf; }
.bar .he, .mini-legend .sw.he { background: #c9d3e3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 2l4-4M0 8l8-8M6 10l4-4' stroke='%233b4a63' stroke-width='1.6'/%3E%3C/svg%3E"); }
.bar .rest, .mini-legend .sw.rest { background: #8a8a8a; }
.mini-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; font-weight: 700; color: var(--k-ink); margin: 0 0 8px; }
.mini-legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mini-legend .sw { width: 14px; height: 14px; flex: none; }
.acts { display: flex; gap: 8px 10px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.acts .k-btn { height: var(--tap); }
.acts .k-link { margin-right: auto; }
.stList { display: grid; margin-top: 6px; }
.stList > button {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 6px; width: 100%; min-height: 46px; padding: 6px 4px;
  border: 0; border-top: 1px solid var(--k-rule); background: none; text-align: left; color: var(--k-ink); font-size: 16px;
}
.stList > button:last-child { border-bottom: 1px solid var(--k-rule); }
@media (hover: hover) { .stList > button:not(.k-on):hover { background: var(--k-wash); } }
.stList .n { color: var(--k-sub); font-variant-numeric: tabular-nums; font-weight: 650; }
.stList > button.done .n { color: var(--k-ink); font-weight: 800; }
.stList .t { font-weight: 650; display: flex; flex-direction: column; }
.stList .t small { font-size: 13.5px; font-weight: 500; color: var(--k-sub); }
.stList .c { font-size: 14px; color: var(--k-sub); white-space: nowrap; }
.info h3:first-child { margin-top: 0; }
.info p { font-size: 14.5px; }

/* ── 시작 화면(kit/start.js): 판 자리 ── */
body.starting #side > :not(.k-start) { display: none !important; }
#side > .k-start { flex: 1; min-height: 0; padding: 14px 6px 12px 6px; }
.k-start.x-tiny { gap: 6px; }
.k-start.x-tiny .k-q { font-size: 14px; line-height: 1.25; }

/* 작은 데스크톱(830×466 등) */
@media (max-height: 560px) and (min-aspect-ratio: 21/20) {
  :root { --hdr: 46px; --specH: clamp(150px, 36vh, 240px); }
  #modal .card { padding: 14px 18px; }
  .card h2 { font-size: 18px; margin-bottom: 6px; line-height: 1.35; }
  .card p { font-size: 14px; line-height: 1.5; margin: 6px 0; }
  .acts { margin-top: 10px; }
  .opts { margin-top: 8px; gap: 6px; }
  .opts button { min-height: 40px; font-size: 14px; padding: 5px 10px; }
  .stList > button { min-height: 40px; padding: 3px 4px; font-size: 15px; }
  .stList .t small { display: none; }
  #goals li { min-height: 30px; font-size: 14px; }
  #mText { font-size: 14px; line-height: 1.45; }
}

/* ── 세로 화면(휴대폰): 그림, 분광기 판, 미션 줄 ── */
html.compact { --hdr: 50px; }
html.compact #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--hdr) minmax(0, 1fr) auto auto; grid-template-areas: "top" "view" "spec" "side"; }
html.compact #view { padding: 0 10px; }
html.compact #figRow { gap: 0; }
html.compact.st5 #fig { display: none; }
html.compact #lvBox { flex: 1 1 auto; }
html.compact #side { padding: 4px 10px 8px; gap: 4px; }
html.compact #mHead, html.compact #mText { display: none; }
html.compact #mission { padding: 0; }
html.compact #mission.empty { display: none; }
html.compact #spec { padding: 6px 10px 4px; gap: 6px; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: auto var(--eyeH, 110px) auto var(--tap);
  grid-template-areas: "src read zoom" "eye eye eye" "dock dock dock" "chips chips chips"; border-top: 0; }
html.compact #srcName { white-space: normal; overflow: visible; font-size: 14px; line-height: 1.25; padding: 2px 0; }
html.compact #srcName .sub { display: block; margin-left: 0; font-size: 13px; }
html.compact.st5 #readout, html.compact.st5 #zoom { display: none; }
html.compact .chip .nm { display: none; }
html.compact .chip.ref .mini { display: none; }
html.compact #readout { min-width: 100px; font-size: 17px; }
html.compact #readout i { font-size: 18px; }
html.compact #sheet {
  position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; z-index: 20; max-height: calc(100% - var(--hdr));
  padding: 12px 14px; border-left: 0; border-top: 1px solid var(--k-rule);
}
html.compact #sheet h2 { font-size: 17px; line-height: 1.38; margin-bottom: 6px; }
html.compact #sheet p { font-size: 14px; line-height: 1.5; margin: 6px 0; }
html.compact #sheet .opts { gap: 6px; margin-top: 8px; }
html.compact #sheet .opts button { min-height: 40px; font-size: 14.5px; padding: 5px 10px; }
html.compact #sheet .acts { margin-top: 10px; }
html.compact body.starting #app { grid-template-rows: var(--hdr) minmax(0, 1fr) 0 minmax(0, 2.4fr); }
html.compact body.starting #spec { display: none; }
html.compact #side > .k-start { padding: 10px 2px 6px; }
html.compact #modal { padding: 8px; }
html.compact #modal .card { padding: 16px 16px 14px; }
html.compact .card h2 { font-size: 18px; }
html.compact .stList > button { min-height: 42px; font-size: 15px; }
html.compact .stList .t small { display: none; }
@media (max-height: 520px) and (max-aspect-ratio: 21/20) {
  html.compact body.starting #app { grid-template-rows: var(--hdr) minmax(0, 1fr) 0 minmax(0, 2.9fr); }
  .card { padding: 12px 14px; }
  .card h2 { font-size: 17px; line-height: 1.35; margin-bottom: 6px; }
  .card p { font-size: 13.5px; line-height: 1.5; margin: 6px 0; }
  .acts { margin-top: 10px; }
}

/* ── 낮은 가로 화면(750×280 등): 그림 왼쪽, 분광기 오른쪽, 미션 줄은 그림 아래 ── */
html.compact.short { --hdr: 44px; }
html.compact.short #app { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); grid-template-rows: var(--hdr) minmax(0, 1fr) auto; grid-template-areas: "top top" "view spec" "side spec"; }
html.short #top { padding: 2px 6px 2px 4px; gap: 4px; }
html.short #chap { font-size: 13px; }
html.short #chap .in { line-height: 1.22; }
html.short #view { padding: 0 6px 4px 8px; }
html.short #side { padding: 2px 6px 4px 8px; }
html.compact.short #spec { height: 100%; grid-template-rows: auto minmax(0, 1fr) auto var(--tap); padding: 0 8px 6px 4px; }
html.compact.short #sheet {
  position: fixed; left: auto; right: 0; top: var(--hdr); bottom: 0; width: min(64vw, 520px); max-height: none;
  padding: 8px 12px; border-top: 0; border-left: 1px solid var(--k-rule);
}
html.short #sheet h2 { font-size: 15px; margin-bottom: 4px; }
html.short #sheet p { font-size: 13px; line-height: 1.45; margin: 4px 0; }
html.short .res .hd { font-size: 14.5px; }
html.short .res .hd .pk { display: inline; margin-left: 6px; font-size: 13px; }
html.short #sheet .opts { margin-top: 6px; gap: 5px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.short #sheet .opts button { min-height: 36px; font-size: 13px; padding: 3px 8px; }
html.short #sheet .acts { margin-top: 6px; }
html.short .opts .ic { display: none; }
html.compact.short body.starting #app { grid-template-columns: minmax(0, 1fr) minmax(0, 60%); grid-template-rows: var(--hdr) minmax(0, 1fr); grid-template-areas: "top top" "view side"; }
html.short #side > .k-start { padding: 6px 4px 4px; }
html.short #modal { padding: 4px; }
html.short #modal .card { padding: 10px 14px; }
html.short .card h2 { font-size: 16px; margin-bottom: 4px; }
html.short .card p { font-size: 13px; margin: 4px 0; line-height: 1.45; }
html.short .acts { margin-top: 8px; }
html.short .stList { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
html.short .stList > button { min-height: 36px; padding: 2px; gap: 4px; grid-template-columns: 20px minmax(0, 1fr) auto; font-size: 13.5px; }
html.short .stList > button:nth-last-child(-n+2) { border-bottom: 1px solid var(--k-rule); }
html.short #toast { bottom: auto; top: 6px; transform: translate(-50%, -8px); font-size: 13px; padding: 4px 10px; }
html.short #toast.show { transform: translate(-50%, 0); }

/* ── 아주 작은 틀(320×200): 3D 그림을 접고 분광기 판을 화면 가득, 도구 줄은 아래, 지금 목표는 위 막대 ── */
html.micro { --hdr: 40px; }
html.micro.compact.short #app, html.micro #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--hdr) minmax(0, 1fr) auto; grid-template-areas: "top" "spec" "side"; }
html.micro #view { display: none; }
html.micro #top { gap: 2px; padding: 2px 4px; }
html.micro .icon { width: 36px; height: 36px; }
html.micro #chap { font-size: 12.5px; }
html.micro #spec, html.micro.compact.short #spec { height: auto; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto var(--tap); grid-template-areas: "src read" "eye eye" "dock dock" "chips chips"; padding: 0 6px 2px; gap: 3px 6px; }
html.micro #zoom { display: none; }
html.micro #srcName { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.micro #srcName .sub { display: none; }
html.micro #readout { font-size: 15px; min-width: 0; }
html.micro #readout i { font-size: 16px; }
html.micro #chips { justify-content: flex-start; gap: 3px; }
html.micro .k-btn.chip { min-width: 34px; padding: 0 6px; font-size: 13px; }
html.micro .chip .nx { display: none; }
html.micro #dockBar { min-height: 36px; gap: 4px; }
html.micro #dockBar .k-btn { height: 36px; padding: 0 6px; font-size: 13px; }
html.micro #dockMini { display: none; }
html.micro #side { padding: 0 6px 3px; }
html.micro #mActs { gap: 4px; flex-wrap: nowrap; }
html.micro #mActs .k-btn, html.micro #mActs .k-seg > button { font-size: 13px; padding: 0 8px; }
html.compact .freeHint { display: none; }
html.compact .shoot label { display: none; }
html.compact .shoot { flex-wrap: nowrap; }
html.micro .shoot label, html.micro .shoot .sw { display: none; }
html.micro .shoot { flex-wrap: nowrap; }
html.micro .shoot output { min-width: 0; font-size: 14px; }
html.micro body.starting #spec { display: none; }
html.micro.compact.short body.starting #app, html.micro body.starting #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--hdr) minmax(0, 1fr); grid-template-areas: "top" "side"; }
html.micro .card h2 { font-size: 14px; margin-bottom: 2px; }
html.micro .acts { margin-top: 4px; }
html.micro #toast { font-size: 12.5px; }

/* 사진(썸네일)용 */
body.thumb #top, body.thumb #side, body.thumb #spec, body.thumb #sceneTools, body.thumb #modal, body.thumb #toast, body.thumb #caption { display: none !important; }
body.thumb #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; grid-template-areas: "view"; }
body.thumb #view { padding: 0; }

@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* 낮은 화면(높이 560px 이하): 기준 띠 줄 단추 36px */
@media (max-height: 560px) { #dockBar { min-height: 36px; } #dockBar .k-btn { height: 36px; } #dockClose { width: 36px; } }
#side.carded { overflow: visible; } /* 옆 창(고정)이 판 경계에서 잘린 것처럼 재지 않게 */
.k-seg > button { min-width: 32px; } /* 누르는 칸 폭 32px 이상(A·B·C 한 글자 칸) */
/* 아주 작은 틀: 메뉴의 단계 목록은 한 줄에 하나(두 칸이면 일본어 가타카나 낱말이 칸보다 길어 갈린다). 창 안 스크롤로 본다 */
html.micro .stList { grid-template-columns: minmax(0, 1fr); }
/* 데스크톱 옆 창(오른쪽 칸 위아래 전체)이 떠 있는 동안 분광기 판은 창 왼쪽으로 줄어든다: 학생이 결과를 읽으며
   접안 화면 전체(380~720 nm), λ 읽음값, 확대 단추를 볼 수 있게(2026-10-18 검토). 판이 좁으면 칩 줄을 따로 둔다(main.js layout) */
html:not(.compact) #app:has(> #side.carded) #spec { grid-column: 1 / 2; margin-right: calc(max(var(--pw), 340px) - var(--pw)); }
#spec.specNarrow { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: var(--tap) auto minmax(0, 1fr) auto;
  grid-template-areas: "src read zoom" "chips chips chips" "eye eye eye" "dock dock dock"; }
#spec.specNarrow #chips { justify-content: flex-start; flex-wrap: wrap; }
/* 데스크톱 시작 화면: 판(오른쪽 칸)이 분광기 판까지 내려와 단계 별과 자유 모드 목록이 접히지 않게 */
html:not(.compact):not(.micro) body.starting #side { grid-row: 2 / 4; }
html:not(.compact):not(.micro) body.starting #spec { grid-column: 1 / 2; }
