/* HoH Tools — dark inversion of the heroesofhistory.wiki companion chrome */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root,
html[data-theme="dark"] {
  --bg: #14110e;
  --panel: #2a241c;
  --plate: #3a3226;
  --surface: #322b22;
  --surface-2: #403628;
  --recess: #1c1812;
  --bg-elevated: #2e271f;
  --border: rgba(220, 198, 152, 0.28);
  --border-strong: rgba(218, 134, 65, 0.55);
  --rule: rgba(220, 198, 152, 0.18);
  --text: #f3ead8;
  --text-2: #d8cdb8;
  --text-3: #a89880;
  --nav: #3367B4;
  --nav-border: #2C5896;
  --bar: #3E7BAD;
  --bar-2: #538cb8;
  --tile-border: #1D4468;
  --link: #8eb8d8;
  --link-hover: #b7d4ea;
  --gold: #da8641;
  --gold-2: #dcc698;
  --gold-3: #e2c587;
  --accent: var(--gold);
  --accent-hover: #e59a5c;
  --accent-dim: rgba(62, 123, 173, 0.22);
  --accent-fg: #fff;
  --metal: #dcc698;
  --metal-dim: rgba(220, 198, 152, 0.12);
  --green: #8dca8d;
  --red: #e08a7a;
  --btn-primary-bg: #3E7BAD;
  --btn-primary-fg: #fff;
  --btn-primary-hover: #538cb8;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  --header-wash: var(--nav);
  --overlay: rgba(12, 10, 8, 0.92);
  --focus: #dcc698;
  --input-bg: #221c16;
  --input-border: rgba(220, 198, 152, 0.35);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --font-display: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --max: 1040px;
  --header-h: 58px;
  --landscape: url("night-landscape.svg");
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #8eb6d4;
  --panel: #EBE4CC;
  --plate: #ECDEC0;
  --surface: #EBE4CC;
  --surface-2: #e5d7b8;
  --recess: #e5dcc4;
  --bg-elevated: #F6F3EB;
  --border: rgba(170, 130, 43, 0.28);
  --border-strong: rgba(218, 134, 65, 0.5);
  --rule: rgba(62, 123, 173, 0.22);
  --text: #212529;
  --text-2: #333333;
  --text-3: #5c5346;
  --nav: #3367B4;
  --nav-border: #2C5896;
  --bar: #3E7BAD;
  --bar-2: #538cb8;
  --tile-border: #1D4468;
  --link: #3e7bad;
  --link-hover: #3367b4;
  --gold: #da8641;
  --gold-2: #dcc698;
  --gold-3: #e2c587;
  --accent: var(--gold);
  --accent-hover: #c67432;
  --accent-dim: rgba(62, 123, 173, 0.12);
  --accent-fg: #fff;
  --metal: #916a17;
  --metal-dim: rgba(145, 106, 23, 0.1);
  --green: #2f7a45;
  --red: #a33b3b;
  --btn-primary-bg: #3E7BAD;
  --btn-primary-fg: #fff;
  --btn-primary-hover: #3367B4;
  --shadow: 0 6px 18px rgba(40, 50, 70, 0.18);
  --header-wash: var(--nav);
  --overlay: rgba(27, 23, 16, 0.82);
  --focus: #3367B4;
  --input-bg: #F6F3EB;
  --input-border: #CCC;
  --landscape: none;
  color-scheme: light;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 42% at 50% -8%, rgba(196, 122, 56, 0.28), transparent 70%),
    var(--landscape);
  background-size: auto, cover;
  background-position: center top, center bottom;
  background-attachment: fixed;
}
html[data-theme="light"] {
  background-image:
    radial-gradient(ellipse 90% 50% at 50% 100%, #c5b48a 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 80% 90%, #9bb8d0 0%, transparent 50%),
    linear-gradient(180deg, #7eb3d9 0%, #a9cbe4 42%, #cfe0ee 100%);
  background-size: auto;
  background-attachment: fixed;
}
body {
  font-family: var(--font-body);
  background: transparent;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: calc(var(--header-h) + 14px);
  padding-bottom: 72px;
  overflow-x: clip;
}
body.body-login { padding: 0; }

::selection { background: var(--bar); color: #fff; }

a { color: var(--link); text-decoration: none; font-weight: 600; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* Grain overlay only — landscape lives on html so it is not hidden by body */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: transparent;
}
.site-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
html[data-theme="light"] .site-bg::after { opacity: 0.08; mix-blend-mode: multiply; }

.label-caps {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--metal);
}

/* Header — wiki blue bar, textured, 15px bottom radius */
.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(calc(100% - 24px), var(--max));
  height: var(--header-h);
  background-color: var(--nav);
  background-image: url("nav-texture.svg");
  background-size: 128px 128px;
  color: #fff;
  border-bottom: 3px solid var(--nav-border);
  border-radius: 0 0 15px 15px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.site-header::after { display: none; }
.site-header-inner {
  height: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark, .logo-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #4a3d2e, #1c1611);
  border: 2px solid var(--gold-2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
}
.brand-mark::after, .logo-mark::after {
  content: 'H';
  font-family: var(--font-body);
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.brand-mark-lg { width: 44px; height: 44px; }
.brand-mark-lg::after { font-size: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.01em;
  color: #fff;
}
.brand-text small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.78);
}

.site-nav-links { display: flex; gap: 4px; align-items: center; }
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 8px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #fff;
  border: none;
  background: transparent;
  text-decoration: none;
}
.nav-pill::before {
  content: '';
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-2);
  background:
    radial-gradient(circle at 32% 30%, #5a4a36, #241c14);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.nav-pill[data-nav="home"]::before {
  background:
    radial-gradient(circle at 50% 60%, #da8641 0 3px, transparent 3.2px),
    radial-gradient(circle at 32% 30%, #5a4a36, #241c14);
}
.nav-pill[data-nav="images"]::before {
  background:
    radial-gradient(circle at 50% 50%, #8eb8d8 0 4px, transparent 4.2px),
    radial-gradient(circle at 32% 30%, #5a4a36, #241c14);
}
.nav-pill[data-nav="releases"]::before {
  background:
    linear-gradient(#dcc698, #dcc698) 50% 62% / 2px 8px no-repeat,
    radial-gradient(circle at 32% 30%, #5a4a36, #241c14);
}
.nav-pill:hover {
  color: #fff;
  background: transparent;
  text-decoration: none;
  opacity: 0.92;
}
.nav-pill.is-active {
  color: #fff;
  background: transparent;
  box-shadow: inset 0 -3px 0 var(--gold-2);
}
.nav-pill-ghost {
  font-weight: 700;
  letter-spacing: 0;
}
.nav-pill-ghost::before { display: none; }

.site-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.22); color: #fff; }
.user-badge {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.nav-toggle {
  display: none;
  width: 40px; height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle-bars {
  display: block; width: 16px; height: 2px;
  background: currentColor; border-radius: 1px; position: relative;
}
.nav-toggle-bars::before, .nav-toggle-bars::after {
  content: ''; position: absolute; left: 0; width: 16px; height: 2px;
  background: currentColor; border-radius: 1px;
}
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }

/* Main wiki frame */
.site-main {
  max-width: var(--max);
  width: min(calc(100% - 24px), var(--max));
  margin: 0 auto 28px;
  padding: 0;
  min-width: 0;
}
.wiki-frame {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
html[data-theme="light"] .wiki-frame { border-color: rgba(0, 0, 0, 0.06); }
.wiki-frame-head {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  background: var(--bar);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.wiki-frame-title { color: #fff; }
.wiki-frame-body { padding: 18px 18px 24px; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bar-2);
  margin-bottom: 8px;
}
.page-head { margin-bottom: 22px; }
.page-head-compact { margin-bottom: 16px; }
.page-head h1, .hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  font-weight: 700;
  font-style: normal;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--link);
}
.hero-title {
  padding-bottom: 0;
  border-bottom: none;
  display: block;
  max-width: 18ch;
}
.page-head h1 {
  padding-bottom: 0;
  border-bottom: none;
  display: block;
}
.page-lede, .hero-lede, .section-lede {
  color: var(--text-2);
  max-width: 58ch;
  font-size: 1.02rem;
  font-weight: 400;
}
.page-actions, .hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Buttons — wiki blue rectangles, not oxblood or gold capsules */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--bar-2) 0%, var(--bar) 100%);
  color: var(--btn-primary-fg);
  border-color: var(--tile-border);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #6aa0c8 0%, var(--bar-2) 100%);
  border-color: var(--tile-border);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--gold-2);
}
.btn-ghost:hover { background: var(--metal-dim); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.text-action {
  font-size: 13px;
  font-weight: 700;
}

/* Hero home */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 28px;
  padding-bottom: 8px;
  border-bottom: none;
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.stat-row > div {
  padding-right: 24px;
  margin-right: 24px;
  margin-bottom: 8px;
  border-right: 1px solid var(--rule);
}
.stat-row > div:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.stat-row dt {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--bar-2);
  text-transform: none;
  letter-spacing: 0;
}
.stat-row dd {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 1.55rem;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text);
}

.hero-cards { display: grid; gap: 12px; }
.stat-card,
.pin-card,
.version-card,
.category-card,
.login-panel,
.version-rail,
.asset-stage,
.compare-stat,
.meta-grid div {
  border: 1px solid var(--tile-border);
  background: var(--plate);
  box-shadow: var(--shadow);
}
.stat-card, .pin-card {
  padding: 0 0 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border-width: 2px;
  border-color: var(--gold-2);
  background: var(--bar);
  color: #fff;
}
.stat-card-accent { border-color: var(--gold); }
.stat-card-label,
.pin-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
  background: transparent;
  padding: 10px 14px 4px;
}
.rail-title,
.version-card-tag,
.compare-stat span,
.meta-grid dt {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--bar-2);
}
.stat-card-value {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 500;
  margin: 0 14px 6px;
  word-break: break-word;
  color: #fff;
}
.stat-card-meta { font-size: 12px; color: rgba(255, 255, 255, 0.8); margin: 0 14px 10px; }
.stat-card .text-action,
.stat-card a { color: var(--gold-3); margin: 0 14px; }
.stat-card .empty-inline { color: rgba(255, 255, 255, 0.8); margin: 0 14px; }
.quick-links { list-style: none; margin: 4px 14px 0; display: grid; gap: 6px; }
.quick-links a { color: #fff; font-weight: 700; }

.pin-card { background: var(--plate); color: var(--text); border-color: var(--tile-border); }
.pin-card .pin-label {
  background: var(--bar);
  color: #fff;
  padding: 8px 14px;
  margin-bottom: 10px;
}
.pin-card h3 { margin: 0 14px 12px; color: var(--text); }
.pin-card .btn { margin-left: 14px; }

.section-block { margin-bottom: 22px; }
.section-block.section-muted,
.section-block.section-highlight,
.section-block:has(> .section-head),
.section-block:has(> h2) {
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--plate);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  flex-wrap: wrap;
  background: var(--bar);
  color: #fff;
  padding: 9px 14px;
}
.section-head h2, .section-block > h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 0;
  color: #fff;
}
.section-block > h2 {
  background: var(--bar);
  padding: 9px 14px;
}
.section-head .text-action { color: #fff; }
.section-block > .section-lede,
.section-block > .tile-grid,
.section-block > .release-stack,
.section-block > p,
.section-block > ul {
  padding: 14px 16px;
}
.count-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  vertical-align: middle;
}

