:root {
  --bg: #ffffff;
  --surface: #f7f5f0;
  --ink: #1e1b2e;
  --muted: #6c6680;
  --line: #e4dfd4;
  --accent: #c0392b;
  --panel: #f7f4ee;
  --border: #2c283e;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top navigation bar with animated sliding underline tabs */
#top-bar {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  flex-shrink: 0;
}

.brand-mark {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

#scene-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

#scene-switcher {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

#scene-switcher::-webkit-scrollbar {
  display: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.tab-btn {
  position: relative;
  flex-shrink: 0; /* QA-001: tabs scroll sideways on phones instead of shrinking to 44px */
  min-width: 44px;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 160ms ease;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--accent);
  background: transparent;
}

#tab-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  transition: transform 240ms cubic-bezier(0.22, 0.8, 0.28, 1), width 240ms cubic-bezier(0.22, 0.8, 0.28, 1);
  pointer-events: none;
}

/* Main workspace: left control dock + full-bleed viewport diorama stage */
#workspace {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  padding: 0;
  gap: 0;
}

#side-dock {
  width: 214px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  overflow-y: auto;
}

.dock-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.dock-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.dock-btn {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d7d1c4;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.dock-btn:hover:not(:disabled) {
  border-color: var(--border);
  background: #fbfaf7;
}

.dock-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.dock-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.dock-btn.primary:hover {
  background: #a93226;
}

.dock-checklist-section {
  flex: 1;
  min-height: 0;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #e4dfd4;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #2e8b57;
  transition: width 240ms ease;
}

.vocab-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.vocab-chip {
  width: 100%;
  min-height: 36px;
  padding: 5px 8px;
  border: 1px solid #e4dfd4;
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vocab-chip.found {
  color: var(--ink);
  font-weight: 600;
  border-color: #c5decb;
  background: #f3fbf5;
}

.vocab-chip.found:hover {
  border-color: #2e8b57;
}

.vocab-chip:disabled {
  cursor: default;
  opacity: 0.75;
}

/* Diorama Stage: fills 100% of remaining viewport edge-to-edge without padding, border, or white margins */
#stage-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #141422;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  padding: 0;
}

#stage-anim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: transform, opacity;
  transition: transform 240ms cubic-bezier(0.22, 0.8, 0.28, 1), opacity 200ms ease;
}

#stage-anim.exit-left {
  transform: translateX(-44px) scale(0.97);
  opacity: 0;
}

#stage-anim.exit-right {
  transform: translateX(44px) scale(0.97);
  opacity: 0;
}

#stage-anim.enter-from-right {
  transform: translateX(44px) scale(0.97);
  opacity: 0;
  transition: none;
}

#stage-anim.enter-from-left {
  transform: translateX(-44px) scale(0.97);
  opacity: 0;
  transition: none;
}

#scene-transit-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(30, 27, 46, 0.9);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

#zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d5cfc2;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(30, 27, 46, 0.08);
  overflow: hidden;
}

.zoom-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid #ebe7de;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:last-child {
  border-right: 0;
}

.zoom-btn.zoom-level {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  min-width: 54px;
  color: var(--muted);
}

.zoom-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
}

.zoom-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: grab;
  outline: none;
}

#game-canvas.dragging {
  cursor: grabbing;
}

.file-warning {
  width: calc(100% - 36px);
  max-width: 720px;
  margin: 8px auto 0;
  padding: 10px 12px;
  border: 2px solid #b7791f;
  background: #fff3cd;
  color: var(--ink);
  font-size: 0.9rem;
}

/* Bottom bar: centered/left hint + subtle clickable About text on bottom right */
#bottom-bar {
  width: 100%;
  padding: 2px 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.explore-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.about-link {
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.about-link:hover,
.about-link:focus-visible {
  color: var(--ink);
}

/* Responsive phone / narrow layout (<= 760px) */
@media (max-width: 760px) {
  #app {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }
  #top-bar {
    padding: 4px 12px 0;
    gap: 4px;
  }
  #workspace {
    flex-direction: column-reverse;
    padding: 0;
    gap: 0;
  }
  #side-dock {
    width: 100%;
    padding: 10px;
    gap: 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow-y: visible;
  }
  .dock-section {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .dock-label {
    width: 100%;
  }
  .dock-btn {
    width: auto;
    flex: 1 1 130px;
  }
  .dock-checklist-section {
    flex-direction: column;
    align-items: stretch;
  }
  .vocab-checklist {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
  .vocab-chip {
    width: auto;
    flex: 1 1 110px;
  }
  #stage-wrap {
    width: 100%;
    height: 52dvh;
    min-height: 300px;
    flex: none;
    padding: 0;
  }
  #zoom-controls {
    top: 8px;
    right: 8px;
  }
  #bottom-bar {
    padding: 2px 12px 10px;
  }
}

