/* Market Academy. Deep green header on a warm cream ground, one colour per track.
   Candles use the usual green (up) and red (down). Dark mode is a warm deep green, not cold black. */
:root {
  --bg: #FBF7F0; --surface: #FFFFFF; --surface-2: #F3EEE6; --ink: #24231F; --muted: #625D55; --line: #E5DED3;
  --head: #1F4636; --head-ink: #FFF8EE; --butter: #F4E7B8;
  --prob: #74205A; --prob-t: #F3E4EE;
  --candles: #2F5D46; --candles-t: #DDEAE1;
  --invest: #7A5C00; --invest-t: #F6ECC8;
  --fund: #1D5C86; --fund-t: #DCEAF4;
  --sim: #9E241D; --sim-t: #F8DEDA;
  --up: #187A4A; --down: #C9372C; --up-t: #DDF0E4; --down-t: #F9DEDA;
  --ok: #1E7A4C; --bad: #C4332B; --gold: #B98A12; --accent: #1F4636;
  --chart-grid: #ECE6DC; --chart-text: #7A746B; --ma1: #B98A12; --ma2: #6B3FA0;
  --shadow: 0 1px 2px rgba(36, 35, 31, .06), 0 4px 14px rgba(36, 35, 31, .06);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141A17; --surface: #1C2420; --surface-2: #232D28; --ink: #EFEDE6; --muted: #AEB5AE; --line: #33403A;
    --head: #10251C; --head-ink: #FFF5E6;
    --prob: #E7A9D2; --prob-t: #3A2133; --candles: #9FD4B5; --candles-t: #1E3328; --invest: #E9C86C; --invest-t: #382E15; --fund: #8DC3E6; --fund-t: #182F3E; --sim: #F29C90; --sim-t: #3E2320;
    --up: #45C281; --down: #F2685C; --up-t: #1D3A2A; --down-t: #43231F;
    --ok: #7FD3A0; --bad: #FF8A7E; --gold: #E9C86C; --accent: #9FD4B5;
    --chart-grid: #26302B; --chart-text: #8F978F; --ma1: #E9C86C; --ma2: #C7AEEA;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141A17; --surface: #1C2420; --surface-2: #232D28; --ink: #EFEDE6; --muted: #AEB5AE; --line: #33403A;
  --head: #10251C; --head-ink: #FFF5E6;
  --prob: #E7A9D2; --prob-t: #3A2133; --candles: #9FD4B5; --candles-t: #1E3328; --invest: #E9C86C; --invest-t: #382E15; --fund: #8DC3E6; --fund-t: #182F3E; --sim: #F29C90; --sim-t: #3E2320;
  --up: #45C281; --down: #F2685C; --up-t: #1D3A2A; --down-t: #43231F;
  --ok: #7FD3A0; --bad: #FF8A7E; --gold: #E9C86C; --accent: #9FD4B5;
  --chart-grid: #26302B; --chart-text: #8F978F; --ma1: #E9C86C; --ma2: #C7AEEA;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-top: 22px; padding-bottom: 48px; }
main:focus { outline: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .7em; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { width: 100%; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }
/* Bars stay edge to edge; their contents line up with the page below (wider on full-screen pages) */
main.wrap, .site-header .wrap, .site-footer .wrap { max-width: 1600px; }
main.wrap.full, body.page-full .site-header .wrap, body.page-full .site-footer .wrap { max-width: none; }
/* .wrap sets side padding only; give the page its own breathing room under the header */
main.wrap { padding-top: 28px; padding-bottom: 56px; }
@media (max-width: 640px) { main.wrap { padding-top: 18px; } }
.narrow { width: 100%; }
.reading { max-width: 980px; margin-left: auto; margin-right: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.loading { color: var(--muted); padding: 40px 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }

/* Header */
.site-header { background: var(--head); color: var(--head-ink); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
.brand-mark svg { width: 28px; height: 28px; display: block; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { text-decoration: none; padding: 7px 11px; border-radius: 9px; font-weight: 550; font-size: .95rem; opacity: .88; }
.nav a:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.nav a.active { background: rgba(255, 255, 255, .16); opacity: 1; }
.theme-toggle { background: none; border: 0; padding: 7px; border-radius: 9px; cursor: pointer; color: var(--head-ink); display: flex; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
@media (max-width: 640px) {
  .brand-name { display: none; }
  .nav a { padding: 7px 6px; font-size: .86rem; }
}
@media (max-width: 380px) { .nav-progress { display: none; } }

.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--muted); font-size: .88rem; }

/* Buttons and bits */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--head); color: var(--head-ink); border-color: var(--head); }
:root[data-theme="dark"] .btn.primary { background: var(--accent); color: #10251C; border-color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--accent); color: #10251C; border-color: var(--accent); } }
.btn.buy { background: var(--up); border-color: var(--up); color: #fff; }
.btn.sell { background: var(--down); border-color: var(--down); color: #fff; }
.btn.small { padding: 6px 11px; font-size: .88rem; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.back { display: block; width: fit-content; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.back:hover { color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Track colours */
[data-track="probability"] { --t: var(--prob); --tt: var(--prob-t); }
[data-track="candles"] { --t: var(--candles); --tt: var(--candles-t); }
[data-track="investing"] { --t: var(--invest); --tt: var(--invest-t); }
[data-track="fundamentals"] { --t: var(--fund); --tt: var(--fund-t); }
[data-track="sim"] { --t: var(--sim); --tt: var(--sim-t); }

/* Home */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 36em; }
.hero-chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.hero-chart canvas { width: 100%; height: 230px; display: block; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.track-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; border-top: 5px solid var(--t); }
.track-card:hover { border-color: var(--t); }
.track-card .icon { width: 42px; height: 42px; border-radius: 11px; background: var(--tt); color: var(--t); display: grid; place-items: center; }
.track-card .icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.track-card h3 { margin: 4px 0 0; font-size: 1.25rem; }
.track-card p { margin: 0; color: var(--muted); }
.track-card .bar > span { background: var(--t); }
.track-card .meta { font-size: .86rem; color: var(--muted); display: flex; justify-content: space-between; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.steps .card { position: relative; padding-top: 22px; }
.steps .card::before { counter-increment: s; content: counter(s); position: absolute; top: -12px; left: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--butter); color: #24231F; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }

/* Learn */
.level-title { font-family: var(--serif); font-size: 1.15rem; margin: 26px 0 10px; display: flex; gap: 10px; align-items: baseline; }
.level-title .muted { font-family: var(--sans); font-size: .9rem; font-weight: 400; }
.lesson-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.levels { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.levels .level-title { margin-top: 18px; }
@media (max-width: 1000px) { .levels { grid-template-columns: minmax(0, 1fr); gap: 0; } .lesson-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.track-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: center; margin-top: 18px; }
.track-top .track-head { margin-bottom: 0; }
.track-top .track-head p { max-width: 46em; margin: 0; }
.track-go { display: grid; gap: 10px; }
.track-go .bar > span { background: var(--t); }
@media (max-width: 820px) { .track-top { grid-template-columns: minmax(0, 1fr); } }
.lesson-item { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; padding: 14px 16px; }
.lesson-item:hover { border-color: var(--t); }
.lesson-item .tick { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.lesson-item.done .tick { background: var(--t); border-color: var(--t); color: var(--surface); }
.lesson-item b { display: block; line-height: 1.3; }
.lesson-item span.muted { font-size: .88rem; }
.track-head { border-left: 6px solid var(--t); padding-left: 14px; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.tabs a { text-decoration: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; }
.tabs a.active { background: var(--t, var(--head)); border-color: var(--t, var(--head)); color: var(--surface); }

/* Lesson page */
/* Lesson: reading column + sticky side panel on wide screens */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; max-width: 1200px; margin: 0 auto; align-items: start; }
.lesson { min-width: 0; }
.lesson-top, .lesson-body > p, .lesson-body > ul, .lesson-body > ol, .lesson-body > h3, .lesson-body > .callout, .lesson-body > .formula, .lesson [data-check] > h2, .lesson [data-check] > p { max-width: 760px; }
.lesson [data-check] > .qbox, .lesson [data-check] > .card { max-width: 900px; }
.lesson-body h3 { scroll-margin-top: 80px; }
.lesson-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; display: grid; gap: 14px; padding-bottom: 6px; }
.lesson-side .card { padding: 14px 16px; }
.lesson-side h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--sans); margin: 0 0 8px; }
.lesson-side .bar { margin: 8px 0 4px; }
.lesson-side .bar > span { background: var(--t); }
.toc { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); font-size: .92rem; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--t); border-left-color: var(--t); font-weight: 650; }
.lesson-side .terms { display: flex; flex-wrap: wrap; gap: 6px; }
.lesson-side button.gl { text-decoration: none; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: .86rem; cursor: pointer; }
.lesson-side button.gl:hover { background: var(--tt); color: var(--t); }
.up-next { display: block; text-decoration: none; }
.up-next b { display: block; line-height: 1.3; margin-top: 2px; }
.up-next:hover b { color: var(--t); }
@media (max-width: 1100px) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
  .lesson-side { display: none; }
}
.lesson-top { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.lesson-top .pill { background: var(--tt); color: var(--t); }
.lesson-body { font-size: 1.05rem; }
.lesson-body h3 { margin-top: 1.4em; font-size: 1.25rem; }
.lesson-body ul, .lesson-body ol { padding-left: 1.3em; margin: 0 0 .9em; }
.lesson-body li { margin: .25em 0; }
.callout { border-radius: 12px; padding: 13px 16px; margin: 16px 0; border: 1px solid var(--line); background: var(--surface); }
.callout b.title { display: block; margin-bottom: 3px; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.callout.tip { background: var(--candles-t); border-color: transparent; }
.callout.tip b.title { color: var(--candles); }
.callout.warn { background: var(--invest-t); border-color: transparent; }
.callout.warn b.title { color: var(--invest); }
.callout.example { background: var(--surface-2); border-color: transparent; }
.callout.example b.title { color: var(--muted); }
.callout p:last-child { margin: 0; }
.formula { text-align: center; font-family: var(--serif); font-size: 1.2rem; padding: 14px; margin: 16px 0; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; }
.formula .note { display: block; font-family: var(--sans); font-size: .85rem; color: var(--muted); margin-top: 4px; }
.table-wrap { overflow-x: auto; margin: 14px 0; }
table.t { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--surface); border-radius: 10px; overflow: hidden; }
table.t th, table.t td { padding: 8px 11px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { background: var(--surface-2); font-size: .85rem; }
.chart-block { margin: 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chart-block canvas { width: 100%; height: 220px; display: block; }
.chart-block figcaption { font-size: .88rem; color: var(--muted); padding: 6px 4px 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* Questions */
.qbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.qbox .qnum { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.qbox .qtext { font-size: 1.06rem; font-weight: 550; margin-bottom: 12px; }
.qbox .chart-block { margin-top: 0; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; }
.choice:hover:not(:disabled) { border-color: var(--muted); }
.choice:disabled { cursor: default; }
.choice.right { border-color: var(--ok); background: var(--up-t); }
.choice.wrong { border-color: var(--bad); background: var(--down-t); }
.num-answer { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.num-field { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: text; }
.num-field:focus-within { border-color: var(--invest); box-shadow: 0 0 0 3px var(--invest-t); }
.num-field .affix { color: var(--muted); font-weight: 600; white-space: nowrap; }
.num-answer input { width: 140px; padding: 10px 0; border: 0; background: transparent; outline: none; font-size: 1rem; }
.num-field:has(input.right) { border-color: var(--ok); } .num-field:has(input.wrong) { border-color: var(--bad); }
.explain { margin-top: 12px; padding: 11px 14px; border-radius: 10px; background: var(--surface-2); font-size: .96rem; }
.explain b.verdict { color: var(--ok); } .explain b.verdict.no { color: var(--bad); }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.quiz-progress .bar { flex: 1; }
.score-big { font-family: var(--serif); font-size: 3rem; font-weight: 700; line-height: 1; }

/* Practice */
.mode-card { display: flex; flex-direction: column; gap: 10px; }
.mode-card h3 { margin: 0; }
.mode-card p { margin: 0; color: var(--muted); }
.mode-card .btn-row { margin-top: auto; }
.chip-select { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-select button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 550; font-size: .9rem; }
.chip-select button[aria-pressed="true"] { background: var(--head); color: var(--head-ink); border-color: var(--head); }
.chip-select button[aria-pressed="true"] .muted { color: inherit; opacity: .75; }
.chip-select { row-gap: 8px; }
.mode-card .opt-group { margin-top: 8px; }
.opt-label { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.mode-card .opt-group + .btn-row { padding-top: 18px; }
.guess-chart canvas { width: 100%; height: 300px; display: block; }

/* Widgets */
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 18px 0; box-shadow: var(--shadow); }
.widget h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.1rem; }
.widget .wsub { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.widget canvas { width: 100%; height: 180px; display: block; margin-top: 10px; }
.widget .stat-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.widget .stat b { display: block; font-size: 1.3rem; font-family: var(--serif); }
.widget .stat span { font-size: .82rem; color: var(--muted); }
.slider-row { display: grid; grid-template-columns: 90px 1fr 70px; gap: 10px; align-items: center; margin: 6px 0; font-size: .92rem; }
.slider-row input[type=range] { width: 100%; accent-color: var(--head); }
.coins { display: flex; flex-wrap: wrap; gap: 3px; min-height: 26px; margin-top: 8px; }
.coins span { width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.coins .h { background: var(--butter); color: #5a4500; } .coins .t { background: var(--surface-2); color: var(--muted); }
.bet-options { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.bet-options button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.bet-options button[aria-pressed="true"] { border-color: var(--head); background: var(--candles-t); }

/* Simulator list */
.scenario { display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.scenario:hover { border-color: var(--sim); }
.scenario h3 { margin: 0; }
.scenario p { margin: 0; color: var(--muted); font-size: .95rem; }
.mood { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--sim-t); color: var(--sim); }
.scenario .best { font-size: .86rem; margin-top: auto; }
.setup-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.setup-row label { font-weight: 600; font-size: .92rem; }

/* Simulator game */
.sim { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.sim > * { min-width: 0; }
@media (max-width: 960px) { .sim { grid-template-columns: minmax(0, 1fr); } }
.sim-top { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sim-top h1 { margin: 0; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (max-width: 640px) { .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-strip .card { padding: 10px 14px; }
.stat-strip span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-strip b { font-size: 1.25rem; font-family: var(--serif); }
/* nine investments: wrap into rows on wide screens, swipe sideways on phones */
.asset-tabs { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
@media (max-width: 1599px) { .asset-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); } } /* 5 + 4 */
.asset-tab b, .asset-tab small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tab { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 11px; cursor: pointer; min-width: 0; }
@media (max-width: 640px) { .asset-tabs { display: flex; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; } .asset-tab { flex: none; min-width: 128px; } }
.asset-tab[aria-pressed="true"] { border-color: var(--head); box-shadow: inset 0 0 0 1px var(--head); }
:root[data-theme="dark"] .asset-tab[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.asset-tab b { display: block; font-size: .92rem; }
.asset-tab small { color: var(--muted); font-size: .76rem; display: block; }
.asset-tab .chg { font-size: .82rem; font-weight: 650; }
.sim-chart { padding: 8px; position: relative; }
.sim-chart canvas { width: 100%; height: 420px; display: block; touch-action: pan-y; }
@media (max-width: 640px) { .sim-chart canvas { height: 320px; } }
.chart-tools { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .86rem; padding: 4px 6px 6px; color: var(--muted); }
.chart-tools label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.chart-tools .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.chart-tip { position: absolute; top: 46px; left: 16px; font-size: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
.playbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 12px 0; }
.playbar .day { font-weight: 650; font-variant-numeric: tabular-nums; }
.speed { display: flex; gap: 4px; flex-wrap: wrap; }
.speed button { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .86rem; font-weight: 600; }
.speed button[aria-pressed="true"] { background: var(--head); color: var(--head-ink); border-color: var(--head); }
/* fills up while waiting for the next day */
.day-clock { height: 3px; margin: 8px 0 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.day-clock span { display: block; height: 100%; width: 0; background: var(--muted); border-radius: 99px; }
@keyframes day-fill { from { width: 0; } to { width: 100%; } }
.timeline { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.timeline span { display: block; height: 100%; background: var(--sim); }
.trade-panel h3 { margin: 0 0 2px; }
.trade-panel .price { font-size: 1.6rem; font-family: var(--serif); font-weight: 700; }
.trade-panel label.f { display: block; font-size: .85rem; font-weight: 600; margin: 10px 0 4px; }
.trade-panel input[type=number] { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }
.trade-panel .quick { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.trade-panel .quick button { flex: 1; padding: 5px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; cursor: pointer; }
.trade-panel .bs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.trade-panel .note { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.trade-panel .msg { font-size: .88rem; margin-top: 8px; min-height: 1.3em; }
/* side panel: Trade / Holdings / Log tabs instead of one long column */
.side-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 10px; background: var(--surface-2); border-radius: 12px; }
.side-tabs button { border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-weight: 650; font-size: .9rem; cursor: pointer; color: var(--muted); }
.side-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.side-tabs .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--sim); color: #fff; font-size: .72rem; line-height: 18px; }
.side-tabs .count:empty { display: none; }
.holdings h3 { margin: 0 0 6px; }
.holdings .hold-row { cursor: pointer; }
.holdings .hold-row:hover td { background: var(--surface-2); }
.holdings td small { display: block; color: var(--muted); font-size: .74rem; }
.holdings tr.total td { font-weight: 700; border-bottom: 0; }
.holdings table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.holdings td, .holdings th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.holdings th { font-size: .75rem; color: var(--muted); font-weight: 600; }
.holdings td:first-child, .holdings th:first-child { text-align: left; }
.log { max-height: 60vh; overflow-y: auto; font-size: .84rem; margin-top: 6px; }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
details.stop-box summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-top: 12px; }
.news { font-size: .9rem; padding: 9px 12px; border-radius: 10px; background: var(--butter); color: #3b3000; margin-bottom: 10px; }

/* Results */
.results-hero { text-align: center; padding: 20px 0 6px; }
.results-hero .big { font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 700; line-height: 1.05; }
.reveal { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.reveal .card { padding: 12px 14px; }
.reveal .card b { display: block; }
.feedback li { margin: 6px 0; }

/* Progress */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stats-grid .card b { display: block; font-family: var(--serif); font-size: 1.7rem; }
.stats-grid .card span { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); padding: 14px 0; }

/* Glossary */
/* Glossary stays in the menu on phones too: it is the one place it lives outside lessons */
.gl-search { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 1rem; margin-top: 6px; }
.az { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; }
.az a { text-decoration: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-weight: 650; font-size: .88rem; }
.az a:hover { border-color: var(--muted); }
.gl-letter { margin: 24px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); scroll-margin-top: 72px; }
.gl-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 4px 28px; }
@media (max-width: 640px) { .gl-group { grid-template-columns: minmax(0, 1fr); } }
.gl-entry { padding: 10px 0 10px 12px; border-left: 3px solid var(--t, var(--line)); margin: 6px 0; scroll-margin-top: 80px; }
.gl-entry p { margin: 2px 0 4px; }
.gl-entry .gl-lesson { color: var(--t, var(--muted)); text-decoration: none; font-weight: 600; }
.gl-entry.flash { background: var(--butter); border-radius: 0 10px 10px 0; color: #24231F; }
button.gl { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
button.gl:hover { text-decoration-color: var(--ink); }
.gl-pop { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .16); padding: 12px 14px; font-size: .94rem; }
.gl-pop p { margin: 4px 0 8px; }
.gl-pop a { color: var(--accent); font-weight: 600; }

/* Simulator: stop-loss and take-profit */
.protect { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.protect-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .9rem; }
.protect .quick { margin: 6px 0; }
.protect input[type=number] { padding: 7px 10px; font-size: .88rem; }

/* Calculator */
.with-calc { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; max-width: 1200px; margin: 0 auto; align-items: start; }
.with-calc .session { min-width: 0; max-width: 860px; }
.calc-side { position: sticky; top: 76px; }
.calc-card { padding: 14px 16px; }
.calc-card summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.calc-card summary::-webkit-details-marker { display: none; }
.calc-card summary::after { content: "Show"; font-size: .82rem; font-weight: 600; color: var(--muted); }
.calc-card[open] summary::after { content: "Hide"; }
.calc-card summary h2 { margin: 0; }
.calc-card[open] summary { margin-bottom: 10px; }
.calc { display: grid; gap: 10px; }
.calc-screen { background: var(--surface-2); border-radius: 12px; padding: 8px 12px 10px; text-align: right; }
.calc-prev { min-height: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-in { width: 100%; border: 0; background: transparent; text-align: right; font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 0; outline: none; color: var(--ink); }
.calc-out { min-height: 1.3em; color: var(--muted); font-variant-numeric: tabular-nums; }
.calc-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.calc-keys button { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 1.02rem; font-weight: 600; cursor: pointer; }
.calc-keys button:hover { border-color: var(--muted); }
.calc-keys button:active { transform: translateY(1px); }
.calc-keys .fn { background: var(--surface-2); font-size: .92rem; }
.calc-keys .op { background: var(--invest-t); color: var(--invest); border-color: transparent; font-size: 1.15rem; }
.calc-keys .eq { background: var(--head); color: var(--head-ink); border-color: var(--head); font-size: 1.2rem; }
.calc-keys .wide { grid-column: span 2; }
.calc-use { width: 100%; justify-content: center; }
.calc-note { margin: 0; text-align: center; }
.calc-fab { display: none; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px; border: 0; background: var(--head); color: var(--head-ink); font-weight: 650; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); cursor: pointer; }
.calc-fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.calc-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--surface); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0, 0, 0, .18); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; }
.calc-sheet[hidden] { display: none; }
.calc-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
@media (max-width: 1100px) {
  .with-calc { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
  .calc-side { display: none; }
  .calc-fab { display: inline-flex; }
  main.wrap:has(.calc-fab) { padding-bottom: 96px; }
}
@media (min-width: 1101px) { .calc-sheet { display: none !important; } }

/* Simulator: choosing a kind of market */
.market-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.market-pick button { text-align: left; display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.market-pick button:hover { border-color: var(--muted); }
.market-pick button[aria-pressed="true"] { border-color: var(--sim); background: var(--sim-t); }
.market-pick b { font-size: 1rem; }
.market-pick span { font-size: .88rem; color: var(--muted); line-height: 1.35; }
.market-pick small { font-size: .78rem; color: var(--muted); font-weight: 600; }
.market-pill { vertical-align: middle; font-family: var(--sans); background: var(--sim-t); color: var(--sim); margin-left: 6px; }

/* Simulator headlines: loud on purpose, so players learn to check the chart */
.headline[hidden] { display: none; }
.headline { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 10px; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg); text-align: left; font-weight: 600; font-size: .95rem; cursor: pointer; }
.headline .tag { flex: none; background: var(--sim); color: #fff; font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.headline [data-htext] { flex: 1; min-width: 0; }
.headline [data-htext] small { display: block; font-weight: 500; font-size: .8rem; opacity: .75; margin-top: 2px; }
.news-feed small.ctx { display: block; color: var(--muted); font-size: .8rem; margin: 1px 0 0 60px; }
.headline .hday { flex: none; font-size: .8rem; opacity: .7; font-weight: 500; }
.headline.fresh { animation: headline-in .6s ease; }
@keyframes headline-in { 0% { transform: translateY(-4px); box-shadow: 0 0 0 4px var(--sim-t); } 100% { transform: none; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .headline.fresh { animation: none; } }
.news-feed { margin-top: 12px; padding: 12px 14px; }
.news-feed h3 { margin: 0 0 6px; font-size: 1rem; }
.news-feed ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.news-feed button { width: 100%; text-align: left; border: 0; background: none; padding: 5px 0; font-size: .9rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.news-feed li:last-child button { border-bottom: 0; }
.news-feed button:hover { color: var(--sim); }
.news-feed .muted.small { display: inline-block; min-width: 56px; }

/* "Read the report": a simplified results table */
table.report caption { text-align: left; font-weight: 700; padding: 0 0 6px; }
table.report td:not(:first-child), table.report th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
table.report tr.strong td { font-weight: 700; }

/* five practice modes: one row on wide screens */
.mode-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* News: under the chart on wide screens, a side-panel tab on phones and tablets */
.side-tabs:has(.side-news) { grid-template-columns: repeat(3, 1fr); }
.side-tabs .side-news, .card.side-news { display: none; }
@media (max-width: 960px) {
  .side-tabs:has(.side-news) { grid-template-columns: repeat(4, 1fr); }
  .side-tabs .side-news { display: block; }
  .card.side-news:not([hidden]) { display: block; }
  .sim > div > .news-feed { display: none; }
}
@media (max-width: 640px) {
  .stat-strip { gap: 8px; }
  .stat-strip .card { padding: 8px 12px; }
  .stat-strip .card b { font-size: 1.05rem; }
}

/* Free demo and the unlock screen (js/licence.js) */
.nav-unlock { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: var(--butter); color: #24231F; font-weight: 650; font-size: .9rem; cursor: pointer; }
.nav-unlock[hidden], .link-btn[hidden] { display: none; }
.nav-unlock svg, .lock-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; flex: none; }
.nav-unlock:hover { filter: brightness(1.04); }
@media (max-width: 520px) { .nav-unlock { padding: 7px; margin-left: 2px; } .nav-unlock span { display: none; } }
.link-btn { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-weight: 600; cursor: pointer; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0 0; }
.footer-links a, .footer-links .link-btn { padding: 6px 0; }
.lock-icon { display: inline-flex; color: var(--muted); }
.demo-note { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; margin: 14px 0; max-width: 60em; }
.demo-note .lock-icon { margin-top: 2px; }
.demo-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: center; border-color: transparent; background: var(--invest-t); }
.demo-card h2 { margin-bottom: 6px; }
.demo-card p { margin: 0; }
@media (max-width: 820px) { .demo-card { grid-template-columns: minmax(0, 1fr); } }
.lesson-item.locked { opacity: .78; }
.lesson-item.locked .tick { border-style: dashed; }
.lesson-item.locked .tick svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.market-pick small svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; vertical-align: -1px; }
.lock-card { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; padding: 22px; }
.lock-card .lock-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--butter); color: #24231F; display: grid; place-items: center; flex: none; }
.lock-card .lock-icon svg { width: 22px; height: 22px; }
.lock-card h2 { margin-bottom: 6px; }
@media (max-width: 520px) { .lock-card { flex-direction: column; } }
.gate { position: fixed; inset: 0; z-index: 100; overflow-y: auto; background: color-mix(in srgb, var(--bg) 92%, transparent); display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.gate[hidden] { display: none; }
.gate-card { position: relative; width: min(540px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 28px clamp(18px, 4vw, 34px); display: grid; gap: 12px; }
.gate-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.gate-close:hover { background: var(--surface-2); }
.gate-brand { display: flex; align-items: center; gap: 10px; font: 700 1.05rem var(--serif); margin: 0; color: var(--accent); }
.gate-brand .brand-mark svg { width: 26px; height: 26px; }
.gate-card h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.1rem); }
.gate-card p { margin: 0; }
.gate-card label { font-weight: 600; margin-top: 4px; }
.gate-card input { font: 500 1.3rem var(--sans); padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); letter-spacing: .04em; width: 100%; }
.gate-card input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-color: var(--accent); }
.gate-go { font-size: 1.05rem; padding: 12px 22px; }
.gate-notice { background: var(--invest-t); padding: 10px 14px; border-radius: 12px; }
.gate-err { color: var(--bad); font-weight: 550; }
.gate-help { display: grid; gap: 10px; font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.gate-links { display: flex; gap: 16px; flex-wrap: wrap; }
.gate-links a { display: inline-block; padding: 6px 0; }
body.locked { overflow: hidden; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; background: var(--head); color: var(--head-ink); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: min(92vw, 520px); transition: opacity .5s; }
.toast.out { opacity: 0; }

/* FAQ, terms and privacy pages (scripts/make-pages.js) */
.info-main { max-width: 820px; }
.info-main .lede { color: var(--muted); }
.info-body h2 { margin-top: 1.6em; }
.info-body a { color: var(--accent); }
.faq-q { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq-q summary { cursor: pointer; padding: 12px 0; list-style-position: outside; }
.faq-q > div { padding: 0 0 10px; }
/* small phones: room for the Unlock button beside the five menu items */
@media (max-width: 400px) {
  .header-inner { gap: 6px; }
  .nav a { padding: 7px 4px; font-size: .84rem; }
  .nav-unlock { padding: 6px; margin-left: 0; }
  .theme-toggle { padding: 5px; }
}
