/* ============ AFK Knight — styles ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #12141c;
  --bg-panel: #1b1e2a;
  --bg-panel-2: #232738;
  --border: #343a52;
  --text: #e8ecf6;
  --text-dim: #9aa3bf;
  --gold: #ffd45e;
  --hp: #5fd068;
  --xp: #7ab8ff;
  --accent: #c9a227;

  /* T30 — width of the framed game window when it hits its ≤50vh ceiling on short windows:
     display height = width × 9/16, so "frame (incl. its 6px border) ≤ 50% of viewport height"
     becomes this width cap. Reused below by .game-frame and the health/inventory blocks. */
  --frame-cap-w: calc((50vh - 6px) * 16 / 9 + 6px);
}

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 500px at 50% -10%, #232841 0%, transparent 60%),
    var(--bg-deep);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  display: flex;
  justify-content: center;
  padding: 18px 14px 30px;
}

/* T30 — the page may grow past the old 1000 px cap up to 80% of the viewport (≈10% blank each side
   when able). Below ~1253 px viewports max() resolves back to 1000px, so small-window shrinking is
   bit-identical to before. */
.page { width: 100%; max-width: max(1000px, 80vw); }

.masthead { text-align: center; margin-bottom: 12px; }
.masthead h1 {
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 2px 0 #000, 0 0 24px rgba(255, 212, 94, .25);
}
.tagline { color: var(--text-dim); font-style: italic; margin-top: 2px; }

/* ---------- game frame ---------- */
.game-frame {
  position: relative;
  border: 3px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), inset 0 0 60px rgba(0, 0, 0, .25);
  background: #000;
}
#game { display: block; width: 100%; height: auto; }

.hidden { display: none !important; }

/* ---------- HUD chips ---------- */
.hud { position: absolute; left: 0; right: 0; pointer-events: none; }
.hud-top { top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px; gap: 8px; }

.chip {
  background: rgba(14, 16, 24, .78);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(3px);
}
.chip em { color: var(--text-dim); font-style: normal; font-size: 12px; }

