/* Wanderburg Almanac — styled after the game's own UI: olive meadow ground,
   dark aubergine card panels with steel frames, cream ribbon titles, wooden
   slot planks and an orange blackletter headline face. Dark mode swaps the
   meadow for the Dark Forest's night blue; the panels stay the same. */

@font-face {
  font-family: "Rubik";
  src: url("fonts/rubik-v31.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Grenze Gotisch";
  src: url("fonts/grenze-gotisch-700-v20.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ground (the meadow) */
  --ground: #a9ae4f;
  --ground-deep: #8f9640;
  --ground-ink: #1f1c16;
  --ground-ink-2: #3c3a26;
  --tree: #3f7a4b;

  /* panels (the in-game cards) */
  --panel: #251c27;
  --panel-2: #302534;
  --panel-3: #3b2f40;
  --panel-ink: #f1e8d8;
  --panel-ink-2: #c3b7c2;
  --panel-ink-3: #968a98;
  --panel-rule: #4a3d4f;

  --steel: #8e919b;
  --steel-hi: #cfd2d9;
  --steel-lo: #5c5f69;
  --wood: #6e3f2b;
  --wood-hi: #8b5338;
  --wood-ink: #2b170f;
  --cream: #f3ebdc;
  --cream-ink: #2a2124;
  --orange: #f39433;
  --orange-deep: #c65a1c;
  --roof: #c8372d;

  --ok: #86d46a;
  --warn: #f2b84a;
  --bad: #f07a6a;
  --info: #7fb6f0;

  --t-cannon: #d2b894;
  --t-arrow: #93d772;
  --t-melee: #f2877a;
  --t-magic: #bd9ef7;
  --t-fire: #f7a552;
  --t-other: #aaa1ab;

  --r-common: #b3b5ae;
  --r-uncommon: #74d160;
  --r-rare: #62aef2;
  --r-epic: #c781f2;

  --f-display: "Grenze Gotisch", "UnifrakturCook", Georgia, serif;
  --f-ui: "Rubik", "Segoe UI", system-ui, sans-serif;

  --radius: 10px;
  --gutter: clamp(16px, 3vw, 32px);
  --frame: 0 0 0 2px var(--steel-lo), 0 0 0 4px var(--panel), 0 0 0 5px var(--steel), 0 10px 24px rgb(20 14 10 / 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #1f4b63;
    --ground-deep: #173a4e;
    --ground-ink: #eef1ea;
    --ground-ink-2: #b9cad3;
    --tree: #2c3a44;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ground-ink);
  background:
    radial-gradient(ellipse at 50% 0%, transparent 40%, var(--ground-deep) 100%) fixed,
    var(--ground);
}
a { color: inherit; text-underline-offset: 3px; }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ------------------------------------------------------------ top bar */
.mast {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--panel);
  color: var(--panel-ink);
  border-bottom: 4px solid var(--wood);
  box-shadow: 0 2px 0 var(--wood-ink), 0 6px 18px rgb(0 0 0 / 0.25);
}
.mast-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: var(--gutter);
  padding-block: 8px;
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--panel-ink); }
.wordmark .wm-name { font-family: var(--f-display); font-weight: 700; font-size: 26px; line-height: 1; color: var(--orange); }
.wordmark .wm-for { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--panel-ink-2); }
.pill-unofficial {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid currentColor;
  border-radius: 99px;
  padding: 3px 8px;
  white-space: nowrap;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--panel-ink-2);
  padding: 7px 11px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 15px;
}
.tabs a:hover { color: var(--panel-ink); background: var(--panel-2); }
.tabs a[aria-current="page"] { color: var(--cream-ink); background: var(--cream); box-shadow: inset 0 -3px 0 var(--orange); }
@media (max-width: 820px) {
  .tabs { margin-left: 0; width: 100%; mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
}

main { max-width: 1280px; margin: 0 auto; padding-inline: var(--gutter); padding-block: 28px 72px; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
/* Any display rule on a component overrides the browser's own [hidden] handling;
   this is the bug that once left every page stacked on screen at once. */
.view[hidden] { display: none; }

/* ------------------------------------------------------------ type */
.headline {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  color: var(--orange);
  text-shadow: 0 2px 0 var(--orange-deep), 0 3px 0 #1b1215, 0 0 18px rgb(0 0 0 / 0.25);
  letter-spacing: 0.01em;
}
.view-head { display: grid; gap: 10px; max-width: 760px; }
.view-head p { color: var(--ground-ink-2); font-size: 17px; }
.view-head p b { color: var(--ground-ink); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ground-ink-2); }

/* ------------------------------------------------------------ the card panel */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 120px);
  color: var(--panel-ink);
  border-radius: var(--radius);
  box-shadow: var(--frame);
  padding: 22px 18px 18px;
  display: grid;
  gap: 16px;
  min-width: 0;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--steel-hi), var(--steel-lo));
}
.panel::before { left: 8px; }
.panel::after { right: 8px; }
.ribbon {
  justify-self: start;
  position: relative;
  margin: -34px 0 0 -4px;
  background: var(--cream);
  color: var(--cream-ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 16px 4px;
  border: 2px solid #1b1215;
  box-shadow: 2px 2px 0 #1b1215;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ribbon .step {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--orange-deep);
  color: var(--cream);
  font-size: 12px;
  letter-spacing: 0;
}
.panel-sub { color: var(--panel-ink-2); font-size: 14px; margin-top: -8px; }
.plank {
  display: block;
  text-align: center;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood));
  color: var(--wood-ink);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.15), 0 2px 0 var(--wood-ink);
}

