/* DanClub Terminal — Institutional Precision Multi-Market UI (MIT License) */

:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #0f131b;
  --surface-2: #151b26;
  --surface-hover: #1b2333;
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #eef2f6;
  --text-2: #c5cedb;
  --muted: #7c899e;
  --faint: #556277;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.11);
  --accent-border: rgba(56, 189, 248, 0.28);

  /* Market directional colors (default: intl green-up / red-down) */
  --up: #10b981;
  --up-bg: rgba(16, 185, 129, 0.13);
  --down: #f43f5e;
  --down-bg: rgba(244, 63, 94, 0.13);

  /* Invariant status/risk colors */
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.13);
  --risk: #f43f5e;
  --risk-bg: rgba(244, 63, 94, 0.14);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --cushion: #38bdf8;
  --cushion-bg: rgba(56, 189, 248, 0.13);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.13);

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-hover: #eef2f7;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0b1220;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.09);
  --accent-border: rgba(2, 132, 199, 0.28);

  --up: #059669;
  --up-bg: rgba(5, 150, 105, 0.1);
  --down: #e11d48;
  --down-bg: rgba(225, 29, 72, 0.1);

  --ok: #059669;
  --ok-bg: rgba(5, 150, 105, 0.1);
  --risk: #e11d48;
  --risk-bg: rgba(225, 29, 72, 0.1);
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, 0.11);
  --cushion: #0284c7;
  --cushion-bg: rgba(2, 132, 199, 0.1);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.1);

  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.03);
}

/* CN color convention toggle (red-up / green-down) */
[data-color-mode="cn"] {
  --up: #f43f5e;
  --up-bg: rgba(244, 63, 94, 0.13);
  --down: #10b981;
  --down-bg: rgba(16, 185, 129, 0.13);
}

[data-theme="light"][data-color-mode="cn"] {
  --up: #e11d48;
  --up-bg: rgba(225, 29, 72, 0.1);
  --down: #059669;
  --down-bg: rgba(5, 150, 105, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
}

.num, .mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.up { color: var(--up); }
.down { color: var(--down); }
.ok { color: var(--ok); }
.risk { color: var(--risk); }
.warn { color: var(--warn); }
.cushion { color: var(--cushion); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }

/* Sticky Live Market Tape */
.ribbon-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.ribbon-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
}

.ribbon-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  padding-right: 16px;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 16px), transparent 100%);
}

.ribbon-scroll::-webkit-scrollbar {
  display: none;
}

.ribbon-divider {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
  flex: 0 0 auto;
  margin: 0 2px;
}

.tick-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px 5.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: border-color 0.25s, background 0.25s;
}

.tick-pill.flash-up {
  border-color: var(--up);
  background: var(--up-bg);
}

.tick-pill.flash-down {
  border-color: var(--down);
  background: var(--down-bg);
}

.tick-pill .sym {
  font-weight: 700;
  color: var(--text);
}

.tick-pill .px {
  color: var(--text-2);
  font-weight: 600;
}

.tick-pill .chg {
  font-weight: 600;
  font-size: 11px;
}

.tick-pill .sess {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.ribbon-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
  padding-left: 4px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
}

.pulse-dot.stale {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-bg);
}

/* Header & Navigation */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.meta-chip {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
  text-decoration: none;
}

