/* LCD 화소 해부: '종이 위 그림' (studio/DESIGN.md, 2026-10-17)
   - 틀(위 막대·판·단추·창)은 공용 묶음 kit/paper.css(빌드가 studio/_kit에서 복사)의 토큰과 부품을 그대로 쓴다:
     .k-btn·.k-primary(단추), .k-seg·.k-on(고른 상태), .k-range(슬라이더), .k-w(범례 낱말), .k-link(진행 지우기),
     .k-dark(어두운 그림 위 초점 링), [hidden] !important. 이 파일에는 배치와 이 작품의 대상 색만 둔다.
   - 어두운 그림은 둘이다: 3D 장면(#fig)과 계기(#inst: 빛의 길·그래프. 빛은 어둠 위에서 보인다). 둘 다 흰 종이 위에 놓인다.
   - 같은 대상은 같은 색: 편광판의 투과축 = 분홍(3D 화살표·손잡이, 다이얼, 빛의 길 점선, 글 속 '투과축'),
     액정 = 연보라, 빛 = 그 빛의 색(흰빛·부화소 색). 예전 호박색 투과축·손잡이(경고가 아닌 강조)를 분홍으로 옮겼다.
   - 반경: 단추·입력·세그먼트 var(--k-r), 판·그림·그래프·꼬리표·창 0, 손잡이·다이얼만 원. */
:root {
  --pol-d: #ff5fa2; --pol-p: #c2255c;   /* 편광판 투과축 */
  --lc-d: #cdbcff;  --lc-p: #6741d9;    /* 액정 */
  --ok-p: #237032; --bad-p: #c92a2a;
  --scene: #070b12;
  --hdr: 52px;
  --sideW: clamp(300px, 36%, 440px);
  --instH: 120px;
  --tap: 40px;
  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; color: var(--k-ink); font-family: var(--k-font); background: var(--k-paper);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* 줄바꿈: 한국어는 어절, 영어는 낱말, 일본어는 구절·금칙. 틀을 넘는 긴 낱말만 끊는다 */
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; }
.k-w.pol { --w: var(--pol-p); }
.k-w.lc { --w: var(--lc-p); }

#app {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sideW);
  grid-template-rows: var(--hdr) auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "view mission" "view inst" "view ctl";
  background: var(--k-paper);
}
/* 시작 화면: 판 자리(데스크톱 오른쪽) */
body.starting #app { grid-template-rows: var(--hdr) minmax(0, 1fr); grid-template-areas: "top top" "view start"; }
body.starting #mission, body.starting #inst, body.starting #ctl { display: none !important; }
#app > .k-start { grid-area: start; min-height: 0; padding: 14px 14px 12px 6px; }
.k-start.x-tiny { gap: 6px; }
.k-start.x-tiny .k-q { font-size: 14px; line-height: 1.25; }
body.thumb #app > :not(#view) { 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; }
body.thumb #sceneTools, body.thumb #labels { display: none !important; }

/* ── 위 막대 ── */
#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; }
#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 #bMenu { visibility: hidden; }
body.starting #tabs { display: none; }
/* 좁은 위 막대: 단계 이름(1단계 편광판)만, 부제는 미션 줄이 대신한다 */
html.phone body:not(.starting) #chName, html.micro body:not(.starting) #chName { display: none; }
#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: 820px) { html:not(.free) #tabs { display: none; } }

/* ── 3D 그림 ── */
#view { grid-area: view; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 10px 12px 12px; }
#fig { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--scene); }
#c3 { 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; flex-wrap: wrap; gap: 6px; 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; }
#srcPills > button { white-space: nowrap; }
#srcPills.wrap { flex-wrap: wrap; max-width: calc(100% - var(--tap) - 6px); }
#noGL { position: absolute; inset: 0; display: grid; place-items: center; color: #e8eefc; font-size: 14px; text-align: center; padding: 20px; }
#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: 600; line-height: 1.45;
  width: max-content; max-width: min(calc(100% - 24px), 520px); text-align: center; transition: opacity 0.2s, transform 0.2s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
