/* ============ MixAutoTrade — quiet dark, minimalist UI ============ */
:root {
  color-scheme: dark;
  --bg0: #0B0D11;         /* page base */
  --bg1: #0E1116;         /* faint lift toward the top */
  --surface: #14171D;     /* card */
  --surface-2: #1A1E25;   /* raised / hover / inputs */
  --surface-3: #20242C;   /* controls */
  --text: #E7E9EC;        /* soft white, not pure */
  --text-2: #B4B9C2;      /* secondary */
  --muted: #7E858F;       /* calm grey */
  --line: rgba(255,255,255,0.07);   /* hairline */
  --line-2: rgba(255,255,255,0.12);
  /* back-compat aliases (old class rules read these) */
  --glass-bg: var(--surface);
  --glass-brd: var(--line);
  --glass-hi: var(--surface-2);
  --accent: #33D69F;      /* mint-emerald — the single accent */
  --accent-2: #23A982;
  --accent2: #23A982;
  --accent-soft: rgba(51,214,159,0.13);
  --moon: #E7E9EC;        /* legacy alias → clean monochrome mark */
  --moon-2: #B4B9C2;
  --moon-glow: rgba(51,214,159,0.18);
  --green: #2FC98C;       /* up */
  --red: #F0616F;         /* down (softer than neon) */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,0.30), 0 10px 30px rgba(0,0,0,0.26);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.28);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body[data-theme="light"] {
  color-scheme: light;
  --bg0: #F5F6F8;
  --bg1: #EDEFF2;
  --surface: #FFFFFF;
  --surface-2: #F3F5F7;
  --surface-3: #ECEEF1;
  --text: #0F1319;
  --text-2: #3C424C;
  --muted: #6B7280;
  --line: rgba(15,20,30,0.09);
  --line-2: rgba(15,20,30,0.14);
  --accent: #12B886;
  --accent-2: #0CA678;
  --accent2: #0CA678;
  --accent-soft: rgba(18,184,134,0.12);
  --moon: #0F1319;
  --moon-glow: rgba(18,184,134,0.16);
  --green: #12B886;
  --red: #E8445A;
  --shadow: 0 1px 2px rgba(20,30,50,0.06), 0 12px 30px rgba(20,30,50,0.10);
  --shadow-sm: 0 1px 2px rgba(20,30,50,0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(92px + var(--safe-bottom));
}

/* ---- calm backdrop: one faint accent aura, no neon ---- */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(90% 60% at 50% -10%, color-mix(in srgb, var(--accent) 7%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 46%);
}
/* legacy decorative nodes — retired in the redesign */
.bg::before, .moon, .blob { display: none !important; }

/* ---- card primitive (calm surface, hairline, soft shadow — no glass blur) ---- */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}
.pad { padding: 16px; }

/* ---- topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: 0; padding: 14px 16px calc(14px - 1px);
  display: flex; align-items: center; justify-content: space-between;
  border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  background: color-mix(in srgb, var(--bg0) 78%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  box-shadow: none;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: none;
}
.logo svg { width: 21px; height: 21px; }
.logo svg path, .splash-logo svg path {
  fill: var(--accent);
  filter: none;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.2px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.mode-pill {
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); font-weight: 600; font-size: 11.5px; letter-spacing: 0.3px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.mode-pill:active { transform: scale(0.96); }

/* ---- screens ---- */
main { padding: 8px 14px 0; }
.screen { display: none; }
.screen.active { display: block; animation: screenIn 0.5s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px);} to {opacity:1; transform:none;} }
@keyframes fade { from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }
/* staggered entrance for the direct sections of a screen (runs on screen-show
   only — inner card refreshes don't re-trigger it, so no flicker) */
.screen.active > * { animation: cardIn 0.55s var(--ease) both; }
.screen.active > *:nth-child(1){animation-delay:.02s}
.screen.active > *:nth-child(2){animation-delay:.06s}
.screen.active > *:nth-child(3){animation-delay:.10s}
.screen.active > *:nth-child(4){animation-delay:.14s}
.screen.active > *:nth-child(5){animation-delay:.18s}
.screen.active > *:nth-child(6){animation-delay:.22s}
.screen.active > *:nth-child(n+7){animation-delay:.26s}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px);} to {opacity:1; transform:none;} }
@media (prefers-reduced-motion: reduce) {
  .screen.active, .screen.active > * { animation: none !important; }
}
.screen-title { font-size: 25px; font-weight: 700; letter-spacing: -0.6px;
  margin: 10px 2px 16px; text-shadow: none; }

/* ---- search ---- */
.search { padding: 2px 14px; margin-bottom: 14px; border-radius: 14px; }
.search input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; padding: 12px 0;
}
.search input::placeholder { color: var(--muted); }

