:root {
  --ink: var(--mf-ink, #262626);
  --muted: var(--mf-muted, #808080);
  --accent: var(--mf-blue, #4472C4);
  --accent2: var(--mf-orange, #ED7D31);
  --line: var(--mf-gridline, #D9D9D9);
  --panel: color-mix(in srgb, var(--mf-ink, #262626) 3%, var(--mf-bg, #fff));
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mf-bg, #fff); color: var(--ink); font-family: var(--mf-font, Literata, Georgia, serif); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 80px; }
a { color: var(--accent); }
.crumb { font-size: 14px; margin: 0 0 22px; }
h1 { font-size: 34px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 40px 0 6px; }
.sub { color: var(--muted); font-size: 17px; margin: 0 0 22px; max-width: 900px; line-height: 1.5; }
.note { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0 0 12px; max-width: 900px; }
.note.fine { font-size: 12.5px; }
.note p { margin: 0 0 10px; }
.note b { color: var(--ink); }
.hint { text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 13px; margin-left: 6px; }

/* the scenario panel, full width */
.results { border: 1px solid var(--line); border-left: 5px solid var(--accent); background: var(--panel); border-radius: 6px; padding: 18px 20px 10px; min-width: 0; }
.results.replay { border-left-color: var(--mf-ink, #262626); }
.kicker { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.lede { font-size: 18px; line-height: 1.45; margin: 6px 0 8px; max-width: 1000px; }
.custbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 12px; }
.custbtn { font-family: inherit; font-size: 14px; font-weight: 600; width: 250px; height: 40px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: var(--mf-bg, #fff); cursor: pointer; }
.custbtn.ghost { background: var(--mf-bg, #fff); color: var(--accent); font-weight: 400; }
.controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(326px, 1fr)); gap: 0 22px; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 16px 4px; background: var(--mf-bg, #fff); margin: 0 0 14px; }
.controls[hidden] { display: none; }
.ctl { margin: 10px 0 12px; }
.ctl label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.ctl.off { opacity: .4; }
.row2 { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 0 22px; }

/* buttons: every one the same fixed size, wrapping onto rows */
.seg { display: grid; grid-template-columns: repeat(auto-fill, 150px); gap: 6px; }
.seg button { font-family: inherit; font-size: 13px; width: 150px; height: 44px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--mf-bg, #fff); color: var(--ink); cursor: pointer; padding: 0 6px; white-space: normal; line-height: 1.15; overflow: hidden; }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--mf-bg, #fff); font-weight: 600; }
.seg button:disabled { opacity: .35; cursor: default; }
.controls .avail { grid-column: 1 / -1; margin: 0 0 8px; }
.seg.tiles-shock { grid-template-columns: repeat(auto-fill, 180px); }
.seg.tiles-shock button { width: 180px; height: 52px; font-size: 14px; }
/* why stock prices move: two buttons of one fixed width, wide enough for "Higher expected earnings" on one line */
.seg.why { grid-template-columns: repeat(auto-fill, 200px); }
.seg.why button { width: 200px; }
.cmp .seg button[aria-pressed="true"] { background: var(--accent2); border-color: var(--accent2); }
input[type="range"] { width: 100%; height: 30px; accent-color: var(--accent); }
.cmp input[type="range"] { accent-color: var(--accent2); }

/* scenario B */
.cmp { border: 1px solid var(--accent2); border-left-width: 5px; border-radius: 6px; padding: 12px 16px 2px; margin: 0 0 14px; background: var(--mf-bg, #fff); }
.cmp .controls { border: 0; padding: 0; margin: 0; }
.cmp .kicker { color: var(--accent2); }

/* charts */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.grid2[hidden] { display: none; }   /* a scenario that did not solve hides the charts; display: grid would override hidden */
.chartbox { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 4px; background: var(--mf-bg, #fff); min-width: 0; }
.chart { min-height: 200px; }
.fs-fig .mf-fig-plot svg { overflow: visible; }
.allbar { display: inline-flex; }
.allbar .ev-dlbar { margin: 0; }

/* the grid of every other variable */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 4px 0 14px; }
.more-grid .cell { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px 2px; background: var(--mf-bg, #fff); cursor: pointer; min-width: 0; }
.more-grid .cell:hover, .more-grid .cell:focus { border-color: var(--accent); outline: none; }
.more-grid .cell.focused { border-color: var(--accent); border-width: 2px; }
.more-grid .cell .mf-fig-title { font-size: 12.5px; }
.more-grid .cell .mf-fig-meta, .more-grid .cell .mf-fig-foot { display: none; }
.focus { border: 2px solid var(--accent); border-radius: 6px; padding: 12px 14px 4px; background: var(--mf-bg, #fff); margin: 6px 0 14px; }
.methods p { max-width: 900px; }


/* Customize: the three settings that need explaining take the full row, with the explanation under the buttons */
.controls .ctl.wide { grid-column: 1 / -1; }
.explain { font-size: 13.5px; line-height: 1.55; color: var(--ink); background: var(--panel); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 8px 12px; margin: 8px 0 0; max-width: 980px; }
.cmp .explain { border-left-color: var(--accent2); }
.explain b { font-weight: 600; }
.methods h3 { font-size: 16px; color: var(--ink); text-align: left; margin: 18px 0 6px; }
.methods ul.rules { margin: 0 0 12px; padding-left: 20px; max-width: 900px; }
.methods ul.rules li { margin: 0 0 8px; }

/* Customize: added shocks, one card each (shock, size, length, Remove) */
.extras { display: grid; gap: 10px; margin: 0 0 4px; }
.extras:empty { display: none; }
.extra { border: 1px solid var(--line); border-radius: 6px; padding: 2px 14px 6px; background: var(--panel); }
.cmp .extra { border-color: color-mix(in srgb, var(--accent2) 45%, var(--line)); }
.extra-top { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0 22px; align-items: end; }
.extra-bottom { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0 16px; }
.extra-bottom .ctl { flex: 1 1 280px; min-width: 0; }   /* a definite basis, or the button grid collapses to one column */
.extra select { font-family: inherit; font-size: 14px; width: 260px; height: 40px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--mf-bg, #fff); color: var(--ink); padding: 0 8px; }
.custbtn.rm { width: 150px; height: 40px; margin: 0 0 12px; }
.custbtn:disabled { opacity: .4; cursor: default; }

/* the download row: one centered row of three equal buttons under each chart (Jason, 2026-10-30) */
.chartbox .ev-dlbar, .focus .ev-dlbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  max-width: 540px; margin: 8px auto 6px; }
.chartbox .ev-dlbar .ev-dl, .focus .ev-dlbar .ev-dl { width: 100%; height: 34px; white-space: normal; line-height: 1.1; }
@media (max-width: 520px) {
  .chartbox .ev-dlbar .ev-dl, .focus .ev-dlbar .ev-dl { font-size: 11px; height: 40px; }
}

@media (max-width: 820px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .extra-top { grid-template-columns: minmax(0, 1fr); }
  .extra select { width: 100%; max-width: 260px; }
}
@media (max-width: 520px) {
  h1 { font-size: 28px; }
  .results { padding: 14px; }
  .controls { grid-template-columns: minmax(0, 1fr); padding: 4px 10px; }
  .lede { font-size: 16px; }
  .seg { grid-template-columns: repeat(auto-fill, 136px); }
  .seg button { width: 136px; font-size: 12px; }
  .seg.tiles-shock { grid-template-columns: repeat(auto-fill, 150px); }
  .seg.tiles-shock button { width: 150px; font-size: 13px; }
  .custbtn { width: 100%; }
  .extra { padding: 2px 6px 6px; }
  .extra .seg { grid-template-columns: repeat(auto-fill, 130px); }
  .extra .seg button { width: 130px; }
  .seg.why, .extra .seg.why { grid-template-columns: repeat(auto-fill, 150px); }
  .seg.why button, .extra .seg.why button { width: 150px; }
}
