/* STREAMING_CHUNK: Defining root variables and cybernetic neon color tokens */
:root {
  --bg-dark: #02050c;
  --bg-panel: rgba(5, 15, 35, 0.85);
  --hud-cyan: #00f3ff;
  --hud-blue: #0066ff;
  --hud-red: #ff3e3e;
  --hud-green: #00ff66;
  --hud-yellow: #ffe600;

  --hud-cyan-glow: 0 0 10px rgba(0, 243, 255, 0.35);
  --hud-blue-glow: 0 0 10px rgba(0, 102, 255, 0.35);
  --hud-red-glow: 0 0 10px rgba(255, 62, 62, 0.35);
  --hud-green-glow: 0 0 10px rgba(0, 255, 102, 0.35);

  --hud-panel-border: rgba(0, 243, 255, 0.15);
  --hud-panel-border-active: rgba(0, 243, 255, 0.5);

  --text-primary: #e2f5ff;
  --text-secondary: #7fa8bf;
  --text-muted: #4a6c80;

  --font-mono: 'Share Tech Mono', monospace;
  --font-sans: 'Inter', sans-serif;
}

/* STREAMING_CHUNK: Resetting base browser formatting and setting grid background */

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

body.hud-theme,
body.hud-theme * {
  user-select: none;
  -webkit-user-select: none;
}

/* Keep the root app tied to the browser's current visible viewport. */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.main {
    flex:1;
    min-height:0;
    overflow:auto;
}

body.hud-theme {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);

  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;

  display: flex;
  flex-direction: column;

  background-image:
    linear-gradient(rgba(0, 243, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.02) 1px, transparent 1px);

  background-size: 30px 30px;
  background-position: center;
}

#app-container {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
}

/* STREAMING_CHUNK: Formatting header status dashboard and clocks */
/* 完美對齊（頂部避讓 + 左右不溢出）的 HUD Header 樣式 */
.hud-header {
  position: relative;
  width: 100% !important;
  flex-shrink: 0 !important;

  background: rgba(2, 5, 12, 0.95);
  border-bottom: 1px solid rgba(0, 243, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);

  box-sizing: border-box !important;

  /* 🎯 body 已在 safe-area 內，header 不再需要額外避讓 */
  height: 50px !important;
  padding-top: 0 !important;

  padding-bottom: 0 !important;
  padding-left: max(20px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(20px, env(safe-area-inset-right, 0px)) !important;

  display: flex;
  justify-content: space-between;
  
  /* 🎯 不再需要 flex-end 沉底，改回 center 垂直置中 */
  align-items: center !important;

  z-index: 100;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  height: 50px; /* 固定在 Safe Area 下方的 50px 區域內垂直置中 */
}

.header-left {
  gap: 12px;
}

.header-center {
  flex: 1;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  min-width: 0;
}

.header-right {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 16px;
}

.hud-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--hud-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--hud-green);
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 255, 102, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 102, 0); }
}

.hud-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hud-cyan);
  text-shadow: var(--hud-cyan-glow);
  letter-spacing: 1px;
}

.hud-stat-box {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px auto;
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(0, 243, 255, 0.12);
  border-radius: 5px;
  background: rgba(0, 102, 255, 0.07);
  line-height: 1.05;
  white-space: nowrap;
}

.hud-stat-box i {
  grid-row: 1 / span 2;
  font-size: 0.75rem;
  text-align: center;
}

.hud-stat-label {
  color: var(--text-muted);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
}

.hud-stat-box > span:last-child {
  font-size: 0.76rem;
}

.hud-stat-box:hover {
  border-color: rgba(0, 243, 255, 0.35);
  background: rgba(0, 243, 255, 0.08);
}

.camera-capture-wrap {
  position: relative;
}

.network-status-wrap {
  position: relative;
}

.network-details {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 243, 255, 0.28);
  border-radius: 6px;
  background: rgba(3, 10, 25, 0.98);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), var(--hud-cyan-glow);
  z-index: 120;
  transform: translateX(-50%);
}

.network-details[hidden] {
  display: none;
}

.network-details-list {
  display: grid;
  gap: 8px;
  font: 0.78rem var(--font-mono);
}