/* Popup buttons & controls inside #dialogue-box */
#dialogue-box button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-weight: 600;
  border-radius: 6px;
}

#dialogue-box button.active {
  background: var(--accent);
  color: #ffffff;
}

#dialogue-box button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Popup: vocab card, dialogue, flashcards, quiz and About float over the scene */
#panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 18, 34, 0.38);
}

#panel-backdrop[hidden] {
  display: none;
}

#dialogue-box {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 14px 16px;
  border: 3px solid var(--border);
  background: var(--panel);
  box-shadow: 6px 6px 0 rgba(30, 27, 46, 0.85);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: popup-in 120ms steps(3, end);
}

@keyframes popup-in {
  from { transform: translate(-50%, -46%); opacity: 0; }
  to { transform: translate(-50%, -50%); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #dialogue-box { animation: none; }
  #tab-indicator { transition: none; }
  #stage-anim { transition: none; }
}

#dialogue-box[hidden] {
  display: none;
}

.panel-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: #544e68;
  border-bottom: 1px solid #d5cfc2;
  padding-bottom: 4px;
}

.vocab-hanzi,
.dialogue-line-zh,
.quiz-prompt {
  font-size: 1.5rem;
  font-weight: 700;
}

.line-pinyin {
  font-size: 1rem;
  color: #3a3452;
}

.line-zhuyin {
  font-size: 0.95rem;
  color: #635b7d;
}

.vocab-en,
.dialogue-line-en {
  font-size: 1.05rem;
  font-weight: 600;
}

.vocab-example {
  padding: 8px 10px;
  background: #ffffff;
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.choice-btn {
  text-align: left;
  width: 100%;
}

.choice-btn.correct-choice {
  background: #d4edda;
  border-color: #1e7e34;
}

.choice-btn.wrong-choice {
  background: #f8d7da;
  border-color: #bd2130;
}

.dialogue-feedback,
.quiz-feedback {
  font-weight: 700;
  padding: 4px 8px;
}

.dialogue-feedback.correct,
.quiz-feedback.correct {
  color: #1e7e34;
}

.dialogue-feedback.wrong,
.quiz-feedback.wrong {
  color: #bd2130;
}

.panel-actions,
.listen-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.voice-note {
  font-size: 0.85rem;
  color: #856404;
  background: #fff3cd;
  padding: 4px 8px;
  border: 1px solid #ffeeba;
}


/* ===== Pixel theme for the left dock (added; overrides earlier dock rules) ===== */
#side-dock {
  --px-bg: #1d1b33;
  --px-panel: #2a2850;
  --px-hi: #5f5aa6;
  --px-lo: #15132a;
  --px-gold: #f2c14e;
  --px-green: #4cd964;
  --px-text: #f4f0e6;
  --px-dim: #9a96c8;
  background-color: var(--px-bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 2px, transparent 2px);
  background-size: 8px 8px;
  border-right: 4px solid var(--px-lo);
  box-shadow: inset -2px 0 0 var(--px-hi);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", "PingFang TC", "Noto Sans TC", monospace;
  color: var(--px-text);
  image-rendering: pixelated;
  gap: 12px;
  overflow-y: hidden;
}

#side-dock .dock-label {
  color: var(--px-gold);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-shadow: 2px 2px 0 var(--px-lo);
}

#side-dock .dock-btn {
  border: 0;
  border-radius: 0;
  background: var(--px-panel);
  color: var(--px-text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 44px; /* QA-011 (was 40px) */
  padding: 6px 10px;
  transition: none;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
  box-shadow: inset 3px 3px 0 var(--px-hi), inset -3px -3px 0 var(--px-lo);
}

#side-dock .dock-btn:hover:not(:disabled) {
  background: #34316a;
  border: 0;
  color: #ffffff;
}

#side-dock .dock-btn:active:not(:disabled) {
  box-shadow: inset 3px 3px 0 var(--px-lo), inset -3px -3px 0 var(--px-hi);
  padding-top: 8px;
  padding-bottom: 4px;
}

#side-dock .dock-btn.active {
  background: #2f7d4b;
  color: #eafff0;
  border: 0;
  box-shadow: inset 3px 3px 0 #58c27d, inset -3px -3px 0 #1a4a2c;
}

#side-dock .dock-btn:focus-visible {
  outline: 2px solid var(--px-gold);
  outline-offset: -4px;
}

#side-dock .dock-label-row strong {
  color: var(--px-gold);
  font-size: 0.8rem;
  text-shadow: 2px 2px 0 var(--px-lo);
}

#side-dock .progress-track {
  height: 14px;
  border-radius: 0;
  background: var(--px-lo);
  box-shadow: inset 0 0 0 2px var(--px-hi);
  padding: 3px;
}

