:root,
[data-theme="cyber-brass"] {
  --bg-dark: #080a0f;
  --bg-panel: #0f131c;
  --bg-surface: #151a27;
  --bg-card: #1a2130;
  --card-bg: #0f131c;
  --gold: #ffd700;
  --gold-dim: #b89700;
  --gold-glow: rgba(255, 215, 0, 0.25);
  --gold-light: #f7e49a;
  --cyan: #00e5ff;
  --cyan-dim: #009cb3;
  --cyan-glow: rgba(0, 229, 255, 0.25);
  --neon-blue: #00e5ff;
  --neon-glow: rgba(0, 229, 255, 0.85);
  --green: #00e676;
  --red: #ff5252;
  --danger: #ff5252;
  --text-main: #f0f4fc;
  --text-dim: #8292a4;
  --text-muted: #4e5d71;
  --border-subtle: #1c2333;
  --border-accent: rgba(0, 229, 255, 0.28);
  --border-gold: rgba(255, 215, 0, 0.35);
  --border-brass: #9b8146;
  --wire-base: #4a4126;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Classic Amber (短波琥珀黃，溫暖低炫光護眼) */
[data-theme="classic-amber"] {
  --bg-dark: #0e0b06;
  --bg-panel: #17120a;
  --bg-surface: #20190e;
  --bg-card: #271e12;
  --card-bg: #17120a;
  --gold: #ffb000;
  --gold-dim: #c67c00;
  --gold-glow: rgba(255, 176, 0, 0.35);
  --gold-light: #ffe082;
  --cyan: #ffc83b;
  --cyan-dim: #b27b10;
  --cyan-glow: rgba(255, 200, 59, 0.35);
  --neon-blue: #ff9800;
  --neon-glow: rgba(255, 152, 0, 0.85);
  --green: #ffb000;
  --red: #ff5252;
  --danger: #ff5252;
  --text-main: #fff4e0;
  --text-dim: #bca17c;
  --text-muted: #786348;
  --border-subtle: #291e10;
  --border-accent: rgba(255, 152, 0, 0.32);
  --border-gold: rgba(255, 176, 0, 0.4);
  --border-brass: #a86e1e;
  --wire-base: #543810;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Green Phosphor (雷達磷光綠，P31 深綠螢光示波儀表) */
[data-theme="green-phosphor"] {
  --bg-dark: #060e0a;
  --bg-panel: #0a1710;
  --bg-surface: #0f2218;
  --bg-card: #142b1f;
  --card-bg: #0a1710;
  --gold: #00e676;
  --gold-dim: #00a352;
  --gold-glow: rgba(0, 230, 118, 0.35);
  --gold-light: #b9f6ca;
  --cyan: #69f0ae;
  --cyan-dim: #00b27a;
  --cyan-glow: rgba(105, 240, 174, 0.35);
  --neon-blue: #00ff66;
  --neon-glow: rgba(0, 255, 102, 0.85);
  --green: #00e676;
  --red: #ff5252;
  --danger: #ff5252;
  --text-main: #e0fff0;
  --text-dim: #7ca38f;
  --text-muted: #486958;
  --border-subtle: #10291d;
  --border-accent: rgba(0, 255, 102, 0.32);
  --border-gold: rgba(0, 230, 118, 0.4);
  --border-brass: #1b7a42;
  --wire-base: #134426;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* CRT Phosphor Scanline Overlay */
[data-theme="classic-amber"] body::after,
[data-theme="green-phosphor"] body::after {
  content: " ";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.22) 50%);
  background-size: 100% 4px;
  z-index: 9999;
  opacity: 0.32;
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-ui);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

header {
  text-align: center;
}

h1 {
  margin: 0 0 6px 0;
  color: var(--gold-light);
  font-size: 1.55rem;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-bottom: 4px;
}

/* Layout Switcher Pill in Header */
.layout-switch-container {
  display: inline-flex;
  background: #14161c;
  border: 1px solid #2f3442;
  border-radius: 20px;
  padding: 3px;
  margin-top: 6px;
  gap: 3px;
}

.layout-switch-btn {
  background: transparent;
  border: none;
  color: #8e929b;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.layout-switch-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.layout-switch-btn.active {
  background: var(--gold);
  color: #101114;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

/* Base Main Container */
.main-container {
  display: grid;
  gap: 16px;
  width: 100%;
  margin: 0 auto;
  transition: max-width 0.3s ease;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 4px 16px 8px 16px;
}

.main-container::-webkit-scrollbar {
  width: 6px;
}
.main-container::-webkit-scrollbar-track {
  background: transparent;
}
.main-container::-webkit-scrollbar-thumb {
  background: #232b3b;
  border-radius: 3px;
}
.main-container::-webkit-scrollbar-thumb:hover {
  background: var(--cyan-dim);
}

/* 1. Two-Column Focus Mode (Default) */
.main-container.layout-2col {
  grid-template-columns: 380px minmax(540px, 720px);
  grid-template-areas:
    "hardware training"
    "hardware telemetry";
  max-width: 1200px;
  justify-content: center;
}

/* 2. Three-Column Cockpit Mode */
.main-container.layout-3col {
  grid-template-columns: 350px minmax(500px, 1.2fr) minmax(360px, 420px);
  grid-template-areas:
    "hardware training telemetry";
  max-width: 1650px;
  justify-content: center;
}

/* Column Area Mappings */
.card-column, #col-hardware {
  grid-area: hardware;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  align-self: start;
}

.training-column, #col-training {
  grid-area: training;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-self: start;
}

