:root {
  --bg: #dfe4e6;
  --panel-bg: rgba(246, 248, 248, 0.96);
  --panel-bg-solid: #f6f8f8;
  --border: #ccd3d5;
  --border-soft: #dde2e4;
  --text: #20282b;
  --dim: #6d7c81;
  --faint: #93a0a4;
  --accent: #2c6f7a;
  --warn: #a3761b;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: var(--sans); color: var(--text); }
#world { position: fixed; inset: 0; }
button { font-family: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 46px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--panel-bg); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); pointer-events: none; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-family: var(--mono); font-size: 15px; font-weight: 500; letter-spacing: 0.14em; }
.brand-sep { width: 1px; height: 16px; background: var(--border); }
.brand-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--dim); }
.roomtag { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); }
.roomtag span:last-child { color: var(--text); }

/* ---------- first-time-visitor intro card ---------- */
.intro-card {
  position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 6;
  width: min(440px, calc(100vw - 32px));
  background: var(--panel-bg); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 3px;
  padding: 16px 18px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.intro-title { font-size: 15px; font-weight: 600; }
.intro-body { font-size: 12.5px; line-height: 1.65; color: var(--dim); margin: 8px 0 0; }
.intro-close { margin-top: 12px; }

/* ---------- hub button ---------- */
.hubbtn {
  position: fixed; top: 60px; right: 16px; z-index: 5;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 3px;
  padding: 8px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--text);
}
.hubbtn:hover { background: var(--panel-bg-solid); border-color: var(--accent); color: var(--accent); }
.hubbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- left side stack (mission card + quick nav) ---------- */
.side-stack {
  position: fixed; top: 62px; left: 16px; width: 264px; z-index: 4;
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - 78px); overflow-y: auto;
}

/* ---------- mission mini-card ---------- */
.mission-card {
  flex: none; width: 100%;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 3px;
  padding: 14px 15px 12px; cursor: pointer;
}
.mission-card:hover { border-color: var(--accent); }
.mission-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mc-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--dim); }
.mc-title { font-size: 16px; font-weight: 600; margin-top: 6px; }
.mc-desc { font-size: 12px; line-height: 1.5; color: var(--dim); margin-top: 4px; }
.mc-kv { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; font-family: var(--mono); }
.mc-k { font-size: 9px; letter-spacing: 0.12em; color: var(--dim); }
.mc-v { font-size: 14px; margin-top: 3px; }
.mc-v.warn { color: var(--warn); }
.mc-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border-soft); }
.step { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }
.step-label { width: 74px; flex: none; color: var(--text); }
.step-bar { flex: 1; height: 4px; background: #dde2e4; border-radius: 2px; overflow: hidden; }
.step-bar span { display: block; height: 100%; background: var(--accent); }
.step-val { width: 74px; flex: none; text-align: right; color: var(--dim); font-size: 9px; }
/* Mobile-only "current step" indicator (Phase 6) — reuses .flow-steps/.hint
   (already styled for the panel header) so it costs no new visual language.
   Hidden on desktop: the 6-bar .mc-steps grid above already covers this. */
.mc-mobile-flow { display: none; }

/* ---------- quick nav (room shortcut list) ---------- */
.quicknav {
  flex: none; width: 100%;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 3px;
  padding: 12px 12px 8px;
}
.qn-title {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; padding: 4px 2px; margin: 0 0 8px; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--dim);
}
.qn-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qn-chevron { font-size: 12px; }
/* Above the mobile breakpoint the list is always shown (no .qn-list{display:
   none} rule exists outside @media (max-width:767px) below), so the toggle
   has no visible effect there — looking clickable with no result reads as a
   broken control. Strip the interactive affordance (not the click handler
   itself, which stays harmless) so desktop reads it as a plain label. */
