:root {
  --bg-glass: rgba(16, 26, 38, 0.86);
  --bg-glass-light: rgba(24, 38, 54, 0.92);
  --border-line: rgba(255, 255, 255, 0.14);
  --text-main: #F4F6F8;
  --text-muted: #9EB1C4;
  --accent-gold: #FFD23F;
  --accent-blue: #3898EC;
  --accent-green: #58C98B;
  --accent-coral: #FF6B5B;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-lg: 0 12px 32px rgba(5, 12, 20, 0.45);
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: #0F1A26;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  /* 地圖類全螢幕介面：只允許面板捲動，停用瀏覽器雙指縮放整頁 (縮放交給 3D 地圖手勢) */
  touch-action: pan-x pan-y;
}

#appContainer {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
}

#campusCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#campusCanvas:active {
  cursor: grabbing;
}

/* 3D 浮動標籤層 */
#labelsOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

/* 從標籤上開始的觸控交給地圖手勢處理 (見 app.js beginPointer) */
#labelsOverlay > * {
  touch-action: none;
}

/* 標籤避讓：與較重要標籤重疊時淡出 (見 app.js resolveLabelOverlaps) */
.b-label,
.road-label,
.cardinal-label {
  transition: opacity 0.18s ease, background 0.15s, border-color 0.15s;
}

.label-occluded {
  opacity: 0 !important;
  pointer-events: none !important;
}

.b-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 24, 34, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s;
  will-change: transform;
}

.b-label:hover,
.b-label.selected {
  background: #FFD23F;
  color: #141B24;
  border-color: #FFFFFF;
  z-index: 10;
}

.b-label .b-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3898EC;
}

.b-label.cat-landmark .b-dot { background: #FFD23F; }
.b-label.cat-admin .b-dot { background: #64B5F6; }
.b-label.cat-teaching .b-dot { background: #58C98B; }
.b-label.cat-tech .b-dot { background: #FF8A5B; }
.b-label.cat-sport .b-dot { background: #BA68C8; }
.b-label.cat-eco .b-dot { background: #4DD0E1; }

.b-label .b-fl {
  font-size: 10.5px;
  opacity: 0.78;
  padding-left: 2px;
}

/* 單層教室浮動標籤（已移除每間教室重複的樓層前綴，版面更輕巧乾淨） */
.r-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.95);
  color: #121E2B;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.22);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  white-space: nowrap;
  z-index: 5;
  transition: transform 0.14s ease, background 0.14s ease;
}

.r-label.active,
.r-label:hover {
  background: #FFD23F;
  color: #101820;
  font-weight: 800;
  border-color: #101820;
  transform: scale(1.08);
  z-index: 12;
}

.r-label .r-fl {
  display: none; /* 已改為每棟大樓每層僅標示單一 1F/2F/3F 指標，隱藏個別教室重複前綴 */
}

/* 整體大樓各樓層獨立指標標籤 (1F、2F、3F... 整層樓僅標示一個，清楚醒目) */
.fl-marker-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #1B2A3A;
  color: #FFD23F;
  font-size: 12px;
  font-weight: 800;
  border: 1.5px solid #FFD23F;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  white-space: nowrap;
  z-index: 10;
  transition: transform 0.16s ease, background 0.16s ease;
}

.fl-marker-label:hover,
.fl-marker-label.active {
  background: #FFD23F;
  color: #101820;
  border-color: #FFFFFF;
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(255, 210, 63, 0.6);
}

.fl-marker-label span {
  letter-spacing: 0.5px;
}

/* 周邊外部道路路名牌標籤 (台灣綠底白字路牌風格) */
.road-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(18, 104, 72, 0.92);
  border: 1.5px solid #F2F5F4;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.road-label.primary {
  background: rgba(15, 86, 138, 0.94);
  border-color: #FFD23F;
  font-size: 12.5px;
}

.dir-hint {
  font-size: 11.5px;
  color: #B6D7F5;
  background: rgba(56, 152, 236, 0.12);
  border: 1px solid rgba(56, 152, 236, 0.28);
  border-radius: 7px;
  padding: 5px 9px;
  margin-bottom: 8px;
}

/* 頂部導覽列 */
#topHeader {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  z-index: 15;
  pointer-events: none;
}

#topHeader > * {
  pointer-events: auto;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 15px 8px 11px;
}