.network-details-list div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  min-width: 0;
}

.network-details-list dt {
  color: var(--text-muted);
}

.network-details-list dd {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hud-stat-box {
    padding-left: 7px;
    padding-right: 7px;
    display: flex;
    gap: 6px;
  }

  .hud-stat-label {
    display: none;
  }
}

@media (max-width: 680px) {
  .hud-logo {
    display: none;
  }

  .header-center {
    justify-content: flex-start;
  }

  .header-right {
    margin-left: 8px;
  }
}

.text-green { color: var(--hud-green) !important; text-shadow: var(--hud-green-glow); }
.text-cyan { color: var(--hud-cyan) !important; text-shadow: var(--hud-cyan-glow); }
.text-red { color: var(--hud-red) !important; text-shadow: var(--hud-red-glow); }
.text-yellow { color: var(--hud-yellow) !important; }

/* STREAMING_CHUNK: Structuring primary layout split grids and bars */
.ide-body {
  flex: 1;
  min-height: 0; /* 關鍵：允許 Flex 子元件伸縮，不被內容硬撐 */
  display: flex;
  position: relative;
  overflow: hidden;
}

.hud-activity-bar {
  width: 55px;
  background: rgba(3, 10, 25, 0.95);
  border-right: 2px solid var(--hud-panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 15px;
  gap: 15px;
  z-index: 15;
  flex-shrink: 0;
}

.activity-tab {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.activity-tab:hover {
  color: var(--hud-cyan);
  background: rgba(0, 243, 255, 0.05);
  border-color: rgba(0, 243, 255, 0.15);
}

.activity-tab.active {
  color: var(--hud-cyan);
  background: rgba(0, 243, 255, 0.08);
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

.activity-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
  border-radius: 0 3px 3px 0;
}

/* STREAMING_CHUNK: Styling bottom audio drawer panel */
#bottom-audio-drawer {
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 0;
  height: 250px;
  background: rgba(3, 10, 25, 0.95);
  border-top: 2px solid var(--hud-panel-border);
  border-left: 1px solid var(--hud-panel-border);
  transition: height 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 12;
}

#bottom-audio-drawer.collapsed {
  height: 35px;
}

.audio-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100% - 35px);
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* STREAMING_CHUNK: Formulating HUD buttons and user micro-interfaces */
.hud-btn {
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid var(--hud-blue);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.hud-btn:hover {
  background: rgba(0, 102, 255, 0.3);
  box-shadow: var(--hud-blue-glow);
  border-color: var(--hud-cyan);
}

.hud-btn.glow-cyan {
  border-color: var(--hud-cyan);
  background: rgba(0, 243, 255, 0.05);
}
.hud-btn.glow-cyan:hover {
  background: rgba(0, 243, 255, 0.2);
  box-shadow: var(--hud-cyan-glow);
}

.hud-btn.glow-blue {
  border-color: var(--hud-blue);
  background: rgba(0, 102, 255, 0.05);
}
.hud-btn.glow-blue:hover {
  background: rgba(0, 102, 255, 0.25);
  box-shadow: var(--hud-blue-glow);
}

.hud-btn.glow-green {
  border-color: var(--hud-green);
  background: rgba(0, 255, 102, 0.05);
}
.hud-btn.glow-green:hover {
  background: rgba(0, 255, 102, 0.25);
  box-shadow: var(--hud-green-glow);
}

.hud-btn.glow-red {
  border-color: var(--hud-red);
  background: rgba(255, 62, 62, 0.05);
}
.hud-btn.glow-red:hover {
  background: rgba(255, 62, 62, 0.25);
  box-shadow: var(--hud-red-glow);
}

.w-full { width: 100%; }
.text-center { justify-content: center; }
.cursor-pointer { cursor: pointer; }

/* STREAMING_CHUNK: Adjusting split containers in visual panels */
#middle-container {
  flex: 1;
  min-height: 0; /* 關鍵：取代固定 height: 100%，由 flex 自動吸收剩餘空間 */
  display: flex;
  overflow: hidden;
  background: rgba(2, 5, 12, 0.5);
  position: relative;
}

