/* ═══════════════════════════════════════════════════════════════
   BEANGAME — new components (stats, armoury explorer, leaderboard,
   screenshots, tooltips). Sits on top of base.css.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --wire: #3d9bff;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
html, body { overflow-x: clip; }
button { color: inherit; }

/* ── Sprites ─────────────────────────────────────────────────── */
img.sprite {
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 0;       /* animated textures are vertical strips: show frame 1 */
}
.sprite--label {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, #2f2923 0 4px, #29241f 4px 8px);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 214, 0.14);
  overflow: hidden;
}
.sprite--label span {
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.1;
  text-align: center;
  color: var(--muted);
  padding: 2px;
  word-break: break-word;
}

/* ── Minecraft text colours (§ codes) ────────────────────────── */
.mc-0 { color: #3a3a3a; } .mc-1 { color: #4a4ae0; } .mc-2 { color: #22b322; } .mc-3 { color: #1fb8b8; }
.mc-4 { color: #d63a3a; } .mc-5 { color: #c13cc1; } .mc-6 { color: #ffaa00; } .mc-7 { color: #b5b5b5; }
.mc-8 { color: #7a7a7a; } .mc-9 { color: #7d7dff; } .mc-a { color: #55ff55; } .mc-b { color: #55ffff; }
.mc-c { color: #ff6464; } .mc-d { color: #ff6bff; } .mc-e { color: #ffff6b; } .mc-f { color: #ffffff; }
.mc-l { font-weight: 700; } .mc-o { font-style: italic; } .mc-n { text-decoration: underline; }
.mc-m { text-decoration: line-through; } .mc-k { filter: blur(2.5px); }

/* ── Data badge ──────────────────────────────────────────────── */
.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--ink-800);
}
.data-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: #c9a227; box-shadow: 0 0 10px #c9a227; }
.data-badge.is-live .data-badge__dot { background: #4bd16a; box-shadow: 0 0 10px #4bd16a; animation: live 1.8s ease-in-out infinite; }
@keyframes live { 50% { opacity: 0.35; } }
.data-badge.is-offline .data-badge__dot { background: #e0553a; box-shadow: 0 0 10px #e0553a; }

/* ── Big stat strip ──────────────────────────────────────────── */
.bigstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.bigstats li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
}
.bigstats b {
  font-family: var(--font-display);
  font-weight: var(--w-display-lg);
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  line-height: 1;
  color: var(--orange-bright);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.bigstats span { font-size: 0.93rem; color: var(--text); line-height: 1.35; }
.bigstats small { font-family: var(--font-mono); font-size: 0.72rem; color: var(--dim); }

/* ── Meta map ────────────────────────────────────────────────── */
.metamap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-800);
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 26px;
}
.metamap__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
  margin-bottom: 18px;
}
.metamap__title { font-family: var(--font-display); font-weight: var(--w-display); font-size: 1.45rem; margin: 0 0 2px; }
.metamap__sub { font-size: 0.92rem; color: var(--muted); margin: 0; max-width: 62ch; }
.metamap__toggle, .chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.metamap__toggle input, .chk input { accent-color: var(--orange); width: 16px; height: 16px; }

.metamap__plot {
  position: relative;
  height: clamp(340px, 52vw, 540px);
  margin: 6px 6px 26px 30px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 20%,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 10% 100%;
}
.quad {
  position: absolute;
  max-width: 40%;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--dim);
  pointer-events: none;
}
.quad b {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.quad--tl { top: 12px; left: 14px; }
.quad--tr { top: 12px; right: 14px; text-align: right; }
.quad--tr b { color: var(--orange-bright); }
.quad--bl { bottom: 12px; left: 14px; }
.quad--br { bottom: 12px; right: 14px; text-align: right; }
.axis {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--dim);
  pointer-events: none;
}
.axis--x { right: 0; bottom: -24px; }
.axis--y { left: -28px; top: 0; transform-origin: 0 0; transform: rotate(-90deg) translate(-100%, 0); white-space: nowrap; }
.mline { position: absolute; pointer-events: none; border: 0 dashed rgba(255, 164, 107, 0.35); }
.mline--v { top: 0; bottom: 0; border-left-width: 1px; }
.mline--h { left: 0; right: 0; border-top-width: 1px; }

