/* The Model pages (SCOR_EST, Accuracy, Model ranks, Error analysis), redesigned Dec 1 (docs/REDESIGN.md "Model pages"):
   the team page's look: one column with room, a head, big-number tiles, plain section titles over light dividers, keys
   under charts, folded tables and method notes. The closing line is blue (--score), this model orange (--turn), other
   models gray, as before.
   One slice of the page's stylesheet. The files load in the order of their numbers (the <link> list in
   web/site_template.html) and several rules rely on that order at equal specificity: never reorder or merge
   them without running tests/layout_check.js. */
#est, #construct, #acc, #mrk, #err { width: 100%; max-width: 1120px; margin: 0 auto; box-sizing: border-box; gap: 20px; min-width: 0; }

/* the head and the tiles */
.md-head { padding-top: 6px; }
.md-title { font-family: var(--f-display); font-weight: 700; font-size: 1.84rem; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; }
.md-tag { display: inline-block; vertical-align: 0.45em; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font: 700 0.75rem/1.3 var(--f-body);
  letter-spacing: 0.04em; text-transform: uppercase; background: var(--line); color: var(--ink); }
.md-tag.live { background: var(--score); color: var(--on-accent); }
.md-tag.bf { background: transparent; border: 1px dashed var(--line-strong); }
.md-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; max-width: 70ch; }
.md-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px 22px; }
.md-tile { border-top: 1px solid var(--line-strong); padding-top: 8px; min-width: 0; }
.md-tile-l { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.md-tile-v { font-family: var(--f-display); font-weight: 600; font-size: 1.92rem; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 2px; color: var(--ink); }
.md-tile-v small { font-family: var(--f-body); font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.md-tile-v .u { font-size: 1.1rem; color: var(--muted); margin-left: 3px; }
.md-tile-s { font-size: 0.82rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.md-tile.line .md-tile-v { color: var(--score); } .md-tile.model .md-tile-v { color: var(--turn); }
.md-tile.line { border-top: 3px solid var(--score); padding-top: 6px; } .md-tile.model { border-top: 3px solid var(--turn); padding-top: 6px; }
.md-call { font-size: 0.88rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; }
.md-call p { margin: 4px 0; }
.md-call b { color: var(--ink); }

/* sections */
.md-sec { border-top: 1px solid var(--line); padding-top: 14px; min-width: 0; }
.md-sec-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 10px; }
.md-h { font-family: var(--f-display); font-weight: 700; font-size: 1.08rem; text-transform: uppercase; letter-spacing: 0.03em; }
.md-h3 { font-family: var(--f-display); font-weight: 700; font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 4px; }
.md-aside { font-size: 0.82rem; color: var(--muted); }
.md-note { font-size: 0.88rem; color: var(--muted); line-height: 1.45; margin: 8px 0 0; max-width: 78ch; }
.md-note b { color: var(--ink); }
.md-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 22px 36px; min-width: 0; }
.md-two > * { min-width: 0; }
.md-scroll { max-width: 100%; }
.md-tbl { margin-top: 12px; }
.md-table { margin-top: 14px; }
.md-table > summary { font-weight: 600; }
.md-sec .tm-info { margin-top: 12px; }

/* chart keys: a swatch and words */
.md-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--muted); margin: 0 0 8px; }
.md-key span { display: inline-flex; align-items: center; gap: 6px; }
.md-sw { display: inline-block; flex: none; width: 16px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.md-sw.line { background: var(--score); } .md-sw.model { background: var(--turn); } .md-sw.other { width: 10px; height: 10px; border-radius: 50%; }
.md-sw.dash { height: 0; border-top: 3px dashed var(--ink); background: transparent; }
.md-sw.dash.line { border-color: var(--score); } .md-sw.dash.model { border-color: var(--turn); }
.md-sw.wf0 { height: 8px; background: var(--ink); } .md-sw.wf { height: 8px; background: var(--line-strong); }
.md-sw.dm { width: 10px; height: 10px; border-radius: 1px; transform: rotate(45deg); background: var(--ink); }
.md-sw.ln { width: 3px; height: 14px; background: var(--muted); border-radius: 1px; }
.md-sw.b8 { width: 14px; height: 10px; background: var(--score-tint); } .md-sw.b5 { width: 14px; height: 10px; background: var(--score); opacity: 0.4; }
.md-sw.fn { width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--ink); box-sizing: border-box; }