/* 장면 이름표: 반경 0, 장면과 같은 불투명 바탕, 글자색으로 가른다 */
.lbl { position: absolute; left: 0; top: 0; padding: 2px 7px 4px; background: var(--scene); white-space: nowrap; line-height: 1.25; font-size: 13px; font-weight: 700; color: #eef3ff; }
.lbl small { display: block; font-size: 12px; font-weight: 600; color: #b9c0cf; }
.lbl b { color: #ffffff; font-variant-numeric: tabular-nums; }
.lbl.hot { color: var(--pol-d); }
.lbl.hot b { color: var(--pol-d); }
.lbl.lav { color: var(--lc-d); }
html.compact .lbl, html.short .lbl { font-size: 12px; padding: 1px 6px 3px; }
html.compact .lbl small, html.short .lbl small { display: none; }

/* ── 미션 ── */
#mission { grid-area: mission; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 4px 14px 8px 4px; }
#mHead { display: flex; align-items: center; gap: 8px; min-width: 0; }
#mDots { display: flex; gap: 4px; flex: none; }
#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); }
#mDots i.on.cur { box-shadow: none; }
#mGoal { font-size: 15px; font-weight: 800; line-height: 1.3; min-width: 0; }
#mText { margin: 0; font-size: 14.5px; line-height: 1.5; }
#mText:empty { display: none; }
#mText .mine { font-weight: 700; color: var(--k-sub); margin-right: 4px; }
.pr { font-weight: 800; }
.pr.ok { color: var(--ok-p); }
.pr.no { color: var(--bad-p); }
#mActs { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
#mActs:empty { display: none; }
#mActs .k-btn { height: var(--tap); }
#mActs .need { font-size: 13px; color: var(--k-sub); }
.verdicts { display: flex; flex-wrap: wrap; gap: 6px; }
html.free #mHead { display: none; }

/* ── 계기(어두운 그림): 빛의 길·그래프 ── */
#inst { grid-area: inst; position: relative; min-width: 0; min-height: 0; margin: 0 14px 8px 4px; background: var(--scene); display: flex; flex-direction: column; padding: 6px; }
#inst canvas { flex: 1 1 0; min-height: 0; width: 100%; display: block; touch-action: none; }
#inst .swap { position: absolute; right: 6px; top: 6px; z-index: 2; }
#inst .swap svg { width: 22px; height: 22px; }

/* ── 조작판 ── */
#ctl { grid-area: ctl; position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 0 14px 12px 4px; }
#ctl:empty { display: none; }
/* 예측 전 잠금: 조작은 흐리게, 할 일 한 줄(막 없이) */
#ctl.locked > * { opacity: 0.45; }
#ctl.locked::before { content: attr(data-lock-msg); font-size: 14px; font-weight: 700; color: var(--k-ink); }
.crow { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.dial { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dial canvas { width: 56px; height: 56px; display: block; border-radius: 50%; cursor: grab; touch-action: none; }
.dlab { font-size: 13px; font-weight: 700; color: var(--k-sub); white-space: nowrap; }
.drow { display: flex; align-items: center; gap: 2px; }
.drow .k-btn.pm { flex: none; }
#mText .note { display: block; margin-top: 4px; }
.dlab b { color: var(--pol-p); font-variant-numeric: tabular-nums; }
.togs { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; justify-content: flex-end; }
/* 켜고 끄는 부품: 네모 칸 ✓ */
.k-btn.tog { gap: 7px; padding: 0 10px 0 8px; font-size: 14px; }
.tog .chk { width: 16px; height: 16px; flex: none; border: 2px solid var(--k-ink); border-radius: var(--k-r); position: relative; }
.tog[aria-pressed="true"] .chk { background: var(--k-ink); }
.tog[aria-pressed="true"] .chk::after { content: ""; position: absolute; left: 3.5px; top: 0; width: 5px; height: 9px; border: solid var(--k-paper); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tog[aria-pressed="false"] { color: var(--k-sub); }
/* 이번 미션에서 눌러 볼 부품: 굵은 테두리(깜빡이지 않는다) */
.k-btn.tog.hint { border-color: var(--k-ink); border-width: 2.5px; }
.parts { gap: 6px; }
.vrow { flex-wrap: nowrap; }
.slider { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: auto var(--tap) minmax(60px, 1fr) var(--tap) 66px; align-items: center; gap: 6px; }
.slab { font-size: 14px; font-weight: 750; color: var(--k-ink); white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.sval { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.k-btn.pm { width: var(--tap); height: var(--tap); padding: 0; font-size: 18px; }
.rgbrows { flex-direction: column; align-items: stretch; gap: 4px; }
.slider.rgb { grid-template-columns: 82px 34px minmax(60px, 1fr) 34px 64px; }
/* 부화소 색 칸(네모) */
.sw { width: 12px; height: 12px; display: inline-block; flex: none; }
.sw.R { background: #e03131; } .sw.G { background: #2f9e44; } .sw.B { background: #1c5fbf; }
.crow.withDial { flex-wrap: nowrap; align-items: center; }
.ptogs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 auto; }

/* ── 옆 창(예측·결과): 판 자리의 미션 줄·조작판 자리에 놓는다(막 없음). 장면과 계기(빛의 길·그래프)는 그대로 보인다.
   판이 낮아 다 들어가지 않으면 계기도 접고 판 전체를 쓴다(html.cardOnly, main.js fitSide) ── */
#sheet { grid-area: mission; z-index: 6; display: flex; flex-direction: column; min-width: 0; min-height: 0; max-height: calc(100vh - var(--hdr)); max-height: calc(100dvh - var(--hdr)); background: var(--k-paper); padding: 4px 14px 10px 4px; }
html.carded #mission, html.carded #ctl { display: none; }
html.cardOnly #inst { display: none; }
html.cardOnly #sheet { grid-row: 2 / 5; }
/* 계기를 접어도 넘치면 판을 넓히고(가로 화면), 그래도 넘치면 그림까지 접어 창이 화면을 다 쓴다(html.cardFull) */
html.cardOnly:not(.compact):not(.short):not(.micro) #app { grid-template-columns: minmax(0, 1fr) minmax(0, max(var(--sideW), 50%)); }
html.cardFull #view, html.cardFull #inst { display: none; }
html.cardFull #sheet { grid-row: 2 / -1; grid-column: 1 / -1; max-height: none; padding: 6px 16px 10px; }
#sheet .ctx { color: var(--k-sub); font-size: 14px; line-height: 1.5; margin: 0 0 6px; }
#sheet h2 { font-size: 18px; line-height: 1.4; margin: 0 0 8px; }
#sheet .acts { margin-top: 12px; }
.res .hd { font-size: 16px; font-weight: 800; margin: 0 0 2px; line-height: 1.4; }
.res .hd.ok { color: var(--ok-p); }
.res .hd.bad { color: var(--bad-p); }
.res .pk { font-size: 14px; color: var(--k-sub); margin: 0 0 2px; line-height: 1.45; }
.res { margin-bottom: 8px; }
/* ── 가운데 창 ── */
#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(600px, 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, .card .body { margin: 8px 0; font-size: 15px; line-height: 1.6; }
.card .ctx { color: var(--k-sub); font-size: 14px; margin: 0 0 6px; }
.card .note { font-size: 13.5px; color: var(--k-sub); line-height: 1.5; }
.card .note.good { color: var(--ok-p); font-weight: 700; }
.card ul { margin: 4px 0; padding-left: 20px; }
.card li { font-size: 14.5px; line-height: 1.55; margin: 3px 0; }
.card .sub { font-size: 14px; color: var(--k-sub); margin: 0 0 4px; font-weight: 650; }
.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;
}
@media (hover: hover) { .opts button:hover { background: var(--k-wash); border-color: var(--k-ink); } }
/* 내 예측과 결과를 나란히 */
.cmp2 { display: flex; align-items: stretch; gap: 10px; margin: 2px 0 8px; }
.cmp2 > span { flex: 1 1 0; padding: 4px 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; border-top: 1px solid var(--k-rule); }
.cmp2 small { display: block; font-size: 13px; color: var(--k-sub); font-weight: 750; }
.cmp2 > b { align-self: center; font-size: 20px; color: var(--k-sub); }
.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; }
.stars { font-size: 24px; letter-spacing: 3px; color: var(--k-ctl); margin: 2px 0 6px; }
.stars .on { color: var(--k-ink); }
/* 편광판 속 들여다보기 그림(어두운 그림) */
.card svg.peek { width: 100%; height: auto; max-height: 180px; display: block; margin: 4px 0 2px; background: var(--scene); }
.peekGrid .note { margin: 2px 0 6px; }
.card.peekc .peekGrid.wide { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; align-items: start; }

/* 좁은 옆 판·낮은 데스크톱 */
html.lowH #mission, html.narrowSide #mission { gap: 4px; }
html.lowH #mText, html.narrowSide #mText { font-size: 14px; line-height: 1.45; }
html.lowH .dial canvas, html.narrowSide .dial canvas { width: 48px; height: 48px; }
/* 좁은 옆 판(830×466 등): 슬라이더 칸을 줄여 값이 판 밖으로 나가지 않게 */
html.narrowSide .slider { grid-template-columns: auto 36px minmax(50px, 1fr) 36px 58px; gap: 4px; }
html.narrowSide .slider.rgb { grid-template-columns: 62px 36px minmax(50px, 1fr) 36px 56px; }
html.narrowSide .k-btn.pm { width: 36px; height: 36px; }
html.narrowSide .slab, html.narrowSide .sval { font-size: 13px; }
@media (max-height: 560px) and (min-aspect-ratio: 21/20) {
  :root { --hdr: 46px; }
  #modal .card { padding: 14px 18px; }
  .card h2 { font-size: 18px; margin-bottom: 6px; line-height: 1.35; }
  .card p, .card .body { 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; }
}

/* ── 세로 화면(휴대폰): 미션 줄, 그림, 계기, 조작판 ── */
html.compact { --hdr: 50px; }
html.compact #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--hdr) auto minmax(0, 1fr) var(--instH) auto; grid-template-areas: "top" "mission" "view" "inst" "ctl"; }
html.compact body.starting #app { grid-template-rows: var(--hdr) minmax(0, 1fr) minmax(0, 2.4fr); grid-template-areas: "top" "view" "start"; }
html.compact #view { padding: 0 10px 6px; }
html.compact #mission { padding: 2px 10px 6px; gap: 4px; }
html.compact #mission.introC { flex-direction: row; flex-wrap: wrap; align-items: center; }
html.compact #mission.introC #mHead { flex: 1 1 55%; }
html.compact #mGoal { font-size: 14px; }
html.compact #mText { font-size: 14px; line-height: 1.42; }
html.compact #inst { margin: 0 10px 6px; padding: 4px; }
html.compact #ctl { padding: 0 10px 8px; gap: 6px; }
html.compact .dial canvas { width: 48px; height: 48px; }
html.compact .slider { grid-template-columns: auto var(--tap) minmax(50px, 1fr) var(--tap) 60px; gap: 5px; }
html.compact .slider.rgb { grid-template-columns: 62px 34px minmax(50px, 1fr) 34px 58px; }
html.compact .slab, html.compact .sval { font-size: 13px; }
html.compact #sheet { grid-area: ctl; padding: 6px 10px 8px; max-height: calc(100vh - var(--hdr) - 150px); max-height: calc(100dvh - var(--hdr) - 150px); }
html.compact.cardOnly #app { grid-template-rows: var(--hdr) auto minmax(0, 1fr) 0 auto; }
html.compact.cardFull #sheet { max-height: none; grid-row: 2 / -1; grid-column: 1 / -1; }
html.compact.cardFull #sheet p, html.compact.cardFull #sheet .body { font-size: 13px; line-height: 1.42; margin: 4px 0; }
html.compact.cardFull #sheet h2 { font-size: 16px; margin-bottom: 4px; }
html.compact.cardFull .res .hd { font-size: 15px; }
html.compact.cardFull .res .pk { font-size: 13px; }
html.compact #sheet h2 { font-size: 17px; line-height: 1.38; margin-bottom: 6px; }
html.compact #sheet p, html.compact #sheet .body { 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 #app > .k-start { padding: 10px 10px 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; }
html.compact #toast { font-size: 13.5px; }
@media (max-height: 520px) and (max-aspect-ratio: 21/20) {
  html.compact body.starting #app { grid-template-rows: var(--hdr) minmax(0, 1fr) minmax(0, 2.9fr); }
  .card { padding: 12px 14px; }
  .card h2 { font-size: 17px; line-height: 1.35; margin-bottom: 6px; }
  .card p, .card .body { font-size: 13.5px; line-height: 1.5; margin: 6px 0; }
  .acts { margin-top: 10px; }
}

/* ── 낮은 가로 화면(750×280 등): 그림 왼쪽, 오른쪽 절반에 미션·계기·조작판 ── */
html.short { --hdr: 44px; }
html.short #app { grid-template-columns: minmax(0, 1fr) minmax(0, 50%); grid-template-rows: var(--hdr) auto minmax(0, 1fr) auto; grid-template-areas: "top top" "view mission" "view inst" "view ctl"; }
html.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 start"; }
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 6px 8px; }
html.short #mission { padding: 0 8px 4px 2px; gap: 3px 8px; flex-direction: row; flex-wrap: wrap; align-items: center; }
html.short #mHead { display: none; }
html.short #mission.introC #mHead { display: flex; flex: 1 1 50%; }
html.short #mText { flex: 1 1 55%; font-size: 13px; line-height: 1.38; }
html.short #mActs { flex: 0 1 auto; }
html.short #inst { margin: 0 8px 4px 2px; padding: 3px; }
html.short #ctl { padding: 0 8px 6px 2px; gap: 4px; }
html.short .dial { flex-direction: row; gap: 4px; }
html.short .dial canvas { width: 42px; height: 42px; }
html.short .slider { grid-template-columns: auto 36px minmax(50px, 1fr) 36px 58px; gap: 4px; }
html.short .slider.rgb { grid-template-columns: 58px 36px minmax(50px, 1fr) 36px 56px; }
html.short .rgbrows { gap: 1px; }
html.short .slab, html.short .sval { font-size: 13px; }
html.short .k-btn.pm { width: 36px; height: 36px; }
html.short .k-btn.tog { padding: 0 6px; font-size: 13px; gap: 4px; }
html.short .tog .chk { width: 14px; height: 14px; }
html.short .tog[aria-pressed="true"] .chk::after { left: 3px; top: -0.5px; width: 4px; height: 8px; }
html.short .ptogs { gap: 4px; }
html.short #sheet { padding: 0 8px 4px 2px; }
html.short #sheet h2 { font-size: 15px; margin-bottom: 4px; }
html.short #sheet p, html.short #sheet .body { font-size: 13px; line-height: 1.45; margin: 4px 0; }
html.short .res .hd { font-size: 14.5px; }
html.short #sheet .opts { margin-top: 6px; gap: 5px; grid-template-columns: repeat(3, 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 #app > .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, html.short .card .body { 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 .card.peekc .peekGrid { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; align-items: start; }
html.short #toast { font-size: 13px; padding: 4px 10px; }
/* 낮은 가로 화면에서 옆 창이 판 전체를 쓰면 판을 넓혀 글이 창 안에서 스크롤되지 않게 한다(그림은 좁아져도 보인다) */
html.short.cardOnly:not(.micro) #app { grid-template-columns: minmax(0, 1fr) minmax(0, 64%); }

/* ── 아주 낮은 화면(320×200 등): 계기를 접고 미션 줄은 위 막대로(main.js) ── */
html.micro { --hdr: 40px; }
html.micro #app { grid-template-columns: minmax(0, 30%) minmax(0, 70%); grid-template-rows: var(--hdr) minmax(0, 1fr) auto; grid-template-areas: "top top" "view mission" "ctl ctl"; }
html.micro body.starting #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--hdr) minmax(0, 1fr); grid-template-areas: "top" "start"; }
html.micro body.starting #view { display: none; }
html.micro #inst { display: none; }
html.micro.cardOnly #sheet { grid-row: 2 / 4; grid-column: 1 / 3; padding: 0 8px 4px; }
html.micro #top { gap: 2px; padding: 2px 4px; }
html.micro .icon { width: 36px; height: 36px; }
html.micro #chap { font-size: 12.5px; }
html.micro:not(.free) #tabs { display: none; }
html.micro #view { padding: 0 4px 4px 6px; }
html.micro #ctl { padding: 2px 6px 4px; gap: 3px; }
html.micro .crow { flex-wrap: wrap; }
html.micro .crow.withDial { flex-wrap: nowrap; }
html.micro #mActs .need { display: none; }
html.micro #mission { padding: 0 6px 3px 2px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
html.micro #mission.introC #mHead { flex: 1 1 0; min-width: 0; }
html.micro #mDots { display: none; }
html.micro #mGoal { font-size: 12.5px; line-height: 1.3; }
html.micro #mission.mHide #mText, html.micro #mission.mNoHead #mHead { display: none; }
html.figTiny #sceneTools { display: none; }
html.micro #mText { flex: 1 1 100%; font-size: 12px; line-height: 1.25; }
html.micro #mActs { flex: 0 1 auto; gap: 4px; }
html.micro .verdicts { gap: 4px; }
html.micro #mActs .need { font-size: 12px; }
html.micro .slab { display: none; }
html.micro .slider, html.micro .slider.rgb { grid-template-columns: 36px minmax(40px, 1fr) 36px 54px; gap: 3px; }
html.micro .slider.rgb { grid-template-columns: 12px 36px minmax(36px, 1fr) 36px 52px; }
html.micro .slider.rgb .slab { display: flex; width: 12px; }
html.micro .slider.rgb .slab .lt { display: none; }
html.micro .k-btn.pm { width: 36px; height: 36px; font-size: 15px; }
html.micro .k-range { height: 36px; }
html.micro .rgbrows { gap: 0; }
html.micro .slider.rgb .k-btn.pm { height: 36px; min-height: 36px; }
html.micro .slider.rgb .k-range { height: 36px; min-height: 36px; }
html.micro .verdicts .k-btn { height: 36px; min-height: 36px; padding: 0 5px; font-size: 12px; }
html.micro .crow.dials > .k-btn { height: 36px; min-height: 36px; padding: 0 8px; font-size: 12.5px; }
html.micro .dial { flex-direction: column; gap: 0; }
html.micro .dial canvas { width: 38px; height: 38px; }
html.micro .dlab { font-size: 12px; line-height: 1.3; }
html.micro .k-seg > button { padding: 2px 6px; min-height: 36px; min-width: 32px; font-size: 12.5px; }
/* 아주 작은 틀: 그림 위에는 처음 시점 단추만(층 펼치기·편광판 속은 접는다, 편광판 속은 1단계 마무리 창에도 있다) */
html.micro #bExplode, html.micro #bPeek { display: none; }
html.micro .k-btn.tog { padding: 0 5px; font-size: 12px; height: 36px; min-height: 36px; }
html.micro .crow { gap: 4px; }
html.micro #mActs .k-btn { padding: 0 8px; font-size: 13px; }
html.micro #sceneTools { left: 3px; top: 3px; right: 3px; gap: 3px; flex-wrap: nowrap; }
html.micro #sceneTools .k-btn { height: 36px; min-height: 36px; }
html.micro #sceneTools .k-btn.ico { width: 36px; }
html.micro #sceneTools .k-btn:not(.ico) { padding: 0 5px; font-size: 12px; }
html.micro .card h2 { font-size: 14px; margin-bottom: 2px; }
html.micro .acts { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
/* 낮은 휴대폰 세로(341×470 등): 편광판 속 창이 한 화면에 들어가게 그림을 줄이고 그림 설명 줄을 접는다 */
@media (max-height: 560px) and (max-aspect-ratio: 1/1) {
  .card svg.peek { max-height: 100px; }
  .card.peekc .peekGrid .note { display: none; }
  .card.peekc .body { font-size: 14px; line-height: 1.45; }
  .card.peekc .opts button { min-height: 40px; padding: 4px 10px; font-size: 14px; }
}
/* 아주 작은 틀: 메뉴의 단계 목록은 한 줄에 하나(두 칸이면 일본어 가타카나 낱말이 칸보다 길어 갈린다). 창 안 스크롤로 본다 */
html.micro .stList { grid-template-columns: minmax(0, 1fr); }