@media (min-width: 768px) {
  .qn-title { cursor: default; }
  .qn-chevron { display: none; }
}
.qn-list { display: flex; flex-direction: column; gap: 3px; }
.qn-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; background: none; border: 1px solid transparent; border-radius: 3px;
  padding: 7px 8px; font-family: var(--sans);
}
.qn-item:hover { background: var(--panel-bg-solid); border-color: var(--border-soft); }
.qn-item.qn-active { background: var(--panel-bg-solid); border-color: var(--accent); }
.qn-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.qn-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.qn-label { font-size: 12.5px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; min-width: 0; }
.qn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex: none; }
.qn-active .qn-dot { background: var(--accent); }
.qn-badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em; color: var(--dim); white-space: nowrap; flex: none; }
.qn-badge.qn-done { color: var(--accent); }
.qn-badge.qn-locked { color: var(--faint); }
.qn-desc { font-size: 10.5px; color: var(--dim); }

/* ---------- guided flow (Phase 4) ---------- */
.flow-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.02em; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.flow-step { color: var(--faint); white-space: nowrap; }
.flow-step.flow-done { color: var(--dim); }
.flow-step.flow-active { color: var(--accent); font-weight: 600; }
.flow-arrow { color: var(--faint); margin: 0 2px; }
.hint { margin: 6px 0 0; padding: 7px 10px; background: rgba(44,111,122,0.08); border-left: 2px solid var(--accent); font-size: 12px; color: var(--text); }
.room-intro { color: var(--dim); font-size: 13px; padding: 8px 10px; margin: 0 0 12px; border-left: 2px solid var(--border); background: rgba(109,124,129,0.06); }
.doe-success { border-color: var(--accent); background: rgba(44,111,122,0.06); }
.reset-done { border-color: var(--warn); background: rgba(163,118,27,0.08); }

/* ---------- mission reset (secondary/destructive utility — never a Primary CTA) ---------- */
.mission-reset { flex: none; width: 100%; }
.btn-reset {
  width: 100%; background: none; border: 1px solid var(--border-soft); border-radius: 3px;
  padding: 8px 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--faint);
  text-align: center;
}
.btn-reset:hover { color: var(--warn); border-color: var(--warn); }
.reset-en { color: var(--faint); font-size: 9px; }
.reset-confirm { background: var(--panel-bg); border: 1px solid var(--warn); border-radius: 3px; padding: 12px; }
.reset-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.btn-reset-confirm {
  background: var(--warn); color: #fff; border: none; border-radius: 3px;
  padding: 8px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
}
.btn-reset-confirm:hover { background: #8a6318; }

/* ---------- controls hint ---------- */
.controls-hint {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 16px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--dim);
  background: var(--panel-bg); border: 1px solid var(--border-soft); border-radius: 3px; padding: 7px 14px;
  pointer-events: none;
}
.controls-hint-touch { display: none; } /* shown instead of the mouse hint ≤767px — see mobile block below */

/* ---------- 3D degraded mode (Phase 8) ----------
   Injected by app.js's showWorldFallback() only when <spl-world> fails to
   start. Sits in the 3D area (z-index below the side panel and Quick Nav, so
   it can never cover the core workflow) and stays pointer-events:none — it is
   a notice, not a blocker. When this shows, .controls-hint is hidden too:
   "drag to orbit" is a lie with no camera to orbit. */
.world-fallback {
  position: fixed; top: 46px; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px; text-align: center; pointer-events: none;
}
.world-fallback .wf-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.world-fallback .wf-body { font-size: 12px; line-height: 1.6; color: var(--dim); margin: 0; max-width: 34ch; }
body:has(.world-fallback) .controls-hint { display: none; }

/* ---------- side panel ---------- */
.panel {
  position: fixed; top: 46px; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 10;
  background: var(--panel-bg-solid); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,0.08);
}
.panel[hidden] { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 18px 14px; border-bottom: 1px solid var(--border-soft); }
.panel-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--dim); }
.panel-title { font-size: 18px; font-weight: 600; margin-top: 4px; }
.panel-close { background: none; border: 1px solid var(--border); border-radius: 3px; width: 30px; height: 30px; font-size: 18px; line-height: 1; color: var(--dim); }
.panel-close:hover { color: var(--text); border-color: var(--accent); }
.panel-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.panel-disclaimer {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--faint);
  padding: 8px 18px; border-bottom: 1px solid var(--border-soft); background: #eef1f2;
}

