:root {
  --bg: #0d0e12;
  --panel: #131722;
  --line: #2a2e39;
  --grid: #1b2030;
  --neon: #10b981;
  --red: #ef4444;
  --warn: #f59e0b;
  --cyan: #5cc8ff;
  --text: #e8eef4;
  --muted: #7d8b9a;
  --radius: 8px;
  --font: "IBM Plex Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(46,229,157,0.06), transparent 50%),
    radial-gradient(700px 380px at 100% 0%, rgba(92,200,255,0.05), transparent 45%);
  z-index: 0;
}
.wrap { position: relative; z-index: 1; max-width: 80rem; margin: 0 auto; padding: 16px 16px 88px; }
.wrap.wide { max-width: 80rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(19, 23, 34, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: sticky; top: 10px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo {
  width: 10px; height: 10px; border-radius: 50%; background: var(--neon);
  box-shadow: 0 0 10px var(--neon);
}
.brand h1 { font-size: 13px; letter-spacing: 0.22em; color: var(--neon); font-weight: 500; }
.brand span { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.08em; margin-top: 3px; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.lang-switch { display: flex; border: 1px solid var(--line); }
.lang-switch button {
  font-family: inherit; font-size: 11px; color: var(--muted);
  background: 0; border: 0; padding: 8px 10px; cursor: pointer;
}
.lang-switch button.active { color: var(--neon); background: rgba(46,229,157,0.08); }

.nav-link {
  font-family: inherit; font-size: 12px; color: var(--muted);
  background: 0; border: 0; text-decoration: none; cursor: pointer; padding: 8px 6px;
}
.nav-link:hover { color: var(--text); }
.micro-tag {
  font-size: 10px; color: var(--cyan); border: 1px solid #1c4a62;
  border-radius: 999px; padding: 3px 8px;
}
.btn, .btn-cta {
  font-family: inherit; cursor: pointer; font-size: 12px; letter-spacing: 0.04em;
  padding: 10px 14px; border: 1px solid var(--line); color: var(--text); background: #0b121a;
  border-radius: var(--radius);
}
.btn-cta.pulse {
  animation: ctaPulse 2.4s ease-in-out infinite;
}
.btn-cta.lg, .btn.lg { padding: 14px 18px; font-size: 14px; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(16,185,129,0.25); }
  50% { box-shadow: 0 0 28px rgba(16,185,129,0.55); }
}
.btn:hover { border-color: var(--cyan); }
.btn.cyan { color: var(--cyan); border-color: #1c4a62; }
.btn.amber { color: #ffcc66; border-color: #5a4718; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn-cta {
  color: #06140f; background: var(--neon); border-color: #8fffd0;
  box-shadow: 0 0 18px rgba(46,229,157,0.25);
}
.btn-cta.compact { padding: 12px 14px; }

.desk {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
}
.desk-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kicker { color: var(--cyan); font-size: 10px; letter-spacing: 0.28em; }
.h2 { font-size: 22px; font-weight: 500; margin: 6px 0 8px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.65; }
.desk-ctrls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.seg, .strat-tabs { display: flex; flex-wrap: wrap; border: 1px solid var(--line); }
.seg-btn, .strat-tab {
  font-family: inherit; font-size: 11px; color: var(--muted);
  background: 0; border: 0; padding: 8px 12px; cursor: pointer;
}
.seg-btn.active, .strat-tab.active { color: #06140f; background: var(--neon); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.metrics.four { grid-template-columns: repeat(4, 1fr); }
.strat-tab.locked { opacity: 0.42; cursor: pointer; color: var(--muted); }
.nav-pages { display: flex; gap: 6px; }
.metric { border: 1px solid var(--line); background: #090d13; padding: 12px 14px; }
.metric span { font-size: 10px; color: var(--muted); letter-spacing: 0.14em; }
.metric b { display: block; margin-top: 6px; font-size: 22px; color: var(--neon); font-variant-numeric: tabular-nums; }
.metric b.up { color: var(--neon); }
@media (max-width: 900px) {
  .metrics, .metrics.four { grid-template-columns: 1fr 1fr; }
  .desk-ctrls { align-items: stretch; }
}
@media (max-width: 520px) { .metrics, .metrics.four { grid-template-columns: 1fr; } }

.chart-shell {
  position: relative; height: 440px; border: 1px solid var(--line); background: #080b10;
}
.chart-shell.live { height: 62vh; min-height: 480px; }
.tv-chart { width: 100%; height: 100%; }
.feed-status { font-size: 13px; letter-spacing: 0.06em; font-weight: 500; }
.feed-status.wait { color: var(--muted); }
.feed-status.live { color: var(--neon); }
.feed-status.warn { color: var(--warn); }
.feed-status.err { color: var(--red); }
.lab-top {
  margin-top: 16px; height: 60vh; min-height: 420px;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); background: var(--panel); padding: 12px;
}
.lab-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lab-canvas { flex: 1; min-height: 320px; border: 1px solid var(--line); background: #080b10; }
.lab-panel { margin-top: 16px; border: 1px solid var(--line); background: var(--panel); padding: 16px; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#kline { width: 100%; height: 100%; display: block; }
.engine-box { margin-top: 16px; display: grid; gap: 10px; }
.engine-box select {
  width: 100%; background: #070a0f; border: 1px solid var(--line);
  color: var(--text); padding: 10px; font-family: inherit; font-size: 13px;
}
.pine-box { border: 1px solid var(--line); background: #070a0f; padding: 10px 12px; }
.pine-box summary { cursor: pointer; color: var(--cyan); font-size: 12px; letter-spacing: 0.08em; }
.pine-pre {
  margin-top: 10px; max-height: 280px; overflow: auto; white-space: pre;
  color: #9dffd0; font-size: 12px; line-height: 1.55;
}
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.m-card { border: 1px solid var(--line); background: var(--panel); padding: 14px; display: grid; gap: 8px; border-radius: var(--radius); max-width: 420px; justify-self: center; width: 100%; }
.m-card h3 { font-size: 15px; font-weight: 500; color: var(--neon); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 10px; color: var(--cyan); border: 1px solid #1c4a62; padding: 3px 7px; }
.chart-meta {
  position: absolute; top: 10px; left: 12px;
  font-size: 11px; color: var(--muted); letter-spacing: 0.08em;
}
.home-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: center; }
footer.site-foot {
  margin-top: 36px;
  padding: 22px 4px 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #6a7886;
  line-height: 1.7;
}
.foot-brand { letter-spacing: 0.06em; color: #8a97a6; }
.foot-legal { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0; }
.foot-link {
  font-family: inherit; font-size: 11px; color: #8ab4c8;
  background: 0; border: 0; padding: 0; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.foot-official a { color: var(--cyan); text-decoration: none; }
.foot-official .sep { margin: 0 8px; color: #3d4a56; }
.legal-body { white-space: pre-wrap; font-size: 12px; line-height: 1.7; margin: 12px 0 16px; max-height: 50vh; overflow: auto; }
.dash-block { border: 1px solid var(--line); padding: 12px; margin-bottom: 12px; background: #090d13; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.stat { border: 1px solid var(--line); padding: 8px; }
.stat span { display: block; font-size: 10px; color: var(--muted); }
.stat b { display: block; margin-top: 4px; font-size: 13px; color: var(--neon); }
@media (max-width: 700px) { .stats-row { grid-template-columns: 1fr; } }

.lang-pills {
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(232, 238, 244, 0.14);
  background: rgba(11, 18, 26, 0.72);
  overflow: hidden;
  flex: 0 0 auto;
}
.lang-pills button {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0 12px;
  min-width: 36px;
  height: 100%;
  cursor: pointer;
  outline: none;
  box-shadow: none;
}
.lang-pills button + button { border-left: 1px solid rgba(232, 238, 244, 0.1); }
.lang-pills button:hover { color: var(--text); }
.lang-pills button.active { color: var(--neon); background: rgba(46, 229, 157, 0.12); }
.lang-pills button:focus,
.lang-pills button:focus-visible {
  outline: none;
  box-shadow: none;
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(4, 8, 12, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-bg.show { display: flex; }
.modal {
  width: min(480px, 100%); background: var(--panel); border: 1px solid var(--line); padding: 20px;
  max-height: 92vh; overflow: auto; border-radius: var(--radius);
}
.modal.wide { width: min(560px, 100%); }
.modal.login-modal {
  padding: 20px;
  background: rgba(11, 16, 23, 0.86);
  border: 1px solid rgba(46, 229, 157, 0.4);
  box-shadow: 0 0 24px rgba(46, 229, 157, 0.12);
  animation: loginGlow 2.8s ease-in-out infinite;
}
@keyframes loginGlow {
  0%, 100% { border-color: rgba(46, 229, 157, 0.32); box-shadow: 0 0 16px rgba(46, 229, 157, 0.08); }
  50% { border-color: rgba(46, 229, 157, 0.88); box-shadow: 0 0 28px rgba(46, 229, 157, 0.22); }
}
.login-step { margin-top: 14px; }
.login-step label {
  display: block; font-size: 11px; letter-spacing: 0.16em;
  color: var(--cyan); margin-bottom: 6px;
}
.btn-tg {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px;
  background: #229ED9; color: #fff; border: 0; padding: 14px 16px;
  font-family: inherit; font-size: 13px; text-decoration: none; cursor: pointer;
  box-shadow: 0 0 20px rgba(34, 158, 217, 0.45);
}
#loginCode { letter-spacing: 0.28em; font-size: 18px; text-align: center; }
#loginCode:focus {
  outline: none;
  border-color: var(--neon);
  box-shadow: 0 0 0 1px rgba(46, 229, 157, 0.35);
}
.status.err { color: var(--red); font-weight: 500; }
.btn-cancel {
  width: 100%; margin-top: 8px; background: transparent; border: 0;
  color: rgba(232, 238, 244, 0.45); font-family: inherit; font-size: 12px; cursor: pointer;
}
.pnl.up { color: var(--neon); }
.pnl.down { color: var(--red); }
.modal h3 { color: var(--neon); margin-bottom: 8px; font-size: 16px; }
.modal h4 { margin: 16px 0 8px; font-size: 13px; color: var(--cyan); }
input {
  width: 100%; margin-top: 8px; background: #070a0f; border: 1px solid var(--line);
  color: var(--text); padding: 10px; font-family: inherit; font-size: 13px;
}
.dash-status {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); padding: 12px; margin: 12px 0; background: #090d13;
}
.dash-status .dot {
  width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
}
.qr { display: block; width: 180px; height: 180px; margin: 12px auto; background: #fff; padding: 8px; }
.addr { word-break: break-all; font-size: 12px; color: var(--cyan); border: 1px dashed #1c4a62; padding: 10px; margin: 8px 0; }
.amount { text-align: center; font-size: 28px; color: #ffcc66; margin: 10px 0; }
.status { font-size: 12px; color: var(--muted); margin: 10px 0; min-height: 16px; }
.toast {
  position: fixed; right: 16px; bottom: 16px; display: none;
  border: 1px solid var(--neon); color: var(--neon); background: #07140f; padding: 10px 14px; z-index: 80;
  border-radius: var(--radius);
}
.toast.show { display: block; }
.toast.warn { border-color: var(--warn); color: var(--warn); background: #1a1408; }
.toast.err { border-color: var(--red); color: var(--red); background: #1a0c0e; }

@media (max-width: 900px) {
  .nav-actions { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-shell { height: 400px; }
}

.page-grid { display: grid; gap: 16px; margin-top: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); padding: 16px;
}
.panel h2 { font-size: 18px; font-weight: 500; margin: 6px 0 10px; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-card { border: 1px solid var(--line); background: #090d13; padding: 12px; }
.rule-card b { color: var(--neon); font-size: 18px; display: block; margin-top: 6px; }
.tree-wrap { overflow: auto; border: 1px solid var(--line); background: #080b10; padding: 12px; }
.tree-wrap svg { min-width: 720px; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line); text-align: left; padding: 10px 8px; color: var(--text);
}
.data-table th { color: var(--muted); font-weight: 500; letter-spacing: 0.08em; font-size: 10px; }
.strat-list { display: grid; gap: 8px; }
.strat-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  border: 1px solid var(--line); background: #090d13; padding: 10px 12px; cursor: pointer;
  font-family: inherit; color: var(--text); width: 100%; text-align: left;
}
.strat-item.active { border-color: var(--neon); color: var(--neon); }
.lc-chart { height: 280px; border: 1px solid var(--line); background: #080b10; margin-bottom: 12px; }
#equity { width: 100%; height: 280px; display: block; background: #080b10; border: 1px solid var(--line); }
.bt-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.bt-meta.five { grid-template-columns: repeat(5, 1fr); }
.gate { border: 1px dashed #1c4a62; padding: 24px; text-align: center; }
.nav-toggle {
  display: none;
  font-family: inherit; font-size: 18px; color: var(--neon);
  background: #0b121a; border: 1px solid var(--line); padding: 8px 12px; cursor: pointer;
}
.nav-kpis {
  display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
  margin: 8px 0 12px; font-size: 13px; line-height: 1.5; color: var(--text);
}
.nav-sep { color: #3d4a56; }
.nav-chip { color: var(--muted); }
.nav-chip.up { color: var(--neon); }
.nav-chip.down { color: var(--red); }
#candleChart, #equityChart, #tvChart, .lab-canvas, .chart-container, .lc-chart {
  width: 100%;
  display: block;
}
.pine-toolbar {
  position: sticky; top: 0; z-index: 2;
  background: #070a0f; padding: 8px 0; margin-top: 6px;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.data-table { min-width: 520px; font-size: 12px; }

@media (max-width: 768px) {
  .wrap { padding: 10px 10px 56px; }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    top: 6px;
    padding: 10px;
  }
  .nav-toggle { grid-column: 2; }
  .brand h1 { font-size: 12px; letter-spacing: 0.12em; }
  .brand span { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-actions {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .topbar.nav-open .nav-actions { display: flex; }
  .nav-actions .btn, .nav-actions .btn-cta, .nav-actions > button {
    width: 100%; text-align: center;
  }
  .nav-actions .lang-pills {
    width: auto;
    height: 32px;
    margin: 10px auto 4px;
    align-self: center;
  }
  .nav-actions .lang-pills button {
    width: auto;
    min-width: 40px;
  }
  .seg { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .seg-btn { flex: 0 0 auto; }
  .chart-shell, .chart-shell.live {
    height: 350px; min-height: 350px; max-height: 350px;
  }
  .lab-top {
    height: auto; min-height: 0; max-height: none;
  }
  #candleChart, #equityChart, #backtest-chart, #tvChart,
  .lab-canvas, .lc-chart, .chart-container {
    width: 100% !important;
    height: 350px !important;
    min-height: 350px !important;
    display: block !important;
    flex: none !important;
  }
  .h2 { font-size: 18px; }
  .engine-box select,
  .lab-actions .btn,
  .lab-actions .btn-cta,
  .pine-toolbar .btn {
    width: 100%; min-height: 44px;
  }
  .lab-actions { flex-direction: column; }
  .bt-meta { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .nav-actions .nav-link { width: 100%; text-align: center; }
  .micro-tag { align-self: center; }
  .hero-h1 { font-size: 20px; }
  .kpi-row { grid-template-columns: 1fr; }
  .chart-meta { font-size: 10px; max-width: 70%; }
  .tg-fab { left: 12px; right: 12px; width: auto; }
  .toast { left: 12px; right: 12px; }
}

.hero { margin-top: 18px; }
.hero-h1 { font-size: 28px; font-weight: 600; line-height: 1.25; max-width: 920px; }
.hero-h2 { color: var(--muted); font-size: 14px; margin: 10px 0 16px; max-width: 760px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.open-src { margin-top: 12px; color: var(--cyan); font-size: 12px; }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.kpi { border: 1px solid var(--line); background: var(--panel); padding: 14px; border-radius: var(--radius); }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi b { display: block; margin-top: 8px; font-size: 26px; font-variant-numeric: tabular-nums; color: var(--neon); }
.kpi-note { margin-top: 8px; }
.ticker {
  margin-top: 12px; overflow: hidden; white-space: nowrap;
  border: 1px solid var(--line); background: #10141c; color: var(--cyan);
  font-size: 12px; padding: 8px 12px; border-radius: var(--radius);
}
.feed-box { display: grid; gap: 8px; justify-items: end; }
.feed-actions { display: flex; gap: 6px; }
.ohlc { margin-top: 4px; color: var(--text); }
.risk-banner {
  margin-top: 16px; border: 1px solid rgba(245, 158, 11, 0.45); color: var(--warn);
  background: rgba(245, 158, 11, 0.08); padding: 12px 14px; font-size: 12px; line-height: 1.6;
  border-radius: var(--radius);
}
.login-guide { margin: 10px 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.otp { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.otp-cell {
  width: 52px; height: 56px; text-align: center; font-size: 22px; letter-spacing: 0;
  margin-top: 0; border-radius: var(--radius);
}
.progress { height: 8px; background: #0b121a; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--neon); }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.price-card { border: 1px solid var(--line); padding: 12px; border-radius: var(--radius); background: #10141c; }
.price-card.on { border-color: var(--neon); }
.trc-warn {
  background: #3f1d20; color: #fecaca; padding: 10px 12px; font-size: 12px; margin: 12px 0;
  border-radius: var(--radius);
}
.pay-help { display: block; margin-top: 12px; color: var(--cyan); font-size: 12px; }
.tg-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  background: #229ED9; color: #fff; text-decoration: none;
  padding: 12px 14px; border-radius: 999px; font-size: 12px;
  box-shadow: 0 8px 24px rgba(34, 158, 217, 0.35);
}
.fab-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  margin-right: 6px; animation: ctaPulse 1.4s ease-in-out infinite;
}
.demo-card { border: 1px dashed var(--line); padding: 16px; border-radius: var(--radius); background: var(--panel); }
.demo-card input[type="range"] { width: 100%; margin: 12px 0; }
.est { font-size: 28px; color: var(--neon); font-variant-numeric: tabular-nums; }
.panel, .desk, .lab-panel, .rule-card, input, select, .btn, .stat, .pine-box {
  border-radius: var(--radius);
}
@media (max-width: 360px) {
  .hero-h1 { font-size: 18px; }
  .otp-cell { width: 44px; height: 48px; }
}

