/* Season Tally - classic spreadsheet chrome: white cells on hairline grey rules, grey letter and number gutters, a
 * two-pixel blue selected cell over a lighter range, a formula bar under a slim toolbar, tabular monospace numerals in
 * number cells and a humanist sans everywhere else. Green and red are reserved for pass marks. */
:root, :root[data-theme="light"] {
  --bg: #eef0f3; --paper: #ffffff; --cell: #ffffff; --line: #e1e4e8; --line-strong: #c9ced6;
  --gutter: #f3f4f6; --gutter-ink: #6a717c; --gutter-on: #dde7fb; --ink: #1d2126; --muted: #67707b; --soft: #8a929c;
  --sel: #1a6fe8; --range: rgba(26, 111, 232, 0.09); --heat: #3c78e0; --hl: #fff6d6;
  --pass: #17703a; --pass-bg: #e5f4ea; --fail: #b42318; --fail-bg: #fdeceb;
  --flag: #6b46c1; --sugg: #3d4f86; --warn: #8a5a00; --warn-bg: #fff4dc;
  --shadow: rgba(16, 24, 40, 0.18); --btn: #ffffff; --btn-hover: #f1f3f6; --primary: #1a6fe8; --primary-ink: #ffffff;
  --sans: "Segoe UI", "Gill Sans", "Gill Sans MT", Seravek, "Avenir Next", Calibri, "Trebuchet MS", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111316; --paper: #1a1d21; --cell: #1a1d21; --line: #2b3036; --line-strong: #3b424a;
  --gutter: #22262b; --gutter-ink: #9aa3ad; --gutter-on: #24365a; --ink: #e5e8ec; --muted: #a2abb5; --soft: #7d8690;
  --sel: #7fb0ff; --range: rgba(127, 176, 255, 0.13); --heat: #4f86ea; --hl: #3a3420;
  --pass: #7fd39a; --pass-bg: #19331f; --fail: #ff9a8f; --fail-bg: #3a1c1a;
  --flag: #b79cff; --sugg: #a9bdf5; --warn: #f2c46b; --warn-bg: #342a14;
  --shadow: rgba(0, 0, 0, 0.5); --btn: #23272c; --btn-hover: #2c3137; --primary: #4d8ef0; --primary-ink: #0d1117;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { --bg: #111316; --paper: #1a1d21; --cell: #1a1d21; --line: #2b3036; --gutter: #22262b; --ink: #e5e8ec; --muted: #a2abb5; color-scheme: dark; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.none { color: var(--soft); list-style: none; font-style: italic; }

/* --- Top bar, toolbar, formula bar ----------------------------------------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 16px; background: var(--paper); border-bottom: 1px solid var(--line); min-height: 46px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.backlink { color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap; }
.backlink:hover { color: var(--ink); }
.logo { display: inline-flex; }
.lg-frame { fill: var(--cell); stroke: var(--line-strong); stroke-width: 1.2; }
.lg-line { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.lg-sel { fill: var(--range); stroke: var(--sel); stroke-width: 1.6; }
.appname { font-size: 15px; white-space: nowrap; letter-spacing: 0.01em; }
.titlefield { flex: 1; min-width: 0; max-width: 520px; }
.titlefield input { width: 100%; border: 1px solid transparent; background: transparent; padding: 4px 8px; border-radius: 4px; font-size: 15px; }
.titlefield input:hover { border-color: var(--line); }
.titlefield input:focus { outline: none; border-color: var(--sel); background: var(--cell); }
.topactions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.credits { font-size: 12.5px; color: var(--muted); }
.topup { font-size: 13px; }

.tb { border: 1px solid var(--line); background: var(--btn); border-radius: 4px; padding: 3px 9px; font-size: 13px; line-height: 20px; cursor: pointer; white-space: nowrap; }
.tb:hover { background: var(--btn-hover); }
.tb[aria-pressed="true"] { background: var(--gutter-on); border-color: var(--sel); }
.tb.icon { width: 30px; padding: 3px 0; }
.tb.strong { font-weight: 600; }
.tb:disabled { opacity: 0.5; cursor: default; }
.linkbtn { border: none; background: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; }
.primary { border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); border-radius: 5px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: 0.45; cursor: default; }

.toolbar { display: flex; align-items: center; gap: 5px; padding: 5px 16px; background: var(--paper); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tsel select { border: 1px solid var(--line); background: var(--btn); border-radius: 4px; padding: 3px 6px; font-size: 13px; }
.tsep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; flex: none; }

.fxbar { display: flex; align-items: center; gap: 0; background: var(--paper); border-bottom: 1px solid var(--line-strong); height: 32px; padding: 0 16px; }
.namebox { width: 92px; flex: none; font-size: 12.5px; padding: 0 8px; border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; color: var(--muted); }
.fx { font-style: italic; font-family: Georgia, "Times New Roman", serif; color: var(--soft); padding: 0 10px; border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; }
#fxInput { flex: 1; min-width: 0; height: 100%; border: none; background: transparent; padding: 0 10px; font-family: var(--mono); font-size: 13px; }
#fxInput:focus { outline: none; background: var(--cell); box-shadow: inset 0 -2px 0 var(--sel); }
#fxInput.isrule { color: var(--sugg); }
.fxhint { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); padding-left: 10px; }

/* --- Workspace ---------------------------------------------------------------------------------------------------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 0; align-items: start; }
.gridwrap { min-width: 0; padding: 0; }
.frame { position: relative; overflow: auto; height: calc(100vh - 128px); min-height: 420px; background: var(--paper); border-right: 1px solid var(--line); outline: none; overscroll-behavior: contain; }
.frame:focus-visible { box-shadow: inset 0 0 0 1px var(--sel); }
.frame.drop { box-shadow: inset 0 0 0 3px var(--sel); }
.gridnote { margin: 0; padding: 5px 16px; font-size: 12px; color: var(--muted); background: var(--gutter); border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.gridnote.warn { color: var(--warn); background: var(--warn-bg); }

.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; user-select: none; -webkit-user-select: none; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 27px; padding: 0 7px; white-space: nowrap; }
.grid td { background: var(--cell); max-width: 240px; overflow: hidden; text-overflow: ellipsis; position: relative; cursor: cell; }
.grid thead th { background: var(--gutter); color: var(--gutter-ink); font-weight: 500; position: sticky; z-index: 3; }
.grid tr.letters th { top: 0; height: 22px; font-size: 11.5px; text-align: center; font-family: var(--mono); }
.grid tr.names th { top: 22px; text-align: left; color: var(--ink); font-weight: 600; background: var(--gutter); border-bottom: 1px solid var(--line-strong); }
.grid th.corner { left: 0; z-index: 5; width: 44px; min-width: 44px; }
.grid th.rownum { position: sticky; left: 0; z-index: 2; background: var(--gutter); color: var(--gutter-ink); text-align: center; font-family: var(--mono); font-size: 11.5px; font-weight: 400; width: 44px; min-width: 44px; cursor: default; }
.grid .frz { position: sticky; left: 44px; z-index: 1; }
.grid td.frz { font-weight: 600; min-width: 132px; }
.grid thead th.frz { z-index: 4; }
.frame.sx .grid .frz { box-shadow: 3px 0 5px -3px var(--shadow); }
.frame.sx .grid th.rownum { box-shadow: none; }
.frame.sy .grid tr.names th { box-shadow: 0 3px 5px -3px var(--shadow); }
.grid th.on-col, .grid th.on-row { background: var(--gutter-on); color: var(--sel); }
.grid tr.names th.on-col { color: var(--ink); }
.cname { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sortbtn { border: none; background: transparent; color: var(--soft); cursor: pointer; font-size: 11px; padding: 0 2px 0 5px; vertical-align: middle; }
.sortbtn.on { color: var(--sel); }
.fxmark { font-style: italic; font-family: Georgia, serif; color: var(--soft); font-size: 12px; margin-left: 3px; font-weight: 400; }
.grid tr.names th.k-calc { background: color-mix(in srgb, var(--gutter) 80%, var(--sel) 6%); }

.grid td.numc { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.grid td.k-calc { color: color-mix(in srgb, var(--ink) 88%, var(--sel)); }
.grid td.pass { color: var(--pass); background: var(--pass-bg); }
.grid td.fail { color: var(--fail); background: var(--fail-bg); }
.grid td.err { color: var(--soft); font-style: italic; font-size: 11.5px; }
.grid td.bad { text-decoration: underline dotted var(--fail); text-underline-offset: 3px; text-align: left; }
.grid td.sel { box-shadow: inset 0 0 0 2px var(--sel); z-index: 1; }
.grid td.frz.sel { z-index: 2; }
.grid td.inrange { background-image: linear-gradient(var(--range), var(--range)); }
.grid td.colhl, .grid td.rowhl { background-image: linear-gradient(color-mix(in srgb, var(--hl) 70%, transparent), color-mix(in srgb, var(--hl) 70%, transparent)); }
.grid td.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--sel); }
.celledit { width: 100%; min-width: 80px; height: 25px; border: none; outline: none; background: var(--cell); padding: 0 7px; font: inherit; }
.grid td.numc .celledit { text-align: right; font-family: var(--mono); }
.flag { position: absolute; top: 1px; left: 2px; font-size: 8px; line-height: 1; color: var(--flag); font-family: var(--sans); }
.flag.k-check { font-weight: 700; font-size: 9px; }
.grid td.flagged { box-shadow: inset 2px 0 0 var(--flag); }
.grid td.flagged.sel { box-shadow: inset 0 0 0 2px var(--sel); }

.grid td.notec { min-width: 300px; max-width: 460px; white-space: nowrap; text-align: left; font-family: var(--sans); }
.sugg { color: var(--sugg); font-style: italic; border-bottom: 1px dashed color-mix(in srgb, var(--sugg) 60%, transparent); }
.sugg.stale { opacity: 0.45; }
.sugg.badcite { text-decoration: underline wavy var(--fail); text-underline-offset: 3px; border-bottom: none; }
.mini { border: 1px solid var(--line); background: var(--btn); border-radius: 3px; font-size: 11px; line-height: 16px; padding: 0 5px; margin-left: 4px; cursor: pointer; }
.mini.acc { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, var(--line)); }
.mini.dis { color: var(--muted); }
.notewrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.notewrap .sugg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notewrap .mini { margin-left: 0; flex: none; }
.cnote .notewrap .sugg { white-space: normal; }
.nocomment { color: var(--soft); font-style: italic; font-size: 12px; }
.awardbadge { display: inline-block; border: 1px solid color-mix(in srgb, var(--flag) 50%, var(--line)); color: var(--flag); border-radius: 10px; padding: 0 7px; font-size: 11.5px; margin-right: 4px; line-height: 18px; background: color-mix(in srgb, var(--flag) 8%, var(--cell)); }
.grid tfoot td, .grid tfoot th { background: var(--gutter); color: var(--muted); font-size: 12px; height: 24px; }
.grid tfoot tr.sum:first-child td, .grid tfoot tr.sum:first-child th { border-top: 1px solid var(--line-strong); }
.grid tfoot td.frz { font-weight: 500; font-style: italic; }

/* --- Cards (phone-friendly view) ------------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 12px; }
.card { background: var(--cell); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.chead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.cnum { color: var(--gutter-ink); font-size: 11px; background: var(--gutter); border-radius: 3px; padding: 0 5px; }
.cstats { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 0; font-size: 12.5px; }
.cstats dt { color: var(--muted); }
.cstats dd { margin: 0; text-align: right; }
.cstats dd.pass { color: var(--pass); } .cstats dd.fail { color: var(--fail); } .cstats dd.err { color: var(--soft); font-style: italic; }
.cnote { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; white-space: normal; }

/* --- Side panel -------------------------------------------------------------------------------------------------- */
.side { background: var(--paper); height: calc(100vh - 128px + 27px); min-height: 447px; overflow-y: auto; padding: 0 0 16px; }
.lanes { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 2; }
.lane { flex: 1; border: none; background: none; padding: 9px 6px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.lane.active { color: var(--ink); border-bottom-color: var(--sel); font-weight: 600; }
.badge { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--gutter); color: var(--muted); font-size: 11px; }
.runbox { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.lanenote { margin: 0; font-size: 13px; color: var(--muted); }
.meter { margin: 0; font-size: 12px; color: var(--muted); }
.notice { margin: 0; color: var(--muted); }
.gate { margin: 0; background: var(--warn-bg); color: var(--warn); padding: 6px 8px; border-radius: 4px; }
.gateaction { font-weight: 600; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.awardeditor { display: grid; gap: 6px; }
.aehead { display: flex; justify-content: space-between; align-items: center; }
.awardlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.awitem { display: grid; grid-template-columns: 1fr auto; gap: 4px; }
.awitem .aw-hint { grid-column: 1 / -1; font-size: 12.5px; }
.awitem .aw-del { grid-row: 1; grid-column: 2; }
.awitem input { border: 1px solid var(--line); border-radius: 4px; padding: 4px 7px; background: var(--cell); min-width: 0; }
.progress { border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; background: var(--gutter); }
.phead { display: flex; justify-content: space-between; gap: 8px; }
.steps { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--soft); }
.step.done { color: var(--muted); } .step.active { color: var(--ink); font-weight: 600; }
.step-ic { display: inline-block; width: 14px; text-align: center; }
.pane { padding: 12px 16px; }
.pane h3, .colpanel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
.empty { color: var(--muted); font-size: 13px; background: var(--gutter); border-radius: 5px; padding: 10px 12px; }
.headline { font-size: 15px; margin: 0 0 8px; }
.acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recon, .anoms, .checks, .cites { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.rc.ok .rcic, .cite.ok .rcic { color: var(--pass); } .rc.bad .rcic, .cite.bad .rcic { color: var(--fail); } .rc.warn .rcic { color: var(--warn); }
.rcic { display: inline-block; width: 14px; font-weight: 700; }
.cite.bad { color: var(--fail); }
.rowdetail { margin-top: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; background: var(--cell); }
.rowdetail:empty { display: none; }
.rowdetail h3 { margin: 0 0 4px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); }
.rdnote { margin: 0 0 6px; }
.rdline { margin: 0 0 4px; font-size: 13px; }
.anom, .chk { padding: 5px 7px; border-radius: 4px; background: var(--gutter); cursor: pointer; }
.anom:hover, .chk:hover { background: var(--gutter-on); }
.akind { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--flag); margin-right: 6px; }
.acol { margin-right: 4px; } .arows { color: var(--muted); } .abad { color: var(--fail); }
.nexts { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
.awardcards { display: grid; gap: 10px; margin-top: 8px; }
.acard { border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; background: var(--cell); }
.achead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.runner { color: var(--muted); font-size: 12.5px; }
.acase { margin: 0 0 6px; } .acounter, .averdict { margin: 0 0 5px; font-size: 13px; }
.ref { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; margin: 0; }
.ref dt { font-family: var(--mono); color: var(--sugg); } .ref dd { margin: 0; color: var(--muted); }
.colpanel { padding: 4px 16px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.coleditor { display: grid; gap: 7px; }
.cf { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.cf span { color: var(--muted); }
.cf input, .cf select { border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; background: var(--cell); min-width: 0; }
.cf.check { display: flex; }
.weights { border: 1px dashed var(--line); border-radius: 5px; padding: 6px 8px; display: grid; gap: 5px; }
.weights p { margin: 0; }
.rawbox { padding: 0 16px; } .raw { white-space: pre-wrap; font-size: 12px; background: var(--gutter); padding: 8px; border-radius: 4px; max-height: 300px; overflow: auto; }
#how { padding: 0 16px; }

/* --- History, footer, dialog, toasts ------------------------------------------------------------------------------ */
.history { padding: 18px 16px 6px; max-width: 1100px; }
.hhead { display: flex; align-items: baseline; gap: 12px; }
.hhead h2 { font-size: 16px; margin: 0; }
.hlist { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.hbtn { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 5px; padding: 8px 10px; cursor: pointer; display: grid; gap: 2px; }
.hbtn:hover { border-color: var(--sel); }
.hmeta { font-size: 11.5px; color: var(--muted); }
.foot { padding: 12px 16px 28px; color: var(--muted); font-size: 12.5px; max-width: 1100px; }
.dialog { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink); width: min(680px, calc(100vw - 32px)); padding: 16px 18px; }
.dialog::backdrop { background: rgba(10, 14, 20, 0.45); }
.dialog h2 { margin: 0 0 6px; font-size: 17px; }
.dialog textarea { width: 100%; font-family: var(--mono); font-size: 12.5px; border: 1px solid var(--line); border-radius: 5px; padding: 8px; background: var(--cell); resize: vertical; }
.dacts { display: flex; gap: 8px; align-items: center; margin-top: 10px; } .grow { flex: 1; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; font-size: 13px; box-shadow: 0 4px 14px var(--shadow); transition: opacity 0.5s; }
.toast.err { background: var(--fail); color: #fff; }
.toast.gone { opacity: 0; }
.toast a { color: inherit; font-weight: 700; }
.printreport { display: none; }

/* --- Narrow screens: the grid scrolls both ways inside its own frame, never the page ------------------------------- */
@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .frame { height: 62vh; min-height: 320px; border-right: none; }
  .gridnote { border-right: none; }
  .side { height: auto; min-height: 0; overflow: visible; border-top: 1px solid var(--line-strong); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 6px 16px; }
  .brand { flex-wrap: wrap; }
  .titlefield { flex-basis: 100%; max-width: none; order: 5; }
  .backlink { font-size: 12px; }
  .toolbar { padding: 5px 16px; }
  .fxbar { padding: 0 0 0 16px; }
  .namebox { width: 64px; }
  .fxhint { display: none; }
  .grid td.frz { min-width: 104px; max-width: 120px; }
  .grid td.notec { min-width: 240px; }
  .cf { grid-template-columns: 84px 1fr; }
}

/* --- Print: one page per player ----------------------------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  body > *:not(.printreport) { display: none !important; }
  .printreport { display: block; }
  .ppage { page-break-after: always; break-after: page; padding: 8mm 4mm; font-family: var(--sans); }
  .ppage:last-child { page-break-after: auto; break-after: auto; }
  .pteam { color: #555; font-size: 11pt; margin: 0; }
  .ppage h1 { font-size: 22pt; margin: 2mm 0 4mm; }
  .ppage h2 { font-size: 12pt; margin: 6mm 0 2mm; text-transform: uppercase; letter-spacing: 0.06em; color: #444; }
  .ptable { border-collapse: collapse; width: 100%; font-size: 10.5pt; }
  .ptable th, .ptable td { border: 0.5pt solid #bbb; padding: 1.5mm 2.5mm; text-align: left; }
  .ptable td.num { text-align: right; font-family: var(--mono); }
  .ptable td.pass { color: #17703a; } .ptable td.fail { color: #b42318; }
  .pnote { font-size: 12pt; line-height: 1.5; }
  .awardbadge { border: 0.5pt solid #555; color: #000; background: none; }
}

/* --- Docs pages (api.html, tokens.html) ---------------------------------------------------------------------------- */
.mono, code, pre { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sep { color: var(--line-strong); }
.doc { max-width: 940px; margin: 0 auto; padding: 24px 16px; }
.doc h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 12px; letter-spacing: -0.01em; }
.doc h2 { margin: 30px 0 8px; border-bottom: 1px solid var(--line-strong); padding-bottom: 4px; font-size: 19px; }
.doc h3 { margin-top: 20px; font-size: 15px; }
.doc pre { background: var(--paper); border: 1px solid var(--line); border-radius: 0 4px 4px 4px; padding: 12px; overflow-x: auto; font-size: 12px; line-height: 1.5; margin: 0 0 8px; max-width: 100%; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13px; display: block; overflow-x: auto; background: var(--paper); }
.doc th, .doc td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.doc th { background: var(--gutter); }
.doc code { font-size: 12px; background: var(--gutter); padding: 0 3px; border-radius: 3px; }
.doc pre code { background: none; padding: 0; }
.codegroup { margin: 8px 0 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; }
.tab { background: var(--gutter); border: 1px solid var(--line); border-bottom: 0; margin-right: -1px; padding: 3px 11px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tab:first-child { border-radius: 4px 0 0 0; } .tab:last-child { border-radius: 0 4px 0 0; }
.tab.active { background: var(--paper); color: var(--sel); font-weight: 600; box-shadow: inset 0 2px 0 var(--sel); }
.statebox { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.statebox p { margin: 4px 0; }
.tokenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.tokenbox { font: 12px var(--mono); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; word-break: break-all; flex: 1; }
.doc .mini { font-size: 12.5px; padding: 3px 9px; line-height: 18px; margin: 0; }
