/* conkers — one stylesheet, no framework, no external font. */
:root {
  --bg: #f4efe6;
  --panel: #fffdf9;
  --ink: #2a1f16;
  --dim: #6a5a4a;
  --line: #ddd0be;
  --shell: #7a4a22;
  --shell2: #a9682f;
  --pale: #e7d6ba;
  --accent: #14683f;
  --accent2: #1f8c55;
  --warn: #9a3412;
  --good: #14683f;
  --shadow: 0 1px 2px rgba(42,31,22,.10), 0 6px 18px rgba(42,31,22,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #17130f;
  --panel: #1f1a15;
  --ink: #f0e7dc;
  --dim: #b0a091;
  --line: #3a2f26;
  --shell: #b1743c;
  --shell2: #d29553;
  --pale: #6a543a;
  --accent: #4fd18b;
  --accent2: #7ee3ae;
  --warn: #f59e6b;
  --good: #4fd18b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}
header.top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  justify-content: space-between;
  padding: 18px 20px 10px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), transparent);
}
/* A flex item sizes to its max-content unless told otherwise, and the 60ch
   strapline below made .brand 510 px wide inside a 390 px viewport.  Both
   offline harnesses passed that; the browser measured it. */
.brand { flex: 1 1 260px; min-width: 0; }
.brand h1 {
  margin: 0; font-size: 26px; letter-spacing: -0.01em; font-weight: 700;
  overflow-wrap: break-word;
}
/* .strap, NOT .tag.  The provenance pill below also claims .tag and sets
   white-space: nowrap on it, which silently stopped the strapline wrapping and
   pushed the document 225 px wider than a phone.  Two unrelated meanings for one
   class name is the oldest bug in this file's family. */
.brand .strap { margin: 3px 0 0; color: var(--dim); font-size: 13.5px;
  max-width: min(60ch, 100%); overflow-wrap: break-word; }
.topright { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  min-width: 0; max-width: 100%; }
nav.tabs { min-width: 0; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab, button, select, input[type="number"], input[type="range"] {
  font: inherit; color: inherit;
}
.tab {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 11px; cursor: pointer; color: var(--dim); font-size: 13.5px;
}
.tab:hover { background: var(--panel); border-color: var(--line); color: var(--ink); }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
[data-theme="dark"] .tab.on { color: #10231a; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 13px; cursor: pointer; box-shadow: var(--shadow);
}
button:hover { border-color: var(--shell); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
[data-theme="dark"] button.primary { color: #10231a; }
button.ghost { background: transparent; box-shadow: none; }
main { padding: 16px 20px 60px; max-width: 1180px; margin: 0 auto; }
.panel[hidden] { display: none !important; }
section.panel { display: block; min-width: 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin: 0 0 14px; box-shadow: var(--shadow);
  min-width: 0; overflow-wrap: break-word;
}
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card h3 { margin: 14px 0 6px; font-size: 14.5px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em; }
.card p { margin: 0 0 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 12px; }
.ctrlgroup { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lab { font-size: 12.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
input[type="number"], select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 8px; width: 7.5em;
}
select { width: auto; }
input[type="range"] { width: 170px; accent-color: var(--accent); }
/* A canvas with no CSS width falls back to its 300 px attribute default and
   never fills its card.  Both offline harnesses passed that; the browser did not. */
canvas { display: block; width: 100%; max-width: 100%; border-radius: 10px;
  background: var(--panel); }
.arena { border: 1px solid var(--line); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tablewrap { overflow-x: auto; }
th, td { text-align: left; padding: 5px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.tag {
  display: inline-block; font-size: 10.5px; letter-spacing: .05em; padding: 1px 6px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap;
}
.tag.DOCUMENTED { border-color: var(--good); color: var(--good); }
.tag.MEASURED, .tag.DERIVED { border-color: var(--shell); color: var(--shell); }
.tag.UNSOURCED { border-color: var(--warn); color: var(--warn); }
.tag.RECONSTRUCTED, .tag.CALIBRATED, .tag.QUALIFIED { border-color: var(--dim); color: var(--dim); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.stat .k { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 19px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat .u { font-size: 11.5px; color: var(--dim); }
.log { font-family: var(--mono); font-size: 12px; max-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--bg); }
.log div { padding: 1px 0; border-bottom: 1px dotted var(--line); }
.log div:last-child { border-bottom: 0; }
.log .win { color: var(--good); font-weight: 600; }
.log .lose { color: var(--warn); font-weight: 600; }
.note { color: var(--dim); font-size: 13px; }
.callout { border-left: 3px solid var(--shell); padding: 8px 12px; background: var(--bg);
  border-radius: 0 9px 9px 0; margin: 10px 0; }
.callout.big { border-left-color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.eq { font-family: var(--mono); font-size: 13.5px; background: var(--bg); padding: 7px 10px;
  border-radius: 8px; border: 1px solid var(--line); display: block; margin: 8px 0;
  overflow-x: auto; white-space: pre; }
footer { padding: 18px 20px 40px; color: var(--dim); font-size: 13px;
  border-top: 1px solid var(--line); max-width: 1180px; margin: 0 auto; }
footer a, .card a { color: var(--accent); }
ol.rules { padding-left: 1.3em; margin: 6px 0; }
ol.rules li { margin-bottom: 7px; }
.scoreline { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.who { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.dot.a { background: var(--shell); }
.dot.b { background: var(--accent); }
@media (max-width: 620px) {
  header.top { padding: 12px 12px 8px; }
  main { padding: 12px 12px 48px; }
  .brand .strap { font-size: 12.5px; }
  .brand h1 { font-size: 21px; }
  input[type="range"] { width: 130px; }
}