body.pdf-fullscreen-mode #middle-container {
  overflow: hidden;
}

body.pdf-fullscreen-mode #left-nav-panel {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

body.pdf-fullscreen-mode #canvas-panel {
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  pointer-events: none !important;
}

body.pdf-fullscreen-mode #canvas-panel .panel-header,
body.pdf-fullscreen-mode #canvas-panel .viewer-content {
  display: none !important;
}

body.iframe-fullscreen-mode #middle-container {
  overflow: hidden;
}

body.iframe-fullscreen-mode #left-nav-panel {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

body.iframe-fullscreen-mode #canvas-panel {
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  pointer-events: none !important;
}

body.iframe-fullscreen-mode #canvas-panel .panel-header,
body.iframe-fullscreen-mode #canvas-panel .viewer-content {
  display: none !important;
}

.iframe-fullscreen-control {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.hud-sub-panel {
  transition: width 0.35s cubic-bezier(0.1, 0.9, 0.2, 1), flex 0.35s cubic-bezier(0.1, 0.9, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--hud-panel-border);
}

.hud-sub-panel:last-child {
  border-right: none;
}

.hud-sub-panel.collapsed {
  width: 0% !important;
  min-width: 0 !important;
  flex: 0 0 0 !important;
  border-right: none !important;
}

.viewer-content {
  flex: 1;
  position: relative;
  overflow: auto;
  background: #02050c;
}

/* STREAMING_CHUNK: Structuring translation right-sidebar styles */
.hud-panel {
  background: var(--bg-panel);
  border: 1px solid var(--hud-panel-border);
  display: flex;
  flex-direction: column;
  height: 100%; /* 確保只佔滿父容器 .ide-body 的高度 */
  transition: width 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  position: relative;
  z-index: 10;
}

#right-sidebar.sidebar-expanded { width: 320px; }
#right-sidebar.sidebar-collapsed { width: 45px; }
#right-sidebar { border-left: 2px solid var(--hud-panel-border); }

.panel-header {
  height: 40px;
  background: rgba(3, 10, 25, 0.9);
  border-bottom: 1px solid var(--hud-panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

/* STREAMING_CHUNK: Overriding header overflow to allow dropdown menu projection */
#canvas-panel .panel-header {
  overflow: visible !important;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--hud-cyan);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--hud-cyan);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toggle-btn:hover {
  color: #fff;
  text-shadow: var(--hud-cyan-glow);
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-collapsed .sidebar-content { display: none; }
.sidebar-collapsed .panel-title { display: none; }
.sidebar-collapsed .panel-header { justify-content: center; padding: 0; }

/* STREAMING_CHUNK: Formatting buttons and controllers inside viewer layouts */
#pdf-viewer-panel .panel-header {
  overflow: visible !important;
}

.pdf-controls, .canvas-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pdf-controls::-webkit-scrollbar {
  display: none;
}

.hud-icon-btn {
  background: rgba(3, 10, 25, 0.8);
  border: 1px solid var(--hud-panel-border);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.hud-icon-btn:active {
  color: var(--hud-cyan);
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
  background: rgba(0, 243, 255, 0.05);
}

.hud-icon-btn.glow-red:hover {
  color: var(--hud-red);
  border-color: var(--hud-red);
  box-shadow: var(--hud-red-glow);
  background: rgba(255, 62, 62, 0.05);
}

#zoom-percent, #page-num, #page-count {
  font-size: 0.8rem;
  color: var(--hud-cyan);
  font-family: var(--font-mono);
}

/* STREAMING_CHUNK: Styling Canvas and Digital Memo boards */
#canvas-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#memo-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud-color-picker {
  border: 1px solid var(--hud-panel-border);
  background: transparent;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
}

