/* 바퀴와 그림자: '종이 위 그림' (studio/DESIGN.md, 2026-10-17)
   - 틀(위 막대·판·단추·창)은 공용 묶음 _kit/paper.css의 토큰과 부품을 그대로 쓴다:
     .k-btn·.k-primary(단추), .k-seg·.k-on(고른 상태 = 굵은 글자 + 칸 아래 3px 막대), .k-range(슬라이더),
     .k-w(범례 낱말), .k-link(진행 지우기·더 보기), .k-dark(어두운 그림 위 초점 링), [hidden] !important.
     이 파일에는 배치와 이 작품의 대상 색만 둔다.
   - 3D 장면은 흰 종이 위의 어두운 그림(#sceneBox)이다. 과제는 오른쪽 위, 그래프는 오른쪽 아래 흰 종이 위(휴대폰은 그림 아래).
   - 같은 대상은 같은 색과 같은 선 모양: 손잡이와 그 그림자 잉크 점선(장면에서는 밝은 회색), 추(변위 x) 초록,
     속도 v 파랑, 가속도 a 빨강, 복원력 F 보라. 3D(scene.js COL), 벽 꼬리표, 글 속 낱말(.k-w), 읽음값, 그래프 선(graph.js GC)이
     모두 따른다. -d는 어두운 장면 위, -p는 흰 종이 위(흰 바탕 대비 4.5:1 이상).
   - 반경: 단추·입력·세그먼트 var(--k-r), 판·그림·그래프·꼬리표·창 0, 슬라이더 손잡이만 원. */

:root {
  --scene: #0a0d16;  /* 3D 그림 바탕·장면 읽음값 바탕(scene.js와 같다) */
  --h-d: #e9ecef;   --h-p: #171717;   /* 손잡이·손잡이 그림자 */
  --m-d: #20c997;   --m-p: #0b7a55;   /* 추(변위 x) */
  --v-d: #4dabf7;   --v-p: #1864ab;   /* 속도 v */
  --a-d: #ff6b8b;   --a-p: #c2255c;   /* 가속도 a */
  --F-d: #b197fc;   --F-p: #6741d9;   /* 복원력 F */
  --ok-p: #237032;  --bad-p: #c92a2a;
  --hdr: 52px;
  --tap: 40px;      /* 누르는 것의 최소 높이(DESIGN.md '크기'). 낮은 화면은 36px */
  --gap: 12px;
  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); font-size: 15px; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
/* 줄바꿈: 한국어는 어절, 영어는 낱말(하이픈 분철 없음), 일본어는 구절·금칙. 틀을 넘는 긴 낱말만 끊는다.
   가운뎃점·괄호·숫자 단위는 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 없음): i18n.js가 이때만 넣는 U+200B(구절 경계)에서만 줄을 바꾼다 */
@supports not (word-break: auto-phrase) { html:lang(ja) { word-break: keep-all; } }
button { font-family: inherit; color: inherit; cursor: pointer; font-size: inherit; }
button:disabled { cursor: default; opacity: 0.45; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--k-ink); outline-offset: 2px; }
canvas#c3:focus-visible { outline-offset: -4px; outline-color: var(--k-paper); }
i { font-style: italic; font-family: "Times New Roman", Georgia, serif; font-size: 1.1em; }
sup, sub { font-size: max(12px, 0.72em); line-height: 0; }
sup { vertical-align: baseline; position: relative; top: -0.42em; }
sub { vertical-align: baseline; position: relative; top: 0.3em; }
.nw { white-space: nowrap; }

/* ── 범례 낱말(.k-w)의 대상 색과 선 모양 ── */
.k-w.h { --w: var(--h-p); }
.k-w.m { --w: var(--m-p); }
.k-w.v { --w: var(--v-p); }
.k-w.a { --w: var(--a-p); }
.k-w.F { --w: var(--F-p); }
.k-w.tg { --w: var(--k-ink); }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--k-paper); }

