/* -- design tokens -- */

/* -- base reset -- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.number {
  font-family: var(--font-num);
}
.trading-up {
  color: var(--trading-up);
}
.trading-down {
  color: var(--trading-down);
}

:root {
  --canvas: #f0e0ce;
  --canvas-warm: #f3e8d8;
  --surface-card: #f7f0e2;
  --surface-soft: #f3e8d8;
  --surface-strong: #ecd8c4;
  --surface-cool: #e4ccba;
  --hairline: #ecd8c4;
  --hairline-soft: #f0e0ce;
  --ink: #1c100a;
  --body: #3d2b1f;
  --muted: #8b7b6b;
  --overlay: rgba(247, 240, 226, 0.97);
  --shadow-card:
    0 1px 4px rgba(100, 60, 20, 0.08), 0 2px 8px rgba(100, 60, 20, 0.06);
  --shadow-elevated:
    0 4px 20px rgba(100, 60, 20, 0.14), 0 2px 6px rgba(100, 60, 20, 0.08);
  --text-bullish: #0a6b46;
  --text-bearish: #b91c1c;
  --text-neutral: var(--muted);
  --accent: #7c5c35;
  --accent-subtle: rgba(124, 92, 53, 0.12);
}

[data-theme="dark"] {
  --canvas: #0b0e11;
  --surface-card: #1e2329;
  --surface-soft: #2b3139;
  --surface-strong: #363c45;
  --hairline: #2b3139;
  --hairline-soft: #1e2329;
  --ink: #ffffff;
  --body: #eaecef;
  --muted: #707a8a;
  --overlay: rgba(30, 35, 41, 0.95);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-elevated:
    0 4px 16px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
  --text-bullish: #0ecb81;
  --text-bearish: #f6465d;
  --text-neutral: #707a8a;
  --accent: #fcd535;
  --accent-subtle: rgba(252, 213, 53, 0.15);
}

/* -- spacing, radii, fonts -- */
:root {
  --binance-yellow: #fcd535;
  --trading-up: #0ecb81;
  --trading-down: #f6465d;

  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --rounded-sm: 2px;
  --rounded-md: 6px;
  --rounded-lg: 10px;

  --font-ui: "Motiva Sans", "BinanceNova", "Inter", system-ui, sans-serif;
  --font-num: "Motiva Sans", "BinancePlex", "IBM Plex Sans", sans-serif;
}

/* -- floating navbar -- */
.toolbar.floating-nav {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: var(--shadow-elevated);
  z-index: 1000;
  width: 95%;
  max-width: 1400px;
  cursor: grab;
}
.toolbar.floating-nav:active {
  cursor: grabbing;
}

.nav-row-primary {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 48px;
  gap: 10px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-card);
  border-radius: 8px 8px 0 0;
}
[data-theme="dark"] .nav-row-primary {
  background: #1e2329;
}

.nav-row-secondary {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 38px;
  gap: 6px;
  background: var(--surface-soft);
  border-radius: 0 0 8px 8px;
}
[data-theme="dark"] .nav-row-secondary {
  background: #161a1e;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.5;
}

/* -- search bar -- */
.search-container {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0 8px;
  height: 30px;
  transition:
    border 0.2s,
    box-shadow 0.2s;
  flex-shrink: 0;
  gap: 4px;
}
.search-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.search-container input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  width: 90px;
}
.search-container kbd {
  font-family: var(--font-ui);
  font-size: 10px;
  background: var(--surface-soft);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--muted);
  border: 1px solid var(--hairline);
  font-weight: 600;
  pointer-events: none;
  flex-shrink: 0;
}

/* -- token tab strip -- */
.nav-pill-group {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  flex: 1 1 0;
  min-width: 0;
  scrollbar-width: none;
}
.nav-pill-group::-webkit-scrollbar {
  display: none;
}

