/* ═══════════════════════════════════════════════════════════
   CRYPTO SCREENER v6.0 — Dark Terminal Aesthetic
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=Inter:wght@400;500;600&display=swap');

:root {
    --bg0:        #050508;
    --bg1:        #0c0c14;
    --bg2:        #12121e;
    --bg3:        #1a1a2e;
    --border:     rgba(255,255,255,0.07);
    --border2:    rgba(255,255,255,0.12);
    --text:       #e8e8f0;
    --muted:      #6b6b88;
    --accent:     #1eb4ff;
    --accent2:    rgba(30,180,255,0.15);
    --buy:        #00e676;
    --sell:       #ff3b30;
    --otc:        #c084fc;
    --sidebar-w:  240px;
}

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

html, body {
    height: 100%;
    background: var(--bg0);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    overflow: hidden;
}

/* ─── SIDEBAR COLLAPSE ──────────────────────────────────── */
.sidebar-toggle-btn {
    position: absolute;
    top: calc(48px + 50% - 22px); /* 48px = topbar, центр в зоне sidebar */
    left: 240px; /* = var(--sidebar-w) */
    z-index: 300;
    width: 14px;
    height: 44px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--muted);
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.25s ease, color 0.15s, background 0.15s;
    padding: 0;
    line-height: 1;
    box-shadow: 2px 0 6px rgba(0,0,0,0.4);
}
.sidebar-toggle-btn:hover { color: var(--accent); background: var(--bg3); }

/* .app должен быть relative чтобы кнопка позиционировалась относительно него */
.app { position: relative; }

/* Когда sidebar свёрнут */
.app.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}
.app.sidebar-collapsed .sidebar {
    overflow: hidden;
    border-right: none;
}
.app.sidebar-collapsed .sidebar-toggle-btn {
    left: 0;
}

/* ─── SIDEBAR PANELS ────────────────────────────────────── */
.sb-panel {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    min-height: 28px;
    overflow: hidden;
    transition: height 0.2s ease;
    position: relative;
}

.sb-panel-resizable {
    /* height задаётся JS или inline при resize */
}

.sb-panel-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    cursor: pointer;
    user-select: none;
    background: var(--bg1);
    flex-shrink: 0;
    min-height: 28px;
}
.sb-panel-head:hover { background: var(--bg2); }

.sb-panel-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    flex: 1;
}

.sb-panel-chevron {
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}
.sb-panel.collapsed .sb-panel-chevron {
    transform: rotate(-90deg);
}

.sb-panel-body {
    overflow: hidden;
    flex: 1;
}

/* свёрнутая панель — только header */
.sb-panel.collapsed .sb-panel-body {
    display: none;
}
.sb-panel.collapsed .sb-resize-handle {
    display: none;
}

/* ─── RESIZE HANDLE ─────────────────────────────────────── */
.sb-resize-handle {
    height: 5px;
    cursor: ns-resize;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}
.sb-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 1px;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: var(--border2);
    opacity: 0.5;
    transition: opacity 0.15s, background 0.15s;
}
.sb-resize-handle:hover::after,
.sb-resize-handle.dragging::after {
    opacity: 1;
    background: var(--accent);
}

/* tape-stats-panel внутри sb-panel-body — убираем дублирующий border */
.sb-panel-body.tape-stats-panel {
    border-top: none;
    border-bottom: none;
    overflow-y: auto;
}
.sb-panel-body.tape-stats-panel::-webkit-scrollbar { width: 3px; }
.sb-panel-body.tape-stats-panel::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

/* ─── LAYOUT ────────────────────────────────────────────── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 48px 1fr;
    height: 100vh;
    transition: grid-template-columns 0.25s ease;
}

/* ─── TOP BAR ───────────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--bg1);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.topbar-brand {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent);
    white-space: nowrap;
}

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

.topbar-symbol {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#currentSymbol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

#currentExchange {
    font-size: 11px;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
}

#currentPrice {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
}

.price-change {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
}
.price-change.up   { color: var(--buy);  background: rgba(0,230,118,0.1); }
.price-change.down { color: var(--sell); background: rgba(255,59,48,0.1); }

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.ctrl-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctrl-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* sliders */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: var(--bg3);
    outline: none;
    cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(30,180,255,0.5);
}
input[type=range]::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}