/* ── 위 막대: 메뉴 · 작품 이름 · 단계 탭(자유 모드는 장면 탭) · 정보 · 소리 ── */
#top { flex: none; height: var(--hdr); display: flex; align-items: center; gap: 4px; padding: 0 8px 0 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) { #top .icon:hover { background: var(--k-wash); } }
#ttl { flex: 0 1 auto; min-width: 0; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 14px 0 6px; }
#stages { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow: hidden; }
#stages button {
  flex: none; height: var(--tap); min-width: 32px; border: 0; border-radius: 0; background: none; padding: 0 9px;
  font-size: 15px; font-weight: 600; color: var(--k-sub); white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 6px;
}
#stages button .n { font-variant-numeric: tabular-nums; }
#stages button .mk { font-size: 13px; font-weight: 700; color: var(--k-ink); font-variant-numeric: tabular-nums; }
#stages button .mk:empty { display: none; }
#stages button.k-on { color: var(--k-ink); }
@media (hover: hover) { #stages button:not(.k-on):hover { background: var(--k-wash); color: var(--k-ink); } }
#top.nottl #ttl { display: none; }
#stages.num button:not(.k-on) .t, #stages.num button:not(.k-on) .mk { display: none; }
#stages.min button .t { display: none; }
body.starting #bMenu, body.starting #stages { display: none; }
body.starting #ttl { margin: 0 6px 0 8px; }
@media (max-width: 400px) { #ttl { font-size: 15px; } }

/* ── 본문: 가로 화면은 그림(왼쪽) | 과제(오른쪽 위)·그래프(오른쪽 아래) ── */
#main { flex: 1 1 auto; min-height: 0; display: grid; column-gap: 16px; row-gap: 0; padding: 0 12px 10px; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); position: relative; }
#app.wide #main { grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr); }
#sceneBox { grid-column: 1; grid-row: 1 / 3; position: relative; min-height: 0; overflow: hidden; background: var(--scene); }
#c3 { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#task { grid-column: 2; grid-row: 1; min-width: 0; background: var(--k-paper); padding: 2px 0 10px; border-bottom: 1px solid var(--k-rule); }
#panel { grid-column: 2; grid-row: 2; position: relative; min-height: 0; min-width: 0; background: var(--k-paper); margin-top: 8px; }
#plot { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ── 그림 위: 읽음값(왼쪽 위, 장면색 바탕), 처음 시점(오른쪽 위), 시점(왼쪽 아래), 재생 막대(오른쪽 아래) ── */
#readout {
  position: absolute; left: 8px; top: 8px; z-index: 2; background: var(--scene); color: #e8ecff;
  padding: 3px 8px 4px; font-size: 13px; line-height: 1.45; pointer-events: none; font-variant-numeric: tabular-nums; white-space: nowrap;
}
#readout:empty { display: none; }
/* 그림이 150px보다 낮으면 3D 이름표(v·a·F)를 숨기고 화살표 색 범례 한 줄을 둔다(main.js syncLegend). 장면 꼬리표처럼 장면색 바탕, 반경 0 */
#legend { position: absolute; left: 8px; top: 6px; z-index: 2; display: flex; gap: 12px; align-items: center; pointer-events: none; white-space: nowrap; }
#legend:empty { display: none; }
/* 상자 없이 글자 테두리(DESIGN.md '장면 속 이름표') */
#legend .lg { display: inline-flex; align-items: center; gap: 3px; color: var(--c); font: italic 700 16px/1.3 "Times New Roman", Georgia, serif; -webkit-text-stroke: 3px var(--scene); paint-order: stroke fill; }
#legend svg { display: block; }
#readout .k { color: #b9c0cf; }
#readout .h { color: var(--h-d); }
#readout .m { color: var(--m-d); }
#bHome { position: absolute; right: 8px; top: 8px; z-index: 2; background: var(--scene); color: #e8ecff; border: 1.5px solid var(--k-ctl); }
@media (hover: hover) { #bHome:hover { background: #1b2036; } }
#views { position: absolute; left: 8px; bottom: 8px; z-index: 2; }
#views > button { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); min-width: 40px; padding: 2px 10px; white-space: nowrap; }
#playbar { position: absolute; right: 8px; bottom: 8px; z-index: 2; display: flex; gap: 6px; align-items: center; }
#playbar .k-btn { height: var(--tap); padding: 0 12px; }
#playbar .k-btn.ic { width: var(--tap); padding: 0; }
#bPlay { min-width: 52px; }
#bSpeed { font-variant-numeric: tabular-nums; min-width: 56px; }
#bSpeed .sm { color: var(--k-sub); font-weight: 600; font-size: 13px; }

/* ── 예측 고르기: 그래프 자리에 놓는 옆 창(막 없음) ── */
#predict { position: absolute; inset: 0; z-index: 3; background: var(--k-paper); display: flex; flex-direction: column; padding: 0; gap: 8px; }
#predict .ph { font-size: 15px; font-weight: 800; }
#predict .pq { display: none; }
/* 알아 둘 것(처음 나오는 용어·기호의 뜻): 예측 보기 위쪽 */
#predict .pk { flex: none; margin: 0; font-size: 14px; line-height: 1.45; color: var(--k-ink-2); }
#predict .pk b { margin-right: 6px; font-weight: 800; color: var(--k-ink); }
#app.port #predict .pk { font-size: 13px; line-height: 1.4; }
#app.tiny #predict .pk { font-size: 12px; line-height: 1.3; }
.choices { flex: 1 1 auto; min-height: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); }
.choices.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice {
  display: flex; align-items: center; gap: 10px; text-align: left; min-height: 0; overflow: hidden;
  border: 1.5px solid var(--k-ctl); border-radius: var(--k-r); background: var(--k-paper); color: var(--k-ink);
  padding: 6px 12px; font-size: 15px; font-weight: 650; line-height: 1.3;
}
@media (hover: hover) { .choice:hover { background: var(--k-wash); border-color: var(--k-ink); } }
.choice .letter { flex: none; font-weight: 800; color: var(--k-sub); }
.choice svg { flex: none; color: var(--k-sub); }
html:lang(ja) .choice span { overflow-wrap: anywhere; }
/* 낮은 틀에서 보기가 36px 아래로 줄거나 글이 넘치면(main.js fitPredict): 보기 칸을 늘리고(pc2: 휴대폰 세로는 2열, 낮은 가로는 3열),
   그래도 모자라면 그림을 줄인다(pwide). 칸은 글 높이 아래로 줄지 않는다 */
#predict { overflow-y: auto; }
#app.pc2 .choices { grid-auto-rows: minmax(auto, 1fr); }
#app.pc2 .choice { min-height: 36px; }

/* ── 과제(스토리 모드) ── */
.tkHead { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; min-height: 24px; min-width: 0; }
#tkStep { font-size: 15px; font-weight: 800; color: var(--k-ink); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
#tkStep .no { color: var(--k-sub); font-weight: 700; margin-right: 8px; font-variant-numeric: tabular-nums; }
#tkStars { flex: none; font-size: 15px; color: var(--k-ink); white-space: nowrap; }
#tkDots { display: flex; gap: 5px; align-items: center; margin-left: auto; }
/* 단계 점: 각진 칸. 끝낸 것은 잉크로 칠하고, 지금 것은 테두리를 굵게 */
#tkDots i { width: 10px; height: 10px; display: block; box-shadow: inset 0 0 0 1.5px var(--k-ctl); font-style: normal; }
#tkDots i.ok { background: var(--k-ink); box-shadow: none; }
#tkDots i.on { box-shadow: inset 0 0 0 2.5px var(--k-ink); }
.more { flex: none; min-width: 40px; font-size: 14px; }
#tkBody { font-size: 16px; }
#tkBody p { margin: 0; line-height: 1.45; }
#tkBody p + p { margin-top: 5px; }
#tkBody > p:first-child:not(.key):not(.fb):not(.live) { font-weight: 650; font-size: 16.5px; }
#tkBody p.key { font-weight: 750; }
#tkBody b.ok { color: var(--ok-p); }
#tkBody b.no { color: var(--bad-p); }
#tkBody p.sub { color: var(--k-sub); font-size: 14px; }
#tkBody p.live { font-variant-numeric: tabular-nums; }
#tkBody p.pick { font-size: 14px; color: var(--k-sub); }
#tkBody p.pick b { color: var(--k-ink); }
#tkBody .muted { color: var(--k-sub); font-size: 14px; }
#tkBody .pairs { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; font-variant-numeric: tabular-nums; }
#tkBody .pair { color: var(--m-p); font-weight: 650; }
#tkBody .pair1 { white-space: nowrap; margin-right: 0.6em; }
#tkCtl:empty { display: none; }
#tkCtl { margin-top: 8px; }
#tkActs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; justify-content: flex-end; }
#tkActs:empty { display: none; }
#tkActs .k-btn { height: var(--tap); }
#tkActs .okmsg { margin-right: auto; font-size: 14px; font-weight: 800; color: var(--ok-p); }
body.free #task { display: none !important; }

/* ── 자유 모드 장면의 조절 칸: 그래프 위 종이에(과제 칸 대신) ── */
#freeCtl { grid-column: 2; grid-row: 1; padding: 2px 0 8px; border-bottom: 1px solid var(--k-rule); min-width: 0; }
body.free #main { grid-template-rows: auto minmax(0, 1fr); }
#freeCtl .fh { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
#freeCtl .fd { margin: 0 0 6px; font-size: 14px; color: var(--k-sub); line-height: 1.45; }

/* ── 슬라이더·단추 줄 ── */
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
.sl label { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 14px; color: var(--k-sub); white-space: nowrap; }
.sl .nm { color: var(--k-ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.sl output { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; color: var(--k-ink); }
/* 슬라이더 양옆 −/+: 한 칸씩 바꾼다(터치에서 끌기만으로는 0.5 N/m·0.01 kg 한 칸을 맞추기 어렵다, 2026-10-30 점검) */
.sl .rr { display: flex; align-items: center; gap: 4px; }
.sl .rr .k-range { flex: 1 1 auto; min-width: 0; }
.sl .nud { flex: none; width: 34px; height: var(--tap); padding: 0; font-size: 19px; font-weight: 700; line-height: 1; }
.sl .k-range { --q: var(--m-p); }
.sl.one { margin-top: 4px; }
.sl.one .k-range { --q: var(--h-p); }
.throw, .amps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.throw button, .amps button {
  height: var(--tap); min-width: 40px; border: 1.5px solid var(--k-ctl); border-radius: var(--k-r); background: var(--k-paper); color: var(--k-ink);
  padding: 0 12px; font-weight: 650; font-size: 14px; white-space: nowrap;
}
@media (hover: hover) { .throw button:hover, .amps button:hover { background: var(--k-wash); } }
.throw .thv { font-weight: 750; font-variant-numeric: tabular-nums; min-width: 72px; text-align: center; }
.throw button.tog[aria-pressed="true"] { font-weight: 750; box-shadow: inset 0 -3px 0 var(--k-ink); }
.amps .lbl { color: var(--k-sub); font-size: 14px; margin-right: 2px; }
.rows { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 6px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--m-p); font-weight: 650; }

/* ── 가운데 창(정보·메뉴·정리): 흰 종이, 반경 0, 그림자 없음. 뒤만 어둡게 ── */
#modal { position: fixed; inset: 0; z-index: 50; background: var(--k-dim); display: grid; place-items: center; padding: 12px; }
.card { width: min(600px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--k-paper); color: var(--k-ink); overflow: hidden; }
.cardBody { padding: 20px 22px 6px; overflow-y: auto; min-height: 0; -webkit-user-select: text; user-select: text; }
.cardActs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 22px 18px; justify-content: flex-end; flex: 0 0 auto; }
.cardActs .k-btn { height: var(--tap); }
.cardActs .k-link { margin-right: auto; }
.card h2 { margin: 0 0 10px; font-size: 22px; font-weight: 750; line-height: 1.38; }
.card h3 { font-size: 16px; margin: 16px 0 6px; font-weight: 800; }
.card h3:first-child { margin-top: 0; }
.card p { line-height: 1.6; margin: 0 0 8px; font-size: 15px; }
.card .small { color: var(--k-sub); font-size: 14px; }
.card .stars { margin-right: 6px; color: var(--k-ink); }
.card ul { margin: 0; padding-left: 18px; }
.card li { line-height: 1.55; margin-bottom: 4px; font-size: 14.5px; }
.card ul.eq li { margin: 5px 0; }
/* 단계·장면 목록(지금 것 = 공용 .k-on) */
.stList { display: grid; margin-top: 4px; }
.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; }
.stList .c { font-size: 14px; color: var(--k-sub); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── 시작 화면(_kit/start.js의 startSheet): 오른쪽 칸(휴대폰은 아래)에 놓인다. 장면은 그대로 보인다 ── */
body.starting #task, body.starting #panel, body.starting #freeCtl, body.starting #playbar { display: none !important; }
#main > .k-start { grid-column: 2; grid-row: 1 / 3; min-height: 0; height: 100%; padding: 6px 4px 8px 6px; }
.k-start.x-tiny { gap: 6px; }
.k-start.x-tiny .k-q { font-size: 14px; line-height: 1.25; }

/* ── 세로 화면(휴대폰): 그림 / 그래프 / 과제(3줄로 접힘) ── */
#app.port #main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.18fr) minmax(0, 0.92fr) auto; row-gap: 6px; padding: 0 10px 8px; }
#app.port #sceneBox { grid-column: 1; grid-row: 1; }
#app.port #panel { grid-column: 1; grid-row: 2; margin-top: 0; }
#app.port #task { grid-column: 1; grid-row: 3; border-bottom: 0; border-top: 1px solid var(--k-rule); padding: 6px 0 0; }
#app.port #freeCtl { grid-column: 1; grid-row: 3; border-bottom: 0; border-top: 1px solid var(--k-rule); padding: 6px 0 0; }
body.free #app.port #main { grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr) auto; }
/* 자유 모드의 그래프 장면(x·v·a, a–x, 단위원)도 그래프 칸을 크게: x·v·a 세 판은 150px보다 낮으면 그리지 않아 휴대폰에서 빈칸이었다 */
body.free #app.port.gfocus #main { grid-template-rows: minmax(0, 1fr) minmax(150px, 1fr) auto; }
body.starting #app.port.port #main { grid-template-rows: minmax(0, 1fr) 0 minmax(0, 2.2fr); }
body.starting #app.port #main > .k-start { grid-column: 1; grid-row: 3; padding: 10px 2px 4px; }
#app.port.cardOpen #main { grid-template-rows: minmax(0, 1.18fr) minmax(0, 0.92fr) var(--cardH, auto); }
#app.port #task.open { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 12; max-height: var(--openMax, calc(100% - 12px)); overflow: auto; border-top: 1.5px solid var(--k-ink); padding: 8px 0 0; }
#app.port #task.open.openFull { top: 0; max-height: none; }
/* 아주 넓고 낮은 가로 화면(휴대폰 가로): 그림 | 그래프 | 과제 */
#app.tri #main { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.95fr); grid-template-rows: minmax(0, 1fr); column-gap: 10px; }
#app.tri #sceneBox { grid-column: 1; grid-row: 1; }
#app.tri #panel { grid-column: 2; grid-row: 1; margin-top: 0; }
#app.tri #task, #app.tri #freeCtl { grid-column: 3; grid-row: 1; align-self: stretch; border-bottom: 0; overflow: hidden; }
#app.tri #main > .k-start { grid-column: 2 / 4; grid-row: 1; }
/* 그래프가 주인공인 단계(휴대폰 세로): 그래프 칸을 더 크게 */
#app.port.gfocus #main { grid-template-rows: minmax(0, 1fr) minmax(150px, 1.05fr) auto; }
/* 그래프 단계의 휴대폰: 읽음 상자는 숨긴다(값은 그래프 값표에). 낮은 그림을 읽음 상자가 덮어 몇십 px만 남던 것을 고침(2026-10-30) */
#app.port.gfocus #readout { display: none; }
#app.port.gfocus.cardOpen #main { grid-template-rows: minmax(0, 1fr) minmax(150px, 1.05fr) var(--cardH, auto); }
/* 그래프 판이 하나뿐인 걸음(a–x, 미션)의 휴대폰 세로: 그래프 칸 바닥 110px(main.js G1) */
#app.port.gfocus.g1:not(.asking) #main { grid-template-rows: minmax(0, 1fr) minmax(110px, 1.05fr) auto; }
#app.port.gfocus.g1.cardOpen:not(.asking) #main { grid-template-rows: minmax(0, 1fr) minmax(110px, 1.05fr) var(--cardH, auto); }
body.free #app.port.gfocus.g1 #main { grid-template-rows: minmax(0, 1fr) minmax(110px, 1fr) auto; }
/* 단위원 걸음(4-2·4-3·자유 4)의 휴대폰 세로: 3D 그림을 접고 단위원을 크게(main.js CIRCLE). 3D 그림이 80px 남짓으로 줄어 바퀴가 안 보였다 */
#app.port.circ #sceneBox { display: none; }
#app.port.circ #main, #app.port.circ.asking #main, #app.port.circ.asking.knowing #main, body.free #app.port.circ.gfocus #main { grid-template-rows: 0 minmax(0, 1fr) auto; }
#app.port.circ.cardOpen #main { grid-template-rows: 0 minmax(0, 1fr) var(--cardH, auto); }
/* 휴대폰 세로에서 낮은 그림(170px 아래): 시점 단추를 숨긴다(그림 끌기와 ⟲는 남는다, main.js fitScene) */
#app.port.sceneShort #views { display: none; }
/* 낮은 휴대폰 세로(높이 520px 아래: 341×470, 356×496): 그래프 칸 바닥을 낮추고 그림에 몫을 더 준다. 341×470에서 단추 띠 위로
   남는 그림이 52~59px라 바퀴가 조각만 보이던 것(2026-10-30 점검). 세 판 그래프는 120px, 판 하나(a–x, 미션)는 88px */
body:not(.free):not(.starting) #app.port.lowport.gfocus:not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1fr) minmax(120px, 0.95fr) auto; }
body:not(.free):not(.starting) #app.port.lowport.gfocus.cardOpen:not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1fr) minmax(120px, 0.95fr) var(--cardH, auto); }
body:not(.free):not(.starting) #app.port.lowport.gfocus.g1:not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1.15fr) minmax(88px, 0.85fr) auto; }
body:not(.free):not(.starting) #app.port.lowport.gfocus.g1.cardOpen:not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1.15fr) minmax(88px, 0.85fr) var(--cardH, auto); }
body:not(.free):not(.starting) #app.port.lowport:not(.gfocus):not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1.3fr) minmax(70px, 0.8fr) auto; }
body:not(.free):not(.starting) #app.port.lowport.cardOpen:not(.gfocus):not(.asking):not(.circ) #main { grid-template-rows: minmax(0, 1.3fr) minmax(70px, 0.8fr) var(--cardH, auto); }
/* 자유 모드도 같은 까닭으로(341×470 일본어 장면 1에서 56px였다) */
body.free #app.port.lowport:not(.gfocus):not(.circ) #main { grid-template-rows: minmax(0, 1.35fr) minmax(76px, 0.75fr) auto; }
body.free #app.port.lowport.gfocus:not(.g1):not(.circ) #main { grid-template-rows: minmax(0, 1fr) minmax(120px, 0.95fr) auto; }
body.free #app.port.lowport.gfocus.g1:not(.circ) #main { grid-template-rows: minmax(0, 1.15fr) minmax(88px, 0.85fr) auto; }
/* 조절 칸이 단추 한 줄뿐이고 아래 단추가 하나면(미션의 θ, 4-4의 ω 두 배) 휴대폰 세로에서 한 줄로 합친다(main.js row1) */
#app.port #task.row1 { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; }
#app.port #task.row1 > .tkHead, #app.port #task.row1 > #tkBody { grid-column: 1 / -1; }
#app.port #task.row1 > #tkCtl { grid-column: 1; grid-row: 3; margin-top: 8px; }
#app.port #task.row1 > #tkActs { grid-column: 2; grid-row: 3; margin-top: 8px; flex-wrap: nowrap; }
#app.port #task.row1 .throw { flex-wrap: nowrap; gap: 4px; }
#app.port #task.row1 .throw button { padding: 0 9px; }
#app.port #task.row1 .throw .thv { min-width: 0; flex: 1 1 auto; }
#app.port #task.row1 .thv .kk, #app.port #task.row1 #tkActs .okmsg .t { display: none; }
/* 접힌 과제 카드: 본문 3줄(줄 높이에 딱 맞춰 반쯤 잘린 줄이 없게), 피드백을 맨 앞에 */
#app.compact #tkBody, #app.clamp #tkBody { display: flex; flex-direction: column; font-size: 14px; line-height: 19px; }
#app.compact #tkBody p, #app.clamp #tkBody p { margin: 0 !important; font-size: 14px !important; line-height: 19px; }
/* 접힌 카드(3줄)에서 먼저 보이는 차례(2026-10-30): 결론 줄, 지금 할 일(.do: 결과 기다림·돌려 보기·재기·줄이기), 판정 줄, 그다음 질문.
   실시간 값 줄(.live)은 제자리(질문 뒤)라 먼저 접힌다. 예전에는 값 줄이 맨 앞이라 '결과 보기를 눌러요'·'2° 아래까지' 같은 할 일이 숨었다 */
#app.compact #tkBody p.fb, #app.clamp #tkBody p.fb { order: -1; }
#app.compact #tkBody p.do, #app.clamp #tkBody p.do { order: -2; color: var(--k-ink-2); }
#app.compact #task:not(.open) #tkBody p.pick, #app.clamp #task:not(.open) #tkBody p.pick { display: none; }
#app.compact #tkBody i, #app.compact #tkBody sup, #app.compact #tkBody sub, #app.clamp #tkBody i, #app.clamp #tkBody sup, #app.clamp #tkBody sub { line-height: 0; }
#app.compact #tkBody p.key, #app.clamp #tkBody p.key { order: -3; }
#app.clamp:not(.port):not(.tri) #task.open { position: absolute; right: 12px; top: 0; width: calc((100% - 40px) / 2.16); max-height: calc(100% - 10px); overflow: auto; z-index: 12; background: var(--k-paper); border: 1.5px solid var(--k-ink); padding: 8px 10px; }
#app.tiny:not(.port) #task.open { position: absolute; right: 6px; top: 0; bottom: 6px; width: min(440px, 64%); z-index: 12; overflow: auto; background: var(--k-paper); border: 1.5px solid var(--k-ink); padding: 6px 8px; }
#app.tri #task.open { grid-column: 2 / 4; z-index: 12; overflow-y: auto; background: var(--k-paper); }
#app.tri #task.open.openFull { grid-column: 1 / 4; }
/* 펼친 카드는 격자 전체를 기준으로 덮는다 (절대 위치 격자 항목은 자기 칸이 기준이 되므로) */
#app.port #task.open, #app.tiny #task.open, #app.clamp:not(.tri) #task.open { grid-column: 1 / -1; grid-row: 1 / -1; }

/* ── 좁은·낮은 화면 ── */
#app.compact { --hdr: 48px; }
#app.narrow #views button span { display: none; }
#app.narrow #views > button { padding: 2px 8px; }
#app.sceneNarrow #views button span { display: none; }
#app.sceneNarrow #views > button { padding: 2px 8px; }
#app.short { --hdr: 44px; --gap: 8px; }
#app.short #main { padding: 0 8px 6px; column-gap: 10px; }
#app.short #task { padding: 0 0 6px; }
#app.short #tkActs { margin-top: 4px; }
#app.short #readout { top: 6px; left: 6px; padding: 2px 7px; font-size: 12.5px; }
#app.short #bHome { top: 6px; right: 6px; }
#app.short #views { left: 6px; bottom: 6px; }
#app.short #playbar { right: 6px; bottom: 6px; gap: 4px; }
#app.port #readout { font-size: 12.5px; top: 6px; left: 6px; padding: 2px 7px; }
#app.port #bHome { top: 6px; right: 6px; }
#app.port #views { left: 6px; bottom: 6px; }
#app.port #playbar { right: 6px; bottom: 6px; gap: 4px; }
#app.port #bSpeed .sm, #app.short #bSpeed .sm, #app.sceneNarrow #bSpeed .sm { display: none; }
#app.short #bPlay, #app.sceneNarrow #bPlay { min-width: 40px; }
#app.short #playbar .k-btn:not(.ic), #app.sceneNarrow #playbar .k-btn:not(.ic) { padding: 0 9px; }
#app.port .choice { font-size: 14px; padding: 4px 10px; }
#app.port .choices.n4 { grid-template-columns: minmax(0, 1fr); }
#app.port .choices.n4 .choice svg { display: none; }
#app.port #predict .ph { display: none; }
#app.port.asking #main { grid-template-rows: minmax(0, 0.85fr) minmax(0, 1.15fr) auto; }
#app.port.asking.knowing #main { grid-template-rows: minmax(0, 0.5fr) minmax(0, 1.5fr) auto; } /* 알아 둘 것이 있는 예측: 보기가 36px 아래로 줄지 않게 그림을 줄인다(영어는 알아 둘 것이 세 줄) */
/* 휴대폰 세로에서 예측을 고르는 동안: 질문을 보기 위에 둔다(과제 카드는 숨긴다). 예전에는 보기가 위, 질문이 맨 아래라 보기부터 읽혔다(2026-10-29) */
#app.port.asking #task { display: none; }
#app.port.pc2 .choices.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#app.port.pc2 .choice { gap: 7px; padding: 4px 8px; }
#app.port.asking.pwide #main, #app.port.asking.knowing.pwide #main { grid-template-rows: minmax(72px, 0.34fr) minmax(0, 1.66fr) auto; }
#app.port.asking #predict .pq { display: block; flex: none; font-size: 15px; line-height: 1.4; font-weight: 650; }
#app.port.asking #predict .pq p { margin: 0; }
#app.port .sliders { gap: 0 12px; }
#app.port .sl label { font-size: 13px; }
#app.port .sl output { font-size: 14px; }
#app.tri #readout { display: none; }
#app.tri #views { top: 6px; bottom: auto; left: auto; right: 52px; }
/* 낮은 가로 화면: 슬라이더는 두 단(이름은 기호만), 장면 설명 한 줄은 뺀다 */
#app.tri .sliders { grid-template-columns: 1fr; gap: 0; }
#app.tiny .sliders { grid-template-columns: 1fr; gap: 0; }
#app.tri .sl .lw, #app.tiny .sl .lw { display: none; }
/* 세 칸 배치: 슬라이더 하나가 한 줄(이름·값 | − 슬라이더 +). 두 칸으로 나누면 −/+ 사이 슬라이더가 30px 남짓이 된다 */
#app.tri .sl { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; }
#app.tri .sl label { gap: 5px; }
#app.short #freeCtl .fd { display: none; }
#app.short .choice svg { display: none; }
#app.tri .throw { flex-wrap: nowrap; gap: 4px; }
/* 세 칸 배치: 진폭 단추 셋이 한 줄에 들도록 이름 글자는 숨긴다(무리 이름은 aria-label에 있다) */
#app.tri .amps { flex-wrap: nowrap; gap: 4px; }
#app.tri .amps .lbl { display: none; }
#app.tri .amps button { padding: 0 8px; }
#app.tri .throw button { padding: 0 8px; }
#app.tri .throw .thv { min-width: 0; flex: 1 1 auto; }
#app.tri #tkDots { display: none; }
#app.tri #tkActs .okmsg .t { display: none; }
/* 낮은 가로 화면의 과제: 단추는 머리 줄 오른쪽(글·조절 칸에 자리를 준다). 머리 줄이 모자라면 단계 이름을 숨긴다(위 탭에 보인다) */
#app.tri #task { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto; align-content: start; column-gap: 8px; }
#app.tri .tkHead { grid-column: 1; grid-row: 1; margin: 0; }
#app.tri #tkActs { grid-column: 2; grid-row: 1; margin: 0; flex-wrap: nowrap; gap: 6px; }
#app.tri #tkBody { grid-column: 1 / -1; grid-row: 2; margin-top: 4px; }
#app.tri #tkCtl { grid-column: 1 / -1; grid-row: 3; }
#app.tri #task.nostep #tkStep, #app.tiny #task.nostep #tkStep { display: none; }
#app.tri #task.actsDown .tkHead { grid-column: 1 / -1; }
#app.tri #task.actsDown #tkActs { grid-column: 1 / -1; grid-row: 4; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
#app.tri .thv .kk { display: none; }
/* 낮은 가로 화면에서 예측을 고르는 동안: 보기 창이 그래프와 과제 칸을 함께 쓴다(질문은 보기 위에) */
#app.tri.asking #task { display: none; }
#app.tri.asking #panel { grid-column: 2 / 4; }
#app.tri.asking #predict .pq { display: block; font-size: 14px; line-height: 1.4; font-weight: 650; }
#app.tri.asking #predict .ph { display: none; }
#app.tri.pc2 .choices.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#app.tri.asking.pwide #main { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1fr) minmax(0, 0.95fr); }
/* 아주 작은 틀(320×200 등): 장면 | 과제·그래프, 조절 칸은 '더 보기'에서 */
#app.tiny { --hdr: 40px; }
#app.tiny:not(.tri):not(.port) #main { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); padding: 0 6px 4px; column-gap: 8px; }
#app.tiny:not(.port) #task:not(.open) #tkCtl { display: none; }
#app.tiny #tkDots, #app.tiny #readout, #app.tiny #views, #app.tiny #tkStars, #app.tiny #predict .ph { display: none; }
#app.tiny .choices { gap: 4px; }
#app.tiny .choice { padding: 2px 6px; font-size: 12.5px; line-height: 1.2; }
#app.tiny .choice svg { display: none; }
#app.tiny #predict { gap: 4px; }
#app.tiny #bSpeed, #app.tiny #bRestart { display: none; }
#app.tiny #bPlay { min-width: 36px; padding: 0; width: 36px; }
#app.tiny #playbar { gap: 4px; right: 4px; bottom: 4px; }
/* 아주 작은 틀에서 예측을 고르는 동안: 그림 자리까지 써서 질문과 보기를 한 화면에(보기 높이 36px 이상) */
#app.tiny.asking:not(.port) #task, #app.tiny.asking:not(.port) #sceneBox { display: none; }
#app.tiny.asking:not(.port) #main { grid-template-columns: minmax(0, 1fr); }
#app.tiny.asking:not(.port) #panel { grid-column: 1; grid-row: 1 / 3; margin-top: 0; }
#app.tiny.asking:not(.port) #predict .pq { display: block; font-size: 13px; line-height: 1.35; font-weight: 650; }
#app.tiny .choices { grid-auto-rows: minmax(36px, auto); flex: none; }
#app.tiny #predict { overflow-y: auto; } /* 320×200: 보기가 많으면 창 안에서 스크롤 */
#app.tiny .choice { min-height: 36px; }
/* 아주 작은 틀의 자유 모드: 조절 칸은 위 절반에서 안으로 스크롤, 그래프는 아래 절반 */
body.free #app.tiny:not(.port) #main { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
#app.tiny #freeCtl { overflow: auto; padding-bottom: 4px; }
#app.tiny #freeCtl .fh { font-size: 13px; margin-bottom: 2px; }
#app.tiny #tkStep { font-size: 13px; }
/* 아주 작은 틀: 접은 글은 두 줄, 단추는 한 줄(단추 줄이 틀 안에 남게) */
#app.tiny #tkActs { flex-wrap: nowrap; gap: 4px; margin-top: 4px; }
#app.tiny #tkActs .k-btn { padding: 0 8px; font-size: 13px; }
#app.tiny .stList > button { min-height: 36px; padding: 2px 4px; font-size: 14px; }
#app.tiny .cardBody { padding: 10px 14px 2px; }
#app.tiny .card h2 { font-size: 16px; margin-bottom: 6px; }
#app.tiny .card p { font-size: 13px; margin-bottom: 4px; line-height: 1.45; }
#app.tiny .cardActs { padding: 6px 14px 8px; }
#app.tiny #modal { padding: 4px; }
/* 아주 작은 틀의 시작 화면: 판 자리가 모자라 그림과 위 막대 자리까지 쓴다 */
body.starting #app.tiny:not(.port) #sceneBox, body.starting #app.tiny:not(.port) #top { display: none; }
body.starting #app.tiny:not(.port) #main { grid-template-columns: minmax(0, 1fr); }
body.starting #app.tiny:not(.port) #main > .k-start { grid-column: 1; grid-row: 1 / 3; }
/* 낮은 가로 화면의 가운데 창: 단계 목록은 두 단, 글은 작게(창 안 스크롤 없이) */
@media (max-height: 340px) and (min-width: 521px) {
  .stList { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .stList > button:nth-last-child(2) { border-bottom: 1px solid var(--k-rule); }
  .card h2 { font-size: 15.5px !important; margin-bottom: 4px !important; line-height: 1.3; }
  .card p { font-size: 13px !important; line-height: 1.4 !important; margin-bottom: 4px !important; }
  .cardBody { padding: 8px 14px 2px !important; }
  .cardActs { padding: 4px 14px 8px !important; }
}
@media (max-height: 520px) {
  .cardBody { padding: 12px 16px 4px; }
  .cardActs { padding: 8px 16px 10px; }
  .card h2 { font-size: 18px; margin-bottom: 6px; }
  .card p { font-size: 14px; margin-bottom: 6px; }
  .stList > button { min-height: 38px; padding: 2px 4px; font-size: 14.5px; }
}
@media (max-width: 520px) {
  .cardBody { padding: 14px 16px 4px; }
  .cardActs { padding: 8px 16px 12px; }
  .card h2 { font-size: 19px; }
}
@media (max-width: 520px) and (max-height: 540px) {
  .card h2 { font-size: 17px; line-height: 1.32; margin-bottom: 6px; }
  .card p { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
  .card .small { font-size: 13px; }
}

/* 썸네일 찍기용 */
#app.thumb #legend, #app.thumb #top, #app.thumb #task, #app.thumb #panel, #app.thumb #playbar, #app.thumb #views, #app.thumb #bHome, #app.thumb #readout, #app.thumb #freeCtl { display: none !important; }
#app.thumb #main { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) !important; padding: 0 !important; }
#app.thumb #sceneBox { grid-column: 1 !important; grid-row: 1 !important; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 좁은 그림에서 시점 단추와 재생 막대가 겹칠 때(main.js fitBars) */
#app.crowd #views { left: 4px; }
#app.crowd #views > button { min-width: 32px; padding: 2px 4px; }
#app.crowd #playbar { gap: 2px; right: 4px; }
#app.crowd #playbar .k-btn:not(.ic) { padding: 0 5px; }
#app.crowd #playbar .k-btn.ic { width: 32px; }
/* 그래도 겹치면 시점 단추는 숨긴다(그림을 끌면 시점이 돌고 ⟲가 처음 시점으로 돌린다) */
#app.crowd2 #views { display: none; }

/* 아주 작은 틀(320×200): 과제 칸이 넘치면 칸 안에서 스크롤한다(첫 문장이 칸보다 길 때) */
#app.tiny:not(.port) #task { overflow: auto; }
#app.cardFull #sceneBox, #app.cardFull #panel { visibility: hidden; }