.telemetry-column, #col-telemetry {
  grid-area: telemetry;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-self: start;
}

/* Responsive fallbacks */
@media (max-width: 1199px) {
  .main-container.layout-3col {
    grid-template-columns: 380px minmax(500px, 1fr);
    grid-template-areas:
      "hardware training"
      "hardware telemetry";
    max-width: 1000px;
  }
}

@media (max-width: 960px) {
  .main-container,
  .main-container.layout-2col,
  .main-container.layout-3col {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    max-width: 100%;
  }
  .card-column, .training-column, .telemetry-column, #col-hardware, #col-training, #col-telemetry {
    width: 100%;
    max-width: 540px;
  }
}

/* Generic Panel & Eurorack Chassis Inset */
.panel {
  background: linear-gradient(180deg, #181a24 0%, #12141c 100%);
  border: 1px solid #282f42;
  border-top-color: #3d4660;
  border-bottom-color: #171b26;
  border-radius: 10px;
  padding: 13px 15px;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 2px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.45);
  position: relative;
}

/* Eurorack Corner Rivets / Hex Screws */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #252c3d;
  border: 1px solid #141822;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0.55;
  top: 6px;
}
.panel::before {
  left: 7px;
}
.panel::after {
  right: 7px;
}

.panel-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Radio Nomenclature Micro-labels */
.radio-label,
.telem-label,
.state-label,
.meter-track-header,
.rx-sc-item-label,
.scope-bezel-text,
.control-group-title {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Tabular Numbers for rock-solid dynamic instrumentation without horizontal jitter */
.tabular-nums,
.wpm-badge,
.topbar-wpm-pill,
.state-val,
.telem-value,
.telem-unit,
.meter-readout strong,
.meter-readout span,
.val-tag,
.settings-row .val-tag,
.rx-score-val,
.rx-stat-num,
.rx-badge,
.rx-progress-label,
.rx-char-pct,
.rx-hist-val,
.rx-sc-metric-val,
.rx-latency-val,
.rx-stat-badge,
.preset-btn span,
.k5-step-val,
.hud-char-large,
.hud-seq-code,
.hud-committed-stream,
.trophy-pill strong,
#topbar-wpm-val,
#k5-wpm-val,
#state-duration,
#state-wpm,
#state-seq,
#readout-time,
#readout-wpm,
#readout-threshold-tag,
#readout-max,
#gap-time-readout,
#gap-countdown-readout,
#gap-max-readout,
#telem-unit-t,
#telem-jitter,
#telem-ratio-text,
#tag-unit-t,
#tag-threshold,
#tag-gap,
#tag-word-gap,
#wpm-display,
#farns-wpm-display,
#tone-val,
#farnsworth-gap-val,
#farnsworth-word-val,
#weight-ratio-val,
#qrn-val,
#rx-wpm-val,
#rx-fwpm-val,
#rx-volume-val,
#rx-sc-accuracy,
#rx-sc-wpm,
#rx-sc-latency,
#rx-sc-median-latency,
#rx-sc-low25-latency,
#rx-sc-total,
#rx-sc-hist-sessions,
#rx-sc-hist-accuracy,
#rx-sc-hist-latency,
#rx-sc-hist-best,
#rx-stat-total-sessions,
#rx-stat-rolling-accuracy,
#rx-stat-rolling-latency,
#rx-stat-best-accuracy,
#sc-total,
#sc-correct,
#sc-errors,
#sc-accuracy,
#koch-sc-total,
#koch-sc-correct,
#koch-sc-errors,
#koch-sc-accuracy,
#koch-mastery-text,
#trophy-cnt-challenge,
#trophy-cnt-standard,
#trophy-cnt-quick,
#trophy-cnt-total,
#radar-halo-text {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Material Design Icons (MDI) Base Standards */
.mdi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: -0.125em;
  font-size: 1.1em;
}