#side-dock .progress-fill {
  height: 100%;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, var(--px-green) 0 6px, #2f9e44 6px 8px);
  transition: none;
}

/* Checklist fills the remaining height and scrolls, so no chip is ever cut in half */
#side-dock .dock-checklist-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#side-dock .vocab-checklist {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 2px 4px 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--px-hi) var(--px-lo);
}

#side-dock .vocab-checklist::-webkit-scrollbar { width: 8px; }
#side-dock .vocab-checklist::-webkit-scrollbar-track { background: var(--px-lo); }
#side-dock .vocab-checklist::-webkit-scrollbar-thumb { background: var(--px-hi); }

#side-dock .vocab-chip {
  flex: 0 0 auto;
  min-height: 44px; /* QA-011 (was 34px) */
  border: 0;
  border-radius: 0;
  background: var(--px-panel);
  color: var(--px-dim);
  font-family: inherit;
  font-size: 0.74rem;
  box-shadow: inset 0 0 0 2px var(--px-lo);
}

#side-dock .vocab-chip.found {
  background: #1f3a2c;
  color: #eafff0;
  box-shadow: inset 0 0 0 2px #2f9e44;
}

#side-dock .vocab-chip.found:hover {
  background: #28503a;
  box-shadow: inset 0 0 0 2px var(--px-green);
}

/* Popup legend note */
#side-dock .legend-box[hidden] { display: none; }

#side-dock .legend-box {
  background: var(--px-lo);
  box-shadow: inset 0 0 0 2px var(--px-hi);
  padding: 8px 8px 10px;
  gap: 8px;
}

#side-dock .legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--px-text);
}

#side-dock .legend-row canvas {
  flex: 0 0 auto;
  image-rendering: pixelated;
}

@media (max-width: 760px) {
  #side-dock { overflow-y: visible; }
  #side-dock .vocab-checklist { max-height: none; }
}

/* Checklist is a framed scroll window with a soft fade at the bottom, so a cut chip never looks like a broken border */
#side-dock .vocab-checklist {
  padding: 6px 6px 18px;
  background: var(--px-lo);
  box-shadow: inset 0 0 0 2px var(--px-hi);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
}

/* Floor badge for multi-floor indoor scenes */
#floor-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: stretch;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #1d1b33;
  color: #f4f0e6;
  box-shadow: inset 0 0 0 3px #5f5aa6, 3px 3px 0 #15132a;
  image-rendering: pixelated;
}
#floor-badge[hidden] { display: none; }
#floor-badge b { background: #f2c14e; color: #1d1b33; font-size: 1.4rem; padding: 6px 12px; display: flex; align-items: center; }
#floor-badge span { padding: 6px 12px; font-size: 0.8rem; display: flex; align-items: center; }