.mode-chip b, .mode-chip span { color: #d9f7c9; }

/* T15 — difficulty chip inside the mode chip */
.diff-chip {
  font-size: 10.5px; letter-spacing: .45px; text-transform: uppercase;
  color: #a8d4ff; background: rgba(74, 134, 216, .18);
  border: 1px solid rgba(74, 134, 216, .6);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}

.hud-right { display: flex; gap: 8px; align-items: flex-start; }

.xpbar {
  width: 130px; height: 8px; border-radius: 4px;
  background: #101320; overflow: hidden; border: 1px solid #000;
}
.xpfill { height: 100%; width: 0%; background: linear-gradient(90deg, #4a86d8, var(--xp)); transition: width .25s; }

.gold-chip span { color: var(--gold); font-weight: bold; font-size: 15px; }

/* ---------- rest overlay ---------- */
.rest-overlay {
  position: absolute; inset: 0;
  background: rgba(8, 9, 14, .55);
  display: flex; align-items: center; justify-content: center;
}
.rest-card {
  text-align: center;
  background: var(--bg-panel);
  border: 2px solid #6b4a2b;
  border-radius: 14px;
  padding: 22px 34px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .6);
}
.rest-emoji { font-size: 42px; animation: flicker 1.2s infinite alternate; }
@keyframes flicker { from { opacity: .75; transform: scale(.98); } to { opacity: 1; transform: scale(1.04); } }
.rest-card h2 { margin: 6px 0 4px; color: #ffcf8a; font-size: 22px; }
.rest-card p { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; }
.restbar {
  width: 260px; height: 14px; border-radius: 7px; overflow: hidden;
  background: #101320; border: 1px solid #000;
}
.restfill { height: 100%; width: 0%; background: linear-gradient(90deg, #d88a3c, var(--gold)); }

/* ---------- game over overlay ---------- */
.gameover-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(640px 320px at 50% 42%, rgba(122, 34, 28, .48), rgba(6, 7, 12, .84));
  display: flex; align-items: center; justify-content: center;
}
.gameover-card {
  text-align: center;
  background: var(--bg-panel);
  border: 2px solid #a3402f;
  border-radius: 16px;
  padding: 24px 36px 22px;
  box-shadow: 0 8px 34px rgba(0, 0, 0, .7), 0 0 42px rgba(255, 90, 50, .14);
}
.gameover-emoji { font-size: 46px; animation: dragonPulse 1.6s infinite alternate; }
@keyframes dragonPulse { from { opacity: .8; transform: scale(.97) rotate(-3deg); } to { opacity: 1; transform: scale(1.05) rotate(2deg); } }
.gameover-card h2 { margin: 6px 0 4px; color: #ff8d6e; font-size: 22px; letter-spacing: .5px; }
.gameover-card p { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; max-width: 340px; }
.gameover-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#riseAgainBtn { background: linear-gradient(180deg, #7a5c1e, #5d4514); border-color: #a37f2b; font-weight: bold; }
.go-secondary { background: transparent; border-color: var(--border); color: var(--text-dim); }
.go-secondary:hover { color: var(--text); filter: none; }

/* ---------- T6 victory overlay (slain the Elder Dragon) ---------- */
.victory-overlay {
  background: radial-gradient(640px 320px at 50% 42%, rgba(122, 96, 28, .5), rgba(6, 7, 12, .84));
}
.victory-card {
  border-color: #a37f2b;
  box-shadow: 0 8px 34px rgba(0, 0, 0, .7), 0 0 42px rgba(255, 212, 94, .18);
}
.victory-card h2 { color: #ffd45e; }
/* T16: Ascend is the golden choice; Restart sits back as .go-secondary */
#ascendBtn {
  background: linear-gradient(180deg, #7a5c1e, #5d4514); border-color: #a37f2b;
  font-weight: bold;
}

/* ---------- paused chip ---------- */
.paused-chip {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(14, 16, 24, .85);
  border: 1px solid var(--border);
  padding: 10px 22px; border-radius: 12px;
  font-size: 18px; letter-spacing: 2px; color: var(--text-dim);
}

/* ---------- toasts ---------- */
.toasts { position: absolute; top: 56px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  background: rgba(14, 16, 24, .9);
  border: 1px solid var(--accent);
  color: #ffe9a8;
  padding: 6px 16px; border-radius: 999px;
  font-size: 13px; font-weight: bold;
  animation: toastIn 2.4s forwards;
}
@keyframes toastIn {
  0%   { opacity: 0; transform: translateY(-8px) scale(.9); }
  12%  { opacity: 1; transform: none; }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(6px); }
}

/* ---------- controls ---------- */
.controls {
  margin-top: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
}

.hp-block { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hp-label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.hpbar {
  flex: 1; height: 18px; border-radius: 9px; overflow: hidden;
  background: #101320; border: 1px solid #000;
}
.hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #2f9e45, var(--hp)); transition: width .2s; }
#hpText { font-size: 13px; color: var(--text-dim); min-width: 78px; text-align: right; font-style: normal; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
button {
  font-family: inherit;
  background: linear-gradient(180deg, #3a4160, #2b3049);
  color: var(--text);
  border: 1px solid #4a5378;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform .06s, filter .12s;
}
button:hover { filter: brightness(1.18); }
button:active { transform: translateY(1px) scale(.99); }
button b { color: var(--gold); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; } // T12: greys out the Eat button (and any future gated action)
/* #advanceBtn retired with T10 — its gold styling lives on in .buy-btn */
.secondary { font-size: 13px; padding: 9px 11px; }
.ghost { background: transparent; border-color: transparent; color: #6d7590; font-size: 12px; padding: 9px 8px; }
.ghost:hover { color: var(--text-dim); filter: none; }

.stats-line { color: var(--text-dim); font-size: 12.5px; text-align: center; }
.stats-line b { color: var(--text); }

/* ---------- shop ---------- */
.shop-overlay { position: fixed; inset: 0; background: rgba(6, 7, 12, .7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.shop-card {
  width: min(480px, 94vw);
  background: var(--bg-panel-2);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 18px 20px 14px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, .7);
}
.shop-head { display: flex; justify-content: space-between; align-items: center; }
.shop-head h2 { font-size: 19px; color: var(--gold); letter-spacing: 1px; }
#closeShopBtn { padding: 4px 10px; font-size: 15px; line-height: 1; }
.shop-sub { color: var(--text-dim); margin-bottom: 12px; }
.shop-sub b { color: var(--gold); }

.shop-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.shop-info h3 { font-size: 14.5px; margin-bottom: 3px; }
.shop-info p { color: var(--text-dim); font-size: 12.5px; }
.shop-info b { color: var(--text); }
.lvl-tag { font-size: 11px; color: #8fd0ff; background: rgba(127, 184, 255, .12); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }

.buy-btn { white-space: nowrap; min-width: 92px; background: linear-gradient(180deg, #7a5c1e, #5d4514); border-color: #a37f2b; font-weight: bold; }
.buy-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.shop-foot { text-align: center; color: var(--text-dim); font-size: 11.5px; margin-top: 4px; }

/* ---------- camp hub (T9) — one screen replaces the old rest + shop overlays ---------- */
.camp-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 7, 12, .8);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 18px; overflow-y: auto;
}
.camp-card {
  width: min(940px, 96vw);
  background: var(--bg-panel-2);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 16px 18px 12px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, .7);
}
.camp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.camp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.camp-col h3 { font-size: 15px; margin-bottom: 6px; }
.camp-col > p:not(.shop-foot) { color: var(--text-dim); font-size: 12.5px; margin-bottom: 8px; min-height: 16px; }
.camp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.camp-list { list-style: none; padding: 0; margin: 10px 0 4px; max-height: 236px; overflow-y: auto; }
.camp-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px; margin-bottom: 6px;
  font-size: 13px;
}
.camp-row .camp-action { min-width: 78px; font-size: 12.5px; padding: 5px 9px; }
.camp-empty { color: var(--text-dim); font-style: italic; font-size: 12.5px; padding: 4px 2px; }

/* ---------- zone map (T10) — all travel happens here, gated by boss defeats ---------- */
.map-title { margin: 14px 0 6px; font-size: 13.5px; color: var(--text-dim); }
.map-list { max-height: none; margin-top: 2px; }
.map-row-btn {
  width: 100%; display: block; text-align: left;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); font-size: 12.5px; padding: 6px 10px;
  border-radius: 8px; margin-bottom: 6px; cursor: pointer;
}
.map-row-btn:hover { border-color: var(--accent); }
.map-current { background: rgba(201, 162, 39, .14); border-color: var(--accent); font-weight: bold; color: var(--gold); }
.map-locked { opacity: .55; }

/* ---------- inventory & equipment panel (T4) ---------- */
.inv-panel {
  margin-top: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px 14px;
}

.inv-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.inv-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 999px;
}
.inv-tab:hover { color: var(--text); filter: none; }
.inv-tab.active {
  background: linear-gradient(180deg, #7a5c1e, #5d4514);
  border-color: #a37f2b;
  color: #ffe9a8;
  font-weight: bold;
}

.inv-body { min-height: 96px; }
.inv-empty { color: var(--text-dim); font-style: italic; font-size: 13px; text-align: center; padding: 14px 4px; }

#invList {
  list-style: none;
  max-height: 236px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding-right: 4px;
}
.inv-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
}
.inv-row.kind-weapon  { border-left: 3px solid #d8b25a; }
.inv-row.kind-armor   { border-left: 3px solid var(--xp); }
.inv-row.kind-trinket { border-left: 3px solid #c98fff; }
.inv-row.kind-food    { border-left: 3px solid var(--hp); }
.inv-row.kind-junk    { border-left: 3px solid #6d7590; }

.inv-icon { flex: 0 0 auto; width: 24px; text-align: center; }
.inv-name { font-weight: bold; white-space: nowrap; }
.inv-qty { color: var(--gold); margin-left: 5px; font-style: normal; }
.inv-stats {
  flex: 1; min-width: 0;
  color: var(--text-dim); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-value { color: var(--gold); font-size: 12.5px; white-space: nowrap; }

.inv-act {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.equip-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.slot-label { flex: 0 0 auto; width: 74px; color: var(--text-dim); font-size: 12.5px; }
.equip-name { white-space: nowrap; }
.equip-empty { color: #6d7590; font-style: italic; }

/* T7 — rolled affix detail lines (equipment tab + held gear in the bag) */
.equip-aff {
  margin: -2px 0 8px 82px;
  font-size: 11.5px; color: #d8b25a; letter-spacing: .3px;
}
.inv-aff { color: #d8b25a; font-size: 11.5px; white-space: nowrap; }
.gear-line { margin-top: 8px; text-align: center; color: var(--text-dim); font-size: 12.5px; }

/* T24 — shift+hover compare tooltip (held gear vs what's equipped in its slot) */
.inv-hint { margin: 0 2px 8px; font-size: 11.5px; color: var(--text-dim); font-style: italic; }
.cmp-tip {
  position: fixed; z-index: 60; pointer-events: none;
  min-width: 316px; max-width: 440px;
  background: rgba(19, 22, 34, .97);
  border: 1px solid var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55), 0 0 0 3px rgba(201, 162, 39, .1);
  border-radius: 10px; padding: 8px 12px 10px;
  font-size: 12.5px; line-height: 1.45;
}
.cmp-head { color: var(--gold); font-weight: bold; letter-spacing: .4px; margin-bottom: 6px; }
.cmp-grid {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr) 52px;
  column-gap: 10px; row-gap: 2px; align-items: baseline;
}
.cmp-colhead {
  color: var(--text-dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--border); padding-bottom: 3px; margin-bottom: 2px;
}
.cmp-this-h, .cmp-this-n { color: var(--gold); }
.cmp-name { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.cmp-lab { color: var(--text-dim); font-size: 11.5px; }
.cmp-val, .cmp-delta { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-this-v { color: #f2f5ff; }
.cmp-delta.better { color: var(--hp); font-weight: bold; }
.cmp-delta.worse  { color: #ff7a6b; font-weight: bold; }
.cmp-delta.same   { color: var(--text-dim); }

/* ---------- T28 — DOS event log (matrix green on black) ---------- */
/* flex-start (not stretch): the frame keeps its natural canvas-driven height, and fitLog() pins
   #combatLog to that exact height on boot/resize — so new lines scroll inside the panel instead of
   stretching the row taller (which would show black under the canvas). */
.game-row {
  display: flex; align-items: flex-start; gap: 10px;
  justify-content: center; /* T30: when the 50vh cap below shrinks the frame, keep game+log centered in the page */
}
/* canvas is width:100% + height:auto (intrinsic 960x540 = 16:9), so it shares the row instead of owning
   the full width. T30 cap: the framed window must never take more than 50% of the browser's vertical space —
   since display height = width x 9/16, that is enforced as a width ceiling derived from 50vh (--frame-cap-w). */
.game-frame { flex: 1 1 auto; min-width: 0; max-width: var(--frame-cap-w); }
/* T30 follow-up: the health row + inventory panel below must never be wider than the game+log block
   combined — frame cap + 10px gap + 284px DOS log. Centered, so when the ceiling engages their edges line
   up exactly with the centered game+log group; on tall windows the expression exceeds page width and they
   keep spanning it as before. */
.controls, .inv-panel { max-width: calc(var(--frame-cap-w) + 294px); margin-left: auto; margin-right: auto; }

.dos-log {
  flex: 0 0 284px; width: 284px;
  display: flex; flex-direction: column;
  background: #040704; /* near-black, green-tinted — the phosphor tube */
  border: 2px solid #1d5c31;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), inset 0 0 46px rgba(69, 224, 107, .08);
  overflow: hidden; position: relative;
}
.dos-log::after { /* CRT scanlines over the whole panel (pointer-transparent) */
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0px, rgba(0, 0, 0, .28) 1px, transparent 1px, transparent 3px);
}
.dos-log-title {
  background: #7dffab; color: #040704; /* inverted-video header strip */
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold; font-size: 12.5px; letter-spacing: 2px; text-transform: uppercase;
  padding: 5px 10px;
}
.dos-log-body {
  flex: 1 1 auto; min-height: 0; /* fixed-height parent (fitLog): scroll inside, never grow */
  overflow-y: auto; overflow-x: hidden;
  font-family: 'Courier New', Courier, monospace; /* the 80s DOS terminal face */
  font-size: 12.5px; line-height: 1.4;
  color: #45e06b; padding: 8px 10px;
}
.dos-log-body::-webkit-scrollbar { width: 9px; }
.dos-log-body::-webkit-scrollbar-track { background: #040704; }
.dos-log-body::-webkit-scrollbar-thumb { background: #1d5c31; border-radius: 4px; }

.log-enc { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed rgba(69, 224, 107, .2); } /* one group per encounter */
.log-line { color: #45e06b; }
.log-spawn { color: #7dffab; }
.log-loot  { color: #7dffab; }
.log-boss  { color: #d2ffdc; font-weight: bold; }
.log-hit   { color: #45e06b; }
.log-crit  { color: #d2ffdc; font-weight: bold; }
.log-over  { color: #d2ffdc; font-weight: bold; } /* the hidden proc — same top tier, no explanation */
.log-mitig { color: #d2ffdc; font-weight: bold; } /* T31 — parry/block/dodge calls (same tier as crits) */
.log-hurt  { color: #35a852; } /* slightly dimmer — the knight taking one */
.log-dot   { color: #d97b45; } /* T35 fix — brimstone gnaw blows (the air itself is the enemy): ember tone, no mob involved */
.log-food  { color: #7dffab; }
.log-kill  { color: #7dffab; }
.log-death { color: #35a852; font-style: italic; }

@media (max-width: 760px) {
  .game-row { flex-direction: column; } /* stack the log below the game on narrow screens */
  .dos-log { width: 100%; height: 200px; }
}

/* ---------- footnote ---------- */
.footnote { margin-top: 12px; text-align: center; color: #6d7590; font-size: 12px; }

@media (max-width: 640px) {
  .chip { font-size: 11px; padding: 5px 8px; }
  .xpbar { width: 84px; }
  button { font-size: 12.5px; padding: 8px 10px; }
}

/* ================= T53/T54 — account chip, slot menu, name claim, leaderboard =============
   All of this chrome lives outside the canvas and is inert until site-config.js is configured,
   so an unconfigured guest deploy never renders any of it (the markup ships empty/hidden). */
.masthead { position: relative; }
.masthead-right { position: absolute; top: 4px; right: 0; display: flex; gap: 8px; align-items: center; }

.acct-chip { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 999px;
             color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
             padding: 5px 12px; font-size: 13px; }
.acct-chip.guest { opacity: .94; }
.acct-chip.guest:hover { opacity: 1; border-color: var(--accent); }
.acct-glyph { font-size: 14px; }
.acct-btn { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit;
            display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.acct-avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); display: block; }
.acct-name { font-weight: 700; max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-status { font-size: 11px; color: var(--text-dim); font-style: normal; }

.slot-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(360px, 92vw);
             background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px;
             box-shadow: 0 14px 34px rgba(0,0,0,.5); text-align: left; }
.slot-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
            padding: 7px 8px; border-radius: 9px; }
.slot-row.active { background: rgba(255,212,94,.07); outline: 1px solid rgba(255,212,94,.22); }
.slot-info b { font-size: 13px; }
.slot-meta { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.slot-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.slot-acts { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 9px; margin-top: 7px; border-top: 1px solid var(--border); }
.slot-menu button.danger, .slot-acts button.danger { color: #ffb3ab; border-color: #6b2f34; }

.name-dialog-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(6,8,14,.74);
                    display: flex; align-items: center; justify-content: center; padding: 16px; }
.name-dialog { width: min(430px, 94vw); background: var(--bg-panel); border: 1px solid var(--border);
               border-radius: 14px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.55); }
.name-dialog h3 { margin: 0 0 6px; font-size: 17px; }
.name-dialog p { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; }
#nameInput { width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 9px;
             border: 1px solid var(--border); background: #12151f; color: var(--text); font-size: 15px; }
.name-help { font-size: 12px; margin: 8px 0 0 !important; }
.name-help.bad { color: #ff8a80; }
.name-btns { display: flex; justify-content: flex-end; margin-top: 14px; }

/* --- the roll of honour (T54): rank · icon · nickname · highest tier · metres marched --- */
.lb-panel { max-width: calc(var(--frame-cap-w) + 294px); margin: 14px auto 0; background: var(--bg-panel);
            border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lb-head h2 { margin: 0; font-size: 16px; letter-spacing: .2px; }
.lb-scope { color: var(--text-dim); font-weight: 400; font-size: 13px; }
.lb-updated { font-size: 11.5px; color: var(--text-dim); font-style: normal; white-space: nowrap; }
.lb-rows { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-row { display: grid; grid-template-columns: 54px 30px minmax(0, 1fr) minmax(0, auto) minmax(86px, auto);
          gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; }
.lb-row:nth-child(odd) { background: rgba(255,255,255,.02); }
.lb-row.me { outline: 1px solid rgba(122,184,255,.45); background: rgba(122,184,255,.09); }
.lb-row.top1 .lb-rank { color: var(--gold); }
.lb-rank { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-icon { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.lb-avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); display: block; }
.lb-crest { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
            font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.65); }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-tier { color: var(--text-dim); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-dist { text-align: right; font-variant-numeric: tabular-nums; color: var(--gold); white-space: nowrap; }
.lb-status { margin: 12px 0 2px; color: var(--text-dim); font-size: 13px; }
.lb-foot { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); }

@media (max-width: 760px) { .lb-panel { max-width: none; } }
@media (max-width: 640px) {
  .masthead-right { position: static; justify-content: center; margin-top: 10px; }
  .slot-menu { left: 50%; right: auto; transform: translateX(-50%); }
  .lb-row { grid-template-columns: 42px 26px minmax(0, 1fr) minmax(0, auto) auto; gap: 8px; font-size: 12.5px; padding: 5px 6px; }
  .lb-tier { font-size: 11px; }
}

