* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --paper: #f3f0e7; --card: #fffdf7; --ink: #242820; --muted: #60685d;
  --line: #d8d5c9; --accent: #276348; --accent-soft: #e0eee2; --warm: #b46035;
  --control: #7a8476; --focus: #965415; --shadow: 0 8px 30px #3028130c;
  font: 17px/1.5 "Trebuchet MS", "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark; --paper: #151c18; --card: #202923; --ink: #edf2e9; --muted: #b5c2b6;
  --line: #45564a; --accent: #a6d9b3; --accent-soft: #2b4435; --warm: #f0a477;
  --control: #819587; --focus: #ffd08e; --shadow: 0 8px 30px #0004;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --paper: #151c18; --card: #202923; --ink: #edf2e9; --muted: #b5c2b6; --line: #45564a; --accent: #a6d9b3; --accent-soft: #2b4435; --warm: #f0a477; --control: #819587; --focus: #ffd08e; --shadow: 0 8px 30px #0004; }
}
body { margin: 0; background: var(--paper); color: var(--ink); }
main { width: min(1120px, 100%); margin: auto; padding: clamp(1rem, 3vw, 2.5rem); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .25rem; font: 700 clamp(2.2rem, 6vw, 3.7rem)/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.035em; text-wrap: balance; }
h2 { margin-bottom: .2rem; font-size: 1.14rem; line-height: 1.25; }
.masthead { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.2rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.intro { margin-bottom: 0; max-width: 58ch; color: var(--muted); font-size: 1.04rem; }
.card { min-width: 0; padding: clamp(.9rem, 2.5vw, 1.35rem); border: 1px solid var(--line); border-radius: .9rem; background: var(--card); box-shadow: var(--shadow); }
.access-card { display: grid; grid-template-columns: 1fr minmax(16rem, .8fr); gap: 1.5rem; align-items: center; margin-bottom: 1rem; }
.practice-form { display: grid; gap: .4rem; }
.inline-form { display: flex; gap: .5rem; }
.inline-form input { flex: 1 1 10rem; }
.muted, .fine-print { color: var(--muted); }
.muted { margin-bottom: .5rem; }
.fine-print { margin: .35rem 0 0; font-size: .8rem; }
label { display: grid; gap: .28rem; font-weight: 700; font-size: .9rem; }
input, select, textarea, button { max-width: 100%; font: inherit; }
input, select, textarea { min-width: 0; border: 1px solid var(--control); border-radius: .45rem; padding: .55rem .65rem; background: var(--card); color: var(--ink); }
input, select { min-height: 2.8rem; }
textarea { width: 100%; min-height: 4.5rem; resize: vertical; }
button { min-height: 2.65rem; padding: .55rem .8rem; border: 1px solid var(--control); border-radius: .48rem; background: var(--card); color: var(--ink); font-weight: 700; cursor: pointer; touch-action: manipulation; }
button:hover { background: var(--accent-soft); }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.primary-button { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.quiet-button { font-size: .83rem; }
.status { min-height: 1.5rem; margin: 0 0 .6rem; font-size: .9rem; }
.status[data-kind="error"] { color: #a93225; font-weight: 700; }
.market-heading { margin-bottom: 1rem; }
.market-title-row { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.market-title-row > div { min-width: 0; }
.teaching-prompt { max-width: 68ch; margin: .55rem 0 0; padding: .6rem .75rem; border-left: 3px solid var(--warm); background: var(--accent-soft); font-size: .9rem; font-weight: 700; }
.headline-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin: 1rem 0; }
.headline-stat { display: grid; gap: .15rem; padding: .75rem .85rem; border-radius: .65rem; background: var(--accent-soft); }
.headline-stat > span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.headline-stat strong { font: 700 clamp(1.35rem, 4vw, 2rem)/1.2 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.headline-stat small { color: var(--muted); font-size: .75rem; }
.outcomes { display: grid; gap: .5rem; }
.outcomes-details { margin: .6rem 0; }
.outcomes-details > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.outcomes-details[open] > summary { margin-bottom: .7rem; color: var(--ink); }
.settled-result { margin: .85rem 0 0; padding: .65rem .8rem; border-left: 4px solid var(--warm); border-radius: .35rem; background: var(--accent-soft); }
.outcome-row { display: grid; grid-template-columns: minmax(7rem, .65fr) 3fr 3.2rem; gap: .65rem; align-items: center; font-size: .86rem; }
.outcome-label { overflow-wrap: anywhere; }
.probability-track { height: .7rem; overflow: hidden; border-radius: 99px; background: var(--line); }
.probability-fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.probability-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.explain-box { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.explain-box summary { width: fit-content; color: var(--accent); font-weight: 700; cursor: pointer; }
.explain-content { max-width: 75ch; padding: .5rem 0 0; color: var(--muted); font-size: .88rem; }
.explain-content p:last-child { margin-bottom: 0; }
.schedule-box { margin-top: .7rem; color: var(--muted); font-size: .83rem; }
.schedule-box summary { width: fit-content; color: var(--accent); font-weight: 700; cursor: pointer; }
.schedule-box p { margin: .5rem 0 0; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; align-items: start; }
.left-column, .right-column { display: grid; gap: 1rem; min-width: 0; }
.section-title { display: flex; align-items: start; gap: .7rem; margin-bottom: 1rem; }
.section-title .muted { margin: .2rem 0 0; font-size: .87rem; }
.step { display: grid; width: 1.8rem; height: 1.8rem; flex: 0 0 1.8rem; place-items: center; border-radius: 50%; background: var(--accent); color: var(--paper); font-weight: 800; }
.optional-step { background: var(--accent-soft); color: var(--accent); }
.daily-evidence-details { margin-top: .35rem; font-size: .78rem; }
.daily-evidence-details ol { margin: .35rem 0 0; padding-left: 1.2rem; }
.daily-evidence-details li { margin: .15rem 0; }
.reflection-privacy { margin-top: .65rem; }
.prediction-input-row { display: flex; align-items: center; gap: .6rem; }
.prediction-input-row input { width: min(16rem, 100%); font-size: 1.2rem; font-weight: 700; }
.categorical-prediction { display: grid; gap: .45rem; max-width: 20rem; margin-bottom: .6rem; }
.unit { color: var(--muted); }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: .8rem; }
.inline-result { color: var(--accent); font-size: .88rem; }
.trade-controls { display: grid; grid-template-columns: 1.2fr 1fr .8fr; gap: .6rem; margin-bottom: .85rem; }
.privacy-controls { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .8rem; }
.check-label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .45rem; font-size: .83rem; font-weight: 600; }
.check-label input { width: 1.15rem; height: 1.15rem; min-height: auto; accent-color: var(--accent); }
.quote-result { display: block; min-height: 2.2rem; margin-top: .65rem; padding: .55rem .7rem; border-radius: .45rem; background: var(--accent-soft); font-size: .88rem; }
.timeline-tabs { display: flex; gap: .4rem; margin-bottom: .8rem; }
.timeline-tabs button { min-height: 2.25rem; padding: .4rem .65rem; font-size: .83rem; }
.timeline-tabs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.receipt-card p { font-size: .87rem; }
.receipt-result { display: block; margin-top: .6rem; font-size: .85rem; overflow-wrap: anywhere; }
footer { display: flex; justify-content: space-between; gap: .8rem; padding: 1.2rem .2rem .2rem; color: var(--muted); font-size: .75rem; }
footer span:first-child { font-weight: 700; }
[hidden] { display: none !important; }
@media (max-width: 760px) { .right-column { grid-template-columns: 1fr; } }
@media (max-width: 580px) {
  main { padding: .8rem; }
  .masthead, .market-title-row { flex-direction: column; align-items: stretch; }
  .masthead .quiet-button { align-self: start; }
  .access-card { grid-template-columns: 1fr; gap: .8rem; }
  .headline-grid { grid-template-columns: 1fr; }
  .trade-controls { grid-template-columns: 1fr 1fr; }
  .trade-controls label:last-child { grid-column: 1 / -1; }
  footer { flex-direction: column; }
}
@media (max-width: 380px) { .inline-form { flex-direction: column; } .inline-form input { flex-basis: auto; } .outcome-row { grid-template-columns: minmax(5.5rem, .8fr) 2fr 2.8rem; gap: .4rem; font-size: .78rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Shared tokens keep active, hover, focus and invalid controls readable in either theme. */
:root { --error: #a12520; --button-ink: #fffdf7; --series-0: #276348; --series-1: #985024; --series-2: #62429b; --series-3: #a22862; --series-4: #245f9b; }
:root[data-theme="dark"] { --error: #ffb3aa; --button-ink: #132019; --series-0: #a6d9b3; --series-1: #f0b082; --series-2: #c7b1ff; --series-3: #ffa9d3; --series-4: #9dcaff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --error: #ffb3aa; --button-ink: #132019; --series-0: #a6d9b3; --series-1: #f0b082; --series-2: #c7b1ff; --series-3: #ffa9d3; --series-4: #9dcaff; } }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.primary-button, .timeline-tabs button[aria-pressed="true"], .step { color: var(--button-ink); }
.primary-button:hover { background: var(--accent-soft); color: var(--ink); }
button:disabled { opacity: 1; color: var(--muted); background: var(--paper); border-color: var(--control); }
.status[data-kind="error"], [data-kind="error"], .field-error { color: var(--error); font-weight: 700; }
[aria-invalid="true"] { border: 2px solid var(--error); }
.field-error { font-size: .83rem; margin: .35rem 0; }
.prediction-trade-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.prediction-trade-row > div { min-width: 0; }
.prediction-trade-row input:not([type="radio"]), .prediction-trade-row select { width: 100%; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 .65rem; }
legend { font-size: .9rem; font-weight: 700; margin-bottom: .35rem; }
.trade-mode { display: flex; flex-wrap: wrap; gap: .6rem; }
.live-estimate { display: block; margin-top: .4rem; font-size: .88rem; font-weight: 700; }
.sharing-controls { margin: .9rem 0; }
.privacy-controls { position: relative; margin-top: 0; }
.tooltip-control { position: static; display: inline-block; }
.tooltip { position: absolute; z-index: 2; top: calc(100% + .3rem); left: 0; width: min(19rem, 72vw); padding: .65rem; background: var(--ink); color: var(--card); border-radius: .4rem; font-size: .85rem; font-weight: 400; box-shadow: var(--shadow); visibility: hidden; }
.tooltip-control:hover .tooltip, .tooltip-control:focus-within .tooltip { visibility: visible; }
.prices-note { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .7rem; color: var(--muted); font-size: .8rem; margin-top: .8rem; }
.prices-note p { width: 100%; margin: 0; }
.prices-note button { font-size: .8rem; min-height: 2.2rem; }
.history-chart { margin: 0 0 1rem; }
.history-chart > summary { cursor: pointer; font-weight: 700; }
.history-chart[open] > summary { margin-bottom: .7rem; }
.table-scroll { overflow: auto; max-width: 100%; margin-top: .7rem; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; color: var(--muted); }
td { min-width: 7rem; overflow-wrap: anywhere; }
.timeline-card { --history-gutter: clamp(.8rem, 2vw, 1.5rem); width: calc(100vw - 2 * var(--history-gutter)); margin-inline: calc(50% - 50vw + var(--history-gutter)); }
.history-table .history-date, .history-table .history-evidence { white-space: nowrap; }
.history-table .history-reason { min-width: 10rem; max-width: 26rem; }
.history-table .history-sharing { min-width: 5rem; white-space: nowrap; }
.history-table time { display: block; }
.history-filters { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; margin-bottom: .35rem; }
.filter-chip, .compact-button { min-height: 1.6rem; padding: .15rem .4rem; font-size: .76rem; }
.visibility-button { display: inline-grid; place-items: center; width: 1.85rem; min-height: 1.85rem; padding: .3rem; margin: 0 .12rem; color: var(--muted); }
.visibility-button svg, .sharing-key svg { display: block; width: 1rem; height: 1rem; }
.visibility-button[aria-pressed="true"] { color: var(--button-ink); background: var(--accent); border-color: var(--accent); }
.visibility-button[aria-pressed="true"]:hover { color: var(--ink); background: var(--accent-soft); }
.sharing-key { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .75rem; }
.table-filter-button { min-height: 1.6rem; margin: -.15rem -.3rem; padding: .15rem .3rem; border-color: transparent; background: transparent; color: var(--accent); font-size: inherit; font-weight: inherit; text-align: left; text-decoration: underline; text-underline-offset: .15em; }
.table-filter-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.table-filter-button:hover { background: var(--accent-soft); }
.sale-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
.sale-row input { width: 10rem; }
#sale-controls { margin-top: 1rem; }
.price-history-chart { width: 100%; height: auto; overflow: visible; }
.price-history-chart text { fill: var(--muted); font-size: 12px; }
.chart-grid { stroke: var(--line); }
.price-line { fill: none; stroke-width: 2.5; stroke: var(--series-0); }
.price-point { fill: var(--series-0); }
.price-history-toggles { display: flex; gap: .5rem 1rem; flex-wrap: wrap; }
.price-history-toggles label { display: flex; align-items: center; gap: .4rem; font-size: .8rem; }
.price-history-toggles input { min-height: auto; }
@media (max-width: 580px) { .prediction-trade-row { grid-template-columns: 1fr; } .sale-row button { flex: 1 1 auto; } }
.price-line { stroke: var(--series-color, var(--series-0)); }
.price-point { fill: var(--series-color, var(--series-0)); }
.price-outcome-toggle { border-inline-start: 4px solid var(--series-color, var(--series-0)); padding-inline-start: .35rem; }

.optional-step { color: var(--accent); }
.tooltip-control[data-dismissed="true"] .tooltip { visibility: hidden; }

/* Tooltips are guidance, never an invisible click shield over nearby controls. */
.tooltip { pointer-events: none; }

/* Keyboard users can jump over the market details to the learning task. */
.skip-link { position: absolute; top: -8rem; left: .75rem; z-index: 10; background: var(--card); color: var(--ink); padding: .5rem .75rem; border: 2px solid var(--focus); border-radius: .45rem; }
.skip-link:focus { top: .75rem; }

/* Small-screen tables become readable cards without hiding the sharing controls. */
@media (max-width: 580px) {
  .mobile-cards, .mobile-cards tbody, .mobile-cards tr { display: block; width: 100%; }
  .mobile-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-cards tr { margin: .55rem 0; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: .55rem; }
  .mobile-cards td { display: grid; grid-template-columns: minmax(6rem, .9fr) minmax(0, 1.5fr); gap: .65rem; width: 100%; min-width: 0; padding: .5rem .1rem; white-space: normal; }
  .mobile-cards td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 700; }
  .mobile-cards td[colspan] { display: block; }
  .mobile-cards td[colspan]::before { content: none; }
}
