/* The Aeronautica 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).
   The :host() twins serve the 3D replay's Admin card (FEAT-mcstats-16), which
   sits in a shadow root whose host copies <html>'s data-theme and data-scheme;
   on these pages they match nothing. */
:root, :host {
  --lv-accent: #3987e5;
  --lv-on: #199e70;
  --lv-warn: #d03b3b;
  --lv-food: #c98500;
  --lv-track: #2c2c2a;
}
:root[data-theme="clean"], :host([data-theme="clean"]) {
  --lv-accent: #2a78d6;
  --lv-on: #1baf7a;
  --lv-food: #eda100;
  --lv-track: #e1e0d9;
}
:root[data-theme="clean"][data-scheme="dark"], :host([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"]), :host([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;
}
/* Text links take Kit's text-safe --link (AA on --surface and --bg in every
   theme); --lv-accent stays the series colour for bars and strips
   (MSSLIVE-4, QA-MSS-5). */
a { color: var(--link, 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; }
/* --text-faint is AA on a card only; a note on the page background is muted (QA-MSS-6). */
main > .note, .wrap > .note { color: var(--text-muted); }
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: #052016; }  /* dark on the green, 5:1+ in every theme (UX-mcstats-19; #0b2e20 was 4.3:1 on #199e70) */
.pill.down { background: var(--lv-warn); color: #fff; }
.pill-note { font-size: 13px; color: var(--text-faint); }

main, main.wrap { padding-top: 22px; }  /* main.wrap: .wrap's padding shorthand would otherwise zero it, flush under the tabs */
.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(--link, 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; }
/* UX-mcstats-3: on a phone the dashboard's tables keep the Player column in
   place and fade at the right edge while there is more to scroll; admin.js
   marks a table .at-end when it is scrolled to its end. */
@media (max-width: 600px) {
  #panel-stats .tablewrap { position: relative; display: flex; }
  #panel-stats .tablewrap > table { flex: none; width: auto; min-width: 100%; }
  #panel-stats .tablewrap th:first-child, #panel-stats .tablewrap td:first-child {
    position: sticky; left: 0; background: var(--surface); z-index: 1; }
  #panel-stats .tablewrap::after { content: ""; flex: none; position: sticky; right: 0; width: 24px; margin-left: -24px;
    z-index: 2; pointer-events: none; background: linear-gradient(to right, transparent, var(--surface)); }
  #panel-stats .tablewrap.at-end::after { display: none; }
}
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; }

/* Leaderboards (FEAT-mcstats-1): rank, player, value; fits at 390 px. */
table.board th:nth-child(2), table.board td:nth-child(2) { text-align: left; width: 100%; }
table.board td:first-child { color: var(--text-muted); width: 2.5em; }

.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); }
/* One line per label, so every bar stands on the same baseline (QA-MSS-2). */
@media (max-width: 600px) { .col-l { white-space: nowrap; font-size: 11px; letter-spacing: -0.01em; } }

.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.week { grid-template-columns: repeat(168, 1fr); gap: 0; }
.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; }
/* On a phone each name sits whole on its own line above its strip (UX-mcstats-4). */
@media (max-width: 600px) {
  .ps-row { grid-template-columns: 1fr; gap: 2px; margin: 6px 0; }
  .ps-name { white-space: normal; }
  .ps-cells { gap: 0; }
}
/* Tap targets at least 24 px tall on a phone (MSSLIVE-10, QA-MSS-7), and on any
   touch screen however wide, a phone turned sideways included (QA-MSS2-1). */
@media (max-width: 600px), (pointer: coarse) {
  a.ps-name { display: block; min-height: 24px; padding: 2px 0; }
  footer a, a.back { display: inline-block; padding: 5px 0; min-height: 24px; }
  table.board th a, .tablewrap th a { display: inline-block; padding: 4px 0; min-height: 24px; }
  ul.timelapses a { display: inline-block; min-height: 24px; padding: 2px 0; }   /* QA-MSS2-2 */
}

.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; }
/* FEAT-mcstats-2: an in-game title, its description under it, and the
   Completion card's total. */
.adv li:has(> span[title]) { flex-wrap: wrap; }
.adv li > span[title] { font-weight: 600; }
.adv li > span[title] + span.muted:not(:last-child) { flex: 1 1 100%; order: 3; font-size: 12px; }
.adv-total { font-size: 24px; font-weight: 600; line-height: 1.15; margin: 0 0 12px; }

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

