/* ==========================================================================
   香港地鐵 MTR 東鐵綫 車載 LCD 仿真視導系統 專用樣式表
   1:1 像素級精準還原 1280 x 364 超寬條形屏幕與正統宋體排版
   ========================================================================== */

:root {
  --screen-bg: #E5E5E5;
  --track-east-rail: #50B7E8;     /* 東鐵綫標誌天藍色 */
  --track-past: #8A8A8A;          /* 已駛過灰色軌道 */
  --color-tuen-ma: #923811;       /* 屯馬綫棕暗紅 */
  --color-kwun-tong: #00AB4E;     /* 觀塘綫經典綠色 */
  --color-yellow: #FFD100;        /* 港鐵黃 (車站圓圈 & 橫幅) */
  --color-door-green: #00C853;    /* 請在這邊落車綠色膠囊 */
  --color-door-yellow: #FFC000;   /* 請往另一邊落車黃色膠囊 */
  --banner-blue-bg: #00283A;      /* 報站深藍橫幅底色 */
  --banner-yellow-bg: #FFCC00;    /* 關門與小心空隙黃色橫幅底色 */
  --text-black: #111111;
  --text-white: #FFFFFF;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: #0F1216;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "Microsoft JhengHei", sans-serif;
  color: var(--text-black);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 正統港鐵標宋字體與無襯線英文 */
.font-songti {
  font-family: "Noto Serif TC", "Songti TC", "Songti SC", "SimSun", "PMingLiU", "MingTi", serif;
  font-weight: 900;
}

.font-english {
  font-family: "Myriad Pro", "Segoe UI", Frutiger, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

/* ==========================================================================
   車載 LCD 仿真超寬條屏外框 (精準 1280 x 364 比例 3.516 : 1)
   ========================================================================== */
.lcd-frame {
  position: relative;
  width: min(96vw, calc(94vh * (1280 / 364)));
  aspect-ratio: 1280 / 364;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 0 10px #22252A, 0 0 0 14px #14171A;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--screen-bg);
}

:fullscreen .lcd-frame,
:-webkit-full-screen .lcd-frame {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

:fullscreen .lcd-screen,
:-webkit-full-screen .lcd-screen {
  width: min(100vw, calc(100vh * (1280 / 364)));
  aspect-ratio: 1280 / 364;
}

.lcd-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--screen-bg);
  overflow: hidden;
  container-type: inline-size;
}

/* ==========================================================================
   頂部資訊條 (落車膠囊 & 東鐵綫標誌)
   ========================================================================== */
.lcd-topbar {
  position: absolute;
  top: 1.09cqw;
  left: 1.56cqw;
  right: 1.88cqw;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 50;
  pointer-events: none;
}

/* 落車指示膠囊 (請在這邊落車 / 請往另一邊落車) */
.exit-capsule-pill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0.31cqw 1.56cqw;
  border-radius: 2.19cqw;
  box-shadow: 0 0.16cqw 0.47cqw rgba(0, 0, 0, 0.15);
  transition: opacity 0.2s ease, background-color 0.25s ease;
}

.exit-capsule-pill.pill-green {
  background-color: var(--color-door-green);
  color: #FFFFFF;
}

.exit-capsule-pill.pill-yellow {
  background-color: var(--color-door-yellow);
  color: #111111;
}

.exit-capsule-pill.hidden {
  opacity: 0;
  visibility: hidden;
}

.exit-capsule-pill .capsule-zh {
  font-family: "Noto Serif TC", serif;
  font-size: 1.48cqw;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.5px;
}

.exit-capsule-pill .capsule-en {
  font-family: "Myriad Pro", "Segoe UI", sans-serif;
  font-size: 1.02cqw;
  font-weight: 700;
  line-height: 1.1;
}

/* 右上角 東鐵綫標籤 */
.line-title-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: #1A1A1A;
}

.line-name-zh {
  font-size: 1.64cqw;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.1;
}

