/* ------------------------------------------------------------------
   AI 아키텍처 시티 — UI 스타일
   색은 두 지구를 무의식적으로 색분류시키려고 쓴다(§7).
   단, 색만으로 뜻을 전달하지 않는다 — 반드시 도형/기호를 같이 붙인다(§11.1).
   ------------------------------------------------------------------ */

:root {
  /* 기본 색 */
  --sand:        #F4EAD8;
  --card:        #FFFDF8;
  --ink:         #23303E;
  --ink-soft:    #55636F;
  --line:        #DCCFB8;

  /* 지구별 강조색 — 밝은 쪽은 면, 어두운 쪽은 글자 */
  --saas:        #38B6C8;
  --saas-ink:    #17708C;
  --bedrock:     #E09A3E;
  --bedrock-ink: #8A4E0B;
  --lane:        #E2795C;
  --lane-ink:    #9C3F26;

  --ok:          #2E7D53;
  --warn:        #B23B3B;

  /* 글자 크기 3단계(§11.1). data-textsize 로 바뀐다 */
  --ui-scale: 1;
  --fs-xs: calc(11px * var(--ui-scale));
  --fs-sm: calc(13px * var(--ui-scale));
  --fs-md: calc(15px * var(--ui-scale));
  --fs-lg: calc(18px * var(--ui-scale));
  --fs-xl: calc(26px * var(--ui-scale));

  --radius: 14px;
  --shadow: 0 6px 22px rgba(35, 48, 62, .16);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "D2Coding", "Consolas", "Menlo", monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-textsize="1"] { --ui-scale: 1.16; }
html[data-textsize="2"] { --ui-scale: 1.34; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font);
  /* 모바일에서 더블탭 확대·주소창 리사이즈를 막는다(§11.4) */
  -webkit-text-size-adjust: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

/* CSS3D 층은 캔버스 뒤에 깔린다. 광장 화면의 구멍으로만 보인다(core/screen3d.js). */
#css3d { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

#scene {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- 로딩 화면 ---------- */
.boot {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #FBF3E5 0%, #EFE0C8 100%);
  transition: opacity .5s ease;
}
.boot[hidden] { display: none; }
.boot.is-gone { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; width: min(80vw, 320px); }
.boot-mark { display: flex; gap: 8px; justify-content: center; align-items: flex-end; height: 54px; margin-bottom: 18px; }
.bm { display: block; border-radius: 4px 4px 0 0; animation: bmrise 1.6s ease-in-out infinite alternate; }
.bm-a { width: 22px; height: 48px; background: var(--saas); }
.bm-b { width: 26px; height: 32px; background: var(--bedrock); animation-delay: .35s; }
@keyframes bmrise { from { transform: translateY(4px); } to { transform: translateY(-4px); } }
.boot-title { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.02em; margin: 0 0 14px; }
.boot-bar { height: 6px; background: rgba(35,48,62,.12); border-radius: 99px; overflow: hidden; }
.boot-bar > i { display: block; height: 100%; width: 0%; background: var(--ink); border-radius: 99px; transition: width .35s ease; }
.boot-msg { font-size: var(--fs-sm); color: var(--ink-soft); margin: 12px 0 0; min-height: 1.4em; }

/* ---------- UI 레이어 ---------- */
.ui-root {
  position: fixed; inset: 0; z-index: 100;
  /* 카드 바닥선. 좁은 화면에서는 아래 @media 가 이 값 하나만 바꾼다.
     올림 규칙(labelcard 들어올리기)도 이 변수를 쓴다 — 숫자를 두 군데 적으면
     폰에서만 다시 겹친다. */
  --card-bottom: calc(112px + var(--safe-b));
  pointer-events: none;                 /* 기본은 통과. 개별 요소만 켠다 */
  font-size: var(--fs-md);
}
.ui-root > * { pointer-events: auto; }

