:root {
  color-scheme: dark;
  --bg: #03070b;
  --bg-grid: rgba(0, 240, 255, 0.024);
  --sidebar: #050a10;
  --panel: #070e17;
  --panel-hi: #0b1624;
  --panel-soft: #050b12;
  --border-neon: rgba(0, 240, 255, 0.16);
  --border-subtle: rgba(0, 240, 255, 0.07);
  --line: rgba(0, 240, 255, 0.12);
  --line-soft: rgba(140, 180, 210, 0.08);

  /* 主題色系：螢光綠 + 電光青為主，紫/琥珀為輔，負值為紅/洋紅 */
  --neon-green: #00ff9d;
  --neon-green-glow: rgba(0, 255, 157, 0.35);
  --neon-green-soft: rgba(0, 255, 157, 0.1);
  --neon-cyan: #00f0ff;
  --neon-cyan-glow: rgba(0, 240, 255, 0.35);
  --neon-cyan-soft: rgba(0, 240, 255, 0.09);
  --neon-amber: #ffb020;
  --neon-amber-soft: rgba(255, 176, 32, 0.12);
  --neon-purple: #b388ff;
  --neon-purple-soft: rgba(179, 136, 255, 0.12);
  --neon-red: #ff2a55;
  --neon-red-glow: rgba(255, 42, 85, 0.35);
  --neon-red-soft: rgba(255, 42, 85, 0.11);

  /* 文字階層 */
  --text: #f0f6fc;
  --text-dim: #cad8e6;
  --muted: #8397aa;
  --quiet: #506477;

  /* 字體族群：本機系統等寬字與無襯線繁中字 */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Monaco, Consolas, "Liberation Mono", monospace;

  --sidebar-width: 252px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  background-color: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, rgba(0, 240, 255, 0.05), transparent 60%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* 細掃描光紋理 (Scanlines) */
.app-shell::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12),
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.55;
  z-index: 99;
}

button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }

/* 鍵盤焦點輪廓 */
:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
  box-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* 應用程式主外框 */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ========== 側邊欄 (SIDEBAR) ========== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 22px 14px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-neon);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

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

.brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(0, 255, 157, 0.35);
  background: rgba(0, 255, 157, 0.08);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.2);
}

.brand-mark span {
  width: 4px;
  border-radius: 2px;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green-glow);
}

.brand-mark span:nth-child(1) { height: 9px; opacity: 0.6; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: 0.85; }

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.5px;
  color: #fff;
}

.brand-copy strong span {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green-glow);
}

.brand-copy small {
  margin-top: 4px;
  color: var(--quiet);
  font: 8px/1 var(--mono);
  letter-spacing: 1.3px;
}

.side-caption {
  padding: 0 10px 8px;
  color: var(--quiet);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font: 8px/1 var(--mono);
  font-weight: 700;
}

.side-caption-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-nav {
  display: grid;
  gap: 3px;
}

.nav-link {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  transition: all 0.16s ease;
}

.nav-link:hover {
  background: rgba(0, 240, 255, 0.04);
  color: var(--text);
  border-color: rgba(0, 240, 255, 0.15);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 255, 157, 0.14), rgba(0, 255, 157, 0.02));
  border-color: rgba(0, 255, 157, 0.25);
  box-shadow: inset 3px 0 var(--neon-green), 0 0 14px rgba(0, 255, 157, 0.1);
}

.nav-icon {
  width: 16px;
  color: var(--neon-cyan);
  font-size: 15px;
  text-align: center;
}

.nav-link.active .nav-icon {
  color: var(--neon-green);
}

.nav-count {
  margin-left: auto;
  color: var(--quiet);
  font: 9px var(--mono);
}

.sidebar-divider {
  height: 1px;
  margin: 18px 6px 16px;
  background: var(--line);
}

.live-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--neon-green);
  font: 8px var(--mono);
  letter-spacing: 0.8px;
}

.live-mini i, .status-dot, .foot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}

.sidebar-watchlist {
  display: grid;
  gap: 3px;
  overflow-y: auto;
  max-height: calc(100vh - 430px);
}

.side-asset {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: all 0.15s;
}

.side-asset:hover {
  background: var(--panel);
  border-color: rgba(0, 240, 255, 0.2);
}