#sizeSlider   { width: 80px; }
#volumeSlider { width: 80px; }

/* volume input */
.vol-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vol-input-wrap {
    display: inline-flex;
    align-items: stretch;
    height: 26px;
    gap: 2px;
}

#volumeInput {
    width: 62px;
    padding: 3px 6px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 4px 0 0 4px;
    color: var(--text);
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    -moz-appearance: textfield;
    box-sizing: border-box;
}
#volumeInput:focus { outline: none; border-color: var(--accent); }
#volumeInput::-webkit-inner-spin-button,
#volumeInput::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.vol-spin-wrap {
    display: none;
    flex-direction: column;
    width: 14px;
}
.vol-input-wrap:hover .vol-spin-wrap {
    display: flex;
}

.vol-spin-up,
.vol-spin-down {
    flex: 1;
    width: 14px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 8px;
    line-height: 1;
}
.vol-spin-up   { border-radius: 0 3px 0 0; border-bottom: none; }
.vol-spin-down { border-radius: 0 0 3px 0; }
.vol-spin-up:hover,
.vol-spin-down:hover { background: var(--accent); color: #000; border-color: var(--accent); }

#volumeDisplay {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    min-width: 44px;
}

/* status */
.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    min-width: 160px;
}
.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--buy);
    flex-shrink: 0;
    animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

#statusText[data-type="error"] { color: var(--sell); }
#statusText[data-type="ok"]    { color: var(--buy); }
#statusText[data-type="warning"] { color: #ffa500; }

/* OTC settings button */
.btn-otc {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.btn-otc:hover { border-color: var(--otc); color: var(--otc); }

/* ─── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
    grid-row: 2;
    background: var(--bg1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
}

.sidebar-top {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exchange-select {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
}
.exchange-select:focus { outline: none; border-color: var(--accent); }

.search-input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { outline: none; border-color: var(--accent); }

.sidebar-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 8px 10px 4px;
}

.symbols-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 6px 10px;
}

.symbols-list::-webkit-scrollbar { width: 4px; }
.symbols-list::-webkit-scrollbar-track  { background: transparent; }
.symbols-list::-webkit-scrollbar-thumb  { background: var(--bg3); border-radius: 2px; }
.symbols-list::-webkit-scrollbar-thumb:hover { background: var(--border2); }

.symbol-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    border: 1px solid transparent;
    margin-bottom: 2px;
}
.symbol-item:hover { background: var(--bg2); }
.symbol-item.active {
    background: var(--accent2);
    border-color: rgba(30,180,255,0.3);
}

.sym-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.symbol-item.active .sym-name { color: var(--accent); }

.sym-badge {
    font-size: 8px;
    color: var(--muted);
}
.symbol-item.active .sym-badge { color: var(--accent); }

.loading {
    text-align: center;
    color: var(--muted);
    padding: 20px;
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
}

/* tape section */
.tape-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 8px 10px 4px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.ticker-list {
    min-height: 60px;
    overflow-y: auto;
    padding: 2px 6px 6px;
    flex-shrink: 0;
}
.ticker-list::-webkit-scrollbar { width: 3px; }
.ticker-list::-webkit-scrollbar-track  { background: transparent; }
.ticker-list::-webkit-scrollbar-thumb  { background: var(--bg3); border-radius: 2px; }

.t-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px 3px 8px;
    border-left: 2px solid transparent;
    border-radius: 0 3px 3px 0;
    margin-bottom: 1px;
    font-size: 10px;
    font-family: 'IBM Plex Mono', monospace;
    animation: fadeSlide 0.2s ease;
}
@keyframes fadeSlide {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: none; }
}