/* 공통 카드 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(14px * var(--ui-scale)) calc(16px * var(--ui-scale));
}

/* 버튼 */
.btn {
  font-family: var(--font); font-size: var(--fs-sm); font-weight: 700;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  padding: calc(9px * var(--ui-scale)) calc(14px * var(--ui-scale));
  cursor: pointer; min-height: 44px; min-width: 44px;   /* 손가락 최소 타깃 */
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: #FFF8EA; }
.btn:active { transform: scale(.96); }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: #16202B; }
.btn--sm { min-height: 38px; padding: 6px 10px; font-size: var(--fs-xs); }

/* 키보드 포커스 링은 항상 보이게(§11.1) */
:focus-visible {
  outline: 3px solid #1B6FE0;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- 상단 좌: 스탬프 카드 ---------- */
.stampcard {
  position: absolute; top: calc(12px + var(--safe-t)); left: 12px;
  width: calc(206px * var(--ui-scale));
}
.stampcard h2 { font-size: var(--fs-xs); margin: 0 0 8px; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; }
.stampcard ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stampcard li {
  aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed var(--line);
  display: grid; place-items: center; text-align: center;
  font-size: var(--fs-xs); line-height: 1.15; color: var(--ink-soft);
  padding: 2px; position: relative; background: #FFFDF8;
  white-space: pre-line;
}
.stampcard li.is-done { border-style: solid; border-color: var(--ok); color: var(--ok); font-weight: 700; background: #F0F8F3; }
.stampcard li.is-done::after {
  content: "\2713"; position: absolute; top: 2px; right: 5px;
  font-size: calc(11px * var(--ui-scale)); color: var(--ok);
}

/* ---------- 하단 중앙: 상호작용 안내 ---------- */
.prompt {
  position: absolute; left: 50%; bottom: calc(74px + var(--safe-b));
  transform: translate(-50%, 8px); opacity: 0;
  display: flex; align-items: center; gap: 10px;
  background: rgba(35,48,62,.92); color: #fff;
  border-radius: 999px; padding: 10px 18px 10px 12px;
  font-size: var(--fs-sm); font-weight: 600;
  transition: opacity .16s ease, transform .16s ease;
  white-space: nowrap; max-width: 86vw;
}
.prompt.is-on { opacity: 1; transform: translate(-50%, 0); }
.prompt kbd {
  font-family: var(--font); font-size: var(--fs-xs); font-weight: 800;
  background: #fff; color: var(--ink); border-radius: 6px; padding: 3px 8px; min-width: 26px; text-align: center;
}

/* ---------- 상단 우: 토글 ---------- */
.toprow { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; display: flex; gap: 8px; }

/* ---------- 미니맵 ---------- */
.minimap {
  position: absolute; right: 12px; bottom: calc(12px + var(--safe-b));
  width: calc(112px * var(--ui-scale)); height: calc(112px * var(--ui-scale));
  border-radius: 50%; background: rgba(255,253,248,.9);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
}
.minimap canvas { width: 100%; height: 100%; display: block; }

/* ---------- 라벨 카드(개념 설명) ---------- */
.labelcard {
  position: absolute; left: 50%; bottom: var(--card-bottom);
  transform: translate(-50%, 14px); opacity: 0;
  width: min(560px, 90vw);
  border-left: 5px solid var(--ink);
  transition: opacity .28s ease, transform .28s ease;
}
.labelcard.is-on { opacity: 1; transform: translate(-50%, 0); }
.labelcard[data-tone="saas"]    { border-left-color: var(--saas-ink); }
.labelcard[data-tone="bedrock"] { border-left-color: var(--bedrock-ink); }
.labelcard[data-tone="lane"]    { border-left-color: var(--lane-ink); }
.labelcard .lc-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: .03em;
  color: var(--ink-soft); margin-bottom: 6px;
}
.labelcard h3 { margin: 0 0 6px; font-size: var(--fs-lg); letter-spacing: -.01em; padding-right: 40px; }
.labelcard p  { margin: 0; font-size: var(--fs-md); line-height: 1.62; color: var(--ink); white-space: pre-line; }
.labelcard .lc-close { position: absolute; top: 8px; right: 8px; }

/* ---------- 안내 NPC 대사 ---------- */
.dialog {
  position: absolute; left: 50%; bottom: var(--card-bottom);
  transform: translate(-50%, 14px); opacity: 0;
  width: min(600px, 92vw);
  transition: opacity .25s ease, transform .25s ease;
}
.dialog.is-on { opacity: 1; transform: translate(-50%, 0); }
.dialog .dl-who { font-size: var(--fs-xs); font-weight: 800; color: var(--ink-soft); margin-bottom: 6px; }
.dialog .dl-text { font-size: var(--fs-md); line-height: 1.66; margin: 0 0 12px; min-height: 3.2em; white-space: pre-wrap; }
.dialog .dl-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 겹침 순서 ----------
   #ui-root 안에는 z-index 가 하나도 없었다. 그리는 차례가 곧 DOM 차례라서
   **라벨 카드와 대사가 같은 자리(left 50% / bottom 112px)** 를 쓰고 있었고,
   둘 다 켜지면 나중에 붙은 대사가 카드를 통째로 덮었다. 45초 유휴 힌트가
   카드를 읽는 중에 뜨는 정상 경로로 재현된다. */
.labelcard { z-index: 20; }
.dialog    { z-index: 21; }
.sheet     { z-index: 30; }

/* ---------- 꺼져 있는 상자는 **마우스를 먹지 않는다** ----------
   이게 학습자가 말한 「닫기가 안 먹는다」의 진짜 원인이었다.

   .labelcard 와 .dialog 는 꺼져 있을 때 `opacity: 0` 일 뿐, DOM 에서 사라지지도
   않고 `pointer-events` 도 그대로다. 둘은 **같은 자리**(left 50% / bottom
   var(--card-bottom))에 있고 대사가 z-index 21 로 카드(20) 위에 있다. 게다가
   .dl-text 에 `min-height: 3.2em` 이 걸려 있어, 대사가 **한 번도 안 떴어도**
   보이지 않는 상자가 카드 아래쪽 닫기 단추를 덮고 있었다.

   그래서 눌러도 클릭이 대사 상자로 들어가고 카드는 그대로 남는다. 지나가는 사람
   열여섯 명 카드에서 전부 재현됐다(qa/click.js: coveredBy "card dialog" 16건).
   opacity 로 숨기는 상자는 반드시 클릭도 같이 꺼야 한다. */
.labelcard, .dialog, .hopcard { pointer-events: none; }
.labelcard.is-on, .dialog.is-on, .hopcard.is-on { pointer-events: auto; }

/* 대사가 떠 있는 동안에는 라벨 카드를 대사 위로 올린다.
   대사 상자 높이는 타자기가 돌고 버튼이 붙는 사이에 계속 바뀌므로
   panels.js 의 ResizeObserver 가 --dlg-h 로 실시간으로 넘겨준다. */
.ui-root[data-dialog="on"] .labelcard.is-on {
  bottom: calc(var(--card-bottom) + var(--dlg-h, 150px) + 10px);
  max-height: calc(100vh - var(--card-bottom) - var(--dlg-h, 150px) - 26px);
  overflow-y: auto;                    /* auto 는 잘림이 아니다 — 글씨는 남는다 */
}

/* 시트가 떠 있으면 뒤의 카드는 감춘다. 시트 장막이 55% 라서 대사의
   「다음」 단추가 시트 상자 밑으로 비쳐 나왔다. visibility 라 상태는 살아 있고,
   시트를 닫으면 읽던 카드와 대기 중인 say() 약속이 그대로 돌아온다. */
.ui-root[data-sheet="on"] .labelcard,
.ui-root[data-sheet="on"] .dialog { visibility: hidden; }

/* 홉 카드도 .labelcard 자리를 그대로 쓴다. 요청 따라가기는 화면을 통째로
   가져가는 연출이므로, 그 동안 라벨 카드는 감춘다(닫으면 그대로 돌아온다). */
.ui-root[data-hop="on"] .labelcard:not(.hopcard) { visibility: hidden; }

/* ---------- 전체 화면 오버레이(도움말·학습 기록·메뉴) ---------- */
.sheet {
  position: absolute; inset: 0; display: none;
  background: rgba(35,48,62,.55);
  align-items: center; justify-content: center; padding: 16px;
}
.sheet.is-on { display: flex; }
.sheet-box {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  width: min(680px, 96vw); max-height: min(86vh, 720px);
  display: flex; flex-direction: column; overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(16px * var(--ui-scale)) calc(18px * var(--ui-scale));
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: var(--fs-lg); }
.sheet-body { padding: calc(16px * var(--ui-scale)) calc(18px * var(--ui-scale)); overflow-y: auto; font-size: var(--fs-md); line-height: 1.7; }
.sheet-body h3 { font-size: var(--fs-md); margin: 18px 0 8px; }
.sheet-body h3:first-child { margin-top: 0; }
.sheet-body p { margin: 0 0 10px; }
.keylist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; }
.keylist .k {
  font-weight: 800; font-size: var(--fs-sm);
  background: var(--sand); border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; text-align: center;
}
.keylist .v { font-size: var(--fs-sm); color: var(--ink-soft); }
.seg { display: inline-flex; gap: 4px; }
.seg .btn.is-sel { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- 모바일 조작 ---------- */
.touch { position: absolute; inset: 0; display: none; }
html[data-touch="1"] .touch { display: block; }
.stick {
  position: absolute; left: 20px; bottom: calc(24px + var(--safe-b));
  width: 128px; height: 128px; border-radius: 50%;
  background: rgba(255,253,248,.42); border: 2px solid rgba(35,48,62,.18);
}
.stick > i {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; background: rgba(35,48,62,.72); border: 2px solid rgba(255,255,255,.75);
}
.touch-act {
  position: absolute; right: 22px; bottom: calc(150px + var(--safe-b));
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--ink); color: #fff; border: 3px solid #fff;
  font-size: var(--fs-sm); font-weight: 800; box-shadow: var(--shadow);
  display: none; align-items: center; justify-content: center; text-align: center; line-height: 1.2;
  font-family: var(--font);
}
.touch-act.is-on { display: flex; }

/* ---------- 토스트 ---------- */
.toast {
  position: absolute; left: 50%; top: calc(16px + var(--safe-t));
  transform: translate(-50%, -12px); opacity: 0;
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 10px 18px; font-size: var(--fs-sm); font-weight: 600;
  transition: opacity .3s ease, transform .3s ease; max-width: 90vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 디버그 오버레이 ---------- */
.debug {
  position: absolute; left: 12px; bottom: calc(12px + var(--safe-b));
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  background: rgba(35,48,62,.82); color: #C9F5A0; padding: 8px 10px; border-radius: 8px;
  white-space: pre; display: none;
}
.debug.is-on { display: block; }

/* ---------- 대체 페이지(WebGL 불가) ---------- */
.fallback { position: fixed; inset: 0; z-index: 950; overflow-y: auto; background: var(--sand); padding: 24px 18px 60px; }
.fallback .fb-inner { max-width: 720px; margin: 0 auto; }
.fallback h1 { font-size: var(--fs-xl); margin: 0 0 6px; }
.fallback h2 { font-size: var(--fs-lg); margin-top: 32px; }
.fallback p, .fallback li { font-size: var(--fs-md); line-height: 1.75; }
.fallback .fb-lead { color: var(--ink-soft); }

.noscript { padding: 40px 24px; max-width: 640px; margin: 0 auto; }

/* ---------- 모션 최소화(§11.1) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
html[data-reduced="1"] * { transition-duration: .001ms !important; animation: none !important; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 560px) {
  .stampcard { width: calc(150px * var(--ui-scale)); }
  .stampcard li { font-size: calc(9px * var(--ui-scale)); }
  .minimap { width: calc(84px * var(--ui-scale)); height: calc(84px * var(--ui-scale)); }
  .ui-root { --card-bottom: calc(184px + var(--safe-b)); }
}

/* ---------------------------------------------------------------- 나란히 보기(§5) */
.cmp { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.cmp .cmp-split { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: rgba(35,48,62,.55); }
.cmp .cmp-side {
  position: absolute; bottom: calc(18px + var(--safe-b)); width: calc(50% - 24px);
  background: var(--card); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(35,48,62,.18); border-left: 5px solid var(--ink);
}
.cmp .cmp-side.is-left  { left: 12px;  border-left-color: var(--saas-ink); }
.cmp .cmp-side.is-right { right: 12px; border-left-color: var(--bedrock-ink); }
.cmp .cmp-name { font-size: var(--fs-sm); font-weight: 800; color: var(--ink); display: flex; justify-content: space-between; gap: 10px; }
.cmp .cmp-clock { font-variant-numeric: tabular-nums; color: #55636F; font-weight: 700; }
.cmp .cmp-step { margin: 4px 0 0; font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.cmp .cmp-note { margin: 2px 0 0; font-size: var(--fs-sm); color: #55636F; }
.cmp .cmp-top {
  position: absolute; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  background: var(--card); border-radius: 999px; padding: 8px 16px; font-size: var(--fs-sm);
  font-weight: 800; color: var(--ink); box-shadow: 0 4px 14px rgba(35,48,62,.16);
}
.cmp .cmp-close { position: absolute; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); pointer-events: auto; }
@media (max-width: 560px) {
  .cmp .cmp-side { width: calc(50% - 14px); padding: 9px 10px; }
  .cmp .cmp-side.is-left { left: 7px; } .cmp .cmp-side.is-right { right: 7px; }
}

/* 목적지 안내 한 줄 — 왼쪽에 이름, 오른쪽에 데려다주기 */
.destrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid rgba(35, 48, 62, 0.12);
}
.destrow:last-child { border-bottom: 0; }
.destrow > div { min-width: 0; }
.destrow .btn { flex: none; }

/* 사원증 두 장(§5.1) — 스탬프 카드 아래 왼쪽에 쌓는다 */
.badges {
  position: absolute; left: 14px; top: 214px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.badge {
  width: 148px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 2px 10px rgba(35, 48, 62, 0.16);
  border-left: 5px solid #9BAAB4;
  font-size: 0.82rem; line-height: 1.25;
}
.badge--seat { border-left-color: #38B6C8; }
.badge--key  { border-left-color: #E0A047; }
.badge.is-empty { border-left-color: #C8452F; }
.bg-kind { color: #7A8590; font-size: 0.74rem; }
.bg-main { font-weight: 800; color: #23303E; margin-top: 1px; }
.bg-note { color: #55636F; font-size: 0.74rem; margin-top: 3px; }
.badge.is-empty .bg-note { color: #C8452F; font-weight: 700; }
.bg-bar {
  height: 6px; margin-top: 6px; border-radius: 3px;
  background: rgba(35, 48, 62, 0.14); overflow: hidden;
}
.bg-bar > i {
  display: block; height: 100%; border-radius: 3px;
  background: #E0A047; transition: width 0.4s ease;
}
.badge.is-empty .bg-bar > i { background: #C8452F; }
@media (max-width: 560px) {
  .badges { top: 186px; }
  .badge { width: 118px; font-size: 0.76rem; }
}

/* 설정 시트 안 부연 한 줄 (§12 소리 설명 등) */
.muted { color: #55636F; font-size: var(--fs-sm); margin: 6px 0 0; }

/* ------------------------------------------------------------------
   광장 대형 화면 뷰어 — 올린 웹사이트를 크게 보는 시트.
   본문 여백을 없애고 iframe 이 남는 자리를 전부 쓰게 둔다.
   ------------------------------------------------------------------ */
.sheet-box--wide { width: min(1180px, 96vw); max-height: min(92vh, 900px); }

.webview { display: flex; flex-direction: column; gap: 10px; height: min(74vh, 700px); }
.wv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wv-what { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); flex: 1 1 220px; word-break: break-all; }
.wv-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* display 를 주면 hidden 속성이 먹지 않는다 — 주소 줄이 늘 펼쳐져 있었다 */
.wv-url { display: flex; gap: 8px; }
.wv-url[hidden] { display: none; }
.wv-input {
  flex: 1; font: inherit; font-size: var(--fs-sm); color: var(--ink);
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #FFF;
}
.wv-input:focus { outline: 2px solid var(--saas-ink); outline-offset: 1px; }

.wv-stage {
  flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: #F7F3EA; display: flex;
}
.wv-stage.is-over { border-color: var(--saas-ink); background: #EAF6F9; }
.wv-frame { flex: 1; border: 0; width: 100%; height: 100%; background: #FFF; }

.wv-drop {
  margin: auto; text-align: center; padding: 24px; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.wv-drop strong { font-size: var(--fs-lg); color: var(--ink); }
.wv-drop p { margin: 0; font-size: var(--fs-sm); white-space: pre-line; }

.wv-note { margin: 0; font-size: var(--fs-xs); }
.wv-note.is-bad { color: var(--warn); font-weight: 700; }

/* ---------- 강사 모드(§11.6) ----------
   `?teach` 를 붙였을 때만 DOM 에 붙는다. 학습자 화면에는 이 두 상자가 아예 없다.
   시트(30)보다 아래, 대사(21)보다 위에 둔다 — 지점 목록 시트는 이 띠를 덮어야 하고,
   띠는 카드에 가리면 안 된다. */
.teachbar {
  position: absolute; z-index: 26;
  top: calc(var(--safe-t) + 8px); left: 50%; transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: min(96vw, 1080px);
  padding: 7px 10px; border-radius: 12px;
  background: rgba(35, 48, 62, .92); color: #FFF7E8;
  box-shadow: var(--shadow); font-size: var(--fs-sm);
  opacity: 0; pointer-events: none;                 /* 꺼진 상자는 클릭을 먹지 않는다 */
  transition: transform .25s ease, opacity .25s ease;
}
.teachbar.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

.tb-mark {
  flex: none; padding: 2px 8px; border-radius: 999px;
  background: var(--bedrock); color: #2A1B06; font-weight: 800; font-size: var(--fs-xs);
  letter-spacing: .04em;
}
.tb-where {
  flex: 1 1 12ch; min-width: 12ch; color: #F0E4D0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.tb-btn.is-sel { background: var(--bedrock); border-color: var(--bedrock); color: #2A1B06; }
.tb-k {
  font-family: var(--mono); font-size: var(--fs-xs); line-height: 1;
  padding: 2px 5px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .65;
}

/* 발표용 큰 글씨. 빔으로 쏠 때 뒷줄에서 읽히는 것이 목적이라
   --ui-scale 위에 한 번 더 배율을 얹는다. */
.teachbig {
  position: absolute; z-index: 25;
  left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translate(-50%, 12px);
  width: min(1180px, 94vw);
  max-height: 32vh; overflow: hidden;
  padding: calc(18px * var(--ui-scale)) calc(26px * var(--ui-scale));
  border-radius: 18px; border: 1px solid var(--line);
  background: rgba(255, 253, 248, .96); color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;                 /* 같은 이유로 꺼져 있을 땐 통과시킨다 */
  transition: transform .22s ease, opacity .22s ease;
}
.teachbig.is-on { transform: translate(-50%, 0); opacity: 1; }
.tg-tag {
  font-size: calc(var(--fs-md) * 1.15); font-weight: 800; letter-spacing: .02em;
  color: var(--bedrock-ink); margin-bottom: 6px;
}
.tg-title { margin: 0 0 8px; font-size: calc(var(--fs-xl) * 1.7); line-height: 1.25; }
.tg-body  { margin: 0; font-size: calc(var(--fs-lg) * 1.35); line-height: 1.55; color: var(--ink-soft); }

@media (max-width: 720px) {
  .tg-title { font-size: calc(var(--fs-xl) * 1.15); }
  .tg-body  { font-size: calc(var(--fs-lg) * 1.05); }
}

/* 발표용 큰 글씨를 켜면 HUD 조준 안내를 접는다. 둘은 화면 아래 같은 자리를
   쓰는데 큰 글씨 판이 반투명이라, 안 접으면 빔에 글자 두 벌이 겹쳐 보인다. */
html[data-teachbig="1"] .prompt { opacity: 0; pointer-events: none; }

/* 그리고 라벨 카드를 큰 글씨 판 **위로** 들어올린다.
   큰 글씨 판(z 25)이 카드(z 20)보다 위층이라, 안 비키면 카드 아래쪽 「닫기」 단추를
   덮는다. 클릭은 안 먹지만(pointer-events: none) **보이지 않으면 못 누른다.**
   숫자를 여기 따로 적지 않고 판의 max-height 를 그대로 쓴다 — 두 군데 적으면
   폰에서만 다시 겹친다(이 파일이 이미 같은 이유로 --card-bottom 을 한 곳에 뒀다). */
html[data-teachbig="1"] .ui-root { --card-bottom: calc(32vh + 34px + var(--safe-b)); }