/* ---------- the estimate card: one game, from the ratings to the score ---------- */
.ec-key { margin-bottom: 14px; }
.ec-grp + .ec-grp { margin-top: 22px; }
.ec-gh { font-family: var(--f-display); font-weight: 700; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px; }
.ec-gh span { font-family: var(--f-body); font-size: 0.82rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.ec-grid { display: grid; gap: 14px; }
.ec { display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "h wf" "f wf"; align-items: start; gap: 10px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px 12px; min-width: 0; }
.ec-h { grid-area: h; min-width: 0; }
.ec-th, .ec-t { display: grid; grid-template-columns: 24px minmax(0, 1fr) 40px; align-items: center; gap: 4px 9px; }
.ec-th { grid-template-columns: minmax(0, 1fr) 40px; font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.ec-th > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ec-h:has(.ec-fs) .ec-t { grid-template-columns: 24px minmax(0, 1fr) 40px 40px; }
.ec-h:has(.ec-fs) .ec-th { grid-template-columns: minmax(0, 1fr) 40px 40px; }
.ec-sch { text-align: right; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.ec-t { padding: 3px 0; }
.ec-t .logo img { display: block; }
.ec-tn { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.ec-tn b { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-rk { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ec-sc, .ec-fs { font-family: var(--f-display); font-weight: 700; font-size: 1.32rem; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.ec-fs { color: var(--muted); font-weight: 600; }
.ec-cap { margin: 6px 0 0; font-size: 0.85rem; color: var(--score); font-weight: 600; }
.ec-facts { grid-area: f; align-self: end; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0; padding-top: 8px; border-top: 1px solid var(--line); }
.ec-facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ec-facts dd { margin: 0; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.ec > .tm-more { grid-column: 1 / -1; margin-top: 0; }
.ec-wf { grid-area: wf; min-width: 0; }
.ec-r { display: grid; grid-template-columns: 128px 50px 50px minmax(0, 1fr) 128px; grid-template-areas: "k a h t m"; align-items: center; gap: 2px 10px; padding: 3px 0; font-size: 0.85rem; }
.ec-k { grid-area: k; line-height: 1.2; }
.ec-k small { display: block; font-size: 0.75rem; color: var(--muted); }
.ec-n { text-align: right; font-variant-numeric: tabular-nums; }
.ec-n.a { grid-area: a; } .ec-n.h { grid-area: h; }
.ec-n.ec-span2 { grid-area: a / a / h / h; grid-column: 2 / 4; font-size: 0.8rem; color: var(--muted); }
.ec-m { grid-area: m; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-band .ec-m { white-space: normal; font-size: 0.8rem; color: var(--muted); line-height: 1.25; }
.ec-p { color: var(--muted); font-size: 0.8rem; margin-left: 2px; }
.ec-r.zero { color: var(--muted); }
.ec-est { border-top: 1px solid var(--line-strong); margin-top: 3px; padding-top: 6px; }
.ec-ax { color: var(--muted); font-size: 0.75rem; padding-bottom: 2px; }
.ec-ax .ec-n { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-tr { grid-area: t; position: relative; display: block; height: 18px; min-width: 0; }
.ec-tr i { position: absolute; }
.ec-tr i.gl, .ec-tr i.z { top: 0; bottom: 0; width: 1px; background: var(--line); }
.ec-tr i.z { background: var(--line-strong); }
.ec-tr i.wf0 { top: 5px; height: 8px; border-radius: 2px; background: var(--ink); }
.ec-tr i.wf { top: 5px; height: 8px; border-radius: 2px; background: var(--line-strong); }
.ec-tr i.wfc { top: -6px; height: 11px; width: 0; border-left: 1px dashed var(--line-strong); }
.ec-tr i.wfz { top: 4px; height: 10px; width: 2px; margin-left: -1px; background: var(--line-strong); opacity: 0.6; }
.ec-tr i.dm { top: 3px; width: 12px; height: 12px; margin-left: -6px; box-sizing: border-box; transform: rotate(45deg); border-radius: 1px; background: var(--ink); border: 2px solid var(--surface); z-index: 2; }
.ec-tr i.dm.ghost { background: transparent; border: 1.5px solid var(--ink); opacity: 0.7; }
.ec-tr i.ln { top: 1px; width: 3px; height: 16px; margin-left: -1.5px; background: var(--muted); border-radius: 1px; }
.ec-tr i.b8 { top: 4px; height: 10px; background: var(--score-tint); border-radius: 2px; }
.ec-tr i.b5 { top: 3px; height: 12px; background: var(--score); opacity: 0.4; border-radius: 2px; }
.ec-tr i.fn { top: 3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--ink); box-sizing: border-box; z-index: 2; }
.ec-tk { height: 16px; }
.ec-tk span { position: absolute; top: 0; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.ec-tk em { position: absolute; top: 0; font-style: normal; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ec-tk em.l { left: 0; } .ec-tk em.r { right: 0; }
@media (max-width: 760px) {
  .ec { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "h" "wf" "f"; padding: 12px 14px; }
  .ec-r { grid-template-columns: minmax(0, 1fr) 54px 54px; grid-template-areas: "k a h" "t t t" "m m m"; gap: 1px 8px; padding: 4px 0; }
  .ec-r.ec-step .ec-m { display: none; }        /* a step's margin: the bar shows it, and the label its change */
  .ec-r.zero { grid-template-areas: "k a h"; } .ec-r.zero .ec-tr { display: none; } .ec-r.zero .ec-k small { display: inline; margin-left: 6px; }
  .ec-ax { grid-template-areas: "k a h" "t t t"; }
  .ec-ax .ec-k, .ec-ax .ec-m { display: none; }
  .ec-m { font-size: 0.82rem; }
}
@media (max-width: 640px) {
  .md-title { font-size: 2rem; }
  .md-tile-v { font-size: 2rem; }
  .md-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
}

/* ---------- shared: more key swatches, tables in a section ---------- */
.md-sw.bar { width: 12px; height: 12px; border-radius: 2px; }
.md-sw.line.other { background: var(--score); } .md-sw.model.bar { background: var(--turn); }
.md-gap { margin-top: 22px; }
.md-rk thead th.c-line { color: var(--score); } .md-rk thead th.c-model { color: var(--turn); }
.md-rk { max-width: none; }
.md-sec .rk-t thead th { background: var(--bg); }
.md-sec .rk-t td { font-size: 0.88rem; }

/* ---------- Accuracy: lines with their values printed, the share of the swing explained ---------- */
.md-two .acc-svg { margin-top: 4px; }
.acc-svg .ag-0 { stroke: var(--line-strong); }
.acc-svg .av { font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.acc-svg .av.c-line { fill: var(--score); } .acc-svg .av.c-model { fill: var(--turn); }
.acc-svg .ae.c-line { fill: var(--score); } .acc-svg .ae.c-model { fill: var(--turn); }
.acc-svg .at { font-size: 12px; }
.acc-svg.acc-sc { max-width: 760px; margin: 0; }
.acc-vgrp { margin: 14px 0 -2px; }
.acc-vrow { grid-template-columns: 170px minmax(0, 1fr) 200px; }
.acc-vbar { height: 24px; border-radius: 6px; }
.acc-vval b { color: var(--ink); }
@media (max-width: 640px) { .acc-vrow { grid-template-columns: 110px minmax(0, 1fr); } }

/* ---------- Model ranks: the rivalries, each game's units then its card ---------- */
.rv-h { margin-top: 22px; }
.rv-game { border-top: 0; margin-top: 18px; padding-top: 0; }
.rv-units { margin: 4px 0 12px; }
.rv-game .ec { margin-top: 4px; }
.pg-h { margin-top: 20px; }
.mr-card { padding: 0; }
/* the rank chart on a phone (Dec 1): this model's place by season on a track from best to worst, the full chart folded */
.md-sw.sel { background: var(--ink); }
.mr-ph { display: grid; gap: 2px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.mr-ph-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 70px; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.mr-ph-y { font-weight: 600; font-size: 0.9rem; line-height: 1.15; }
.mr-ph-y small, .mr-ph-v small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.mr-ph-v { text-align: right; font-size: 0.9rem; line-height: 1.15; }
.mr-ph-v b.o { color: var(--turn); } .mr-ph-v b.s { color: var(--ink); }
.mr-ph-tr { position: relative; height: 26px; }
.mr-ph-tr.two { height: 50px; }
.mr-ph-in { position: absolute; inset: 0 11px; }
.mr-ph-in::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; border-top: 1px solid var(--line-strong); }
.mr-ph-tr.two .mr-ph-in::before { top: 25px; }
.mr-ph-in b { position: absolute; top: 11px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--line-strong); }
.mr-ph-tr.two .mr-ph-in b { top: 23px; }
.mr-ph-d { position: absolute; top: 2px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 700 11px/1 var(--f-body); font-style: normal; color: var(--on-accent); background: var(--turn); z-index: 1; }
.mr-ph-d.s { top: 26px; background: var(--ink); color: var(--surface); }
.mr-ph-ax { border-bottom: 0; padding: 0; }
.mr-ph-ax .mr-ph-tr { height: auto; display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.mr-ph-ax .mr-ph-v { font-size: 0.75rem; color: var(--muted); }
.mr-full { margin: 4px 0 8px; }
.mr-full > summary { font-size: 0.9rem; padding: 6px 0; }
.mr-full[open] > summary { margin-bottom: 8px; }

/* ---------- Error analysis: the bars ---------- */
.er-svg { font-size: 12px; }
.er-svg .bm { fill: var(--turn); opacity: 0.9; }