/* Gallery layout */
.gallery-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.version-rail {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  padding: 0 0 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--tile-border);
}
.rail-title {
  margin-bottom: 0;
  background: var(--bar);
  color: #fff;
  padding: 8px 12px;
}
.version-list { list-style: none; display: grid; gap: 0; max-height: 70vh; overflow: auto; padding: 6px; }
.version-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.version-link:hover { background: var(--metal-dim); text-decoration: none; color: var(--text); }
.version-link.is-active, .version-link.is-latest {
  background: var(--accent-dim);
  color: var(--text);
  border-left-color: var(--gold);
}
.version-link-label { display: block; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.version-link-meta { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }

.version-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.version-card {
  padding: 14px 14px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #fff;
  display: grid;
  gap: 6px;
  background: linear-gradient(180deg, var(--bar-2) 0%, var(--bar) 100%);
  border: 2px solid var(--tile-border);
}
.version-card:hover { filter: brightness(1.06); text-decoration: none; color: #fff; }
.version-card-tag { color: var(--gold-3); }
.version-card strong { font-family: var(--font-body); font-size: 1.2rem; font-weight: 700; }
.version-card span { color: rgba(255, 255, 255, 0.88); font-size: 13px; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.category-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, var(--bar-2) 0%, var(--bar) 100%);
  border: 2px solid var(--tile-border);
}
.category-card:hover { filter: brightness(1.06); text-decoration: none; color: #fff; }
.category-card-count { font-family: var(--font-mono); font-size: 11px; color: var(--gold-3); }

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.gallery-tabs.is-sticky {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: var(--panel);
  backdrop-filter: none;
  padding-top: 10px;
}
.gallery-tab {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--tile-border);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  color: #fff;
  text-decoration: none;
  background: var(--bar);
  margin-bottom: 0;
}
.gallery-tab em { font-style: normal; font-family: var(--font-mono); font-size: 10px; opacity: 0.85; font-weight: 600; }
.gallery-tab:hover {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.08);
}
.gallery-tab.is-active, .gallery-tab.is-current {
  background: linear-gradient(180deg, var(--bar-2), var(--bar));
  border-color: var(--gold-2);
  color: #fff;
}

