/* BubblePulse Pro · 币圈引力泡 — Obsidian Space-Glass & Porcelain Studio Design System (149 RSI Open Access) */
:root {
  --bg: #05070b;
  --bg-elev: rgba(11, 15, 24, 0.84);
  --bg-solid: #0b0f18;
  --bg-card: rgba(255, 255, 255, 0.038);
  --border: rgba(255, 255, 255, 0.095);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #f3f6fc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --gold: #e5b95c;
  --gold-soft: rgba(229, 185, 92, 0.16);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.16);
  --amber: #f59e0b;
  --cyan: #38bdf8;
  --violet: #a855f7;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.56);
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

[data-theme='light'] {
  --bg: #f1f4f9;
  --bg-elev: rgba(255, 255, 255, 0.9);
  --bg-solid: #ffffff;
  --bg-card: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.21);
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #64748b;
  --accent: #059669;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --gold: #b45309;
  --gold-soft: rgba(180, 83, 9, 0.12);
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.11);
  --amber: #d97706;
  --cyan: #0284c7;
  --violet: #7e22ce;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.13);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Full-Viewport Physics & Quadrant Stage */
.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 65% at 50% 48%, rgba(16, 185, 129, 0.065), transparent 62%),
    radial-gradient(ellipse 65% 55% at 82% 20%, rgba(56, 189, 248, 0.055), transparent 58%),
    var(--bg);
}

[data-theme='light'] .stage {
  background:
    radial-gradient(ellipse 80% 65% at 50% 48%, rgba(16, 185, 129, 0.06), transparent 64%),
    radial-gradient(ellipse 65% 55% at 80% 18%, rgba(56, 189, 248, 0.06), transparent 58%),
    var(--bg);
}

#bubbleCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#bubbleCanvas.is-dragging {
  cursor: grabbing;
}

#bubbleCanvas.is-hovering {
  cursor: pointer;
}

/* Cinema Presentation Mode (F hotkey) */
body.cinema-mode .topbar,
body.cinema-mode .dock,
body.cinema-mode .color-legend,
body.cinema-mode .scatter-toolbar,
body.cinema-mode .sector-spotlight-bar,
body.cinema-mode .anomaly-bar,
body.cinema-mode .presets-popover,
body.cinema-mode .mobile-sheet {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-16px);
}

body.cinema-mode .replay-bar {
  top: 52px;
}

body.cinema-mode .dock {
  transform: translate(-50%, 24px);
}

.cinema-hud {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 65;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(229, 185, 92, 0.34);
  background: rgba(9, 13, 22, 0.78);
  color: #f8fafc;
  font-size: 11.5px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  white-space: nowrap;
  max-width: calc(100vw - 20px);
}

[data-theme='light'] .cinema-hud {
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
}

body.cinema-mode .cinema-hud {
  opacity: 0.92;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cinema-sep {
  opacity: 0.4;
}

.cinema-meta {
  color: var(--cyan);
  font-weight: 700;
}

.cinema-handle {
  color: var(--gold);
  font-weight: 800;
}

.cinema-views {
  display: inline-flex;
  gap: 3px;
}

.cinema-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.cinema-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.cinema-exit {
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(229, 185, 92, 0.5);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* Top Floating Glass Header (50px desktop) */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 50px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  cursor: pointer;
}

.brand-mark {
  width: 27px;
  height: 27px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.fng-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px currentColor;
}

.fng-val {
  font-family: var(--font-mono);
  font-weight: 700;
}

.fng-tag {
  color: var(--text-dim);
  font-size: 11px;
}

.breadth-pill {
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
}

.breadth-pill .up {
  color: var(--accent);
  font-weight: 700;
}

.breadth-pill .down {
  color: var(--rose);
  font-weight: 700;
}

.breadth-pill .oi {
  color: var(--cyan);
  font-weight: 700;
}

.squeeze-pill {
  cursor: pointer;
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber);
  font-family: var(--font-sans);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.14s ease;
}

.squeeze-pill:hover {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.2);
  transform: translateY(-1px);
}

.squeeze-pill.active {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.squeeze-pill.active .squeeze-pulse-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.squeeze-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulseDot 1.8s infinite ease-in-out;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  animation: pulseDot 2.2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.84); }
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 148px;
  flex-shrink: 1;
}

.search-icon {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 30px;
  padding: 0 24px 0 27px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--bg-solid);
}