.t-dir   { font-size: 8px; flex-shrink: 0; }
.t-price { flex: 1; color: var(--text); }
.t-vol   { color: var(--muted); min-width: 40px; text-align: right; }
.t-time  { color: var(--muted); font-size: 9px; }
/* ─── TAPE STATS PANEL (над лентой) ────────────────────── */
.tape-stats-panel {
    padding: 8px 10px;
    flex-shrink: 0;
    background: rgba(8,8,18,0.8);
}

.tsp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.tsp-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
}

.tsp-dom {
    font-size: 10px;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--muted);
    background: transparent;
    transition: all 0.3s ease;
}
.tsp-dom-buy  { color: var(--buy);  background: rgba(0,230,118,0.1);  }
.tsp-dom-sell { color: var(--sell); background: rgba(255,59,48,0.1);  }
.tsp-dom-neutral { color: #aaa; background: rgba(255,255,255,0.05); }

/* Progress bar */
.tsp-bar-wrap {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg3);
    margin-bottom: 3px;
    gap: 1px;
}
.tsp-bar-buy  {
    background: linear-gradient(90deg, #00c853, #00e676);
    border-radius: 3px 0 0 3px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.tsp-bar-sell {
    background: linear-gradient(90deg, #ff3b30, #ff6b60);
    border-radius: 0 3px 3px 0;
    transition: width 0.4s ease;
    min-width: 2px;
    flex: 1;
}

.tsp-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
}
.tsp-buy-pct  { font-size: 10px; font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: var(--buy);  }
.tsp-sell-pct { font-size: 10px; font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: var(--sell); }

/* 2x2 grid */
.tsp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 6px;
}
.tsp-cell {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 6px;
}
.tsp-cell.tsp-buy-side  { border-color: rgba(0,230,118,0.2); }
.tsp-cell.tsp-sell-side { border-color: rgba(255,59,48,0.2); }

.tsp-cell-val {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.tsp-buy-side  .tsp-cell-val { color: var(--buy);  }
.tsp-sell-side .tsp-cell-val { color: var(--sell); }

.tsp-cell-lbl {
    font-size: 9px;
    color: var(--muted);
    margin-top: 1px;
    font-family: 'IBM Plex Mono', monospace;
}

/* Bottom row */
.tsp-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
}
.tsp-total-lbl { color: var(--muted); }
.tsp-total-val { color: var(--text); font-weight: 600; flex: 1; }
.tsp-delta     { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.tsp-delta-buy  { color: var(--buy);  background: rgba(0,230,118,0.1);  }
.tsp-delta-sell { color: var(--sell); background: rgba(255,59,48,0.1);  }

/* Дополнительные блоки: объём 24ч + NATR */
.tsp-extra-grid {
    margin-top: 4px;
}
.tsp-vol24-cell {
    border-color: rgba(30, 180, 255, 0.25);
}
.tsp-natr-cell {
    border-color: rgba(255, 200, 30, 0.25);
}
.tsp-natr-warm { color: #ffc81e !important; }
.tsp-natr-hot  { color: #ff6b35 !important; }

/* ── Exchange Volume Breakdown ─────────────────────────────── */
.exvol-section {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}
.exvol-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}
.exvol-title-icon { color: var(--accent); font-size: 10px; }
.exvol-best-badge {
    margin-left: auto;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(30,180,255,0.15);
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.04em;
    display: none;
}
.exvol-best-badge.visible { display: inline-block; }

.exvol-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.exvol-loading {
    font-size: 9px;
    color: var(--muted);
    text-align: center;
    padding: 8px 0;
    font-family: 'IBM Plex Mono', monospace;
}
.exvol-row {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg2);
    overflow: hidden;
    position: relative;
    min-height: 28px;
    transition: border-color 0.2s;
}
.exvol-row.exvol-best {
    border-color: rgba(30,180,255,0.4);
    background: rgba(30,180,255,0.06);
}
.exvol-row.exvol-none {
    opacity: 0.4;
    border-style: dashed;
}

/* Bar fill behind the row */
.exvol-bar-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(30,180,255,0.07);
    transition: width 0.4s ease;
    pointer-events: none;
}
.exvol-row.exvol-best .exvol-bar-fill {
    background: rgba(30,180,255,0.12);
}

/* Exchange logo/watermark */
.exvol-logo {
    position: relative;
    width: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7.5px;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-right: 1px solid var(--border);
    padding: 4px 3px;
    height: 100%;
    text-transform: uppercase;
    background: rgba(0,0,0,0.15);
}
.exvol-row.exvol-best .exvol-logo {
    color: var(--accent);
    border-right-color: rgba(30,180,255,0.2);
}
.exvol-row.exvol-none .exvol-logo {
    color: var(--muted);
}

/* Volume value */
.exvol-val {
    position: relative;
    flex: 1;
    padding: 3px 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.exvol-row.exvol-best .exvol-val { color: var(--accent); }
.exvol-none-label {
    font-size: 8px;
    color: var(--muted);
    font-weight: 400;
}

/* Best crown icon */
.exvol-crown {
    position: relative;
    font-size: 10px;
    padding-right: 6px;
    display: none;
}
.exvol-row.exvol-best .exvol-crown { display: inline; }

/* Rank percent */
.exvol-pct {
    position: relative;
    font-size: 8px;
    color: var(--muted);
    padding: 3px 5px 3px 0;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}
.exvol-row.exvol-best .exvol-pct { color: rgba(30,180,255,0.7); }


/* ── Tape row tiers ──────────────────────────────────────── */
.t-otc { color: var(--otc); font-size: 9px; font-weight: 600; }

/* BIG tier */
.t-row-big {
    padding: 4px 6px 4px 8px;
}

/* LARGE tier */
.t-row-large {
    padding: 5px 6px 5px 8px;
    border-radius: 0 4px 4px 0;
}

/* WHALE tier — пульсирует при появлении */
.t-row-whale {
    padding: 6px 6px 6px 8px;
    border-radius: 0 5px 5px 0;
    animation: whalePulse 0.6s ease-out, fadeSlide 0.2s ease;
}
@keyframes whalePulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.3); }
    40%  { box-shadow: 0 0 0 4px rgba(255,255,255,0.08); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.t-row.t-otc-row {
    border-radius: 0 4px 4px 0;
    box-shadow: inset 2px 0 12px rgba(192,132,252,0.06);
}

/* ── Badges ──────────────────────────────────────────────── */
.t-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    line-height: 1.5;
}
.t-badge-otc {
    color: var(--otc);
    background: rgba(192,132,252,0.15);
    border: 1px solid rgba(192,132,252,0.35);
}
.t-badge-whale {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 9px;
    animation: badgeGlow 1.2s ease-out;
}
@keyframes badgeGlow {
    0%   { text-shadow: 0 0 8px currentColor; }
    100% { text-shadow: none; }
}
.t-badge-large {
    background: transparent;
    border: 1px solid;
    font-size: 8px;
}
.t-badge-big {
    background: transparent;
    border: 1px solid;
    font-size: 7px;
    opacity: 0.85;
}