.mdi::before {
  line-height: 1;
}

.mdi.mdi-sm {
  font-size: 0.9em;
}

.mdi.mdi-lg {
  font-size: 1.3em;
}


/* ==========================================================================
   Three-Zone Shell: Top Bar, Workspaces, and Navigation
   ========================================================================== */
.va-topbar {
  width: calc(100% - 24px);
  max-width: 1650px;
  height: 52px;
  background: linear-gradient(180deg, #161924 0%, #11131a 100%);
  border: 1px solid #282f42;
  border-top-color: #3d4660;
  border-bottom-color: #171b26;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin: 6px auto 10px;
  align-self: center;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 2px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.45);
}
.va-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.va-title {
  font-size: 1rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.va-title-en {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}
.va-workspace-nav {
  display: flex;
  gap: 4px;
  background: #0b0c10;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #232936;
  flex-shrink: 0;
}
.va-ws-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.va-ws-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.va-ws-btn.active {
  background: #1e2430;
  color: var(--neon-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: wsBtnActivate 0.22s ease;
}
@keyframes wsBtnActivate {
  0% {
    transform: scale(0.95);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}
.va-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.topbar-wpm-pill {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  background: #0b0c10;
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
}
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1b1e26;
  border: 1px solid #2e3444;
  color: #cfd6e6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}
.header-subbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}
.header-subbar.noise-hidden,
.hardware-keyer-deck.noise-hidden,
#hardware-keyer-deck {
  display: none !important;
}

/* ==========================================================================
   Panoramic HUD Ribbon (Top 置頂示波光帶, 75px)
   ========================================================================== */
.p3b-top-ribbon {
  width: 100%;
  height: 75px;
  min-height: 75px;
  max-height: 75px;
  background: #080b11;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
.scope-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.scope-graticule {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, rgba(0, 229, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}
.scope-bezel-text {
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 0 6px var(--cyan-glow);
}

/* ==========================================================================
   Timing Vector Telemetry (向量時差遙測儀)
   ========================================================================== */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.telem-card {
  background: #0a0e16;
  border: 1px solid #1a2230;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.telem-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.telem-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.telem-unit {
  font-size: 0.65rem;
  font-weight: normal;
  color: var(--text-dim);
}
.ratio-bar-wrap {
  grid-column: 1 / span 2;
  background: #0a0e16;
  border: 1px solid #1a2230;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ratio-meter-track {
  width: 100%;
  height: 8px;
  background: #141b26;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.ratio-meter-fill {
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  border-radius: 4px;
  transition: width 0.15s ease;
}
.ratio-target-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 4px #fff;
}

.workspace-view {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Workspace Switch Transition & Tactical Beam Sweep */
.workspace-view::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 99;
}

.workspace-view.ws-slide-in-right {
  animation: wsSlideInRight 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.workspace-view.ws-slide-in-left {
  animation: wsSlideInLeft 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.workspace-view.ws-slide-in-right::before,
.workspace-view.ws-slide-in-left::before {
  animation: wsModeSwitchGlow 0.28s ease-out;
}

@keyframes wsSlideInRight {
  0% {
    opacity: 0;
    transform: translate3d(24px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes wsSlideInLeft {
  0% {
    opacity: 0;
    transform: translate3d(-24px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes wsModeSwitchGlow {
  0% {
    opacity: 0;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    transform: scaleX(0.1);
  }
  40% {
    opacity: 0.9;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-view.ws-slide-in-right,
  .workspace-view.ws-slide-in-left {
    animation: wsFadeInOnly 0.15s ease both;
  }
  .workspace-view.ws-slide-in-right::before,
  .workspace-view.ws-slide-in-left::before {
    display: none;
  }
  .va-ws-btn.active {
    animation: none;
  }
}

@keyframes wsFadeInOnly {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.placeholder-workspace {
  padding: 60px 20px;
  text-align: center;
  background: #141720;
  border: 1px solid #283142;
  border-radius: 12px;
  max-width: 600px;
  margin: 40px auto;
  width: 100%;
}
.placeholder-icon {
  font-size: 3.5rem;
  color: var(--neon-blue);
  margin-bottom: 16px;
}
.placeholder-badge {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.75rem;
  font-family: monospace;
  background: rgba(0, 229, 255, 0.1);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
}

/* Slide-up Settings Drawer */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
}
.settings-drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: #141720;
  border: 1px solid #2b3548;
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
}
.drawer-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #242e40;
}
.drawer-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.drawer-body::-webkit-scrollbar {
  width: 6px;
}
.drawer-body::-webkit-scrollbar-track {
  background: transparent;
}
.drawer-body::-webkit-scrollbar-thumb {
  background: #232b3b;
  border-radius: 3px;
}
.drawer-body::-webkit-scrollbar-thumb:hover {
  background: #333e54;
}

/* Theme Preset Selector Grid */
.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.theme-preset-btn {
  background: #1a1c24;
  border: 1px solid #363b4b;
  border-radius: 6px;
  padding: 8px 4px;
  color: var(--text-main);
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.theme-preset-btn:hover {
  border-color: var(--gold);
  background: #222634;
}
.theme-preset-btn.active {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 8px var(--gold-glow);
}
[data-theme="classic-amber"] .theme-preset-btn.active {
  background: rgba(255, 176, 0, 0.1);
}
[data-theme="green-phosphor"] .theme-preset-btn.active {
  background: rgba(0, 230, 118, 0.1);
}
.theme-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-bottom: 2px;
}
.dot-cyber-brass {
  background: linear-gradient(135deg, #ffd700 50%, #00e5ff 50%);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}
.dot-classic-amber {
  background: linear-gradient(135deg, #ffb000 50%, #ff9800 50%);
  box-shadow: 0 0 6px rgba(255, 176, 0, 0.6);
}
.dot-green-phosphor {
  background: linear-gradient(135deg, #00e676 50%, #00ff66 50%);
  box-shadow: 0 0 6px rgba(0, 230, 118, 0.6);
}
.theme-btn-title {
  font-weight: bold;
  font-size: 0.72rem;
  line-height: 1.2;
}
.theme-btn-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
}


/* ==========================================================================
   Zone 3: K5 Ergonomic Morphing Dock (雙翼變形工學座)
   ========================================================================== */
.va-keyer-dock {
  width: 100%;
  max-width: 1280px;
  background: #141720;
  border-top: 1px solid #232936;
  border-radius: 0 0 12px 12px;
  padding: 8px 16px;
  box-sizing: border-box;
  margin-top: auto;
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.k5-dock-container {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 96px;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.k2-thumb-wing {
  flex: 1.1;
  height: 96px;
  background: linear-gradient(145deg, #1e2635 0%, #11151f 100%);
  border: 1.5px solid #2f3c52;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.08s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}
.k2-thumb-wing.left {
  border-bottom-left-radius: 28px;
  border-left: 3px solid var(--neon-blue);
  border-bottom: 3px solid var(--neon-blue);
  transform-origin: center right;
}
.k2-thumb-wing.right {
  border-bottom-right-radius: 28px;
  border-right: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
  transform-origin: center left;
}
.k2-thumb-wing.active {
  transform: scale(0.97) translateY(2px);
  background: linear-gradient(145deg, #10141c 0%, #07090e 100%);
}
.k2-thumb-wing.left:not(.mode-straight).active {
  transform: scale(0.97) translateY(2px) rotate(-1.5deg);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.55);
}
.k2-thumb-wing.right:not(.mode-straight).active {
  transform: scale(0.97) translateY(2px) rotate(1.5deg);
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.55);
}
.k2-thumb-wing.mode-straight.active {
  transform: scale(0.97) translateY(2px);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(0, 229, 255, 0.3);
}
.k2-thumb-wing.mode-straight.active .k2-wing-symbol {
  color: #fff;
  text-shadow: 0 0 8px #fff, 0 0 16px rgba(255, 215, 0, 0.9), 0 0 24px rgba(0, 229, 255, 0.8);
  animation: contact-spark 0.08s infinite alternate;
}
@keyframes contact-spark {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.08); filter: brightness(1.35) drop-shadow(0 0 6px #00e5ff); }
}
.k2-wing-symbol {
  font-size: 2.2rem;
  font-family: monospace;
  font-weight: 900;
  line-height: 1;
}
.k2-wing-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 2px;
  color: #fff;
}
.k2-wing-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: monospace;
}
.k5-center-smart-island {
  width: 124px;
  height: 96px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
.k5-device-capsule {
  display: flex;
  gap: 2px;
  background: #090c12;
  border: 1px solid #283344;
  border-radius: 12px;
  padding: 2px;
  width: 100%;
  box-sizing: border-box;
}
.k5-dev-pill {
  flex: 1;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.12s;
  padding: 0;
}
.k5-dev-pill:hover {
  color: #fff;
}
.k5-dev-pill.active {
  background: #1e2430;
  color: var(--gold);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.k5-island-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}
.k2-island-pill {
  background: #090c12;
  border: 1px solid #283344;
  border-radius: 14px;
  padding: 2px 6px;
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}
.k2-island-btn {
  background: #1a1e28;
  border: 1px solid #2e3648;
  color: #cfd6e6;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0;
}
.k2-island-btn:hover {
  border-color: var(--neon-blue);
  color: #fff;
}
.k5-rev-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #090c12;
  border: 1px solid #283344;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  transition: all 0.12s;
  padding: 0;
  flex-shrink: 0;
}
.k5-rev-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.k5-rev-btn.active {
  background: #252010;
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}
.k5-mode-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
}


/* ==========================================================================
   Zone 2: Focus HUD Stage & A3 Center Radar Halo
   ========================================================================== */
.focus-hud-stage {
  width: 100%;
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 40%, #151a24 0%, #0d1017 100%);
  border: 1px solid #232a38;
  border-radius: 12px;
  margin-bottom: 12px;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
}
.a3-halo-stage {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.a3-halo-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.halo-bg-ring {
  fill: none;
  stroke: #18202d;
  stroke-width: 6;
}
.halo-press-arc {
  fill: none;
  stroke: var(--neon-blue);
  stroke-width: 6;
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.04s linear;
}
.halo-gap-arc {
  fill: none;
  stroke: #2c394c;
  stroke-width: 6;
  stroke-dasharray: 534;
  stroke-dashoffset: 534;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.04s linear;
}
.halo-gate-dot {
  fill: var(--gold);
  transition: transform 0.1s;
}
.halo-gate-dot.gate-3t {
  fill: #ffd700;
}
.halo-gate-dot.gate-7t {
  fill: #00e5ff;
}
.a3-halo-inner {
  text-align: center;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hud-char-large {
  font-size: 4.6rem;
  font-weight: 900;
  color: var(--gold);
  font-family: monospace;
  line-height: 0.95;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}
.hud-seq-code {
  font-size: 1.3rem;
  color: var(--neon-blue);
  font-family: monospace;
  letter-spacing: 4px;
  margin-top: 4px;
  min-height: 24px;
}
.hud-status-line {
  font-size: 0.82rem;
  font-family: monospace;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 20px;
  text-align: center;
}
.hud-committed-stream {
  background: #090c12;
  border: 1px solid #232a38;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 2px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cfd6e6;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  max-width: 540px;
  width: 100%;
  margin-top: 10px;
  box-sizing: border-box;
  word-break: break-all;
}


/* ==========================================================================
   Stage View Switcher (Tree View / Focus HUD / Telemetry View)
   ========================================================================== */
.stage-view-switcher {
  display: flex;
  gap: 6px;
  background: #0b0c10;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #232936;
  margin-top: 10px;
}
.stage-view-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.stage-view-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.stage-view-btn.active {
  background: #1e2430;
  color: var(--neon-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* Mobile & Portrait Adaptation (375px - 768px) */
@media (max-width: 768px) {
  .va-topbar {
    width: 100%;
    border-radius: 0;
    margin: 0 0 6px 0;
    border-left: none;
    border-right: none;
    padding: 0 8px;
    height: 48px;
    gap: 4px;
  }
  .va-brand {
    gap: 6px;
    flex-shrink: 0;
  }
  .brand-mark {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  .va-title {
    font-size: 0.86rem;
    gap: 4px;
    white-space: nowrap;
  }
  .va-title-en {
    display: none;
  }
  .va-workspace-nav {
    gap: 2px;
    padding: 2px;
    flex-shrink: 0;
  }
  .va-ws-btn {
    padding: 4px 6px;
    font-size: 0.72rem;
    gap: 3px;
    white-space: nowrap;
  }
  .ws-btn-sub {
    display: none;
  }
  .va-topbar-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar-wpm-pill {
    font-size: 0.72rem;
    padding: 2px 6px;
    white-space: nowrap;
  }
  .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }
  .k5-dock-container {
    gap: 6px;
    padding: 0 6px;
  }
  .k2-thumb-wing {
    min-width: 80px;
    padding: 6px 4px;
    touch-action: none;
  }
  .k2-wing-symbol {
    font-size: 1.5rem;
  }
  .k2-wing-title {
    font-size: 0.75rem;
  }
  .k2-wing-hint {
    display: none;
  }
  #k5-center-island,
  .k5-center-smart-island {
    padding: 4px 6px;
    touch-action: none;
  }
  .settings-drawer {
    max-width: 100%;
    border-left: none;
    border-right: none;
  }
}

@media (max-width: 380px) {
  .va-topbar {
    padding: 0 4px;
    gap: 2px;
  }
  .va-title {
    font-size: 0.8rem;
  }
  .va-ws-btn {
    padding: 3px 4px;
    font-size: 0.68rem;
  }
  .topbar-wpm-pill {
    padding: 2px 4px;
    font-size: 0.68rem;
  }
}