/* Retro: chrome only -- square corners and ridge borders, as the Endventure report. */
:root:not([data-theme="clean"]) .card,
:host(:not([data-theme="clean"])) .card,
:root:not([data-theme="clean"]) .kpi,
:host(:not([data-theme="clean"])) .kpi,
:root:not([data-theme="clean"]) .pill,
:host(:not([data-theme="clean"])) .pill,
:root:not([data-theme="clean"]) code,
:host(:not([data-theme="clean"])) code { border-radius: 0; }
:root:not([data-theme="clean"]) .card,
:host(: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; }
:root:not([data-theme="clean"]) .pd-health .host { border-radius: 0; border-width: 3px; border-style: ridge; }
:root:not([data-theme="clean"]) .pd-health .host.warn { border-color: var(--warning); }
:root[data-theme="clean"] .pd-health .host { box-shadow: var(--shadow-1); }

/* 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); }
/* The Admin tab's launch bar: the control panel and the 3D world viewer, as big buttons above
   the sub-tabs (static in the page, so they show even while Private is locked). */
.pd-launch { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 0 0 16px; }
.pd-launch-btn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; text-decoration: none;
  border: 2px solid var(--lv-accent); background: var(--surface-alt); color: var(--text); }
.pd-launch-btn:hover, .pd-launch-btn:focus-visible { background: var(--lv-accent); color: #fff; }
.pd-launch-btn:hover small, .pd-launch-btn:focus-visible small { color: inherit; }
.pd-launch-btn strong { display: block; font-size: 16px; }
.pd-launch-btn strong::after { content: " \2192"; }
.pd-launch-btn small { display: block; font-size: 12px; color: var(--text-muted); }
:root:not([data-theme="clean"]) .pd-launch-btn,
:host(:not([data-theme="clean"])) .pd-launch-btn { border-radius: 0; }
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, :host {
  --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"], :host([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"], :host([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"]), :host([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; }
/* The Admin tab's Server health section: the NUC's card is Private's host-card.js markup
   (the /private/projects card), so these rules mirror Private's app.css for it, scoped here. */
.pd-health { margin: 0 0 18px; }
.pd-health > h2 { margin: 0 0 10px; }
.pd-hosts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 14px; align-items: start; }
.pd-health .host { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; min-width: 0; }
.pd-health .host.warn { border-color: var(--warning); }
.pd-health details.host > summary { cursor: pointer; list-style-position: inside; }
.pd-health details.host > summary > h3 { display: inline; font-size: 16px; margin: 0; }
.pd-health details.host > summary > .fine { display: block; margin: 4px 0 0; }
.pd-health details.host[open] > summary { margin-bottom: 6px; }
.pd-health .fine { color: var(--text-muted); font-size: 13px; }
.pd-health .note { color: var(--text-muted); font-size: 13px; margin-left: 6px; }
.pd-health .kv { display: grid; grid-template-columns: 7.5rem 1fr; gap: 5px 14px; margin: 10px 0; }
.pd-health .kv dt { color: var(--text-muted); font-size: 13px; }
.pd-health .kv dd { margin: 0; overflow-wrap: anywhere; }
.pd-health meter { width: 5rem; height: .8rem; vertical-align: middle; margin-right: 5px; }
.pd-health .warnings { margin: 8px 0; padding-left: 1.2rem; }
.pd-health .warnings li { margin: 2px 0; }
.pd-health .badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  vertical-align: middle; border: 1px solid var(--border-alt); background: var(--surface-alt); color: var(--text-muted); }
.pd-health .badge.ok { border-color: var(--success); background: var(--success-soft); color: var(--success-soft-text); }
.pd-health .badge.bad { border-color: var(--danger); background: var(--danger-soft); color: var(--danger-soft-text); }
.pd-health .badge.warn { border-color: var(--warning); background: var(--warning-soft); color: var(--warning-soft-text); }
.pd-health .banner.error { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger-soft-text);
  border-radius: 8px; padding: 8px 12px; }