.hud-select {
  background: rgba(3, 10, 25, 0.9);
  border: 1px solid var(--hud-panel-border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.hud-select:focus {
  border-color: var(--hud-cyan);
}

/* STREAMING_CHUNK: Designing collapsible shapes tool box and HUD submenus */
.hud-tool-group {
  position: relative;
  display: inline-block;
}

/* STREAMING_CHUNK: Designing Translation system visual components */
.translation-switch-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.hud-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.hud-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(3, 10, 25, 0.9);
  border: 1px solid var(--hud-panel-border);
  transition: .3s cubic-bezier(0.1, 0.9, 0.2, 1);
  border-radius: 10px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s cubic-bezier(0.1, 0.9, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider {
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

.translation-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.hud-section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.hud-terminal-box {
  background: rgba(2, 5, 12, 0.9);
  border: 1px solid var(--hud-panel-border);
  border-radius: 4px;
  padding: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  min-height: 90px;
  max-height: 140px;
  overflow-y: auto;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.hud-terminal-box.empty {
  color: var(--text-muted);
}

.hud-terminal-box:focus {
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

.hud-terminal-box-output {
  background: rgba(3, 10, 25, 0.95);
  border-left: 3px solid var(--hud-cyan);
  border-top: 1px solid var(--hud-panel-border);
  border-right: 1px solid var(--hud-panel-border);
  border-bottom: 1px solid var(--hud-panel-border);
  border-radius: 0 4px 4px 0;
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 120px;
  overflow-y: auto;
}

.hud-terminal-text {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* STREAMING_CHUNK: Adjusting PDF alignment structures */
#pdf-scroll-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  background: #030814;
  padding: 15px;
}

#pdf-canvas-container {
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 243, 255, 0.1);
  position: relative;
  background: white;
}

#pdf-canvas {
  display: block;
}

.textLayer {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  opacity: 0.25;
  line-height: 1.0;
  overflow: hidden;
}

.textLayer span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}

.textLayer ::selection {
  background: rgba(0, 243, 255, 0.45);
  color: transparent;
}

/* STREAMING_CHUNK: Common alerts and general glowing scrolls */
.hud-toast {
  position: fixed;
  bottom: calc(25px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(2, 5, 12, 0.95);
  border: 1px solid var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
  padding: 10px 25px;
  border-radius: 4px;
  z-index: 10000;
  font-size: 0.85rem;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  transition: opacity 0.3s, transform 0.3s;
}

.hud-toast.hidden {
  opacity: 0;
  transform: translate(-50%, 15px);
  pointer-events: none;
}

/* STREAMING_CHUNK: Header Lofi Audio Player Styles */
.hud-lofi-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(3, 10, 25, 0.8);
  border: 1px solid var(--hud-panel-border);
  padding: 3px 8px;
  border-radius: 4px;
}

.hud-lofi-player .hud-icon-btn {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.lofi-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.hud-lofi-player.playing .lofi-title {
  color: var(--hud-cyan);
  text-shadow: var(--hud-cyan-glow);
}

.hud-lofi-player.playing #lofi-play-btn {
  color: var(--hud-cyan);
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(2, 5, 12, 0.4);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 243, 255, 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--hud-cyan);
}

#status-location {
    color: inherit;
    font: inherit;
  line-height: 1.05;
    cursor: pointer;
    text-align: left;
}

#status-location[aria-expanded="true"] {
    border-color: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
}

#location-name {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.location-details {
    width: 220px;
}

#status-weather-btn {
    color: inherit;
    font: inherit;
    line-height: 1.05;
    cursor: pointer;
    text-align: left;
}

#status-weather-btn[aria-expanded="true"] {
    border-color: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
}

.weather-details {
    width: 280px;
}

.weather-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
}

.weather-header-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hud-cyan);
}

.weather-header-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.weather-details-list div {
    grid-template-columns: 80px 1fr;
}

.weather-forecast-title {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 243, 255, 0.15);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.weather-hourly-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.weather-hourly-item {
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.12);
    border-radius: 4px;
    padding: 5px 3px;
    text-align: center;
    font-size: 0.7rem;
}

.weather-hourly-time {
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-bottom: 2px;
}

.weather-hourly-icon {
    font-size: 0.85rem;
    margin: 2px 0;
}

.weather-hourly-temp {
    color: var(--text-primary);
    font-weight: 600;
}

.weather-hourly-pop {
    color: var(--hud-cyan);
    font-size: 0.62rem;
}

.weather-hourly-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 6px 0;
}