/* ---------- panel content primitives ---------- */
.section-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); }
.section-label.small { font-size: 9px; }
.section-label.mt { margin-top: 16px; }
.body-text { font-size: 14px; line-height: 1.62; margin: 7px 0 0; }
.body-text.small { font-size: 12.5px; }
.hr { height: 1px; background: var(--border-soft); margin: 16px 0; }

.kvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; font-family: var(--mono); }
.kvgrid .k { font-size: 9.5px; letter-spacing: 0.14em; color: var(--dim); }
.kvgrid .v { font-size: 17px; margin-top: 5px; }
.kvgrid .v.big { font-size: 22px; }
.v.warn { color: var(--warn); }

/* ---------- mission selector ---------- */
.mission-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mission-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1px solid var(--border-soft); background: #fff; border-radius: 3px; padding: 10px 12px;
  font-family: var(--sans); color: var(--text);
}
.mission-row:hover { border-color: var(--accent); }
.mission-row-active { border-color: var(--accent); background: rgba(44,111,122,0.06); }
.mission-row-id { font-family: var(--mono); font-size: 11px; color: var(--dim); flex: none; width: 40px; }
.mission-row-main { flex: 1; display: flex; flex-direction: column; }
.mission-row-title { font-size: 13px; font-weight: 600; }
.mission-row-desc { display: block; font-size: 11.5px; line-height: 1.5; color: var(--dim); margin-top: 3px; }
.mission-row-process { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--dim); margin-top: 4px; display: block; }
.mission-row-status { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--accent); flex: none; }

/* ---------- wafer map ---------- */
.wafer-map-wrap { display: flex; justify-content: center; margin-top: 10px; }

.pathlist { font-size: 13px; line-height: 1.9; padding-left: 18px; margin: 8px 0 0; }

.checklist { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
.checkrow { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-family: var(--mono); font-size: 12px; }
.checkrow .ok { color: var(--accent); }
.checkrow .open { color: var(--faint); }

.callout { margin-top: 16px; padding: 12px; border: 1px solid var(--border); background: #eef1f2; font-size: 14px; }
.callout .section-label { margin-bottom: 6px; }

.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11px; padding: 6px 9px; border: 1px solid var(--border-soft); color: var(--dim); background: none; border-radius: 2px; }
.chip-active { border-color: var(--accent); color: var(--accent); }
.chip-read::after { content: ' ✓'; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-static { cursor: default; }
.chip-static:hover { border-color: var(--border-soft); color: var(--dim); }

.evlist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.evrow { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border-soft); padding: 10px 11px; text-decoration: none; color: var(--text); font-size: 12.5px; gap: 10px; }
.evrow:hover { border-color: var(--accent); }
.ev-tag { font-family: var(--mono); font-size: 10px; color: var(--accent); flex: none; margin-left: 10px; }
.ev-pub { font-family: var(--mono); font-size: 10px; color: var(--dim); }

/* ---------- evidence strength badge ---------- */
.strength-badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 2px; margin-left: 6px; vertical-align: middle; }
.strength-HIGH { background: rgba(44,111,122,0.12); color: var(--accent); }
.strength-MEDIUM { background: rgba(163,118,27,0.12); color: var(--warn); }
.strength-CONTEXTDEPENDENT { background: rgba(109,124,129,0.16); color: var(--dim); }
.strength-def { color: var(--dim); margin-top: 4px; }

/* ---------- check understanding ---------- */
.quiz { margin-top: 10px; padding: 12px; border: 1px solid var(--border-soft); background: #eef1f2; }
.quiz-guidance { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--text); }