.search-clear {
  position: absolute;
  right: 5px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-clear.visible {
  display: inline-flex;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.btn:hover {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.14);
}

.btn-icon {
  width: 30px;
  padding: 0;
  font-size: 12px;
}

.btn-accent {
  border-color: rgba(16, 185, 129, 0.42);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-accent:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.24);
}

.btn-gold {
  border-color: rgba(229, 185, 92, 0.48);
  background: var(--gold-soft);
  color: var(--gold);
}

.btn-gold:hover {
  border-color: var(--gold);
  background: rgba(229, 185, 92, 0.26);
}

.btn-link-broker {
  border-color: rgba(56, 189, 248, 0.34);
  background: rgba(56, 189, 248, 0.1);
  color: var(--cyan);
}

.btn-link-broker:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.2);
}

/* Constellation trigger optical alignment */
[data-kzg-orbit-slot] .kzg-orbit-trigger {
  height: 30px !important;
  font-size: 11.5px !important;
  padding: 0 10px !important;
}

[data-theme='light'] [data-kzg-orbit-slot] .kzg-orbit-trigger {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #f8e2a8 !important;
}

/* Floating Color Scale Legend */
.color-legend {
  position: fixed;
  top: 58px;
  left: 14px;
  z-index: 32;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  backdrop-filter: blur(12px);
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

.color-legend.visible {
  display: inline-flex;
}

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

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Floating Quadrant / Scatter Y-Axis Controls */
.scatter-toolbar {
  position: fixed;
  top: 58px;
  left: 14px;
  z-index: 34;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  max-width: calc(100vw - 24px);
}

.scatter-toolbar.visible {
  display: inline-flex;
}

.scatter-tb-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 3px;
  white-space: nowrap;
}

.scatter-tb-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.scatter-spot-btn {
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
}

.scatter-spot-btn.active {
  border-color: var(--cyan) !important;
  background: rgba(56, 189, 248, 0.16) !important;
  color: var(--cyan) !important;
  box-shadow: none !important;
}

/* Sector Spotlight Indicator Pill */
.sector-spotlight-bar {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(14px);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.sector-spotlight-bar.visible {
  display: inline-flex;
}

.spotlight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sector-spotlight-bar button {
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.sector-spotlight-bar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Bottom-Center Floating Control Dock */
.dock {
  position: fixed;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100vw - 20px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1), max-width 0.24s ease, opacity 0.2s ease, transform 0.2s ease;
}

@media (min-width: 981px) {
  body.drawer-open .dock {
    left: calc((100vw - 412px) / 2);
    max-width: calc(100vw - 432px);
    gap: 4px;
    padding: 5px 6px;
  }
  body.drawer-open .dock-views .lbl-full {
    display: none;
  }
  body.drawer-open .dock-views .lbl-short {
    display: inline;
  }
  body.drawer-open .dock-sep {
    display: none;
  }
  body.drawer-open .dock-select {
    max-width: 118px;
    padding: 0 20px 0 8px;
    font-size: 11px;
  }
  body.drawer-open .sector-spotlight-bar {
    left: calc((100vw - 412px) / 2);
  }
}

html[lang='en'] .dock {
  gap: 5px;
  padding: 5px 7px;
}

html[lang='en'] .dock .seg-btn {
  padding: 0 7px;
  font-size: 11px;
}

html[lang='en'] .dock .dock-select {
  padding: 0 20px 0 8px;
  font-size: 11px;
  max-width: 138px;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  flex-shrink: 0;
}

.dock-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.seg-btn {
  height: 27px;
  padding: 0 8px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-btn:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.13);
}

.seg-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.32);
}

.lbl-short {
  display: none;
}

.dock-select {
  height: 31px;
  padding: 0 23px 0 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 11px) 13px, calc(100% - 6px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.dock-select option {
  background: var(--bg-solid);
  color: var(--text);
}

.dock-mobile-more {
  display: none;
}

/* Free Institutional & Custom Presets Popover */
.presets-popover {
  position: fixed;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 58;
  width: min(390px, calc(100vw - 24px));
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 10px;
}

.presets-popover.open {
  display: flex;
}

.presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--gold);
}

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

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.preset-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preset-item-name {
  font-size: 12px;
  font-weight: 750;
}

.preset-item-desc {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 1px;
}