.pair-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  height: 32px;
}
.pair-btn:hover {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--hairline);
}
.pair-btn.active {
  background: var(--surface-card);
  color: var(--ink);
  border-color: var(--hairline);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .pair-btn.active {
  background: var(--surface-strong);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
  flex-shrink: 0;
}
.status-dot.live {
  background: var(--trading-up);
  box-shadow: 0 0 6px rgba(14, 203, 129, 0.4);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  height: 32px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover {
  background: var(--surface-soft);
  border-color: var(--hairline-soft);
}
.btn.active {
  background: var(--surface-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* -- dropdown menus -- */
.clean-dropdown {
  position: relative;
  flex-shrink: 0;
}
.clean-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  height: 32px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.clean-dropdown-toggle:hover {
  background: var(--surface-soft);
}
.clean-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  display: flex;
  flex-direction: column;
  width: 160px;
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 2000;
  transform: translateY(-4px);
}
.clean-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.clean-dropdown-menu button {
  background: transparent;
  border: none;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--hairline-soft);
}
.clean-dropdown-menu button:last-child {
  border-bottom: none;
}
.clean-dropdown-menu button:hover {
  background: var(--surface-soft);
  color: var(--accent);
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--hairline);
  margin: 0 var(--space-xs);
}

/* -- tooltips -- */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--canvas);
  padding: 4px 8px;
  border-radius: var(--rounded-md);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 3000;
  font-family: var(--font-ui);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--hairline);
}
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

.ghost-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18vw;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.03;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  letter-spacing: -0.04em;
  font-family: var(--font-num);
}

/* -- main layout -- */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding-top: 102px;
}

.chart-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

#chart-wrapper {
  flex: 1;
  position: relative;
}
#chart {
  width: 100%;
  height: 100%;
}

/* -- chart overlay controls -- */
.chart-actions {
  position: absolute;
  bottom: 40px; /* above the time scale */
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
}
.chart-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--overlay);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition:
    color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}
.chart-action-btn:hover {
  color: var(--ink);
  background: var(--surface-card);
  box-shadow: var(--shadow-elevated);
}

/* -- price widget -- */
.price-widget {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  padding: var(--space-md);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-elevated);
  margin-bottom: var(--space-md);
}
[data-theme="dark"] .price-widget {
  background: var(--overlay);
  backdrop-filter: blur(8px);
}
.price-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.price-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
}
.price-change {
  font-size: 14px;
  margin-top: 4px;
  font-weight: 600;
}

.readout {
  position: absolute;
  top: var(--space-md);
  right: var(--space-lg);
  background: var(--overlay);
  border: 1px solid var(--hairline);
  padding: var(--space-sm);
  border-radius: var(--rounded-md);
  font-size: 12px;
  line-height: 1.8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  min-width: 140px;
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-card);
}
.readout.visible {
  opacity: 1;
}
.readout div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}
.readout span {
  color: var(--muted);
}
.readout .val {
  color: var(--ink);
  font-weight: 500;
}

/* -- sidebar -- */
.sidebar {
  width: 380px;
  background: var(--canvas-warm);
  border-left: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-strong) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 3px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--surface-strong);
  border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
.sidebar-section {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--hairline-soft);
}
[data-theme="dark"] .sidebar {
  background: var(--canvas);
}
.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  padding: var(--space-md);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
}

/* -- 24h stats grid -- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-item {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: 10px 12px;
}
.stat-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-num);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value.up {
  color: var(--trading-up);
}
.stat-value.down {
  color: var(--trading-down);
}

/* -- technical signals -- */
.signal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.signal-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.signal-row:first-child {
  padding-top: 0;
}

.signal-label {
  display: flex;
  flex-direction: column;
}
.signal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.signal-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* -- signal badges -- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--rounded-md);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 60px;
}
.badge.bullish {
  background: rgba(14, 203, 129, 0.1);
  color: var(--trading-up);
  border: 1px solid rgba(14, 203, 129, 0.3);
}
.badge.bearish {
  background: rgba(246, 70, 93, 0.1);
  color: var(--trading-down);
  border: 1px solid rgba(246, 70, 93, 0.3);
}
.badge.neutral {
  background: var(--surface-strong);
  color: var(--muted);
  border: 1px solid var(--hairline);
}

.loading {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* -- orderbook -- */
.ob-table {
  display: flex;
  flex-direction: column;
  font-family: var(--font-num);
  font-size: 12px;
}
.ob-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-ui);
}
.ob-header div,
.ob-row .ob-col {
  flex: 1;
  text-align: right;
  z-index: 2;
  position: relative;
}
.ob-header div:first-child,
.ob-row .ob-col:first-child {
  text-align: left;
  font-weight: 500;
}
.ob-row {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: 4px 8px;
  cursor: default;
}
.ob-row:hover {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .ob-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ob-bg-ask {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(246, 70, 93, 0.15);
  z-index: 1;
  pointer-events: none;
}
.ob-bg-bid {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(14, 203, 129, 0.15);
  z-index: 1;
  pointer-events: none;
}

.ob-price-ask {
  color: var(--trading-down);
}
.ob-price-bid {
  color: var(--trading-up);
}

.ob-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}
.ob-mid-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--binance-yellow);
  letter-spacing: -0.5px;
  font-family: var(--font-num);
}
.ob-mid-spread {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-weight: 600;
  margin-top: 2px;
}