.side-asset.selected {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(0, 240, 255, 0.02));
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: inset 3px 0 var(--neon-cyan), 0 0 12px rgba(0, 240, 255, 0.1);
}

.asset-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: #04080e;
  font-size: 11px;
  font-weight: 800;
}

.asset-icon.btc { background: var(--neon-amber); box-shadow: 0 0 8px var(--neon-amber-soft); }
.asset-icon.eth { background: var(--neon-purple); box-shadow: 0 0 8px var(--neon-purple-soft); }
.asset-icon.sol { background: #3be8b0; box-shadow: 0 0 8px rgba(59, 232, 176, 0.2); }
.asset-icon.bnb { background: #f3c74f; box-shadow: 0 0 8px rgba(243, 199, 79, 0.2); }
.asset-icon.xrp { background: #96bbdc; box-shadow: 0 0 8px rgba(150, 187, 220, 0.2); }
.asset-icon.doge { background: #edd978; box-shadow: 0 0 8px rgba(237, 217, 120, 0.2); }

.side-asset-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.side-asset-label strong {
  font-size: 11px;
  font-weight: 650;
  color: #eaf1f8;
}

.side-asset-label small {
  color: var(--quiet);
  font: 9px var(--mono);
}

.side-asset-change {
  font: 10px var(--mono);
  font-weight: 600;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
}

.privacy-card {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.035);
}

.privacy-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 5px;
  height: 5px;
  border-top: 2px solid var(--neon-cyan);
  border-left: 2px solid var(--neon-cyan);
}

.privacy-icon {
  color: var(--neon-cyan);
  font-size: 14px;
  padding-top: 2px;
}

.privacy-card strong {
  font-size: 10px;
  font-weight: 700;
  color: #d8e5f2;
}

.privacy-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 4px 0;
  color: var(--quiet);
  font: 8px var(--mono);
  letter-spacing: 0.3px;
}

.sidebar-foot .foot-dot {
  width: 5px;
  height: 5px;
}

/* ========== 主要內容區域 (MAIN CONTENT) ========== */
.main-content {
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 7, 11, 0.93);
  backdrop-filter: blur(16px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--quiet);
  font: 10px var(--mono);
  letter-spacing: 0.6px;
}

.breadcrumb b {
  color: #273b4d;
  font-weight: 400;
}

.breadcrumb strong {
  color: var(--neon-cyan);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(0, 255, 157, 0.25);
  border-radius: 20px;
  color: #90f5cb;
  background: rgba(0, 255, 157, 0.06);
  font: 9px var(--mono);
  letter-spacing: 0.4px;
}

.connection-badge[data-state="loading"] {
  color: var(--neon-amber);
  border-color: rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.06);
}

.connection-badge[data-state="error"] {
  color: var(--neon-red);
  border-color: rgba(255, 42, 85, 0.3);
  background: rgba(255, 42, 85, 0.07);
}

.connection-badge[data-state="stale"] {
  color: #e2b877;
  border-color: rgba(226, 184, 119, 0.3);
  background: rgba(226, 184, 119, 0.06);
}

.connection-badge[data-state="loading"] .status-dot {
  background: var(--neon-amber);
  box-shadow: none;
  animation: pulse 1s infinite;
}

.connection-badge[data-state="error"] .status-dot {
  background: var(--neon-red);
  box-shadow: 0 0 6px var(--neon-red);
}

.connection-badge[data-state="stale"] .status-dot {
  background: #e2b877;
  box-shadow: none;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.density-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.03);
  color: #a4b7c8;
  font: 9px var(--mono);
  transition: all 0.15s;
}

.density-button:hover {
  color: var(--text);
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.07);
}

.terminal-badge {
  display: grid;
  place-items: center;
  height: 25px;
  padding: 0 8px;
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-radius: 4px;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.07);
  font: 8px var(--mono);
  letter-spacing: 1px;
}

/* ========== 頁面主體 (PAGE WRAP) ========== */
.page-wrap {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 32px 24px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--neon-cyan);
  font: 9px var(--mono);
  letter-spacing: 1.2px;
}

.eyebrow-line {
  width: 18px;
  height: 1px;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan-glow);
}