/* ---------- counterfactual compare ---------- */
.cf-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-family: var(--mono); font-size: 12px; }
.cf-row select { font-family: var(--mono); font-size: 12px; padding: 6px 8px; border: 1px solid var(--border-soft); background: #fff; color: var(--text); }

.hyp-card { border: 1px solid var(--border-soft); padding: 12px; margin-bottom: 10px; }
.hyp-selected { border-color: var(--accent); }
.hyp-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); }
.hyp-selected .hyp-head { color: var(--accent); }
.hyp-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.hyp-sub { margin-top: 10px; }

.slider-row { margin-top: 12px; }
.slider-label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.slider-val { color: var(--text); }
.slider-row input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--accent); }

.btn { display: inline-block; margin-top: 14px; padding: 10px 16px; background: var(--accent); color: #fff; border: none; border-radius: 3px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-decoration: none; }
.btn:hover { background: #235a63; }
.btn-link { margin-left: 10px; background: none; border: 1px solid var(--border); color: var(--text); }
.btn-link:hover { border-color: var(--accent); color: var(--accent); background: none; }

.result-row { margin-top: 14px; }

.table-scroll { overflow-x: auto; margin-top: 10px; }
.doetable { width: 100%; min-width: 480px; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.doetable th { text-align: left; font-size: 9.5px; letter-spacing: 0.1em; color: var(--dim); border-bottom: 1px solid var(--border); padding-bottom: 8px; padding-right: 14px; font-weight: 400; white-space: nowrap; }
.doetable td { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }

.effect-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-family: var(--mono); font-size: 11px; }
.effect-label { width: 96px; flex: none; }
.effect-track { flex: 1; height: 9px; background: var(--border-soft); }
.effect-fill { display: block; height: 100%; background: var(--accent); }
.effect-val { width: 60px; flex: none; text-align: right; color: var(--dim); }

.ta { width: 100%; min-height: 60px; margin-top: 8px; padding: 9px 10px; border: 1px solid var(--border-soft); font-family: var(--sans); font-size: 13px; color: var(--text); resize: vertical; background: #fff; }
.ta:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.caseout { white-space: pre-wrap; font-family: var(--mono); font-size: 11px; line-height: 1.6; background: #fff; border: 1px solid var(--border-soft); padding: 12px; margin-top: 8px; max-height: 280px; overflow-y: auto; }

/* ---------- Case Sheet — grouped like an engineering record, not a bare form ---------- */
.case-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.case-section:first-of-type { margin-top: 16px; }
.case-section-label { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0.1em; color: var(--accent); margin: 0 0 6px; }
.case-section .ta { margin-top: 6px; }
.case-section .ta + .ta { margin-top: 10px; }

/* ---------- small screens (Phase 6 — mobile) ----------
   Desktop is LEFT (mission/nav) + CENTER (3D) + RIGHT (panel). That does not
   shrink onto a phone — instead: a compact TOP strip (mission id/title/
   current step only, kv-grid and 6-bar progress hidden — full detail is one
   tap away via the existing mission-card→Mission console panel), the 3D
   CENTER gets the rest of the screen, Quick Nav collapses to a one-line
   drawer toggle, and the work panel still takes the full screen when open
   (a phone-width panel has no room to sit "beside" the 3D anyway). */
@media (max-width: 767px) {
  /* topbar's secondary copy ("공정 연구 환경...") wraps to 2-3 lines at this
     width with nothing capping .topbar's height, which used to blow past
     46px and push everything below it down/out of place. SPL identity
     (mark) and current position (room code + name) stay; the descriptive
     subtitle and long room names truncate instead of wrapping. */
  .brand-sub, .brand-sep { display: none; }
  .roomtag span:last-child { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* .hubbtn used to sit at top:60 (below the topbar) to clear the desktop
     side-stack, which is only 264px wide there — but the mobile side-stack
     below is full-width, so top:60 landed ON TOP of the mission card's
     header text. Moving it INTO the topbar's own 46px row (well above
     top:52 where the mobile side-stack starts) clears that collision. */
  .hubbtn { top: 7px; right: 8px; padding: 5px 10px; font-size: 10px; }
  /* Phase 10 (real-device QA): the hub button is position:fixed, outside
     .topbar's own flex flow, so .topbar had no idea it needed to leave
     room for it — the room title (e.g. "02 학습실 (Study Center)") ran
     right underneath. Reserving real space on .topbar's right edge (wider
     than the button itself: ~10px+"← 허브"+10px padding + border + the
     button's own right:8px offset) pushes the flex content left instead of
     just capping its width, so it can never overlap regardless of title
     length or which of E-001/T-001 is active. */
  .topbar { padding-right: 92px; }

  .side-stack { left: 8px; right: 8px; width: auto; top: 52px; max-height: calc(100vh - 66px); }
  .mission-card { padding: 10px 12px 9px; }
  .mc-kv, .mc-steps { display: none; }
  .mc-mobile-flow { display: block; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
  .mc-mobile-flow .flow-steps { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }
  .mc-mobile-flow .hint { margin-top: 6px; }
  .qn-title { padding: 10px 6px; } /* larger touch target than the desktop 4px */
  .qn-item { padding: 7px 8px; } /* tighter than desktop's 9px — see .qn-desc note below */
  /* Real-device QA (Phase 10): each open Quick Nav item showed both its
     label AND its description line, so the full 7-item list on a phone
     screen read as one oversized white panel. The description is a nice-
     to-have, not load-bearing — the label alone ("학습실 (Study)") already
     identifies the room — so drop it here to roughly halve each row's
     height without touching desktop or the collapsed (closed) state, which
     was never the complaint. */
  .qn-desc { display: none; }
  /* Quick Nav collapses to just its title bar by default (JS toggles
     .qn-open on #quickNav — see renderQuickNav()/the qn-toggle handler in
     app.js); desktop never gets this rule so its list always stays visible. */
  .qn-list { display: none; }
  .quicknav.qn-open .qn-list { display: flex; }

  .panel { width: 100vw; }
  .controls-hint-mouse { display: none; }
  .controls-hint-touch { display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); bottom: 8px; }
  /* Real-device QA (Phase 10): the gesture-hint strip is position:fixed at
     the bottom of the whole viewport, so on a phone it sat on top of
     Quick Nav's open room list (both were fixed-position, same z-index —
     DOM order made the hint win). Same pattern as the existing
     .world-fallback rule two rules up: hide it while there's something
     more important on screen to read, bring it back once that closes. */
  body:has(.quicknav.qn-open) .controls-hint { display: none; }

  /* intro card can sit close to the mission bar on a short screen — give it
     a bit less top offset and let it scroll internally rather than clip */
  .intro-card { top: 52px; max-height: calc(100vh - 90px); overflow-y: auto; }

  /* .kvgrid's auto-fit(minmax(84px,1fr)) packs 3-4 columns into the ~354px
     panel width here — fine for short labels/values, but longer ones (e.g.
     Analysis's "우선 검토 조건 — CD") wrap mid-word inside a squeezed
     column. 2 columns gives each one enough room; a 3rd/4th item just wraps
     to its own row instead of fighting for space in a narrow column. */
  .kvgrid { grid-template-columns: repeat(2, 1fr); }

  /* DOE table: both th (response labels like T-001's "평균 두께 (Mean
     Thickness)") and the first td column (RUN_LABEL text like "중앙점 실험
     (Center Point)") are long enough under nowrap to push the table's
     PRIMARY response column past the visible width, forcing a scroll to
     see it — exactly what the primary response is supposed to avoid.
     Letting these two wrap (data cells besides the run label stay nowrap —
     they're short, e.g. "낮음 / 높음") shrinks both columns enough that the
     primary response starts and ends within the visible ~330px, confirmed
     for both missions (E-001's `cd`, T-001's `thickness`, each declared
     first in their `responses[]`). Desktop is untouched (nowrap outside
     this query, plenty of width there anyway). */
  .doetable th { white-space: normal; }
  .doetable td:first-child { white-space: normal; }
}