.school-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
  flex: none;
  display: block;
}

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-text small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 搜尋框與結果下拉 */
.search-box {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 44px;
}

.search-input-wrap input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  padding-left: 8px;
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.quick-chip {
  border: 1px solid var(--border-line);
  background: rgba(16, 26, 38, 0.78);
  color: #DCE6F0;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
  cursor: pointer;
}

.quick-chip:hover {
  background: var(--accent-gold);
  color: #121A24;
  border-color: var(--accent-gold);
}

#searchResults {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
  z-index: 30;
}

#searchResults li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}

#searchResults li:hover {
  background: rgba(255, 255, 255, 0.12);
}

.s-badge {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.s-badge.building { background: rgba(56, 152, 236, 0.25); color: #7CC4FA; }
.s-badge.room { background: rgba(88, 201, 139, 0.25); color: #7CE8AC; }

.s-info {
  flex: 1;
  min-width: 0;
}

.s-info b {
  display: block;
  font-size: 13.5px;
}

.s-info small {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s-go {
  font-size: 12px;
  color: var(--accent-gold);
  font-weight: 700;
}

/* 頂部右側工具群：視覺風格＆精選導覽 */
.top-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.seg-group {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
}

.seg-group button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.seg-group button.active,
.seg-group button:hover {
  background: var(--accent-gold);
  color: #141C24;
}

/* 分區快速切換列 */
#zoneBar {
  position: absolute;
  left: 14px;
  top: 102px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  z-index: 12;
}

.zone-btn {
  border: 0;
  background: transparent;
  color: #DCE6F0;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.zone-btn:hover,
.zone-btn.active {
  background: rgba(255, 210, 63, 0.2);
  color: var(--accent-gold);
  border-left: 3px solid var(--accent-gold);
}

/* 左側路線導航與任務導覽小面板 (往上移至頂端) */
#leftNavBox {
  position: absolute;
  left: 14px;
  top: 86px;
  width: 250px;
  padding: 12px 14px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#leftNavBox h3 {
  margin: 0;
  font-size: 13px;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.nav-select-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.nav-select-row select {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-line);
  border-radius: 7px;
  padding: 5px 6px;
  font-size: 12px;
}

.nav-select-row select option {
  background: #14202E;
  color: #FFF;
}

.tour-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-line);
}

.tour-btn {
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.tour-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(255, 210, 63, 0.15);
}

/* 右下角：樓層剖面切換器 */
#floorSwitcher {
  position: absolute;
  right: 16px;
  bottom: 48px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 4px;
  z-index: 12;
}

#floorSwitcher .fl-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0;
}

#floorSwitcher button {
  border: 0;
  background: transparent;
  color: var(--text-main);
  width: 48px;
  height: 36px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
}

#floorSwitcher button.active,
#floorSwitcher button:hover {
  background: var(--accent-gold);
  color: #141C24;
}

/* 右側建築與教室詳情抽屜 */
#detailDrawer {
  position: absolute;
  right: 76px;
  top: 76px;
  bottom: 52px;
  width: min(410px, calc(100vw - 96px));
  padding: 16px;
  overflow-y: auto;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.drawer-head h2 {
  margin: 5px 0 2px;
  font-size: 20px;
  font-weight: 900;
}

.en-sub {
  color: var(--text-muted);
  font-size: 11.5px;
}

.cat-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 210, 63, 0.2);
  color: var(--accent-gold);
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drawer-action-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.drawer-action-btn:hover {
  background: rgba(255, 210, 63, 0.25);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(244, 67, 54, 0.25);
  border-color: #F44336;
  color: #FF8A80;
}

.floating-reopen-pill {
  position: absolute;
  right: 76px;
  bottom: 56px;
  z-index: 21;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--accent-gold);
  background: rgba(20, 28, 36, 0.92);
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 210, 63, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-reopen-pill:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--accent-gold);
  color: #141C24;
  box-shadow: 0 10px 28px rgba(255, 210, 63, 0.45);
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px;
}