/* Tiles — wiki unit portraits, gold/sand frame */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 16px 12px;
}
.tile-grid-portrait { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.tile-grid-featured { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.tile, .img-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s;
}
.tile:hover, .img-tile:hover {
  border-color: transparent;
  transform: translateY(-2px);
  text-decoration: none;
  opacity: 1;
}
.tile-new .tile-frame { box-shadow: 0 0 0 2px var(--gold); }
.tile-frame {
  display: block;
  border-radius: 8px;
  background: linear-gradient(180deg, #dcc698, #da8641 40%, #916a17);
  overflow: hidden;
  border: 1px solid #aa822b;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] .tile-frame {
  background: linear-gradient(180deg, #f3ead4, #dcc698);
  border-color: var(--gold);
}
html[data-theme="dark"] .tile-frame {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.tile img, .img-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: var(--recess);
  border-radius: 5px;
}
.tile-portrait .tile img, .tile-grid-portrait .tile img { aspect-ratio: 3 / 4; }
.tile-label {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--link);
  word-break: break-word;
  text-align: center;
  padding: 0 2px;
}
.tile-cat {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
  text-align: center;
}
.tile.is-hidden, .img-tile.is-hidden { display: none; }

/* Toolbar / search */
.toolbar, .search-hero, .compare-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.search-input:focus { border-color: var(--bar); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input-lg { min-width: min(100%, 420px); font-size: 15px; padding: 12px 14px; }
.toolbar-jumps { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar-jumps a {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--tile-border);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #fff;
  text-decoration: none;
  background: var(--bar);
}
.toolbar-jumps a:hover { color: #fff; filter: brightness(1.08); text-decoration: none; }
.toolbar-jumps b { font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; text-transform: none; }

/* Releases — wiki cards/tables */
.pin-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.pin-card h3 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; word-break: break-word; }

.release-stack {
  display: grid;
  gap: 0;
  border-top: none;
  background: var(--plate);
}
.release-row, .release-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
}
.release-row:hover, .release-card:hover { background: var(--metal-dim); }
.release-row-title, .release-card-name { font-family: var(--font-mono); font-size: 12px; font-weight: 500; word-break: break-word; }
.release-row-meta, .release-card-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); margin-top: 6px; }
.release-group { margin-bottom: 22px; }
.release-group h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--link); }
.release-row.is-hidden,
.release-group.is-hidden,
.section-block.is-hidden,
.release-disclosure.is-hidden,
#release-archive[hidden] { display: none; }