.presets-divider {
  height: 1px;
  background: var(--border);
}

.presets-save-row {
  display: flex;
  gap: 6px;
}

.text-input {
  flex: 1;
  min-width: 120px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
}

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

.presets-custom-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.custom-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.36);
  background: rgba(56, 189, 248, 0.1);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.custom-preset-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}

.custom-preset-del:hover {
  color: var(--rose);
}

/* Hover Glass Tooltip (clamped strictly inside viewport) */
.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 62;
  width: 256px;
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  will-change: transform;
}

.tooltip.visible {
  opacity: 1;
}

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

.tt-sym {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.tt-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.tt-sec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.tt-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.tt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.tt-kv {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tt-k {
  font-size: 10px;
  color: var(--text-muted);
}

.tt-v {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
}

.tt-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tt-signal {
  margin-top: 0;
  padding: 3.5px 8px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tt-click-cue {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Signal tone badges */
.tone-emerald { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.34); }
.tone-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.36); }
.tone-cyan { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.32); }
.tone-rose { background: rgba(244, 63, 94, 0.16); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.34); }
.tone-violet { background: rgba(168, 85, 247, 0.16); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.34); }
.tone-teal { background: rgba(20, 184, 166, 0.16); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.34); }
.tone-slate { background: rgba(148, 163, 184, 0.14); color: var(--text-dim); border: 1px solid var(--border); }

