/* The Aeronautics live-stats pages (build_live.py). Colours come from the
   shared theme tokens (WPerls/Kit public/, served by the edge at /theme/);
   the two series colours are the validated dataviz pair the Endventure
   report uses (report_template.html), light set under clean-light, dark set
   otherwise -- retro counts as dark. Prefixed --lv- so none
   shadows or is shadowed by a Kit token (an --accent here lost to retro's). */
:root {
  --lv-accent: #3987e5;
  --lv-on: #199e70;
  --lv-warn: #d03b3b;
  --lv-food: #c98500;
  --lv-track: #2c2c2a;
}
:root[data-theme="clean"] {
  --lv-accent: #2a78d6;
  --lv-on: #1baf7a;
  --lv-food: #eda100;
  --lv-track: #e1e0d9;
}
:root[data-theme="clean"][data-scheme="dark"] {
  --lv-accent: #3987e5; --lv-on: #199e70; --lv-food: #c98500; --lv-track: #2c2c2a;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="clean"]:not([data-scheme="light"]) {
    --lv-accent: #3987e5; --lv-on: #199e70; --lv-food: #c98500; --lv-track: #2c2c2a;
  }
}

@font-face {
  font-family: "Comic Relief"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/comic-relief-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Comic Relief"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/comic-relief-latin-700-normal.woff2") format("woff2");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-body);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--lv-accent); }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 17px; margin-bottom: 10px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }
.note { color: var(--text-faint); font-size: 13px; margin: -6px 0 10px; }
code { font-size: 12px; background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; }

header.top { border-bottom: 1px solid var(--border); background: var(--surface); }
header.top .wrap { padding-top: 32px; padding-bottom: 24px; }
.back { display: inline-block; font-size: 14px; margin-bottom: 12px; }
.eyebrow { font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin-bottom: 8px; }
.sub { color: var(--text-muted); margin: 8px 0 0; max-width: 64ch; }
.status { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px;
  font-weight: 600; background: var(--surface-alt); color: var(--text-muted); }
.pill.up { background: var(--lv-on); color: #fff; }
.pill.down { background: var(--lv-warn); color: #fff; }
.pill-note { font-size: 13px; color: var(--text-faint); }

main { padding-top: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow-1); min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px;
  margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.card .kpi { background: var(--surface-alt); border: 0; }
.card .kpis { margin-bottom: 0; }
.kpi-v { font-size: 24px; font-weight: 600; line-height: 1.15; }
.kpi-l { font-size: 13px; color: var(--text-muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.player-card { display: block; text-decoration: none; color: inherit; margin: 0;
  background: var(--surface-alt); box-shadow: none; }
.player-card:hover, .player-card:focus-visible { border-color: var(--lv-accent); }
.pc-name { font-weight: 700; font-size: 17px; color: var(--lv-accent); }
.pc-row { font-size: 14px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.meter { display: inline-block; width: 80px; height: 8px; background: var(--lv-track);
  border-radius: 4px; overflow: hidden; vertical-align: middle; }
.meter-fill { display: block; height: 100%; }
.meter-fill.hp { background: var(--lv-warn); }
.meter-fill.food { background: var(--lv-food); }
.now { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 18px; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.barlist { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.barlist li { display: grid; grid-template-columns: minmax(0, 11em) 1fr auto; gap: 10px;
  align-items: center; padding: 3px 0; }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 10px; background: var(--lv-track); border-radius: 3px; overflow: hidden; }
.bl-bar { display: block; height: 100%; background: var(--lv-accent); }
.bl-val { font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 4.5em; text-align: right; }

.columns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  height: 170px; align-items: end; }
.col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; font-size: 12px; }
.col-v { color: var(--text-muted); }
.col-bar { align-self: end; background: var(--lv-accent); border-radius: 4px 4px 0 0; min-height: 1px; }
.col-l { color: var(--text-muted); padding-top: 4px; border-top: 1px solid var(--border); }

.presence { font-size: 13px; }
.ps-row { display: grid; grid-template-columns: 8.5em 1fr; gap: 8px; align-items: center; margin: 3px 0; }
.ps-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-cells { display: grid; grid-template-columns: repeat(96, 1fr); gap: 1px; height: 16px; }
.ps-cells i, .ps-legend i { display: block; background: var(--lv-track); border-radius: 1px; }
.ps-cells i.on, .ps-legend i.on { background: var(--lv-on); }
.ps-cells i.down, .ps-legend i.down { background: repeating-linear-gradient(45deg, var(--lv-warn) 0 2px, transparent 2px 4px); opacity: .6; }
.ps-cells i.none, .ps-legend i.none { background: transparent; outline: 1px dashed var(--border); outline-offset: -1px; }
.ps-axis { position: relative; height: 16px; color: var(--text-faint); font-size: 11px; }
.ps-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ps-axis span:first-child { transform: none; }
.ps-axis span:last-child { transform: translateX(-100%); }
.ps-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 10px;
  font-size: 12px; color: var(--text-muted); }
.ps-legend i { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 4px; }
@media (max-width: 600px) { .ps-row { grid-template-columns: 5.5em 1fr; } .ps-cells { gap: 0; } }

.adv { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.adv li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0;
  border-bottom: 1px solid var(--border); }
.adv li:last-child { border-bottom: 0; }
.adv li span:last-child { white-space: nowrap; font-size: 12px; }

footer { border-top: 1px solid var(--border); margin-top: 30px; padding: 22px 0 40px;
  color: var(--text-faint); font-size: 12.5px; }
.appearance-mount { margin-top: 16px; }

/* Retro: chrome only -- square corners and ridge borders, as the Endventure report. */
:root:not([data-theme="clean"]) .card,
:root:not([data-theme="clean"]) .kpi,
:root:not([data-theme="clean"]) .pill,
:root:not([data-theme="clean"]) code { border-radius: 0; }
:root:not([data-theme="clean"]) .card { border-width: 3px; border-style: ridge; }
:root:not([data-theme="clean"]) header.top { border-bottom-width: 3px; border-bottom-style: ridge; }

/* Tabs: Stats for everyone, Admin for a signed-in admin (admin.js). */
nav.tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
nav.tabs .wrap { display: flex; gap: 4px; }
nav.tabs a, nav.subtabs a { padding: 10px 14px; font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--text-muted); border-bottom: 3px solid transparent; }
nav.tabs a[aria-current="page"], nav.subtabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--lv-accent); }
nav.tabs a:hover, nav.subtabs a:hover { color: var(--text); }
nav.subtabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
[hidden] { display: none !important; }