.read-only-pill {
  padding: 2px 5px;
  border: 1px solid rgba(0, 255, 157, 0.35);
  border-radius: 3px;
  color: var(--neon-green);
  font-size: 8px;
  letter-spacing: 0.8px;
}

h1 {
  margin: 6px 0 3px;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.6px;
  color: #fff;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.updated-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 130px;
}

.updated-label {
  color: var(--quiet);
  font: 8px var(--mono);
  letter-spacing: 0.5px;
}

.updated-block strong {
  color: #b7c8d7;
  font: 10px var(--mono);
  font-weight: 500;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.05);
  color: #e1edf6;
  font: 10px var(--mono);
  transition: all 0.16s;
}

.refresh-button:hover {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 14px var(--neon-cyan-glow);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.refresh-glyph {
  color: var(--neon-cyan);
  font-size: 15px;
  line-height: 1;
}

.refresh-button.is-loading .refresh-glyph {
  animation: rotate 0.8s linear infinite;
}

/* 分區小眉題列 (SECTION KICKER BAR) */
.section-kicker-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.kicker-tag {
  padding: 2px 6px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 3px;
  color: var(--neon-cyan);
  font: 8px var(--mono);
  letter-spacing: 1.1px;
}

.kicker-title {
  color: var(--quiet);
  font: 9px var(--mono);
  letter-spacing: 0.5px;
}

/* ========== 現貨行情快照 (MARKET RIBBON) ========== */
.market-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ribbon-card {
  position: relative;
  min-height: 106px;
  padding: 13px 15px 11px;
  border: 1px solid var(--border-neon);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(8, 16, 26, 0.95), rgba(4, 9, 15, 0.97));
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

/* 角落刻線 (Corner ticks) */
.ribbon-card::before, .ribbon-card::after,
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  pointer-events: none;
  z-index: 2;
}

.ribbon-card::before, .panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--neon-cyan);
  border-left: 2px solid var(--neon-cyan);
}

.ribbon-card::after, .panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--neon-cyan);
  border-right: 2px solid var(--neon-cyan);
}

.ribbon-primary {
  border-color: rgba(0, 255, 157, 0.25);
  background: radial-gradient(ellipse at 95% 5%, rgba(0, 255, 157, 0.08), transparent 50%),
              linear-gradient(145deg, #091a18, #050e14 75%);
}

.ribbon-primary::before {
  border-color: var(--neon-green);
}
.ribbon-primary::after {
  border-color: var(--neon-green);
}

.ribbon-top, .ribbon-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ribbon-top {
  color: var(--muted);
  font: 9px var(--mono);
  letter-spacing: 0.5px;
}

.asset-chip, .ribbon-symbol, .source-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
}

.btc-chip {
  color: var(--neon-amber);
  background: var(--neon-amber-soft);
  box-shadow: 0 0 6px var(--neon-amber-soft);
}

.eth-chip {
  color: var(--neon-purple);
  background: var(--neon-purple-soft);
  box-shadow: 0 0 6px var(--neon-purple-soft);
}

.ribbon-symbol {
  color: var(--neon-green);
  background: var(--neon-green-soft);
}

.source-mark {
  color: #e5b252;
  border: 1px solid rgba(229, 178, 82, 0.3);
  font: bold 10px var(--mono);
}

.ribbon-value {
  overflow: hidden;
  margin-top: 6px;
  color: #f6fbff;
  font: 21px/1.25 var(--mono);
  font-weight: 700;
  letter-spacing: -0.6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ribbon-value small {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 400;
}

.ribbon-foot {
  justify-content: flex-start;
  gap: 10px;
  margin-top: 7px;
}

.change-positive, .change-negative, .change-neutral {
  font: 10px var(--mono);
  font-weight: 600;
}

.change-positive {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0, 255, 157, 0.4);
}

.change-negative {
  color: var(--neon-red);
  text-shadow: 0 0 8px rgba(255, 42, 85, 0.4);
}

.change-neutral {
  color: var(--quiet);
}

.ribbon-caption {
  color: var(--quiet);
  font: 8px var(--mono);
}

.source-name {
  margin-top: 7px;
  color: #e3ebf1;
  font-size: 13px;
  font-weight: 600;
}