[data-theme='light'] .tone-emerald { color: #047857; }
[data-theme='light'] .tone-amber { color: #b45309; }
[data-theme='light'] .tone-cyan { color: #0369a1; }
[data-theme='light'] .tone-rose { color: #be123c; }
[data-theme='light'] .tone-violet { color: #7e22ce; }
[data-theme='light'] .tone-teal { color: #0f766e; }

/* Right Slide-Over Bubble Spotlight & 2-Coin Comparison Drawer */
.drawer {
  position: fixed;
  top: 50px;
  right: 0;
  bottom: 0;
  width: 412px;
  max-width: 100vw;
  z-index: 55;
  background: var(--bg-elev);
  border-left: 1px solid var(--border-strong);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: -16px 0 50px rgba(0, 0, 0, 0.45);
  transform: translateX(104%);
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.24s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}

.drawer.open {
  transform: translateX(0);
  visibility: visible;
}

@keyframes bpDrawerPop {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drawer.open .drawer-stagger {
  animation: bpDrawerPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.drawer.open .drawer-stagger:nth-child(2) { animation-delay: 0.025s; }
.drawer.open .drawer-stagger:nth-child(3) { animation-delay: 0.05s; }
.drawer.open .drawer-stagger:nth-child(4) { animation-delay: 0.075s; }
.drawer.open .drawer-stagger:nth-child(5) { animation-delay: 0.1s; }
.drawer.open .drawer-stagger:nth-child(6) { animation-delay: 0.125s; }
.drawer.open .drawer-stagger:nth-child(7) { animation-delay: 0.15s; }
.drawer.open .drawer-stagger:nth-child(8) { animation-delay: 0.175s; }

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 15px 17px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

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

.drawer-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.35);
}

.drawer-sym {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.drawer-rank {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.drawer-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.sector-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawer-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.drawer-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.drawer-price {
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.drawer-delta-main {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
}

.pos { color: var(--accent); }
.neg { color: var(--rose); }
.pos-bg { background: var(--accent-soft); color: var(--accent); }
.neg-bg { background: var(--rose-soft); color: var(--rose); }

.tf-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.tf-cell {
  padding: 7px 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.tf-cell:hover {
  border-color: var(--border-strong);
}

.tf-cell.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tf-cell-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.tf-cell.active .tf-cell-lbl {
  color: var(--text);
}

.tf-cell-val {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.verdict-box {
  padding: 11px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.verdict-title {
  font-size: 12.5px;
  font-weight: 800;
}

.verdict-score {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.score-bar-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: currentColor;
}

.verdict-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  opacity: 0.92;
}

.spark-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.spark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.spark-readout {
  color: var(--text);
  font-weight: 600;
  font-size: 10.5px;
}

.spark-svg {
  width: 100%;
  height: 86px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.metric-card {
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.metric-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.metric-val {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
}

.metric-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.drawer-actions .btn {
  height: 36px;
  border-radius: 10px;
  font-size: 12px;
}

.btn-compare-cta {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 750;
  border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(229, 185, 92, 0.14), rgba(56, 189, 248, 0.14));
  color: var(--text);
}

.btn-compare-cta:hover {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(229, 185, 92, 0.24), rgba(56, 189, 248, 0.24));
}

/* 2-Coin Picker & Side-by-Side Comparison Matrix */
.compare-picker-box {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.42);
  background: rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-picker-hint {
  font-size: 11.5px;
  color: var(--cyan);
  font-weight: 650;
  line-height: 1.4;
}

.compare-rivals {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rival-chip {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-solid);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.rival-chip:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

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

.compare-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 800;
}

.cmp-a-tag {
  color: #fcd34d;
}

[data-theme='light'] .cmp-a-tag {
  color: #b45309;
}

.cmp-b-tag {
  color: var(--cyan);
}

.cmp-vs {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.compare-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-bottom: 5px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.compare-table tr {
  border-bottom: 1px solid var(--border);
}

.compare-table tr:last-child {
  border-bottom: none;
}

.compare-table td {
  padding: 8px 8px;
  font-family: var(--font-mono);
}

.compare-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.compare-table td:nth-child(2) {
  text-align: center;
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.compare-table td:last-child {
  text-align: right;
  font-weight: 700;
}

.cmp-win {
  color: var(--accent) !important;
}

/* Watchlist Empty Overlay */
.empty-state {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  width: min(380px, calc(100vw - 32px));
  padding: 24px 22px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(18px);
  text-align: center;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.empty-state.visible {
  display: flex;
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* Full Leaderboard Overlay + KZG Growth Strip */
.list-overlay {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 38;
  background: var(--bg);
  display: none;
  flex-direction: column;
  padding: 10px 16px 76px;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}

.list-overlay.open {
  display: flex;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  flex-shrink: 0;
}

.list-sector-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.list-sector-pills::-webkit-scrollbar {
  display: none;
}

.list-sec-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.list-sec-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.list-count {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.list-scroll-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 12px;
}

.list-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
  flex-shrink: 0;
}

.list-growth-wrap {
  flex-shrink: 0;
}

.list-growth-wrap .kzg-growth-strip {
  margin-top: 0;
}

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

.list-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-solid);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  padding: 10px 9px;
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.14s ease;
}

.list-table th.sort-active {
  color: var(--accent);
}

.list-table th.sort-active[data-dir='asc']::after {
  content: ' ▲';
  font-size: 9px;
}

.list-table th.sort-active[data-dir='desc']::after {
  content: ' ▼';
  font-size: 9px;
}

.list-table th:nth-child(1),
.list-table th:nth-child(2),
.list-table th:nth-child(3),
.list-table th:nth-child(13) {
  text-align: left;
}

.list-table th:last-child {
  text-align: center;
  cursor: default;
}

.list-table th:hover {
  color: var(--text);
}

.list-table td {
  padding: 9px 9px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.list-table td:nth-child(1),
.list-table td:nth-child(2),
.list-table td:nth-child(3),
.list-table td:nth-child(13) {
  text-align: left;
  font-family: var(--font-sans);
}

.list-table td:last-child {
  text-align: center;
}

.row-star {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px 2px 0;
  cursor: pointer;
}

.row-star.active,
.row-star:hover {
  color: var(--gold);
}

.row-vs-btn {
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.36);
  background: rgba(56, 189, 248, 0.1);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.row-vs-btn:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.22);
}

.list-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.list-table tbody tr:hover {
  background: var(--bg-card);
}

/* Poster Preview Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 5, 10, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  user-select: text;
  -webkit-user-select: text;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 860px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--bg-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

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

.modal-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

.modal-title {
  margin: 4px 0 3px;
  font-size: 18px;
  font-weight: 800;
}

.modal-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.poster-img-wrap {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #05070b;
}

.poster-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.modal-foot {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Mobile / Tablet Parameter Popover Sheet */
.mobile-sheet {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 48;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
}

.mobile-sheet.open {
  display: flex;
}

.mobile-sheet-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mobile-sheet-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mobile-sheet-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-sheet-pills .seg-btn {
  min-width: 44px;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 10px;
  font-size: 12px;
}

.mobile-sheet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.mobile-sheet-actions .btn {
  min-height: 40px;
  height: 40px;
  font-size: 12px;
}

/* Responsive Breakpoints: 1440 -> 1280 -> 1024 -> 768 -> 390 (strictly 0px horizontal overflow!) */
@media (max-width: 1380px) {
  .fng-tag {
    display: none;
  }
  .brand-sub {
    display: none;
  }
  .search-wrap {
    width: 124px;
  }
}

@media (max-width: 1260px) {
  .dock-views .lbl-full {
    display: none;
  }
  .dock-views .lbl-short {
    display: inline;
  }
  .breadth-pill {
    display: none;
  }
}

@media (max-width: 1100px) {
  .squeeze-pill {
    display: none;
  }
  .search-wrap {
    width: 108px;
  }
  #btnExportPoster span {
    display: none;
  }
  #btnExportPoster {
    width: 30px;
    padding: 0;
  }
  .dock {
    gap: 5px;
    padding: 5px 7px;
  }
  .seg-btn {
    padding: 0 6px;
    font-size: 11px;
  }
  .dock-select {
    font-size: 11px;
    max-width: 106px;
  }
}

@media (max-width: 920px) {
  .dock-desktop-only,
  .dock-tablet-hide {
    display: none !important;
  }
  .dock-mobile-more {
    display: inline-flex;
  }
  .search-wrap {
    display: none;
  }
  .topbar .btn-link-broker {
    display: none;
  }
}

@media (max-width: 780px) {
  .topbar {
    height: 52px;
    padding: 0 6px;
    gap: 4px;
  }
  .topbar-left,
  .topbar-right {
    gap: 4px;
  }
  .brand {
    gap: 5px;
  }
  .brand-mark {
    width: 24px;
    height: 24px;
  }
  .brand-name {
    font-size: 12.5px;
  }
  .fng-prefix {
    display: none;
  }
  .hud-pill {
    height: 32px;
    padding: 0 7px;
    gap: 4px;
    font-size: 11px;
  }
  .desktop-only-btn {
    display: none !important;
  }
  /* Enforce strict >=40px mobile touch targets on ALL interactive controls */
  .topbar .btn,
  .topbar .btn-icon {
    min-height: 40px;
    height: 40px;
  }
  .topbar .btn-icon {
    min-width: 40px;
    width: 40px;
    font-size: 12.5px;
  }
  #btnJoinClub {
    padding: 0 8px;
    font-size: 11px;
    min-height: 40px;
    height: 40px;
  }
  [data-kzg-orbit-slot] .kzg-orbit-trigger span:last-child {
    display: none;
  }
  [data-kzg-orbit-slot] .kzg-orbit-trigger {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
  .dock {
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    left: 6px;
    right: 6px;
    transform: none;
    max-width: none;
    width: auto;
    transition: opacity 0.2s ease;
    padding: 4px 5px;
    gap: 4px;
    justify-content: space-between;
    border-radius: 14px;
  }
  .dock-mobile-hide {
    display: none !important;
  }
  .dock .dock-views {
    flex: 1;
    justify-content: space-between;
  }
  .dock .dock-views .seg-btn {
    flex: 1;
    min-height: 40px;
    height: 40px;
    padding: 0 4px;
    font-size: 11.5px;
  }
  .dock .dock-mobile-more {
    min-height: 40px;
    height: 40px;
    min-width: 62px;
    padding: 0 9px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 11.5px;
  }
  .scatter-toolbar {
    top: 56px;
    left: 6px;
    right: 6px;
    padding: 4px 6px;
    gap: 4px;
    overflow-x: auto;
  }
  .scatter-tb-lbl {
    display: none;
  }
  .scatter-toolbar .seg-btn {
    min-height: 40px;
    height: 40px;
    padding: 0 8px;
    font-size: 11px;
  }
  .drawer {
    top: 52px;
    width: 100vw;
  }
  .drawer-close {
    width: 40px;
    height: 40px;
  }
  .drawer-actions .btn,
  .drawer-broker-link,
  .btn-compare-cta,
  .compare-head-bar .btn,
  .compare-picker-box .btn,
  .compare-picker-box .text-input,
  .modal-foot .btn,
  .rival-chip,
  .tf-cell {
    min-height: 40px;
    height: auto;
  }
  .compare-head-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .compare-head-bar .btn,
  .compare-picker-box .btn,
  .modal-foot .btn {
    min-width: 44px;
    padding: 0 11px;
  }
  .rival-chip {
    min-width: 44px;
    padding: 0 11px;
  }
  .list-overlay {
    top: 52px;
    padding: 8px 8px 66px;
  }
  .list-sec-pill {
    min-height: 40px;
  }
  .row-star {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .row-vs-btn {
    min-height: 40px;
    min-width: 40px;
    padding: 0 10px;
  }
  .color-legend {
    top: 56px;
    left: 6px;
    padding: 4px 8px;
    font-size: 10px;
    gap: 6px;
  }
  .sector-spotlight-bar {
    top: 56px;
    font-size: 11px;
  }
  .sector-spotlight-bar button {
    min-height: 40px;
    padding: 0 12px;
  }
  .cinema-hud {
    top: 8px;
    padding: 4px 8px;
    gap: 5px;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
  }
  .cinema-sep,
  .cinema-meta,
  .cinema-handle {
    display: none;
  }
  .cinema-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }
  .cinema-exit {
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
  }
}

.drawer-broker-link {
  height: 36px;
  border-radius: 10px;
}

@media (max-width: 780px) {
  .drawer-broker-link {
    min-height: 40px;
    height: 40px;
  }
}

/* ==================== Wave 1–4 Super-Evolution Styles (199-RSI Flagship) ==================== */

/* Dock Kinetic Replay & Anomaly Spotlight Triggers */
.dock-replay-btn {
  border: 1px solid rgba(16, 185, 129, 0.36);
  background: rgba(16, 185, 129, 0.11);
  color: var(--accent);
}

.dock-replay-btn:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.22);
  color: var(--accent);
}

.dock-replay-btn.active,
.dock-replay-btn.active:hover,
#btnReplay.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  font-weight: 750;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.42);
}

#btnReplay.active span {
  color: #ffffff !important;
}

.dock-anomaly-btn {
  border: 1px solid rgba(245, 158, 11, 0.36);
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber);
}

.dock-anomaly-btn:hover {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber);
}

.dock-anomaly-btn.active,
.dock-anomaly-btn.active:hover,
#btnAnomalyDock.active {
  background: linear-gradient(135deg, #f59e0b, #ea580c) !important;
  border-color: transparent !important;
  color: #0b0f18 !important;
  font-weight: 800;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.42);
}

#btnAnomalyDock.active span {
  color: #0b0f18 !important;
}

.btn-replay-mobile {
  border-color: rgba(16, 185, 129, 0.44);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-replay-mobile.active {
  background: var(--accent);
  color: #ffffff;
}

.btn-anomaly-mobile {
  border-color: rgba(245, 158, 11, 0.44);
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.btn-anomaly-mobile.active {
  background: var(--amber);
  color: #0b0f18;
}

/* Wave 1: Floating Momentum Replay Stage Pill */
.replay-bar {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 36;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(16, 185, 129, 0.44);
  background: var(--bg-elev);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.44);
  max-width: calc(100vw - 20px);
  overflow: hidden;
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s ease;
}

.replay-bar.visible {
  display: inline-flex;
  transform: translateX(-50%) translateY(0);
}

.replay-play-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  letter-spacing: -1px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.replay-steps {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.replay-step {
  height: 24px;
  padding: 0 7px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.replay-step.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.replay-arrow {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.65;
}

.replay-regime {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  padding: 0 8px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 430px;
}

.replay-speed-btn {
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--cyan);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.replay-exit-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.replay-exit-btn:hover {
  color: var(--rose);
  border-color: var(--rose);
}

.replay-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: rgba(148, 163, 184, 0.16);
}

.replay-progress-fill {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, #10b981, #38bdf8, #e5b95c);
  transition: width 0.08s linear;
}

/* Wave 2: Floating Anomaly Spotlight Control Strip */
.anomaly-bar {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 36;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: var(--bg-elev);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  max-width: calc(100vw - 20px);
  white-space: nowrap;
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.anomaly-bar.visible {
  display: inline-flex;
}

.anomaly-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  flex-shrink: 0;
  animation: pulseDot 1.6s infinite ease-in-out;
}

.anomaly-bar-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}

.anomaly-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.anomaly-chip {
  height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.14s ease;
}

.anomaly-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.anomaly-chip.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.anomaly-chip.chip-squeeze.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.anomaly-chip.chip-trap.active {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber);
}

.anomaly-chip.chip-whale.active {
  border-color: var(--violet);
  background: rgba(168, 85, 247, 0.18);
  color: var(--violet);
}

.anomaly-quad-btn,
.anomaly-exit-btn {
  height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.anomaly-exit-btn {
  color: var(--text-dim);
}

.anomaly-exit-btn:hover {
  border-color: var(--rose);
  color: var(--rose);
}

@media (min-width: 981px) {
  body.drawer-open .replay-bar,
  body.drawer-open .anomaly-bar {
    left: calc((100vw - 412px) / 2);
    max-width: calc(100vw - 432px);
  }
  body.drawer-open .dock-replay-lbl,
  body.drawer-open .dock-anom-lbl {
    display: none;
  }
}

/* Wave 3: Funding-vs-OI Divergence Gauge Card */
.div-gauge-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.div-gauge-title {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-dim);
}

.div-gauge-body {
  display: grid;
  grid-template-columns: 162px 1fr;
  align-items: center;
  gap: 10px;
}

.div-gauge-svg {
  width: 100%;
  height: 76px;
  display: block;
}

.div-gauge-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.div-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.div-stat-k {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.div-stat-v {
  font-size: 13px;
  font-weight: 800;
}

.div-oi-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  margin-top: 2px;
}

.div-oi-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Wave 3: Duel Dominance Banner & Quick Switcher */
.duel-score-banner {
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid rgba(229, 185, 92, 0.32);
  background: linear-gradient(135deg, rgba(229, 185, 92, 0.1), rgba(56, 189, 248, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.duel-score-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.duel-k {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.duel-v {
  font-size: 13px;
  font-weight: 800;
}

.duel-score-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
}

.duel-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.duel-quick-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.duel-quick-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* Wave 3: 1-Click Cross-Planet Crypto X-Ray Grid */
.xray-planets-card {
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(229, 185, 92, 0.32);
  background: linear-gradient(145deg, rgba(229, 185, 92, 0.07), rgba(16, 185, 129, 0.05));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xray-planets-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold);
}

.xray-planets-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

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

.xray-planet-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease;
}

.xray-planet-link:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.xray-planet-top {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.xray-planet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.xray-planet-name {
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xray-planet-code {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}

.xray-planet-desc {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wave 4: Dual-Theme Poster Modal Switcher */
.poster-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
}

.poster-img-wrap.is-light-poster {
  background: #e7eef7;
}

/* Responsive Calibration for New Wave 1-4 Controls (1440 / 1280 / 1024 / 768 / 390) */
@media (max-width: 1360px) {
  .dock-replay-lbl,
  .dock-anom-lbl {
    display: none;
  }
}

@media (max-width: 1120px) {
  .replay-regime {
    max-width: 210px;
  }
  .anomaly-bar-title {
    display: none;
  }
}

@media (max-width: 780px) {
  .replay-bar {
    top: 56px;
    left: 6px;
    right: 6px;
    transform: none;
    max-width: none;
    width: auto;
    padding: 5px 7px 7px;
    gap: 5px;
    overflow-x: auto;
  }
  .replay-bar.visible {
    transform: none;
  }
  .replay-regime {
    display: none;
  }
  .replay-play-btn,
  .replay-step,
  .replay-speed-btn,
  .replay-exit-btn {
    min-height: 40px;
    height: 40px;
    min-width: 40px;
  }
  .anomaly-bar {
    top: 56px;
    left: 6px;
    right: 6px;
    transform: none;
    max-width: none;
    width: auto;
    border-radius: 14px;
    padding: 5px 7px;
    overflow-x: auto;
  }
  .anomaly-chip,
  .anomaly-quad-btn,
  .anomaly-exit-btn {
    min-height: 40px;
    height: 40px;
    padding: 0 10px;
  }
  .xray-planet-link {
    min-height: 44px;
    justify-content: center;
  }
  .poster-theme-switch .seg-btn {
    min-height: 40px;
    height: 40px;
  }
}

/* Respect prefers-reduced-motion cleanly across all CSS transitions & pulse keyframes */
@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .squeeze-pulse-dot,
  .anomaly-badge-dot {
    animation: none !important;
  }
  .drawer,
  .dock,
  .replay-bar,
  .anomaly-bar,
  .cinema-hud {
    transition-duration: 0.01ms !important;
  }
  .drawer.open .drawer-stagger {
    animation: none !important;
  }
}