.btn-compact {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-accent-ghost {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-accent-ghost:hover {
  background: var(--accent);
  color: #080b10;
}

.btn-primary {
  background: var(--accent);
  color: #080b10;
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.9;
  background: var(--accent);
  color: #080b10;
}

.nav-shell {
  position: relative;
}

.nav-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-right: 20px;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--risk);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.nav-badge[hidden] {
  display: none;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Main Shell */
.main-shell {
  padding-top: 16px;
  padding-bottom: 44px;
}

.tab-panel {
  display: none;
  gap: 14px;
  flex-direction: column;
}

.tab-panel.active {
  display: flex;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

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

.wrap-head {
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.card-note {
  margin: 0 0 11px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.subhead {
  margin: 14px 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}

/* Pills & Tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}

.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill-risk { background: var(--risk-bg); color: var(--risk); border-color: transparent; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill-cushion { background: var(--cushion-bg); color: var(--cushion); border-color: transparent; }
.pill-violet { background: rgba(168, 85, 247, 0.16); color: #c084fc; border-color: transparent; }
[data-theme="light"] .pill-violet { background: rgba(147, 51, 234, 0.11); color: #7e22ce; }
.pill-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

/* 5-Second Market Regime & Desk Radar Strip */
.regime-card {
  padding: 14px 16px;
  border-color: var(--line-strong);
}

.regime-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.regime-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.regime-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.regime-badge.danger { background: var(--risk-bg); color: var(--risk); }
.regime-badge.warn { background: var(--warn-bg); color: var(--warn); }
.regime-badge.bullish { background: var(--ok-bg); color: var(--ok); }
.regime-badge.neutral { background: var(--info-bg); color: var(--info); }

.regime-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-2);
}

.regime-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.regime-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.regime-chip b {
  color: var(--text);
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.signal-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.signal-card:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.signal-card.sev-danger { border-left-color: var(--risk); }
.signal-card.sev-warn { border-left-color: var(--warn); }
.signal-card.sev-opportunity { border-left-color: var(--cushion); }
.signal-card.sev-info { border-left-color: var(--info); }

.signal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.signal-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.signal-metric {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 750;
}

.signal-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-detail {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Layout Grids */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.grid-2-wide {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.stack-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* KPI Cards */
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
}

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

.kpi-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.kpi-scope {
  font-size: 10px;
  color: var(--faint);
  font-family: var(--mono);
}

.kpi-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seg-bar {
  display: flex;
  gap: 3px;
  height: 5px;
  margin-top: 2px;
}

.seg-bar span {
  flex: 1;
  border-radius: 2px;
  background: var(--line-strong);
}

.seg-bar span.g { background: var(--ok); }
.seg-bar span.y { background: var(--warn); }
.seg-bar span.r { background: var(--risk); }

.fng-track {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--risk) 0%, var(--warn) 45%, var(--ok) 100%);
  margin-top: 2px;
  opacity: 0.85;
}

.fng-needle {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
}

/* Bottom Dashboard Items */
.bottom-list {
  display: grid;
  gap: 8px;
}

.bottom-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.bottom-item .b-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.bottom-item .b-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.brief-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-line;
}

.miner-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.miner-tile {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.miner-tile span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.miner-tile strong {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

/* Macro Matrix */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.macro-tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}

.macro-left {
  min-width: 0;
}

.macro-sym-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.macro-sym {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

.sess-tag {
  font-size: 9.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
  white-space: nowrap;
}

.macro-name {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.macro-dd {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.macro-right {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.macro-px {
  font-size: 13px;
  font-weight: 700;
}

.macro-chg {
  font-size: 11.5px;
  font-weight: 650;
}

.macro-ext {
  font-size: 10px;
  color: var(--muted);
}

/* Segmented Controls */
.seg-group {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s;
}

.seg-sm .seg-btn {
  font-size: 11.5px;
  padding: 4px 8px;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .seg-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Spread / Stat Tiles / Chart Canvas */
.spread-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-tile {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.stat-tile small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.stat-tile strong {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.stat-tile span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chart-box {
  position: relative;
  width: 100%;
  min-height: 256px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 8px 6px;
  overflow: hidden;
}

.chart-box.chart-sm {
  min-height: 196px;
}

.chart-box.chart-xs {
  min-height: 132px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 8px 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-svg {
  display: block;
  width: 100%;
  touch-action: pan-y;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11.5px;
  font-family: var(--mono);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  white-space: nowrap;
  z-index: 10;
  display: none;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface-2);
}

.data-table th:first-child { border-top-left-radius: 5px; }
.data-table th:last-child { border-top-right-radius: 5px; }

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.row-highlight {
  background: var(--accent-soft);
}

.row-risk {
  background: var(--risk-bg);
}

.dca-best {
  font-weight: 700;
  background: var(--accent-soft);
}

.dca-best-tag {
  display: inline-block;
  margin-right: 5px;
  padding: 0 4px;
  border-radius: 3px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.45;
  vertical-align: 1px;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--accent-border);
}

.prem-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.prem-bar {
  display: inline-block;
  width: 34px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  vertical-align: middle;
}

.prem-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

/* Wallet Summary */
.wallet-sum-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.wallet-card {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.wallet-card-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12.5px;
}

.wallet-card-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* DCA & Curated Promos */
.dca-strat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.promo-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.promo-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.promo-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.promo-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.promo-kv {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.promo-k {
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 auto;
  min-width: 36px;
}

.promo-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* High-Signal Wire */
.feed-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.feed-alert-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 11px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.feed-alert-group,
.feed-alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-alert-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.feed-alert-status {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
}

.btn.btn-toggle-active,
.btn.btn-toggle-active:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.pill-tr {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.feed-new-pill {
  background: var(--risk);
  color: #ffffff;
  font-weight: 700;
}

.feed-en-sub {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}

.feed-item.is-fresh {
  border-color: var(--accent-border);
  background: linear-gradient(90deg, var(--accent-soft), var(--surface-2) 52%);
}

.search-input {
  padding: 5px 10px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  min-width: 210px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.feed-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.feed-item {
  min-width: 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  overflow-wrap: anywhere;
}

.feed-item.tone-bearish { border-left-color: var(--risk); }
.feed-item.tone-bullish { border-left-color: var(--ok); }
.feed-item.tone-warn { border-left-color: var(--warn); }

.feed-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.feed-headline {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.feed-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11.5px;
}

.feed-foot .pill {
  white-space: normal;
  max-width: 100%;
}

.feed-ref {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Open API */
.prose p, .prose li {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
}

.prose h3 {
  font-size: 13.5px;
  margin: 14px 0 6px;
  color: var(--text);
}

.prose code {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.api-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.api-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

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

.api-path {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.api-desc {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.code-box {
  margin: 0;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 16px 0 24px;
  font-size: 12px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.skeleton-block {
  height: 58px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes cardPulse {
  0% { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: var(--shadow); }
}

.card-flash {
  animation: cardPulse 1.2s ease-out;
}

/* Tactical War Room & Whale Radar */
.war-arena-card:fullscreen {
  background: #070a10;
  padding: 16px 20px;
  border-radius: 0;
  border: 0;
  overflow: auto;
}

.war-arena-card:fullscreen .war-audio-bar,
.war-arena-card:fullscreen .war-legend-row {
  display: none;
}

.war-arena-card:fullscreen .war-chat-rail {
  height: calc(100vh - 156px);
  min-height: 460px;
}

.war-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 5-Nation War Anthem Audio Deck */
.war-audio-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 11px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.btn-war-audio {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.12);
  color: var(--warn);
  font-weight: 700;
}

.btn-war-audio:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--warn);
}

.btn-war-audio.active {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.16);
  color: var(--ok);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.war-track-select {
  height: 29px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.war-vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.war-vol-slider {
  width: 74px;
  accent-color: var(--accent);
  cursor: pointer;
}

.war-now-playing {
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.war-audio-prompt {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.52);
  background: rgba(7, 10, 16, 0.84);
  backdrop-filter: blur(6px);
  color: #fde68a;
  font-size: 11px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(245, 158, 11, 0.18);
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}

.war-audio-prompt:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #ffffff;
  transform: translateX(-50%) translateY(-1px);
}

.war-audio-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}

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

.war-side-lbl {
  font-size: 13px;
  font-weight: 700;
}

.war-power-track {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.war-bar-long {
  background: linear-gradient(90deg, #059669, #10b981);
  transition: width 0.4s ease;
}

.war-bar-short {
  background: linear-gradient(90deg, #f43f5e, #e11d48);
  transition: width 0.4s ease;
}

.war-power-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.war-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: #070a10;
}

#war-canvas {
  display: block;
  width: 100%;
}

.war-legend-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--muted);
}

.war-stats-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.war-div-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.war-factions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.faction-box {
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.faction-pct-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

.faction-bar {
  display: flex;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
}

.faction-bar .f-long { background: var(--ok); }
.faction-bar .f-short { background: var(--risk); }

.faction-foot {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.fleet-entity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ship-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  flex: 0 0 auto;
}

.ship-carrier { background: rgba(245, 158, 11, 0.16); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.32); }
.ship-cruiser { background: var(--cushion-bg); color: var(--cushion); border: 1px solid var(--accent-border); }
.ship-destroyer { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Slide-Over Entity Dossier Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.62);
  backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.whale-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  padding: 18px 20px 28px;
  z-index: 100;
  overflow-y: auto;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(102%);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
}

.whale-drawer.open {
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

.wd-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.wd-head h3 {
  margin: 2px 0 3px;
  font-size: 16px;
}

.wd-head p {
  margin: 0;
}

.wd-pos-list {
  display: grid;
  gap: 8px;
}

.wd-pos-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wd-pos-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.wd-pos-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.wd-pos-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.btn-qq-group {
  border-color: rgba(16, 185, 129, 0.44);
  background: rgba(16, 185, 129, 0.13);
  color: var(--ok);
  font-weight: 700;
}

.btn-qq-group:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--ok);
  text-decoration: none;
}

.btn-x-profile {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.btn-x-profile:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}

.btn-x-profile svg {
  flex: 0 0 auto;
}

.sess-bstock {
  background: rgba(56, 189, 248, 0.16) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(56, 189, 248, 0.34);
  font-weight: 700;
}

.feed-ext-link {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
}

.whale-x-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-decoration: none;
  white-space: nowrap;
}

.whale-x-pill:hover {
  background: rgba(56, 189, 248, 0.24);
  color: #ffffff;
  text-decoration: none;
}

.whale-x-pill-lg {
  padding: 2px 8px;
  font-size: 11.5px;
}

.fleet-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.wd-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wd-pos-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.war-local-btn {
  cursor: pointer;
}

/* War Room Danmaku Toggle, Stage Split & Frontline Message Wall */
.btn-danmaku-toggle.active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  font-weight: 700;
}

.war-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 12px;
  align-items: start;
}

.war-stage-main {
  min-width: 0;
}

.war-arena-card:fullscreen .war-stage-layout {
  grid-template-columns: minmax(0, 1fr);
}

.war-arena-card:fullscreen .war-chat-rail {
  display: none;
}

.war-danmaku-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 8px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.dm-side-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
  flex: 0 0 auto;
}

.dm-side-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.dm-side-btn:hover {
  color: var(--text);
}

.dm-side-btn.active.is-long {
  background: rgba(16, 185, 129, 0.18);
  color: var(--ok);
}

.dm-side-btn.active.is-short {
  background: rgba(244, 63, 94, 0.18);
  color: var(--risk);
}

.dm-side-btn.active.is-neutral {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent);
}

.dm-nick-input,
.dm-text-input {
  height: 30px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  padding: 0 9px;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}

.dm-nick-input:focus,
.dm-text-input:focus {
  border-color: var(--accent);
}

.dm-nick-input {
  width: 96px;
  flex: 0 0 96px;
}

.dm-text-input {
  flex: 1 1 180px;
}

.dm-send-btn {
  flex: 0 0 auto;
  font-weight: 700;
}

.dm-send-btn.is-long {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--ok);
}

.dm-send-btn.is-long:hover:not(:disabled) {
  background: #10b981;
  border-color: #10b981;
  color: #06130e;
}

.dm-send-btn.is-short {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.45);
  color: var(--risk);
}

.dm-send-btn.is-short:hover:not(:disabled) {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
}

.dm-send-btn.is-neutral {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent);
}

.dm-send-btn.is-neutral:hover:not(:disabled) {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #07121b;
}

.dm-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dm-feedback {
  margin-top: 5px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.4;
}

.dm-feedback:empty {
  display: none;
}

.dm-feedback.is-ok {
  color: var(--ok);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.dm-feedback.is-err {
  color: var(--risk);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.dm-feedback.is-warn {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.war-chat-rail {
  height: 479px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  overflow: hidden;
  min-width: 0;
}

.war-rail-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.war-rail-pane[hidden] {
  display: none;
}

/* Real Verified Single-Venue Whale Liquidation Magnet Ruler */
.war-liq-magnet {
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mag-title-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mag-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.mag-src {
  font-size: 10px;
}

.mag-mark {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.mag-alert {
  font-size: 10px;
}

.mag-track-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mag-axis-lbl {
  font-size: 10px;
  color: var(--faint);
  flex: 0 0 auto;
}

.mag-track {
  position: relative;
  flex: 1 1 auto;
  height: 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: visible;
}

.mag-half {
  position: absolute;
  top: 5px;
  height: 4px;
  pointer-events: none;
}

.mag-half-long {
  left: 4px;
  right: 50%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.45));
}

.mag-half-short {
  left: 50%;
  right: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.45), rgba(244, 63, 94, 0.14));
}

.mag-center-pin {
  position: absolute;
  left: 50%;
  top: -1px;
  bottom: -1px;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.75);
  z-index: 3;
}

.mag-ticks {
  position: absolute;
  inset: 0;
}

.mag-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 12px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  cursor: pointer;
  z-index: 4;
  transition: transform 0.12s ease;
}

.mag-tick:hover {
  transform: translate(-50%, -50%) scale(1.25);
  z-index: 6;
}

.mag-tick.is-long {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.mag-tick.is-short {
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.6);
}

.mag-tick.is-danger {
  background: #f59e0b;
  border-color: #ffffff;
  box-shadow: 0 0 9px rgba(245, 158, 11, 0.9);
}

.mag-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  line-height: 1.35;
}

.mag-crowd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 5px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-2);
}