/* -- live insights panel -- */

#liveInsightsPanel {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 560px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: var(--shadow-elevated);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    opacity 0.2s,
    transform 0.2s;
  font-family: var(--font-ui);
}
#liveInsightsPanel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}
.li-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.li-header-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.li-header-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--trading-up);
  box-shadow: 0 0 8px rgba(14, 203, 129, 0.55);
  animation: li-pulse 1.8s infinite;
  flex-shrink: 0;
}
@keyframes li-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.li-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  border-radius: 5px;
  transition:
    color 0.15s,
    background 0.15s;
}
.li-close-btn:hover {
  color: var(--ink);
  background: var(--surface-strong);
}
.li-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
}
.li-feed::-webkit-scrollbar {
  width: 4px;
}
.li-feed::-webkit-scrollbar-track {
  background: transparent;
}
.li-feed::-webkit-scrollbar-thumb {
  background: var(--surface-strong);
  border-radius: 2px;
}
.li-card {
  break-inside: avoid;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.li-card.ai-card {
  grid-column: 1 / -1;
}
.li-card:hover {
  border-color: var(--hairline-soft);
  box-shadow: var(--shadow-card);
}
/* section label with colored accent bar */
.li-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--body);
  margin-bottom: 8px;
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 8px;
}
.li-card-label::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: var(--muted);
  flex-shrink: 0;
}
/* accent color per insight card type */
.li-card-label.pressure::before {
  background: var(--trading-down);
}
.li-card-label.momentum::before {
  background: var(--binance-yellow);
}
.li-card-label.whale::before {
  background: #9ca3af;
}
.li-card-label.macd::before {
  background: #3b82f6; /* blue */
}
.li-card-label.bb::before {
  background: #8b5cf6; /* purple */
}
/* orderbook mini bar chart */
.li-ob-bars {
  display: flex;
  height: 32px;
  gap: 2px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.li-ob-bar-bid {
  background: var(--trading-up);
  border-radius: 2px;
  flex: 1;
  transition: height 0.3s;
}
.li-ob-bar-ask {
  background: var(--trading-down);
  border-radius: 2px;
  flex: 1;
  transition: height 0.3s;
}
/* sparkline canvas */
.li-spark {
  width: 100%;
  height: 36px;
  display: block;
  margin-bottom: 6px;
}
/* volume context bar */
.li-vol-bar-wrap {
  height: 6px;
  background: var(--surface-strong);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.li-vol-bar {
  height: 100%;
  background: #f59e0b; /* amber */
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s;
}
.li-vol-bar.spike {
  background: var(--trading-down);
}
.li-card-text {
  font-size: 13px;
  color: var(--body);
  line-height: 1.6;
  font-weight: 500;
  font-family: var(--font-ui);
  margin-bottom: 12px;
}
.li-card-text.muted {
  color: var(--muted);
}
.li-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  font-family: var(--font-num);
  line-height: 1.4;
}
.li-card-meta .li-tag {
  padding: 2px 6px;
  background: var(--surface-strong);
  border-radius: 3px;
  font-weight: 600;
  color: var(--body);
}
/* stream loading overlay */
.stream-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface-card);
  z-index: 5;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  transition: opacity 0.3s;
}
.stream-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* -- responsive: tablet landscape -- */
@media (max-width: 1024px) {
  .sidebar {
    width: 300px;
  }
  .sidebar-section {
    padding: var(--space-md);
  }
  .sidebar-title {
    font-size: 16px;
  }
  .price-value {
    font-size: 26px;
  }
  #liveInsightsPanel {
    width: 280px;
  }
  .nav-pill-group {
    max-width: 320px;
  }
}