.pd-health .sub summary { cursor: pointer; padding: 4px 0; font-size: 13px; }
.pd-health .chips { list-style: none; padding: 0; margin: 5px 0; display: flex; flex-wrap: wrap; gap: 5px; }
.pd-health .chips li { font-size: 13px; padding: 1px 8px; border: 1px solid var(--border-alt); border-radius: 6px; overflow-wrap: anywhere; }
.pd-health .chips li.bad { border-color: var(--danger); color: var(--danger-soft-text); background: var(--danger-soft); }
.pd-health .chips .note { margin-left: 3px; }
.pd-health .table-scroll { overflow-x: auto; }
.pd-health table.events { border-collapse: collapse; width: 100%; font-size: 13px; }
.pd-health table.events th, .pd-health table.events td { text-align: left; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--border); }
.pd-health table.events tr.bad td { color: var(--danger-soft-text); }
.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; }
/* UX-mcstats-11: the Admin tab's jump bar and folding player cards. */
.pd-jump { position: sticky; top: 0; z-index: 2; overflow-x: auto; white-space: nowrap; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 8px 0; margin-bottom: 14px; font-size: 14px; }
.pd-jump a { display: inline-block; margin-right: 14px; }
[id^="pd-"] { scroll-margin-top: 48px; }   /* a jump lands below the sticky bar (MSS5B-11) */
summary.pd-head { cursor: pointer; list-style: none; }
summary.pd-head::-webkit-details-marker { display: none; }
summary.pd-head::before { content: "\25B8" / ""; color: var(--text-muted); font-size: 13px; }
details[open] > summary.pd-head::before { content: "\25BE" / ""; }
details.pd-fold:not([open]) > summary.pd-head { margin-bottom: 0; }
.pd-head h2 { margin: 0; flex: 1; }
.pd-head h2 a { color: inherit; text-decoration: none; }
.pd-head h2 a:hover, .pd-head h2 a:focus-visible { text-decoration: underline; }
.admin-link { margin: 0 0 8px; font-size: 14px; }
/* Nothing to show a non-admin: no 8 px gap above "Right now" (MSS3-O4). */
.admin-link:has(> a[hidden]) { display: none; }
.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; }
/* A tile is at most 52 px, its size on the whole page's cards, so the one-player view's single
   wide card does not stretch it (RC2-2); narrower screens shrink it as before. */
.pd-grid, .pd-gear { display: grid; grid-template-columns: repeat(9, minmax(0, 52px)); 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-slot.nest { border-style: dashed; border-color: var(--text-muted); }   /* holds items: see the list under the grid */
.pd-inv details.pd-nest { margin: 4px 0 0 0; }
.pd-saved .pd-facts { margin-bottom: 6px; }
.pd-saved-label { font-size: 12px; font-style: italic; color: var(--text-muted); margin: 4px 0 2px 10px; }
.pd-saved .pd-facts { margin-left: 10px; }
.pd-saved .pd-facts > div { overflow-wrap: anywhere; }
.pd-item { display: block; hyphens: auto; }
/* A Grid text tile breaks between words (or at a hyphenation point) and
   shows three lines at most (four on a phone, below); the full name is the
   List row's and the tile's title (QA-MSS-4). */
.pd-slot .pd-item { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.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); }
/* The item sheet's icons (admin.js itemIcon; FEAT-mcstats-3): 32 px centred in a slot, the count and
   enchant mark over its corners as in the game, the name kept for title and aria-label only;
   16 px before a list row's name. admin.js sets the image and its place through el.style. */
.pd-icon { display: inline-block; width: 16px; height: 16px; background-repeat: no-repeat;
  vertical-align: -3px; margin-right: 6px; }
.pd-slot.has-icon { display: grid; place-items: center; }
.pd-slot.has-icon .pd-icon { width: 32px; height: 32px; margin: 0; }
.pd-slot.has-icon .pd-item { display: none; }
.pd-slot.has-icon .pd-count { text-shadow: 1px 1px 0 var(--surface-alt), -1px -1px 0 var(--surface-alt); }
.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,
:host(:not([data-theme="clean"])) .pd-slot,
:root:not([data-theme="clean"]) .pd-svg,
:host(:not([data-theme="clean"])) .pd-svg,
:root:not([data-theme="clean"]) .pd-dims button,
:host(: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,
:host(:not([data-theme="clean"])) .pd-tools select,
:root:not([data-theme="clean"]) .pd-tools input,
:host(:not([data-theme="clean"])) .pd-tools input,
:root:not([data-theme="clean"]) .pd-btn,
:host(: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; }

/* The page's window bar (admin.js viewBar): one window for every card, or each card's usual one. */
.pd-viewbar { align-items: center; }
.pd-viewbar label { font-size: 13px; }

/* Admin item blocks (admin.js itemBlock): a List | Grid toggle over each item grid; the list is
   one line per stack (count, full name, then the tile's title text), the default under 600 px. */
.pd-items-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 4px; }
.pd-items-head .pd-inv-label { margin: 0; }
.pd-seg { display: flex; margin-left: auto; }
.pd-seg .pd-btn { font-size: 12px; padding: 2px 9px; border-radius: 0; color: var(--text-muted); }
.pd-seg .pd-btn:first-child { border-radius: 8px 0 0 8px; }
.pd-seg .pd-btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.pd-seg .pd-btn[aria-pressed="true"] { background: var(--lv-accent); border-color: var(--lv-accent); color: #fff; }
:root:not([data-theme="clean"]) .pd-seg .pd-btn,
:host(:not([data-theme="clean"])) .pd-seg .pd-btn { border-radius: 0; }
.pd-list { list-style: none; margin: 0 0 4px; padding: 0; font-size: 13px; line-height: 1.35; }
.pd-row { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); column-gap: 8px; padding: 3px 0;
  border-bottom: 1px solid var(--border); }