.mag-crowd-metrics {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 24h Hourly Liquidation Rhythm Sparkbar (Up=Long Liq / Down=Short Liq) */
.liq-rhythm-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}

.liq-rhythm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  white-space: nowrap;
}

.liq-rhythm-bars {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 30px;
  padding: 2px 3px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.liq-rhythm-bars::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 1px;
  background: var(--line-strong);
  pointer-events: none;
}

.lr-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.lr-col.is-now {
  background: var(--accent-soft);
  border-radius: 2px;
}

.lr-half {
  flex: 1 1 50%;
  display: flex;
  width: 100%;
}

.lr-half-up {
  align-items: flex-end;
}

.lr-half-dn {
  align-items: flex-start;
}

.lr-bar {
  width: 100%;
  border-radius: 1px;
  min-height: 0;
}

.lr-bar-long {
  background: #10b981;
}

.lr-bar-short {
  background: #f43f5e;
}

/* Right Rail: CoinGlass 10-Exchange Liquidation Scoreboard + Typed Kill Feed */
.liq-board {
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 0 0 auto;
}

.liq-board-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.liq-board-src {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.liq-board-nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
}

.liq-ex-row {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.liq-filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.liq-filter-bar::-webkit-scrollbar {
  display: none;
}

.liq-filter-bar .seg-btn {
  padding: 2px 7px;
  font-size: 11px;
  height: 22px;
}

.liq-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 3px 2px 1px;
  letter-spacing: 0.02em;
}