.release-disclosure {
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  background: var(--plate);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.release-disclosure > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 14px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: #fff;
  background: var(--bar);
  user-select: none;
}
.release-disclosure > summary::-webkit-details-marker { display: none; }
.release-disclosure > summary::before {
  content: '▸';
  color: var(--gold-2);
  font-size: 0.85em;
  font-family: var(--font-body);
}
.release-disclosure[open] > summary::before { content: '▾'; }
.release-disclosure > .section-lede {
  padding: 12px 16px 0;
  margin-bottom: 0;
}
.release-disclosure > .release-stack {
  padding: 0;
  border-top: 1px solid var(--rule);
}
.release-disclosure .empty-state { padding: 14px 16px; }

.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.badge-client {
  background: rgba(62, 123, 173, 0.22);
  color: var(--link);
  border-color: color-mix(in srgb, var(--bar) 40%, transparent);
}
.badge-server {
  background: var(--metal-dim);
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
}
.badge-version {
  background: rgba(62, 123, 173, 0.22);
  color: var(--link);
  border-color: color-mix(in srgb, var(--bar) 40%, transparent);
}
.badge-oneoff {
  background: var(--metal-dim);
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
}
.section-block > h2 .badge {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.release-disclosure > summary .badge {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Dumps archive */
.dump-stack { display: grid; gap: 0; background: var(--plate); }
.dump-row {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.dump-row:hover { background: var(--metal-dim); text-decoration: none; }
.dump-row-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.dump-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}
.dump-toc { padding: 8px 0; }
.dump-toc ul { list-style: none; margin: 0; padding: 0; }
.dump-toc li { border-bottom: 1px solid var(--rule); }
.dump-toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.dump-toc a:hover { background: var(--metal-dim); text-decoration: none; }
.dump-toc-emoji { font-size: 1.15rem; line-height: 1; width: 1.6em; text-align: center; }
.dump-topic-emoji { margin-right: 0.2em; }
.dump-topic-actions { margin-top: 12px; }
.dump-prose-wrap > .dump-prose { padding: 16px 18px 20px; }
.dump-prose {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 72ch;
}
.dump-prose h1, .dump-prose h2, .dump-prose h3 {
  font-family: var(--font-display);
  margin: 1.2em 0 0.45em;
  color: var(--text);
}
.dump-prose h1 { font-size: 1.35rem; }
.dump-prose h2 { font-size: 1.18rem; }
.dump-prose p, .dump-prose ul, .dump-prose ol { margin: 0 0 0.85em; }
.dump-prose ul, .dump-prose ol { padding-left: 1.3em; }
.dump-prose a { color: var(--link); }
.dump-prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--recess);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.dump-prose pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.dump-prose pre code { background: transparent; padding: 0; }
.dump-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 0.95rem;
}
.dump-prose th, .dump-prose td {
  border: 1px solid var(--rule);
  padding: 6px 10px;
  text-align: left;
}
.dump-prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.dump-images {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 16px;
  margin: 0;
}
.dump-image {
  border: 1px solid var(--tile-border);
  background: var(--recess);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.dump-image img { display: block; width: 100%; height: 140px; object-fit: contain; background: var(--plate); }
.dump-image-meta { padding: 8px 10px 10px; display: grid; gap: 4px; }
.dump-image-name { font-family: var(--font-mono); font-size: 11px; word-break: break-word; }
.dump-image-missing { color: var(--text-3); font-size: 12px; }

/* Asset page */
.back-link { margin-bottom: 16px; font-size: 13px; }
.asset-stage {
  margin: 0 0 24px;
  padding: 28px;
  border-radius: var(--radius);
  text-align: center;
  background: var(--recess);
  border: 2px solid var(--gold);
}
.asset-stage img { max-width: min(100%, 520px); max-height: 72vh; object-fit: contain; }
.asset-stage-portrait img { max-height: 78vh; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.meta-grid div {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--plate);
  border-color: var(--border);
}
.meta-grid dd { margin-top: 6px; font-size: 13px; }
.meta-grid dd code { font-family: var(--font-mono); font-size: 12px; }

/* Compare */
.compare-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--bar-2); }
.compare-form select {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.compare-form select:focus-visible { outline-offset: 1px; }
.compare-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.compare-stat {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  min-width: 120px;
  background: var(--plate);
}
.compare-stat span { display: block; }
.compare-stat strong { display: block; font-family: var(--font-display); font-style: normal; font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.compare-stat-arrow { display: flex; align-items: center; font-size: 1.4rem; color: var(--text-3); border: none; background: none; min-width: auto; box-shadow: none; }
.compare-stat-added strong { color: var(--green); }
.compare-stat-removed strong { color: var(--red); }

.code-list { list-style: none; display: grid; gap: 6px; font-family: var(--font-mono); font-size: 12px; }
.code-list code { color: var(--text-2); word-break: break-all; }

.empty-state, .empty-inline {
  color: var(--text-3);
  font-family: var(--font-body);
  font-style: normal;
  font-size: 1rem;
  padding: 22px 0;
  text-align: center;
}
.empty-inline { padding: 8px 0; text-align: left; font-size: 0.95rem; }

/* Footer */
.site-footer {
  border-top: none;
  padding: 8px 12px 80px;
  color: var(--text-3);
  font-size: 12px;
}
.site-footer-inner {
  max-width: var(--max);
  width: min(calc(100% - 24px), var(--max));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.footer-links { display: flex; gap: 14px; }
.footer-links a { color: var(--link); }

/* Login */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel {
  width: min(100%, 420px);
  padding: 0 0 24px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
}
.login-panel::before {
  content: 'HoH Tools';
  display: block;
  background: var(--bar);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 10px 16px;
  margin-bottom: 8px;
}
.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 22px 0;
}
.login-brand h1 { font-family: var(--font-display); font-style: normal; font-size: 1.45rem; font-weight: 700; color: var(--link); }
.login-brand p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.login-form { display: grid; gap: 14px; padding: 0 22px; }
.login-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bar-2);
}
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  font-size: 14px;
  font-weight: 400;
}
.login-form input:focus { border-color: var(--bar); box-shadow: 0 0 0 3px var(--accent-dim); outline: none; }
.form-error {
  color: var(--red);
  font-size: 13px;
  margin: 0 22px 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  border-radius: var(--radius-xs);
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: var(--overlay);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 64px 72px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; max-width: min(92vw, 900px); }
.lightbox img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.lightbox figcaption {
  margin-top: 12px;
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 700;
  font-size: 15px;
  color: var(--link);
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  border: 1px solid var(--tile-border);
  background: var(--bar);
  color: #fff;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.lightbox-close { top: 16px; right: 16px; width: 40px; height: 40px; font-size: 22px; }
.lightbox-prev, .lightbox-next { top: 50%; width: 44px; height: 44px; font-size: 28px; transform: translateY(-50%); }
.lightbox-prev { left: 16px; } .lightbox-next { right: 16px; }
.lightbox-open { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--gold-3); font-size: 13px; }
body.lightbox-open { overflow: hidden; }