.pd-row-n { grid-column: 1; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pd-row-name, .pd-row-x { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
.pd-row-x { font-size: 12px; color: var(--text-muted); }
.pd-row-sub { border-bottom-style: dashed; }
.pd-row-sub .pd-row-name { padding-left: 1.2em; font-size: 12px; color: var(--text-muted); }
/* Grid chosen on a phone: the count and the enchant mark get their own line under the name
   (clipped above them), so nothing overprints in a ~33 px tile. */
@media (max-width: 599px) {
  .pd-slot:not(.empty) { display: grid; grid-template: minmax(0, 1fr) auto / auto 1fr; }
  .pd-slot .pd-item { grid-column: 1 / -1; min-height: 0; overflow: hidden; }
  /* A ~28 px tile: a smaller face and four lines so common item words fit;
     a word still wider than the tile breaks inside it as the last resort,
     rather than being clipped sideways ("Cobble"; RV-MSSQA-3). */
  .pd-slot .pd-item { font-size: 10px; line-height: 1.15; -webkit-line-clamp: 4; line-clamp: 4;
    hyphens: auto; overflow-wrap: break-word; }
  .pd-slot .pd-ench { position: static; grid-area: 2 / 1; line-height: 1.3; }
  .pd-slot .pd-count { position: static; grid-area: 2 / 2; justify-self: end; line-height: 1.3; }
  /* An icon tile has no name to clip: the icon fills it, the corners stay over it. */
  .pd-slot.has-icon:not(.empty) { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
  .pd-slot.has-icon .pd-count { position: absolute; right: 3px; bottom: 1px; }
  .pd-slot.has-icon .pd-ench { position: absolute; left: 3px; bottom: 1px; }
}

/* Weekly headlines (headlines.py, FEAT-mcstats-4): the Endventure report's
   Headlines cards (report_template.html .finding) on the shared tokens; the
   first card spans the full width, as there. */
.hl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.hl-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hl-card:first-child { grid-column: 1 / -1; }
.hl-kicker { font-size: 11px; letter-spacing: 0.04em; font-weight: 700;
  color: var(--text-muted); overflow-wrap: anywhere; }   /* names keep their case (MSSLIVE-7) */
.hl-big { font-size: 34px; font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; }
.hl-big small { font-size: 16px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.hl-card h3 { font-size: 16px; margin: 0; overflow-wrap: anywhere; }
.hl-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
:root:not([data-theme="clean"]) .hl-card { border-radius: 0; border-width: 3px; border-style: ridge; }

/* Build timelapses (FEAT-mcstats-9): the image never wider than its column. */
.timelapse { margin: 0 0 8px; }
.timelapse img { display: block; max-width: 100%; height: auto; }
.timelapse figcaption { color: var(--text-muted); margin-top: 6px; }
.timelapses { margin: 0; padding-left: 1.2em; }
/* Play / last frame (QA-MSS-8) and the downloads (MSSLIVE-10): 24 px targets,
   each download on its own line on a phone. */
.tl-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.tl-btn { display: inline-block; min-height: 24px; padding: 4px 12px; border: 1px solid var(--border);
  border-radius: 999px; text-decoration: none; font-size: 14px; }
:root:not([data-theme="clean"]) .tl-btn { border-radius: 0; }
.dl { display: inline-block; min-height: 24px; padding: 4px 0; margin-right: 14px; }
@media (max-width: 600px) { .tl-dl .dl { display: block; width: max-content; } }

/* The Bases tab (admin.js): a gallery of every build timelapse's last frame. */
.bases { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.base-card { display: block; text-decoration: none; color: inherit; margin: 0; padding: 10px; }
.base-card:hover, .base-card:focus-visible { border-color: var(--lv-accent); }
.base-card img { display: block; width: 100%; height: auto; margin-bottom: 8px; background: var(--surface-alt); }
.pd-pager.pd-tools { margin-bottom: 0; }
.pd-pager > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.guide-link { margin: 0 0 18px; font-size: 15px; }