.source-lock {
  color: #d1ab55;
  font-size: 11px;
}

/* ========== 主網格 (PRIMARY GRID: CHART + MATRIX) ========== */
.primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.88fr) minmax(280px, 0.94fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border-neon);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(8, 15, 24, 0.98), rgba(4, 9, 15, 0.99));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.chart-panel, .movers-panel {
  min-height: 360px;
  padding: 16px 18px 12px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-kicker {
  color: var(--neon-cyan);
  font: 8px var(--mono);
  letter-spacing: 1.2px;
  opacity: 0.85;
}

.panel-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  color: #e8f0f6;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

#chartSymbolBadge, .matrix-badge {
  padding: 2px 6px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 3px;
  color: var(--neon-cyan);
  font: 8px var(--mono);
  letter-spacing: 0.5px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 2px;
}

.range-switch {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: #04090e;
}

.range-button {
  min-width: 36px;
  height: 23px;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--quiet);
  font: 9px var(--mono);
  transition: all 0.15s;
}

.range-button.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.range-button:hover {
  color: var(--text);
}

.chart-type-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font: 8px var(--mono);
  white-space: nowrap;
}

.chart-type-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
}

/* 圖表數據列 (CHART TELEMETRY ROW) */
.chart-telemetry-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.chart-price-block {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.chart-price-block strong {
  color: #fff;
  font: 23px/1.2 var(--mono);
  font-weight: 700;
  letter-spacing: -0.8px;
}

.chart-unit {
  color: var(--quiet);
  font: 8px var(--mono);
}

.chart-ohlc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font: 9px var(--mono);
  color: var(--quiet);
}

.ohlc-item b {
  color: #d1dfec;
  font-weight: 600;
}

.chart-stage {
  position: relative;
  height: 226px;
  margin-top: 6px;
}

#priceChart {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font: 10px var(--mono);
  pointer-events: none;
}

.chart-placeholder[hidden] {
  display: none;
}

.loading-orbit {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(0, 240, 255, 0.2);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

.small-orbit {
  width: 11px;
  height: 11px;
  vertical-align: -2px;
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  padding: 4px 2px 0;
  color: var(--quiet);
  font: 8px var(--mono);
}

.chart-source-note {
  color: #4b6277;
}

/* ========== 6 幣種市場強弱矩陣 (MOVERS PANEL) ========== */
.movers-panel {
  display: flex;
  flex-direction: column;
}

.panel-menu-mark {
  color: var(--neon-cyan);
  font-size: 14px;
  opacity: 0.7;
}

.movers-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font: 9px var(--mono);
}

.movers-summary span:last-child {
  color: #c9d8e4;
  font-weight: 600;
}

.movers-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  flex: 1 1 auto;
}

.matrix-item {
  display: grid;
  grid-template-columns: 24px 72px 1fr 64px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(0, 240, 255, 0.02);
  cursor: pointer;
  transition: all 0.14s ease;
}

.matrix-item:hover {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.2);
}

.matrix-item.selected {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(0, 240, 255, 0.02));
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: inset 3px 0 var(--neon-cyan);
}

.matrix-rank {
  color: var(--quiet);
  font: 8px var(--mono);
  font-weight: 700;
}

.matrix-asset {
  display: flex;
  align-items: center;
  gap: 6px;
}

.matrix-asset .asset-icon {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.matrix-names {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.matrix-names strong {
  color: #e4edf4;
  font: 10px var(--mono);
  font-weight: 650;
}

.matrix-names small {
  color: var(--quiet);
  font-size: 8px;
}

.matrix-meter-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.matrix-meter-track {
  width: 100%;
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.matrix-meter-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.35s ease;
}

.meter-pos {
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green-glow);
}

.meter-neg {
  background: var(--neon-red);
  box-shadow: 0 0 8px var(--neon-red-glow);
}

.meter-neutral {
  background: var(--quiet);
}

.matrix-meter-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 8px var(--mono);
}

.matrix-price {
  color: #8da2b3;
}

.matrix-status {
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 7px;
  letter-spacing: 0.3px;
}

.status-bull {
  color: var(--neon-green);
  background: var(--neon-green-soft);
}

.status-bear {
  color: var(--neon-red);
  background: var(--neon-red-soft);
}