/* Mobile dock */
.mobile-dock {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: 58px;
  border-top: 3px solid var(--nav-border);
  background-color: var(--nav);
  background-image: url("nav-texture.svg");
  background-size: 128px 128px;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.3);
}
.mobile-dock::before { display: none; }
.mobile-dock a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
}
.mobile-dock a.is-active { color: #fff; }
.mobile-dock a.is-active .dock-icon {
  color: var(--gold-2);
}
.dock-icon { font-size: 16px; line-height: 1; letter-spacing: 0; text-transform: none; }

.hide-mobile { display: initial; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding-bottom: 8px; }
  .gallery-layout { grid-template-columns: 1fr; }
  .version-rail { position: static; max-height: none; }
  .stat-row > div { padding-right: 20px; margin-right: 20px; }
}

@media (max-width: 720px) {
  body { padding-bottom: 64px; padding-top: calc(var(--header-h) + 10px); }
  .site-header {
    width: 100%;
    left: 0;
    transform: none;
    border-radius: 0 0 12px 12px;
  }
  .site-main { width: calc(100% - 16px); }
  .wiki-frame-body { padding: 14px 12px 18px; }
  .hide-mobile { display: none !important; }
  .nav-toggle { display: inline-flex; }
  .site-nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    gap: 0;
    padding: 8px 10px 12px;
    background-color: var(--nav);
    background-image: url("nav-texture.svg");
    border-bottom: 3px solid var(--nav-border);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  .site-nav.is-open .site-nav-links { display: flex; }
  .nav-pill {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
  }
  .nav-pill.is-active { box-shadow: inset 3px 0 0 var(--gold-2); background: rgba(0, 0, 0, 0.18); }
  .mobile-dock { display: flex; }
  .release-row, .release-card { grid-template-columns: 1fr; }
  .lightbox { padding: 56px 12px 72px; }
  .search-input { font-size: 16px; }
  .hero-title, .page-head h1 { font-size: clamp(1.55rem, 7vw, 2rem); }
  .stat-row > div {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--rule);
    flex: 1 1 40%;
  }
  .stat-row > div:last-child { border-bottom: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
