:root {
  --bg: #1b1d29;
  --panel: rgba(22, 24, 36, 0.72);
  --panel-border: rgba(255, 236, 210, 0.14);
  --text: #f6efe3;
  --muted: rgba(246, 239, 227, 0.68);
  --accent: #ffc27a;
  --accent-strong: #ff9f5a;
  --cool: #8fd8ff;
  --radius: 14px;
  --font: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* 상영관 작품 화면: 캔버스 아래 층. 앉았을 때만 눌러 조작할 수 있다. */
#screen-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.screen-holder {
  position: absolute;
  left: 0;
  top: 0;
  /* 변환 전체(카메라·원근·스크린 자리)를 이 판 하나에 건다. 기준점은 왼쪽 위(dom-screen.js). */
  transform-origin: 0 0;
  background: #000;
  pointer-events: none;
}
.screen-holder iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

#scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }
#scene:focus { outline: none; }

/* 화면 위 조작부 전체 배율: 큰 창·전체 화면에서 같이 커진다(main.js가 창 크기로 --hud-zoom을 정한다, 작은 창은 1).
   zoom 안에서는 vw·vh도 같이 커지니 조작부 규칙의 vw·vh는 이 배율로 나눠 쓴다. */
#hud {
  position: fixed;
  inset: 0;
  z-index: 2;
  zoom: var(--hud-zoom, 1);
  pointer-events: none;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
#hud > * { pointer-events: auto; }
/* 알림은 누르기를 받지 않는다. 위 규칙(#hud > *)이 .toast의 pointer-events: none보다 우선해서, 사라져 투명해진 알림이
   그 자리 버튼(휴대폰의 '한 입 먹기' 등)으로 가는 누르기를 계속 가로챘다. */
#hud > .toast { pointer-events: none; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.title-panel {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  padding: 12px 14px;
  max-width: min(360px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
}
.title-panel h1 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.title-panel p { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.title-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.chip:hover { background: rgba(255, 255, 255, 0.12); }
.chip.primary { background: var(--accent); color: #2a1d10; border-color: transparent; font-weight: 700; }
.chip:focus-visible, .segmented button:focus-visible, .places button:focus-visible, .panel-toggle:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--cool);
  outline-offset: 2px;
}

/* 설정 휴대폰 버튼. 넓은 화면은 휴대폰이 올라오는 오른쪽 아래, 좁은 화면은 오른쪽 위(시각을 곁들인다). */
.phone-button {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 9px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.phone-button:hover { background: rgba(34, 36, 52, 0.82); }
.phone-button:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
.phone-button-icon { width: 24px; height: 30px; flex: none; color: var(--accent); }
.phone-button-icon svg { display: block; width: 100%; height: 100%; }
.phone-button-text { display: grid; gap: 1px; }
.phone-button-label { font-weight: 700; font-size: 13px; }
.phone-button-time { display: none; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 넓은 화면 오른쪽 위의 환경 요약(게임 속 시각·날씨·바람). 누르면 휴대폰의 시계 앱이 열린다. */
.phone-clock-chip {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px 8px 10px;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.phone-clock-chip:hover { background: rgba(34, 36, 52, 0.82); }
.phone-clock-chip:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
.phone-clock-chip-icon { width: 16px; height: 16px; flex: none; }
.phone-clock-chip-icon svg { display: block; width: 100%; height: 100%; }
.phone-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.panel-toggle {
  appearance: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  padding: 11px 14px;
  cursor: pointer;
}
.panel-title { font-weight: 700; font-size: 14px; }
.panel-body { padding: 0 14px 14px; display: grid; gap: 12px; max-height: calc(calc(100vh / var(--hud-zoom, 1)) - 92px); overflow-y: auto; overscroll-behavior: contain; }
.switch-row { display: flex; flex-wrap: wrap; gap: 8px 14px; }

.field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.field-label { display: flex; justify-content: space-between; }
.field output { color: var(--text); }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.segmented button {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 0;
  border-radius: 9px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: #2a1d10; border-color: transparent; font-weight: 700; }

input[type="range"] { width: 100%; accent-color: var(--accent); }
select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 6px 8px;
}
select option { background: #222433; }

.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--cool); }

/* 장소 단추 두 줄(main.js): 윗줄은 광장과 1층 건물, 아랫줄은 소개관·전시관의 층 단추를 건물 이름 뒤에 묶는다. */
.places {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 24px;
}
.places-row { display: flex; justify-content: center; gap: 6px; }
.places-group { display: flex; align-items: center; gap: 2px; }
.places-group + .places-group { margin-left: 10px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.places-group-name { padding: 0 6px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.places button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.places button:hover { background: rgba(255, 255, 255, 0.1); }

/* 가상 이동 패드: 왼쪽 아래 원 안에서 손잡이를 끌어 걷는다. 끝까지 밀면 테두리가 밝아지며 달린다. */
.move-pad {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 72px);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04) 72%);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.move-pad[hidden] { display: none; }
.move-pad-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s ease-out;
  pointer-events: none;
}
.move-pad[data-active="true"] .move-pad-knob { transition: none; background: rgba(255, 220, 170, 0.88); }
.move-pad[data-run="true"] { border-color: var(--accent); }
/* 점프 단추: 오른쪽 아래, 이동 패드와 마주 보는 자리. */
.jump-button {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 96px);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 72%);
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.jump-button:active { background: rgba(255, 220, 170, 0.5); }
.jump-button[hidden] { display: none; }
body[data-seated="true"] .move-pad,
body[data-exhibit="open"] .move-pad,
body[data-seated="true"] .jump-button,
body[data-exhibit="open"] .jump-button { display: none; }
/* 상영관 안에 서 있으면 아래 가운데에 재생 패널이 떠서 패드와 겹친다. 패드를 패널 위로 올린다(알림과 같은 높이). */
.theater-panel:not([hidden]) ~ .move-pad,
.theater-panel:not([hidden]) ~ .jump-button { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 196px); }
.places button[aria-current="true"] { background: rgba(255, 194, 122, 0.22); color: var(--accent); }

/* 단축키가 있는 단추는 글 뒤에 (키)를 붙인다(data-key). 마우스를 올릴 수 없는 기기(휴대폰·태블릿)는 키보드가 없다고 보고 뺀다. */
@media (hover: hover) {
  button[data-key]::after { content: "\00a0(" attr(data-key) ")"; }
}

/* 왼쪽 아래, 장소 단추 옆에 둔다. 가운데 패널(상영관·라떼, 560px)과 장소 단추(폭 약 600px)를 피해 폭을 줄인다.
   창이 좁아 옆에 들어가지 않으면 장소 단추 두 줄 위로 올린다(아래 미디어 쿼리). */
.help {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 4px);
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  max-width: max(200px, min(400px, calc(calc(50vw / var(--hud-zoom, 1)) - 320px)));
  pointer-events: none;
}
@media (max-width: 1000px) {
  .help { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 100px); }
}

.debug-stats {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  /* 오른쪽 아래 휴대폰 버튼 위에 둔다. */
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px);
  margin: 0;
  padding: 10px 12px;
  font: 12px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #d6fff3;
  white-space: pre;
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 64px);
  transform: translate(-50%, 8px);
  background: rgba(18, 20, 30, 0.88);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  max-width: min(440px, calc(calc(100vw / var(--hud-zoom, 1)) - 32px));
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