.liq-item {
  padding: 6px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 2.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.liq-item.kind-liq-long { border-left-color: #10b981; }
.liq-item.kind-liq-short { border-left-color: #f43f5e; }
.liq-item.kind-wick { border-left-color: #f59e0b; }
.liq-item.kind-whale {
  border-left-color: #38bdf8;
  cursor: pointer;
}

.liq-item.kind-whale:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

.liq-item-top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  min-width: 0;
}

.liq-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  height: 16px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  flex: 0 0 auto;
  white-space: nowrap;
}

.liq-tag-long { background: rgba(16, 185, 129, 0.16); color: var(--ok); }
.liq-tag-short { background: rgba(244, 63, 94, 0.16); color: var(--risk); }
.liq-tag-wick { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.liq-tag-whale { background: var(--accent-soft); color: var(--accent); }
.liq-tag-live { background: #f59e0b; color: #090d15; font-weight: 800; }

.liq-ex-pill {
  padding: 0 4px;
  height: 16px;
  line-height: 16px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.liq-coin-lbl {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liq-ts {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  flex: 0 0 auto;
}

.liq-item-body {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.liq-item-body b {
  color: var(--text);
  font-family: var(--mono);
}

/* Compact Chat Form inside Rail Tab #2 */
.war-chat-form {
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 0 0 auto;
}

.war-chat-form-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.war-chat-form .dm-nick-input {
  flex: 1 1 60px;
  width: auto;
  height: 26px;
  font-size: 11.5px;
}

.war-chat-form .dm-text-input {
  flex: 1 1 auto;
  height: 28px;
  font-size: 12px;
}

.seg-group[hidden] {
  display: none;
}

.war-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}

.war-rail-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.seg-xs .seg-btn {
  padding: 2px 7px;
  font-size: 11px;
  height: 22px;
}

.war-rail-pulse {
  padding: 6px 10px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}

.war-rail-pulse-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-bottom: 4px;
}

.war-rail-pulse-track {
  display: flex;
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

.war-msg-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
}

.dm-pin {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.dm-empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 10px;
}

.dm-item {
  padding: 7px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 2.5px;
  transition: border-color 0.15s, background 0.15s;
}

.dm-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.dm-item.is-long { border-left-color: #10b981; }
.dm-item.is-short { border-left-color: #f43f5e; }
.dm-item.is-neutral { border-left-color: #38bdf8; }
.dm-item.is-self { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35); }

.dm-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  margin-bottom: 3px;
  min-width: 0;
}

.dm-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  height: 16px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  flex: 0 0 auto;
}

.dm-badge-long { background: rgba(16, 185, 129, 0.16); color: var(--ok); }
.dm-badge-short { background: rgba(244, 63, 94, 0.16); color: var(--risk); }
.dm-badge-neutral { background: rgba(56, 189, 248, 0.16); color: var(--accent); }
.dm-badge-sys { background: rgba(245, 158, 11, 0.16); color: var(--warn); }

.dm-coin-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0 4px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.dm-nick {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.dm-ts {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  flex: 0 0 auto;
}

.dm-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--mono);
  height: 18px;
  padding: 0 5px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dm-like-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.dm-like-btn.liked {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.dm-item-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
  word-break: break-word;
  cursor: pointer;
}

.war-rail-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
  flex: 0 0 auto;
}

.dm-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  flex: 0 0 auto;
}

.dm-sync-dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ok-bg);
}

.dm-foot-hint {
  margin-left: auto;
  opacity: 0.78;
}

/* Official YouTube Mini Radio PiP */
.war-yt-pip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 240px;
  z-index: 45;
  border-radius: 8px;
  overflow: hidden;
  background: #0b1019;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.war-yt-pip.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.war-yt-pip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  background: #111827;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.war-yt-pip-title {
  font-size: 11px;
  font-weight: 700;
  color: #fde68a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.war-yt-pip-close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.war-yt-pip-close:hover {
  color: #ffffff;
}