.dot {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: 0 0 -15px -15px;
  padding: 3px;
  border: 0;
  border-radius: 7px;
  background: rgba(22, 19, 15, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 236, 214, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  z-index: 1;
}
.dot .sprite { width: 100%; height: 100%; }
.dot:hover, .dot:focus-visible {
  transform: scale(1.55);
  background: var(--ink-700);
  box-shadow: 0 0 0 2px var(--orange), 0 8px 20px rgba(0, 0, 0, 0.6);
  z-index: 3;
  outline: none;
}

/* ── Ranked lists ────────────────────────────────────────────── */
.ranks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
.rank {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-800);
  padding: 20px 18px 14px;
}
.rank header { margin-bottom: 10px; padding-inline: 6px; }
.rank h3 { font-family: var(--font-display); font-weight: var(--w-display); font-size: 1.2rem; margin: 0; }
.rank header p { margin: 0; font-size: 0.84rem; color: var(--muted); }
.rank ol { list-style: none; margin: 0; padding: 0; }
.rrow {
  display: grid;
  grid-template-columns: 22px 28px minmax(0, 1.3fr) minmax(50px, 1fr) 56px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rrow:hover, .rrow:focus-visible { background: var(--ink-750); outline: none; }
.rrow__n { font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); text-align: right; }
.rrow .sprite { width: 28px; height: 28px; }
.rrow__name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow__bar, .xpbar {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: var(--ink-700);
  overflow: hidden;
}
.rrow__bar i, .xpbar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-deep), var(--orange-bright));
}
.rrow__v { font-family: var(--font-mono); font-size: 0.8rem; text-align: right; color: var(--orange-soft); font-variant-numeric: tabular-nums; }
.stats-foot { max-width: 760px; margin: 0 auto 30px; text-align: center; font-size: 0.86rem; color: var(--dim); }
.stats-foot b { color: var(--muted); }

[data-bar] {
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Class cards (now buttons that filter the armoury) ───────── */
.grid-classes { margin-bottom: 38px; }
button.class-card {
  display: block;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.class-card__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--ink-700);
  color: var(--mc-lite, var(--muted));
}
.class-card__stats {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--dim);
}
.class-card__stats b { font-family: var(--font-mono); color: var(--text); margin-right: 3px; }
.class-card.is-on {
  border-color: var(--mc);
  box-shadow: 0 0 0 1px var(--mc), 0 10px 40px -12px var(--mc);
}

/* ── Explorer ────────────────────────────────────────────────── */
.explorer { scroll-margin-top: 90px; }
.explorer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-800);
  margin-bottom: 12px;
}
.search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--ink-900);
  border: 1px solid var(--line);
}
.search:focus-within { border-color: var(--orange); }
.search svg { width: 17px; height: 17px; color: var(--dim); flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}
.explorer select {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--ink-900);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.explorer__count { margin-left: auto; font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); }

.explorer__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--ink-800);
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-on {
  color: var(--ink-900);
  background: var(--mc, var(--orange));
  border-color: transparent;
  font-weight: 600;
}

.itemgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
  min-height: 200px;
}
.itemgrid__empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 50px 0; }
.icard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-800);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.icard:hover, .icard:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 164, 107, 0.45);
  background: var(--ink-750);
  outline: none;
}
.icard__art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 60%, rgba(242, 101, 34, 0.18), transparent 70%), #1d1915;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.4), inset -2px -2px 0 rgba(255, 255, 255, 0.05);
}
.icard__art .sprite { width: 44px; height: 44px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }
.icard__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.icard__cls { display: flex; gap: 4px; min-height: 8px; }
.icard__cls i { width: 8px; height: 8px; border-radius: 2px; background: var(--mc); }
.icard__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.66rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.icard__stats b { display: block; font-family: var(--font-mono); font-size: 0.84rem; color: var(--text); letter-spacing: 0; }
.icard.is-retired { opacity: 0.62; }
.icard__flag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--dim);
}
.explorer__more { display: flex; margin: 22px auto 0; }
/* Component display rules (like the one above) would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

/* ── Minecraft tooltip ───────────────────────────────────────── */
.mctt {
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(16, 1, 16, 0.94);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 0 0 2px #1b0533, inset 0 0 0 1px #4d1aa8;
  font-size: 0.88rem;
  line-height: 1.45;
}
.mctt__name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; margin: 0 0 6px; }
.mctt__line { display: block; color: #aaa; }
.mctt__meta { display: block; margin-top: 8px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--orange-soft); }
.mctip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 140;
  max-width: 330px;
  pointer-events: none;
}
.mctip[hidden] { display: none; }

