/* Moonshot 310: night-market palette. Deep navy ground, moon-gold accent, green/red only for money. */
:root {
  --bg: #f3f5f8; --surface: #ffffff; --raised: #eef1f5; --line: #e1e6ec;
  --ink: #0d1722; --muted: #66768a; --faint: #a3afbd;
  --gold: #c99a1e; --gold-ink: #1a1300; --gold-soft: #fbf1d6;
  --up: #12985c; --up-soft: #e2f5ec; --down: #d6423c; --down-soft: #fbe6e5;
  --live: #d6423c; --paper: #b7860f; --paper-soft: #fbf1d6;
  --chart-grid: #e7ebf0; --shadow: 0 1px 2px rgba(13,23,34,.05), 0 6px 20px rgba(13,23,34,.06);
  --r: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-d: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1118; --surface: #121a23; --raised: #19232e; --line: #223040;
    --ink: #e9eef3; --muted: #8d9caa; --faint: #5c6b7a;
    --gold: #e9b949; --gold-ink: #1a1300; --gold-soft: #2c2412;
    --up: #3ecf8e; --up-soft: #12291f; --down: #f0605d; --down-soft: #2e1617;
    --live: #f0605d; --paper: #e9b949; --paper-soft: #2c2412;
    --chart-grid: #1b2530; --shadow: 0 1px 0 rgba(255,255,255,.02) inset;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg.ic { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 15px;
  background: var(--raised); transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn-lg { height: 52px; border-radius: 14px; font-size: 16px; width: 100%; }
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-quiet { background: var(--raised); color: var(--ink); }
.btn-danger { background: var(--down); color: #fff; }
.btn-danger-ghost { width: 100%; margin-top: 14px; background: var(--down-soft); color: var(--down); }
.btn.wide { width: 100%; height: 48px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--raised); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- lock */
.lock {
  min-height: 100%; display: grid; place-items: center; text-align: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 60%), var(--bg);
}
.lock-inner { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-mark {
  width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; margin-bottom: 14px;
  background: linear-gradient(160deg, #18263a, #0b1118); box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.brand-mark svg { width: 40px; height: 40px; color: #e9b949; }
.lock h1 { font: 700 28px/1.1 var(--font-d); letter-spacing: -.02em; margin: 0; }
.lock-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.setup-note { color: var(--muted); font-size: 14px; margin: 0; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; color: var(--muted); }
.field input {
  height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 0 14px; font: 600 18px var(--mono); letter-spacing: .12em; text-transform: uppercase;
}
.link-btn { color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px; }
.lock-err { color: var(--down); font-size: 14px; min-height: 20px; margin: 8px 0 0; }

/* ---------- app shell */
.app { min-height: 100%; }
.main {
  max-width: 1120px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 92px) max(16px, env(safe-area-inset-left));
}
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 14px; }
.tb-left h1 { font: 700 30px/1.1 var(--font-d); letter-spacing: -.025em; margin: 0; }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.mode-pill {
  font: 700 11px var(--font); letter-spacing: .1em; padding: 6px 10px; border-radius: 999px;
  background: var(--paper-soft); color: var(--paper);
}
.mode-pill.live { background: var(--live); color: #fff; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--live) 18%, transparent); } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px max(8px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 6px) max(8px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 12px; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--gold); }
.side-brand { display: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow);
}
.card-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.card-label .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.view { display: flex; flex-direction: column; gap: 14px; animation: fade .2s ease; }
@keyframes fade { from { opacity: .4; } }  /* opacity only: a transform here would trap the full-screen chart inside the page */
.grid-home { display: grid; gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- banner + chips */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r);
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.banner strong { display: block; }
.banner span { font-size: 13px; color: var(--muted); }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 7px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 0;
}
.chip span { font-size: 12px; color: var(--muted); }
.chip b { grid-column: 1 / -1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.chip.ok .dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.chip.bad .dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.chip.warn .dot { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---------- markets + chart */
.tickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ticker {
  text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid transparent; background: var(--raised);
}
.ticker.active { border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: var(--gold-soft); }
.t-name { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.t-last { font: 700 21px/1.2 var(--font-d); letter-spacing: -.01em; }
.t-chg { font-size: 13px; font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.chart-meta { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; background: var(--raised); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.seg button { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chart { position: relative; height: 210px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart.tall { height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { font: 11px var(--font); fill: var(--faint); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .ref { stroke: var(--faint); stroke-dasharray: 3 4; stroke-width: 1; }
.chart .tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; padding: 4px 8px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font: 600 12px var(--font); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chart .empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 0 20px; }
.ohl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ohl b { color: var(--ink); font-weight: 600; }

/* ---------- signal */
.sig-row { display: flex; gap: 14px; align-items: center; }
.sig-badge {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; flex: none;
  font: 800 18px var(--font-d); background: var(--raised); color: var(--muted);
}
.sig-badge.ce { background: var(--up-soft); color: var(--up); }
.sig-badge.pe { background: var(--down-soft); color: var(--down); }
.sig-text { display: flex; flex-direction: column; min-width: 0; }
.sig-text strong { font-size: 17px; }
.sig-text span { font-size: 14px; }
.vs-open { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.vs-open div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-open span { font-size: 12px; }
.vs-open b { font-size: 15px; }

/* ---------- trade */
.empty { color: var(--muted); font-size: 15px; }
.trade-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.trade-sym { font: 700 18px var(--font-d); letter-spacing: -.01em; }
.trade-pnl { font: 700 26px var(--font-d); letter-spacing: -.02em; white-space: nowrap; }
.kv3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kv3 div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--raised); min-width: 0; }
.kv3 span { font-size: 12px; color: var(--muted); }
.kv3 b { font-size: 15px; }

/* ---------- month */
.month-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.month-top .right { text-align: right; }
.month-val { font: 700 30px var(--font-d); letter-spacing: -.02em; }
.meter { height: 8px; border-radius: 99px; background: var(--raised); margin: 14px 0 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--down), var(--gold) 45%, var(--up)); transition: width .4s ease; }

/* ---------- activity */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.ev-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--raised); color: var(--muted); }
.ev-ic.buy { background: var(--up-soft); color: var(--up); }
.ev-ic.sell { background: var(--gold-soft); color: var(--gold); }
.ev-ic.bad { background: var(--down-soft); color: var(--down); }
.ev-head { display: flex; justify-content: space-between; gap: 8px; }
.ev-head strong { font-size: 15px; }
.ev-head time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev-body { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- results */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat span { font-size: 12px; color: var(--muted); display: block; }
.stat b { font: 700 22px var(--font-d); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.months { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: grid; grid-template-columns: 64px 1fr 92px; align-items: center; gap: 10px; font-size: 14px; }
.mrow .bar { height: 10px; border-radius: 6px; background: var(--raised); position: relative; overflow: hidden; }
.mrow .bar i { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.mrow b { text-align: right; font-variant-numeric: tabular-nums; }
.trades { display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; padding-top: 0; }
.trow .sym { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.trow .net { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.trow .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow .meta.r { text-align: right; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; background: var(--paper-soft); color: var(--paper); }
.tag.live { background: var(--down-soft); color: var(--live); }

/* ---------- settings */
.group { padding: 4px 16px; }
.group .card-label { margin-top: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seg-mode button { padding: 7px 14px; }
.seg-mode button.on[data-m="live"] { background: var(--live); color: #fff; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--raised); border: 1px solid var(--line); transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: var(--up); border-color: var(--up); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.key { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.key button { color: var(--down); font-size: 14px; font-weight: 600; }
.rules ul { margin: 0 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
.rules b { color: var(--ink); }

/* ---------- sheet + toast */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(5,9,13,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 460px; background: var(--surface); border-radius: 24px 24px 0 0; display: flex; flex-direction: column; gap: 10px;
  padding: 22px max(20px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 20px) max(20px, env(safe-area-inset-left));
}
.sheet h2 { margin: 0; font: 700 22px var(--font-d); }
.sheet p { margin: 0; color: var(--muted); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px);
}

/* ---------- Mac / wide screens */
@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; bottom: 0; width: 220px; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 24px 14px; border-top: 0; border-right: 1px solid var(--line);
  }
  .side-brand { display: flex; align-items: center; gap: 10px; font: 700 17px var(--font-d); padding: 0 10px 22px; }
  .side-brand svg { width: 22px; height: 22px; color: var(--gold); }
  .tab { flex-direction: row; gap: 12px; font-size: 15px; padding: 10px 12px; border-radius: 12px; color: var(--muted); }
  .tab svg { width: 20px; height: 20px; }
  .tab.active { background: var(--gold-soft); color: var(--ink); }
  .tab.active svg { color: var(--gold); }
  .main { padding: 28px 36px 40px 256px; max-width: none; }
  .grid-home { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
  .chart { height: 300px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; }
  .toast { bottom: 28px; }
}
@media (min-width: 900px) and (max-width: 1100px) { .grid-home { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.btn { white-space: nowrap; flex: none; }
.field input::placeholder { text-transform: none; letter-spacing: 0; font: 500 16px var(--font); color: var(--faint); }
.trade-top > div:first-child { min-width: 0; }
.trade-sym { overflow-wrap: anywhere; }

/* ---------- v2: pro chart, markets, news, option chain, alerts */
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.chart-head .icon-btn.sm { margin-left: auto; }
.tab { padding: 4px 6px; min-width: 56px; }

.pc { padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.pc-top { display: grid; grid-template-columns: minmax(0, auto) 1fr auto; align-items: center; gap: 10px; }
.pc-sym { display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 12px; border-radius: 12px; background: var(--raised); min-width: 0; }
.pc-sym b { font: 700 16px var(--font-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sym svg { width: 16px; height: 16px; transform: rotate(90deg); color: var(--muted); flex: none; }
.pc-price { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; overflow: hidden; }
.pc-price b { font: 700 19px var(--font-d); white-space: nowrap; }
.pc-price span { font-size: 12px; font-weight: 600; white-space: nowrap; }
.pc-tools { display: flex; gap: 6px; margin-left: auto; }
.pc-bar { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 0 2px; }
.pc-bar::-webkit-scrollbar { display: none; }
.seg.tf button { padding: 5px 9px; }
.pc-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); min-height: 18px; }
.pc-legend b { color: var(--ink); font-weight: 600; }
.pc-ons { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.pc-ons i, .sw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.pc-charts { position: relative; display: flex; flex-direction: column; height: min(64vh, 560px); min-height: 300px; }
.pc-main { flex: 1; min-height: 160px; position: relative; }
.pc-pane { height: 110px; flex: none; position: relative; border-top: 1px solid var(--line); }
.pc-plabel { position: absolute; left: 6px; top: 4px; z-index: 3; font-size: 11px; font-weight: 600; color: var(--muted); pointer-events: none; }
.pc-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 20px; z-index: 4; }
.pc-foot { min-height: 16px; }
body.focus .tabbar, body.focus .topbar { display: none; }
body.focus .main { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); max-width: none; }
body.focus .pc { border-radius: 0; border: 0; height: 100dvh; padding: 10px max(12px, env(safe-area-inset-left)); }
body.focus .pc-charts { height: auto; flex: 1; }
body.focus .pc-foot { display: none; }

.board { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto 62px; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); text-align: left; }
.brow:first-child { border-top: 0; padding-top: 2px; }
.b-name { font-weight: 600; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.b-mid { display: flex; align-items: center; justify-content: center; }
.spark { width: 72px; height: 26px; display: block; }
.rng { position: relative; width: 60px; height: 4px; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--down) 45%, transparent), color-mix(in srgb, var(--up) 45%, transparent)); }
.rng i { position: absolute; top: -3px; width: 4px; height: 10px; margin-left: -2px; border-radius: 2px; background: var(--gold); }
.b-last { font-weight: 600; font-size: 15px; text-align: right; white-space: nowrap; }
.b-pct { font-weight: 700; font-size: 13px; text-align: right; white-space: nowrap; }

.news-seg { align-self: flex-start; }
.news { display: flex; flex-direction: column; }
.nrow { display: flex; flex-direction: column; gap: 3px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.nrow:first-child { border-top: 0; padding-top: 0; }
.nrow b { font-weight: 600; font-size: 15px; line-height: 1.35; }
.nrow span { font-size: 12px; color: var(--muted); }
.nrow:active b { color: var(--gold); }

.menu { padding: 4px 16px; }
.mrow2 { display: grid; grid-template-columns: 34px 1fr 18px; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); text-align: left; width: 100%; }
.mrow2:first-child { border-top: 0; }
.mrow2 > svg:first-child { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); }
.mrow2 span { display: flex; flex-direction: column; }
.mrow2 small { color: var(--muted); font-size: 13px; }
.mrow2 .chev { width: 18px; height: 18px; color: var(--faint); }

.chain-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chain-stats .stat { padding: 10px; }
.chain-stats .stat b { font-size: 16px; }
.chain-card { padding: 0; overflow: hidden; }
.chain-head, .crow { display: grid; grid-template-columns: 1fr 1.05fr 0.95fr 1.05fr 1fr; align-items: center; }
.chain-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.chain { max-height: 64vh; overflow-y: auto; }
.crow { padding: 6px 8px; border-top: 1px solid var(--line); font-size: 13px; }
.crow:first-child { border-top: 0; }
.crow.atm { background: var(--gold-soft); }
.c-k { text-align: center; font-weight: 700; }
.c-ltp { display: flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 2px 0; border-radius: 6px; }
.c-ltp.itm { background: color-mix(in srgb, var(--gold) 9%, transparent); }
.c-ltp small { font-size: 11px; font-weight: 600; }
.c-oi { position: relative; height: 22px; display: flex; align-items: center; }
.c-oi i { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; opacity: .2; }
.c-oi.l { justify-content: flex-start; } .c-oi.l i { right: 0; background: var(--down); }
.c-oi.r { justify-content: flex-end; } .c-oi.r i { left: 0; background: var(--up); }
.c-oi em { position: relative; font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; padding: 0 4px; }

.al-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.field2 { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.field2 select, .field2 input { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); padding: 0 12px; font: 500 16px var(--font); width: 100%; }
.arow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.arow:first-of-type { border-top: 0; }
.arow > div { display: flex; flex-direction: column; min-width: 0; }
.arow.done b { color: var(--muted); }
.arow button { color: var(--down); font-weight: 600; font-size: 14px; flex: none; }

.sheet.pick { max-height: 82vh; }
.pick-list { overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.pick-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 0 4px; }
.pick-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 0; border-top: 1px solid var(--line); text-align: left; font-size: 16px; cursor: pointer; }
.pick-row svg { width: 16px; height: 16px; color: var(--faint); }
.pick-row.on span { color: var(--gold); font-weight: 600; }
.pick-row.chk input { width: 22px; height: 22px; accent-color: var(--gold); }

@media (min-width: 900px) {
  .pc-charts { height: calc(100vh - 230px); }
  .chain-stats { grid-template-columns: repeat(4, minmax(0, 200px)); }
  .al-form { grid-template-columns: 2fr 1fr 1fr 2fr; }
  .tab { min-width: 0; }
  #v-markets { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 380px) { .brow { grid-template-columns: minmax(0, 1fr) auto 60px; } .b-mid { display: none; } }
@media (max-width: 420px) {
  .pc-top { grid-template-columns: minmax(0, 1fr) auto; }
  .pc-price { grid-row: 2; grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
}

/* events */
.ev-day { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 0 4px; }
.ev-day:first-child { padding-top: 0; }
.evrow { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.ev-day + .evrow, #upnext-body .evrow:first-child { border-top: 0; }
.evrow.past { opacity: .5; }
.ev-t { display: flex; flex-direction: column; line-height: 1.25; }
.ev-t b { font-size: 14px; }
.ev-t small, .ev-m small { font-size: 12px; color: var(--muted); }
.ev-m { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ev-m b { font-size: 15px; font-weight: 600; }
.evrow button { color: var(--down); font-weight: 600; font-size: 13px; }
.link-sm { float: right; font-size: 12px; font-weight: 700; color: var(--gold); text-transform: none; letter-spacing: 0; }

/* ================================================================ v3 look: depth, colour, motion */
:root { --violet: #7c5cff; --teal: #14b8a6; --glass: rgba(255,255,255,.72); --glass-line: rgba(13,23,34,.07);
  --hero: linear-gradient(135deg, #fff8e6 0%, #f1ecff 55%, #e7f8f5 100%); }
@media (prefers-color-scheme: dark) {
  :root { --bg: #070b12; --surface: #0f1622; --raised: #172131; --line: #1d293a; --chart-grid: #141d29;
    --violet: #9b87ff; --teal: #2dd4bf; --glass: rgba(17,25,38,.72); --glass-line: rgba(255,255,255,.06);
    --hero: linear-gradient(135deg, rgba(233,185,73,.16) 0%, rgba(124,92,255,.14) 55%, rgba(45,212,191,.10) 100%); }
}
body { background: var(--bg); }
body::before {
  content: ""; position: fixed; inset: -20% -10% auto -10%; height: 70vh; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 50% at 15% 20%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%),
              radial-gradient(35% 45% at 85% 10%, color-mix(in srgb, var(--violet) 18%, transparent), transparent 70%),
              radial-gradient(40% 50% at 60% 60%, color-mix(in srgb, var(--teal) 10%, transparent), transparent 70%);
  filter: blur(10px);
}
.card {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 22px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px rgba(0,0,0,.12);
}
.card-label { color: var(--muted); letter-spacing: .08em; }
.tb-left h1 { font-size: 32px; background: linear-gradient(90deg, var(--ink), color-mix(in srgb, var(--ink) 65%, var(--gold))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mode-pill { box-shadow: 0 0 0 1px color-mix(in srgb, var(--paper) 30%, transparent) inset; }

/* tab bar: floating pill */
.tabbar { left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 8px); border-radius: 26px; border: 1px solid var(--glass-line);
  padding: 6px 6px; background: var(--glass); box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.tab { border-radius: 18px; padding: 6px 4px; transition: background .2s, color .2s; flex: 1; }
.tab.active { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.main { padding-bottom: calc(env(safe-area-inset-bottom) + 104px); }

/* home */
.ticker { background: var(--raised); border: 1px solid var(--glass-line); border-radius: 18px; }
.ticker.active { background: var(--hero); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.t-last { font-size: 23px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-line); font-size: 12px; font-weight: 600; color: var(--ink); }
.quick svg { width: 38px; height: 38px; padding: 9px; border-radius: 13px; color: #fff; }
.quick button:nth-child(1) svg { background: linear-gradient(135deg, #f6c344, #e08e0b); }
.quick button:nth-child(2) svg { background: linear-gradient(135deg, #7c5cff, #4e7dff); }
.quick button:nth-child(3) svg { background: linear-gradient(135deg, #14b8a6, #0ea5e9); }
.quick button:nth-child(4) svg { background: linear-gradient(135deg, #ff7ab6, #ef5350); }
.quick button:active { transform: scale(.96); }
.signal { background: var(--hero), var(--glass); }

/* pro chart */
.pc { padding: 12px; gap: 10px; }
.pc-charts { height: min(68vh, 620px); }
.pc-charts[data-panes="1"] .pc-pane { height: 22%; } .pc-charts[data-panes="2"] .pc-pane { height: 18%; }
.pc-charts[data-panes="3"] .pc-pane, .pc-charts[data-panes="4"] .pc-pane, .pc-charts[data-panes="5"] .pc-pane { height: 14%; }
.pc-panes { display: contents; }
.pc-pane { min-height: 80px; flex: none; border-top: 1px solid var(--glass-line); }
.pc-main { border-radius: 14px; }
.pc-legend { position: absolute; left: 6px; top: 4px; right: 80px; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; min-height: 0; }
.lg-row { display: flex; flex-wrap: wrap; gap: 2px 9px; align-items: center; }
.lg-row span { color: var(--muted); }
.lg-row b { margin-left: 3px; font-weight: 600; color: var(--ink); }
.lg-row b.up { color: #26a69a; } .lg-row b.down { color: #ef5350; }
.lg-t { color: var(--ink) !important; font-weight: 600; }
.lg-ind i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.pc-charts.drawing { cursor: crosshair; outline: 2px dashed color-mix(in srgb, var(--gold) 60%, transparent); outline-offset: 2px; border-radius: 12px; }
.icon-btn.on { background: var(--gold); color: var(--gold-ink); }
.seg.tf button:disabled { opacity: .3; }
.pc-sym { background: var(--hero); border: 1px solid var(--glass-line); }
.pc-price b { font-size: 21px; transition: color .6s; }
.flash-up { animation: fu 1s ease; } .flash-down { animation: fd 1s ease; }
@keyframes fu { 0% { color: #26a69a; text-shadow: 0 0 14px rgba(38,166,154,.6); } 100% { color: var(--ink); } }
@keyframes fd { 0% { color: #ef5350; text-shadow: 0 0 14px rgba(239,83,80,.6); } 100% { color: var(--ink); } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--raised); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
body.focus .pc { background: var(--bg); backdrop-filter: none; }

/* markets: mood, breadth, heatmap, movers */
.pulse-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mood { display: flex; flex-direction: column; align-items: center; padding-bottom: 12px; }
.mood .card-label { align-self: flex-start; }
.gauge svg { width: 150px; display: block; }
.g-num { font: 700 18px var(--font-d); fill: var(--ink); }
.mood-txt { display: flex; flex-direction: column; align-items: center; }
.mood-txt b { font: 700 18px var(--font-d); }
.breadth { display: flex; flex-direction: column; gap: 10px; }
.br-num { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: baseline; }
.br-num b { font: 800 30px var(--font-d); }
.br-num span { color: var(--muted); font-size: 13px; }
.br-bar { height: 8px; border-radius: 6px; background: rgba(239,83,80,.55); overflow: hidden; }
.br-bar i { display: block; height: 100%; background: #26a69a; border-radius: 6px; transition: width .5s; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 6px; }
.hcell { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; color: #fff; min-height: 58px; justify-content: space-between; }
.hcell span { font-size: 12px; font-weight: 600; opacity: .92; }
.hcell b { font: 700 16px var(--font-d); font-variant-numeric: tabular-nums; }
.movers { display: flex; flex-direction: column; gap: 2px; }
.mv { display: grid; grid-template-columns: 96px 76px 1fr 62px; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; }
.mv-n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-p { color: var(--muted); font-size: 13px; text-align: right; }
.mv-bar { position: relative; height: 8px; border-radius: 5px; background: var(--raised); }
.mv-bar i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.mv-bar i.pos { left: 50%; background: #26a69a; } .mv-bar i.neg { right: 50%; background: #ef5350; }
.mv b { text-align: right; font-size: 13px; }
.up { color: #26a69a; } .down { color: #ef5350; }
@media (prefers-color-scheme: light) { .up { color: #0d9488; } .down { color: #dc2626; } }

@media (min-width: 900px) {
  .tabbar { left: 0; right: auto; top: 0; bottom: 0; border-radius: 0; border: 0; border-right: 1px solid var(--glass-line); box-shadow: none; padding: 24px 14px; }
  .tab { flex: none; }
  .main { padding-bottom: 40px; }
  .pc-charts { height: calc(100vh - 210px); }
  #v-markets { grid-template-columns: 1fr 1fr; }
  .quick { grid-template-columns: repeat(4, minmax(0, 160px)); }
}

/* option chain v3 */
.chain-ctl { display: flex; flex-direction: column; gap: 8px; }
.exp-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.exp-chips::-webkit-scrollbar { display: none; }
.exp-chips button { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--glass); border: 1px solid var(--glass-line); color: var(--muted); }
.exp-chips button.on { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.chain-stats { grid-template-columns: repeat(3, 1fr); }
.chain-stats .stat { background: var(--glass); border: 1px solid var(--glass-line); }
.chain-stats .stat span { font-size: 11px; }
.oi-chart svg { width: 100%; height: auto; display: block; }
.oi-lab { font: 10px var(--font); fill: var(--muted); }
.oi-lab.atm { fill: var(--gold); font-weight: 700; }
.oi-lab.spot { fill: var(--gold); font-weight: 600; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 3px 0 8px; }
button.c-ltp { width: 100%; }
.c-oi em small { display: block; font-size: 10px; font-weight: 600; }
.c-oi em { line-height: 1.15; }
.c-oi { height: 30px; }
@media (min-width: 900px) { .chain-stats { grid-template-columns: repeat(6, 1fr); } }

@media (max-width: 899px) { .pc-charts { height: calc(100dvh - 318px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 360px; } }

/* ---------- v4: full-screen chart (one chart with stacked indicator panels) */
.pc-back { display: none; }
.pc-back svg { transform: rotate(180deg); }
.pc-main { position: relative; flex: 1; min-height: 0; }
.pc-panes { display: block; position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pc-plabel { position: absolute; left: 6px; top: 0; display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); right: 76px; }
.pc-plabel b { color: var(--ink); font-weight: 600; }
.pc-exit { display: none; position: absolute; right: 78px; top: 6px; z-index: 6; width: 34px; height: 34px; border-radius: 10px; place-items: center;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); }
.pc-exit svg { width: 18px; height: 18px; }
.pc-charts { touch-action: none; overscroll-behavior: contain; }
body.focus .pc-exit { display: grid; }
body.focus .pc-top, body.focus .pc-bar { display: none; }
@media (max-width: 899px) {
  /* the chart takes the whole phone screen; tabs come back with the back arrow */
  body[data-view="chart"] .topbar, body[data-view="chart"] .tabbar { display: none; }
  body[data-view="chart"] { overflow: hidden; }
  body[data-view="chart"] #v-chart { animation: none; transform: none; }
  body[data-view="chart"] .main { padding-bottom: 0; }
  body[data-view="chart"] .pc-back { display: grid; }
  body[data-view="chart"] .pc { position: fixed; inset: 0; z-index: 30; margin: 0; border: 0; border-radius: 0; display: flex; flex-direction: column; gap: 8px;
    background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: calc(env(safe-area-inset-top) + 8px) max(10px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 4px) max(10px, env(safe-area-inset-left)); }
  body[data-view="chart"] .pc-top { grid-template-columns: auto minmax(0, 1fr) auto; }
  body[data-view="chart"] .pc-price { grid-row: 2; grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
  body[data-view="chart"] .pc-charts { flex: 1; height: auto; min-height: 0; margin: 0 -6px; }
  body[data-view="chart"] .pc-foot { font-size: 11px; min-height: 0; }
}
@media (max-width: 899px) and (orientation: landscape) {
  body[data-view="chart"] .pc-price { grid-row: auto; grid-column: auto; }
  body[data-view="chart"] .pc-top { grid-template-columns: auto auto 1fr auto; }
  body[data-view="chart"] .pc-foot { display: none; }
}

/* news: important headlines stand out */
.nrow { border-radius: 12px; }
.nrow .ntag { font-style: normal; font-weight: 700; font-size: 11px; padding: 2px 7px; border-radius: 6px; margin-right: 7px; }
.nrow.imp2 { background: linear-gradient(100deg, color-mix(in srgb, var(--amber) 22%, transparent), color-mix(in srgb, var(--pink) 12%, transparent));
  border-top-color: transparent; border-left: 3px solid var(--amber); padding: 11px 12px; margin: 4px 0; }
.nrow.imp2 .ntag { background: var(--amber); color: #1a1300; }
.nrow.imp2 b { font-weight: 700; }
.nrow.imp1 .ntag { background: color-mix(in srgb, var(--sky) 20%, transparent); color: var(--sky); }
.nrow.imp2 + .nrow { border-top-color: transparent; }

/* bank stocks as watchlist tiles */
.movers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px; border-radius: 12px; background: var(--raised);
  border-left: 3px solid var(--up); text-align: center; min-width: 0; }
.wt.wt-dn { border-left-color: var(--down); }
.wt-n { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wt b { font: 700 16px var(--font-d); }
.wt span.num { font-size: 10.5px; font-weight: 600; white-space: nowrap; }
@media (min-width: 900px) { .movers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }


/* ================================================================ v5 "Terminal": TradingView-style graphite, flat and crisp.
   Solid surfaces only (no blur, glow or gradients): sharper text and a smoother chart on the phone. */
:root {
  --bg: #ffffff; --surface: #ffffff; --raised: #f0f3fa; --line: #e0e3eb; --ink: #131722; --muted: #6a6d78; --faint: #9598a1;
  --accent: #2962ff; --accent-soft: #e3ebff; --on-accent: #ffffff;
  --up: #089981; --down: #f23645; --up-soft: #e6f5f2; --down-soft: #fdecee; --amber: #f0a500; --amber-soft: #fff4dc; --sky: #2962ff;
  --gold: #2962ff; --gold-ink: #ffffff; --gold-soft: #e3ebff; --paper: #b26b00; --paper-soft: #fff4dc; --live: #f23645;
  --glass: var(--surface); --glass-line: var(--line); --hero: var(--surface); --chart-grid: #f0f3fa;
  --r: 8px; --shadow: none;
  --font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-d: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --surface: #161a23; --raised: #1e2330; --line: #262b38; --ink: #d1d4dc; --muted: #868b98; --faint: #5d6170;
    --accent: #2962ff; --accent-soft: rgba(41,98,255,.16); --on-accent: #ffffff;
    --up: #089981; --down: #f23645; --up-soft: rgba(8,153,129,.14); --down-soft: rgba(242,54,69,.14); --amber: #f0b90b; --amber-soft: rgba(240,185,11,.12); --sky: #5b8cff;
    --gold: #2962ff; --gold-ink: #ffffff; --gold-soft: rgba(41,98,255,.16); --paper: #f0b90b; --paper-soft: rgba(240,185,11,.12); --live: #f23645;
    --chart-grid: #1c2029; color-scheme: dark;
  }
}
body { background: var(--bg); font-size: 15px; }
body::before { display: none; }
.num, .t-last, .pc-price b, .wt b, .hcell b, .br-num b { font-variant-numeric: tabular-nums; }
.up { color: var(--up) !important; } .down, .dn { color: var(--down) !important; }
@media (prefers-color-scheme: light) { .up { color: var(--up) !important; } .down { color: var(--down) !important; } }

/* surfaces: flat panels with thin borders */
.card, .ticker, .stat, .quick button, .chain-stats .stat, .exp-chips button {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; }
.card { padding: 14px; }
.card::after { display: none; }
.card-label { font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.card-label::before { display: none; }
.ticker.active { background: var(--surface); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.signal { background: var(--surface); }
.view { gap: 12px; }

/* top bar: solid, pinned under the status bar, fits any phone */
.topbar { position: sticky; top: 0; z-index: 15; margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 4px calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--line); }
.main { padding-top: 0; }
.tb-left h1, #view-title { font: 700 22px/1.15 var(--font-d); letter-spacing: -.01em; background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--ink); }
.clock { font-size: 12px; }
.mode-pill { border-radius: 4px; padding: 4px 8px; font-size: 10px; box-shadow: none; }
.icon-btn { border-radius: 8px; background: var(--raised); }
.icon-btn.on { background: var(--accent); color: var(--on-accent); }

/* tab bar: full width, solid, like TradingView's */
.tabbar { left: 0; right: 0; bottom: 0; border-radius: 0; border: 0; border-top: 1px solid var(--line); box-shadow: none;
  background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 6px max(6px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 4px) max(6px, env(safe-area-inset-left)); }
.tab { border-radius: 8px; color: var(--faint); font-size: 10.5px; }
.tab svg { width: 22px; height: 22px; }
.tab.active { background: none; color: var(--accent); }
.tab.active svg { color: var(--accent); filter: none; }
.main { padding-bottom: calc(env(safe-area-inset-bottom) + 76px); }
@media (min-width: 900px) {
  .tabbar { top: 0; bottom: 0; right: auto; width: 220px; border-top: 0; border-right: 1px solid var(--line); padding: 22px 12px; background: var(--bg); }
  .tab { font-size: 14px; color: var(--muted); }
  .tab.active { background: var(--accent-soft); color: var(--ink); }
  .side-brand svg { color: var(--accent); }
  .topbar { margin: 0 0 4px; padding: 20px 0 12px; }
  .main { padding-top: 0; padding-bottom: 40px; }
}

/* segmented controls and buttons */
.seg { background: var(--raised); border-radius: 8px; padding: 3px; }
.seg button { border-radius: 6px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #2a2f3c; box-shadow: none; } }
.btn { border-radius: 8px; }
.btn-gold { background: var(--accent); color: var(--on-accent); }
.exp-chips button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
:focus-visible { outline-color: var(--accent); }
.spinner { border-color: var(--raised); border-top-color: var(--accent); }

/* quick actions: small tinted icons, not candy tiles */
.quick { gap: 6px; }
.quick button { padding: 10px 4px; font-size: 11.5px; gap: 5px; }
.quick svg { width: 30px; height: 30px; padding: 6px; border-radius: 7px; color: var(--accent); background: var(--accent-soft) !important; }
.quick button:active { transform: none; background: var(--raised); }

/* chart screen */
.pc-sym { background: var(--raised); border: 0; border-radius: 8px; }
.pc-price b { font-size: 20px; }
.flash-up, .flash-down { animation: none; }
.pc-charts.drawing { outline-color: var(--accent); }
@media (max-width: 899px) { body[data-view="chart"] .pc { background: var(--bg); } }

/* markets */
.hcell { border-radius: 6px; }
.br-bar { background: var(--down); opacity: .85; } .br-bar i { background: var(--up); }
.wt { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--up); border-radius: 6px; cursor: pointer; }
.wt.wt-dn { border-left-color: var(--down); }
.wt:active { background: var(--raised); }
.mood-txt b.up, #mood-word.up { color: var(--up); }

/* news */
.nrow { border-radius: 6px; }
.nrow.imp2 { background: var(--amber-soft); border-left: 3px solid var(--amber); }
.nrow.imp2 .ntag { background: var(--amber); color: #1a1300; }
.nrow.imp1 .ntag { background: var(--accent-soft); color: var(--sky); }

/* ================================================================ v6 "Carbon Teal" (the user's pick, 29 Oct):
   true black, blue accent #0f62fe, lifted panels, floating pill tabs, compact header, 10px corners, iPhone font.
   Always dark, whatever the phone's setting. */
:root {
  --bg: #000000; --surface: #101315; --raised: #181c1f; --line: #1d2124; --ink: #e9ecee; --muted: #7d868c; --faint: #566066;
  --accent: #0f62fe; --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent); --on-accent: #ffffff;
  --up: #22c55e; --down: #f43f5e; --up-soft: rgba(34,197,94,.14); --down-soft: rgba(244,63,94,.14);
  --amber: #facc15; --amber-soft: rgba(250,204,21,.12); --sky: #5b9bff; --teal: #14b8a6;
  --gold: var(--accent); --gold-ink: var(--on-accent); --gold-soft: var(--accent-soft); --paper: #facc15; --paper-soft: rgba(250,204,21,.12); --live: #f43f5e;
  --glass: var(--surface); --glass-line: var(--line); --hero: var(--surface); --chart-grid: #121517;
  --r: 10px; --lift: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 28px rgba(0,0,0,.65);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-d: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root { --bg: #000000; --surface: #101315; --raised: #181c1f; --line: #1d2124; --ink: #e9ecee; --muted: #7d868c; color-scheme: dark; } .up { color: var(--up) !important; } .down { color: var(--down) !important; } }
@media (prefers-color-scheme: dark) { .seg button.on { background: var(--raised); } }
body { background: #000; color: var(--ink); }

/* lifted panels: no outlines, a soft shadow and a faint top highlight */
.card, .ticker, .stat, .quick button, .chain-stats .stat, .wt, .exp-chips button {
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r); box-shadow: var(--lift); }
.ticker.active { border-color: var(--accent); box-shadow: var(--lift), inset 0 0 0 1px var(--accent); }
.wt { border-left: 3px solid var(--up); } .wt.wt-dn { border-left-color: var(--down); }
.seg { background: var(--surface); box-shadow: var(--lift); border-radius: 10px; }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: none; }
.icon-btn { background: var(--surface); box-shadow: var(--lift); border-radius: 10px; }
.btn { border-radius: 10px; }

/* compact header with market status and ticker tape */
.topbar { background: rgba(0,0,0,.92); border-bottom: 1px solid var(--line); flex-wrap: wrap; padding-bottom: 0; row-gap: 6px; }
.tb-left { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; flex: 1 1 0; }
.tb-right { flex: none; }
.tb-left h1, #view-title { font-size: 19px; }
.clock { font-size: 11.5px; }
.mkt { flex-basis: 100%; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.mkt i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.mkt.open { color: var(--up); } .mkt.open i { background: var(--up); animation: livedot 1.8s ease-in-out infinite; }
@keyframes livedot { 50% { box-shadow: 0 0 0 5px rgba(34,197,94,.22); } }
.tape { flex-basis: 100%; overflow: hidden; white-space: nowrap; margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
  border-top: 1px solid var(--line); padding: 6px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.tape-in { display: inline-block; animation: tape 60s linear infinite; }
.tape:active .tape-in { animation-play-state: paused; }
@keyframes tape { to { transform: translateX(-50%); } }
.tp { font-size: 12px; color: var(--muted); padding: 0 14px; font-weight: 500; }
.tp b { color: var(--ink); font-weight: 600; margin: 0 3px; }
@media (min-width: 900px) { .tape { margin: 0; } }

/* floating pill tab bar */
@media (max-width: 899px) {
  .tabbar { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + 8px);
    border-radius: 24px; border: 1px solid rgba(255,255,255,.06); background: rgba(16,19,21,.96); box-shadow: 0 12px 34px rgba(0,0,0,.8); padding: 6px; }
  .tab { border-radius: 18px; padding: 6px 2px; flex: 1; color: var(--muted); }
  .tab.active { background: var(--accent-soft); color: #fff; }
  .tab.active svg { color: var(--accent); }
  .main { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
}

/* price flash: green or red wash for a moment when a price moves */
.flash-up { animation: fu6 1s ease-out; } .flash-down { animation: fd6 1s ease-out; }
@keyframes fu6 { 0% { background: rgba(34,197,94,.35); color: #fff; } 100% { background: transparent; } }
@keyframes fd6 { 0% { background: rgba(244,63,94,.35); color: #fff; } 100% { background: transparent; } }
.t-last, .b-last, #pc-last { border-radius: 4px; }

/* candles draw in: the chart sweeps in from the left when it opens */
#pc-main.reveal .tv-lightweight-charts { animation: sweep .8s cubic-bezier(.2,.7,.2,1); }
@keyframes sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* news highlight on black */
.nrow.imp2 { background: var(--amber-soft); border-left-color: var(--amber); }
.nrow.imp2 .ntag { background: var(--amber); color: #1a1300; }
@media (prefers-reduced-motion: reduce) { .tape-in, .mkt.open i { animation: none; } }


/* ---------- Appearance (More → Appearance): black or white background, accent colour, up/down colours.
   Set as attributes on <html> by app.js; black is the default. */
html[data-bg="light"] {
  --bg: #ffffff; --surface: #ffffff; --raised: #f0f3fa; --line: #e0e3eb; --ink: #131722; --muted: #6a6d78; --faint: #9598a1;
  --chart-grid: #f0f3fa; --lift: 0 1px 2px rgba(15,23,42,.06), 0 6px 18px rgba(15,23,42,.08); --amber-soft: #fff6d6; --paper: #9a6700; --paper-soft: #fff1c2; color-scheme: light;
}
html[data-bg="light"] body { background: #ffffff; color: var(--ink); }
html[data-bg="light"] .topbar { background: rgba(255,255,255,.94); }
html[data-bg="light"] .tabbar { background: rgba(255,255,255,.97); border-color: var(--line); box-shadow: 0 10px 30px rgba(15,23,42,.14); }
html[data-bg="light"] .tab.active { color: var(--ink); }
html[data-bg="light"] .flash-up, html[data-bg="light"] .flash-down { color: inherit; }
html[data-bg="light"] .nrow.imp2 .ntag { color: #1a1300; }
html[data-accent="cyan"] { --accent: #22d3ee; --on-accent: #001318; }
html[data-accent="teal"] { --accent: #14b8a6; --on-accent: #001a17; }
html[data-accent="violet"] { --accent: #8b5cf6; --on-accent: #ffffff; }
html[data-accent="magenta"] { --accent: #e14ecb; --on-accent: #ffffff; }
html[data-accent="coral"] { --accent: #ff6b4a; --on-accent: #1a0600; }
html[data-accent="gold"] { --accent: #f0b90b; --on-accent: #1a1300; }
html[data-accent="silver"] { --accent: #aab4bf; --on-accent: #0b0d0f; }
html[data-bg="light"][data-accent="cyan"] { --accent: #0891b2; --on-accent: #fff; }
html[data-bg="light"][data-accent="gold"] { --accent: #b7860b; --on-accent: #fff; }
html[data-bg="light"][data-accent="silver"] { --accent: #4b5563; --on-accent: #fff; }
html[data-ud="tv"] { --up: #089981; --down: #f23645; }
html[data-ud="cb"] { --up: #2f81f7; --down: #f0883e; }
html[data-bg="light"]:not([data-ud]) { --up: #16a34a; --down: #e11d48; }
.look { display: flex; flex-direction: column; gap: 12px; }
.look-row { display: flex; flex-direction: column; gap: 7px; }
.look-row > span { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.look .seg { align-self: flex-start; }

/* iPhone Safari: a column flexbox sized only by "inset: 0" doesn't stretch its children, which left an empty band under
   the chart. Give the chart screen an explicit full height. */
@media (max-width: 899px) {
  body[data-view="chart"] .pc { top: 0; bottom: 0; height: 100%; height: 100dvh; }
  body[data-view="chart"] .pc-charts { flex: 1 1 0; height: 0; min-height: 0; }
}

/* chart top bar: solid and crisp (shadows on black looked like a haze), sits right under the iPhone status bar */
.pc .icon-btn { box-shadow: none; background: var(--raised); color: var(--ink); }
.pc .icon-btn.on { background: var(--accent); color: var(--on-accent); }
.pc-sym { background: var(--raised); box-shadow: none; border: 0; }
.pc-sym b { color: var(--ink); font: 600 17px/1.2 var(--font); letter-spacing: -.01em; }
.pc-price b { color: var(--ink); }
.pc .seg { box-shadow: none; background: var(--raised); }
.pc .seg button.on { background: var(--surface); }
html[data-bg="light"] .pc .seg button.on { background: #ffffff; box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 899px) {
  body[data-view="chart"] .pc { padding-top: calc(env(safe-area-inset-top) + 4px); gap: 6px; }
  body[data-view="chart"] .pc-top { margin: 0 -10px; padding: 0 10px 8px; border-bottom: 1px solid var(--line); row-gap: 6px; }
  body[data-view="chart"] .pc .icon-btn.sm { width: 36px; height: 36px; }
}

/* drawing tools: SVG layer over the candle pane, a tool strip along the bottom, an edit bar for the selected drawing */
.pc-charts { position: relative; }
.dr-layer { position: absolute; left: 0; top: 0; width: 100%; z-index: 6; pointer-events: none; overflow: hidden; touch-action: none; }
.dr-layer.placing { pointer-events: all; cursor: crosshair; }
.dr-layer .dr-hit { stroke: transparent; stroke-width: 18; pointer-events: all; cursor: grab; touch-action: none; }
.dr-layer rect.dr-hit { pointer-events: all; stroke-width: 10; }
.dr-layer .dr-handle { pointer-events: all; cursor: move; touch-action: none; }
.dr-layer text { pointer-events: none; font-family: var(--font); }
.dr-tools { position: absolute; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); z-index: 8;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dr-tools[hidden], .dr-edit[hidden] { display: none; }
.dr-tools button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px; padding: 7px 6px;
  border: 0; border-radius: 10px; background: var(--raised); color: var(--ink); font: 600 10.5px/1.1 var(--font); }
.dr-tools button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dr-tools button.on { background: var(--accent); color: var(--on-accent); }
.dr-tools button.done { min-width: 56px; justify-content: center; align-self: stretch; background: var(--ink); color: var(--bg); font-size: 13px; }
.dr-tools .dr-hint { flex-basis: 100%; margin: 2px 2px 0; font-size: 12px; color: var(--muted); }
.dr-edit { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 9; max-width: calc(100% - 16px);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 6px 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dr-edit .dr-name { font: 700 12px var(--font); color: var(--muted); margin-right: 2px; }
.dr-edit .sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.dr-edit .sw.on { box-shadow: 0 0 0 2px var(--ink); }
.dr-edit input { width: 96px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised);
  color: var(--ink); font: 600 14px var(--font); font-variant-numeric: tabular-nums; }
.dr-edit .txt { height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--raised); color: var(--ink); font: 600 13px var(--font); }
.dr-edit .del { background: rgba(244,63,94,.16); color: #f43f5e; }
.dr-edit { gap: 5px; }
.dr-edit .sw { width: 20px; height: 20px; }
@media (max-width: 420px) { .dr-edit .dr-name { display: none; } }