.status-neutral {
  color: var(--quiet);
  background: rgba(255, 255, 255, 0.05);
}

.matrix-delta {
  text-align: right;
  font: 10px var(--mono);
  font-weight: 700;
}

.movers-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--quiet);
  font: 8px var(--mono);
  line-height: 1.4;
}

.note-icon {
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 1px solid #3c4f60;
  border-radius: 50%;
  font: 8px var(--mono);
  flex-shrink: 0;
}

.list-empty {
  padding: 24px 0;
  color: var(--quiet);
  font: 9px var(--mono);
  text-align: center;
}

/* ========== 自選行情看板表格 (WATCHLIST TABLE) ========== */
.watchlist-panel {
  margin-bottom: 14px;
  overflow: hidden;
}

.watchlist-heading {
  align-items: center;
  padding: 14px 18px 11px;
}

.watchlist-heading h2 {
  font-size: 13px;
}

.watch-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 4px;
  color: var(--neon-cyan);
  font: 8px var(--mono);
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--quiet);
  font: 8px var(--mono);
}

.table-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a4b5c4;
}

.table-source i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
}

.sort-label {
  padding: 4px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.02);
}

.sort-label b {
  margin-left: 4px;
  color: var(--neon-cyan);
  font-weight: 400;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.market-table thead {
  background: rgba(0, 240, 255, 0.02);
}

.market-table th {
  height: 32px;
  padding: 0 12px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--quiet);
  font: 8px var(--mono);
  font-weight: 600;
  letter-spacing: 0.6px;
  text-align: right;
}

.market-table th:first-child {
  padding-left: 18px;
  text-align: left;
}

.market-table td {
  height: 48px;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.05);
  color: #b9c8d5;
  font: 10px var(--mono);
  text-align: right;
  transition: background 0.12s;
}

.market-table tbody tr:last-child td {
  border-bottom: 0;
}

.market-table tbody tr {
  cursor: pointer;
}

.market-table tbody tr:hover td {
  background: rgba(0, 240, 255, 0.045);
}

.market-table tbody tr.selected td {
  background: rgba(0, 240, 255, 0.075);
}

.market-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 var(--neon-cyan);
}

.market-table td:first-child {
  padding-left: 18px;
  text-align: left;
}

.asset-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.asset-cell .asset-icon {
  width: 25px;
  height: 25px;
}

.asset-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.asset-name strong {
  color: #e5edf4;
  font: 11px var(--font);
  font-weight: 650;
}

.asset-name small {
  color: var(--quiet);
  font: 8px var(--mono);
}

.price-cell {
  color: #fff !important;
  font-weight: 700 !important;
}

.num-cell {
  color: #cbd8e4;
}

.table-change-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}

.table-change-pill.change-positive {
  background: var(--neon-green-soft);
}

.table-change-pill.change-negative {
  background: var(--neon-red-soft);
}

.range-meter-cell {
  min-width: 110px;
}

.range-meter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-bound {
  font: 8px var(--mono);
  color: var(--quiet);
}

.range-meter-track {
  position: relative;
  flex: 1 1 auto;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.range-meter-thumb {
  position: absolute;
  top: -2px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.trend-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font: 8px var(--mono);
}

.trend-tag.change-positive {
  background: var(--neon-green-soft);
}

.trend-tag.change-negative {
  background: var(--neon-red-soft);
}

.trend-tag.change-neutral {
  background: rgba(255, 255, 255, 0.05);
}

.empty-row td {
  height: 90px;
  text-align: center !important;
  color: var(--muted) !important;
  font-family: var(--font) !important;
}

.error-row td {
  color: var(--neon-red) !important;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--quiet);
  font: 8px var(--mono);
}

.table-footer span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-footer .foot-dot {
  width: 5px;
  height: 5px;
}

/* ========== 頁面頁腳 (PAGE FOOTER) ========== */
.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 2px 0;
  color: #485c6f;
  font: 8px var(--mono);
  letter-spacing: 0.3px;
}

.page-footer b {
  color: var(--neon-green);
}