/* ── Item dialog ─────────────────────────────────────────────── */
.itemdlg {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--ink-850);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
}
.itemdlg::backdrop { background: rgba(5, 4, 3, 0.72); backdrop-filter: blur(4px); }
.itemdlg__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--ink-750);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.itemdlg__close:hover { background: var(--ink-700); }
.dlg {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 22px 26px;
  padding: 30px;
}
.dlg__art {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 26px 12px 16px;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 40%, rgba(242, 101, 34, 0.22), transparent 65%), var(--ink-800);
}
.sprite--xl { width: 128px !important; height: 128px !important; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
.dlg__mat { margin: 0; font-family: var(--font-mono); font-size: 0.7rem; color: var(--dim); text-align: center; }
.dlg__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dstat {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink-800);
  border: 1px solid var(--line);
}
.dstat__l { font-size: 0.74rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.dstat__v { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.dstat__r { font-family: var(--font-mono); font-size: 0.7rem; color: var(--orange-soft); }
.dlg__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.tag {
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--muted);
}
.tag--on { color: #8be08b; border-color: rgba(139, 224, 139, 0.35); }
.tag--food { color: #c2e07a; border-color: rgba(194, 224, 122, 0.35); }
.dlg__date { margin-left: auto; font-family: var(--font-mono); font-size: 0.74rem; color: var(--dim); }

/* ── Leaderboard ─────────────────────────────────────────────── */
.head {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--hs);
  height: var(--hs);
  border-radius: calc(var(--hs) / 6);
  background: linear-gradient(150deg, var(--orange-bright), var(--orange-deep));
  overflow: hidden;
  image-rendering: pixelated;
}
.head::before {
  content: attr(data-letter);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--hs) * 0.5);
  color: var(--ink-900);
}
.head img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 26px;
}
.pod {
  position: relative;
  flex: 0 1 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--ink-750), var(--ink-800));
  text-align: center;
}
.pod--1 {
  padding-top: 44px;
  padding-bottom: 34px;
  border-color: rgba(255, 196, 0, 0.45);
  background: radial-gradient(circle at 50% 0%, rgba(255, 196, 0, 0.18), transparent 60%), linear-gradient(180deg, var(--ink-750), var(--ink-800));
  box-shadow: 0 20px 60px -20px rgba(255, 170, 0, 0.45);
}
.pod__rank {
  position: absolute;
  top: -14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  background: #8a8f99;
  color: var(--ink-900);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.pod--1 .pod__rank { background: #ffc400; }
.pod--3 .pod__rank { background: #cd7f32; }
.pod__name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 4px 0 0; word-break: break-all; }
.pod__lvl { display: flex; align-items: baseline; gap: 6px; margin: 0; }
.pod__lvl span { font-family: var(--font-pixel); font-size: 0.62rem; color: var(--muted); text-transform: uppercase; }
.pod__lvl b { font-family: var(--font-display); font-size: 2.3rem; line-height: 1; color: var(--orange-bright); }
.pod--1 .pod__lvl b { font-size: 3rem; color: #ffc400; }
.pod .xpbar { width: 100%; }
.pod__xp { margin: 0; font-family: var(--font-mono); font-size: 0.72rem; color: var(--dim); }

.lbtable {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 820px;
  display: grid;
  gap: 6px;
}
.lbrow {
  display: grid;
  grid-template-columns: 34px 28px minmax(0, 1fr) minmax(80px, 200px) 64px;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--ink-800);
  border: 1px solid var(--line);
}
.lbrow__n { font-family: var(--font-mono); font-size: 0.8rem; color: var(--dim); }
.lbrow__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow__lvl { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; text-align: right; color: var(--orange-soft); }
.lbrow__lvl small { font-family: var(--font-pixel); font-size: 0.55rem; color: var(--dim); margin-right: 3px; }
.lb__foot { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 20px; }
.lb__total { margin: 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); }

/* ── Screenshots ─────────────────────────────────────────────── */
.shots__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  height: clamp(380px, 46vw, 560px);
}
.shot {
  position: relative;
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--ink-800);
}
.shot--wide { grid-row: span 2; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot figcaption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(10, 9, 8, 0.78);
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── HUD ─────────────────────────────────────────────────────── */
.hud {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.hud__log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 300px;
}
.hud__row {
  display: flex;
  gap: 8px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(10, 9, 8, 0.78);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: hudIn 0.25s ease-out;
}
.hud__row:nth-child(n+4) { opacity: 0.55; }
.hud__row b { font-weight: 700; }
.hud__row span { overflow: hidden; text-overflow: ellipsis; }
@keyframes hudIn { from { opacity: 0; transform: translateY(6px); } }
.hud__ctl {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(16, 14, 12, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}
.hud__ctl button {
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}
.hud__ctl button:hover { background: var(--ink-700); color: var(--text); }
.hud__ctl button[hidden] { display: none; }
.hud__ctl button.is-cta { background: var(--wire); color: #fff; font-weight: 600; }
.hud__ctl button.is-cta:hover { background: #5aaeff; }
.hud__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
}
.hud__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wire); box-shadow: 0 0 8px var(--wire); animation: live 1s infinite; }
.is-site-built .hud__dot { background: #4bd16a; box-shadow: 0 0 8px #4bd16a; animation: none; }
.is-site-built .hud__log { opacity: 0; transition: opacity 1.2s 2s; }
.no-build .hud__log { display: none; }
.buildbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 110;
  pointer-events: none;
}
.buildbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--wire), #8cc8ff);
  box-shadow: 0 0 10px var(--wire);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.6s ease, opacity 0.8s 1s;
}
.is-site-built .buildbar span { opacity: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .bigstats { grid-template-columns: repeat(2, 1fr); }
  .ranks { grid-template-columns: 1fr; }
  .dlg { grid-template-columns: 1fr; padding: 24px 18px; }
  .dlg__art { grid-row: auto; flex-direction: row; justify-content: center; padding: 18px; }
  .sprite--xl { width: 84px !important; height: 84px !important; }
  .dlg__stats { grid-template-columns: repeat(2, 1fr); }
  .shots__grid { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
  .shot { aspect-ratio: 16 / 9; }
  .shot--wide { grid-row: auto; }
}
@media (max-width: 620px) {
  .podium { flex-direction: column; align-items: stretch; }
  .pod--1 { order: -1; }
  .lbrow { grid-template-columns: 26px 28px minmax(0, 1fr) 54px; }
  .lbrow .xpbar { display: none; }
  .itemgrid { grid-template-columns: repeat(2, 1fr); }
  .hud__log { display: none; }
  .hud { right: 10px; bottom: 10px; }
  .metamap__plot { margin-left: 22px; }
  .quad { font-size: 0.68rem; }
  .quad span, .quad { max-width: 46%; }
  .explorer__count { margin-left: 0; }
  .dot { width: 22px; height: 22px; margin: 0 0 -11px -11px; padding: 2px; border-radius: 5px; }
  .data-badge { border-radius: 12px; text-align: left; }
  .axis--y { display: none; }
}

.no-build #hudCursors { display: none; }

/* Phones: the full HUD stays while the build runs (so Skip is easy to hit); once the page is
   built it shrinks to one small round button (↻ rebuild, or ▶ watch it build when it's off),
   so it isn't sitting on top of the text. The button text stays for screen readers. */
@media (max-width: 620px) {
  .is-site-built .hud__status,
  .is-site-built #hudCursors { display: none; }
  .is-site-built .hud__ctl { padding: 3px; border-radius: 999px; }
  .is-site-built #hudReplay:not([hidden]) {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    color: var(--text);
  }
  .is-site-built #hudReplay::before { content: '\21BB'; font-size: 1.2rem; line-height: 1; }
  .no-build #hudReplay::before { content: '\25B6\FE0E'; font-size: 0.85rem; padding-left: 2px; }
}
/* No keyboard on touch screens, so no "Esc" hint. */
@media (hover: none) and (pointer: coarse) {
  .hud__ctl kbd { display: none; }
}

.hud__ctl kbd {
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--dim);
}

/* ── Items page (items.html) ─────────────────────────────────── */
.page-head { padding-top: calc(clamp(72px, 11vw, 128px) + 48px); padding-bottom: clamp(40px, 5vw, 60px); }
#browse { padding-block: clamp(36px, 5vw, 56px) clamp(56px, 8vw, 96px); }
.page-head .section__head { margin-bottom: clamp(30px, 4vw, 44px); }
.page-head .eyebrow--badge { margin-bottom: 20px; }
.page-head__title { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.page-head .b-ruler { top: 72px; }

.jumps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.jumps a {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--ink-800);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.jumps a:hover { color: var(--text); border-color: var(--orange-soft); background: rgba(242, 101, 34, 0.1); }

#browse, #classes, #meta { scroll-margin-top: 0; }
#ranks { scroll-margin-top: 96px; }
.nav__links a[aria-current="page"]:not(.btn) { color: var(--text); box-shadow: inset 0 -2px 0 var(--orange); padding-bottom: 4px; }

/* ── Items teaser (index.html) ───────────────────────────────── */
.items-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 30px;
}
@media (max-width: 640px) {
  .items-cta .btn { flex: 1 1 100%; justify-content: center; }
}