.photo-thumb {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  aspect-ratio: 16 / 10;
  cursor: pointer;
  background: #0B131C;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}

.photo-thumb:hover img {
  transform: scale(1.06);
}

.photo-thumb span {
  position: absolute;
  right: 6px;
  bottom: 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #FFF;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
}

.b-summary {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #DCE5EE;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ft-tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(56, 152, 236, 0.16);
  border: 1px solid rgba(56, 152, 236, 0.35);
  color: #9AD1FF;
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.act-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.act-btn.pri {
  background: var(--accent-gold);
  color: #141C24;
  border-color: var(--accent-gold);
}

.act-btn.deselect-btn {
  flex: 0 0 auto;
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.15);
}

.act-btn.deselect-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: #F44336;
  color: #FF8A80;
}

.floors-section {
  border-top: 1px solid var(--border-line);
  padding-top: 10px;
}

.sec-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
}

.reset-fl-btn {
  border: 1px solid var(--border-line);
  background: transparent;
  color: var(--accent-gold);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}

.floors-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.floor-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
}

.floor-row.active-fl {
  border-color: var(--accent-gold);
  background: rgba(255, 210, 63, 0.1);
}

.fl-badge {
  width: 38px;
  border: 0;
  border-radius: 6px;
  background: #243447;
  color: var(--accent-gold);
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  flex: none;
}

.fl-rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}

.rm-chip {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.rm-chip.rtype-class1 { border-left: 3px solid #58B957; }
.rm-chip.rtype-class2 { border-left: 3px solid #4CC3D9; }
.rm-chip.rtype-class3 { border-left: 3px solid #F2D03B; }
.rm-chip.rtype-lab { border-left: 3px solid #E08A4B; }
.rm-chip.rtype-office { border-left: 3px solid #8E9AAF; }

.rm-chip:hover,
.rm-chip.sel {
  background: var(--accent-gold);
  color: #121A24;
  font-weight: 800;
}

/* 左下角小地圖 */
#minimapBox {
  position: absolute;
  left: 14px;
  bottom: 44px;
  width: 146px;
  height: 175px;
  padding: 6px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#minimapBox span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
}

#minimapCanvas {
  width: 100%;
  flex: 1;
  border-radius: 8px;
  display: block;
}

/* 底部中央：導航狀態與任務導覽播放器 */
#navStatusBar,
#tourPlayerBar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 48px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 18;
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-actions .act-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
  padding: 7px 11px;
}

.nav-walk-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.nav-walk-progress-inner {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold, #FFD23F), #FF9F1C);
  border-radius: 2px;
  transition: width 0.1s linear;
}

#tourPlayerBar {
  bottom: 112px;
  border-color: var(--accent-gold);
}

.nav-info b,
.tour-info b {
  display: block;
  font-size: 14px;
  color: var(--accent-gold);
}

.nav-info small,
.tour-info small {
  display: block;
  font-size: 12px;
  color: #DCE6F0;
  margin-top: 2px;
}

/* 實景照片放大燈箱 */
#photoModal {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 18, 0.88);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-inner {
  max-width: min(1024px, 94vw);
  max-height: 88vh;
  background: #14202E;
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-inner img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

/* 頁尾資訊列 */
#campusFooter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  background: rgba(11, 18, 26, 0.88);
  border-top: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  z-index: 14;
}

#campusToast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: #FFD23F;
  color: #101820;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 90;
}

#campusToast.show {
  opacity: 1;
}

/* 頂部功能按鈕 (地面漫步、特色學程) */
.mode-pill-btn {
  border: 1px solid var(--border-line);
  color: var(--text-main);
  padding: 0 14px;
  height: 38px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mode-pill-btn:hover,
.mode-pill-btn.active {
  background: var(--accent-gold);
  color: #141C24;
  border-color: var(--accent-gold);
}

.mode-pill-btn.pri-pill {
  border-color: rgba(255, 210, 63, 0.65);
  color: var(--accent-gold);
}

/* 滑鼠移上、啟用中或下拉選單展開時：金底深色字 (需寫在 .pri-pill 之後，否則金色文字會蓋過而看不見) */
.mode-pill-btn.pri-pill:hover,
.mode-pill-btn.pri-pill.active,
.dropdown-toggle[aria-expanded="true"] {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #141C24;
}

/* 右上角：3D 動態方位羅盤指北針 + 視角平移控制盤 */
#compassBox {
  position: absolute;
  right: 16px;
  top: 72px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 15;
}

