:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d232c;
  --line: #2a313c;
  --text: #e6edf3;
  --muted: #8b96a5;
  --accent: #4c9aff;
  --up: #2fbf71;
  --down: #f0596b;
  --warn: #e3b341;
  --ce: #f0596b;
  --pe: #2fbf71;
  --radius: 14px;
  --tabs-h: 62px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa; --surface: #ffffff; --surface-2: #eef1f5; --line: #dde2e8;
    --text: #141a21; --muted: #5d6875; --accent: #1f6feb; --up: #1a8f52; --down: #cf2e43;
    --warn: #9a6700; --ce: #cf2e43; --pe: #1a8f52;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.num, .mono { font-variant-numeric: tabular-nums; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 19px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--up), var(--accent)); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; font-size: 18px; color: var(--text); cursor: pointer;
}
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.15;
}
.tabs a span { font-size: 22px; line-height: 1; }
.tabs a.on { color: var(--accent); }
.tabs.hidden { display: none; }

main { padding: 14px 14px 28px; max-width: 640px; margin: 0 auto; }
h2 { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 2px 8px; font-weight: 650; }
h2:first-child { margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; }
.card.tap { display: block; color: inherit; }
.card.tap:active { background: var(--surface-2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 13.5px; }
.big { font-size: 32px; font-weight: 700; letter-spacing: -.01em; }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 13px; min-width: 0; }
.stat.wide { grid-column: 1 / -1; }
.stat .k { font-size: 14px; color: var(--muted); line-height: 1.3; }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px;
  font-size: 14px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip.up { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.chip.down { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
button.chip { cursor: pointer; }
button.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .stat { flex: 0 0 auto; min-width: 118px; }

/* feed */
.item-kind { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.k-morning_list { color: #4c9aff; } .k-trade_review { color: #b083f0; } .k-value_pick { color: #e3b341; }
.k-oc_read { color: #39c5cf; } .k-trade_event { color: var(--up); } .k-alert { color: var(--down); } .k-note { color: var(--muted); }
.item-title { font-weight: 700; font-size: 18px; margin: 4px 0 4px; }
.item-sum { color: var(--muted); font-size: 15.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prose { overflow-wrap: anywhere; }
.prose { font-size: 16.5px; line-height: 1.6; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; white-space: nowrap; }
.prose h1, .prose h2, .prose h3 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 17px; margin: 18px 0 6px; }
.prose code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.prose ul { padding-left: 20px; }

/* option chain ladder */
.ladder { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ladder th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 2px; text-align: center; }
.ladder td { padding: 7px 2px; text-align: center; position: relative; border-top: 1px solid var(--line); }
.ladder td.strike { font-weight: 700; background: var(--surface-2); }
.ladder tr.atm td.strike { background: var(--accent); color: #fff; }
.ladder tr.wall-c td.strike { box-shadow: inset 0 -2px 0 var(--ce); }
.ladder tr.wall-p td.strike { box-shadow: inset 0 -2px 0 var(--pe); }
.bar { position: absolute; top: 4px; bottom: 4px; opacity: .22; border-radius: 3px; }
.bar.ce { right: 0; background: var(--ce); }
.bar.pe { left: 0; background: var(--pe); }
.ladder td span { position: relative; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 9px 14px; border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.verdict { border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; margin: 8px 0; }
.verdict .p { font-weight: 650; font-size: 15.5px; }
.verdict .t { color: var(--muted); font-size: 15px; }

/* ideas */
.zone { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 8px; }
.chart-img { width: 100%; border-radius: 10px; margin-top: 10px; background: #fff; display: block; }
details summary { cursor: pointer; color: var(--accent); font-size: 15px; margin-top: 10px; padding: 4px 0; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
table.simple th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 4px 6px; }
table.simple td { padding: 7px 6px; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }

/* forms / banners */
.banner { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.banner p { margin: 0; flex: 1; font-size: 15px; }
.btn {
  border: 0; background: var(--accent); color: #fff; font-weight: 650; border-radius: 10px;
  padding: 10px 16px; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.block { width: 100%; padding: 13px; font-size: 16px; }
.btn:disabled { opacity: .5; }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; margin: 6px 0 12px;
}
label.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
label.check:first-of-type { border-top: 0; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.login { max-width: 380px; margin: 8vh auto 0; }
.login .logo { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 14px; }
.steps { padding-left: 20px; margin: 6px 0; }
.steps li { margin: 4px 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.err { color: var(--down); font-size: 14px; min-height: 20px; }
.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
svg.spark { width: 100%; height: 64px; display: block; }

/* market list: one row per market, easy to scan on a phone */
.mkt { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.mkt:first-child { border-top: 0; padding-top: 0; }
.mkt:last-child { padding-bottom: 0; }
.mkt .name { min-width: 0; }
.mkt .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.mkt .val .tiny { display: block; font-weight: 600; }
.hero { display: flex; flex-direction: column; gap: 10px; }
.hero .chips { justify-content: flex-start !important; }
.zone .stat .v { font-size: 17px; }
@media (max-width: 360px) { body { font-size: 16px; } .stat .v { font-size: 19px; } .big { font-size: 28px; } }

/* option trades */
.otrade .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.otrade .title { font-weight: 700; font-size: 18px; line-height: 1.3; }
.otrade .pnl { text-align: right; white-space: nowrap; }
.otrade .pnl .pts { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.legs { margin: 10px 0 4px; padding: 0; list-style: none; }
.legs li { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.legs li.buy { box-shadow: inset 3px 0 0 var(--up); }
.legs li.sell { box-shadow: inset 3px 0 0 var(--down); }
.timeline { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.timeline a { display: block; color: inherit; padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline a::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.timeline a.ev-open::before { background: var(--accent); }
.timeline a.ev-exit::before { background: var(--warn); }
.timeline .t { font-size: 13.5px; color: var(--muted); }
.timeline .s { font-size: 15px; }

.outcome { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -16px -16px 12px; padding: 10px 16px; border-radius: var(--radius) var(--radius) 0 0; font-weight: 800; letter-spacing: .04em; }
.outcome span { font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.outcome.ok { background: color-mix(in srgb, var(--up) 18%, var(--surface)); color: var(--up); }
.outcome.bad { background: color-mix(in srgb, var(--down) 18%, var(--surface)); color: var(--down); }
details.timeline summary { margin-top: 0; }