/* PC 1인칭 커서 잠금 중 가운데 조준점. 누를 수 있는 것을 가리키면 고리가 커지고 강조색이 된다. */
#hud > .crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  display: none;
  transition: width 0.12s, height 0.12s, margin 0.12s, background 0.12s, box-shadow 0.12s;
}
body[data-pointer-lock="on"] #hud > .crosshair { display: block; }
#hud > .crosshair[data-hot="true"] {
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  background: transparent;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 3.5px rgba(0, 0, 0, 0.4);
}
.theater-panel:not([hidden]) ~ .toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 196px); }

/* 상영관 조작 패널: 상영관 안에 있거나 앉아 있을 때만 보인다. */
.theater-panel {
  position: absolute;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px);
  transform: translateX(-50%);
  width: min(560px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
  padding: 10px 12px 11px;
  display: grid;
  gap: 8px;
}
.theater-panel[hidden] { display: none; }
.theater-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.theater-meta { display: grid; gap: 2px; min-width: 0; }
.theater-status { font-size: 11px; color: var(--accent); }
.theater-title { font-size: 14px; overflow-wrap: anywhere; }
.theater-time { font: 12px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); white-space: nowrap; }
.theater-progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.theater-progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.theater-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.theater-actions .primary { margin-left: auto; }
.chip:disabled { opacity: 0.45; cursor: default; }
.theater-list {
  list-style: none;
  margin: 0;
  padding: 6px 0 0;
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--panel-border);
}
.theater-list[hidden] { display: none; }
.theater-list button {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 9px;
  cursor: pointer;
}
.theater-list button:hover { background: rgba(255, 255, 255, 0.08); }
.theater-list button[aria-current="true"] { background: rgba(255, 194, 122, 0.18); color: var(--accent); }
.theater-list button:focus-visible { outline: 2px solid var(--cool); outline-offset: 1px; }
.theater-list .num { font: 12px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.theater-list .by { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 앉아 있을 때: 스크린 귀퉁이를 가리는 패널을 치우고, 상영관 패널은 위쪽 한 줄로 줄인다(작품 조작부가 아래에 있다). */
body[data-seated="true"] .phone-button,
body[data-seated="true"] .phone-clock-chip,
body[data-seated="true"] .title-panel { display: none; }
body[data-seated="true"] .theater-panel {
  top: max(12px, env(safe-area-inset-top));
  bottom: auto;
  width: auto;
  max-width: calc(calc(100vw / var(--hud-zoom, 1)) - 24px);
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  column-gap: 14px;
  padding: 7px 8px 7px 14px;
}
body[data-seated="true"] .theater-progress,
body[data-seated="true"] .theater-time { display: none; }
/* 앉아 있을 때 화면 밖 빈 곳을 끌어 둘러본다(손가락 끌기를 브라우저 스크롤·확대에 넘기지 않는다). */
body[data-seated="true"] { touch-action: none; cursor: grab; }
/* 둘러보다가 스크린 정면으로 돌아오는 단추: 눈에 띄게 차가운 색 테두리를 두른다. */
.theater-face { border-color: var(--cool); color: var(--cool); }
.theater-face[hidden] { display: none; }
body[data-seated="true"] .theater-list { grid-column: 1 / -1; }

/* 전시관 정보 카드: 넓은 화면은 왼쪽 위 소개 패널 아래, 좁은 화면은 아래쪽 시트. */
.exhibit-card {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  top: calc(max(14px, env(safe-area-inset-top)) + 108px);
  width: min(380px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
  max-height: calc(calc(100vh / var(--hud-zoom, 1)) - 108px - 110px);
  overflow: auto;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.exhibit-card[hidden] { display: none; }
.exhibit-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(12, 14, 20, 0.66);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.exhibit-close:hover { background: rgba(255, 255, 255, 0.14); }
.exhibit-close:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
.exhibit-image { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; background: #10131a; }
.exhibit-image[src$=".svg"] { object-fit: contain; background: #f2eee6; }
.exhibit-image[hidden] { display: none; }
/* 사진이 여러 장이면 카드에서 잘라내지 않고 원래 비율로 보여 준다. */
.exhibit-image { object-fit: contain; }
.exhibit-caption { margin: -2px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.exhibit-caption[hidden], .exhibit-thumbs[hidden] { display: none; }
.exhibit-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.exhibit-thumb { flex: 0 0 auto; width: 64px; height: 40px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #10131a; cursor: pointer; }
.exhibit-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.exhibit-thumb[aria-current="true"] { border-color: var(--accent); }
.exhibit-body .exhibit-note b { color: var(--text); }
.exhibit-body .exhibit-subhead { margin-top: 4px; font-weight: 700; color: var(--text); }
.exhibit-kicker { margin: 2px 36px 0 0; font-size: 12px; color: var(--accent); }
.exhibit-image:not([hidden]) ~ .exhibit-kicker { margin-right: 0; }
.exhibit-title { margin: 0 30px 0 0; font-size: 17px; line-height: 1.35; }
.exhibit-image:not([hidden]) ~ .exhibit-title { margin-right: 0; }
.exhibit-body { display: grid; gap: 6px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.exhibit-body p { margin: 0; }
.exhibit-body .exhibit-metric { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
/* 소개관 글 판 카드: 목록·코드·표·막대그래프·그림(사이트 글 그대로). */
.exhibit-body .exhibit-list { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 4px; }
.exhibit-body .exhibit-list b, .exhibit-body .exhibit-quote { color: var(--text); }
.exhibit-body .exhibit-quote { padding-inline-start: 10px; border-inline-start: 3px solid var(--accent); font-weight: 600; }
.exhibit-body .exhibit-code { margin: 0; padding: 8px 10px; border-radius: 8px; background: #0b0d13; color: #cfe0ff; font: 12px/1.45 "D2Coding", Consolas, "Courier New", monospace; overflow-x: auto; white-space: pre; }
.exhibit-body .exhibit-table { overflow-x: auto; }
.exhibit-body .exhibit-table table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.exhibit-body .exhibit-table th, .exhibit-body .exhibit-table td { padding: 4px 6px; border-bottom: 1px solid var(--panel-border); text-align: left; vertical-align: top; }
.exhibit-body .exhibit-table th { color: var(--text); }
.exhibit-body .exhibit-bars { display: grid; gap: 4px; font-size: 12.5px; }
.exhibit-body .exhibit-bar { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.exhibit-body .exhibit-bar-name { text-align: right; }
.exhibit-body .exhibit-bar-track { height: 10px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.exhibit-body .exhibit-bar-fill { display: block; height: 100%; border-radius: 4px; background: #8b90a0; }
.exhibit-body .exhibit-bar.is-strong { color: var(--accent); font-weight: 700; }
.exhibit-body .exhibit-bar.is-strong .exhibit-bar-fill { background: var(--accent); }
.exhibit-body .exhibit-bar-value { font-variant-numeric: tabular-nums; color: var(--text); }
.exhibit-body .exhibit-inline-image { width: 100%; height: auto; border-radius: 8px; background: #fff; }
/* SI 활용 단계 카드: 사례 캡처, 사람·SI 흐름도, 역할·환경 목록, 도구 묶음, 사이트 링크. */
.exhibit-body .exhibit-capture { margin: 0; display: grid; gap: 4px; }
.exhibit-body .exhibit-capture-index { font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); }
.exhibit-body .exhibit-capture-caption { font-size: 12px; line-height: 1.45; color: var(--muted); }
.exhibit-body .exhibit-flow { display: grid; gap: 6px; }
.exhibit-body .exhibit-node { display: grid; gap: 2px; padding: 7px 10px; border-radius: 8px; border-inline-start: 3px solid #d9a066; background: rgba(217, 160, 102, 0.1); }
.exhibit-body .exhibit-node.is-ai { border-inline-start-color: var(--cool); background: rgba(120, 180, 230, 0.1); }
.exhibit-body .exhibit-node b { color: var(--text); }
.exhibit-body .exhibit-node-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.exhibit-body .exhibit-node-note { font-size: 12px; color: var(--muted); }
.exhibit-body .exhibit-meta { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 10px; }
.exhibit-body .exhibit-meta dt { font-weight: 700; color: var(--text); }
.exhibit-body .exhibit-meta dt.is-ai { color: var(--cool); }
.exhibit-body .exhibit-meta dt.is-human { color: #d9a066; }
.exhibit-body .exhibit-meta dd { margin: 0; }
.exhibit-body .exhibit-tools { display: grid; gap: 6px; }
.exhibit-body .exhibit-tool-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.exhibit-body .exhibit-tool-grid li { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--panel-border); border-radius: 8px; }
.exhibit-body .exhibit-tool-grid img { grid-row: span 2; width: 24px; height: 24px; object-fit: contain; }
.exhibit-body .exhibit-tool-grid b { color: var(--text); font-size: 12.5px; }
.exhibit-body .exhibit-tool-grid span { font-size: 11.5px; line-height: 1.4; }
.exhibit-body .exhibit-tool-more { justify-content: center; grid-template-columns: 1fr !important; color: var(--muted); }
.exhibit-body .exhibit-link { color: var(--cool); font-weight: 600; }
.architecture-panel { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.architecture-panel__body { min-width: 0; }
.architecture-panel__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.architecture-panel__tab { min-height: 44px; padding: 8px 10px; border: 1px solid var(--panel-border); border-radius: 8px; background: #232c3b; color: var(--text); font: inherit; cursor: pointer; }
.architecture-panel__tab[aria-pressed="true"], .architecture-panel__tab[aria-selected="true"] { border-color: var(--accent); background: #35445a; }
.architecture-panel__tab:focus-visible, .architecture-panel__viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.architecture-panel__viewport { max-width: 100%; max-height: 480px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--panel-border); border-radius: 8px; background: #101722; touch-action: pan-x pan-y pinch-zoom; }
.architecture-panel__viewport svg { display: block; max-width: none; }
.architecture-panel__summary { font-size: 14px; word-break: keep-all; overflow-wrap: anywhere; }
.architecture-panel__summary ul { padding-inline-start: 20px; }
.architecture-panel__caption { font-size: 13px; color: var(--muted); }
.architecture-panel__legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; }
.architecture-panel__swatch { display: inline-block; width: 18px; height: 4px; margin-inline-end: 5px; vertical-align: middle; }
.architecture-panel__nodes, .architecture-panel__notes { padding-inline-start: 20px; word-break: keep-all; overflow-wrap: anywhere; }
.exhibit-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.exhibit-tags[hidden] { display: none; }
.exhibit-tags li {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  color: var(--muted);
}
.exhibit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* 라떼 만들기 패널: 잔 앞 시점 아래쪽에 붙는다. 잔이 가리지 않게 위쪽 패널과 이동 패드는 치운다. */
.latte-panel {
  position: absolute;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px);
  transform: translateX(-50%);
  width: min(560px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
  padding: 11px 14px 12px;
  display: grid;
  gap: 6px;
}
.latte-panel[hidden] { display: none; }
.latte-kicker { margin: 0 36px 0 0; font-size: 11px; color: var(--accent); }
.latte-title { margin: 0 36px 0 0; font-size: 16px; }
.latte-status { margin: 0; font-size: 13.5px; line-height: 1.5; min-height: 3em; }
.latte-amounts { margin: 0; font: 12px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.latte-actions { display: grid; grid-template-columns: repeat(6, auto); gap: 6px; margin-top: 2px; }
.latte-actions .chip { padding: 9px 11px; white-space: nowrap; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.latte-actions .chip[data-pouring="true"] { background: var(--cool); color: #0f2230; border-color: transparent; }
body[data-latte="open"] .move-pad,
body[data-latte="open"] .jump-button,
body[data-latte="open"] .title-panel,
body[data-latte="open"] .wind-panel,
body[data-latte="open"] .help,
body[data-latte="open"] .debug-stats { display: none; }
/* 잔 앞 시점: 가장자리를 어둡게 눌러 잔에 눈이 가게 한다(캔버스 위에 덮는 그림자, 누르기는 통과). */
body[data-latte="open"] #hud::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 52% at 50% 34%, transparent 45%, rgba(8, 6, 4, 0.5) 100%);
}
@media (max-width: 640px) {
  .latte-panel { left: 12px; right: 12px; width: auto; transform: none; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px); padding: 10px 12px; }
  .latte-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .latte-actions .chip { padding: 10px 4px; font-size: 13px; }
}

/* 헬스장 기구 사용 패널(gym-use.js): 오른쪽 아래, 장소 버튼 줄 위. 왼쪽 아래 이동 패드(밀면 내려온다)와 겹치지 않는다. */
.gym-panel {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px);
  width: min(300px, calc(calc(100vw / var(--hud-zoom, 1)) - 172px));
  padding: 10px 12px 11px;
  display: grid;
  gap: 6px;
}
.gym-panel[hidden] { display: none; }
.gym-kicker { margin: 0; font-size: 11px; color: var(--accent); }
.gym-title { margin: 0; font-size: 15px; line-height: 1.25; }
.gym-stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.gym-stats div { min-width: 0; }
.gym-stats dt { font-size: 10.5px; color: var(--muted); }
.gym-stats dd { margin: 0; font: 600 13.5px ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.gym-actions { display: flex; gap: 6px; }
.gym-actions .chip { flex: 1 1 auto; padding: 8px 11px; }
.gym-actions .chip[hidden] { display: none; }
/* 유산소 기구 1인칭: 계기판이 화면 아래쪽에 오므로 패널을 위쪽 가운데 얇은 띠(이름·단추 한 줄, 수치 네 칸 한 줄)로 옮긴다. */
body[data-gym-view="first-person"] .gym-panel {
  top: calc(max(14px, env(safe-area-inset-top)) + 84px);
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(560px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
  padding: 8px 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
}
body[data-gym-view="first-person"] .gym-kicker { display: none; }
body[data-gym-view="first-person"] .gym-title { overflow-wrap: anywhere; }
body[data-gym-view="first-person"] .gym-stats { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body[data-gym-view="first-person"] .gym-actions .chip { flex: 0 0 auto; padding: 6px 12px; }
body[data-gym="open"] .help { display: none; }

/* 손에 든 물건 패널(carry.js): 헬스장 패널과 같은 오른쪽 아래 자리. 다른 패널이 열리면 비켜 준다. */
.carry-panel {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px);
  width: min(260px, calc(calc(100vw / var(--hud-zoom, 1)) - 172px));
  padding: 9px 12px 10px;
  display: grid;
  gap: 6px;
}
.carry-panel[hidden] { display: none; }
.carry-kicker { margin: 0; font-size: 11px; color: var(--accent); }
.carry-title { margin: 0; font-size: 14.5px; line-height: 1.25; }
.carry-remain { font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.carry-actions { display: flex; gap: 6px; }
.carry-actions .chip { flex: 1 1 auto; padding: 8px 10px; }
.carry-actions .chip:disabled { opacity: 0.55; cursor: default; }
body[data-carry="open"] .help { display: none; }
body[data-gym="open"] .carry-panel,
body[data-latte="open"] .carry-panel,
body[data-jukebox="open"] .carry-panel,
body[data-exhibit="open"] .carry-panel,
body[data-seated="true"] .carry-panel { display: none; }

/* 벤치·의자에 앉아 있을 때 일어나기 단추(seats.js): 위쪽 가운데, 제목 패널 아래. 아래쪽은 패드·손에 든 물건 패널 자리다.
   (상영관 좌석은 data-seated, 벤치·의자는 data-chair로 갈라서, 의자에 앉아서도 손에 든 물건 패널은 그대로 보인다.) */
.seat-stand {
  position: absolute;
  left: 50%;
  top: calc(max(14px, env(safe-area-inset-top)) + 86px);
  transform: translateX(-50%);
  padding: 8px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.seat-stand[hidden] { display: none; }
@media (max-width: 640px) {
  /* 좁은 화면은 알림도 위쪽 가운데에 뜨므로, 앉아 있는 동안은 일어나기 단추 아래로 내린다. */
  body[data-chair="true"] #hud > .toast { top: calc(max(14px, env(safe-area-inset-top)) + 134px); }
}

/* 주크박스 곡 고르기 패널: 넓은 화면은 왼쪽 위 소개 패널 아래, 좁은 화면은 아래쪽 시트.
   오실로의 앨범 고르기처럼 슬리브를 좌우로 넘기고(스크롤 스냅), 고른 앨범의 레코드가 슬리브 밖으로 나오며 틀면 돈다. */
.jukebox-panel {
  --album: var(--accent);
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  top: calc(max(14px, env(safe-area-inset-top)) + 108px);
  width: min(380px, calc(calc(100vw / var(--hud-zoom, 1)) - 28px));
  max-height: calc(calc(100vh / var(--hud-zoom, 1)) - 108px - 100px);
  padding: 12px 14px;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr) auto auto;
  gap: 7px;
  overflow: hidden;
}
.jukebox-panel[hidden] { display: none; }
.jukebox-status { margin: 0 36px 0 0; min-height: 1.2em; font-size: 11.5px; color: var(--album); }
.jukebox-now { margin: -4px 36px 0 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.jukebox-now-original { display: block; margin-top: 1px; font-size: 12px; font-weight: 500; color: var(--muted); }
.jukebox-scope { display: block; width: 100%; height: 34px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); }
.jukebox-reel {
  --sleeve: 84px;
  display: flex;
  gap: 12px;
  margin: 0 -14px;
  padding: 4px calc(50% - var(--sleeve) / 2 - 12px) 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.jukebox-reel::-webkit-scrollbar { display: none; }
.jukebox-sleeve {
  --c: var(--accent);
  position: relative;
  flex: 0 0 calc(var(--sleeve) + 24px);
  height: var(--sleeve);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  scroll-snap-align: center;
  opacity: 0.5;
  transform: scale(0.88);
  transition: opacity 0.2s, transform 0.2s;
}
.jukebox-sleeve[aria-pressed="true"] { opacity: 1; transform: none; }
.jukebox-sleeve:focus-visible { outline: none; }
.jukebox-sleeve:focus-visible .jukebox-cover { outline: 2px solid var(--cool); outline-offset: 2px; }
.jukebox-cover {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: var(--sleeve);
  height: var(--sleeve);
  display: grid;
  align-content: space-between;
  padding: 7px 8px;
  border-radius: 6px;
  text-align: left;
  color: #1d1320;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 80%, #fff 20%), color-mix(in srgb, var(--c) 45%, #1a1020 55%));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.jukebox-sleeve[aria-pressed="true"] .jukebox-cover { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--c); }
.jukebox-cover b { font-size: 26px; line-height: 1; font-weight: 800; }
.jukebox-cover small { font-size: 11px; line-height: 1.25; font-weight: 700; }
.jukebox-disc {
  position: absolute;
  top: 4%;
  left: 4%;
  width: calc(var(--sleeve) * 0.92);
  height: calc(var(--sleeve) * 0.92);
  border-radius: 50%;
  background:
    conic-gradient(from 20deg, transparent 0 8%, rgba(255, 255, 255, 0.16) 12%, transparent 18% 58%, rgba(255, 255, 255, 0.12) 62%, transparent 68%),
    radial-gradient(circle, #0b0b0e 0 4%, var(--c) 4.5% 25%, #111116 26% 29%, transparent 29.5%),
    repeating-radial-gradient(circle, #18181d 0 2px, #0b0b0e 2px 4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: left 0.35s ease;
}
.jukebox-sleeve[aria-pressed="true"] .jukebox-disc { left: 26%; }
.jukebox-sleeve[data-playing="true"] .jukebox-disc { animation: jukebox-spin 1.8s linear infinite; }
@keyframes jukebox-spin { to { transform: rotate(360deg); } }
.jukebox-album-nav { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 6px; }
.jukebox-arrow { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 20px; }
.jukebox-album { display: grid; justify-items: center; min-width: 0; text-align: center; }
.jukebox-album b { font-size: 15px; }
.jukebox-album small { font: 11.5px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.jukebox-album-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.jukebox-tracks {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.jukebox-track {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.jukebox-track:hover { background: rgba(255, 255, 255, 0.08); }
.jukebox-track:focus-visible { outline: 2px solid var(--cool); outline-offset: 1px; }
.jukebox-track[aria-current="true"] { border-color: var(--album); background: color-mix(in srgb, var(--album) 13%, transparent); }
.jukebox-track .no, .jukebox-track .len, .jukebox-time { font: 12px ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); white-space: nowrap; }
.jukebox-track[aria-current="true"] .no { color: var(--album); }
.jukebox-track .text { display: grid; gap: 1px; min-width: 0; }
.jukebox-track .name { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.jukebox-track .by { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.jukebox-track .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--album); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; }
.jukebox-track[aria-current="true"] .bar { opacity: 1; }
.jukebox-transport { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--panel-border); }
.jukebox-progress { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.jukebox-progress span { display: block; height: 100%; background: var(--album); transform-origin: 0 50%; transform: scaleX(0); }
.jukebox-panel .chip.primary { background: var(--album); }
.jukebox-transport .chip { padding: 8px 12px; white-space: nowrap; }
.jukebox-sound-note { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--accent); }
.jukebox-sound-note[hidden] { display: none; }
/* 헬스장 음악 재생기(gym-music.js): 주크박스 패널 틀을 그대로 쓰고, 슬리브 대신 지금 곡 앨범 그림과 곡마다 작은 그림을 둔다. */
.gym-music-panel { --album: #ff7a3d; grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.gym-music-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; }
.gym-music-cover { width: 96px; height: 96px; border-radius: 8px; object-fit: cover; background: #15161a; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.14); }
.gym-music-panel[data-phase="playing"] .gym-music-cover { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--album); }
.gym-music-info { display: grid; gap: 4px; min-width: 0; }
.gym-music-info .jukebox-now { margin: 0 30px 0 0; }
.gym-music-info small { font: 11.5px ui-monospace, "Cascadia Mono", Consolas, monospace; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.gym-music-panel .jukebox-track { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 6px 10px 7px 6px; }
.gym-music-panel .jukebox-track img { width: 40px; height: 40px; border-radius: 5px; object-fit: cover; background: #15161a; }
@media (max-width: 640px) {
  .gym-music-head { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  .gym-music-cover { width: 72px; height: 72px; }
  body[data-gym-music="open"] .move-pad,
  body[data-gym-music="open"] .jump-button,
  body[data-gym-music="open"] .debug-stats { display: none; }
  body[data-gym-music="open"] .toast { top: calc(max(14px, env(safe-area-inset-top)) + 64px); bottom: auto; }
}
body[data-gym-music="open"] .carry-panel { display: none; }
@media (max-width: 640px) {
  .jukebox-panel {
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px);
    /* 앨범마다 곡 수가 달라도 시트 높이는 그대로(위쪽 3D 화면이 들썩이지 않게) */
    height: min(calc(58vh / var(--hud-zoom, 1)), 540px);
    max-height: none;
    padding: 10px 12px;
    gap: 6px;
  }
  .jukebox-reel { --sleeve: 70px; margin: 0 -12px; }
  .jukebox-cover b { font-size: 22px; }
  .jukebox-cover small { font-size: 10px; }
  .jukebox-album-note { font-size: 12px; }
  .jukebox-track { padding: 7px 9px 8px; }
  body[data-jukebox="open"] .move-pad,
  body[data-jukebox="open"] .jump-button,
  body[data-jukebox="open"] .debug-stats { display: none; }
  body[data-jukebox="open"] .toast { top: calc(max(14px, env(safe-area-inset-top)) + 64px); bottom: auto; }
}

dialog {
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: #1f2130;
  color: var(--text);
  padding: 20px 22px;
  line-height: 1.6;
  font-size: 14px;
}
dialog::backdrop { background: rgba(6, 8, 14, 0.55); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog strong { color: var(--accent); font-weight: 700; }
dialog form { margin-top: 14px; text-align: right; }

/* ── 설정 휴대폰(js/phone.js) ───────────────────────────────
   안드로이드 계열 화면: 큰 제목이 접히는 앱 화면, 둥근 카드 목록, 아래 3버튼 탐색줄.
   대화상자 자체는 화면 전체를 덮는 투명한 판이고(빈 곳을 누르면 닫힌다), 기기는 그 안에서 아래로부터 올라온다. */
#phone {
  --ph-bg: #0e0f13;
  --ph-card: #1c1d24;
  --ph-line: rgba(255, 255, 255, 0.08);
  --ph-text: #f4f1ea;
  --ph-sub: rgba(244, 241, 234, 0.6);
  --ph-chip: rgba(255, 255, 255, 0.08);
  --ph-accent: var(--accent);
  --ph-on-accent: #2a1d10;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ph-text);
  font-size: 15px;
  line-height: 1.45;
  /* clip: 열 때 안쪽에 초점이 가도 내려가 있는 기기 쪽으로 판이 스크롤되지 않게 한다. */
  overflow: clip;
}
#phone[open] { display: flex; align-items: flex-end; justify-content: flex-end; }
#phone::backdrop { background: rgba(6, 8, 14, 0); transition: background 0.28s; }
#phone[data-state="open"]::backdrop { background: rgba(6, 8, 14, 0.22); }

.phone-device {
  /* 넓은 화면: 위쪽 환경 요약이 가려지지 않을 만큼만 높인다. */
  --ph-h: min(720px, calc(100dvh - 88px));
  position: relative;
  flex: none;
  width: clamp(270px, calc(var(--ph-h) * 0.47), 340px);
  height: var(--ph-h);
  padding: 7px;
  border-radius: 40px;
  background: #060608;
  box-shadow: 0 0 0 1.5px #3c3d45, 0 0 0 3.5px #17181d, 0 30px 70px rgba(0, 0, 0, 0.55);
  transform: translateY(calc(100% + 60px));
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.6, 1);
}
#phone[data-state="open"] .phone-device { transform: none; transition: transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1); }
/* 오른쪽 옆면의 음량·전원 버튼 */
.phone-device::before, .phone-device::after {
  content: '';
  position: absolute;
  right: -4.5px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #2c2d34;
}
.phone-device::before { top: 17%; height: 11%; }
.phone-device::after { top: 31%; height: 6%; }

.phone-screen {
  --ph-wall: linear-gradient(172deg, #3f7fd6 0%, #86bdee 52%, #f1d6a8 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 33px;
  overflow: hidden;
  background: var(--ph-bg);
  isolation: isolate;
}
/* 홈·최근 앱은 배경 화면 위. 배경은 게임 속 하루의 때를 따른다. */
.phone-screen[data-sky="dawn"] { --ph-wall: linear-gradient(172deg, #4a5596 0%, #c993ad 55%, #ffd1a0 100%); }
.phone-screen[data-sky="dusk"] { --ph-wall: linear-gradient(172deg, #2b2d68 0%, #a8557a 52%, #ffad6c 100%); }
.phone-screen[data-sky="night"] { --ph-wall: linear-gradient(172deg, #050916 0%, #141c44 58%, #2b2552 100%); }
/* 홈 아래쪽의 어두운 둔덕은 광장 둘레의 산을 닮게 했다(탐색줄 흰 아이콘도 잘 보이게). */
.phone-screen[data-page="home"] {
  background:
    radial-gradient(95% 24% at 14% 104%, rgba(8, 12, 22, 0.62), transparent 72%),
    radial-gradient(85% 20% at 90% 103%, rgba(8, 12, 22, 0.5), transparent 72%),
    var(--ph-wall);
}
.phone-screen[data-page="recents"] { background: linear-gradient(rgba(6, 8, 14, 0.58), rgba(6, 8, 14, 0.58)), var(--ph-wall); }

.phone-status {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 4px 22px 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.phone-status-side { display: flex; align-items: center; gap: 6px; }
.phone-status-icon { width: 15px; height: 15px; }
.phone-status-icon svg { display: block; width: 100%; height: 100%; }
.phone-status-system { gap: 4px; }
.phone-signal { width: 15px; height: 12px; }
.phone-battery { width: 22px; height: 12px; }
.phone-battery-text { font-size: 12px; margin-left: 2px; }
.phone-camera {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #2b3242 0 22%, #040406 32%);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.06);
}

.phone-pages { position: relative; flex: 1; min-height: 0; }
.phone-page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.phone-page[hidden] { display: none; }

/* 홈 화면: 위젯 + 앱 격자 */
.phone-home { display: flex; flex-direction: column; gap: 18px; padding: 16px 14px 12px; }
.phone-widget {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 28px;
  background: rgba(10, 12, 20, 0.38);
  color: #fff;
}
.phone-widget-clock { display: grid; }
.phone-widget-time { font-size: 46px; font-weight: 300; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.phone-widget-date { margin-top: 4px; font-size: 14px; opacity: 0.86; }
.phone-widget-weather { display: grid; justify-items: end; gap: 2px; text-align: right; }
.phone-widget-icon { width: 38px; height: 38px; }
.phone-widget-icon svg, .phone-now-icon svg, .phone-chevron svg { display: block; width: 100%; height: 100%; }
.phone-widget-label { font-size: 16px; font-weight: 600; }
.phone-widget-wind { font-size: 12px; opacity: 0.82; }
.phone-app-grid {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 4px;
  padding: 0 2px 4px;
}
.phone-launcher {
  appearance: none;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  padding: 4px 0;
  border: 0;
  border-radius: 16px;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
.phone-launcher:focus-visible { outline: 2px solid var(--cool); outline-offset: 0; }
.phone-launcher:active .phone-icon { transform: scale(0.94); }
.phone-launcher-label { max-width: 100%; text-align: center; word-break: keep-all; }
.phone-icon {
  display: grid;
  place-items: center;
  width: min(56px, 100%);
  aspect-ratio: 1;
  border-radius: 32%;
  background: var(--icon-bg);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}
.phone-icon svg { width: 54%; height: 54%; }

/* 앱 화면: 위 제목 줄(내리면 작은 제목이 나타남) + 큰 제목 + 카드 */
.phone-app { padding-bottom: 20px; background: var(--ph-bg); }
.phone-appbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 52px;
  padding: 0 8px;
  background: var(--ph-bg);
}
.phone-up {
  appearance: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ph-text);
  cursor: pointer;
}
.phone-up svg { width: 22px; height: 22px; }
.phone-up:hover, .phone-nav button:hover { background: rgba(255, 255, 255, 0.08); }
.phone-up:focus-visible, .phone-nav button:focus-visible { outline: 2px solid var(--cool); outline-offset: -2px; }
.phone-appbar-title { font-size: 18px; font-weight: 600; opacity: var(--collapse, 0); }
.phone-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: max(92px, 21%);
  padding: 0 26px 16px;
}
#phone .phone-hero h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  opacity: calc(1 - var(--collapse, 0));
  outline: none;
}

.phone-card { margin: 0 12px 12px; padding: 4px 0; border-radius: 26px; background: var(--ph-card); overflow: hidden; }
.phone-row {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 15px 22px;
  color: var(--ph-text);
  text-decoration: none;
}
.phone-row + .phone-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: var(--ph-line);
}
.phone-row-title { display: flex; justify-content: space-between; gap: 10px; font-size: 15.5px; }
.phone-row-title output { color: var(--ph-accent); font-variant-numeric: tabular-nums; }
.phone-row-text { display: grid; gap: 2px; min-width: 0; }
.phone-row-sub { margin: 0; font-size: 13px; color: var(--ph-sub); }
.phone-note { margin: 4px 26px 0; font-size: 13px; color: var(--ph-sub); }
#phone .phone-subhead { margin: 20px 30px 8px; font-size: 13px; font-weight: 600; color: var(--ph-accent); }
/* 소리 앱의 갈래별 음량 줄: 아이콘 · 이름과 설명 · % / 아래에 슬라이더 */
.phone-volume { grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 6px; }
.phone-volume input[type="range"] { grid-column: 2 / -1; }
.phone-volume-value { min-width: 4ch; text-align: right; color: var(--ph-accent); font-size: 14px; font-variant-numeric: tabular-nums; }
#phone-sound-levels[data-muted="true"] .phone-volume,
#phone-sound-kinds[data-muted="true"] .phone-toggle { opacity: 0.5; }
.phone-card-actions { display: flex; justify-content: flex-end; margin: -2px 16px 12px; }
.phone-text-button {
  appearance: none;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ph-chip);
  color: var(--ph-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.phone-text-button:hover { background: rgba(255, 255, 255, 0.13); }
.phone-text-button:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }

/* 안드로이드식 스위치: 꺼지면 테두리만 있는 길에 작은 손잡이, 켜지면 채운 길에 큰 손잡이. */
.phone-toggle { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; cursor: pointer; }
.phone-toggle input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.phone-switch {
  position: relative;
  width: 52px;
  height: 32px;
  border: 2px solid #8d909a;
  border-radius: 16px;
  transition: background 0.18s, border-color 0.18s;
}
.phone-switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: #8d909a;
  transition: left 0.18s, width 0.18s, height 0.18s, margin 0.18s, background 0.18s;
}
.phone-toggle input:checked + .phone-switch { background: var(--ph-accent); border-color: var(--ph-accent); }
.phone-toggle input:checked + .phone-switch::after { left: 23px; width: 22px; height: 22px; margin-top: -11px; background: var(--ph-on-accent); }
.phone-toggle input:focus-visible + .phone-switch { outline: 2px solid var(--cool); outline-offset: 3px; }

#phone .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#phone .segmented button {
  min-height: 40px;
  padding: 6px 2px;
  border: 0;
  border-radius: 14px;
  background: var(--ph-chip);
  color: var(--ph-text);
  font-size: 14px;
}
#phone .segmented button:hover { background: rgba(255, 255, 255, 0.13); }
#phone .segmented button[aria-pressed="true"] { background: var(--ph-accent); color: var(--ph-on-accent); font-weight: 700; }
#phone .segmented[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* 불꽃놀이 앱: 지금 상태 한 줄과 글 단추 줄 */
.phone-fireworks-status { margin: 0; font-size: 15.5px; line-height: 1.45; color: var(--ph-text); }
.phone-button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.phone-button-row:empty, .phone-button-row:not(:has(button:not([hidden]))) { display: none; }

#phone input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer; }
#phone input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--ph-accent) var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%));
}
#phone input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: var(--ph-accent);
  box-shadow: 0 0 0 5px rgba(255, 194, 122, 0.2);
}
#phone input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
#phone input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--ph-accent); }
#phone input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--ph-accent); }

#phone select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 0 40px 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--ph-chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4f1ea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
  color: var(--ph-text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.phone-clock-card { display: grid; gap: 2px; padding: 18px 22px 16px; }
.phone-big-time { color: var(--ph-text); font-size: 54px; font-weight: 300; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.phone-weather-now { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 18px 18px 18px 20px; }
.phone-now-icon { width: 46px; height: 46px; color: var(--ph-accent); }
.phone-now-text { display: grid; gap: 1px; min-width: 0; }
.phone-now-label { font-size: 22px; font-weight: 600; }
.phone-compass { width: 54px; height: 54px; }
.phone-compass .ring { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.22); stroke-width: 0.8; }
.phone-compass text { font-size: 4.2px; fill: var(--ph-sub); dominant-baseline: middle; }
.phone-compass .arrow { fill: var(--ph-accent); }
.phone-compass .tail { stroke: var(--ph-accent); stroke-width: 1.4; stroke-linecap: round; }

/* 목록 줄(설정 목록·지도 장소·링크) */
.phone-link-row {
  appearance: none;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.phone-link-row:hover { background: rgba(255, 255, 255, 0.04); }
.phone-link-row:focus-visible { outline: 2px solid var(--cool); outline-offset: -3px; border-radius: 20px; }
.phone-row-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--icon-bg); color: #fff; }
.phone-row-icon svg { width: 19px; height: 19px; }
.phone-pin-icon, .phone-tint-icon { --icon-bg: rgba(255, 194, 122, 0.16); color: var(--ph-accent); }
.phone-chevron { width: 18px; height: 18px; color: var(--ph-sub); }

.phone-prose { display: grid; gap: 10px; padding: 16px 22px; color: rgba(244, 241, 234, 0.86); font-size: 14px; line-height: 1.65; }
.phone-prose p { margin: 0; }

.phone-map { padding: 10px; }
.phone-map-svg { display: block; width: 100%; height: auto; border-radius: 18px; }
.phone-map-svg .land { fill: #26331f; }
.phone-map-svg .paths rect { fill: #6f6858; }
.phone-map-svg .plaza { fill: #7d7464; }
.phone-map-svg .pool { fill: #3f86b8; }
.phone-map-svg .buildings rect { fill: #3d4252; stroke: #687088; stroke-width: 0.4; }
.phone-map-svg text {
  font-family: var(--font);
  font-size: 3.4px;
  font-weight: 700;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(8, 10, 16, 0.8);
  stroke-width: 0.9px;
  stroke-linejoin: round;
}
.phone-map-svg .north { font-size: 3px; fill: rgba(255, 255, 255, 0.72); }
.phone-map-pin { cursor: pointer; }
.phone-map-pin .halo { fill: rgba(255, 194, 122, 0.3); }
.phone-map-pin .dot { fill: var(--ph-accent); stroke: #2a1d10; stroke-width: 0.5; }
.phone-map-me .dot { fill: var(--cool); stroke: #fff; stroke-width: 0.6; }
.phone-map-me .pulse { fill: rgba(143, 216, 255, 0.3); transform-box: fill-box; transform-origin: center; animation: phone-pulse 1.8s ease-out infinite; }
@keyframes phone-pulse { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.phone-map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 8px 6px 2px; color: var(--ph-sub); font-size: 12px; }
.phone-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.phone-map-legend .hint { flex-basis: 100%; }
.phone-map-legend i { width: 9px; height: 9px; border-radius: 50%; }
.phone-map-legend .me { background: var(--cool); }
.phone-map-legend .pin { background: var(--ph-accent); }

/* 최근 앱: 배경 화면 위로 앱 카드를 옆으로 넘긴다. */
.phone-recents { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 10px 0 18px; }
/* 아래 여백은 카드 그림자가 가로 스크롤 상자에 잘리지 않게 둔다. */
.phone-recents-track { display: flex; gap: 16px; padding: 4px 17% 30px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.phone-recent {
  appearance: none;
  flex: none;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 66%;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  scroll-snap-align: center;
  cursor: pointer;
}
.phone-recent:focus-visible { outline: 2px solid var(--cool); outline-offset: 4px; border-radius: 22px; }
.phone-recent-head { display: flex; align-items: center; gap: 8px; }
.phone-recent-head .phone-icon { width: 28px; box-shadow: none; }
.phone-recent-card {
  display: grid;
  align-content: start;
  gap: 10px;
  width: 100%;
  aspect-ratio: 9 / 15;
  padding: 34px 16px;
  border-radius: 22px;
  background: var(--ph-bg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  text-align: left;
}
.phone-recent-title { margin-bottom: 12px; font-size: 22px; font-weight: 600; }
.phone-recent-line { height: 38px; border-radius: 14px; background: var(--ph-card); }
.phone-recent-line.short { width: 62%; }
.phone-recents-empty { margin: 0 auto; color: rgba(255, 255, 255, 0.82); font-size: 14px; }
.phone-recents-clear {
  align-self: center;
  appearance: none;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* 아래 3버튼 탐색줄: 최근 앱 · 홈 · 뒤로 */
.phone-nav { flex: none; display: flex; justify-content: space-around; align-items: center; height: 48px; padding: 0 22px 2px; background: var(--ph-bg); }
.phone-screen[data-page="home"] .phone-nav, .phone-screen[data-page="recents"] .phone-nav { background: transparent; }
.phone-nav button {
  appearance: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 40px;
  border: 0;
  border-radius: 20px;
  background: none;
  color: var(--ph-text);
  cursor: pointer;
}
.phone-nav svg { width: 22px; height: 22px; }

@media (max-width: 640px) {
  /* 좁은 화면: 위쪽 조금만 남기고 화면 대부분 높이로 올라온다. */
  #phone { padding: max(40px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  #phone[open] { justify-content: center; }
  .phone-device { width: min(100%, 430px); height: 100%; }
}

#loading, #unsupported {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: radial-gradient(circle at 50% 40%, #2b2a3c, #14151f);
  text-align: center;
  padding: 24px;
  transition: opacity 0.6s;
}
#loading[data-done="true"] { opacity: 0; pointer-events: none; }
#loading p { margin: 0; color: var(--muted); font-size: 14px; }
#loading .loading-percent { color: var(--text, #f4efe6); font: 700 22px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.loading-bar { width: min(220px, 60vw); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loading-bar span { display: block; height: 100%; background: var(--accent, #8fd3ff); transform-origin: 0 50%; transform: scaleX(0); transition: transform 0.25s ease-out; }
#unsupported[hidden] { display: none; }
#unsupported h2 { margin: 0; }
#unsupported p { margin: 0 0 8px; color: var(--muted); max-width: 420px; }
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .title-panel { padding: 10px 12px; max-width: calc(calc(100vw / var(--hud-zoom, 1)) - 28px - 132px); }
  .title-panel h1 { font-size: 15px; }
  .title-panel p { display: none; }
  .title-actions { margin-top: 6px; }
  .phone-button { top: max(14px, env(safe-area-inset-top)); bottom: auto; padding: 7px 12px 7px 8px; gap: 6px; }
  .phone-button-label, .phone-clock-chip { display: none; }
  .phone-button-time { display: block; }
  /* 장소가 여섯 곳이라 좁은 화면에서는 한 줄에 다 들어가지 않는다. 줄을 옆으로 밀어 보고(버튼 단위로 멈춘다),
     넓으면 버튼이 늘어나 줄을 채운다. 끝 버튼이 조금 걸쳐 보여 밀 수 있다는 걸 알린다. */
  .places {
    width: calc(calc(100vw / var(--hud-zoom, 1)) - 24px);
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 6px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .places::-webkit-scrollbar { display: none; }
  /* 좁은 화면은 두 줄 대신 한 줄로 이어 붙여 옆으로 민다(건물 이름은 층 단추 앞에 그대로 남는다). */
  .places { flex-direction: row; gap: 6px; border-radius: 999px; }
  .places-row, .places-group { display: contents; }
  .places-group + .places-group { margin-left: 0; padding-left: 0; border-left: 0; }
  .places-group-name { align-self: center; padding: 0 2px 0 8px; }
  .places button { flex: 1 0 auto; padding: 9px 8px; font-size: 13px; scroll-snap-align: start; }
  .help { display: none; }
  /* 좁은 화면 아래쪽은 이동 패드·장소 줄·손에 든 물건·헬스장·상영관 패널로 차 있어 알림이 늘 무언가를 가린다.
     알림은 위쪽 가운데(제목 패널·휴대폰 단추 아래)에 띄운다. 헬스장 1인칭 띠가 있으면 그 아래로. */
  #hud > .toast, .theater-panel:not([hidden]) ~ .toast { top: calc(max(14px, env(safe-area-inset-top)) + 96px); bottom: auto; }
  body[data-gym-view="first-person"] #hud > .toast { top: calc(max(14px, env(safe-area-inset-top)) + 180px); }
  .debug-stats { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px); font-size: 11px; }
  .theater-panel { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px); padding: 9px 10px 10px; gap: 7px; }
  .theater-actions { gap: 5px; }
  .theater-actions .chip { padding: 6px 9px; font-size: 12px; }
  .theater-panel:not([hidden]) ~ .debug-stats { display: none; }
  body[data-seated="true"] .theater-panel {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 7px;
  }
  body[data-seated="true"] .theater-actions .primary { margin-left: auto; }
  .exhibit-card {
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px);
    max-height: calc(48vh / var(--hud-zoom, 1));
    padding: 12px 14px;
  }
  .exhibit-image { aspect-ratio: 16 / 7; }
  body[data-exhibit="open"] .debug-stats { display: none; }
}


/* 전시관 기록 책: 페이지와 장면의 입력을 분리하는 네이티브 모달. */
#log-book {
  box-sizing: border-box;
  width: min(940px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: clamp(10px, 2vw, 18px);
  overflow: auto;
  overscroll-behavior: contain;
}
#log-book::backdrop { background: rgba(7, 9, 16, 0.76); }
.log-book-toolbar, .log-book-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-book-toolbar { justify-content: space-between; }
.log-book-toolbar .chip { min-height: 44px; white-space: nowrap; }
#log-book-title {
  margin: 0;
  font-size: clamp(16px, 2.4vw, 21px);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* 펼친 책: 짙은 책 판 위에 두 쪽. 넘어가는 장(.log-book-leaf)은 등 자리에 겹쳐 세운다(log-book.js). */
.log-book-pages {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-block: 8px;
  padding: 7px 9px 10px;
  border-radius: 10px;
  /* 넘어가는 장은 보는 쪽으로 들리며 위아래로 커지므로 판 밖으로 나와도 자르지 않는다. */
  overflow: visible;
  perspective: 3000px;
  touch-action: pan-y pinch-zoom;
  /* 책 안에서 마우스로 끌면 늘 책장 넘기기다(글 고르기·끌기 대신). */
  user-select: none;
  -webkit-user-select: none;
}
/* 책 판(짙은 바탕)은 따로 두어, 날아오는 동안 덮은 책만 보이다가 서서히 나타나게 한다. */
.log-book-pages::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #3d2a1c, #2a1c12);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 236, 200, 0.07);
  transition: opacity 0.3s ease;
}
.log-book-page a, .log-book-page img { -webkit-user-drag: none; }
.log-book-page {
  box-sizing: border-box;
  min-width: 0;
  height: min(37rem, 66dvh);
  padding: clamp(18px, 3vw, 32px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  color: #30251b;
  background: #f9f1df;
  box-shadow: inset 0 0 32px #bba28530;
  font: 16px/1.7 system-ui, sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.log-book-page:focus-visible { outline: 2px solid #725429; outline-offset: -3px; }
/* 등 쪽 그늘: 왼쪽 쪽은 오른쪽 끝, 오른쪽 쪽은 왼쪽 끝이 접혀 들어가 어둡다. 쪽 아래에는 종이 겹 두께. */
.log-book-pages > .log-book-page:nth-child(1):not(:only-of-type) {
  box-shadow: inset -30px 0 34px -26px rgba(70, 46, 22, 0.5), inset 0 0 32px #bba28530, 0 2px 0 #d8c8aa, 0 4px 0 #c4b190;
}
.log-book-pages > .log-book-page:nth-child(2) {
  box-shadow: inset 30px 0 34px -26px rgba(70, 46, 22, 0.5), inset 0 0 32px #bba28530, 0 2px 0 #d8c8aa, 0 4px 0 #c4b190;
}
.log-book-blank { background: #f6eedb; }
.log-book-reverse { background: #efe5cf; }
/* 펼칠 때 넘어가는 겉표지와 그 아래 빈 책 판. */
.log-book-hardcover {
  display: grid;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: #f4e4c4;
  /* --cover: 책장에 꽂혀 있던 책 색(log-book.js). */
  background: linear-gradient(150deg, color-mix(in srgb, var(--cover, #5a3b25) 88%, #fff), color-mix(in srgb, var(--cover, #5a3b25) 52%, #0d0805));
  box-shadow: inset 0 0 0 10px rgba(0, 0, 0, 0.12), inset 0 0 0 12px rgba(240, 198, 116, 0.35);
}
.log-book-hardcover h3 { margin: 0; font-size: clamp(22px, 3.4vw, 32px); line-height: 1.3; }
.log-book-hardcover p { margin: 0; color: #e7c27f; letter-spacing: 0.2em; font-size: 13px; }
.log-book-board { background: transparent; box-shadow: none !important; }
.log-book-leaf { position: absolute; z-index: 3; pointer-events: none; transform-style: preserve-3d; }
.log-book-strip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}
.log-book-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.log-book-face.is-back { transform: rotateY(180deg); }
.log-book-face > .log-book-page {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  box-shadow: inset 0 0 32px #bba28530;
}
.log-book-face-shade { position: absolute; inset: 0; pointer-events: none; }
.log-book-under { position: absolute; z-index: 2; pointer-events: none; opacity: 0; }
.log-book-under.is-right { background: linear-gradient(90deg, rgba(48, 30, 12, 0.55), rgba(48, 30, 12, 0) 72%); }
.log-book-under.is-left { background: linear-gradient(270deg, rgba(48, 30, 12, 0.55), rgba(48, 30, 12, 0) 72%); }
/* 책이 책장에서 날아오고 날아갈 때: 창 바탕·단추·책 판을 감추고 덮은 책만 보인다. */
#log-book { transition: background-color 0.3s ease, border-color 0.3s ease; }
#log-book > :not(.log-book-pages) { transition: opacity 0.3s ease; }
#log-book::backdrop { transition: background-color 0.45s ease; }
#log-book.is-flying { background-color: transparent; border-color: transparent; }
#log-book.is-flying > :not(.log-book-pages) { opacity: 0; }
#log-book.is-flying .log-book-pages::before { opacity: 0; }
#log-book.is-flying::backdrop { background-color: rgba(7, 9, 16, 0.2); }
.log-book-page > :first-child { margin-top: 0; }
.log-book-page h1, .log-book-page h2, .log-book-page h3, .log-book-page h4 {
  margin: 1em 0 0.38em;
  line-height: 1.32;
}
.log-book-page p, .log-book-page ul, .log-book-page ol,
.log-book-page blockquote, .log-book-page pre, .log-book-page figure { margin: 0 0 0.8em; }
.log-book-page a { color: #14535e; text-underline-offset: 0.15em; }
.log-book-page strong { color: inherit; }
.log-book-page ul, .log-book-page ol { padding-inline-start: 1.35em; }
.log-book-page blockquote { padding-inline-start: 0.8em; border-inline-start: 3px solid #aa8761; }
.log-book-page pre {
  padding: 0.7em;
  border-radius: 5px;
  background: #e9ddc6;
  white-space: pre-wrap;
  word-break: normal;
}
.log-book-page img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(32dvh, 20rem);
  margin: 0.35em auto;
  object-fit: contain;
}
.log-book-image-fallback { display: block; padding: 0.5em; background: #e9ddc6; }
.log-book-cover {
  align-content: center;
  text-align: center;
  background: linear-gradient(150deg, #f9f1df 20%, #ecd9b5);
}
.log-book-cover h1, .log-book-cover h2, .log-book-cover h3 { font-size: clamp(24px, 4vw, 36px); }
.log-book-page .log-book-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0;
  list-style: none;
}
.log-book-tags li { padding: 0.15em 0.6em; border: 1px solid #bda583; border-radius: 999px; font-size: 0.9em; }
#log-book-status { margin: 0 0 8px; font-size: 14px; }
#log-book-status:empty, #log-book-source[hidden] { display: none; }
.log-book-footer { flex-wrap: wrap; }
#log-book-counter { min-width: 6ch; text-align: center; font-variant-numeric: tabular-nums; }
.log-book-pagination button:disabled { opacity: 0.48; cursor: default; }
@media (max-width: 640px) {
  .log-book-pages { grid-template-columns: minmax(0, 1fr); padding: 6px 6px 9px; }
  /* 한 쪽 보기에서 넘어간 장은 책 왼쪽 밖으로 나가므로 옆으로만 자른다(위아래는 그대로). */
  .log-book-pages.is-turning { clip-path: inset(-40% 0 -40% 0); }
  .log-book-pages > .log-book-page:nth-child(1) { box-shadow: inset 18px 0 22px -18px rgba(70, 46, 22, 0.45), inset 0 0 32px #bba28530, 0 2px 0 #d8c8aa, 0 4px 0 #c4b190; }
  .log-book-page { padding: 18px; }
  .log-book-footer { justify-content: center; }
}

/* 알파 판 표시(plaza-version.js): 화면 위 가운데, 누르지 않는 작은 글자표 */
.version-badge {
  position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 30;
  padding: 4px 12px; border-radius: 999px; background: rgba(109, 82, 214, 0.86); color: #fff;
  font: 600 12px/1.4 var(--font, sans-serif); letter-spacing: 0.02em; pointer-events: none;
}