/* ─── MAIN AREA ─────────────────────────────────────────── */
.main {
    grid-row: 2;
    position: relative;
    overflow: hidden;
    background: var(--bg0);
}

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

/* dbl-click hint */
.dbl-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    pointer-events: none;
    transition: opacity 1s;
    opacity: 0.5;
}

/* stats panel */


/* ─── TOOLTIP ───────────────────────────────────────────── */
.trade-tooltip {
    position: fixed;
    background: rgba(12,12,20,0.97);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    min-width: 180px;
    animation: tipIn 0.1s ease;
}
@keyframes tipIn {
    from { opacity:0; transform: scale(0.97); }
    to   { opacity:1; transform: none; }
}

.tip-header {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 8px;
}
.tip-otc { color: var(--otc); }
.tip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 3px;
    color: var(--muted);
}
.tip-row span:last-child { color: var(--text); font-weight: 600; }
.tip-divider {
    border-top: 1px solid var(--border);
    margin: 6px 0;
}
.otc-info span:last-child { color: var(--otc); }

/* ─── MODAL ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }

.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 10px;
    width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn {
    from { opacity:0; transform:translateY(20px) scale(0.97); }
    to   { opacity:1; transform:none; }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--otc);
    font-family: 'IBM Plex Mono', monospace;
}

.btn-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.btn-close:hover { color: var(--text); background: var(--bg3); }

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.form-group small { font-size: 10px; color: var(--muted); }

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-input {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg1);
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
}
.form-input:focus { outline: none; border-color: var(--otc); }

.form-value {
    min-width: 50px;
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.modal-foot {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.btn {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid var(--border2);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
    background: transparent;
    color: var(--muted);
}
.btn-secondary:hover { background: var(--bg3); color: var(--text); }

/* ─── LEGEND STRIP ──────────────────────────────────────── */
.legend-strip {
    position: absolute;
    bottom: 56px;
    left: 80px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 10px;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--muted);
    pointer-events: none;
}
.legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.legend-otc {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1.5px dashed var(--otc);
    flex-shrink: 0;
}
.legend-item { display: flex; align-items: center; gap: 5px; }