.mouse-mode-switch {
  display: flex;
  gap: 4px;
  width: 100%;
  background: rgba(8, 14, 22, 0.65);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.m-mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: #CBD8E6;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.m-mode-btn.active,
.m-mode-btn:hover {
  background: var(--accent-gold);
  color: #121A24;
}

.pan-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 28px);
  gap: 4px;
  margin-top: 2px;
}

.pan-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  user-select: none;
}

.pan-btn:hover {
  background: var(--accent-gold);
  color: #121A24;
  border-color: var(--accent-gold);
}

.pan-btn.home {
  background: rgba(255, 210, 63, 0.2);
  border-color: rgba(255, 210, 63, 0.6);
}

#compassResetBtn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle, rgba(28, 44, 62, 0.95) 0%, rgba(12, 20, 30, 0.98) 100%);
  cursor: pointer;
  padding: 0;
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
}

#compassResetBtn:hover {
  border-color: var(--accent-gold);
}

#compassDial {
  position: relative;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.c-dir {
  position: absolute;
  font-size: 10px;
  font-weight: 900;
  color: #B8C7D6;
  line-height: 1;
}

.c-dir.c-n {
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #FF595E;
  font-size: 11px;
}

.c-dir.c-s {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.c-dir.c-e {
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.c-dir.c-w {
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.c-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 34px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
}

.c-needle .n-red {
  flex: 1;
  background: #FF595E;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.c-needle .s-white {
  flex: 1;
  background: #DCE4EC;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

.compass-caption {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
}

/* 3D 場景邊界東西南北方位大標籤 */
.cardinal-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(12, 20, 30, 0.88);
  border: 2px solid var(--accent-gold);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  z-index: 3;
}

.cardinal-label small {
  font-weight: 600;
  color: #CBD8E6;
  font-size: 11px;
}

/* 專門學程與科館亮點抽屜 */
#programsDrawer {
  position: absolute;
  right: 76px;
  top: 76px;
  bottom: 52px;
  width: min(440px, calc(100vw - 96px));
  padding: 16px;
  overflow-y: auto;
  z-index: 21;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.programs-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prog-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-line);
  border-left: 4px solid var(--accent-gold);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.prog-card:hover,
.prog-card.active {
  background: rgba(255, 210, 63, 0.13);
  border-color: var(--accent-gold);
}

.prog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.prog-head b {
  font-size: 14.5px;
  color: #FFF;
}

.prog-head span {
  font-size: 11.5px;
  color: var(--accent-gold);
  font-weight: 700;
}

.prog-desc {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #D2DCE6;
}

.prog-labs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.prog-lab-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  color: #E8F0F8;
}

/* 第一人稱地面實境漫步控制列 */
#walkHudBar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 44px;
  padding: 12px 16px;
  width: min(680px, calc(100vw - 28px));
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: var(--accent-gold);
}

.walk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.walk-head b {
  display: block;
  font-size: 14px;
  color: var(--accent-gold);
}

.walk-char-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.char-chip {
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.char-chip:hover {
  background: rgba(255, 210, 63, 0.2);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.char-chip.active {
  background: var(--accent-gold);
  color: #141C24;
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(255, 210, 63, 0.4);
}

.char-chip.view-chip {
  border-color: #3898EC;
  color: #9AD1FF;
}

.char-chip.view-chip.active {
  background: #2575C0;
  color: #FFF;
  border-color: #58A6FF;
  box-shadow: 0 0 10px rgba(56, 152, 236, 0.4);
}

.hud-sub-sep {
  color: var(--border-line);
  font-size: 12px;
  margin: 0 2px;
}

/* 復古遊戲像素風格 (原生高解析度銳利體素渲染) */
#walkHudBar.minimized {
  padding: 8px 18px;
  bottom: 14px;
  width: auto;
  min-width: 0;
  max-width: 95vw;
  border-radius: 999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(14, 22, 32, 0.88);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#walkHudBar.minimized .walk-controls-row,
#walkHudBar.minimized #walkStatusTxt {
  display: none !important;
}

#walkHudBar.minimized .walk-head {
  margin-bottom: 0;
  gap: 12px;
}