/* ------------------------------------------------------------ controls */
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; color: var(--panel-ink-2); display: inline-flex; gap: 4px; align-items: center; }
select, input[type="text"], input[type="number"], input[type="search"], textarea {
  background: var(--panel-3);
  color: var(--panel-ink);
  border: 1px solid var(--panel-rule);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
select:hover, input:hover, textarea:hover { border-color: var(--steel); }
select option, select optgroup { background: var(--panel); color: var(--panel-ink); }
textarea { font-size: 13px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.btn {
  border: 2px solid #1b1215;
  background: var(--panel-3);
  color: var(--panel-ink);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 0 #1b1215;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #1b1215; }
.btn.primary { background: var(--orange); color: #1b1215; }
.btn.primary:hover { background: #f7a650; }
.btn.cream { background: var(--cream); color: var(--cream-ink); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--orange); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.seg button {
  border: 2px solid var(--panel-rule);
  background: var(--panel-3);
  border-radius: 8px;
  padding: 8px 6px;
  cursor: pointer;
  display: grid;
  text-align: center;
  line-height: 1.25;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}
.seg button small { color: var(--panel-ink-3); font-size: 12px; font-weight: 400; }
.seg button[aria-pressed="true"] { border-color: var(--orange); background: var(--panel); box-shadow: inset 0 -3px 0 var(--orange); }

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; background: var(--panel-3); border: 1px solid var(--panel-rule); border-radius: 99px; padding: 5px 12px 5px 8px; }
.toggle input { accent-color: var(--orange); margin: 0; }
.toggle:has(input:checked) { border-color: var(--orange); }

/* ------------------------------------------------------------ tooltip */
.tip {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  color: var(--panel-ink-3);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: help;
  vertical-align: 1px;
  flex: none;
}
.tip:hover, .tip:focus-visible { color: var(--orange); }
[data-tip]:not(.tip) { cursor: help; text-decoration: underline dotted var(--panel-ink-3); text-underline-offset: 3px; }
#tooltip {
  position: fixed;
  z-index: 50;
  max-width: min(320px, calc(100vw - 24px));
  background: var(--cream);
  color: var(--cream-ink);
  border: 2px solid #1b1215;
  box-shadow: 3px 3px 0 #1b1215;
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: none;
}

/* ------------------------------------------------------------ chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid currentColor;
  white-space: nowrap;
  font-weight: 500;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.t-cannon { color: var(--t-cannon); }
.t-arrow { color: var(--t-arrow); }
.t-melee { color: var(--t-melee); }
.t-magic { color: var(--t-magic); }
.t-fire { color: var(--t-fire); }
.t-other, .t-explosive, .t-zone, .t-none { color: var(--t-other); }
.r-common { color: var(--r-common); }
.r-uncommon { color: var(--r-uncommon); }
.r-rare { color: var(--r-rare); }
.r-epic { color: var(--r-epic); }
.chip.conf { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; cursor: help; }
.conf-confirmed { color: var(--ok); }
.conf-likely { color: var(--panel-ink-3); }
.conf-unverified { color: var(--warn); border-style: dashed; }
.chip.gold { color: var(--warn); }
.chip.muted { color: var(--panel-ink-3); }

/* ------------------------------------------------------------ home */
.hero {
  display: grid;
  gap: 18px;
  justify-items: start;
  padding-block: 12px 6px;
}
.hero .headline { font-size: clamp(44px, 7vw, 76px); }
.hero .pill-unofficial { font-size: 12px; background: var(--panel); }
.hero p.lede { font-size: clamp(18px, 2.2vw, 22px); max-width: 640px; color: var(--ground-ink); font-weight: 500; }
.hero .stamp { color: var(--ground-ink-2); font-size: 14px; }
.tiles-home { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 28px 20px; margin-top: 10px; }
.tile-link { text-decoration: none; }
.tile-link:hover { transform: translateY(-2px); }
.tile-link h3 { font-size: 19px; }
.tile-link p { color: var(--panel-ink-2); font-size: 15px; }
.tile-link .go { color: var(--orange); font-weight: 700; font-size: 14px; }
.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.steps li::before {
  content: counter(s);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--orange-deep);
  color: var(--cream);
  font-weight: 700;
  border: 2px solid #1b1215;
}
.steps b { color: var(--panel-ink); }
.steps span { color: var(--panel-ink-2); }

/* ------------------------------------------------------------ planner */
.howto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 10px 18px;
  align-items: start;
}
.howto div { display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 14px; color: var(--panel-ink-2); }
.howto div b { color: var(--panel-ink); display: block; }
.howto i { font-style: normal; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--orange-deep); color: var(--cream); font-weight: 700; border: 2px solid #1b1215; font-size: 13px; }
.planner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px 28px; align-items: start; }
@media (max-width: 980px) { .planner { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: 36px; min-width: 0; }

.castle-wrap { background: var(--ground); border-radius: 8px; padding: 6px; box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.25); }
.castle { width: 100%; height: auto; display: block; }
.castle .body { fill: #d8cbb2; stroke: #1b1215; stroke-width: 2.5; }
.castle .roof { fill: var(--roof); stroke: #1b1215; stroke-width: 2.5; }
.castle .line { stroke: #1b1215; stroke-width: 2.5; fill: none; }
.castle .solid { fill: #1b1215; }
.castle .hub { fill: #5a4b45; stroke: #1b1215; stroke-width: 2.5; }
.castle .ground { stroke: #1b1215; stroke-opacity: 0.35; stroke-width: 2; stroke-dasharray: 6 7; }
.castle .smoke { fill: #f3ebdc; opacity: 0.9; }
.castle .socket { cursor: pointer; }
.castle .socket rect { fill: var(--panel); stroke: var(--steel); stroke-width: 2; stroke-dasharray: 5 4; }
.castle .socket.filled rect { stroke-dasharray: none; stroke: var(--orange); stroke-width: 2.5; }
.castle .socket:hover rect, .castle .socket:focus-visible rect { fill: var(--panel-3); }
.castle .socket:focus { outline: none; }
.castle .socket text { font-family: var(--f-ui); font-size: 13px; fill: var(--panel-ink); text-anchor: middle; font-weight: 700; }
.castle .socket text.k { font-size: 9.5px; fill: var(--orange); letter-spacing: 0.14em; font-weight: 700; }

.cap-note { font-size: 14px; color: var(--panel-ink-2); }
.cap-note b { color: var(--panel-ink); }
.cap-note .up { color: var(--ok); font-weight: 500; }
.cap-note .down { color: var(--bad); font-weight: 500; }

.slot-card { background: var(--panel-2); border: 1px solid var(--panel-rule); border-radius: 8px; padding: 12px; display: grid; gap: 12px; }
.slot-card.flash { animation: flash 900ms ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--orange); } to { box-shadow: 0 0 0 3px transparent; } }
.slot-top { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; }
.slot-top .plank { padding: 6px 4px; font-size: 11px; }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stepper { display: grid; gap: 4px; }
.stepper > span { font-size: 12px; color: var(--panel-ink-2); display: inline-flex; gap: 4px; align-items: center; }
.stepper .ctl { display: grid; grid-template-columns: 30px 1fr 30px; border: 1px solid var(--panel-rule); border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.stepper button { border: 0; background: var(--panel); cursor: pointer; padding: 4px 0; font-weight: 700; }
.stepper button:hover { background: var(--orange-deep); color: var(--cream); }
.stepper output { text-align: center; padding: 4px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pips { display: flex; gap: 3px; justify-content: center; }
.pips i { width: 10px; height: 4px; border-radius: 2px; background: var(--panel-rule); }
.pips i.on { background: var(--orange); }
details.specials summary { cursor: pointer; font-size: 13px; color: var(--panel-ink-2); }
details.specials summary b { color: var(--panel-ink); }
details.specials .sp-grid { display: grid; gap: 8px; margin-top: 8px; }
details.specials label { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--panel-ink-2); }
.empty-slot { font-size: 14px; color: var(--panel-ink-3); }

.ranks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.held { display: flex; flex-wrap: wrap; gap: 6px; }
.held button { border: 1px solid var(--panel-rule); background: var(--panel-3); border-radius: 99px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.held button:hover { border-color: var(--bad); color: var(--bad); }
.held .empty { font-size: 14px; color: var(--panel-ink-3); }
.art-list { max-height: 300px; overflow: auto; border: 1px solid var(--panel-rule); border-radius: 8px; padding: 4px; display: grid; gap: 1px; background: var(--panel); }
.art-list label { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.35; }
.art-list label:hover { background: var(--panel-2); }
.art-list input { accent-color: var(--orange); margin-top: 3px; }
.art-list small { color: var(--panel-ink-3); display: block; }
.art-list .m { font-size: 11px; color: var(--ok); white-space: nowrap; padding-top: 2px; }

/* readout */
.bignums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 460px) { .bignums { grid-template-columns: minmax(0, 1fr); } }
.bignum { background: var(--panel); border: 1px solid var(--panel-rule); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.bignum span { font-size: 12px; color: var(--panel-ink-2); display: inline-flex; gap: 5px; align-items: center; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }
.bignum b { font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--cream); }
.bignum.hot b { color: var(--orange); }
.bignum small { font-size: 12px; color: var(--panel-ink-3); }
.minis { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--panel-ink-2); }
.minis b { color: var(--panel-ink); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.bar i { display: block; height: 100%; background: currentColor; }
.bar-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--panel-ink-2); }
.bar-key span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: currentColor; margin-right: 6px; }
.bar-key b { color: var(--panel-ink); font-weight: 500; }
.bar-block { display: grid; gap: 6px; }
.bar-block > span { font-size: 13px; color: var(--panel-ink-2); display: inline-flex; gap: 5px; align-items: center; }
.subtle { font-size: 13px; color: var(--panel-ink-3); }

.scroll-x { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 8px; text-align: left; border-bottom: 1px solid var(--panel-rule); vertical-align: top; }
table.grid th { font-size: 12px; font-weight: 500; color: var(--panel-ink-3); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
table.grid td.n, table.grid th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr.total td { font-weight: 700; border-bottom: 0; color: var(--orange); }
table.grid tr.group td { background: var(--panel-2); color: var(--orange); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
table.grid td .sub { display: block; font-size: 12px; color: var(--panel-ink-3); }
table.grid td .flag { display: block; font-size: 11.5px; color: var(--warn); }
table.grid tbody tr:hover td { background: rgb(255 255 255 / 0.03); }

.notes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.notes li { font-size: 14px; padding: 8px 12px; border-radius: 6px; background: var(--panel-2); border-left: 4px solid var(--warn); color: var(--panel-ink); }
.notes li.note-bad { border-left-color: var(--bad); }
.notes li.note-tip { border-left-color: var(--info); }
.status { font-size: 14px; color: var(--ok); min-height: 1.3em; }
.status.err { color: var(--bad); }

/* ------------------------------------------------------------ database views */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fbtn { border: 2px solid #1b1215; background: var(--cream); color: var(--cream-ink); border-radius: 99px; padding: 4px 14px; cursor: pointer; font-size: 14px; font-weight: 500; }
.fbtn[aria-pressed="true"] { background: var(--panel); color: var(--cream); box-shadow: inset 0 -3px 0 var(--orange); }
.search { width: min(320px, 100%); }
.search input { background: var(--cream); color: var(--cream-ink); border: 2px solid #1b1215; }
.search input::placeholder { color: #7b6f68; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 40px 22px; padding-top: 14px; }
.card { display: flex; flex-direction: column; gap: 12px; }
.card > .ribbon { align-self: flex-start; }
.card h3 { font-size: 20px; }
.card .desc { color: var(--panel-ink-2); font-size: 15px; }
.card .desc b { color: var(--panel-ink); font-weight: 500; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.card dt { color: var(--panel-ink-3); }
.card dd { margin: 0; min-width: 0; color: var(--panel-ink-2); }
.card details summary { cursor: pointer; color: var(--orange); font-weight: 500; font-size: 14px; }
.card details[open] summary { margin-bottom: 8px; }
.statgrid { width: 100%; border-collapse: collapse; font-size: 13px; }
.statgrid th, .statgrid td { padding: 4px 6px; border-bottom: 1px solid var(--panel-rule); text-align: right; font-variant-numeric: tabular-nums; }
.statgrid th { font-weight: 500; color: var(--panel-ink-3); font-size: 12px; }
.statgrid th:first-child, .statgrid td:first-child { text-align: left; }
.card .foot { font-size: 12px; color: var(--panel-ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .foot a { color: var(--panel-ink-3); }
.note { font-size: 13px; color: var(--panel-ink-2); background: var(--panel-2); border-radius: 6px; padding: 7px 10px; }
.note.warn { border-left: 3px solid var(--warn); }
.spec-list { display: grid; gap: 4px; font-size: 14px; margin: 0; padding: 0; list-style: none; color: var(--panel-ink-2); }
.spec-list li { display: grid; grid-template-columns: 46px 1fr; gap: 6px; }
.spec-list li b { font-size: 12px; color: var(--orange); font-weight: 700; padding-top: 2px; }
.card-top { display: grid; gap: 10px; }
.card .plank { margin-top: auto; }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 40px 24px; align-items: start; }
.prose { display: grid; gap: 12px; }
.prose p, .prose li { color: var(--panel-ink-2); }
.prose b, .prose strong { color: var(--panel-ink); font-weight: 500; }
.prose h3 { font-size: 17px; color: var(--cream); margin-top: 6px; }
.prose ul, .prose ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.prose a { color: var(--orange); }
.formula { font-size: 13px; background: var(--panel); border: 1px solid var(--panel-rule); padding: 10px 12px; border-radius: 6px; overflow-x: auto; white-space: pre; color: var(--cream); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

.route { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; font-size: 14px; }
.route .stop { background: var(--cream); color: var(--cream-ink); border: 2px solid #1b1215; padding: 5px 12px; border-radius: 6px; box-shadow: 2px 2px 0 #1b1215; font-weight: 700; }
.route .stop small { display: block; color: #6c5f5a; font-size: 12px; font-weight: 400; }
.route .arrow { color: var(--ground-ink); font-weight: 700; }

.timeline { display: grid; border-left: 3px solid var(--panel-rule); margin-left: 6px; }
.tl-item { position: relative; padding: 0 0 22px 22px; display: grid; gap: 6px; }
.tl-item::before { content: ""; position: absolute; left: -9px; top: 5px; width: 15px; height: 15px; border-radius: 50%; background: var(--orange); border: 3px solid var(--panel); }
.tl-item h3 { font-size: 17px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; color: var(--cream); }
.tl-item h3 small { color: var(--panel-ink-3); font-size: 14px; font-weight: 400; }
.tl-item ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; color: var(--panel-ink-2); font-size: 15px; }
.tl-item .foot { font-size: 12px; color: var(--panel-ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; }

.skulls { color: var(--bad); letter-spacing: 1px; font-size: 12px; white-space: nowrap; }
.res { display: flex; gap: 4px; flex-wrap: wrap; }
.res span { font-size: 12px; background: var(--panel-3); padding: 2px 7px; border-radius: 4px; white-space: nowrap; }

details.more > summary { cursor: pointer; color: var(--orange); font-weight: 700; }
details.more[open] > summary { margin-bottom: 12px; }

.fresh {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ground-ink);
  background: rgb(255 255 255 / 0.18);
  border: 1px solid rgb(0 0 0 / 0.15);
  border-radius: 8px;
  padding: 8px 12px;
}
.fresh b { font-weight: 700; }
.fresh a { font-weight: 500; }
.summary { font-size: 16px; color: var(--panel-ink); background: var(--panel); border: 1px solid var(--panel-rule); border-radius: 8px; padding: 10px 12px; }
.summary b { color: var(--orange); font-variant-numeric: tabular-nums; }
.example-note { font-size: 14px; color: var(--panel-ink); background: var(--panel-3); border-left: 4px solid var(--info); border-radius: 6px; padding: 8px 12px; }
.saved-note { font-size: 13px; color: var(--panel-ink-2); display: flex; gap: 8px; align-items: baseline; }
.saved-note::before { content: "✓"; color: var(--ok); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--ground-ink-2); }
.legend .chip { background: var(--panel); }
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: calc(100vw - 32px);
  background: var(--cream);
  color: var(--cream-ink);
  border: 2px solid #1b1215;
  box-shadow: 3px 3px 0 #1b1215;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 500;
}
#toast button { border: 2px solid #1b1215; background: var(--orange); color: #1b1215; font-weight: 700; border-radius: 6px; padding: 4px 12px; cursor: pointer; }

footer.foot-site { margin-top: 48px; padding-top: 16px; border-top: 2px dashed rgb(0 0 0 / 0.2); font-size: 13px; color: var(--ground-ink-2); display: grid; gap: 4px; }
