/* 「중력을 뒤집으면」 화면 스타일 — lt-opus-design. 토큰은 ../tokens.css(빌드 시 head에 인라인)
   개발 미리보기(site/index.html을 바로 열 때)용으로 토큰을 불러온다. 빌드에서 이 파일을 인라인하면 이 줄은 무시된다(HOOKS.md 4절). */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--c-paper); color: var(--c-ink);
  font-family: var(--font); font-weight: var(--w-body); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; border-radius: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: fixed; left: 12px; top: 12px; z-index: 20; background: var(--c-ink); color: var(--c-paper); padding: 8px 12px; border-radius: 4px; transform: translateY(-200%); }
.skip:focus { transform: none; }

/* ── 머리띠: 왼쪽 작품명 / 오른쪽 엘리베이터 미니맵 + 움직임 일시정지 ── */
.hud {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-hud); height: var(--hud-h);
  display: flex; justify-content: space-between; align-items: center; padding: 0 var(--margin);
  background: color-mix(in srgb, var(--c-paper) 88%, transparent);
  border-bottom: var(--lw-thin) solid var(--c-guide);
}
.hud .brand { font-weight: var(--w-ui); font-size: var(--fs-ui); letter-spacing: -0.01em; }
.hud-right { display: flex; align-items: center; gap: var(--s-3); }
.lift { display: inline-flex; align-items: center; gap: 2px; background: var(--c-led-panel); border-radius: 6px; padding: 5px 6px; box-shadow: inset 0 0 0 2px #2A3035; }
.lift .cell { padding: 3px 5px; border-radius: 3px; }
.lift .dots {
  /* 꺼진 층: 켜진 층(--c-led, 빛 번짐·점등 칸 바탕)보다 확실히 어둡되 판 위 3:1 이상(v0.3.5 qa/CONTRAST.md, #8D6250 on #161A1E ≈ 3.33:1).
     글자는 모든 화면에서 19px 이상 굵은 글(큰 글 기준 3:1). 미니맵 전체는 role="img"이고 칸은 aria-hidden — 읽는 이름은 "현재 N층"뿐이다 */
  --p: 2.5px; display: block; font-weight: var(--w-led); font-size: 21px; line-height: 1; letter-spacing: .02em; color: #8D6250;
  -webkit-mask-image: radial-gradient(circle, #000 0 calc(var(--p) * .38), transparent calc(var(--p) * .48));
          mask-image: radial-gradient(circle, #000 0 calc(var(--p) * .38), transparent calc(var(--p) * .48));
  -webkit-mask-size: var(--p) var(--p); mask-size: var(--p) var(--p);
}
.lift .cell.is-on { background: #24140F; filter: drop-shadow(0 0 4px rgba(255, 90, 44, .65)); }
.lift .cell.is-on .dots { color: var(--c-led); }
.lift[data-flipped] { flex-direction: row-reverse; }
/* 화살표 자리는 늘 잡아 둔다(보일 때만 켬): 층이 바뀔 때 미니맵 폭이 변해 머리띠가 밀리던 것(레드팀 v0.2.2, 320 CLS) */
.lift .lift-arrow { width: 11px; height: 11px; fill: var(--c-led); margin: 0 3px; display: block; visibility: hidden; }
.lift[data-moving] .lift-arrow { visibility: visible; }
.lift[data-moving="up"] .lift-arrow { transform: rotate(180deg); }
.toggles { display: flex; align-items: center; gap: 8px; }
.toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px;
  font-weight: var(--w-ui); font-size: var(--fs-small); line-height: 1;
  padding: 8px 13px 8px 11px; border-radius: 999px; border: 1.5px solid var(--c-ink-3); color: var(--c-ink);
  transition: background-color var(--dur-ui) var(--ease-ui);
}
.toggle[hidden] { display: inline-flex !important; visibility: hidden; }   /* 엔진이 켜기 전에도 자리를 잡는다 → 켜질 때 밀림 없음 */
.toggle svg { width: 14px; height: 14px; flex: none; }
.toggle-sound svg { width: 16px; }
/* 상태는 data-pressed(v0.3.5: aria-pressed는 쓰지 않는다 — 보이는 라벨이 동작을 말한다) */
.toggle .ic-on, .toggle[data-pressed="true"] .ic-off { display: none; }
.toggle[data-pressed="true"] .ic-on { display: inline; }
/* 라벨 두 가지(켜기/끄기)를 한 칸에 겹쳐 긴 쪽 폭으로 고정 → 눌러서 문구가 바뀌어도 폭이 그대로 */
.tg-label { display: inline-grid; }
.tg-label > * { grid-area: 1 / 1; }
.tg-ghost { visibility: hidden; }
.toggle.is-on, .toggle[data-pressed="true"] { background: var(--c-ink); color: var(--c-paper); border-color: var(--c-ink); }
/* 머리띠 아래 작은 알림(소리 켜기 실패 · U-08 첫 진동 안내) */
.hud-note {
  position: absolute; right: var(--margin); top: calc(100% + 8px); max-width: min(360px, calc(100vw - 2 * var(--margin)));
  padding: 8px 12px; background: var(--c-paper); border: 1.5px solid var(--c-ink); border-radius: 6px; box-shadow: 3px 3px 0 var(--c-guide);
  font-size: var(--fs-small); line-height: 1.5;
}
.hud-note:empty { display: none; }

/* 차례가 아니거나 막힌 조작(엔진이 aria-disabled="true"): 흐리게, 누를 수 없는 커서(레드팀 v0.2.2 5절 5번) */
.btn[aria-disabled="true"], .btn-link[aria-disabled="true"] { opacity: .42; cursor: default; }
.btn[aria-disabled="true"]:active { transform: none; }
[data-action][aria-hidden="true"][aria-disabled="true"] { cursor: default; }
.btn-link { padding: 10px 4px; min-height: 40px; font-weight: var(--w-ui); font-size: var(--fs-small); color: var(--c-ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.d-only { display: inline; }
@media (max-width: 720px) { .d-only { display: none; } }

/* ── 장면 = 한 층. 패널은 100svh로 고정되고 섹션 길이가 스크롤 구간이 된다 ── */
.scene { position: relative; }
.scene[data-scene="s0"] { min-height: 100svh; }
.scene[data-scene="s2"] { min-height: 140svh; }
.scene[data-scene="s3"] { min-height: 100svh; }
.scene[data-scene="s4"] { min-height: 260svh; }
.panel { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.stage { position: absolute; inset: 0; }
.room { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.copy { position: absolute; inset: 0; z-index: var(--z-copy); pointer-events: none; }
/* 무대 위 글은 누름을 가로채지 않는다: 방을 누르면 그 높이에서 공이 떨어지므로(v0.2.2 #3, 320에서 안내 문단이 방 위쪽을 덮던 문제)
   버튼·링크만 누름을 받는다 */
.copy > *, .copy h1 > * { pointer-events: none; }
.copy a, .copy button, .copy summary { pointer-events: auto; }
[data-place] { position: absolute; }
.copy h1 { position: static; font: inherit; }

/* 훅 요소의 시각 규칙 */
.pbody { position: absolute; left: 0; top: 0; z-index: var(--z-bodies); transform-origin: 0 0; }
.pbody svg { display: block; overflow: visible; position: absolute; left: 50%; bottom: 0; translate: -50% 0; }
.pbody[data-shape="circle"] svg { bottom: auto; top: 50%; translate: -50% -50%; }   /* 공은 상자 한가운데(구를 때 중심이 같다) */
.pbody svg.is-mirror { transform: scaleX(-1); }
.pbody[data-action] { cursor: pointer; touch-action: manipulation; }
.phys-preview { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; overflow: visible; }
.phys-outline { fill: none; stroke: #00a38e; stroke-width: 2; stroke-dasharray: 5 3; }
.phys-outline.is-lamp { stroke: #8a5cf6; }
.phys-label { font: 600 11px/1 ui-monospace, monospace; fill: #0d5f55; }
.plamp { position: absolute; z-index: 1; pointer-events: none; transform: rotate(var(--lamp-angle, 0rad)); }
.plamp svg { display: block; overflow: visible; }
.plamp.is-fallen .lamp-cone { display: none; }
.hit { position: absolute; z-index: 1; cursor: pointer; touch-action: manipulation; }
.strip { position: absolute; z-index: 1; pointer-events: none; }
.strip svg { display: block; overflow: visible; }
.strip [data-replay-cursor] { position: absolute; top: -8px; bottom: -8px; left: calc(var(--cursor, 0) * 100%); width: 0; border-left: 1.5px solid var(--c-ink); }
.strip [data-replay-cursor]::before { content: ""; position: absolute; top: -6px; left: -6px; border: 5px solid transparent; border-top-color: var(--c-ink); }
.marks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: var(--z-marks); pointer-events: none; overflow: visible; }   /* 표지: 제목 글자 위, 물건 아래 */
/* 아래층 반응 '…?'(v0.2 #3): 도면 위 말풍선 표지. 폭에 비례해 1440에서도 한눈에 보이고, 나타날 때 한 번 튄다 */
.react {
  position: absolute; z-index: 4; pointer-events: none;
  font-weight: 800; font-size: clamp(26px, 2.6vw, 44px); line-height: 1; letter-spacing: .02em; color: var(--c-ink);
  padding: .16em .42em .22em; border-radius: 999px; background: var(--c-paper); border: 2px solid var(--c-ink);
  box-shadow: 3px 3px 0 var(--c-guide);
  animation: react-pop .36s cubic-bezier(.2, 1.6, .4, 1) both;
}
[data-react="laptop"] { font-size: clamp(15px, 1.25vw, 21px); border-width: 1.5px; box-shadow: none; }
/* transform 대신 scale·translate 속성: S4 [data-building-upright]의 역회전(transform)을 덮어쓰지 않는다 */
@keyframes react-pop { from { scale: .4; translate: 0 8px; opacity: 0; } to { scale: 1; translate: 0 0; opacity: 1; } }
@media (max-width: 720px) { .react { font-size: 24px; } }

/* 엔진 파동(proto/motion createSlabWave)을 단면도 언어로: 쿵 색, 아래로 퍼지는 반타원 */
.lt-slab-wave-layer { position: absolute; z-index: 1; pointer-events: none; color: var(--c-kung); overflow: visible; }
/* v0.2 #3: 호 크기·두께를 화면 폭에 비례(390 ≈ 156px·2.5px → 1440 ≈ 518px·3.7px). 지속시간·진폭은 엔진(createSlabWave) */
.lt-slab-wave-arc {
  border-width: clamp(2.5px, .26vw, 4px) !important;
  inline-size: clamp(9.75rem, 36vw, 38rem) !important; block-size: clamp(4rem, 6vw, 7rem) !important;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c-kung) 40%, transparent));
}

/* ── 글 ── */
.display { font-weight: var(--w-display); font-size: var(--fs-display); line-height: 1; letter-spacing: var(--track-display); white-space: nowrap; }
.display.is-wrapped { white-space: normal; line-height: 1.04; width: 7em; }
.h2 { font-weight: var(--w-h2); font-size: var(--fs-h2); line-height: 1.14; letter-spacing: -0.015em; text-wrap: balance; }
.lead { font-size: var(--fs-lead); line-height: var(--lh-lead); color: var(--c-ink-2); }
.annot { font-size: var(--fs-annot); font-weight: var(--w-annot); letter-spacing: var(--track-annot); color: var(--c-ink-2); }
.u06 { font-size: var(--fs-annot); line-height: 1.55; color: var(--c-ink-2); max-width: 36ch; }
.cue { font-weight: var(--w-ui); font-size: var(--fs-ui); color: var(--c-ink); }
.band-note { font-size: 13px; line-height: 1.5; color: var(--c-ink-2); width: 172px; }
.band-note .note-leader { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.keys, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scroll-hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); font-weight: var(--w-ui); color: var(--c-ink-2); text-decoration: none; }
.scroll-hint svg { width: 12px; height: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-weight: var(--w-ui); font-size: 16px; line-height: 1;
  padding: 13px 20px 14px; border-radius: 4px; border: 2px solid var(--c-ink);
  transition: transform var(--dur-ui) var(--ease-ui);
}
.btn:active { transform: translateY(2px); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { font-size: var(--fs-small); padding: 9px 13px 10px; border-width: 1.5px; min-height: 40px; }
.btn-primary { background: var(--c-ink); color: var(--c-paper); }
.btn-ghost { background: color-mix(in srgb, var(--c-paper) 85%, transparent); color: var(--c-ink); }

/* ── 단면도 SVG ── */
.ln-cut     { stroke: var(--c-ink);  stroke-width: var(--lw-cut);    fill: none; }
.ln-beyond  { stroke: var(--c-ink-3); stroke-width: var(--lw-beyond); fill: none; }
.ln-thin    { stroke: var(--c-ink-3); stroke-width: var(--lw-thin);   fill: none; }
.ln-leader  { stroke: var(--c-ink-2); }
.ln-guide   { stroke: var(--c-guide); stroke-width: var(--lw-thin);   fill: none; stroke-dasharray: 10 4 2 4; }
.ln-motion  { stroke: var(--c-ink-3); stroke-width: var(--lw-thin);   fill: none; stroke-dasharray: 4 5; }
.ln-body    { stroke: var(--c-ink);  stroke-width: var(--lw-body);   stroke-linejoin: round; stroke-linecap: round; }
.ln-cord    { stroke: var(--c-ink);  stroke-width: var(--lw-beyond); }
.ln-rail    { stroke: var(--c-ink-3); stroke-width: var(--lw-beyond); }
.f-paper { fill: var(--c-paper); } .f-paper-2 { fill: var(--c-paper-2); }
.f-concrete { fill: var(--c-concrete); } .f-aggregate { fill: var(--c-aggregate); } .f-mortar { fill: var(--c-mortar); }
.f-wood { fill: var(--c-wood); } .f-soft { fill: var(--c-soft); } .f-soft-tint { fill: var(--c-soft-tint); }
.f-kung { fill: var(--c-kung); } .f-ceramic { fill: var(--c-ceramic); } .f-ink { fill: var(--c-ink); } .f-lamp { fill: var(--c-lamp); }
.s-soft { stroke: var(--c-soft); stroke-width: 1px; fill: none; }
.s-hatch { stroke: var(--c-aggregate); stroke-width: .8px; }
.s-grain { stroke: var(--c-wood-ink); stroke-width: .8px; fill: none; opacity: .55; }
.s-wood { stroke: var(--c-wood-ink); stroke-width: var(--lw-body); stroke-linejoin: round; }
.s-kung { stroke: var(--c-kung); fill: none; stroke-linecap: round; }
.s-leaf { stroke: var(--c-soft); stroke-width: 2.2px; fill: none; stroke-linecap: round; }
.stop-lamp { stop-color: var(--c-lamp); } .stop-kung { stop-color: var(--c-kung); }
.band-bg { opacity: .7; }
.burst { stroke-width: 1.3px; opacity: .55; } .burst.is-now { stroke-width: 2px; opacity: 1; }
.fading { opacity: .4; }
.screen { fill: var(--c-screen); } .tile { fill: var(--c-tile); stroke: var(--c-tile-face); stroke-width: .6px; } .tile-me { fill: #D6E4EE; } .tile-face { fill: var(--c-tile-face); }
[data-meeting="over"] .laptop .call { display: none; }
[data-meeting="over"] .laptop .screen { fill: var(--c-paper-2); }
.svg-annot { font-family: var(--font); font-size: 12px; font-weight: var(--w-annot); fill: var(--c-ink-2); letter-spacing: .02em; }
.svg-tag { font-size: 12.5px; }
.tag-chip { fill: var(--c-paper); opacity: .94; }   /* 표지 글 바탕(제목·가구 위에서도 읽힘) */ .tag-n { font-weight: 700; fill: var(--c-ink); } .tag-v { font-weight: 600; fill: var(--c-kung-ink); }
.svg-roomtag { font-weight: 700; }
.card-peak { font-size: 22px; font-weight: 700; fill: var(--c-kung-ink); }

/* ── S0 ── */
.m-only { display: none; }
@media (max-width: 720px) { .m-only { display: inline; } }
@media (max-width: 360px) { .intro-a { display: none; } }   /* S0-02 첫 문장: 엘리베이터 7F·U-03a가 같은 정보(320에서 방 자리 확보) */
.is-measure > [hidden] { display: inline-flex !important; visibility: hidden; }   /* stage.js가 숨은 버튼까지 켠 모양으로 미리 잰다 */
[data-stage="s0"] .room { cursor: pointer; }   /* 방 안을 누르면 그 높이에서 공이 떨어진다 */
/* 높이 낙하 미리보기(v0.2.2 #3, 데스크톱 포인터): 그림자 공 + 치수선 + 바닥 그림자 */
.drop-preview { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.drop-preview .dp-ball { fill: color-mix(in srgb, var(--c-kung) 14%, transparent); stroke: var(--c-kung); stroke-width: 1.6px; stroke-dasharray: 5 4; }
.drop-preview .dp-line { stroke: var(--c-ink-2); stroke-width: 1px; stroke-dasharray: 3 4; }
.drop-preview .dp-tick { stroke: var(--c-ink-2); stroke-width: 1.2px; }
.drop-preview .dp-shadow { fill: var(--c-ink); }

/* ── S2 ── */
[data-place="s2-copy"] .h2 { margin-top: 10px; max-width: 13em; }
[data-place="s2-copy"] .actions { margin-top: 26px; }
[data-place="s2-copy"] .u06 { margin-top: 14px; }
[data-place="s2-copy"] .cue { margin-top: 14px; font-size: var(--fs-lead); }

/* ── S3 ── */
[data-place="s3-top"] .actions { margin-top: 14px; }
[data-place="s3-key"] { max-width: 11em; }
[data-place="s3-below"] { font-size: var(--fs-small); color: var(--c-ink); background: var(--c-paper-2); padding: 2px 6px; }

/* ── S4 절정 ── */
.flip-layer { position: absolute; inset: 0; transform-origin: 50% 50%; isolation: isolate; }   /* 무대 전체가 한 겹: 안의 물건(z 5)이 밖의 큐 상자·버튼 위로 나오지 않게 */
.flip-layer .block { position: absolute; left: 0; top: 0; margin: 0; z-index: var(--z-bodies); font-weight: 720; font-size: clamp(22px, 2.4vw, 34px); line-height: 1.2; white-space: nowrap; transform-origin: 0 0; }
[data-perspective="downstairs"] .flip-layer .block { color: var(--c-ink-2); }
.controls { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.controls .hint { font-size: var(--fs-small); color: var(--c-ink-2); background: color-mix(in srgb, var(--c-paper) 80%, transparent); padding: 2px 4px; }
/* v0.2 #6 데스크톱: 무대 오른쪽 아래 도면 표제란 자리. 반투명 종이 바탕이라 뒤로 굴러온 물건이 비쳐도 버튼·힌트는 읽힌다 */
/* v0.2.2: 5층 바닥 아래 슬래브 띠 안에 한 줄로 — 물건은 슬래브에 들어오지 않으므로 복귀 뒤에도 화분·글 블록을 덮지 않는다 */
.controls.is-corner {
  flex-direction: row; align-items: center; gap: 14px; padding: 7px 14px 7px 8px;
  background: color-mix(in srgb, var(--c-paper) 92%, transparent); border: 1.5px solid var(--c-ink);
  box-shadow: 4px 4px 0 var(--c-guide);
}
.controls.is-corner .hint { background: none; padding: 2px 0 2px 14px; border-left: var(--lw-thin) solid var(--c-ink-3); white-space: nowrap; }
.callout { background: var(--c-paper); border: 1.5px solid var(--c-ink); padding: 22px 26px 24px; box-shadow: 6px 6px 0 var(--c-guide); }
.callout .display { font-size: clamp(34px, 4.2vw, 60px); white-space: normal; line-height: 1.08; }
.callout .s406 { margin-top: 12px; font-size: var(--fs-lead); line-height: 1.5; color: var(--c-ink-2); max-width: 30ch; }
.callout .btn { margin-top: 18px; }
.callout-return .h2 { margin-top: 8px; font-size: clamp(28px, 3vw, 44px); text-wrap: wrap; }
[data-flip-cue] { display: none; }
[data-perspective="downstairs"] [data-flip-cue="listen"] { display: block; }
[data-perspective="upstairs"][data-flip-returned] [data-flip-cue="return"] { display: block; }
[data-perspective="downstairs"] [data-place="s4-controls"] { visibility: hidden; }
[data-perspective="downstairs"] [data-react="7"] { display: block !important; }
.pbody.is-settled { transition: none; }
.callout .s419 { margin-top: 10px; font-size: var(--fs-small); color: var(--c-ink-2); }

/* ── v0.3 S4 휴대폰으로 뒤집기(센서 카드, S4-10~S4-16) ── */
.sensor {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px 16px 14px;
  background: var(--c-paper); border: 1.5px solid var(--c-ink); border-radius: 8px; box-shadow: 5px 5px 0 var(--c-guide);
}
.sensor-phone { width: 44px; height: 48px; flex: none; color: var(--c-ink); }
.sensor-title { font-weight: var(--w-h2); font-size: 19px; line-height: 1.35; }
.sensor-small { margin-top: 4px; font-size: var(--fs-small); color: var(--c-ink-2); line-height: 1.5; }
.sensor-actions { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.sensor-fine { margin-top: 10px; font-size: var(--fs-annot); line-height: 1.55; color: var(--c-ink-2); }
/* 권한을 받고 휴대폰을 돌리는 동안: 카드가 작아지고(제목·'버튼으로 볼게요'만) 휴대폰 그림이 천천히 돈다 */
[data-sensor-state="requesting"] .sensor :is(.sensor-small, .sensor-fine, [data-action="sensor-enable"]),
[data-sensor-state="tilting"] .sensor :is(.sensor-small, .sensor-fine, [data-action="sensor-enable"]) { display: none !important; }
[data-sensor-state="tilting"] .sensor-phone { animation: phone-turn 2.4s var(--ease-flip) infinite; }
@keyframes phone-turn { 0%, 15% { rotate: 0deg; } 55%, 75% { rotate: 180deg; } 100% { rotate: 360deg; } }
[data-sensor-state="inverted"] .sensor, [data-sensor-state="returned"] .sensor, [data-sensor-state="fallback"] .sensor { display: none !important; }
/* 센서 알림 묶음(버튼 위): 상태 글은 비면 안 보이고, 여러 줄이 와도 겹치지 않고 쌓인다 */
.sensor-msgs { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.sensor-msgs.is-right { align-items: flex-end; }
.sensor-status {
  padding: 7px 12px; background: var(--c-paper); border: 1.5px solid var(--c-ink); border-radius: 6px;
  font-weight: var(--w-ui); font-size: var(--fs-small); line-height: 1.45; box-shadow: 3px 3px 0 var(--c-guide);
}
.sensor-status:empty { display: none; }
.sensor-status.is-quiet { font-weight: var(--w-body); color: var(--c-ink-2); box-shadow: none; }
/* 실패·시간 초과·화면 돌아감 → 버튼 경로: 중력 뒤집기 버튼을 한 번 두드러지게 */
:is([data-sensor-state="fallback"], [data-sensor-state="tilting"]) [data-action="flip"] { box-shadow: 0 0 0 4px var(--c-kung-tint), 0 0 0 5.5px var(--c-kung); }
[data-sensor-state="fallback"] [data-action="flip"] { animation: flip-call .9s var(--ease-ui) 2; }
@keyframes flip-call { 50% { box-shadow: 0 0 0 9px var(--c-kung-tint), 0 0 0 10.5px var(--c-kung); } }
/* 센서로 뒤집힌 동안: 무대는 돌지 않고 사람이 휴대폰을 돌렸다 → 듣기 큐와 '…?'를 기기 기준 180° 돌려 사람에게 똑바로(5.2절) */
[data-sensor-state="inverted"] [data-flip-cue="listen"],
[data-sensor-state="inverted"] [data-react="7"] { rotate: 180deg; }

/* ── v0.3 S1 · 같은 방, 던지기·끌기 ── */
.scene[data-scene="s1"] { min-height: 100svh; }
.s1-h { font-weight: var(--w-h2); font-size: clamp(22px, 2vw, 28px); line-height: 1.35; letter-spacing: -0.01em; }
[data-place="s1-note"] .cue { margin-top: 10px; color: var(--c-ink-2); font-weight: var(--w-body); font-size: var(--fs-ui); }
[data-place="s1-note"] .keys { margin-top: 14px; }
[data-physics-gesture] { cursor: grab; touch-action: pan-y; }
[data-physics-gesture].is-grabbed { cursor: grabbing; }
[data-stage][aria-disabled="true"] [data-physics-gesture], [data-listening] [data-physics-gesture] { cursor: default; }
/* S1-03이 보이는 동안: 의자 다리 밑에 '밀 수 있음' 표시(양쪽 화살표 점선), 공 위에 잡는 손 자리(점선 고리) */
#s1:has([data-cue="s1-03"]:not([hidden])) [data-physics-gesture="drag-chair"]::after {
  content: ""; position: absolute; left: -14px; right: -14px; bottom: -9px; height: 0; border-top: 1.5px dashed var(--c-ink-2);
}
#s1:has([data-cue="s1-03"]:not([hidden])) [data-physics-gesture="drag-chair"]::before {
  content: ""; position: absolute; left: -18px; right: -18px; bottom: -13px; height: 8px;
  background: linear-gradient(135deg, transparent 48%, var(--c-ink-2) 50% 62%, transparent 64%) left / 8px 8px no-repeat,
              linear-gradient(45deg, transparent 36%, var(--c-ink-2) 38% 50%, transparent 52%) right / 8px 8px no-repeat;
}
#s1:has([data-cue="s1-03"]:not([hidden])) [data-physics-gesture="throw-ball"] { outline: 1.5px dashed var(--c-kung); outline-offset: 6px; border-radius: 50%; }
/* 의자를 꾹 누르는 0.3초 동안 차오르는 고리(터치). 엔진이 left·top(누른 점)과 hidden을 맡는다 */
.grab-ring {
  position: absolute; z-index: calc(var(--z-bodies) + 1); width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--c-kung) calc(var(--hold, 0) * 360deg), color-mix(in srgb, var(--c-ink) 12%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 20px, #000 21px); mask: radial-gradient(circle, transparent 20px, #000 21px);
  animation: grab-fill .3s linear forwards;
}
@property --hold { syntax: "<number>"; inherits: false; initial-value: 0; }
@keyframes grab-fill { from { --hold: 0; } to { --hold: 1; } }
/* 끌기 자국: 마루 켜 안쪽 두 줄이 2.4초에 걸쳐 사라진다 */
.scuff line { stroke: var(--c-wood-ink); stroke-width: 1.4px; stroke-linecap: round; }
.scuff { animation: scuff-fade 2.4s ease-in forwards; }
@keyframes scuff-fade { from { opacity: .9; } to { opacity: 0; } }
.burst.scrape { stroke-linejoin: round; }

/* ── v0.3 S2-06 소리 안내 ── */
[data-place="s2-copy"] .cue-sound { font-weight: var(--w-body); font-size: var(--fs-ui); color: var(--c-ink-2); max-width: 30em; }

/* ── v0.3 S5 · 다시 7층, 매트 한 장 ── */
.scene[data-scene="s5"] { min-height: 130svh; }
/* v0.3.1: 부제 세 가지(S5-08·S5-08b·S5-02)를 한 칸(둘째 줄)에 겹친다 → 제목 묶음 높이 = 가장 긴 부제, 바뀌어도 밀리지 않는다.
   숨은 부제도 자리는 잡고(visibility), 화면·읽기에서는 빠진다 */
[data-place="s5-head"] { display: grid; align-content: start; }
[data-place="s5-head"] > .lead { grid-area: 2 / 1; margin-top: 10px; text-wrap: balance; }
[data-place="s5-head"] > .lead[hidden] { display: block !important; visibility: hidden; }
.nowrap { white-space: nowrap; }
#s5 .s502 { visibility: hidden; }
#s5:is([data-mat-test="laid"], [data-mat-test="dropping-after"], [data-mat-test="done"]) .s502 { visibility: visible; }
#s5:is([data-mat-test="laid"], [data-mat-test="dropping-after"], [data-mat-test="done"]) [data-cue^="s5-08"] { visibility: hidden !important; }
/* 시험 순서 ①②③: 차례인 단계는 진한 버튼, 마친 단계는 번호 자리에 체크 */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.steps li { counter-increment: step; }
.steps.is-row { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.step { gap: 9px; padding-left: 9px; }
.step::before {
  content: counter(step); flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 12px; font-weight: 760; line-height: 1;
}
.step .t-again, #s5[data-mat-test="done"] .step .t-first { display: none; }
#s5[data-mat-test="done"] .step .t-again { display: inline; }
#s5:is([data-mat-test="ready"], [data-mat-test="dropping-before"]) .step[data-action="mat-before"],
#s5[data-mat-test="before"] .step[data-action="mat-lay"],
#s5:is([data-mat-test="laid"], [data-mat-test="dropping-after"]) .step[data-action="mat-after"] { background: var(--c-ink); color: var(--c-paper); }
#s5:is([data-mat-test="before"], [data-mat-test="laid"], [data-mat-test="dropping-after"], [data-mat-test="done"]) .step[data-action="mat-before"]::before,
#s5:is([data-mat-test="laid"], [data-mat-test="dropping-after"], [data-mat-test="done"]) .step[data-action="mat-lay"]::before {
  content: ""; border-color: var(--c-soft);
  background: var(--c-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.3 2.3 4.5-5' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
/* 결과(S5-04)와 정직성 줄(S5-07, 늘 보임) */
.mat-result .cue { font-size: var(--fs-lead); line-height: 1.45; }
.mat-result b { font-weight: 800; }
.v-before { color: var(--c-kung-ink); }
.v-after { color: var(--c-soft-ink); }
.mat-result .s507 { margin-top: 6px; font-size: var(--fs-annot); line-height: 1.55; color: var(--c-ink-2); }
.mat-lamp { font-weight: var(--w-ui); font-size: var(--fs-ui); background: color-mix(in srgb, var(--c-paper-2) 85%, transparent); padding: 2px 6px; }
.mat-key { font-size: clamp(30px, min(4.4vw, 7svh), 64px); line-height: 1.14; white-space: nowrap; }
.copy.key-replaces-head:has(> [data-cue="s5-after"]:not([hidden])) > [data-place="s5-head"],
.copy.key-replaces-head:has(> [data-cue="s5-after"]:not([hidden])) > [data-place="s5-head"] * { visibility: hidden !important; }   /* 부제 칸의 visibility 규칙보다 앞서게 */
/* 매트 자리(점선) ↔ 깐 매트 */
.ln-spot { fill: none; stroke: var(--c-soft); stroke-width: 1.5px; stroke-dasharray: 5 4; }
.ln-mat { stroke: var(--c-ink); stroke-width: 1.25px; }
.mat-annot { fill: var(--c-soft-ink); font-weight: 600; }
.when-on { display: none; }
#s5:has([data-mat]:not([hidden])) .when-off { display: none; }
#s5:has([data-mat]:not([hidden])) .when-on { display: inline; }
.pbody.mat svg { left: 0; translate: none; }
.pbody.mat:not([hidden]) { animation: mat-unroll .8s var(--ease-ui) both; }
@keyframes mat-unroll { from { clip-path: inset(-2px 100% -2px 0); } to { clip-path: inset(-2px 0 -2px 0); } }
.mat-roll { position: absolute; z-index: var(--z-bodies); cursor: pointer; transform-origin: 50% 100%; }
.mat-roll svg { display: block; }
.pbody.mat:not([hidden]) + .mat-roll { animation: roll-away .8s var(--ease-ui) forwards; pointer-events: none; }
.pbody.mat:not([hidden]) + .mat-roll svg { animation: roll-turn .8s var(--ease-ui) forwards; }
@keyframes roll-away { 85% { opacity: 1; } to { translate: var(--roll-dx) 0; scale: .3; opacity: 0; } }
@keyframes roll-turn { to { rotate: var(--roll-turn); } }
/* 막대: 맨바닥 = 쿵 색, 매트 위 = 완충재 무늬. 새 값은 바닥에서 자라난다 */
.bar { stroke-width: 1.5px; transform-box: fill-box; transform-origin: 50% 100%; }
.bar.is-before { fill: var(--c-kung); stroke: var(--c-kung-ink); }
.bar.is-after { fill: url(#pat-soft); stroke: var(--c-soft-ink); }
.bar.is-new { animation: bar-grow .7s var(--ease-kung) both; }
@keyframes bar-grow { from { scale: 1 0; } }
.bar-slot { fill: none; stroke: var(--c-ink-3); stroke-width: 1px; stroke-dasharray: 3 3; }
.bar-v { font-family: var(--font); font-weight: 800; }
.bar-v.is-before { fill: var(--c-kung-ink); } .bar-v.is-after { fill: var(--c-soft-ink); }
.dim-ext { stroke: var(--c-ink-2); stroke-width: 1px; stroke-dasharray: 3 3; }
.dim-line { stroke: var(--c-soft-ink); stroke-width: 1.4px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dim-tick { stroke: var(--c-ink-2); stroke-width: 1.2px; }
.burst.is-past { opacity: .25; }
.burst.is-soft { stroke: var(--c-soft); }
/* 6층 펜던트 대비: 맨바닥 때 흔들린 만큼(쿵 색 점선)과 매트 위에서(완충 색) */
.lamp-ghost { fill: none; stroke-width: 1.4px; stroke-linejoin: round; }
.lamp-ghost.is-before { stroke: var(--c-kung); stroke-dasharray: 4 3; }
.lamp-ghost.is-after { stroke: var(--c-soft-ink); }
.lamp-arc { stroke-width: 1px; }

/* ── S6 끝 화면: 엘리베이터 안 ── */
.scene-end .panel { position: relative; height: auto; min-height: 100svh; overflow: visible; }
.end {
  position: relative; z-index: var(--z-copy);
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "card title" "card side";
  grid-template-rows: auto 1fr; column-gap: clamp(40px, 5vw, 88px);
  padding: calc(var(--hud-h) + 44px) calc(var(--margin) + 40px) 64px;
}
.end .title { grid-area: title; font-size: clamp(28px, 3.3vw, 48px); padding-top: 18px; }
/* v0.2 #8 · v0.2.2 #5④: 절정을 못 보고 내려온 사람에게 한 줄(엘리베이터 안내문처럼 얇은 띠).
   패널 맨 끝에 두고 화면 아래에 붙인다(sticky) → 나타날 때 카드·제목이 밀리지 않는다 */
.missed {
  position: sticky; bottom: max(14px, env(safe-area-inset-bottom)); z-index: calc(var(--z-copy) + 1);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px;
  width: fit-content; max-width: calc(100% - 2 * var(--margin)); margin: 0 auto 18px;
  padding: 8px 8px 8px 16px; background: var(--c-paper); border: 1.5px solid var(--c-ink); border-radius: 6px;
  box-shadow: 4px 4px 0 var(--c-guide);
  font-weight: var(--w-ui); font-size: var(--fs-ui); line-height: 1.4;
}
.missed .btn { text-decoration: none; }
.missed .btn svg { width: 12px; height: 12px; }
.end .board { grid-area: card; }
.end .side { grid-area: side; padding-top: 26px; max-width: 520px; }
.board { position: relative; padding: 14px; background: var(--c-paper-2); border: 2px solid var(--c-ink); border-radius: 6px; }
.board::before, .board::after { content: ""; position: absolute; left: 4px; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--c-ink-3); box-shadow: calc(var(--cw) + 15px) 0 0 -1.5px var(--c-paper-2), calc(var(--cw) + 15px) 0 0 0 var(--c-ink-3); }
.board::before { top: 4px; } .board::after { bottom: 4px; }
.sheet { position: relative; width: var(--cw, 480px); height: calc(var(--cw, 480px) * 1.25); }
.sheet .card { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform: scale(calc(var(--cw, 480px) / 1080px)); }
.btn-lift { border-radius: 10px; gap: 10px; }
.btn-lift .ring { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; opacity: .7; }
.btn-primary.btn-lift .ring { border-color: var(--c-led); background: var(--c-led); opacity: 1; box-shadow: 0 0 6px rgba(255, 90, 44, .7); }
.feedback { margin-top: 10px; min-height: 1.5em; font-size: var(--fs-small); font-weight: var(--w-ui); }
.share-url { margin-top: 6px; font-size: var(--fs-small); word-break: break-all; }
.disclaim { margin-top: 12px; font-size: var(--fs-small); line-height: 1.6; color: var(--c-ink-2); }
.vote { margin-top: 36px; padding-top: 18px; border-top: var(--lw-thin) solid var(--c-ink-3); font-size: var(--fs-body); line-height: 1.7; }
.vote a { display: inline-block; margin-top: 8px; font-size: var(--fs-small); font-weight: var(--w-ui); }

/* 카드 1080×1350 (도면 한 장: 이중 테두리 + 표제란) */
.card { width: 1080px; height: 1350px; overflow: hidden; background: var(--c-paper); color: var(--c-ink); font-family: var(--font); }
.card .frame-o { position: absolute; inset: 36px; border: 3px solid var(--c-ink); }
.card .frame-i { position: absolute; inset: 50px; border: 1px solid var(--c-ink); }
.card .mini { position: absolute; left: 100px; top: 540px; width: 880px; height: 500px; }
.card .mini svg { width: 880px; height: 500px; display: block; outline: 1.5px solid var(--c-ink-3); }
.card .panel-led { position: absolute; left: 100px; top: 120px; width: 440px; height: 330px; background: var(--c-led-panel); border-radius: 14px; padding: 28px 34px; box-shadow: inset 0 0 0 5px #2A3035; }
.card .lbl { display: block; font-size: 30px; font-weight: 620; color: #C9B2A8; margin-bottom: 14px; letter-spacing: .02em; }
.card .num {
  --p: 9px; display: inline-block; font-weight: 800; font-size: 190px; line-height: 1; color: var(--c-led); letter-spacing: .01em;
  white-space: nowrap; overflow-wrap: normal; word-break: keep-all;   /* v0.2 #4: "100"이 "10"/"0"으로 갈라지지 않게 */
  background: radial-gradient(circle, var(--c-led-off) 0 2.6px, transparent 3.3px) 0 0 / var(--p) var(--p);
  -webkit-mask-image: radial-gradient(circle, #000 0 calc(var(--p) * .36), transparent calc(var(--p) * .46));
          mask-image: radial-gradient(circle, #000 0 calc(var(--p) * .36), transparent calc(var(--p) * .46));
  -webkit-mask-size: var(--p) var(--p); mask-size: var(--p) var(--p);
  filter: drop-shadow(0 0 7px rgba(255, 90, 44, .6));
}
.card .num.is-3 { --p: 7.5px; font-size: 150px; padding: 18px 0 0; }   /* 세 자리(100~999) */
.card .num.is-pct { --p: 7px; font-size: 124px; padding: 24px 0; }
.card .side-t { position: absolute; left: 580px; top: 128px; width: 400px; }
.card .type { font-size: 74px; font-weight: 820; line-height: 1.08; letter-spacing: -0.025em; }
.card .quip { margin-top: 22px; font-size: 31px; font-weight: 420; line-height: 1.5; }
.card .close { position: absolute; left: 100px; top: 1092px; font-size: 44px; font-weight: 720; letter-spacing: -0.01em; }
/* v0.3 카드 v2: 보조 줄 S6-10(LED 판 바로 아래, 숫자 색 = S5 막대 색)과 센서 배지 S6-09(핵심 문장 오른쪽 도장) */
.card .matline { position: absolute; left: 100px; top: 462px; font-size: 28px; font-weight: 520; line-height: 1.2; white-space: nowrap; }
.card .matline b { font-weight: 800; }
.card .badge {
  position: absolute; right: 100px; top: 1096px; height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 22px 0 18px;
  border: 2.5px solid var(--c-soft-ink); border-radius: 22px; color: var(--c-soft-ink); font-size: 22px; font-weight: 700;
}
.card .badge svg { width: 14px; height: 22px; }
.card .tb { position: absolute; left: 50px; right: 50px; bottom: 50px; height: 118px; display: grid; grid-template-columns: 1.7fr 1.3fr .6fr 1.8fr; border-top: 1px solid var(--c-ink); }   /* v0.3.1: 기록 칸을 넓힘(PNG와 같은 비율) */
/* 기록 칸: 엔진 글은 읽기용으로 두고, 보이는 글은 card.js가 맞춘다("쿵 13번"을 먼저 보장, 뒤 항목은 줄이거나 뺀다 — 말줄임 없음) */
.card .tb b[data-result-detail].is-fitted { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card .tb b.fit { overflow: hidden; }
.card .tb > div { padding: 18px 22px 0; border-left: 1px solid var(--c-ink); }
.card .tb > div:first-child { border-left: 0; padding-left: 50px; }
.card .tb span.k { display: block; font-size: 19px; color: var(--c-ink-2); font-weight: 420; }
.card .tb b { display: block; margin-top: 6px; font-size: 30px; font-weight: 720; white-space: nowrap; }
.card .tb b.url { font-size: 22px; font-weight: 500; color: var(--c-ink-2); margin-top: 12px; overflow: hidden; text-overflow: ellipsis; }   /* 길면 card.js가 글자를 줄이고, 그래도 길면 말줄임 */

/* ── S7 바닥글: 로비 게시판처럼 한 단 ── */
.scene-foot { border-top: var(--lw-cut) solid var(--c-ink); background: var(--c-paper-2); }
.foot { max-width: 760px; margin: 0 auto; padding: 72px var(--margin) 96px; font-size: var(--fs-small); line-height: 1.7; }
.foot h2 { font-size: var(--fs-h3); font-weight: var(--w-h2); margin-bottom: 20px; }
.foot h3 { font-size: var(--fs-ui); font-weight: var(--w-ui); margin: 28px 0 8px; }
.foot .facts { padding: 0; list-style: none; display: grid; gap: 12px; }
.foot .facts li { padding-left: 14px; border-left: 2px solid var(--c-ink-3); }
.foot cite { font-style: normal; color: var(--c-ink-2); }
.foot .block { margin-top: 20px; }
.foot small { display: block; margin-top: 6px; color: var(--c-ink-2); font-size: var(--fs-annot); }
.foot .help { margin-top: 24px; padding: 16px 18px; background: var(--c-paper); border: 1.5px solid var(--c-ink); }
.foot .help p + p { margin-top: 6px; }
.foot dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin-top: 8px; }
.foot dt { color: var(--c-ink-2); }
.foot ul.src { padding-left: 18px; }
.foot details { margin-top: 16px; }
.foot details pre { white-space: pre-wrap; font-family: inherit; font-size: var(--fs-annot); color: var(--c-ink-2); }

/* ── 모바일 ── */
@media (max-width: 720px) {
  .hud { padding: 0 calc(var(--margin) - 6px); }
  .hud .brand { display: none; }
  .hud-right { width: 100%; justify-content: space-between; }
  [data-place="s2-copy"] .h2, [data-place="s3-key"] { font-size: 28px; }
  .callout { padding: 16px 16px 18px; box-shadow: 4px 4px 0 var(--c-guide); }
  .callout .display { font-size: 32px; }
  .callout .s406 { font-size: 15px; }
  .callout-return .h2 { font-size: 24px; }
  .flip-layer .block { font-size: 17px; }
  .controls .hint { display: none; }   /* S4-04는 데스크톱 힌트(카피 덱) */
  .end { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "card" "side"; grid-template-rows: auto; row-gap: 22px; padding: calc(var(--hud-h) + 20px) calc(var(--margin) + 4px) 48px; }
  .missed { padding: 8px 8px 8px 12px; gap: 6px 10px; font-size: var(--fs-small); }
  .end .title { font-size: 24px; padding-top: 0; }
  .end .side { padding-top: 0; }
  .board { padding: 10px; }
  .actions .btn-lift { flex: 1 1 auto; justify-content: center; }
  .foot { padding: 56px calc(var(--margin) + 4px) 80px; }
  /* v0.3 */
  .sensor { padding: 12px 14px 13px 10px; gap: 10px; }
  .sensor-title { font-size: 17px; }
  #s5 [data-place="s5-head"] .h2 { font-size: 30px; }
  .mat-result .cue { font-size: var(--fs-ui); }
  .mat-result .s507 { font-size: 12px; }
  .mat-lamp { font-size: var(--fs-small); }
  .mat-key { font-size: 22px; }
}
/* 머리띠가 좁으면 토글은 아이콘만(이름은 그대로 읽힘). 폭이 고정이라 문구가 바뀌어도 밀리지 않는다 */
@media (max-width: 560px) {
  #motion-pause .tg-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #motion-pause { width: 40px; padding: 0; }
  .toggles { gap: 6px; }
}
@media (max-width: 379px) {
  .toggle-sound .tg-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .toggle-sound { width: 40px; padding: 0; }
}
/* 짧은 휴대폰(320×568 등): 띠 설명이 맨 아래 자리를 쓴다. 버튼 줄을 조금 낮춘다 */
@media (max-width: 720px) and (max-height: 699px) and (min-height: 560px) {
  [data-cue="s0-band"]:not([hidden]) ~ .scroll-hint,
  html[data-preview="impact"] [data-cue="s0-band"] ~ .scroll-hint { display: none; }
  .keys { gap: 6px 8px; }
  .keys .btn-sm, .steps .btn-sm { min-height: 36px; padding: 7px 11px 8px; }
  .steps { gap: 6px; }
  #s5 [data-place="s5-head"] .h2 { font-size: 22px; }
  #s5 [data-place="s5-head"] .lead { font-size: 13px; margin-top: 6px; }
  .mat-key { font-size: 18px; white-space: normal; }
  .mat-result .cue { font-size: 14px; }
  .mat-result .s507 { font-size: 11px; margin-top: 4px; }
}
/* '방금 그 쿵'(두 줄)이 안내 문장 자리를 이어받는 화면(짧은 휴대폰·좁은 가로): stage.js가 .after-replaces-intro를 붙인다 */
.copy.after-replaces-intro:has(> [data-cue="s0-after"]:not([hidden])) > [data-place="s0-intro"],
html[data-preview="impact"] .copy.after-replaces-intro > [data-place="s0-intro"] { visibility: hidden; }

/* ── 낮은 뷰포트(가로모드 휴대폰 844×390 등). ui/stage.js의 isShort(H < 560)와 같은 기준 ── */
@media (max-height: 559px) {
  :root { --hud-h: 48px; --fs-display: 40px; --fs-lead: 16px; --fs-body: 15px; }
  .hud { background: var(--c-paper); }   /* 6절: 가로모드·200% 확대에서 뒤집힌 무대가 머리띠 너머로 비치지 않게 */
  .m-only { display: none; }             /* 낮은 화면은 폭이 넓으므로 S0-02를 두 줄로 */
  .lift .dots { font-size: 19px; }   /* v0.3.5: 큰 글(굵은 18.66px 이상) 유지 → 꺼진 층 대비 기준 3:1 */
  .toggle { min-height: 32px; padding: 6px 11px 6px 9px; }
  .btn { min-height: 40px; padding: 10px 16px 11px; }
  .btn-sm { min-height: 36px; padding: 8px 12px 9px; }
  .display.is-wrapped { white-space: nowrap; width: auto; }
  .h2, [data-place="s2-copy"] .h2, [data-place="s3-key"] { font-size: 26px; max-width: none; }
  [data-place="s2-copy"] .h2 { margin-top: 4px; }
  [data-place="s2-copy"] .actions { margin-top: 12px; }
  [data-place="s2-copy"] .u06 { margin-top: 8px; }
  [data-place="s2-copy"] .cue { margin-top: 6px; font-size: var(--fs-ui); }
  [data-place="s3-top"] .actions { margin-top: 8px; }
  .u06 { font-size: 11px; }
  .band-note { width: 220px; }
  .callout { padding: 10px 14px 12px; box-shadow: 4px 4px 0 var(--c-guide); }
  .callout .display { font-size: 26px; }
  .callout .s406 { margin-top: 4px; font-size: 13px; max-width: none; }
  .callout .btn { margin-top: 8px; }
  .callout-return .lead { font-size: 13px; }
  .callout-return .h2 { margin-top: 4px; font-size: 20px; }
  .controls .hint { display: none; }
  .end { padding-top: calc(var(--hud-h) + 20px); }
  .end .title { font-size: 24px; padding-top: 0; }
  /* v0.3 */
  .d-only { display: none; }
  .steps.is-row .btn-sm { font-size: 13px; min-height: 34px; padding: 7px 10px 8px 8px; }
  .step::before { width: 18px; height: 18px; font-size: 11px; }
  #s5 [data-place="s5-head"] .h2 { font-size: 22px; }
  [data-place="s5-head"] .lead { margin-top: 2px; font-size: 15px; }
  .mat-key { font-size: 20px; }
  .mat-result .cue { font-size: 14px; }
  .mat-result .s507 { font-size: 11px; margin-top: 3px; }
  .mat-lamp { font-size: 13px; }
  .sensor { padding: 10px 12px; gap: 10px; }
  .sensor-phone { width: 34px; height: 38px; }
  .sensor-title { font-size: 16px; }
  .sensor-actions { margin-top: 6px; }
  .sensor-fine { margin-top: 4px; }
  .s1-h { font-size: 20px; }
}

/* ── 움직임 줄이기·일시정지: 회전과 파동은 엔진이 정지 프레임으로 바꾼다. 여기서는 전환만 끈다 ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
html[data-motion-paused] *, html[data-motion-paused] *::before, html[data-motion-paused] *::after { animation-play-state: paused !important; transition: none !important; }

/* 시각 점검용 미리보기(?scene=… · ?preview=…)에서만 */
html[data-only] main > section:not(.is-only) { display: none; }
html[data-only] .scene { min-height: 100svh; }
html[data-preview] [data-action][hidden] { display: inline-flex !important; }
html[data-preview] .toggle[hidden] { visibility: visible; }
html[data-preview="impact"] :is([data-cue="s0-after"], [data-cue="s0-band"], [data-cue="s2-after"], [data-cue="s2-06"])[hidden] { display: block !important; }
html[data-preview="impact"] .react[hidden] { display: block !important; }
html[data-preview="flipped"] .flip-layer { transform: rotate(180deg); }
html[data-preview="flipped"] .flip-layer [data-building-upright] { transform: rotate(180deg); }