/* Admin > Player Data. Series colours are the validated categorical palette
   (dataviz skill references/palette.md), light set under clean-light, dark
   set otherwise -- retro counts as dark, as the two above. */
:root {
  --pd-1: #3987e5; --pd-2: #d95926; --pd-3: #199e70; --pd-4: #c98500;
  --pd-5: #d55181; --pd-6: #008300; --pd-7: #9085e9; --pd-8: #e66767;
}
:root[data-theme="clean"] {
  --pd-1: #2a78d6; --pd-2: #eb6834; --pd-3: #1baf7a; --pd-4: #eda100;
  --pd-5: #e87ba4; --pd-6: #008300; --pd-7: #4a3aa7; --pd-8: #e34948;
}
:root[data-theme="clean"][data-scheme="dark"] {
  --pd-1: #3987e5; --pd-2: #d95926; --pd-3: #199e70; --pd-4: #c98500;
  --pd-5: #d55181; --pd-6: #008300; --pd-7: #9085e9; --pd-8: #e66767;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="clean"]:not([data-scheme="light"]) {
    --pd-1: #3987e5; --pd-2: #d95926; --pd-3: #199e70; --pd-4: #c98500;
    --pd-5: #d55181; --pd-6: #008300; --pd-7: #9085e9; --pd-8: #e66767;
  }
}
.pd-c0 { background: var(--pd-1); } .pd-c1 { background: var(--pd-2); } .pd-c2 { background: var(--pd-3); }
.pd-c3 { background: var(--pd-4); } .pd-c4 { background: var(--pd-5); } .pd-c5 { background: var(--pd-6); }
.pd-c6 { background: var(--pd-7); } .pd-c7 { background: var(--pd-8); }
.pd-s0 { stroke: var(--pd-1); } .pd-s1 { stroke: var(--pd-2); } .pd-s2 { stroke: var(--pd-3); }
.pd-s3 { stroke: var(--pd-4); } .pd-s4 { stroke: var(--pd-5); } .pd-s5 { stroke: var(--pd-6); }
.pd-s6 { stroke: var(--pd-7); } .pd-s7 { stroke: var(--pd-8); }
.pd-f0 { fill: var(--pd-1); } .pd-f1 { fill: var(--pd-2); } .pd-f2 { fill: var(--pd-3); }
.pd-f3 { fill: var(--pd-4); } .pd-f4 { fill: var(--pd-5); } .pd-f5 { fill: var(--pd-6); }
.pd-f6 { fill: var(--pd-7); } .pd-f7 { fill: var(--pd-8); }
.pd-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