/* ---- market list ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.coin {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.coin:hover { background: var(--surface-2); border-color: var(--line-2); }
.coin:active { transform: scale(0.985); }
.coin .sym { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 7px; letter-spacing: -0.2px; }
.coin .perp { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--accent);
  background: var(--accent-soft); padding: 2px 5px; border-radius: 5px; }
.market-count { margin: -6px 4px 12px; }
.coin .star { color: var(--muted); font-size: 15px; cursor: pointer; line-height: 1; }
.coin .star.on { color: #ffcf4d; }
.bal-total { font-size: 24px; font-weight: 800; margin-top: 2px; }
.demo-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: #ffcf4d;
  background: rgba(255,207,77,0.16); padding: 2px 7px; border-radius: 6px; vertical-align: middle; }

/* ---- trades rows ---- */
.trade.open .t-main { cursor: pointer; flex: 1; }
.trade .t-right { display: flex; align-items: center; gap: 10px; }
.trade .pnl { text-align: right; font-weight: 700; }
.t-close { background: rgba(255,92,114,0.14); color: var(--red);
  border: 1px solid rgba(255,92,114,0.3); border-radius: 10px; padding: 9px 12px;
  font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.t-close:active { transform: scale(0.96); }
.sec-label { font-size: 12px; color: var(--muted); margin: 10px 4px 2px; font-weight: 600; }

/* ---- PnL share card (BingX-style) ---- */
.card-wrap { width: 100%; max-width: 420px; }
.card-wrap .row.gap .btn-ghost, .card-wrap .btn-danger { flex: 1; margin: 0; width: auto; }
.btn-danger { padding: 13px; border: none; border-radius: 14px; cursor: pointer;
  font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(135deg, #ff5c72, #c23a4d); }
.kill-card { border-color: rgba(255,83,80,0.35); }
.kill-card .btn-danger { width: 100%; margin-top: 12px; }
.kill-card .btn-danger:disabled { opacity: .6; }
.pcard { position: relative; overflow: hidden; border-radius: 22px; padding: 22px;
  background: radial-gradient(130% 110% at 100% 0%, #12203f, #070b16);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow); }
.pcard-glow { position: absolute; right: 0; top: 8px; width: 58%; height: 72%; pointer-events: none; }
.pcard-top, .pcard-label, .pcard-pair, .pcard-pct, .pcard-rows, .pcard-foot { position: relative; z-index: 2; }
.pcard-top { display: flex; justify-content: space-between; align-items: center; }
.pcard-brand { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; color: #eaf0ff; }
.pcard-brand .logo-sm { color: var(--accent); }
.pcard-mode { font-size: 11px; font-weight: 800; color: #ffcf4d; background: rgba(255,207,77,0.16); padding: 3px 8px; border-radius: 6px; }
.pcard-label { margin-top: 28px; color: #aab3cc; font-size: 15px; font-weight: 600; }
.pcard-pair { margin-top: 10px; font-size: 20px; font-weight: 800; color: #fff; }
.pcard-pair .sep { color: #3a4a6a; margin: 0 4px; }
.pcard-pct { margin-top: 8px; font-size: 46px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.pcard-rows { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.pcard-rows > div { display: flex; gap: 14px; align-items: baseline; }
.pcard-rows span { color: #8a93ad; font-size: 13px; min-width: 130px; }
.pcard-rows b { color: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.pcard-foot { margin-top: 20px; color: #6b7597; font-size: 12px;
  display: flex; justify-content: space-between; align-items: center; }
.pcard-ref b { color: #aab3cc; letter-spacing: 1px; }

/* ---- referrals ---- */
.ref-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 4px; }
.ref-code { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--accent); }
.ref-count { font-size: 22px; font-weight: 800; }
.coin .vol { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.coin .spark { flex: 1; height: 34px; }
.coin .px { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.coin .price { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
/* exchange-style change pill */
.chg { font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 7px; min-width: 62px; text-align: center; }
.chg.up { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.chg.down { color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }

/* ---- exchange market header: stats + tabs + column head ---- */
.mkt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.mkt-stats .ms-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 11px;
}
.mkt-stats .ms-mover { cursor: pointer; transition: transform .12s, border-color .2s; }
.mkt-stats .ms-mover:active { transform: scale(0.97); }
.mkt-stats .ms-l { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; white-space: nowrap; }
.mkt-stats .ms-v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mkt-stats .ms-v .up { color: var(--green); font-size: 11.5px; }
.mkt-stats .ms-v .down { color: var(--red); font-size: 11.5px; }
.mkt-tabs { display: flex; gap: 7px; margin-bottom: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mkt-tabs::-webkit-scrollbar { display: none; }
.mkt-tabs button {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.mkt-tabs button:active { transform: scale(0.96); }
.mkt-tabs button.active {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  background: var(--accent-soft);
  box-shadow: none;
}
.mkt-thead { display: flex; align-items: center; padding: 0 16px 8px; font-size: 10.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.mkt-thead .mh-pair { flex: 1 1 auto; }
.mkt-thead .mh-spark { flex: 0 0 auto; width: 76px; margin: 0 10px; text-align: center; }
.mkt-thead .mh-px { flex: 0 0 auto; width: 96px; text-align: right; }
@media (max-width: 480px) {
  .mkt-stats { grid-template-columns: repeat(2, 1fr); }
  .mkt-thead .mh-spark { width: 58px; margin: 0 6px; }
  .mkt-thead .mh-px { width: 82px; }
}

/* ---- fields / buttons ---- */
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.field {
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 12px 13px; font-size: 15px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.field.wide { width: 100%; }
/* exchange-style select control (native option list stays OS-themed) */
select.field {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--bg1); border: 1px solid var(--glass-brd);
  font-weight: 700; padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.field option { background: var(--bg1); color: var(--text); font-weight: 600; }
.tf-group { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px;
  border-radius: 12px; border: 1px solid var(--line); }
.tf-group button {
  border: none; background: transparent; color: var(--muted);
  padding: 8px 13px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: color .2s var(--ease), background .25s var(--ease);
}
.tf-group button:active { transform: scale(0.95); }
.tf-group button.active {
  color: var(--text); background: var(--surface-3);
  box-shadow: var(--shadow-sm);
}
.btn-primary {
  position: relative; overflow: hidden;
  width: 100%; margin: 14px 0; padding: 15px; border: none; border-radius: 13px;
  color: #062018; font-size: 15.5px; font-weight: 700; letter-spacing: 0.1px; cursor: pointer;
  background: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 26%, transparent);
  transition: transform .12s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-primary:active { transform: translateY(1px) scale(0.995); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-ghost {
  position: relative; overflow: hidden;
  width: 100%; margin-top: 10px; padding: 13px; border-radius: 13px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; font-size: 15px;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn-ghost:active { transform: scale(0.98); }

/* ---- signal card ---- */
.sigcard { margin-top: 14px; overflow: hidden; }
.sigcard .head {
  padding: 16px; display: flex; justify-content: space-between; align-items: center;
}
.sigcard.long .head { background: linear-gradient(135deg, rgba(0,192,118,0.16), transparent); }
.sigcard.short .head { background: linear-gradient(135deg, rgba(255,83,80,0.16), transparent); }
.sigcard .dir {
  font-size: 15px; font-weight: 800; letter-spacing: .5px;
  padding: 5px 14px; border-radius: 8px; color: #fff;
}
.sigcard.long .dir { background: var(--green); }
.sigcard.short .dir { background: var(--red); }
.sigcard .badge { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.levels { padding: 8px 16px 16px; }
.level-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--glass-brd); }
.level-row:last-child { border-bottom: none; }
.level-row .k { color: var(--muted); }
.level-row .v { font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.level-row .v.red { color: var(--red); }
.level-row .v.green { color: var(--green); }
.reasons { padding: 0 16px 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---- OKX-style Leading + Confirmation indicator panel ---- */
.ind-panel {
  margin: 4px 16px 14px; border: 1px solid var(--glass-brd); border-radius: 12px;
  overflow: hidden; background: rgba(0,0,0,0.22);
}
.ind-head, .ind-row {
  display: grid; grid-template-columns: 1fr 54px 54px; align-items: center;
}
.ind-head {
  padding: 9px 12px; background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--glass-brd); font-size: 12px; font-weight: 700;
}
.ind-head .ind-name { color: var(--text); text-transform: uppercase; letter-spacing: .4px; }
.ind-cell { text-align: center; font-size: 12px; }
.col-long { color: var(--green); }
.col-short { color: var(--red); }
.ind-sec {
  padding: 8px 12px 6px; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  display: flex; justify-content: space-between; align-items: center;
}
.ind-tally { color: var(--accent2); font-family: var(--mono); }
.ind-row { padding: 7px 12px; border-top: 1px solid rgba(255,255,255,0.04); }
.ind-name { font-size: 13px; color: var(--text); }
.ind-cell .ok { color: var(--green); font-weight: 800; }
.ind-cell .no { color: rgba(255,83,80,0.55); }

/* ---- analytics ---- */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.metric { padding: 13px 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.metric .label { font-size: 12px; color: var(--muted); }
.metric .value { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.up { background: rgba(47,224,138,0.16); color: var(--green); }
.tag.down { background: rgba(255,92,114,0.16); color: var(--red); }
.tag.flat { background: var(--glass-hi); color: var(--muted); }
.verdict { margin-top: 12px; padding: 16px; border-radius: 16px; line-height: 1.5;
  border-left: 3px solid var(--accent); }
.levels-list { margin-top: 12px; }
.levels-list .lv { display: flex; justify-content: space-between; padding: 9px 0;
  border-bottom: 1px solid var(--glass-brd); font-size: 14px; }

/* ---- leaderboard ---- */
#lbList .lv { display: flex; justify-content: space-between; align-items: center;
  padding: 9px 6px; border-bottom: 1px solid var(--glass-brd); font-size: 14px; }
#lbList .lv:last-child { border-bottom: none; }
#lbList .lb-me { background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 10px; }

/* ---- trades ---- */
.stat-row { display: flex; justify-content: space-between; text-align: center; }
.stat-row .cell .n { font-size: 20px; font-weight: 800; }
.stat-row .cell .l { font-size: 11px; color: var(--muted); }
.trade { padding: 14px; border-radius: 14px; display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--line); transition: background .2s var(--ease); }
.trade:hover { background: var(--surface-2); }
.trade.open { border-left: 2px solid var(--accent); }
.trade .s { font-weight: 600; }
.trade .side.long { color: var(--green); }
.trade .side.short { color: var(--red); }
.trade .pnl.up { color: var(--green); }
.trade .pnl.down { color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---- profile ---- */
.glass.pad + .glass.pad { margin-top: 12px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  font-size: 22px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }

/* ---- Axiom-style profile hero ---- */
.profile-hero { display: flex; align-items: center; gap: 14px; padding: 16px; }
.hero-avatar { width: 62px; height: 62px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  background-size: cover; background-position: center;
  border: 2px solid var(--glass-hi); box-shadow: 0 4px 18px rgba(0,0,0,.28); }
.hero-avatar.has-img span { display: none; }
.hero-meta { min-width: 0; }
.hero-name { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero-points { font-size: 13px; margin-top: 4px; font-weight: 600; }
.hero-badge { font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 2px 7px;
  border-radius: 7px; }
.hero-badge.demo { background: rgba(139,147,163,.18); color: var(--muted); }
.hero-badge.live { background: rgba(0,192,118,.18); color: var(--green); }

/* ---- PnL timeframe tabs ---- */
.pnl-tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.pnl-tabs button { flex: 1; padding: 9px 0; border-radius: 11px; font-weight: 600; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: color .2s var(--ease), background .2s var(--ease); }
.pnl-tabs button:active { transform: scale(0.97); }
.pnl-tabs button.active { background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---- PnL main card ---- */
.pnl-main .pnl-wr { text-align: right; font-size: 15px; line-height: 1.15; }
.pnl-hero { font-size: 34px; font-weight: 800; line-height: 1; margin: 6px 0 12px;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pnl-hero-usd { font-size: 16px; font-weight: 700; }
.pnl-rows .lv { padding: 6px 0; }
.pnl-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 14px;
  padding-top: 16px; overflow-x: auto; }
.pnl-bar-col { flex: 1 0 auto; min-width: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.pnl-bar { width: 70%; max-width: 26px; border-radius: 4px 4px 2px 2px; min-height: 3px; }
.pnl-bar.up { background: linear-gradient(180deg, var(--green), rgba(0,192,118,.55)); }
.pnl-bar.down { background: linear-gradient(180deg, rgba(255,83,80,.55), var(--red)); }
.pnl-bar.flat { background: var(--glass-hi); }
.pnl-bar-val { font-size: 9px; font-weight: 700; margin-bottom: 3px; height: 12px; white-space: nowrap; }
.pnl-bar-val.up { color: var(--green); } .pnl-bar-val.down { color: var(--red); }
.pnl-bar-x { font-size: 9px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

/* ---- profit distribution ---- */
.dist-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 4px;
  background: var(--glass-hi); }
.dist-bar span { display: block; height: 100%; }
.dist-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }

/* ---- price alerts ---- */
.alert-form { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 8px; margin: 8px 0 6px; }
.alert-form .field { padding: 10px; }
.alert-form .btn-primary { margin: 0; padding: 10px 14px; white-space: nowrap; }
.alert-row .alert-del { color: var(--muted); cursor: pointer; padding: 0 6px; font-weight: 700; }
.alert-row .alert-del:hover { color: var(--red); }
.alert-row.done { opacity: .8; }

/* ---- manual trade ---- */
#manualCard { margin-top: 12px; }
.manual-side { display: flex; width: 100%; margin: 10px 0 4px; }
.manual-side button { flex: 1; padding: 10px 0; font-weight: 800; }
.manual-side button[data-side="LONG"].active { background: rgba(0,192,118,.22); color: var(--green); }
.manual-side button[data-side="SHORT"].active { background: rgba(255,83,80,.22); color: var(--red); }
#manualMsg { margin-top: 8px; word-break: break-word; }
.sig-open-trade { width: 100%; margin-top: 12px; }
#sigTradeMsg { margin-top: 8px; word-break: break-word; }

.setting-title { font-weight: 700; margin-bottom: 10px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; }
.slider-row { padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.slider-row input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { position: relative; width: 46px; height: 27px; display: inline-block; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--glass-hi);
  border: 1px solid var(--glass-brd); transition: 0.2s; }
.switch span::before { content: ""; position: absolute; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px; transition: 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.switch input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.switch input:checked + span::before { transform: translateX(19px); }
.theme-group { display: flex; }
.disclaimer { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---- tabbar ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  border: none; border-top: 1px solid var(--line); border-radius: 0;
  background: color-mix(in srgb, var(--bg0) 82%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  box-shadow: none;
}
.tab { position: relative; border: none; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 500;
  padding: 7px 8px 5px; border-radius: 12px; flex: 1;
  transition: color .25s var(--ease); }
.tab span { font-size: 17px; line-height: 1; transition: transform .3s var(--ease); display: inline-block; }
.tab:active span { transform: scale(0.86); }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active span { color: var(--accent); transform: translateY(-1px); }
/* sliding accent dot indicator under the active tab */
.tab.active::after {
  content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: tabDot .3s var(--ease) both;
}
@keyframes tabDot { from { opacity: 0; transform: translate(-50%, 4px);} to { opacity: 1; transform: translate(-50%, 0);} }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 420px; padding: 22px; display: flex; flex-direction: column; gap: 10px;
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal h3 { margin: 0; }
#connectMsg.ok { color: var(--green); }
#connectMsg.err { color: var(--red); }

.skeleton { height: 60px; border-radius: 14px; margin-bottom: 10px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -60% 0; } }
@keyframes pulse { 0%,100% { opacity: 0.5;} 50% { opacity: 0.9;} }

/* ================= TradingView chart ================= */
.tv-chart { height: 340px; margin: 12px 0; padding: 6px; overflow: hidden; border-radius: 18px; }
.tv-chart iframe { border-radius: 14px; width: 100% !important; height: 100% !important; }
.tv-chart .empty { padding: 24px; }

/* ================= exchange-style analytics ================= */
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }

/* price hero */
.price-hero { margin-bottom: 12px; }
.ph-top { display: flex; justify-content: space-between; align-items: flex-start; }
.ph-base { font-size: 24px; font-weight: 800; }
.ph-quote { font-size: 14px; color: var(--muted); font-weight: 600; }
.ph-price { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ph-stats { display: flex; justify-content: space-between; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--glass-brd); }
.ph-stats > div { display: flex; flex-direction: column; gap: 3px; }
.ph-stats b { font-variant-numeric: tabular-nums; }

/* liquidation map (leverage → liq price ladder) */
.liq-map { display: flex; flex-direction: column; gap: 6px; }
.liq-row { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center;
  gap: 10px; padding: 7px 0; }
.liq-lev { font-size: 12px; font-weight: 800; text-align: center; padding: 3px 0;
  border-radius: 7px; }
.liq-lev.short { color: var(--red); background: rgba(255,92,114,0.14); }
.liq-lev.long { color: var(--green); background: rgba(47,224,138,0.14); }
.liq-lev.now { color: var(--text); background: var(--glass-hi); font-size: 11px; }
.liq-track { height: 8px; border-radius: 6px; background: var(--glass-hi); overflow: hidden; }
.liq-bar { height: 100%; border-radius: 6px; }
.liq-bar.short { background: linear-gradient(90deg, transparent, var(--red)); margin-left: auto; }
.liq-bar.long { background: linear-gradient(90deg, var(--green), transparent); }
.liq-price { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.liq-dist { font-size: 12px; font-weight: 700; min-width: 48px; text-align: right; }
.liq-dist.up { color: var(--red); }     /* above price = short liquidation zone */
.liq-dist.down { color: var(--green); }
.liq-row.current { border-top: 1px dashed var(--glass-brd); border-bottom: 1px dashed var(--glass-brd);
  padding: 10px 0; grid-template-columns: 60px 1fr auto; }
.liq-row.current .liq-price { font-size: 17px; font-weight: 800; }
.liq-row.current .liq-dist { color: var(--muted); }

/* sentiment split bar */
.sent-bar { display: flex; height: 30px; border-radius: 10px; overflow: hidden; font-size: 12px;
  font-weight: 800; color: #fff; }
.sent-long { background: linear-gradient(90deg, #1fa86a, var(--green)); display: grid; place-items: center; }
.sent-short { background: linear-gradient(90deg, var(--red), #c23a4d); display: grid; place-items: center; }

/* ============ analytics: whales / calendar / derivatives / summary ============ */
/* mini sparkline in the market list */
.coin { align-items: center; }
.spark { width: 76px; height: 30px; flex: 0 0 auto; margin: 0 10px; opacity: .95; }
.spark svg { display: block; width: 100%; height: 100%; }

/* умные деньги · long/short stacked bars */
.ls-item { margin-top: 12px; }
.ls-item:first-of-type { margin-top: 6px; }
.ls-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.ls-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; font-size: 11px;
  font-weight: 800; color: #fff; }
.ls-long { background: linear-gradient(90deg, #1fa86a, var(--green)); display: grid; place-items: center; min-width: 34px; }
.ls-short { background: linear-gradient(90deg, var(--red), #c23a4d); display: grid; place-items: center; min-width: 34px; }

/* деривативы rows */
.deriv-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--glass-brd); }
.deriv-row:last-child { border-bottom: none; }
.deriv-name { font-weight: 700; margin-bottom: 3px; }
.deriv-v { font-family: var(--mono); font-weight: 800; font-size: 18px; white-space: nowrap; }
.deriv-v.up { color: var(--green); } .deriv-v.down { color: var(--red); }

/* макро-события */
.ev-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.ev-legend .ev-dot { margin-left: 8px; }
.ev-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.ev-dot.high { background: #ff4d4f; } .ev-dot.med { background: #f0b429; }
.ev-dot.done { background: transparent; color: var(--green); font-size: 12px; width: auto; height: auto; }
.ev-list { display: flex; flex-direction: column; }
.ev-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.05); }
.ev-l { display: flex; gap: 9px; align-items: flex-start; }
.ev-l .ev-dot { margin-top: 5px; }
.ev-title { font-size: 13px; font-weight: 600; }
.ev-cc { font-size: 10px; font-weight: 800; color: var(--muted); background: rgba(255,255,255,0.08);
  padding: 1px 5px; border-radius: 5px; margin-right: 4px; }
.ev-r { text-align: right; white-space: nowrap; }
.ev-fp { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }

/* сводка простыми словами */
.sum-title { font-weight: 800; font-size: 16px; margin: 8px 0 10px; }
.sum-row { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; line-height: 1.45; }
.sum-tag { font-size: 10px; font-weight: 800; color: var(--muted); background: rgba(255,255,255,0.07);
  padding: 2px 7px; border-radius: 6px; flex: 0 0 auto; letter-spacing: .4px; }
.sum-verdict { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--glass-brd);
  font-size: 13px; line-height: 1.5; }
.sum-verdict::before { content: ""; }

/* trade "why" + strength badge */
.why { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.str-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-left: 4px;
  vertical-align: middle; }
.str-badge.strong { background: rgba(0,192,118,0.18); color: var(--green); }
.str-badge.medium { background: rgba(240,180,41,0.18); color: #f0b429; }
.str-badge.weak { background: rgba(255,255,255,0.08); color: var(--muted); }

/* ============ liquidation heatmap — full-screen terminal ============ */
.liq-open-btn { width: 100%; margin-top: 10px; }

.liq-screen {
  position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column;
  background: #05070b; overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overscroll-behavior: contain;
}
.liq-screen.open { display: flex; }
body.liq-open { overflow: hidden; touch-action: none; }
.liq-topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06); flex: 0 0 auto;
}
.liq-back {
  display: flex; align-items: center; gap: 3px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); color: var(--text); border-radius: 10px;
  padding: 8px 13px 8px 9px; font-size: 14px; font-weight: 600; cursor: pointer; flex: 0 0 auto;
}
.liq-back span { font-size: 20px; line-height: 0.8; margin-top: -2px; }
.liq-back:active { background: rgba(255,255,255,0.12); }
.liq-titlewrap { flex: 1; text-align: center; min-width: 0; }
.liq-title { font-weight: 800; font-size: 16px; }
.liq-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liq-spacer { width: 86px; flex: 0 0 auto; }

.liq-controls { display: flex; gap: 10px; align-items: center; padding: 10px 14px; flex: 0 0 auto; }
.liq-controls .field { flex: 1; min-width: 0; }
.liq-controls .tf-group { flex: 0 0 auto; }
.liq-controls .tf-group button { padding: 8px 11px; font-size: 12px; }

.liq-canvas-wrap {
  flex: 1 1 auto; min-height: 0; position: relative;
  margin: 0 12px; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08); background: #06080d; line-height: 0;
  touch-action: none;   /* dragging the heatmap must NOT pan the page */
}
.liq-canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.liq-bottom { flex: 0 0 auto; max-height: 34vh; overflow-y: auto; padding: 12px 14px 16px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.liq-clusters { display: flex; flex-direction: column; gap: 7px; }
.liq-cl { display: flex; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.liq-cl b { min-width: 74px; }
.liq-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.liq-dot.short { background: var(--red); box-shadow: 0 0 6px rgba(255,83,80,0.6); }
.liq-dot.long { background: var(--green); box-shadow: 0 0 6px rgba(0,192,118,0.6); }
.liq-bar { flex: 1; height: 6px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: hidden; }
.liq-cl.short .liq-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #6b1420, var(--red)); }
.liq-cl.long .liq-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #0f3d33, var(--green)); }
.liq-note { line-height: 1.45; margin-top: 12px; font-size: 11px; color: var(--muted); }

/* ============================================================
   MOBILE OPTIMISATION (Telegram Mini App is phone-first)
   ============================================================ */
@media (max-width: 480px) {
  main { padding: 4px 10px 0; }
  .topbar { margin: 8px; padding: 10px 13px; }
  .logo { width: 34px; height: 34px; font-size: 17px; border-radius: 12px; }
  .brand-name { font-size: 15px; }
  .brand-sub { font-size: 11px; }
  .screen-title { font-size: 21px; margin: 6px 2px 12px; }
  .pad { padding: 14px; }

  /* market rows: keep base | sparkline | price on one line, no overflow */
  .coin { padding: 11px 13px; gap: 8px; }
  .coin .sym { font-size: 15px; gap: 6px; min-width: 0; }
  .coin .coin-l { min-width: 0; flex: 1 1 auto; }
  .coin .vol { font-size: 11px; }
  .spark { width: 58px; height: 26px; margin: 0 6px; flex: 0 0 58px; }
  .coin .px { flex: 0 0 auto; text-align: right; }
  .coin .price { font-size: 14px; }
  .coin .chg { font-size: 12px; }
  .coin .perp { display: none; }        /* save width on small phones */

  /* signal card / indicator panel tighter */
  .sigcard .head { padding: 13px; }
  .ind-panel { margin: 4px 12px 12px; }
  .ind-head, .ind-row { grid-template-columns: 1fr 44px 44px; }
  .ind-name { font-size: 12px; }
  .levels { padding: 6px 13px 13px; }

  /* metric grids stay 2-up but tighter */
  .metric-grid { gap: 8px; }
  .metric { padding: 12px; }
  .metric .value { font-size: 18px; }

  /* analytics blocks */
  .ls-head { font-size: 12px; }
  .deriv-v { font-size: 16px; }
  .ev-title { font-size: 12px; }
  .ev-fp { font-size: 10px; }
  .sum-row { font-size: 12px; }

  /* modals fill the screen comfortably */
  .modal-backdrop { padding: 10px; align-items: flex-start; padding-top: 24px; }
  .modal { padding: 16px; gap: 9px; max-height: 94vh; }
  .liq-modal { max-width: 100%; }
  .liq-controls { flex-wrap: wrap; }
  .liq-controls .field { flex: 1 1 100%; }
  .liq-controls .tf-group { width: 100%; justify-content: space-between; }
  .liq-controls .tf-group button { flex: 1; }

  /* trades */
  .trade { padding: 13px; }
  .t-close { padding: 8px 10px; font-size: 12px; }
  .why { font-size: 11px; }

  /* tabbar: fit 5 tabs on narrow screens */
  .tabbar { left: 8px; right: 8px; padding: 6px 3px; }
  .tab { font-size: 10px; padding: 5px 3px; gap: 2px; }
  .tab span { font-size: 17px; }

  /* forms full width, comfortable tap targets */
  .field { font-size: 15px; padding: 12px; }
  .btn-primary, .btn-ghost { padding: 13px; font-size: 15px; }
  .slider-row input[type=range] { height: 26px; }
}

@media (max-width: 360px) {
  .screen-title { font-size: 19px; }
  .coin .sym { font-size: 14px; }
  .spark { width: 46px; flex: 0 0 46px; margin: 0 4px; }
  .tab span { font-size: 16px; }
  .ind-head, .ind-row { grid-template-columns: 1fr 40px 40px; }
}

/* ---- chart drawing tools (TradingView-style left dock) ---- */
.tv-chart { position: relative; }
.draw-overlay { position: absolute; inset: 0; z-index: 5; touch-action: none; }
.draw-toolbar {
  position: absolute; top: 50%; left: 6px; transform: translateY(-50%); z-index: 6;
  display: flex; flex-direction: column; gap: 4px; padding: 5px;
  background: rgba(12,16,26,0.72); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-brd); border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.draw-toolbar button {
  width: 34px; height: 34px; border: none; border-radius: 9px;
  background: rgba(255,255,255,0.05); color: var(--muted);
  cursor: pointer; display: grid; place-items: center;
  transition: background .15s, transform .1s, color .15s;
}
.draw-toolbar button svg { width: 19px; height: 19px; }
.draw-toolbar button:hover { background: rgba(255,255,255,0.13); color: var(--fg); }
.draw-toolbar button.active { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: #06121f; }
.draw-toolbar button:active { transform: scale(0.9); }
.draw-toolbar button[data-tool="long"] { color: #2fe08a; }
.draw-toolbar button[data-tool="short"] { color: #ff5c72; }
.draw-toolbar button[data-tool="clear"]:hover { color: #ff5c72; }
.draw-toolbar button.active[data-tool="long"],
.draw-toolbar button.active[data-tool="short"] { color: #06121f; }
.draw-sep { height: 1px; align-self: stretch; background: var(--glass-brd); margin: 3px 4px; }

/* live price/time readout that follows the crosshair */
.chart-readout {
  position: absolute; top: 6px; right: 8px; z-index: 6; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  max-width: 78%; padding: 4px 9px; border-radius: 9px;
  background: rgba(12,16,26,0.72); backdrop-filter: blur(8px);
  border: 1px solid var(--glass-brd);
  font: 600 11px/1.3 ui-monospace, monospace; color: var(--muted);
  opacity: 0; transition: opacity .12s;
}
.chart-readout b { color: var(--fg); font-weight: 700; }
.chart-readout .rd-date { color: var(--accent); }
@media (max-width: 480px) {
  .draw-toolbar button { width: 30px; height: 30px; font-size: 14px; }
  .chart-readout { font-size: 10px; gap: 6px; padding: 3px 7px; }
}

/* liquidation heatmap canvas: capture drag/zoom, don't scroll the modal */
#liqCanvas { touch-action: none; cursor: grab; }
#liqCanvas:active { cursor: grabbing; }

/* ---- crypto news ---- */
.news-list { margin-top: 6px; }
.news-row { padding: 10px 2px; border-bottom: 1px solid var(--glass-brd); cursor: pointer; transition: opacity .12s; }
.news-row:last-child { border-bottom: none; }
.news-row:active { opacity: 0.6; }
.news-title { font-size: 13.5px; line-height: 1.35; }
.news-meta { margin-top: 3px; font-size: 11px; color: var(--muted); }
.news-meta span:first-child { color: var(--accent); }
.news-toprow { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.news-tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.news-tag.bull { background: rgba(0,192,118,.18); color: var(--green); }
.news-tag.bear { background: rgba(255,83,80,.18); color: var(--red); }
.news-tag.flat { background: var(--glass-hi); color: var(--muted); }
.news-topic { font-size: 11px; font-weight: 700; color: var(--muted); }
.news-note { margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--text); opacity: .82; }
.news-open { color: var(--accent); }
.edge-curve { width: 100%; height: 90px; display: block; margin-top: 6px; }

/* ================= loading splash (rising PnL) ================= */
.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 15%, var(--bg1) 0%, var(--bg0) 70%);
  transition: opacity .55s ease, visibility .55s ease;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 24px; width: min(86vw, 380px);
  animation: splashRise .6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes splashRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.splash-brand {
  font-size: 20px; font-weight: 800; letter-spacing: .3px; color: var(--text);
  display: flex; align-items: center; gap: 9px;
}
.splash-logo {
  display: inline-flex; width: 26px; height: 26px;
  filter: drop-shadow(0 0 12px var(--moon-glow));
  animation: splashSpin 4s ease-in-out infinite;
}
.splash-logo svg { width: 26px; height: 26px; }
@keyframes splashSpin { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.1); } }
.splash-chartwrap {
  width: 100%; height: 140px; position: relative;
  border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, rgba(0,192,118,.05), rgba(0,0,0,0));
  border: 1px solid var(--glass-brd);
}
.splash-chart { width: 100%; height: 100%; display: block; }
.splash-line {
  stroke-dasharray: 900; stroke-dashoffset: 900;
  animation: splashDraw 1.5s cubic-bezier(.22,.12,.2,1) forwards;
  filter: drop-shadow(0 2px 6px rgba(0,192,118,.45));
}
@keyframes splashDraw { to { stroke-dashoffset: 0; } }
.splash-area { opacity: 0; animation: splashFade .8s ease .7s forwards; }
@keyframes splashFade { to { opacity: 1; } }
.splash-pnl {
  font-family: var(--mono); font-size: 40px; font-weight: 800; line-height: 1;
  color: var(--green); letter-spacing: -.5px;
  text-shadow: 0 0 24px rgba(0,192,118,.45);
  font-variant-numeric: tabular-nums;
}
.splash-pnl.pop { animation: splashPop .4s cubic-bezier(.2,1.6,.3,1); }
@keyframes splashPop { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }
.splash-status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 2px; }
.splash-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.splash-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--muted);
  animation: splashBlink 1.1s ease-in-out infinite;
}
.splash-dots i:nth-child(2) { animation-delay: .18s; }
.splash-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes splashBlink { 0%,100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }

/* ================= market header + exchange picker ================= */
.market-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mkt-ex-wrap { display: flex; align-items: center; gap: 8px; }
.mkt-ex-pick { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px;
  background: var(--glass-bg); border: 1px solid var(--glass-brd); }
.mkt-ex-pick button {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .2px;
  color: var(--muted); background: transparent; border: 0; cursor: pointer;
  padding: 5px 9px; border-radius: 9px; transition: all .18s ease;
}
.mkt-ex-pick button.active { color: var(--accent); background: var(--accent-soft);
  box-shadow: none; }
body[data-theme="light"] .mkt-ex-pick button.active { color: var(--accent); }

/* ================= ORDER BOOK (стакан) ================= */
.ob-panel { display: none; }                 /* mobile: hidden (terminal is desktop-only) */
.ob-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.ob-title { font-weight: 800; font-size: 14px; padding: 4px 8px 8px; }
.ob-head {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 4px;
  font-size: 9.5px; color: var(--muted); padding: 0 10px 6px;
  text-transform: uppercase; letter-spacing: .5px;
}
.ob-head span:nth-child(2), .ob-head span:nth-child(3) { text-align: right; }
.ob-side { display: flex; flex-direction: column; }
.ob-asks { justify-content: flex-end; }
.ob-row {
  position: relative; display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 4px;
  padding: 2.5px 10px; font-size: 12px; font-variant-numeric: tabular-nums;
  overflow: hidden; cursor: default;
}
.ob-row:hover { background: var(--glass-bg); }
.ob-bar { position: absolute; top: 0; bottom: 0; right: 0; z-index: 0; opacity: .16; border-radius: 2px 0 0 2px; }
.ob-row.ask .ob-bar { background: var(--red); }
.ob-row.bid .ob-bar { background: var(--green); }
.ob-row > span { position: relative; z-index: 1; }
.ob-row .ob-s, .ob-row .ob-c { text-align: right; opacity: .82; }
.ob-row.ask .ob-p { color: var(--red); font-weight: 600; }
.ob-row.bid .ob-p { color: var(--green); font-weight: 600; }
.ob-mid {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin: 5px 0;
  border-top: 1px solid var(--glass-brd); border-bottom: 1px solid var(--glass-brd);
}
.ob-price { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ob-spread { font-size: 11px; color: var(--muted); }

/* ================= DESKTOP TERMINAL (PC only; phones untouched) ========= */
@media (min-width: 1000px) {
  main { max-width: 1560px; margin: 0 auto; padding: 6px 22px 0; }
  .screen-title { font-size: 22px; margin: 4px 4px 12px; }

  /* --- Analytics = exchange terminal --- */
  .price-hero { margin-bottom: 14px; }
  .ana-main {
    display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 14px; align-items: stretch;
  }
  .ana-main #anaChart { height: 500px; margin: 0; }
  .ana-main .ob-panel {
    display: flex; flex-direction: column; padding: 10px 4px 8px; margin: 0;
    max-height: 500px; overflow: hidden;
  }
  .ana-info {
    column-count: 2; column-gap: 14px; margin-top: 14px;
  }
  .ana-info > * {
    break-inside: avoid; -webkit-column-break-inside: avoid;
    margin: 0 0 14px !important; display: block; width: 100%;
  }
  .ana-info .metric-grid { margin-bottom: 14px !important; }

  /* --- Market = dense pro table --- */
  #screen-market .list {
    gap: 0; border-radius: 14px; overflow: hidden;
    border: 1px solid var(--glass-brd); background: var(--glass-bg);
  }
  #screen-market .coin {
    border-radius: 0; border: 0; border-bottom: 1px solid var(--glass-brd);
    background: transparent; padding: 9px 16px; transition: background .12s ease;
  }
  #screen-market .coin:last-child { border-bottom: 0; }
  #screen-market .coin:hover { background: var(--glass-hi); }
  #screen-market .coin:active { transform: none; }
  #screen-market .coin .spark { width: 200px; height: 34px; margin: 0 18px; }
  #screen-market .coin .price { font-size: 15px; }
  #screen-market .coin .sym { font-size: 15px; }

  /* --- centered pill nav instead of full-width bottom bar --- */
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); max-width: 620px; width: max-content; }

  /* keep long info screens clear of the floating nav */
  #screen-analytics, #screen-trades, #screen-profile, #screen-market { padding-bottom: 96px; }
}

/* wide desktop: give the market sparkline even more room */
@media (min-width: 1400px) {
  #screen-market .coin .spark { width: 280px; }
}

/* ================= chart live-PnL badge (active trade) ================= */
.chart-pnl {
  position: absolute; top: 10px; left: 10px; z-index: 6; pointer-events: none;
  display: flex; gap: 8px; align-items: center; padding: 6px 11px;
  border-radius: 11px; font-size: 12px; font-variant-numeric: tabular-nums;
  background: rgba(10,14,20,.72); border: 1px solid var(--glass-brd); backdrop-filter: blur(8px);
}
.chart-pnl.up { box-shadow: 0 0 0 1px rgba(0,192,118,.4), 0 4px 16px rgba(0,192,118,.2); }
.chart-pnl.down { box-shadow: 0 0 0 1px rgba(255,83,80,.4), 0 4px 16px rgba(255,83,80,.2); }
.chart-pnl .cp-side { font-weight: 800; }
.chart-pnl .cp-side.long { color: var(--green); }
.chart-pnl .cp-side.short { color: var(--red); }
.chart-pnl .cp-val { font-weight: 800; }
.chart-pnl.up .cp-val, .chart-pnl.up .cp-pct { color: var(--green); }
.chart-pnl.down .cp-val, .chart-pnl.down .cp-pct { color: var(--red); }
.chart-pnl .cp-pct { opacity: .9; }

/* ================= trades tape + quick trade (desktop-only) ============ */
.tape-panel, .qt-panel { display: none; }
.tape-panel { font-variant-numeric: tabular-nums; }
.tape-rows { display: flex; flex-direction: column; overflow: hidden; }
.tape-row { display: grid; grid-template-columns: 1.1fr 1fr .95fr; gap: 4px; padding: 2px 10px; font-size: 11.5px; }
.tape-row .tp-a { text-align: right; opacity: .82; }
.tape-row .tp-t { text-align: right; color: var(--muted); font-size: 10.5px; }
.tape-row.buy .tp-p { color: var(--green); font-weight: 600; }
.tape-row.sell .tp-p { color: var(--red); font-weight: 600; }
.qt-panel { padding: 10px 12px; }
.qt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.qt-mode { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.qt-mode.demo { color: var(--accent); background: rgba(58,125,255,.16); }
.qt-mode.live { color: var(--red); background: rgba(255,83,80,.16); }
.qt-stop { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.qt-stop input { flex: 1; }
.qt-stop b { color: var(--text); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.qt-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qt-btns button { border: 0; border-radius: 10px; padding: 11px 0; font-weight: 800; font-size: 13px; cursor: pointer; transition: transform .1s; }
.qt-buy { background: var(--green); color: #04121a; }
.qt-sell { background: var(--red); color: #fff; }
.qt-btns button:active { transform: scale(.97); }
.qt-msg { font-size: 11px; margin-top: 8px; min-height: 14px; text-align: center; }

@media (min-width: 1000px) {
  .ana-main { align-items: start; }
  .ana-rail { display: flex; flex-direction: column; gap: 12px; height: 500px; }
  .ana-rail .ob-panel { flex: 1 1 auto; min-height: 0; overflow: hidden; margin: 0; max-height: none; }
  .ana-rail .tape-panel { display: flex; flex-direction: column; flex: 0 0 150px; overflow: hidden; padding: 8px 2px; margin: 0; }
  .ana-rail .qt-panel { display: block; flex: 0 0 auto; margin: 0; }
}

/* ===== quick-trade SL/TP + tools ===== */
.qt-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.qt-row span { flex: 0 0 78px; }
.qt-row input[type=range] { flex: 1; }
.qt-row b { flex: 0 0 44px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.qt-rr { font-size: 11.5px; color: var(--muted); margin: 2px 0 9px; }
.qt-rr b { color: var(--text); }
.rr-ok { color: var(--green); font-weight: 700; } .rr-bad { color: var(--red); font-weight: 700; }
.qt-tools { display: flex; gap: 8px; margin-top: 9px; align-items: center; }
.qt-alert { display: flex; flex: 1; gap: 4px; }
.qt-alert input { flex: 1; min-width: 0; background: var(--glass-bg); border: 1px solid var(--glass-brd);
  border-radius: 8px; color: var(--text); padding: 7px 9px; font-size: 12px; outline: none; }
.qt-alert button { border: 1px solid var(--glass-brd); background: var(--glass-hi); border-radius: 8px;
  cursor: pointer; font-size: 14px; padding: 0 10px; }
.qt-calc { border: 1px solid var(--glass-brd); background: var(--glass-hi); color: var(--text);
  border-radius: 8px; cursor: pointer; font-size: 11.5px; font-weight: 700; padding: 7px 10px; white-space: nowrap; }

/* ===== whale tape ===== */
.tape-row.whale { background: rgba(255,207,77,0.12); }
.tape-row.whale .tp-p { font-weight: 800; }
.tape-whale { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.tape-whale.buy { color: var(--green); background: rgba(0,192,118,.14); }
.tape-whale.sell { color: var(--red); background: rgba(255,83,80,.14); }

/* ===== chart PnL: liq + cone toggle ===== */
.chart-pnl .cp-liq { color: #ff9f43; opacity: .95; }
.cone-toggle { position: absolute; top: 10px; right: 10px; z-index: 6; width: 30px; height: 30px;
  border-radius: 9px; border: 1px solid var(--glass-brd); background: rgba(10,14,20,.7);
  backdrop-filter: blur(8px); cursor: pointer; font-size: 15px; line-height: 1; }
.cone-toggle.active { border-color: #5b8cff; box-shadow: 0 0 0 1px #5b8cff, 0 0 14px rgba(91,140,255,.5); }

/* ===== depth chart in order book ===== */
.ob-depth { display: block; width: 100%; height: 52px; margin: 0 0 4px; }

/* ===== position calculator modal ===== */
.calc-modal { max-width: 460px; }
.calc-top { display: flex; align-items: baseline; justify-content: space-between; }
.calc-top h3 { margin: 0; }
.calc-sym { font-weight: 800; color: var(--accent); }
.calc-side { margin: 4px 0 10px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.calc-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.calc-grid input { background: var(--glass-bg); border: 1px solid var(--glass-brd); border-radius: 9px;
  color: var(--text); padding: 9px 10px; font-size: 14px; outline: none; font-variant-numeric: tabular-nums; }
.calc-out { margin: 12px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--glass-brd); }
.calc-out .crow { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 13px; }
.calc-out .crow:nth-child(odd) { background: var(--glass-bg); }
.calc-out .crow span { color: var(--muted); }
.calc-out .crow b { font-variant-numeric: tabular-nums; }
.calc-out .cr-green { color: var(--green); } .calc-out .cr-red { color: var(--red); } .calc-out .cr-orange { color: #ff9f43; }

/* ============ 🧠 Мозг бота — learning dashboard ============ */
.brain-card {
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--glass-brd));
  background:
    radial-gradient(120% 80% at 12% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--glass-bg);
}
.brain-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.brain-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; letter-spacing: 0.2px; }
.brain-orb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: brainPulse 2.6s ease-in-out infinite;
}
@keyframes brainPulse {
  0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent); }
  50%     { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent), 0 0 26px color-mix(in srgb, var(--accent) 75%, transparent); }
}
.brain-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.brain-metrics .bm {
  background: var(--glass-bg); border: 1px solid var(--glass-brd); border-radius: 12px;
  padding: 10px 8px; text-align: center;
}
.brain-metrics .bm-v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.brain-metrics .bm-l { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.brain-summary { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.brain-line {
  font-size: 13px; line-height: 1.45; padding: 8px 11px; border-radius: 10px;
  background: var(--glass-bg); border-left: 3px solid var(--accent);
}
.brain-insights { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.brain-insight {
  font-size: 12.5px; line-height: 1.4; padding: 8px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 26%, transparent);
}
.brain-block {
  margin-top: 8px; font-size: 12.5px; line-height: 1.4; padding: 8px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--red) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 26%, transparent);
}
.brain-tag {
  margin-left: 6px; font-size: 9px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 6px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent); vertical-align: middle;
}
@media (max-width: 480px) {
  .brain-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ===== access-denied lock overlay ===== */
#accessLock {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, #0c1024 0%, #05060e 70%);
}
#accessLock .lock-card {
  max-width: 360px; text-align: center; padding: 30px 24px; border-radius: 20px;
}
#accessLock .lock-emoji { font-size: 46px; margin-bottom: 10px; }
#accessLock .lock-title { font-size: 21px; font-weight: 800; margin-bottom: 10px; }
#accessLock .lock-text { color: var(--muted); font-size: 14px; line-height: 1.5; }
#accessLock .lock-sub { color: var(--muted); font-size: 12px; margin-top: 14px; opacity: 0.8; }

/* ===== AI win-probability on the signal card ===== */
.ai-score {
  margin: 12px 0; padding: 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid var(--glass-brd);
}
.ai-head { display: flex; justify-content: space-between; align-items: baseline; }
.ai-title { font-weight: 700; font-size: 13px; }
.ai-pct { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.ai-bar {
  position: relative; height: 8px; border-radius: 5px; margin: 8px 0 6px;
  background: rgba(255,255,255,0.08); overflow: visible;
}
.ai-bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 5px; transition: width .4s; }
.ai-gate-mark {
  position: absolute; top: -3px; width: 2px; height: 14px; transform: translateX(-50%);
  background: var(--muted); opacity: 0.85; border-radius: 2px;
}
.ai-verdict { font-size: 11.5px; margin-bottom: 6px; }
.ai-factors { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-factor {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-brd);
}
.ai-factor.good { color: var(--green); }
.ai-factor.bad { color: var(--red); }

/* ===== AI meta-model card (Trades) ===== */
.meta-sub { margin: 4px 0 10px; line-height: 1.5; }
.mf-list { display: flex; flex-direction: column; gap: 6px; }
.mf-row { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 10px; }
.mf-name { font-size: 12.5px; }
.mf-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: hidden; }
.mf-bar-fill { display: block; height: 100%; border-radius: 4px; }
@media (min-width: 520px) { .mf-row { grid-template-columns: 1fr 140px; } }

/* ===== learned take-profit calibration card ===== */
.tg-card .brain-head { margin-bottom: 2px; }
.tg-row {
  padding: 9px 0; border-top: 1px solid var(--glass-brd);
}
.tg-row:first-of-type { border-top: none; }
.tg-off { opacity: 0.62; }
.tg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tg-name { font-weight: 700; font-size: 13.5px; }
.tg-tp { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.tg-rail {
  position: relative; height: 6px; margin: 7px 0 6px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--red) 42%, transparent),
    color-mix(in srgb, var(--muted) 30%, transparent) 45%,
    color-mix(in srgb, var(--green) 42%, transparent));
}
.tg-mark {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 0 8px rgba(0,0,0,0.5);
  border: 2px solid var(--bg1, #0b0e1a);
}
.tg-def {
  position: absolute; top: -2px; width: 2px; height: 10px;
  transform: translateX(-50%); background: var(--muted); opacity: 0.7; border-radius: 2px;
}
.tg-meta {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tg-meta b { font-variant-numeric: tabular-nums; }

@media (min-width:1000px){ .mkt-thead{display:none} .mkt-stats{grid-template-columns:repeat(4,1fr)} }

/* ============ exchange-grade polish (Trades + global chrome) ============ */
/* keep the pair count legible where the moon glows behind it */
.market-count { text-shadow: 0 1px 8px rgba(0,0,0,0.85); }
.mkt-ex-wrap { position: relative; z-index: 1; }

/* account summary bar reads like an exchange balance strip */
.stat-row .cell { position: relative; flex: 1; }
.stat-row .cell + .cell::before {
  content: ""; position: absolute; left: 0; top: 14%; height: 72%; width: 1px;
  background: var(--glass-brd);
}
.stat-row .cell .n { font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }

/* positions rows = exchange positions panel */
.trade { border: 1px solid var(--glass-brd); transition: border-color .2s, transform .1s; }
.trade.open { border-left: 3px solid color-mix(in srgb, var(--accent) 65%, transparent); }
.trade:active { transform: scale(0.994); }
.trade .side {
  font-size: 10px; font-weight: 800; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 6px; vertical-align: middle;
}
.trade .side.long { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.trade .side.short { color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent); }
.trade .s { font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trade .vol { font-variant-numeric: tabular-nums; }
.trade .pnl { font-variant-numeric: tabular-nums; }
.trade .pnl.up, .trade .pnl.down {
  padding: 3px 9px; border-radius: 8px; font-size: 15px;
}
.trade .pnl.up { background: color-mix(in srgb, var(--green) 13%, transparent); }
.trade .pnl.down { background: color-mix(in srgb, var(--red) 13%, transparent); }
.trade .why { font-size: 11.5px; color: var(--muted); margin-top: 4px; opacity: 0.85; }

/* глобально: цифры моноширинные — «терминальный» вид */
.ph-price, .ph-stats b, .price, .bm-v, .pnl-hero, .value { font-variant-numeric: tabular-nums; }

/* ============ market regime banner + live signals feed ============ */
.regime-banner {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 12px;
  border-radius: 14px; border: 1px solid var(--glass-brd); background: var(--glass-bg);
}
.regime-banner.bull { border-color: color-mix(in srgb, var(--green) 40%, transparent);
  background: color-mix(in srgb, var(--green) 9%, var(--glass-bg)); }
.regime-banner.bear { border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: color-mix(in srgb, var(--red) 9%, var(--glass-bg)); }
.regime-banner .rb-icon { font-size: 22px; }
.regime-banner .rb-txt { display: flex; flex-direction: column; line-height: 1.3; }
.regime-banner .rb-txt b { font-size: 14px; }
.regime-banner .rb-txt span { font-size: 11.5px; color: var(--muted); }

#signalsFeedCard { margin-bottom: 12px; }
.sig-feed { display: flex; flex-direction: column; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.sig-feed::-webkit-scrollbar { width: 5px; }
.sig-feed::-webkit-scrollbar-thumb { background: var(--glass-hi); border-radius: 4px; }
.sf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid var(--glass-brd); cursor: pointer;
  transition: background .12s;
}
.sf-row:last-child { border-bottom: none; }
.sf-row:hover, .sf-row:active { background: var(--glass-hi); }
.sf-l { min-width: 0; flex: 1; }
.sf-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14px; }
.sf-top .side { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.sf-top .side.long { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.sf-top .side.short { color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent); }
.sf-tf { font-size: 10.5px; color: var(--muted); background: var(--glass-hi); padding: 1px 6px; border-radius: 5px; }
.sf-sub { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-oc { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.sf-oc.win { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.sf-oc.loss { color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }
.sf-score { text-align: center; flex: 0 0 auto; }
.sf-score-v { font-size: 18px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.sf-score-l { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ============ risk presets ============ */
.risk-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.risk-presets button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px;
  border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--glass-bg); border: 1px solid var(--glass-brd); color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.risk-presets button:active { transform: scale(0.97); }
.risk-presets button b { font-size: 12px; font-weight: 700; }
.risk-presets button span { font-size: 10px; color: var(--muted); }
.risk-presets button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.risk-presets button.active b, .risk-presets button.active span { color: var(--accent); }
@media (max-width: 380px) { .risk-presets button b { font-size: 11px; } }

/* ============ Fear & Greed gauge ============ */
.fng-card { margin-bottom: 12px; }
.fng-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fng-val { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.fng-bar { position: relative; height: 10px; border-radius: 6px; margin: 14px 0 6px;
  background: linear-gradient(90deg, #f6465d 0%, #ff9f43 30%, #e0c341 50%, #2ebd85 72%, #16c784 100%); }
.fng-marker { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid #fff; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.5); }
.fng-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.fng-note { margin-top: 9px; font-size: 12.5px; line-height: 1.4; }

/* ============ backtest panel ============ */
.bt-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bt-controls .field { flex: 1; min-width: 130px; }

/* ===================================================================== */
/* ============ REDESIGN v2 — motion, polish, minimalism ============== */
/* ===================================================================== */

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }

/* thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* clear keyboard focus ring (accessibility + feels crafted) */
button:focus-visible, .field:focus-visible, select:focus-visible, input:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-soft);
}

/* card lift on hover for tappable surfaces (desktop / pointer) */
@media (hover: hover) {
  .glass.pad { transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
}

/* tactile ripple (added by ux.js on buttons / tabs / rows) */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: currentColor; opacity: 0.16; animation: ripple .55s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }

/* value change pulse — ux.js flashes a number when it actually changes */
.val-flash { animation: valFlash .6s var(--ease); }
@keyframes valFlash {
  0% { transform: scale(1); }
  30% { transform: scale(1.08); filter: brightness(1.25); }
  100% { transform: scale(1); }
}

/* refined toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 12px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 600; z-index: 90;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  animation: toastIn .3s var(--ease) forwards;
}
@keyframes toastIn { to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* strength / generic badges — calmer, tokenized */
.str-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px; margin-left: 7px; }
.str-badge.strong { color: var(--accent); background: var(--accent-soft); }
.str-badge.medium { color: var(--text-2); background: var(--surface-3); }

/* section entrance also for list rows appearing after async load */
.list > .coin, .list > .trade { animation: cardIn .45s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  .list > .coin, .list > .trade, .toast, .ripple, .tab.active::after { animation: none !important; }
}

/* splash — align to the new palette */
.splash { background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), var(--bg0) 60%) !important; }
.splash-logo svg path { fill: var(--accent) !important; }

/* modal backdrop a touch softer */
.modal-backdrop { background: rgba(4,6,10,0.62); }
.modal { border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* keep tab-bar off the old floating look on desktop terminal too */
@media (min-width: 1000px) { .tabbar { max-width: 620px; left: 50%; right: auto; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 16px; bottom: calc(14px + var(--safe-bottom)); } }
.btn-danger { position: relative; overflow: hidden; transition: transform .12s var(--ease), filter .2s var(--ease); }
.btn-danger:active { transform: scale(0.985); }
