:root {
  --ink: var(--mf-ink, #262626);
  --muted: var(--mf-muted, #808080);
  --accent: var(--mf-blue, #4472C4);
  --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; }
h3 { font-size: 17px; margin: 0 0 10px; text-align: center; }
.h3hint { font-weight: 400; color: var(--muted); font-size: 14px; }
.sub { color: var(--muted); font-size: 17px; margin: 0 0 22px; max-width: 860px; 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 featured rule, full width; "Customize the rule" opens the settings inside it */
.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; }
.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: 0 0 14px; max-width: 980px; }
.custbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 4px 0 12px; }
.custbtn { font-family: inherit; font-size: 14px; font-weight: 600; width: 220px; 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; }

/* 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; }
input[type="range"] { width: 100%; height: 30px; accent-color: var(--accent); }
.ctl.off { opacity: .4; }

/* number tiles: big, centered both ways */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile { border: 1px solid var(--line); border-radius: 6px; background: var(--mf-bg, #fff); min-height: 124px; padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.tile .k { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.tile .v { font-size: 36px; font-weight: 700; line-height: 1.15; margin: 4px 0 4px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--muted); line-height: 1.35; }
.tile.lead { border-color: var(--accent); border-width: 2px; }
.tile.lead .v { color: var(--accent); }
.tile.ref .v { font-size: 26px; }
.tiles.small .tile { min-height: 92px; }
.tiles.small .tile .v { font-size: 28px; }

/* the chart window */
.win { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin: 4px 0 4px; font-size: 13px; color: var(--muted); }
.win label { display: inline-flex; align-items: center; gap: 8px; }
.win input[type="date"] { font-family: inherit; font-size: 14px; width: 160px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--mf-bg, #fff); color: var(--ink); }
.chart { min-height: 260px; margin: 4px 0 6px; }

/* the arithmetic box */
.arith { border: 1px solid var(--line); border-radius: 6px; padding: 14px 18px; background: var(--panel); font-size: 15px; line-height: 1.6; max-width: 900px; }
.arith .eq { font-size: 17px; margin: 6px 0; }
.arith .eq b { font-weight: 700; }
.arith .small { font-size: 13px; color: var(--muted); }

/* the range tables */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; margin-top: 12px; }
.rangebox { border: 1px solid var(--line); border-radius: 6px; padding: 14px 14px 6px; background: var(--panel); min-width: 0; }
table.range td.pick { cursor: pointer; font-variant-numeric: tabular-nums; }
table.range td.pick:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
table.range td.cur { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; color: var(--accent); }
table.t.range th { text-transform: none; letter-spacing: 0; }
table.t.range th, table.t.range td { height: 42px; padding: 0 8px; white-space: nowrap; }
table.range th[scope="row"] { font-size: 12.5px; color: var(--ink); text-align: center; }

/* the reaction-function updater */
.updater { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; margin: 12px 0 14px; }
.uctl { border: 1px solid var(--line); border-radius: 6px; padding: 4px 14px 4px; background: var(--panel); }
.uctl select { font-family: inherit; font-size: 14px; width: 306px; height: 36px; border: 1px solid var(--line); border-radius: 5px; background: var(--mf-bg, #fff); color: var(--ink); padding: 0 8px; }
.uresults { border: 1px solid var(--line); border-left: 5px solid var(--accent); background: var(--panel); border-radius: 6px; padding: 18px 20px 6px; min-width: 0; }
.uctl [hidden] { display: none; }
table.t.big th { font-size: 12px; white-space: normal; height: 48px; line-height: 1.3; text-transform: none; letter-spacing: 0; color: var(--ink); vertical-align: bottom; }
table.t.big td { height: 52px; padding: 0 8px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--mf-bg, #fff); }
table.t.big td:first-child { font-size: 17px; }
table.t.big { table-layout: fixed; }
table.t.big th:last-child, table.t.big td.diff { background: color-mix(in srgb, var(--mf-ink, #262626) 7%, var(--mf-bg, #fff)); border-left: 2px solid var(--mf-ink, #262626); }
table.t.big td.pos { color: color-mix(in srgb, var(--mf-green, #70AD47) 70%, #000); }
table.t.big td.neg { color: var(--mf-red, #C00000); }
table.t.big tr.lead td { background: color-mix(in srgb, var(--accent) 7%, var(--mf-bg, #fff)); }
table.t.big tr.lead td.diff { background: color-mix(in srgb, var(--mf-ink, #262626) 12%, var(--mf-bg, #fff)); }
.uyear { margin-top: 16px; }
.uchart-title { font-size: 15px; margin: 6px 0 2px; }
.uchart { min-height: 220px; }
.seg.narrow { grid-template-columns: repeat(auto-fill, 92px); }
.seg.narrow button { width: 92px; }
.udetails { margin: 4px 0 8px; }
.udetails summary { cursor: pointer; color: var(--accent); font-size: 14px; margin: 0 0 8px; }
table.t tr td, table.t tr th { height: 38px; }

/* tables: every column centered, headers and values alike */
.tablewrap { overflow-x: auto; margin: 0 0 8px; }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
table.t th, table.t td { text-align: center; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
table.t tr.lead td { font-weight: 700; background: var(--panel); }
table.t tr.past td { color: var(--muted); }
table.t td.strong { font-weight: 700; }
table.t td.muted { color: var(--muted); font-size: 12.5px; }
.methods p { max-width: 900px; }

@media (max-width: 900px) {
  .updater { grid-template-columns: minmax(0, 1fr); }
  .uresults { order: -1; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  h1 { font-size: 28px; }
  .results, .uresults { padding: 14px; }
  .controls { grid-template-columns: minmax(0, 1fr); padding: 4px 10px; }
  table.t.big td { font-size: 19px; }
  .lede { font-size: 16px; }
  .seg { grid-template-columns: repeat(auto-fill, 136px); }
  .seg button { width: 136px; font-size: 12px; }
  .uctl select { width: 100%; }
  .tile .v { font-size: 28px; }
}