.pd-updated { margin: 0 0 14px; }
.pd-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 0 18px; }
.pd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pd-head h2 { margin: 0; flex: 1; }
.pd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 18px;
  font-size: 14px; margin-bottom: 12px; }
.pd-inv-label { font-size: 12px; color: var(--text-faint); margin: 8px 0 4px; }
.pd-grid, .pd-gear { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; margin-bottom: 3px; }
.pd-gap { display: block; }
.pd-slot { position: relative; aspect-ratio: 1; background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px; overflow: hidden; font-size: 9.5px; line-height: 1.15; }
.pd-slot.empty { opacity: .45; }
.pd-slot.sel { outline: 2px solid var(--lv-accent); outline-offset: -1px; }
.pd-item { display: block; word-break: break-word; hyphens: auto; }
.pd-count { position: absolute; right: 3px; bottom: 1px; font-weight: 700; font-size: 11px; }
.pd-ench { position: absolute; left: 3px; bottom: 1px; color: var(--pd-7); }
.pd-inv details { margin-top: 8px; font-size: 13px; }
.pd-inv summary { cursor: pointer; color: var(--text-muted); margin-bottom: 4px; }
#pd-body section.card > details, #pd-body section.card > div > details { margin-top: 8px; }
#pd-body section.card details > summary { cursor: pointer; color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.pd-wrap { white-space: normal; }
.pd-tag { color: var(--text-muted); white-space: nowrap; }
.pd-flag { font-weight: 700; color: var(--lv-warn); white-space: nowrap; }

.pd-maptools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 10px; }
.pd-dims { display: flex; gap: 4px; }
.pd-dims button { font: inherit; font-size: 13px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-muted); }
.pd-dims button[aria-pressed="true"] { background: var(--lv-accent); border-color: var(--lv-accent); color: #fff; }
.pd-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-muted); }
.pd-svg { display: block; width: 100%; height: auto; background: var(--surface-alt); border-radius: 8px; }
.pd-gridline { stroke: var(--border); stroke-width: 1; }
.pd-chart { display: block; width: 100%; height: auto; margin: 8px 0 12px; }
.pd-axis { fill: var(--text-faint); font-size: 13px; }
.pd-path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pd-dot { stroke: var(--surface-alt); stroke-width: 2; }
.pd-hit { fill: transparent; }
.pd-end:focus { outline: none; }
.pd-end:focus .pd-dot, .pd-end:hover .pd-dot { stroke: var(--text); }
.pd-label { fill: var(--text); font-size: 15px; font-weight: 600; paint-order: stroke;
  stroke: var(--surface-alt); stroke-width: 4px; }
.pd-readout { font-size: 12px; color: var(--text-faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.pd-table th, .pd-table td { text-align: left; }
td.pd-left { white-space: normal; }
:root:not([data-theme="clean"]) .pd-slot,
:root:not([data-theme="clean"]) .pd-svg,
:root:not([data-theme="clean"]) .pd-dims button { border-radius: 0; }
.pd-ring { fill: none; stroke-width: 3; }
.card h3 { font-size: 15px; margin: 18px 0 8px; }
.pd-cardhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 14px; }
.pd-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pd-tools select, .pd-tools input, .pd-btn { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); }
.pd-tools input { cursor: text; min-width: 0; width: 12em; }
.pd-xana { color: var(--lv-accent); font-weight: 600; }
.pd-btn:disabled { opacity: .45; cursor: default; }
.pd-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px; font-size: 13px; }
:root:not([data-theme="clean"]) .pd-tools select,
:root:not([data-theme="clean"]) .pd-tools input,
:root:not([data-theme="clean"]) .pd-btn { border-radius: 0; }
.pd-db + .pd-db { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--border); }
.pd-db .kpis { margin-bottom: 12px; }
.pd-dbmeta { margin-top: 8px; }
.pd-db td.pd-left:not(:first-child) { white-space: nowrap; }