/* -- responsive: tablet portrait -- */
@media (max-width: 768px) {
  .toolbar.floating-nav {
    width: 100%;
    border-radius: 0;
    top: 0;
    position: fixed;
    cursor: default;
  }
  .toolbar.floating-nav:active {
    cursor: default;
  }
  .drag-handle {
    display: none;
  }
  .nav-row-primary {
    height: 44px;
    padding: 0 10px;
    gap: 8px;
  }
  .nav-row-secondary {
    height: 42px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 0 10px;
    gap: 4px;
  }
  .nav-row-secondary::-webkit-scrollbar {
    display: none;
  }

  .main-container {
    flex-direction: column;
    padding-top: 90px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-container {
    flex: none;
    height: 55vh;
    min-height: 300px;
  }

  .sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--hairline);
    overflow-y: visible;
    flex-shrink: 0;
  }
  .sidebar-section {
    padding: var(--space-md);
  }

  .price-value {
    font-size: 28px;
  }
  .price-widget {
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }

  .search-container input {
    width: 70px;
  }
  .search-container kbd {
    display: none;
  }

  .nav-pill-group {
    max-width: none;
  }
  .pair-btn {
    padding: 4px 8px;
    font-size: 12px;
    height: 30px;
    gap: 4px;
  }
  .pair-btn .iconify {
    font-size: 14px !important;
  }

  .btn {
    padding: 5px 10px;
    font-size: 12px;
    height: 30px;
  }
  .clean-dropdown-toggle {
    padding: 5px 10px;
    font-size: 12px;
    height: 30px;
  }

  #liveInsightsPanel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
  }
  .li-feed {
    max-height: 50vh;
  }

  .readout {
    top: auto;
    bottom: var(--space-md);
    right: var(--space-sm);
    left: var(--space-sm);
    font-size: 11px;
    min-width: unset;
  }

  .ghost-watermark {
    font-size: 25vw;
  }

  .divider {
    height: 16px;
    margin: 0 4px;
  }

  .tooltip::after {
    display: none;
  }
}

/* -- responsive: phone -- */
@media (max-width: 480px) {
  .nav-row-primary {
    height: 40px;
    padding: 0 8px;
    gap: 6px;
  }
  .nav-row-secondary {
    height: 38px;
    padding: 0 8px;
  }

  .main-container {
    padding-top: 82px;
  }

  .chart-container {
    height: 45vh;
    min-height: 260px;
  }

  .search-container {
    height: 28px;
    padding: 0 6px;
  }
  .search-container input {
    width: 56px;
    font-size: 12px;
  }

  .pair-btn {
    padding: 3px 6px;
    font-size: 11px;
    height: 28px;
  }
  .btn {
    padding: 4px 8px;
    font-size: 11px;
    height: 28px;
    gap: 4px;
  }
  .clean-dropdown-toggle {
    padding: 4px 8px;
    font-size: 11px;
    height: 28px;
    gap: 4px;
  }

  /* hide text labels on small screens, keep icons */
  #activeChartTypeText,
  #activeTimeframeText {
    display: none;
  }
  .nav-row-secondary > span[style*="text-transform"] {
    display: none;
  }

  .sidebar-section {
    padding: var(--space-sm) var(--space-md);
  }
  .sidebar-title {
    font-size: 15px;
    margin-bottom: var(--space-sm);
  }

  .price-value {
    font-size: 24px;
    letter-spacing: -0.5px;
  }
  .price-change {
    font-size: 12px;
  }
  .price-label {
    font-size: 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .stat-item {
    padding: 8px 10px;
  }
  .stat-label {
    font-size: 9px;
  }
  .stat-value {
    font-size: 12px;
  }

  .signal-row {
    padding: 8px 0;
  }
  .signal-name {
    font-size: 13px;
  }
  .signal-desc {
    font-size: 11px;
  }
  .badge {
    font-size: 11px;
    padding: 3px 6px;
    min-width: 50px;
  }

  .ob-row {
    padding: 3px 6px;
  }
  .ob-header {
    padding: 4px 6px;
    font-size: 9px;
  }
  .ob-mid-price {
    font-size: 18px;
  }

  .chart-actions {
    bottom: 34px;
    right: 8px;
  }
  .chart-action-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  #liveInsightsPanel {
    max-height: 70vh;
    border-radius: 12px 12px 0 0;
  }
  .li-card {
    margin: 4px 10px;
    padding: 10px 12px 8px;
  }
  .li-card-text {
    font-size: 12px;
  }

  #clock {
    display: none;
  }
}

/* -- touch device overrides -- */
@media (hover: none) and (pointer: coarse) {
  .pair-btn,
  .btn,
  .clean-dropdown-toggle,
  .chart-action-btn,
  .li-close-btn {
    min-height: 36px;
    min-width: 36px;
  }
  .ob-row {
    padding: 6px 8px;
  }
  .toolbar.floating-nav {
    cursor: default;
  }
  .toolbar.floating-nav:active {
    cursor: default;
  }
}