.line-name-en {
  font-size: 0.98cqw;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   視圖層 1: 站名大字畫面 (始發、關門、即將到站)
   ========================================================================== */
.view-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.view-layer.active {
  opacity: 1;
  visibility: visible;
}

.view-big-station {
  display: flex;
  justify-content: center;
  align-items: center;
}

.big-station-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.88cqw;
  margin-top: -2.81cqw; /* 為下方橫幅留出標準視覺中軸 */
}

/* 中文宋體大字站名 */
.big-station-zh {
  font-size: 6.72cqw;
  color: #111111;
  letter-spacing: 3px;
  line-height: 1;
}

/* 中間圓圈 */
.big-station-circle-box {
  width: 5.15cqw;
  height: 5.15cqw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.station-circle-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 0.47cqw solid #111111;
  background-color: var(--color-yellow);
  transition: background-color 0.15s ease;
}

.station-circle-dot.flash-a {
  background-color: var(--color-yellow); /* 實心黃 */
}

.station-circle-dot.flash-b {
  background-color: #FFFFFF;             /* 空心白 */
}

/* 英文站名 */
.big-station-en {
  font-size: 3.91cqw;
  color: #111111;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* ==========================================================================
   視圖層 2: 矢量路線圖 (原生 viewBox 平滑過渡)
   ========================================================================== */
.view-map-svg {
  width: 100%;
  height: 100%;
}

#mtrSvg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 車站圓圈 (不硬編碼 fill 與 stroke-width，避免覆蓋 JS 500ms 黃白動態閃爍與自適應粗細) */
.svg-station-circle {
  transition: fill 0.12s ease;
}

/* 車站文字標籤 (字號交由 JS 參數化自適應引擎控制，字體鎖定正統港鐵大標宋) */
.svg-label-zh {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 900;
  fill: #1A1A1A;
  text-anchor: middle;
}

.svg-label-en {
  font-family: "Myriad Pro", "Segoe UI", sans-serif;
  font-weight: 700;
  fill: #1A1A1A;
  text-anchor: middle;
}

.svg-label-past .svg-label-zh {
  fill: #999999;
}

.svg-label-past .svg-label-en {
  fill: #AAAAAA;
}

/* 換乘立柱標註 */
.svg-transfer-zh {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  fill: #111111;
  text-anchor: middle;
}

.svg-transfer-en {
  font-family: "Myriad Pro", sans-serif;
  font-weight: 700;
  fill: #111111;
  text-anchor: middle;
}

/* ==========================================================================
   底部橫幅 1: 黃色警示橫幅 (高 118px，關門 / 小心空隙)
   ========================================================================== */
.bottom-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100%);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 60;
}

.bottom-banner.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.banner-yellow {
  height: 9.22cqw;
  background-color: var(--banner-yellow-bg);
  padding: 0 2.81cqw;
}

.yellow-text-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.56cqw;
  flex: 1;
}

.yellow-zh {
  font-size: 3.75cqw;
  color: #111111;
  letter-spacing: 2px;
}

.yellow-en {
  font-size: 2.5cqw;
  color: #111111;
  letter-spacing: 0.5px;
}

/* 小心空隙紅圓警告圖標 (左右兩側) */
.banner-gap-icon-svg {
  width: 5.94cqw;
  height: 5.94cqw;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-gap-icon-svg.visible {
  display: flex;
}

.mind-gap-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

/* ==========================================================================
   底部橫幅 2: 深藍信息橫幅 (高 78px，報站 / 換乘信息)
   ========================================================================== */
.banner-blue {
  height: 6.09cqw;
  background-color: var(--banner-blue-bg);
  padding: 0 3.12cqw;
  gap: 1.56cqw;
}

.blue-transfer-pill {
  display: none;
  align-items: center;
  gap: 0.78cqw;
  background-color: var(--color-tuen-ma);
  padding: 0.31cqw 1.25cqw;
  border-radius: 1.56cqw;
  color: #FFFFFF;
}

.blue-transfer-pill.visible {
  display: flex;
}

.blue-text-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.25cqw;
  color: #FFFFFF;
}