/* ===== MRT network map modal ===== */
#mrt-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 12, 30, 0.72);
  padding: 16px;
}
#mrt-modal .mrt-card {
  width: min(1100px, 100%);
  height: min(860px, 100%);
  display: flex;
  flex-direction: column;
  background: #1d1b33;
  color: #f4f0e6;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "PingFang TC", "Noto Sans TC", monospace;
  box-shadow: inset 0 0 0 4px #5f5aa6, 6px 6px 0 #0c0b1a;
}
#mrt-modal .mrt-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #2a2850; }
#mrt-modal .mrt-head strong { font-size: 1.05rem; color: #f2c14e; }
#mrt-modal .mrt-head span { opacity: 0.7; margin-left: 8px; font-size: 0.8rem; }
#mrt-modal .mrt-x, #mrt-modal .mrt-zoom button, #mrt-modal .mrt-say {
  min-width: 44px; min-height: 44px; border: 0; background: #34316a; color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: inset 3px 3px 0 #5f5aa6, inset -3px -3px 0 #15132a;
}
#mrt-modal .mrt-tools { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
#mrt-modal .mrt-chips { display: flex; gap: 6px; flex-wrap: wrap; }
#mrt-modal .mrt-chip {
  min-height: 44px; padding: 4px 10px; border: 0; background: #2a2850; color: #f4f0e6; font: inherit; font-size: 0.78rem; text-align: left; cursor: pointer;
  border-left: 8px solid var(--c); display: flex; flex-direction: column; justify-content: center;
}
#mrt-modal .mrt-chip small { opacity: 0.65; font-size: 0.62rem; }
#mrt-modal .mrt-chip.on { background: var(--c); color: #111; }
#mrt-modal .mrt-zoom { display: flex; gap: 6px; }
#mrt-modal .mrt-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; background: #f4efe2; margin: 0 12px; touch-action: none; cursor: grab; }
#mrt-modal .mrt-svg { display: block; }
#mrt-modal .mrt-lbl { font: 600 15px "PingFang TC", "Noto Sans TC", sans-serif; fill: #2a2736; opacity: 0; paint-order: stroke; stroke: #f4efe2; stroke-width: 4px; pointer-events: none; }
#mrt-modal.mrt-detail .mrt-lbl, #mrt-modal .mrt-lbl.major { opacity: 1; }
#mrt-modal .mrt-lbl.major { font-size: 17px; font-weight: 800; }
#mrt-modal .mrt-st { cursor: pointer; }
#mrt-modal .mrt-st:hover .mrt-lbl, #mrt-modal .mrt-st.sel .mrt-lbl { opacity: 1; fill: #c4002c; }
#mrt-modal .mrt-st.sel circle, #mrt-modal .mrt-st.sel rect:first-of-type { stroke: #ff3366; }
#mrt-modal .mrt-line.dim, #mrt-modal .mrt-st.dim { opacity: 0.18; }
#mrt-modal .mrt-here { animation: mrt-pulse 1.2s steps(2) infinite; }
@keyframes mrt-pulse { 50% { opacity: 0.25; } }
#mrt-modal .mrt-info { padding: 10px 14px; min-height: 64px; display: flex; align-items: center; }
#mrt-modal .mrt-hint { opacity: 0.75; font-size: 0.78rem; }
#mrt-modal .mrt-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#mrt-modal .mrt-pick i { font-style: normal; color: #fff; font-size: 0.72rem; font-weight: 800; padding: 2px 6px; }
#mrt-modal .mrt-pick b { font-size: 1.3rem; color: #f2c14e; }
#mrt-modal .mrt-pick .py { font-size: 0.95rem; }
#mrt-modal .mrt-pick .en { opacity: 0.7; font-size: 0.85rem; }
@media (max-width: 640px) { #mrt-modal { padding: 0; } #mrt-modal .mrt-card { height: 100%; } }

/* MRT map: landmark picture beside the station info */
#mrt-modal .mrt-info { min-height: 0; flex: 0 0 auto; }
#mrt-modal .mrt-pickwrap { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; width: 100%; }
#mrt-modal .mrt-pic { width: 300px; max-width: 100%; height: auto; image-rendering: pixelated; box-shadow: 0 0 0 3px #5f5aa6; background: #15132a; }
#mrt-modal .mrt-pickwrap .mrt-pick { flex: 1 1 260px; }
#mrt-modal .mrt-near { flex: 1 1 100%; display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 8px; border-top: 2px solid #2a2850; }
#mrt-modal .mrt-near small { opacity: 0.65; font-size: 0.68rem; }
#mrt-modal .mrt-near b { font-size: 1.15rem; color: #7fe3a8; }
#mrt-modal .mrt-say2 { align-self: flex-start; min-width: 44px; min-height: 44px; border: 0; background: #34316a; color: #fff; cursor: pointer; box-shadow: inset 3px 3px 0 #5f5aa6, inset -3px -3px 0 #15132a; }
#mrt-modal .mrt-note { opacity: 0.5; }
#mrt-modal .mrt-card { height: min(900px, 100%); }
#mrt-modal .mrt-scroll { min-height: 160px; }

#mrt-modal .mrt-pic { width: 260px; }
#mrt-modal .mrt-pick .mrt-say { min-height: 44px; }

/* QA-010 / QA-006 (2026-11-22): phone layout. The dock scrolls inside its own box so the bottom bar stays near the fold,
   and the MRT info card becomes compact so the map keeps most of the height. Later rule, same specificity: wins over the older 760px blocks. */
@media (max-width: 760px) {
  #stage-wrap { height: 46dvh; min-height: 260px; }
  #side-dock {
    max-height: 34dvh;
    overflow-y: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  #side-dock .vocab-checklist { max-height: none; }
  #bottom-bar { flex-shrink: 0; }
  #mrt-modal .mrt-info { max-height: 195px; overflow-y: auto; padding: 8px 10px; }
  #mrt-modal .mrt-pickwrap { gap: 8px; }
  #mrt-modal .mrt-pic { width: 120px; height: 87px; flex-shrink: 0; }
  #mrt-modal .mrt-pickwrap .mrt-pick { flex: 1 1 150px; min-width: 0; }
  #mrt-modal .mrt-head { padding: 8px 12px; }
  #mrt-modal .mrt-tools { flex-wrap: nowrap; padding: 6px 10px; }
  #mrt-modal .mrt-chips { gap: 4px; flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #mrt-modal .mrt-chips .mrt-chip { flex: 0 0 auto; }
  #mrt-modal .mrt-zoom { flex: 0 0 auto; }
  #mrt-modal .mrt-scroll { min-height: 240px; }
}