/* ===== HUD SCHEDULE 行程監測面板樣式 ===== */

#status-schedule-btn {
    color: inherit;
    font: inherit;
    line-height: 1.05;
    cursor: pointer;
    text-align: left;
}

#status-schedule-btn[aria-expanded="true"] {
    border-color: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

#status-schedule {
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.schedule-details {
    width: 320px;
    max-height: 480px;
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.schedule-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.schedule-header-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #c084fc;
    letter-spacing: 0.5px;
}

.schedule-header-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.schedule-refresh-btn {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.schedule-refresh-btn:hover {
    color: #c084fc;
    border-color: #a855f7;
}

/* 當前進行中行程卡片 */
.schedule-live-card {
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-left: 4px solid #a855f7;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.12);
}

.schedule-live-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.schedule-live-badge {
    font-size: 0.62rem;
    font-weight: 700;
    background: #a855f7;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.schedule-live-time {
    font-size: 0.72rem;
    color: #d8b4fe;
    font-weight: 600;
}

.schedule-live-task {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f3e8ff;
    line-height: 1.3;
    margin: 4px 0 6px 0;
    word-break: break-all;
}

/* 霓虹進度條 */
.schedule-progress-wrap {
    margin-top: 6px;
}

.schedule-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #d8b4fe;
    font-weight: 600;
    margin-bottom: 3px;
}

.schedule-progress-track {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.schedule-progress-fill {
    background: linear-gradient(90deg, #a855f7, #00f3ff);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
    height: 100%;
    width: 0%;
    transition: width 0.4s ease-out;
}

/* 時間軸列表清單 */
.schedule-list-header {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-left: 2px;
}

.schedule-timeline-list {
    flex: 1;
    overflow-y: auto;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 4px;
}

.schedule-timeline-item {
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid rgba(0, 243, 255, 0.4);
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.schedule-timeline-item.is-current {
    border-left-color: #a855f7;
    background: rgba(168, 85, 247, 0.12);
    box-shadow: inset 0 0 12px rgba(168, 85, 247, 0.1);
}

.schedule-timeline-item.is-current .schedule-item-time {
    color: #c084fc;
    font-weight: 700;
}

.schedule-timeline-item.is-current .schedule-item-task {
    color: #f3e8ff;
    font-weight: 600;
}

.schedule-timeline-item.is-off {
    opacity: 0.45;
    border-left-color: #64748b;
    background: rgba(15, 23, 42, 0.4);
}

.schedule-item-time {
    width: 52px;
    padding: 6px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--hud-cyan);
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.schedule-item-task {
    padding: 6px 8px;
    color: var(--text-primary);
    flex: 1;
    display: flex;
    align-items: center;
    line-height: 1.25;
    word-break: break-all;
}

.schedule-timeline-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 16px 0;
}



/* ===== 補強項目：筆刷工具 ===== */

/* 1. 讓按鈕內的圖示（<i>、<svg>）不攔截滑鼠事件，確保點擊必能命中按鈕 */
.hud-icon-btn *,
.hud-btn * {
  pointer-events: none;
}

/* 2. 工具選中時的高亮狀態 (.active) */
.hud-icon-btn.active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--hud-cyan, #00f3ff);
  color: var(--hud-cyan, #00f3ff);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

/* 3. 按鈕懸停效果 (Hover) */
.hud-icon-btn:hover {
  border-color: var(--hud-cyan, #00f3ff);
  color: #ffffff;
}

/* 1. 解除 Canvas / PDF 控制列的 overflow 裁切限制，允許子選單向下溢出 */
#canvas-panel .canvas-controls,
#pdf-viewer-panel .pdf-controls {
  overflow: visible !important;
}

/* 2. 完善子選單樣式與項目對齊 */
.hud-submenu {
  display: none;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(3, 10, 25, 0.98);
  border: 1px solid var(--hud-panel-border);
  box-shadow: var(--hud-cyan-glow), 0 4px 15px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  padding: 6px;
  z-index: 1000;
}

.hud-submenu.show {
  display: flex;
}

/* 確保選單內的子按鈕具有正確的點擊域與圖示置中 */
.hud-submenu .submenu-item {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}