.blue-zh {
  font-size: 2.65cqw;
  letter-spacing: 1px;
}

.blue-en {
  font-size: 1.72cqw;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   懸浮交互控制台
   ========================================================================== */
.control-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 340px;
  background: rgba(18, 22, 28, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  color: #CBD5E1;
  font-size: 13px;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-panel.collapsed {
  transform: translateX(calc(100% + 16px));
}

.control-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-title {
  font-weight: 700;
  color: #38BDF8;
}

.btn-toggle {
  position: absolute;
  left: -36px;
  top: 16px;
  width: 36px;
  height: 44px;
  background: rgba(18, 22, 28, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #38BDF8;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.4);
}

.control-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 78vh;
  overflow-y: auto;
}

.ctrl-row {
  display: flex;
  gap: 8px;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ctrl-group label {
  font-size: 11.5px;
  color: #94A3B8;
  font-weight: 600;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 5px;
  padding: 7px 10px;
  font-weight: 600;
  font-size: 12px;
  transition: background 0.15s ease;
}

.btn-primary {
  background-color: #0284C7;
  color: #FFFFFF;
  flex: 1.3;
}

.btn-primary:hover {
  background-color: #0369A1;
}

.btn-secondary {
  background-color: #334155;
  color: #F8FAFC;
  flex: 1;
}

.btn-secondary:hover {
  background-color: #475569;
}

.grid-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-stage {
  background-color: #1E293B;
  color: #CBD5E1;
  border: 1px solid #334155;
  padding: 6px 8px;
  font-size: 11px;
}

.btn-stage:hover {
  background-color: #334155;
  color: #FFFFFF;
}

.select-station {
  background-color: #1E293B;
  color: #F8FAFC;
  border: 1px solid #475569;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  outline: none;
}

.radio-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}

.radio-box label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #CBD5E1;
}

.log-box {
  background-color: #0B111E;
  border-left: 3px solid #38BDF8;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: "Consolas", monospace;
  font-size: 11px;
  line-height: 1.35;
  min-height: 42px;
}

.btn-action {
  background-color: #334155;
  color: #E2E8F0;
  flex: 1;
}

/* ==========================================================================
   司機互動操縱台專屬樣式 (Interactive Driver Deck)
   ========================================================================== */
.mode-switch-box {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-mode {
  flex: 1;
  background: transparent;
  color: #94A3B8;
  padding: 6px 4px;
  font-size: 11.5px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-mode.active {
  background: #0284C7;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.interactive-deck {
  background: linear-gradient(145deg, #131B26, #0D131C);
  border: 1px solid #1E293B;
  border-left: 3px solid #0284C7;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: border-color 0.3s ease;
}

.interactive-deck.manual-active {
  border-color: #38BDF8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deck-title {
  font-size: 12px;
  font-weight: 700;
  color: #E2E8F0;
}

.door-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.door-status-pill.closed {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.door-status-pill.open {
  background: rgba(34, 197, 94, 0.2);
  color: #4ADE80;
  border: 1px solid rgba(34, 197, 94, 0.4);
  animation: pulse-door 1.2s infinite;
}

@keyframes pulse-door {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.1); }
}

.deck-tip-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  color: #38BDF8;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 4px;
  line-height: 1.3;
}

.deck-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.btn-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-deck:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(80%);
}

.btn-deck:not(:disabled) {
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.btn-deck:not(:disabled):hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.btn-deck:not(:disabled):active {
  transform: translateY(1px);
}

.btn-deck-icon {
  font-size: 16px;
}

/* 開門按鈕 (翡翠綠) */
.btn-open-door:not(:disabled) {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border-color: #34D399;
  animation: pulse-ready 1.2s infinite;
}

/* 關門按鈕 (警示橙黃) */
.btn-close-door:not(:disabled) {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #111111;
  border-color: #FCD34D;
  animation: pulse-ready 1.2s infinite;
}

/* 開車按鈕 (港鐵科技天藍) */
.btn-depart:not(:disabled) {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  border-color: #38BDF8;
  animation: pulse-ready 1.2s infinite;
}

@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
}

/* ==========================================================================
   現實模擬 (GPS 1s 定位) 面板樣式
   ========================================================================== */
.gps-deck {
  background: linear-gradient(145deg, #0d1927, #07101a);
  border: 1px solid #1e3a5f;
  border-left: 3px solid #06b6d4;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.gps-deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gps-deck-title {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.gps-status-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.gps-status-pill.pill-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  animation: pulse-door 1.5s infinite;
}

.gps-status-pill.pill-locating {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.gps-status-pill.pill-sim {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.gps-coords-row {
  display: flex;
  justify-content: space-between;
  font-family: "Consolas", monospace;
  font-size: 11px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
}

.gps-section-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gps-section-stations {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
}

.station-tag.from {
  color: #38bdf8;
}

.station-tag.to {
  color: #f59e0b;
}

.section-arrow {
  color: #64748b;
  font-size: 10px;
}

/* 比例進度條 */
.gps-progress-track {
  position: relative;
  width: 100%;
  height: 12px;
  background: #1e293b;
  border-radius: 6px;
  overflow: visible;
  border: 1px solid #334155;
}

.gps-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 5px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.gps-marker-depart,
.gps-marker-arrival {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  font-size: 9px;
  font-family: monospace;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
  pointer-events: none;
}

.gps-marker-depart {
  left: 10%;
  background: #059669;
  color: #ffffff;
}

.gps-marker-depart::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: 16px;
  background: #10b981;
  transform: translateX(-50%);
}

.gps-marker-arrival {
  left: 90%;
  background: #d97706;
  color: #ffffff;
}

.gps-marker-arrival::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: 16px;
  background: #f59e0b;
  transform: translateX(-50%);
}

.gps-dist-metrics {
  display: flex;
  justify-content: space-between;
  font-family: "Consolas", monospace;
  font-size: 10.5px;
  color: #cbd5e1;
  margin-top: 4px;
}

.gps-rule-tip {
  font-size: 10.5px;
  color: #e0f2fe;
  background: rgba(2, 132, 199, 0.15);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  padding: 5px 8px;
  border-radius: 4px;
  line-height: 1.35;
}

.gps-sim-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.gps-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #a78bfa;
}

.gps-slider {
  width: 100%;
  cursor: pointer;
  accent-color: #a855f7;
}

.btn-open-map {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #ffffff;
  border: 1px solid #14b8a6;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.3);
}

.btn-open-map:hover {
  background: linear-gradient(135deg, #115e59, #0f766e);
  transform: translateY(-1px);
}

/* ==========================================================================
   高德地圖站點打點模態視窗樣式 (AMap Pointing Modal)
   ========================================================================== */
.map-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.map-modal-backdrop.show {
  display: flex;
  animation: modal-fade-in 0.25s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.map-modal-window {
  width: 100%;
  max-width: 1200px;
  height: 86vh;
  background: #0a0f18;
  border: 1px solid #1e293b;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(2, 132, 199, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-modal-header {
  padding: 12px 18px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.amap-sdk-badge {
  font-size: 11px;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: monospace;
}

.btn-modal-close {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-modal-close:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #f87171;
}

.map-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* 左側管理欄 */
.map-sidebar {
  width: 340px;
  background: #0d1420;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #94a3b8;
}

.btn-text-sm {
  background: transparent;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.btn-text-sm:hover {
  background: rgba(56, 189, 248, 0.15);
}

.active-station-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.2), rgba(15, 23, 42, 0.6));
  border: 1px solid #0284c7;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.active-badge {
  font-size: 10.5px;
  color: #7dd3fc;
}

.active-name {
  font-size: 14px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.active-hint {
  font-size: 10px;
  color: #fcd34d;
}

.map-click-mode-switch {
  display: flex;
  gap: 6px;
}

.btn-sub-mode {
  flex: 1;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 6px 4px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-sub-mode.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  font-weight: 700;
}

.station-coords-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.station-coord-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #131d2e;
  border: 1px solid #1e293b;
  border-radius: 5px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.station-coord-row:hover {
  background: #1a273e;
  border-color: #334155;
}

.station-coord-row.selected {
  background: rgba(2, 132, 199, 0.25);
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.st-col-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-col-name {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.st-col-coords {
  font-family: "Consolas", monospace;
  font-size: 10px;
  color: #64748b;
}

.st-col-coords.unmarked {
  color: #fbbf24;
  font-weight: 600;
}

.st-col-coords.marked {
  color: #34d399;
}

.station-coord-row.selected .st-col-coords.unmarked {
  color: #fef08a;
}

.station-coord-row.selected .st-col-coords.marked {
  color: #6ee7b7;
}

.st-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-pick-point {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  font-size: 10.5px;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.btn-pick-point.btn-active,
.btn-pick-point:hover,
.station-coord-row.selected .btn-pick-point {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
}

.btn-clear-st {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-clear-st:hover {
  background: #ef4444;
  color: #ffffff;
}

/* 側邊欄底部 */
.sidebar-footer {
  border-top: 1px solid #1e293b;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.amap-details summary {
  font-size: 11px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 0;
}

.amap-key-inputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding: 6px;
  background: #0b111a;
  border-radius: 4px;
}

.input-dark {
  background: #141e2e;
  border: 1px solid #334155;
  color: #f8fafc;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 4px;
  outline: none;
}

.input-dark:focus {
  border-color: #38bdf8;
}

.btn-save-key {
  background: #0284c7;
  color: #ffffff;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.amap-key-tip {
  font-size: 9.5px;
  color: #64748b;
  line-height: 1.3;
}

.coords-action-row {
  display: flex;
  gap: 6px;
}

/* 右側地圖區域 */
.map-main-area {
  flex: 1;
  position: relative;
  background: #05080f;
  display: flex;
  flex-direction: column;
}

.amap-container {
  width: 100%;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.fallback-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* 地圖頂部懸浮 HUD */
.map-hud-overlay {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 100;
}

.hud-item {
  background: rgba(10, 15, 24, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11.5px;
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.hud-mouse-coords {
  font-family: "Consolas", monospace;
  color: #38bdf8;
}

.hud-station-info {
  font-weight: 700;
  color: #fcd34d;
}

.btn-hud-fit {
  background: rgba(2, 132, 199, 0.9);
  color: #ffffff;
  border: 1px solid #38bdf8;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-hud-fit:hover {
  background: #0284c7;
}

.map-bottom-bar {
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid #1e293b;
  padding: 7px 14px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
}

/* ==========================================================================
   移動端適配與強制橫屏顯示 (確保比例與懸浮窗)
   ========================================================================== */

@media screen and (max-width: 800px) {
  .control-panel {
    width: 280px;
    right: 10px;
    bottom: 10px;
    transform-origin: bottom right;
  }
  .control-panel.collapsed {
    transform: translateX(calc(100% + 10px));
  }
  .control-title {
    font-size: 11.5px;
  }
  button {
    padding: 6px 8px;
    font-size: 11px;
  }
}

/* 豎屏狀態強制旋轉顯示橫屏視圖 */
@media screen and (orientation: portrait) and (max-width: 768px) {
  body {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: calc(50% - 50vw);
    left: calc(50% - 50vh);
  }
  .lcd-frame {
    width: min(96vh, calc(94vw * (1280 / 364)));
  }
}