/* ========== 快訊提示 (TOAST) ========== */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 32px));
  padding: 10px 14px;
  transform: translateY(12px);
  opacity: 0;
  border: 1px solid var(--border-neon);
  border-radius: 6px;
  background: #08121d;
  color: #e5eff8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 240, 255, 0.15);
  font: 10px var(--mono);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ========== 緊湊顯示模式 (DENSITY COMPACT) ========== */
body.density-compact .page-wrap {
  padding-top: 18px;
}

body.density-compact .market-ribbon {
  gap: 8px;
  margin-bottom: 10px;
}

body.density-compact .ribbon-card {
  min-height: 90px;
  padding: 10px 12px 8px;
}

body.density-compact .ribbon-value {
  font-size: 18px;
  margin-top: 4px;
}

body.density-compact .chart-stage {
  height: 198px;
}

body.density-compact .chart-panel,
body.density-compact .movers-panel {
  min-height: 320px;
  padding: 12px 14px 10px;
}

body.density-compact .market-table td {
  height: 38px;
  padding: 2px 10px;
}

body.density-compact .matrix-item {
  padding: 4px 6px;
}

/* ========== 動畫與減弱動態宣告 ========== */
@keyframes rotate {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .app-shell::after {
    display: none !important;
  }
}

/* ========== 響應式佈局 (RESPONSIVE BREAKPOINTS) ========== */
@media (min-width: 1600px) {
  .page-wrap { padding-top: 32px; }
  .chart-stage { height: 245px; }
}

@media (max-width: 1200px) {
  :root { --sidebar-width: 220px; }
  .page-wrap { padding-right: 22px; padding-left: 22px; }
  .topbar { padding-right: 22px; padding-left: 22px; }
  .primary-grid { grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.9fr); }
  .chart-stage { height: 210px; }
  .market-table th, .market-table td { padding-right: 9px; padding-left: 9px; }
  .market-table th:first-child, .market-table td:first-child { padding-left: 14px; }
}

@media (max-width: 960px) {
  :root { --sidebar-width: 64px; }
  .sidebar { align-items: center; padding: 16px 8px 12px; }
  .brand { padding: 0 0 20px; }
  .brand-copy,
  .side-caption,
  .nav-link > span:not(.nav-icon),
  .sidebar-divider,
  .sidebar-watchlist,
  .privacy-card,
  .sidebar-foot { display: none; }
  .main-nav { width: 100%; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link .nav-icon { font-size: 18px; }
  .nav-count { display: none; }
  .sidebar-bottom { display: none; }
  .primary-grid { grid-template-columns: minmax(0, 1.5fr) minmax(230px, 0.8fr); }
  .page-wrap { padding: 20px 16px 18px; }
  .topbar { padding: 0 16px; }
  .market-ribbon { gap: 8px; }
  .ribbon-card { padding-right: 11px; padding-left: 11px; }
  .ribbon-value { font-size: 17px; }
}

@media (max-width: 720px) {
  .topbar { height: 48px; padding: 0 14px; }
  .topbar-actions { gap: 8px; }
  .breadcrumb { font-size: 9px; }
  .connection-badge { padding: 4px 7px; font-size: 8px; }
  .density-button span { display: none; }
  .page-wrap { padding: 18px 12px 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-heading p { max-width: 400px; font-size: 10px; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .updated-block { align-items: flex-start; }
  .market-ribbon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ribbon-card { min-height: 94px; }
  .primary-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-panel { min-height: 330px; }
  .movers-panel { min-height: 300px; }
  .chart-stage { height: 200px; }
  .watchlist-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .table-tools { width: 100%; justify-content: space-between; }
  .market-table { min-width: 750px; }
  .market-table th:first-child, .market-table td:first-child { padding-left: 14px; }
  .table-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .page-footer { flex-direction: column; gap: 4px; padding-left: 2px; }
}

@media (max-width: 400px) {
  :root { --sidebar-width: 50px; }
  .sidebar { padding-right: 4px; padding-left: 4px; }
  .page-wrap { padding-right: 8px; padding-left: 8px; }
  .topbar { padding-right: 10px; padding-left: 10px; }
  .topbar-actions { gap: 5px; }
  .terminal-badge { display: none; }
  .chart-panel, .movers-panel { padding-right: 10px; padding-left: 10px; }
  .chart-controls { gap: 6px; }
  .chart-type-label { font-size: 7px; }
}