.war-yt-pip-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
}

.war-yt-pip-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .kpi-grid-4, .spread-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2-wide, .dca-strat-grid, .promo-grid, .war-factions-grid, .war-stage-layout { grid-template-columns: 1fr; }
  .war-chat-rail { height: 400px; }
  .hide-md { display: none; }
}

@media (max-width: 640px) {
  .container { padding: 0 12px; }
  .card { padding: 13px; }
  .topbar-inner { padding-top: 9px; padding-bottom: 6px; gap: 8px; }
  .brand h1 { font-size: 15.5px; }
  .brand-mark { width: 30px; height: 30px; }
  .nav-tab { padding: 8px 11px; font-size: 12.5px; }
  .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-value { font-size: 18px; }
  .spread-kpis, .miner-box, .macro-grid, .wallet-sum-grid { grid-template-columns: 1fr; }
  .miner-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-item { grid-template-columns: 1fr; gap: 5px; }
  .search-input { min-width: 0; width: 100%; }
  .feed-alert-bar { padding: 8px 9px; gap: 7px; }
  .feed-alert-status { flex-basis: 100%; }
  .api-row { flex-wrap: wrap; }
  .api-desc { white-space: normal; }
  .hide-sm { display: none; }
  .data-table th, .data-table td { padding: 7px 6px; font-size: 12px; }
  .war-now-playing { flex-basis: 100%; margin-left: 0; }
  .war-track-select { max-width: 100%; }
  .war-audio-prompt { font-size: 11px; padding: 6px 11px; }
  .war-danmaku-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 7px;
  }
  .dm-side-group { order: 1; }
  .dm-nick-input { order: 2; flex: 1 1 90px; width: auto; }
  .dm-text-input { order: 3; flex: 1 1 calc(100% - 96px); }
  .dm-send-btn { order: 4; }
  .war-yt-pip { width: 204px; right: 10px; bottom: 10px; }
}

@media (max-width: 440px) {
  .hide-xs { display: none; }
  .kpi-grid-4 { grid-template-columns: 1fr; }
}