/* ═══════════════════════════════════════════════════════════
   OTC / ANOMALY FEED PANEL
   ═══════════════════════════════════════════════════════════ */

.otc-feed-panel {
    display: flex;
    flex-direction: column;
    background: #07070f;
    flex: 1;
    overflow: hidden;
}

.otc-feed-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.otc-feed-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    color: #c8a0ff;
    flex: 1;
    white-space: nowrap;
}

.otc-feed-count {
    font-size: 9px;
    font-family: 'IBM Plex Mono', monospace;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
}

/* Toggle switch */
.otc-toggle-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.otc-toggle-wrap input { display: none; }
.otc-toggle-track {
    width: 28px;
    height: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    position: relative;
    transition: background .2s;
}
.otc-toggle-wrap input:checked + .otc-toggle-track {
    background: #7c3aed;
}
.otc-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 11px;
    height: 11px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.otc-toggle-wrap input:checked + .otc-toggle-track .otc-toggle-thumb {
    transform: translateX(13px);
}

.otc-feed-status {
    font-size: 9px;
    font-family: 'IBM Plex Mono', monospace;
    color: rgba(255,255,255,0.25);
    padding: 4px 10px 3px;
    flex-shrink: 0;
    min-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.otc-feed-status.active   { color: rgba(124,58,237,0.7); }
.otc-feed-status.error    { color: rgba(255,80,80,0.7);  }
.otc-feed-status.loading  { color: rgba(255,180,0,0.5);  }

.otc-feed-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* Строка аномалии */
.of-row {
    display: grid;
    grid-template-columns: 52px 1fr 68px 44px;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 9.5px;
    font-family: 'IBM Plex Mono', monospace;
    transition: background .1s;
    cursor: default;
}
.of-row:hover { background: rgba(255,255,255,0.04); }

/* Новая строка — flash при появлении */
@keyframes of-flash {
    from { background: rgba(124,58,237,0.18); }
    to   { background: transparent; }
}
.of-row.new { animation: of-flash .8s ease-out forwards; }

.of-time  { color: rgba(255,255,255,0.28); font-size: 9px; }
.of-sym   { color: #e0d8ff; font-weight: 600; font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-vol   { text-align: right; font-weight: 700; font-size: 9.5px; }
.of-vol.buy  { color: #00e676; }
.of-vol.sell { color: #ff3b30; }
.of-vr    { text-align: right; font-size: 8.5px; color: rgba(255,255,255,0.35); }
.of-otc   { text-align: center; font-size: 8px; }

.of-badge-otc {
    display: inline-block;
    padding: 1px 3px;
    border-radius: 3px;
    background: rgba(192,132,252,0.15);
    border: 1px solid rgba(192,132,252,0.3);
    color: #c084fc;
    font-size: 7.5px;
    letter-spacing: .04em;
}
.of-badge-big {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}

/* ═══════════════════════════════════════════════════════════
   HOT TOOLS WIDGET v2.0 — "Инструменты в игре"
   ═══════════════════════════════════════════════════════════ */

.hot-tools-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 16px; padding: 0 5px;
    background: rgba(255,120,30,0.22); border: 1px solid rgba(255,120,30,0.45);
    border-radius: 8px; color: #ff8c3a;
    font-size: 10px; font-weight: 700; font-family: 'IBM Plex Mono', monospace;
    margin-left: 2px; transition: all 0.2s;
}
.hot-tools-excl-btn {
    background: none; border: 1px solid rgba(255,255,255,0.1);
    color: rgba(160,160,185,0.6); font-size: 10px; padding: 1px 5px;
    border-radius: 3px; cursor: pointer; font-family: 'IBM Plex Mono', monospace;
    margin-left: auto; margin-right: 4px; transition: all 0.15s; flex-shrink: 0;
}
.hot-tools-excl-btn:hover { background: rgba(255,255,255,0.08); color: #e0e0f0; border-color: rgba(255,255,255,0.25); }

.hot-tools-list {
    display: flex; flex-direction: column;
    overflow-y: auto; height: 100%; padding: 2px 0;
}
.hot-tools-list::-webkit-scrollbar { width: 3px; }
.hot-tools-list::-webkit-scrollbar-track { background: transparent; }
.hot-tools-list::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

.hot-tools-empty {
    color: rgba(140,140,165,0.55); font-size: 11px;
    font-family: 'IBM Plex Mono', monospace; padding: 10px 12px; line-height: 1.5;
}

.hot-tools-row {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer; transition: background 0.12s; position: relative;
}
.hot-tools-row:hover { background: rgba(255,140,60,0.07); }
.hot-tools-row:hover .hot-tools-name { color: #ffaa5c; }

@keyframes hotFlash {
    0%   { background: rgba(255,140,60,0.30); }
    100% { background: transparent; }
}
.hot-tools-row.new-entry { animation: hotFlash 1.4s ease-out forwards; }

/* Имя монеты */
.hot-tools-name {
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600;
    color: #e8e8f0; min-width: 48px; transition: color 0.12s;
}

/* Бейдж биржи */
.hot-tools-badge {
    font-family: 'IBM Plex Mono', monospace; font-size: 8.5px; font-weight: 600;
    padding: 1px 4px; border-radius: 3px; border: 1px solid;
    flex-shrink: 0; letter-spacing: 0.03em; opacity: 0.85;
    min-width: 28px; text-align: center;
}

/* Объём */
.hot-tools-vol {
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    color: #ff8c3a; font-weight: 600; flex: 1; text-align: right;
}

/* Время */
.hot-tools-age {
    font-family: 'IBM Plex Mono', monospace; font-size: 10px;
    color: rgba(140,140,165,0.55); min-width: 30px; text-align: right;
}

/* Кнопка удаления */
.hot-tools-del {
    background: none; border: none; color: rgba(255,80,80,0.3);
    cursor: pointer; font-size: 10px; padding: 2px 3px; border-radius: 3px;
    opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s; flex-shrink: 0;
}
.hot-tools-row:hover .hot-tools-del { opacity: 1; }
.hot-tools-del:hover { background: rgba(255,80,80,0.15); color: #ff5050; }

/* Пульс во время скана */
@keyframes hotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.3; transform: scale(0.65); }
}
.hot-tools-scanning-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: #ff8c3a; animation: hotPulse 1.1s ease-in-out infinite;
    vertical-align: middle; margin-left: 4px;
}

/* ── Hot Tools: exchange checkboxes in modal ── */
.ht-exch-chk {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    background: rgba(255,255,255,0.03);
    user-select: none;
}
.ht-exch-chk:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.16);
}
.ht-exch-chk input[type=checkbox] {
    appearance: none; -webkit-appearance: none;
    width: 14px; height: 14px; flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.25);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: background 0.12s, border-color 0.12s;
}
.ht-exch-chk input[type=checkbox]:checked {
    background: var(--ec, #1eb4ff);
    border-color: var(--ec, #1eb4ff);
}
.ht-exch-chk input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    left: 2px; top: -1px;
    width: 5px; height: 9px;
    border: 2px solid #000;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}
/* Когда снят — визуально затухает */
.ht-exch-chk:has(input:not(:checked)) {
    opacity: 0.45;
}
.ht-exch-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ht-exch-name {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #e0e0f0;
    flex: 1;
}
.ht-exch-lbl {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    opacity: 0.7;
}

/* ── Hot Tools: таблица с CSS Grid ──────────────────────────────────
   Колонки: [name auto] [vol 52px] [cnt 28px] [first 36px] [last 36px] [del 18px]
   ─────────────────────────────────────────────────────────────────── */

/* Grid-шаблон — одинаковый для заголовка и каждой строки */
.hot-tools-header,
.hot-tools-row {
    display: grid;
    grid-template-columns: 16px 1fr 52px 28px 36px 36px 18px;
    align-items: center;
    gap: 0;
    padding: 4px 8px;
}

/* Заголовок */
.hot-tools-header {
    border-bottom: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px 8px 3px;
}
.hot-tools-header span {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: rgba(140,140,165,0.5);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
}
/* Все колонки кроме первых двух — выравнивать вправо */
.hot-tools-header span:not(:first-child):not(:nth-child(2)) { text-align: right; }

/* Строка данных */
.hot-tools-row {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.12s;
}
.hot-tools-row:hover { background: rgba(255,140,60,0.07); }

/* Закреплённая строка */
.ht-row-pinned {
    background: rgba(255,210,0,0.04);
    border-left: 2px solid rgba(255,210,0,0.35);
}
.ht-row-pinned:hover { background: rgba(255,210,0,0.09); }

/* Кнопка звёздочки */
.ht-pin-btn {
    background: none;
    border: none;
    color: rgba(180,180,200,0.25);
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    line-height: 1;
    transition: color 0.15s, transform 0.15s;
    text-align: center;
    width: 16px;
    flex-shrink: 0;
}
.ht-pin-btn:hover { color: rgba(255,210,0,0.7); transform: scale(1.2); }
.ht-pin-btn.ht-pin-active { color: #ffd700; }
.ht-pin-btn.ht-pin-active:hover { color: rgba(255,210,0,0.5); }
.hth-pin { width: 16px; flex-shrink: 0; }

/* Кликабельные заголовки */
.ht-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s;
    border-radius: 2px;
    padding: 1px 0;
}
.ht-sortable:hover { color: #e0e0f0 !important; }

/* Стрелки сортировки */
.ht-sort-arrow  { font-size: 9px; margin-left: 1px; vertical-align: middle; }
.ht-sort-neutral { opacity: 0.35; }
.ht-sort-active  { color: #ff8c3a; opacity: 1; }

/* Активный столбец сортировки */
.ht-col-active { color: #ff8c3a !important; }

/* ── Ячейки строк ── */
.ht-c-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #e8e8f0;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    transition: color 0.12s;
    min-width: 0;
}
.hot-tools-row:hover .ht-c-name { color: #ffaa5c; }

.ht-c-vol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #ff8c3a;
    font-weight: 600;
    text-align: right;
}

.ht-c-cnt {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    text-align: right;
}

.ht-c-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    text-align: right;
}
.ht-first { color: rgba(140,210,255,0.75); }
.ht-last  { color: rgba(255,160,80,0.85);  }

/* Анимация появления */
@keyframes hotFlash {
    0%   { background: rgba(255,140,60,0.30); }
    100% { background: transparent; }
}
.hot-tools-row.new-entry { animation: hotFlash 1.4s ease-out forwards; }
/* ── Изменение цены за 24ч в топбаре ── */
.price-change24h {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: color 0.2s;
}
.price-change24h.up {
    color: #00e676;
    background: rgba(0, 230, 118, 0.08);
    border-color: rgba(0, 230, 118, 0.2);
}
.price-change24h.down {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.2);
}