body.theme-pixel {
  --accent-gold: #00FFCC;
  --accent-secondary: #FF0055;
}

body.theme-pixel .glass-card {
  border-color: rgba(0, 255, 204, 0.4);
  box-shadow: 0 0 16px rgba(0, 255, 204, 0.15);
}

body.theme-pixel #themeSwitcher button.active {
  background: #00FFCC;
  color: #0E1620;
  text-shadow: none;
  font-weight: 900;
}

/* 微縮積木世界風格 */
body.theme-brick {
  --accent-gold: #FF3B30;
  --accent-secondary: #007AFF;
}

body.theme-brick .glass-card {
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.2);
}

body.theme-brick #themeSwitcher button.active {
  background: #FFCC00;
  color: #141C24;
  font-weight: 900;
}

.walk-head small {
  display: block;
  font-size: 11.5px;
  color: #D0DCE8;
  margin-top: 2px;
}

.walk-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.walk-dpad {
  display: inline-flex;
  gap: 6px;
}

.w-btn {
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.1);
  color: #FFF;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.w-btn.pri,
.w-btn:hover {
  background: var(--accent-gold);
  color: #141C24;
  border-color: var(--accent-gold);
}

.walk-spawns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.spawn-chip {
  border: 1px solid var(--border-line);
  background: rgba(255, 255, 255, 0.07);
  color: #DCE6F0;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.spawn-chip:hover,
.spawn-chip.active {
  background: #3898EC;
  color: #FFF;
  border-color: #7CC4FA;
}

/* 版權聲明彈窗與頁尾連結 */
#copyrightModal {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 18, 0.85);
  z-index: 105;
  display: grid;
  place-items: center;
  padding: 20px;
}

.copy-modal-box {
  max-width: 580px;
  width: 100%;
  padding: 18px 20px;
  gap: 12px;
}

.copy-body {
  font-size: 13px;
  line-height: 1.65;
  color: #DCE6F0;
}

.copy-body p {
  margin: 0 0 8px;
}

.copy-body a {
  color: var(--accent-gold);
}

/* 版權說明文字可選取複製 (整體介面預設不可選取，避免拖曳地圖時誤選文字) */
#copyrightModal,
#copyrightModal * {
  user-select: text;
  -webkit-user-select: text;
}

#copyrightModal .modal-inner {
  cursor: auto;
}

/* 頁尾的學校與 OpenStreetMap 連結 */
.footer-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: var(--accent-gold);
  text-decoration-color: var(--accent-gold);
}

.copy-link-btn {
  border: 0;
  background: rgba(255, 210, 63, 0.16);
  color: var(--accent-gold);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.copy-link-btn:hover {
  background: var(--accent-gold);
  color: #141C24;
}

/* 頂部下拉選單 (瀏覽功能、視覺風格) */
#topHeader {
  z-index: 25; /* 展開的選單要蓋過右上角羅盤 */
}

.dropdown {
  position: relative;
}

.dropdown-toggle .caret {
  font-size: 10px;
  opacity: 0.8;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}

.dropdown-item {
  border: 0;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.dropdown-item small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dropdown-item.active {
  background: var(--accent-gold);
  color: #141C24;
}

.dropdown-item.active small {
  color: rgba(20, 28, 36, 0.7);
}

/* 面板標題列 (標題＋關閉鈕) */
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* 僅在精簡版面 (手機／平板) 顯示的元件 */
.compact-only,
#moreSheet,
#walkJoystick,
.hint-touch {
  display: none;
}

/* 觸控操作說明 */
#gestureHint {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 12, 18, 0.62);
}

.gesture-card {
  width: 100%;
  max-width: 340px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gesture-card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--accent-gold);
}

.gesture-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #DCE6F0;
}

.gesture-card .act-btn {
  padding: 10px 12px;
  font-size: 14px;
}

/* 載入畫面 (第一幀畫出後淡出；錯誤時改顯示說明) */
#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, #1C2C3E 0%, #0F1A26 70%);
  transition: opacity 0.45s ease;
}

