:root {
  --brand: #16a34a; --brand-d: #12813b; --brand-bg: #dcfce7;
  --up: #16a34a; --down: #e5484d; --sun: #f59e0b; --muted: #6b7280;
  --bad: #e5484d; --bad-d: #b8383c; --bad-bg: #fee2e2; --good-bg: #dcfce7; --sun-bg: #fef3c7;
  --bg: #ffffff; --surface: #ffffff; --surface2: #f4f5f7; --line: #e5e7eb; --text: #1f2937;
  --flame: #f97316; --bolt: #eab308; --heart: #ef4444; --lock: #cbd5e1;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1720; --surface: #16202b; --surface2: #1d2935; --line: #2b3a48; --text: #e8edf2; --muted: #93a1b0;
    --brand-bg: #12301f; --bad-bg: #3a1a1c; --good-bg: #12301f; --sun-bg: #3a2c0d; --lock: #3a4856;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1720; --surface: #16202b; --surface2: #1d2935; --line: #2b3a48; --text: #e8edf2; --muted: #93a1b0;
  --brand-bg: #12301f; --bad-bg: #3a1a1c; --good-bg: #12301f; --sun-bg: #3a2c0d; --lock: #3a4856;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 600 16px/1.4 ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body.playing { overflow: hidden; }
svg { width: 100%; height: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; }
p { margin: 6px 0; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.up { color: var(--up); } .down { color: var(--down); }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: env(safe-area-inset-top) 16px calc(86px + env(safe-area-inset-bottom)); }

/* Header */
#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 10px 0; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 20px; flex: 1; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 17px; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; padding: 6px 8px; border-radius: 12px; border: 0; background: none; }
.stat svg { width: 22px; height: 22px; }
.flame { color: var(--flame); } .flame.off { color: var(--lock); } .bolt { color: var(--bolt); } .heart { color: var(--heart); }

/* Tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs .inner { max-width: 560px; margin: 0 auto; display: flex; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 800; }
.tab .ic { width: 26px; height: 26px; }
.tab[aria-current] { color: var(--brand); }

/* Buttons: chunky, with a pressed edge */
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 900; font-size: 16px; letter-spacing: .02em; text-transform: uppercase;
  background: var(--brand); color: #fff; box-shadow: 0 4px 0 var(--brand-d); cursor: pointer; margin-top: 8px; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-d); }
.btn:disabled { background: var(--line); color: var(--muted); box-shadow: 0 4px 0 var(--lock); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--brand); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.bad { background: var(--bad); box-shadow: 0 4px 0 var(--bad-d); }
.btn.ghost.bad { background: var(--surface); color: var(--bad); }
.icon-btn { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; border-radius: 12px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented control */
.seg { display: flex; background: var(--surface2); border-radius: 14px; padding: 4px; gap: 4px; margin: 8px 0; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 10px; font-weight: 800; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--line); }

/* Cards & tiles */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
a.card { display: flex; color: inherit; text-decoration: none; }
.card > svg { width: 28px; height: 28px; flex: none; color: var(--muted); }
.card.warn, .card.pred, .card.locked-card, .card.status { display: flex; gap: 12px; align-items: flex-start; }
.card.warn { border-color: var(--sun); background: var(--sun-bg); }
.card.warn > svg { color: var(--sun); }
.card.pred.good { border-color: var(--up); background: var(--good-bg); } .card.pred.good > svg { color: var(--up); }
.card.pred.bad { border-color: var(--bad); background: var(--bad-bg); } .card.pred.bad > svg { color: var(--bad); }
.card.status { align-items: center; }
.card.soon { background: var(--surface2); }
.grow { flex: 1; min-width: 0; }
.k { font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.k svg { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile .v { font-size: 24px; font-weight: 900; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 6px; }
.section-title h2 { font-size: 19px; }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* Today hero */
.hero { background: var(--brand); color: #fff; border-radius: 20px; padding: 18px; margin: 10px 0; box-shadow: 0 5px 0 var(--brand-d); }
.hero .k { color: rgba(255,255,255,.85); }
.hero h1 { font-size: 26px; margin-top: 4px; }
.hero .big { font-size: 22px; font-weight: 900; margin: 6px 0; }
.hero .big small { font-size: 16px; opacity: .9; }
.hero .big.up, .hero .big.down { color: #fff; }
.hero .btn { background: #fff; color: var(--brand); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.hero .btn.ghost { border: 0; }
.hero.done { background: var(--surface); color: var(--text); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line); }
.hero.done .k { color: var(--muted); }
.hero.done .big.up { color: var(--up); } .hero.done .big.down { color: var(--down); }

/* Learn path */
.path { padding-bottom: 20px; }
.unit { margin: 16px 0 6px; }
.unit-head { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 14px; box-shadow: 0 4px 0 var(--brand-d); }
.unit-head .n { font-size: 12px; font-weight: 900; letter-spacing: .06em; opacity: .85; text-transform: uppercase; }
.unit-head p { margin: 2px 0 0; opacity: .9; font-size: 14px; }
.u2 .unit-head { background: #0ea5e9; box-shadow: 0 4px 0 #0b7fb5; }
.u3 .unit-head { background: #8b5cf6; box-shadow: 0 4px 0 #6d43d0; }
.u4 .unit-head { background: #f97316; box-shadow: 0 4px 0 #c75a10; }
.u5 .unit-head { background: #e11d74; box-shadow: 0 4px 0 #b0145a; }
.unit.locked .unit-head { background: var(--surface2); color: var(--muted); box-shadow: 0 4px 0 var(--line); }
.nodes { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 6px; }
.node { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 0; }
.node .disc { width: 70px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; box-shadow: 0 6px 0 var(--brand-d); padding: 17px; }
.node.done .disc { background: var(--sun); box-shadow: 0 6px 0 #c47f08; }
.node.locked .disc { background: var(--lock); box-shadow: 0 6px 0 var(--line); color: var(--surface); }
.node.current .disc { animation: bob 1.6s ease-in-out infinite; outline: 4px solid var(--brand-bg); outline-offset: 4px; }
.node .cap { font-size: 13px; font-weight: 800; color: var(--muted); max-width: 140px; text-align: center; }
.node:active:not(:disabled) .disc { transform: translateY(4px); box-shadow: 0 2px 0 var(--brand-d); }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* Trade */
.plan { border-radius: 20px; padding: 16px; margin: 10px 0; background: var(--surface2); border: 2px solid var(--line); }
.plan.bullish { background: var(--good-bg); border-color: var(--up); }
.plan.bearish { background: var(--bad-bg); border-color: var(--bad); }
.plan h1 { font-size: 28px; margin: 4px 0 8px; }
.plan h1 small { display: block; font-size: 14px; color: var(--muted); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 13px; cursor: pointer; }
.chip.up { color: var(--up); } .chip.down { color: var(--down); }
.kv { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 4px 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div:last-child { border: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; font-variant-numeric: tabular-nums; }
.form .grid2 { margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 800; }
.field input, .row select { width: 100%; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface2); color: var(--text); font-size: 16px; font-weight: 700; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.row select { width: auto; }
.verdict { border-radius: 20px; padding: 16px; margin: 12px 0; border: 2px solid; }
.verdict.good { border-color: var(--up); background: var(--good-bg); } .verdict.bad { border-color: var(--bad); background: var(--bad-bg); }
.checks { margin: 10px 0; display: grid; gap: 8px; }
.check { display: flex; gap: 8px; font-size: 14px; align-items: flex-start; }
.check svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.check.ok svg { color: var(--up); } .check.no svg { color: var(--bad); }
.vehicle { background: var(--surface); border-radius: 14px; padding: 12px; margin: 10px 0; }

/* Player */
#player { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
#player[hidden] { display: none; }
.p-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 560px; width: 100%; margin: 0 auto; }
.p-top .icon-btn { flex: none; }
.prog { flex: 1; height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), inset 0 4px 0 rgba(255,255,255,.3); }
.p-kicker { font-size: 13px; font-weight: 900; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.p-kicker svg { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; }
.p-body { flex: 1; overflow-y: auto; padding: 10px 16px 20px; max-width: 560px; width: 100%; margin: 0 auto; }
.p-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); max-width: 560px; width: 100%; margin: 0 auto; }
.p-foot.fb { max-width: none; border: 0; }
.p-foot.fb > * { max-width: 528px; margin-left: auto; margin-right: auto; }
.p-foot.good { background: var(--good-bg); color: var(--up); }
.p-foot.bad { background: var(--bad-bg); color: var(--bad); }
.p-foot.neutral { background: var(--surface2); }
.fb-head { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.fb-head svg { width: 28px; height: 28px; background: currentColor; border-radius: 50%; padding: 4px; color: inherit; }
.fb-head svg path { stroke: var(--surface); }
.fb-right { margin-top: 6px; }
.fb-why { margin-top: 6px; color: var(--text); font-size: 14px; font-weight: 600; }
.prompt { font-size: 21px; margin: 8px 0 14px; }
.teach h1 { font-size: 24px; margin: 6px 0 10px; }
.prose { font-size: 16px; font-weight: 600; line-height: 1.55; }
.visual { margin: 10px 0 14px; }
.choices { display: grid; gap: 10px; }
.choice { text-align: left; padding: 15px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 4px 0 var(--line); font-weight: 800; cursor: pointer; }
.choice.sel, .chip.sel { border-color: #60a5fa; background: #dbeafe; color: #1d4ed8; box-shadow: 0 4px 0 #93c5fd; }
.chip.on { border-color: var(--brand); }
.chip b { background: var(--brand); color: #fff; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.chip.done { opacity: .35; }
.chip.shake { animation: shake .35s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.slots { min-height: 56px; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-bottom: 2px solid var(--line); margin-bottom: 12px; align-items: center; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; }
.pool .chip:disabled { opacity: .25; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match > div { display: grid; gap: 10px; align-content: start; }
.match .chip { justify-content: center; text-align: center; min-height: 56px; }
.numin { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 800; color: var(--muted); }
.numval { flex: 1; min-height: 52px; font-size: 26px; padding: 8px 14px; color: var(--text); border-radius: 14px; border: 2px solid var(--brand); background: var(--surface2); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.numval.empty::before { content: 'Tap the numbers'; color: var(--muted); font-size: 18px; font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.key { font: inherit; font-size: 22px; font-weight: 800; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; padding: 4px 0; min-height: 44px; display: grid; place-items: center; touch-action: manipulation; }
.key:active { transform: translateY(2px); border-bottom-width: 2px; }
.key svg { width: 26px; height: 26px; }
.key.zero { grid-column: span 4; }
@media (max-height: 700px) { .key { min-height: 40px; font-size: 20px; } .keypad { gap: 5px; } }
.hint { font-size: 14px; }
.center { text-align: center; padding-top: 30px; }
.big-ic { width: 96px; height: 96px; margin: 0 auto 10px; }
.big-ic.sun { color: var(--sun); } .big-ic.heart { color: var(--heart); }
.results { margin: 18px 0; }
.results .v { font-size: 22px; }
.unlock { background: var(--sun-bg); border-radius: 14px; padding: 12px; }
.quit { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: end center; padding: 16px; z-index: 30; }
.quit .card { width: 100%; max-width: 528px; text-align: center; }

/* Charts */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .lbl { font-size: 10px; fill: var(--muted); font-weight: 700; }
.chart .lvl { font-size: 10px; font-weight: 800; }
.cnd.tap { cursor: pointer; }
.cnd.tap.sel rect:first-child { fill: rgba(96,165,250,.25); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.rangebar .zones, .rangebar .ends, .ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rangebar .track { position: relative; height: 18px; border-radius: 9px; margin: 6px 0; background: linear-gradient(90deg, var(--bad-bg) 0 33%, var(--surface2) 33% 67%, var(--good-bg) 67%); border: 2px solid var(--line); }
.rangebar .mark { position: absolute; top: -6px; width: 6px; height: 26px; margin-left: -3px; border-radius: 3px; background: var(--text); }
.adbar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; font-weight: 900; color: #fff; font-size: 14px; }
.adbar > div { display: grid; place-items: center; min-width: 26px; }
.adbar .a { background: var(--up); } .adbar .d { background: var(--down); } .adbar .u { background: var(--muted); }
.gauge { position: relative; display: flex; height: 16px; border-radius: 8px; overflow: visible; margin: 26px 0 6px; }
.gauge .seg { margin: 0; padding: 0; border-radius: 0; }
.gauge .calm { background: #86efac; border-radius: 8px 0 0 8px; } .gauge .norm { background: #fde68a; } .gauge .hot { background: #fca5a5; border-radius: 0 8px 8px 0; }
.gauge .needle { position: absolute; top: -6px; width: 4px; height: 28px; background: var(--text); border-radius: 2px; }
.gauge .needle b { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 14px; }
.hbars .row { display: grid; grid-template-columns: 90px 1fr 64px; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.hbars .bar { height: 12px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.hbars i { display: block; height: 100%; border-radius: 6px; }
.hbars i.up { background: var(--up); } .hbars i.down { background: var(--down); }
.hbars b { text-align: right; font-variant-numeric: tabular-nums; }

/* Sheet & toast */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 800; font-size: 14px; transition: .25s; z-index: 50; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.assets { margin-top: 4px; }