#loadingScreen.done {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #FFFFFF;
  object-fit: contain;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.loading-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-gold);
  animation: loading-spin 0.9s linear infinite;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

#loadingMsg {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.6;
}

#loadingScreen.error .loading-spinner {
  display: none;
}

#loadingScreen.error #loadingMsg b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--accent-gold);
}

/* 觸控裝置：滑鼠專用控制 (左鍵模式切換、十字平移盤) 改以手勢取代 */
@media (hover: none) and (pointer: coarse) {
  .mouse-mode-switch,
  .pan-dpad-grid {
    display: none;
  }
  .hint-mouse {
    display: none;
  }
  .hint-touch {
    display: inline;
  }
}

/* ================= 精簡版面：手機、平板直向、手機橫向 =================
   斷點需與 app.js 的 compactQuery 一致 */
@media (max-width: 900px), (max-height: 520px) {
  :root {
    --dock-h: 58px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
  }

  body.walk-active {
    --dock-h: 0px;
  }

  #zoneBar, #minimapBox, #campusFooter, .top-tools {
    display: none;
  }

  /* 頂部：校徽＋標題一行，搜尋收成圖示 */
  #topHeader {
    top: calc(8px + var(--safe-t));
    left: 10px;
    right: 10px;
    gap: 8px;
    align-items: center;
    z-index: 26;
  }

  .brand-card {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 12px 6px 6px;
    gap: 8px;
  }

  .school-logo-img {
    width: 32px;
    height: 32px;
  }

  .brand-text {
    min-width: 0;
  }

  .brand-text h1 {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-text small {
    display: none;
  }

  #mobileSearchBtn {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    padding: 0;
    font-size: 18px;
    color: inherit;
    cursor: pointer;
  }

  .search-box {
    display: none;
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  body.search-open .search-box {
    display: block;
  }

  .search-input-wrap input {
    font-size: 16px; /* iOS 輸入框小於 16px 時會自動放大頁面 */
  }

  /* 羅盤：只留小圓盤 */
  #compassBox {
    top: calc(var(--safe-t) + 64px);
    right: 10px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #compassResetBtn {
    width: 52px;
    height: 52px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.6);
  }

  .compass-caption, .mouse-mode-switch, .pan-dpad-grid {
    display: none;
  }

  .c-dir {
    font-size: 8.5px;
  }

  .c-dir.c-n {
    top: 3px;
    font-size: 9.5px;
  }

  .c-needle {
    width: 6px;
    height: 24px;
  }

  /* 底部工具列 */
  #mobileDock {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--dock-h) + var(--safe-b));
    padding: 0 4px var(--safe-b);
    background: rgba(11, 18, 26, 0.94);
    border-top: 1px solid var(--border-line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 30;
  }

  #mobileDock button {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
  }

  #mobileDock button span {
    font-size: 19px;
    line-height: 1;
  }

  #mobileDock button.active {
    color: var(--accent-gold);
  }

  body.walk-active #mobileDock,
  body.walk-active #navStatusBar {
    display: none;
  }

  /* 底部滑出面板：路線導航、大樓介紹、學程導覽、更多 */
  #leftNavBox,
  #detailDrawer,
  #programsDrawer,
  #moreSheet {
    position: absolute;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(var(--dock-h) + var(--safe-b));
    width: auto;
    max-height: 58dvh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding: 14px 16px 16px;
    z-index: 24;
  }

  #leftNavBox {
    display: none;
  }

  #leftNavBox.open {
    display: flex;
  }

  #closeNavBoxBtn {
    display: inline-block;
  }

  .nav-select-row select {
    font-size: 16px;
    padding: 8px;
  }

  #leftNavBox .act-btn {
    padding: 11px 12px;
    font-size: 14px;
  }

  #moreSheet {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #moreSheet h3 {
    margin: 0;
    font-size: 14px;
    color: var(--accent-gold);
  }

  .more-label {
    font-size: 12px;
    color: var(--text-muted);
  }

  .more-themes {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
  }

  .more-themes button {
    flex: 1;
    padding: 9px 4px;
  }

  #moreSheet .act-btn {
    padding: 11px 12px;
    font-size: 13.5px;
    text-align: left;
  }

  .drawer-head h2 {
    font-size: 17px;
  }

  /* 縮小的大樓介紹：改放左上角，避開底部列 */
  .floating-reopen-pill {
    top: calc(var(--safe-t) + 66px);
    left: 10px;
    right: auto;
    bottom: auto;
    max-width: calc(100vw - 90px);
    padding: 8px 14px;
    font-size: 12.5px;
  }

  .floating-reopen-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 帶路狀態列 */
  #navStatusBar {
    left: 8px;
    right: 8px;
    transform: none;
    bottom: calc(var(--dock-h) + var(--safe-b) + 8px);
    max-width: none;
    padding: 8px 10px;
    gap: 6px 8px;
  }

  .nav-info {
    flex: 1 1 100%;
    min-width: 0;
  }

  .nav-info b {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-info small {
    font-size: 11px;
  }

  .nav-actions {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .nav-actions .act-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 6px;
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-actions .close-btn {
    flex: none;
  }

  /* 漫步控制列：精簡為兩列 (角色／視角／速度／返回 + 快速起點)，方向改用搖桿 */
  #walkHudBar {
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    bottom: calc(8px + var(--safe-b));
    padding: 8px 10px;
    gap: 8px;
  }

  .walk-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .walk-head > div:first-child,
  .walk-char-select .hud-sub-sep,
  #toggleHudCollapseBtn,
  .walk-dpad {
    display: none;
  }

  .walk-char-select,
  .walk-spawns {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .walk-char-select::-webkit-scrollbar,
  .walk-spawns::-webkit-scrollbar {
    display: none;
  }

  .char-chip,
  .spawn-chip,
  #exitWalkBtn {
    flex: none;
    white-space: nowrap;
    padding: 6px 10px;
  }

  /* 「返回鳥瞰」固定在列尾，不隨角色按鈕捲動而被推出畫面 */
  #exitWalkBtn {
    position: sticky;
    right: 0;
    background: #2A3644;
    box-shadow: -10px 0 12px rgba(14, 22, 32, 0.95);
  }

  .walk-controls-row {
    flex-wrap: nowrap;
  }

  body.walk-active #walkJoystick {
    display: block;
    position: absolute;
    left: 18px;
    bottom: calc(var(--safe-b) + 108px);
    width: 124px;
    height: 124px;
    border-radius: 50%;
    background: rgba(15, 24, 34, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    touch-action: none;
    z-index: 23;
  }

  .joy-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border-radius: 50%;
    background: var(--accent-gold);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    pointer-events: none;
  }

  /* 3D 標籤縮小，減少遮擋 */
  .b-label {
    font-size: 11px;
    padding: 3px 8px;
    gap: 4px;
  }

  .b-label .b-fl {
    display: none;
  }

  .road-label {
    font-size: 10px;
    padding: 2px 6px;
  }

  .road-label.primary {
    font-size: 10.5px;
  }

  .cardinal-label {
    font-size: 10.5px;
    padding: 3px 8px;
  }

  .cardinal-label small {
    display: none;
  }

  #campusToast {
    top: calc(var(--safe-t) + 64px);
    left: 10px;
    right: 72px;
    transform: none;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 12.5px;
    text-align: center;
  }
}

/* 手機橫向：面板改放右側，保留左側地圖 */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --dock-h: 46px;
  }

  #leftNavBox,
  #detailDrawer,
  #programsDrawer,
  #moreSheet {
    left: auto;
    right: 8px;
    width: min(380px, 55vw);
    top: calc(var(--safe-t) + 62px);
    bottom: calc(var(--dock-h) + var(--safe-b) + 8px);
    max-height: none;
    border-radius: 16px;
  }

  #mobileDock button {
    flex-direction: row;
    gap: 6px;
    font-size: 12px;
  }

  #mobileDock button span {
    font-size: 16px;
  }

  body.walk-active #walkJoystick {
    bottom: calc(var(--safe-b) + 92px);
    width: 104px;
    height: 104px;
  }

  #walkHudBar {
    right: auto;
    width: min(560px, calc(100vw - 16px));
  }
}
