/* The RS3 client's own UI faces, pulled from the player's cache by the asset build. */
@font-face { font-family: 'RS Cinzel'; src: url('assets/fonts/cinzel-bold.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'RS Cinzel Light'; src: url('assets/fonts/cinzel.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'RS Sans'; src: url('assets/fonts/noto.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'RS Sans'; src: url('assets/fonts/noto-bold.ttf') format('truetype'); font-weight: bold; font-display: swap; }

:root {
  --serif: 'RS Cinzel', 'Palatino Linotype', Georgia, serif;
  --gold: #ffcb3d;
  --gold-dim: #b88a1b;
  --panel: rgba(20, 16, 12, .88);
  --panel-edge: #5c4a2c;
  --text: #f1e6c8;
  --muted: #a69a7c;
  --hp: #c92a2a;
  --hp-back: #3a1010;
  --xp: #3bb2f0;
  --danger: #ff5a4a;
}

html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0b0a09; color: var(--text);
  font-family: 'RS Sans', "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
[hidden] { display: none !important; }
button {
  font: inherit; color: var(--text); background: linear-gradient(#4a3a22, #2c2214);
  border: 1px solid var(--gold-dim); border-radius: 4px; padding: 8px 18px; cursor: pointer;
}
button:hover { border-color: var(--gold); color: #fff; }

/* ── screens ── */
.screen {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 16px; box-sizing: border-box; text-align: center;
}
.screen h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 5.4vw, 58px); letter-spacing: 1px;
  color: var(--gold); text-shadow: 0 3px 0 #000, 0 0 24px rgba(255, 170, 40, .35); }
.screen h1 em { font-style: normal; color: #fff; }
.screen h2 { margin: 0; font-family: var(--serif); color: var(--gold); font-size: 28px; text-shadow: 0 2px 0 #000; }
.screen .sub { margin: 0; color: var(--text); }
.screen .keys { margin: 0; color: var(--muted); font-size: 13px; }
/* Loading screen: killer painterly backdrop + branded wordmark + progress bar. */
#loading {
  background: url('assets/ui/loading.webp') center / cover no-repeat, #070605;
  justify-content: flex-end; padding-bottom: 10vh; gap: 20px;
}
#loading::before { content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(5,3,2,0.35) 0%, rgba(5,3,2,0.65) 60%, rgba(5,3,2,0.95) 100%); }
#loading > * { position: relative; z-index: 1; }
#loading h1 { font-size: clamp(42px, 6.5vw, 82px); letter-spacing: 2px;
  text-shadow: 0 4px 0 #000, 0 0 32px rgba(255, 170, 40, .55); margin-bottom: 4px; }
#loading #loadtext { font-family: var(--serif); color: #e8c99f; letter-spacing: 2px; font-size: 14px;
  text-transform: uppercase; }
#loading .bar { width: min(420px, 80vw); height: 8px; background: #2a2218; border-radius: 4px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#title { background: linear-gradient(rgba(0,0,0,.15), transparent 40%, rgba(0,0,0,.75)); justify-content: flex-end; padding-bottom: 6vh; }
#title h1 { position: absolute; top: 6vh; left: 0; right: 0; }
#title .sub { position: absolute; top: calc(6vh + clamp(44px, 7.5vw, 80px)); left: 0; right: 0; }

/* ── polish wave: bossbar portrait, logo plate, signature chip, hero hilite ── */
#bossbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
#bossportrait { width: 54px; height: 54px; border-radius: 50%; object-fit: cover;
  object-position: 50% 20%; border: 2px solid var(--gold-dim); box-shadow: 0 0 12px #000; flex: none; }
#bossbar > span { font-family: var(--serif); color: var(--gold); font-size: 15px; letter-spacing: 1px; }
#bossbar > div { flex: 1; height: 10px; background: #0a0806; border: 1px solid #000;
  border-radius: 4px; overflow: hidden; }
#bossbar > div > i { display: block; height: 100%; background: linear-gradient(90deg, #b8200f, #ff7e3d); }

/* Title wordmark: screen-blend drops the white background of the plate PNG so only the
   ornate gold frame and dark panel land on the dark title backdrop. */
#title h1 { position: relative; display: inline-block; padding: 24px 70px 28px;
  background: url('assets/ui/plate.webp') center / 100% 100% no-repeat;
  mix-blend-mode: screen;
  text-shadow: 0 3px 0 #000, 0 0 24px rgba(255, 170, 40, .55); }
#title h1 em { color: #fff; font-style: normal; }

/* Hero summary: slim single-column card. Trait + signature ability shown as descriptive
   lines (name in gold serif, then em-dash and the plain-English effect). */
#hcard .hmeta { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 8px;
  text-align: center; }
#hcard .hmeta .trait, #hcard .hmeta .sig {
  padding: 5px 10px; border: 1px solid var(--panel-edge); border-radius: 5px;
  background: #0b090688; font-size: 12px; line-height: 1.35; color: #d8c8a0;
  letter-spacing: 0.2px; }
#hcard .hmeta .trait b { color: var(--gold); font-family: var(--serif);
  letter-spacing: 1px; text-transform: uppercase; margin-right: 4px; }
#hcard .hmeta .sig b { color: #fff; font-family: var(--serif);
  letter-spacing: 1px; text-transform: uppercase; margin-right: 4px; }
#hcard .bestline { margin: 6px 0 2px; font-size: 11.5px; color: var(--muted); }
#hcard .bestline b { color: var(--gold); font-family: var(--serif); }

/* Skin toggle row on hero card */
#hcard .skinrow { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.skinbtn { padding: 4px 12px; font-size: 11.5px; letter-spacing: 1px;
  background: linear-gradient(#2a2219, #15110a); border: 1px solid #6a5230;
  border-radius: 4px; color: #d8c8a0; cursor: pointer; }
.skinbtn.on { border-color: var(--gold); color: var(--gold); background: linear-gradient(#4a3220, #2a1c0e); }
.skinbtn:hover { border-color: var(--gold); }
#hcard .skinrow small { font-size: 11px; color: var(--muted); font-style: italic; }

/* Alt-skin override for the hero picker thumbnails when active */
#heroes .hero[data-skin="alt"][data-hero="knight"] { background-image: url('assets/ui/skins/knight.webp'); }
#heroes .hero[data-skin="alt"][data-hero="archer"] { background-image: url('assets/ui/skins/archer.webp'); }
#heroes .hero[data-skin="alt"][data-hero="mage"] { background-image: url('assets/ui/skins/mage.webp'); }
#heroes .hero[data-skin="alt"][data-hero="necromancer"] { background-image: url('assets/ui/skins/necromancer.webp'); }
#heroes .hero[data-skin="alt"][data-hero="tzhaar_ket"] { background-image: url('assets/ui/skins/tzhaar_ket.webp'); }
#heroes .hero[data-skin="alt"][data-hero="vannaka"] { background-image: url('assets/ui/skins/vannaka.webp'); }
#heroes .hero[data-skin="alt"][data-hero="swashbuckler"] { background-image: url('assets/ui/skins/swashbuckler.webp'); }
#heroes .hero[data-skin="alt"][data-hero="gnome_archer"] { background-image: url('assets/ui/skins/gnome_archer.webp'); }
#heroes .hero[data-skin="alt"][data-hero="crossbow_dwarf"] { background-image: url('assets/ui/skins/crossbow_dwarf.webp'); }
#heroes .hero[data-skin="alt"][data-hero="dragon_hunter"] { background-image: url('assets/ui/skins/dragon_hunter.webp'); }
#heroes .hero[data-skin="alt"][data-hero="druid"] { background-image: url('assets/ui/skins/druid.webp'); }
#heroes .hero[data-skin="alt"][data-hero="dagonhai_zealot"] { background-image: url('assets/ui/skins/dagonhai_zealot.webp'); }
#heroes .hero[data-skin="alt"][data-hero="barrows_wight"] { background-image: url('assets/ui/skins/barrows_wight.webp'); }
#heroes .hero[data-skin="alt"][data-hero="vyrelord"] { background-image: url('assets/ui/skins/vyrelord.webp'); }
.modal { background: rgba(0, 0, 0, .62); }
.buttons { display: flex; gap: 12px; }

/* ── hero picker ── */
#heroes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero {
  width: 190px; padding: 12px; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 6px; cursor: pointer; text-align: left; transition: transform .1s, border-color .1s;
}
.hero:hover, .hero.on { border-color: var(--gold); transform: translateY(-3px); }
.hero b { display: block; color: var(--gold); font-size: 17px; }
.hero .style { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.hero p { margin: 6px 0 0; font-size: 13px; line-height: 1.35; }

/* ── level-up cards ── */
#cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 980px; }
.card {
  width: 250px; min-height: 150px; padding: 14px; background: var(--panel); border: 2px solid var(--panel-edge);
  border-radius: 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px;
  transition: transform .1s, border-color .1s;
}
.card:hover { border-color: var(--gold); transform: translateY(-4px); }
.card .head { display: flex; align-items: center; gap: 10px; }
.card .icon { width: 40px; height: 40px; flex: none; border-radius: 6px; display: grid; place-items: center;
  font-size: 22px; background: #000a; border: 1px solid #0006; image-rendering: pixelated; }
.card .icon img { width: 36px; height: 36px; image-rendering: auto; }
.card b { color: var(--gold); font-size: 16px; }
.card .lvl { font-size: 12px; color: var(--muted); }
.card .new { color: #7dff8a; font-size: 12px; font-weight: bold; }
.card p { margin: 0; font-size: 13.5px; line-height: 1.4; }
.card .num { color: var(--muted); font-size: 12px; margin-top: auto; }

/* ── HUD, in the RS3 client's interface chrome ── */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

/* the shared RS3 panel look: dark steel, thin double edge, gold small-caps header */
.rsframe { background: linear-gradient(180deg, #2b3138ee, #1d2126ee); border: 1px solid #0b0d0f;
  box-shadow: 0 0 0 1px #434c55 inset, 0 6px 18px #000a; border-radius: 3px; }
.rsframe > header { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 8px 2px; background: linear-gradient(180deg, #3b434c, #262b31);
  border-bottom: 1px solid #0b0d0f; box-shadow: 0 1px 0 #434c55; }
.rsframe > header b { font-family: var(--serif); font-weight: 700; font-size: 12.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: #e7c66b; text-shadow: 0 1px 0 #000; }
.rsframe > header .x { color: #d64541; font-size: 15px; line-height: 1; cursor: pointer; pointer-events: auto;
  text-shadow: 0 1px 0 #000; }

/* minimap panel, top right */
#mapframe { position: absolute; right: 10px; top: 10px; width: 202px; }
#mapframe header span { font-size: 12px; font-weight: bold; color: #ffffff; text-shadow: 0 1px 0 #000; }
#mapwrap { position: relative; padding: 7px; }
#minimap { display: block; width: 186px; height: 186px; border-radius: 8px; border: 1px solid #0b0d0f;
  box-shadow: 0 0 0 1px #434c55, 0 0 22px #000 inset; background: #11150f; }
#compass { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; border-radius: 10px;
  background: #1d2126; border: 1px solid #434c55; display: grid; place-items: center;
  font-size: 11px; font-weight: bold; color: #e7c66b; text-shadow: 0 1px 0 #000; }
#mapstats { display: flex; justify-content: center; gap: 18px; padding: 1px 8px 4px; font-size: 14px;
  font-weight: bold; text-shadow: 0 1px 0 #000; }
#kills::before { content: "\2620  "; color: var(--muted); }
#gold { color: var(--gold); }
#gold::after { content: " gp"; color: var(--gold-dim); font-size: 12px; }
#nextboss { padding: 0 8px 5px; text-align: center; font-size: 11.5px; color: var(--muted);
  text-shadow: 0 1px 0 #000; font-family: var(--serif); letter-spacing: .5px; }

/* the Wilderness' due: pact stacks as debuff icons, top left */
#buffbar { position: absolute; left: 10px; top: 10px; display: flex; gap: 5px; }
#buffbar .buff { position: relative; width: 32px; height: 32px; border-radius: 4px; background: #000c;
  border: 1px solid #8c2e22; box-shadow: 0 0 6px #b03a2a66; display: grid; place-items: center;
  pointer-events: auto; }
#buffbar .buff img { width: 28px; height: 28px; filter: sepia(.4) saturate(1.4) hue-rotate(-18deg); }
#buffbar .buff small { position: absolute; right: 0; bottom: -1px; font-size: 10px; font-weight: bold;
  color: #ff8a70; text-shadow: 0 1px 0 #000; }

/* chat panel, bottom left */
#chatframe { position: absolute; left: 10px; bottom: 10px; width: min(392px, 60vw); }
#chatframe.min #chatlog { display: none; }
#chatlog { height: 128px; overflow-y: auto; padding: 5px 9px; font-size: 12.5px; line-height: 1.5;
  display: flex; flex-direction: column; justify-content: flex-end; }
#chatlog p { margin: 0; text-shadow: 0 1px 0 #000; color: #e8e4da;
  display: block; background: none; border: 0; padding: 0; } /* shields chat lines from page-wide class styles */
#chatlog p.lvl { color: #ffffff; }
#chatlog p.drop { color: #ff981f; }
#chatlog p.ach { color: #ffd24a; }
#chatlog p.pact { color: #ff6a50; }
#chatlog p.sys { color: #9fb8c8; }

/* action bar, bottom centre */
#actionbar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  padding: 6px 10px 7px; display: flex; flex-direction: column; gap: 6px; }
#bars { display: flex; gap: 8px; }
.abar { position: relative; width: 190px; height: 17px; background: #121518; border: 1px solid #0b0d0f;
  box-shadow: 0 0 0 1px #434c55; border-radius: 2px; overflow: hidden; }
.abar i { position: absolute; inset: 0; width: 100%; transform-origin: left; }
.abar.hp i { background: linear-gradient(180deg, #d9574a, #8c1a12); }
.abar.xp i { background: linear-gradient(180deg, #4aa3e0, #1f5f8c); }
.abar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px;
  font-weight: bold; color: #fff; text-shadow: 0 1px 1px #000, 0 0 3px #000; }

/* toasts sit under the minimap now */
#toasts { position: fixed; right: 12px; top: 300px; z-index: 30; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none; max-width: min(340px, 80vw); }
.toast { background: var(--panel); border: 1px solid var(--panel-edge); border-left: 3px solid var(--gold-dim);
  border-radius: 5px; padding: 9px 14px; font-size: 13.5px; line-height: 1.4; opacity: 0;
  transform: translateX(24px); transition: opacity .35s, transform .35s; box-shadow: 0 4px 14px #000a; }
.toast.in { opacity: 1; transform: none; }
.toast.gold { border-left-color: var(--gold); }
.toast.drop { border-left-color: #7dff8a; }
.toast b { color: var(--gold); }
.toast .pts { color: var(--gold); font-weight: bold; }
.toast small { color: var(--muted); }

/* the row of hand actions under the level-up cards */
#handrow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#handrow button small { display: block; font-size: 11px; color: var(--muted); }
#handrow button.on { border-color: var(--danger); color: #ffb0a8; }
#handrow button:disabled { opacity: .45; cursor: default; }
#cards.banishing .card { border-color: #7a2a20; }
#cards.banishing .card:hover { border-color: var(--danger); }
#hpbar { position: absolute; left: 50%; top: calc(50% + 34px); width: 64px; height: 7px; margin-left: -32px;
  background: var(--hp-back); border: 1px solid #000; }
#hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(#ff6b5a, var(--hp)); }
#slots { display: flex; gap: 10px; justify-content: center; }
#slots > div { display: flex; gap: 5px; }
.slot { width: 38px; height: 38px; border-radius: 4px; background: #15181b; border: 1px solid #0b0d0f;
  box-shadow: 0 0 0 1px #434c55; display: grid; place-items: center; font-size: 18px; position: relative;
  pointer-events: auto; }
.slot img { width: 32px; height: 32px; }
.slot small { position: absolute; right: 2px; bottom: 0; font-size: 10px; font-weight: bold;
  color: #e7c66b; text-shadow: 0 1px 0 #000; }
.slot .cd { position: absolute; inset: 0; border-radius: 3px; pointer-events: none; }
#passives .slot { border-color: #26321f; box-shadow: 0 0 0 1px #46543c; }
#bossbar { position: absolute; left: 50%; top: 12px; width: min(520px, 56vw); transform: translateX(-50%); text-align: center; }
#bossbar span { font-weight: bold; color: #ffb37a; text-shadow: 0 2px 0 #000; font-family: var(--serif); letter-spacing: 1px; }
#bossbar div { height: 12px; background: #2a0d0d; border: 1px solid #000; margin-top: 3px;
  box-shadow: 0 0 0 1px #434c55; border-radius: 2px; overflow: hidden; }
#bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(#ff7e3d, #b3200f); }
#pausebtn { position: absolute; right: 220px; top: 10px; pointer-events: auto; padding: 4px 10px; font-weight: bold; }

/* damage numbers */
#numbers { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
#numbers div { position: absolute; font-weight: bold; font-size: 15px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000;
  transform: translate(-50%, -50%); white-space: nowrap; will-change: transform, opacity; }
#numbers div.crit { color: var(--gold); font-size: 19px; }
#numbers div.hurt { color: var(--danger); }
#numbers div.heal { color: #7dff8a; }
#numbers div.info { color: var(--gold); font-size: 18px; }
#hcard { pointer-events: auto; width: min(380px, 100%); text-align: center;
  margin-top: auto; padding: 10px 14px 14px; }
#stick { position: fixed; z-index: 11; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%;
  border: 2px solid #fff5; background: #0003; pointer-events: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; background: #fff6; }

#pausestats, #overstats { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 6px;
  padding: 12px 18px; min-width: 260px; text-align: left; line-height: 1.6; }
#pausestats td, #overstats td { padding: 0 10px 0 0; }

@media (max-width: 640px) {
  #heroes { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .hero { width: auto; padding: 8px; }
  .hero p { display: none; }
  #title .keys { display: none; }
  .card { width: 88vw; min-height: 0; }
}

/* ── Title layout: absolute-positioned panels hug the viewport edges so the 3D hero
   fills the entire middle of the frame. No grid; each region is pinned. ── */
#title { padding: 0; justify-content: flex-start; gap: 0; }
#title h1 { position: absolute; top: 2vh; left: 50%; transform: translateX(-50%);
  margin: 0; z-index: 3; font-size: clamp(26px, 4.2vw, 46px); }
#titlegrid { display: contents; }
#heroes { position: absolute; left: 16px; top: 130px; bottom: 190px;
  width: min(28vw, 440px); overflow-y: auto; z-index: 2; }
#zonecard { position: absolute; right: 16px; top: 130px; bottom: 190px;
  width: min(26vw, 400px); overflow-y: auto; z-index: 2; isolation: isolate; }
#title .keys { position: absolute; left: 0; right: 0; bottom: 4px;
  margin: 0; z-index: 2; pointer-events: none; }
.tpanel { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 8px; padding: 12px; }
#heroes { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; justify-content: flex-start; }
#heroes .hero { position: relative; width: auto; transform: none; }
.hstats { display: flex; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dot { position: absolute; right: -6px; top: -6px; background: #2e7d32; color: #fff; font-style: normal;
  font-size: 11px; font-weight: bold; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid;
  place-items: center; padding: 0 4px; box-shadow: 0 1px 3px #000; }
button .dot, .thead .dot { position: static; margin-left: 6px; }
/* Hero summary flex-ends to the bottom of its grid cell so the 3D hero scene is visible
   above it. The chrome panel still wraps the card. */
/* Hero summary floats centered just above the launch bar. */
#herosummary { position: absolute; left: 50%; bottom: 230px; transform: translateX(-50%);
  z-index: 2; pointer-events: none; width: auto; }
#hcard { pointer-events: auto; width: min(420px, 44vw); text-align: center;
  padding: 10px 16px 12px; margin: 0; }
#hcard .hname { font-family: var(--serif); font-size: 22px; color: var(--gold); }
#hcard .blurb { margin: 6px 0 10px; font-size: 13.5px; }
.eqrow { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.eq { width: 44px; height: 44px; border-radius: 6px; background: #000a; border: 1px solid #44361f;
  display: grid; place-items: center; color: #5c4f38; font-size: 18px; }
.eq.got { border-color: var(--gold-dim); }
.eq img { width: 40px; height: 40px; }
#hcard .buttons { justify-content: center; }
#zonecard { overflow-y: auto; isolation: isolate; }
#zonecard::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 7px;
  background-size: cover; background-position: center; opacity: 0.45; filter: saturate(0.9) contrast(1.05);
  transition: opacity 0.5s ease; }
#zonecard::after { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 7px;
  background: linear-gradient(180deg, rgba(10,8,4,0.55) 0%, rgba(10,8,4,0.85) 100%); }
#zonecard[data-zone="wilderness"]::before { background-image: url('assets/ui/zone-wilderness.webp'); }
#zonecard[data-zone="morytania"]::before { background-image: url('assets/ui/zone-morytania.webp'); }
#zonecard[data-zone="karamja"]::before { background-image: url('assets/ui/zone-karamja.webp'); }
#zonecard[data-zone="daemonheim"]::before { background-image: url('assets/ui/zone-daemonheim.webp'); }
.zname { margin: 0; font-family: var(--serif); color: var(--gold); font-size: 22px; }
.ztag { margin: 2px 0 8px; color: var(--muted); font-style: italic; }
.zdesc { font-size: 13.5px; line-height: 1.45; }
.zenemies { font-size: 12.5px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; border: 1px solid var(--panel-edge); border-radius: 12px; padding: 3px 10px;
  background: #0007; white-space: nowrap; }
.chip.final { border-color: var(--gold-dim); color: var(--gold); }
/* Title-screen buttons use authentic RS3 interface chrome: dark brown weathered wood
   pill with brass rim and gold inner ring. Source asset is 1536x1024 — slice captures
   the end-cap radius so any button width keeps the pill shape. */
#enterbtn, #lbbtn, .secondary, #settingsbtn {
  font-family: var(--serif); font-size: 17px; padding: 10px 44px; letter-spacing: 1.5px;
  background: transparent;
  border-style: solid; border-color: transparent;
  border-width: 24px 60px; border-radius: 0;
  border-image: url('assets/ui/chrome/button.webp') 100 300 fill / 24px 60px / 0 stretch;
  color: #ffe9b8;
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(255, 200, 90, 0.3);
  min-width: 170px; transition: filter .12s, transform .08s; cursor: pointer;
  text-transform: uppercase; }
#enterbtn:hover, #lbbtn:hover, .secondary:hover, #settingsbtn:hover {
  filter: brightness(1.2) saturate(1.2); color: var(--gold); }
#enterbtn:active, #lbbtn:active, .secondary:active, #settingsbtn:active { transform: translateY(1px); }
#enterbtn { font-size: 19px; padding: 12px 48px; min-width: 240px; color: #ffe8c4;
  filter: brightness(1.08) saturate(1.15); }
#enterbtn:hover { filter: brightness(1.3) saturate(1.3); }
#enterbtn small { display: block; font-family: 'RS Sans', sans-serif; font-size: 10.5px;
  letter-spacing: 0.4px; color: #ffd8a0; margin-top: 2px; font-weight: normal;
  white-space: nowrap; text-transform: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

#titlebtns { display: flex; gap: 24px; justify-content: center; align-items: stretch;
  position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%); z-index: 2; }
/* overridden by the unified rule above; keep this line to preserve numbering */
#lbwho { font-size: 13px; position: absolute; left: 50%; bottom: 72px;
  transform: translateX(-50%); z-index: 2; margin: 0; }
#leaderboard { background: rgba(5, 4, 3, .92); gap: 10px; padding: 3vh 2vw; justify-content: flex-start; }
#leaderboard h2 { font-family: var(--serif); color: var(--gold); font-size: 30px; }
#lb-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  width: min(900px, 94vw); padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--panel-edge); border-radius: 8px; }
#lb-head select, #lb-head input { font-family: 'RS Sans', sans-serif; font-size: 13px;
  background: #0b0906; color: var(--text); border: 1px solid #4a3a24; border-radius: 5px; padding: 5px 8px; }
#lb-head input.bad { border-color: var(--danger); }
#lb-head .lb-name { display: inline-flex; align-items: center; gap: 6px; }
#lb-head .lb-off { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
#lb-rows { width: min(900px, 94vw); max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 8px; padding: 2px 6px; }
#lb-rows table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
#lb-rows th { font-family: var(--serif); color: var(--gold); font-weight: normal;
  text-transform: uppercase; letter-spacing: 1px; font-size: 11px; padding: 8px 6px;
  border-bottom: 1px solid var(--panel-edge); position: sticky; top: 0; background: var(--panel); }
#lb-rows td { padding: 5px 6px; border-bottom: 1px solid #1a140b; }
#lb-rows tr.won td:last-child { color: var(--gold); }
#lb-rows tr.me td { color: var(--gold); background: #1a110600; }
#lb-rows tr.me { background: linear-gradient(90deg, #2a1a0855, transparent); }
#lbresult { font-size: 13px; margin-top: 6px; color: var(--text); }
#lbresult b { color: var(--gold); }
.lb-result { padding: 6px 10px; }

/* ── end-of-run banner (death / victory) ── */
#over { background: rgba(0, 0, 0, .5); gap: 0; padding: 0; justify-content: center; align-items: stretch; }
#over .overbanner { width: 100%; max-width: min(1400px, 96vw); margin: 0 auto; aspect-ratio: 3/1;
  background-size: cover; background-position: center; border-radius: 10px;
  border: 1px solid #000; box-shadow: 0 0 60px #000c; position: relative; overflow: hidden; }
#over .overbanner::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(5,4,3,0.95) 100%); }
#over .overbody { max-width: min(1400px, 96vw); margin: -70px auto 0; padding: 0 30px 24px;
  position: relative; z-index: 2; text-align: center; }
#over h2 { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 48px); margin: 0 0 8px;
  text-shadow: 0 2px 6px #000, 0 0 20px #000; }
#over.win h2 { color: var(--gold); }
#over.loss h2 { color: #c7e3a8; }
#over.win .overbanner { background-image: url('assets/ui/victory.webp'); }
#over.loss .overbanner { background-image: url('assets/ui/death.webp'); }
#over #overstats table { margin: 0 auto; }
#over .buttons { justify-content: center; margin-top: 14px; }
#over #sharebtn { background: linear-gradient(#2a2219, #15110a); border: 1px solid #6a5230; color: var(--gold); }
#over #sharebtn:hover { border-color: var(--gold); }

/* ── juice: screenshake, hit-pause, low-HP vignette ── */
@keyframes shake { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-4px, 3px); }
  40% { transform: translate(5px, -2px); } 60% { transform: translate(-3px, -4px); } 80% { transform: translate(4px, 2px); } }
.shake { animation: shake 0.16s ease-out; }
.shake-strong { animation: shake 0.32s ease-out; animation-iteration-count: 2; }
@keyframes hpPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 0.75; } }
#lowhp { position: fixed; inset: 0; pointer-events: none; z-index: 10;
  box-shadow: inset 0 0 180px 40px rgba(180, 20, 20, 0.55); opacity: 0; transition: opacity 0.4s ease; }
#lowhp.on { opacity: 1; animation: hpPulse 1.2s ease-in-out infinite; }
#hitpause { position: fixed; inset: 0; pointer-events: none; background: #fff;
  opacity: 0; z-index: 11; transition: opacity 0.06s linear; }
#hitpause.flash { opacity: 0.18; }

/* ── settings modal ── */
#settings { background: rgba(5, 4, 3, .92); gap: 14px; justify-content: flex-start; padding: 3vh 2vw; }
#settings h2 { font-family: var(--serif); color: var(--gold); font-size: 30px; }
.setpanel { width: min(520px, 94vw); background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: 14px; }
.setrow span { font-family: var(--serif); color: var(--text); letter-spacing: 0.5px; }
.setrow input[type="range"] { flex: 1; max-width: 260px; accent-color: var(--gold); }
.setrow input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); }

/* Colorblind palette: swap red cues (low-HP vignette, telegraphs tinted via class) to blue. */
body.cb #lowhp { box-shadow: inset 0 0 180px 40px rgba(60, 100, 220, 0.55); }
body.cb #over.loss h2 { color: #a7cff2; }

/* ── hero portraits ── */
#heroes .hero { padding-left: 60px; min-height: 56px; background-size: 56px auto;
  background-position: left center; background-repeat: no-repeat; background-color: #0b0906; }
#heroes .hero[data-hero="knight"] { background-image: url('assets/ui/portraits/knight.webp'); }
#heroes .hero[data-hero="archer"] { background-image: url('assets/ui/portraits/archer.webp'); }
#heroes .hero[data-hero="mage"] { background-image: url('assets/ui/portraits/mage.webp'); }
#heroes .hero[data-hero="necromancer"] { background-image: url('assets/ui/portraits/necromancer.webp'); }
#heroes .hero[data-hero="tzhaar_ket"] { background-image: url('assets/ui/portraits/tzhaar_ket.webp'); }
#heroes .hero[data-hero="vannaka"] { background-image: url('assets/ui/portraits/vannaka.webp'); }
#heroes .hero[data-hero="swashbuckler"] { background-image: url('assets/ui/portraits/swashbuckler.webp'); }
#heroes .hero[data-hero="gnome_archer"] { background-image: url('assets/ui/portraits/gnome_archer.webp'); }
#heroes .hero[data-hero="crossbow_dwarf"] { background-image: url('assets/ui/portraits/crossbow_dwarf.webp'); }
#heroes .hero[data-hero="dragon_hunter"] { background-image: url('assets/ui/portraits/dragon_hunter.webp'); }
#heroes .hero[data-hero="druid"] { background-image: url('assets/ui/portraits/druid.webp'); }
#heroes .hero[data-hero="dagonhai_zealot"] { background-image: url('assets/ui/portraits/dagonhai_zealot.webp'); }
#heroes .hero[data-hero="barrows_wight"] { background-image: url('assets/ui/portraits/barrows_wight.webp'); }
#heroes .hero[data-hero="vyrelord"] { background-image: url('assets/ui/portraits/vyrelord.webp'); }
#heroes .hero.on { background-color: #1a110680; border-color: var(--gold-dim); }

/* ── armory ── */
#armory { justify-content: flex-start; background: rgba(5, 4, 3, .88); gap: 10px; padding-top: 2vh; }
#arm-head { width: min(1480px, 96vw); display: flex; align-items: center; gap: 16px; text-align: left; }
#arm-head h2 { font-size: 34px; }
#arm-sub { color: var(--muted); font-size: 13px; }
#arm-tabs { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
#arm-tabs button.on { border-color: var(--gold); color: #fff; background: linear-gradient(#5c4120, #32240f); }
#arm-heroes { width: min(1480px, 96vw); display: flex; gap: 6px; text-align: left; flex-wrap: wrap; }
#arm-heroes button { padding: 5px 12px; font-size: 13px; }
#arm-heroes button.on { border-color: var(--gold); color: var(--gold); }
#arm-body { width: min(1480px, 96vw); flex: 1; min-height: 0; overflow: hidden; text-align: left; display: flex; gap: 14px; }
.arm-empty { margin: auto; color: var(--muted); font-style: italic; }
#arm-body h3 { font-family: var(--serif); color: var(--gold); margin: 10px 0 6px; font-size: 17px; }
.bignum { font-family: var(--serif); font-size: 34px; color: var(--gold); }
.bignum span { font-size: 14px; color: var(--text); font-family: 'RS Sans', sans-serif; }
.meter { height: 7px; background: #241c10; border: 1px solid #000; border-radius: 4px; overflow: hidden; margin: 6px 0; }
.meter i { display: block; height: 100%; background: linear-gradient(#ffd97a, #b8860b); }
.blocked { color: var(--danger); font-size: 12.5px; }

/* talents */
#trees { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; overflow-y: auto; align-content: start; }
.tree { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; }
.thead { display: flex; align-items: center; gap: 8px; }
.thead b { font-family: var(--serif); color: var(--gold); font-size: 16px; }
.thead .tpts { margin-left: auto; color: var(--muted); font-size: 12px; }
.icon { width: 34px; height: 34px; border-radius: 5px; background: #000a; border: 1px solid #0006;
  display: inline-grid; place-items: center; flex: none; }
.icon img { width: 30px; height: 30px; }
.tgrid { display: grid; grid-template-columns: repeat(3, 52px); gap: 9px; justify-content: center; }
.tnode { position: relative; width: 52px; height: 52px; border-radius: 7px; background: #000c;
  border: 1px solid #3a2f1c; padding: 0; display: grid; place-items: center; }
.tnode img { width: 44px; height: 44px; border-radius: 5px; }
.tnode.empty { visibility: hidden; }
.tnode.locked { opacity: .35; }
.tnode.open { border-color: #4e6b36; }
.tnode.open:hover { border-color: #7dff8a; }
.tnode.known { border-color: #6b8f3f; box-shadow: 0 0 7px #4e6b3688; }
.tnode.maxed { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 203, 61, .35); }
.tnode.sel { outline: 2px solid #fff6; }
.tnode small { position: absolute; right: -3px; bottom: -4px; background: #000d; border: 1px solid #40351e;
  border-radius: 4px; font-size: 10px; padding: 0 3px; }
.stones { display: flex; flex-direction: column; gap: 4px; }
.stone { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted);
  cursor: pointer; padding: 3px 4px; border-radius: 5px; }
.stone:hover { background: #ffffff10; }
.stone.lit { color: var(--text); }
.stone.lit b { color: #7dff8a; }
.stone .icon { width: 26px; height: 26px; }
.stone .icon img { width: 22px; height: 22px; }
#tside { width: 290px; flex: none; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 14px; overflow-y: auto; }
.specrow { display: flex; gap: 6px; }
.spec { flex: 1; padding: 5px 4px; font-size: 13px; }
.spec small { display: block; font-size: 10.5px; color: var(--muted); }
.spec.on { border-color: var(--gold); color: var(--gold); }
#t-reset { margin-top: 8px; width: 100%; }
#tdetail { margin-top: 12px; border-top: 1px solid var(--panel-edge); padding-top: 10px; min-height: 130px; }
.dhead { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.dhead b { color: var(--gold); font-size: 15px; }
.xpline { font-size: 12px; color: var(--muted); }

/* collection */
#pieces { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.piece { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 10px 14px; opacity: .75; }
.piece.got { opacity: 1; border-color: #3f5c33; }
.piece .icon { width: 52px; height: 52px; font-family: var(--serif); color: #5c4f38; font-size: 22px; }
.piece .icon img { width: 46px; height: 46px; }
.pbody { display: flex; flex-direction: column; gap: 2px; }
.pbody b { color: var(--gold); }
.pbody .src { font-size: 12px; color: #b08d5a; }
.piece .state { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.piece.got .state { color: #7dff8a; }
#cside { width: 320px; flex: none; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 14px; }
.setbonus { border: 1px solid var(--panel-edge); border-radius: 6px; padding: 8px 10px; font-size: 13px;
  margin: 8px 0; opacity: .7; }
.setbonus.lit { border-color: var(--gold-dim); opacity: 1; }
.setbonus b { color: var(--gold); }

/* achievements */
#acats { width: 280px; flex: none; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.cat { text-align: left; display: flex; justify-content: space-between; }
.cat.on { border-color: var(--gold); color: var(--gold); }
.cat small { color: var(--muted); }
#alist { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ach { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 10px 14px; align-items: center; }
.ach.got { border-color: #6b5420; background: linear-gradient(#2a2115cc, #1d170ecc); }
.abody { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.abody b { color: var(--gold); font-size: 14.5px; }
.abody .unlock { color: #7dff8a; font-size: 12px; }
.ach .pts { font-family: var(--serif); flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--gold-dim); color: var(--gold); display: grid; place-items: center; font-size: 15px; }
.ach:not(.got) .pts { filter: grayscale(.6); opacity: .6; }

/* rewards */
#rside { width: 300px; flex: none; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 14px; }
#rside .buttons { margin: 6px 0; }
#r-wipe.danger { border-color: #8a3a2a; color: #ff9b8a; width: 100%; margin-top: 6px; }
#perks { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px; align-content: start; }
.perk { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: 8px; padding: 12px 14px; }
.perk.locked { opacity: .75; }
.perk.maxed { border-color: #6b5420; }
.perk .icon { width: 42px; height: 42px; align-self: center; }
.perk .icon img { width: 38px; height: 38px; }
.perk .pbody { flex: 1; font-size: 13px; gap: 3px; }
.pip { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--gold-dim);
  margin-left: 3px; vertical-align: 1px; }
.pip.on { background: var(--gold); }
.pbuy { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; justify-content: center; }

/* floating gold numbers */
#numbers div.gold { color: var(--gold); font-size: 13px; }

* { scrollbar-width: thin; scrollbar-color: #5c4a2c transparent; }

@media (max-width: 900px) {
  #title h1 { display: none; }
  #title { padding-top: 8px; }
  #arm-head { flex-wrap: wrap; gap: 8px; }
  #arm-head h2 { font-size: 24px; }
  #arm-tabs { margin-left: 0; order: 3; width: 100%; }
  #arm-tabs button { flex: 1; padding: 6px 2px; font-size: 12.5px; }
  #titlegrid { grid-template-columns: 1fr; overflow-y: auto; }
  #herosummary { order: 3; }
  #heroes { flex-direction: row; flex-wrap: wrap; }
  #heroes .hero { flex: 1 1 40%; }
  #arm-body { flex-direction: column; overflow-y: auto; }
  #trees { grid-template-columns: 1fr; overflow: visible; }
  #tside, #cside, #acats, #rside { width: auto; }
  #alist, #pieces, #perks { overflow: visible; }
}

/* ── rarity cards, tooltips, pacts and the horde panel ── */
#levelup .subtitle, #pact .subtitle { margin: -6px 0 14px; color: var(--muted); font-size: 14px; }
#lvlchip, #pactchip {
  display: inline-block; margin-bottom: 4px; padding: 3px 14px; border: 1px solid var(--gold);
  border-radius: 3px; color: var(--gold); font-family: var(--serif); font-size: 13px;
  letter-spacing: 2px; text-transform: uppercase; background: rgba(0,0,0,.45);
}
#pactchip { border-color: #b03a2a; color: #ff8a70; }
.card { position: relative; width: 252px; min-height: 240px; align-items: center; text-align: center; }
.card .num {
  position: absolute; left: 10px; top: 8px; margin: 0; width: 20px; height: 20px; border-radius: 10px;
  border: 1px solid var(--panel-edge); display: grid; place-items: center; font-size: 11px;
}
.card .new, .card .lvl { position: absolute; right: 10px; top: 9px; }
.card .new { background: #1d4d23; color: #7dff8a; padding: 1px 7px; border-radius: 3px; }
.card .cicon { margin-top: 20px; width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center;
  background: #0d0b08; border: 1px solid var(--panel-edge); box-shadow: 0 0 14px rgba(0,0,0,.6) inset; }
.card .cicon img { width: 48px; height: 48px; }
.card .rarity { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-top: 2px; }
.card .cname { color: var(--gold); font-family: var(--serif); font-size: 18px; line-height: 1.15; }
.card .cbody { font-size: 13px; line-height: 1.45; color: #e8e0d0; }
.card .cdiff { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 12.5px; color: var(--muted); }
.card .cdiff b { color: #7dff8a; }
.card .cbonus { margin: 0; font-size: 13px; font-weight: bold; }
.card .cfoot { margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.07);
  width: 100%; color: var(--muted); font-size: 11.5px; }

.card.r-common { border-color: #5a564c; }
.card.r-common .rarity { color: #cfc9ba; }
.card.r-uncommon { border-color: #2e7d32; box-shadow: 0 0 14px rgba(55,208,44,.12); }
.card.r-uncommon .rarity, .card.r-uncommon .cbonus { color: #4fd24b; }
.card.r-rare { border-color: #2d6fb0; box-shadow: 0 0 16px rgba(61,157,240,.16); }
.card.r-rare .rarity, .card.r-rare .cbonus { color: #58aaf5; }
.card.r-veryrare { border-color: #7b3fb3; box-shadow: 0 0 18px rgba(192,97,255,.2); }
.card.r-veryrare .rarity, .card.r-veryrare .cbonus { color: #c061ff; }
.card.r-ultra { border-color: #c9960c; box-shadow: 0 0 22px rgba(255,191,42,.25); }
.card.r-ultra .rarity, .card.r-ultra .cbonus { color: #ffbf2a; }

#tip {
  position: fixed; z-index: 60; width: 300px; pointer-events: none;
  background: rgba(14, 12, 9, .97); border: 1px solid #6a6150; border-radius: 4px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.45; color: #e8e0d0;
  box-shadow: 0 4px 18px rgba(0,0,0,.7);
}
#tip .thead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
#tip .thead b { color: var(--gold); font-family: var(--serif); font-size: 15px; }
#tip .thead span { color: var(--muted); font-size: 11.5px; }
#tip .tmeta { color: #b7ad99; font-size: 11.5px; margin: 2px 0 6px; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 5px; }
#tip p { margin: 0 0 6px; }
#tip .tnext { color: #ffb347; margin-bottom: 4px; }
#tip .tbonus { color: #7dff8a; margin-bottom: 4px; }
#tip .tcrit { color: var(--muted); }

#pactcards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.card.pactcard { min-height: 130px; border-color: #7a2a20; box-shadow: 0 0 16px rgba(176,58,42,.18); }
.card.pactcard:hover { border-color: #ff6a50; }
.card.pactcard .cname { color: #ff8a70; margin-top: 14px; }

#pausecols { display: flex; gap: 26px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
#pausecols h3 { font-family: var(--serif); color: var(--gold); margin: 0 0 6px; font-size: 15px;
  letter-spacing: 1px; text-transform: uppercase; }
#hordestats { max-width: 340px; font-size: 13px; }
#hordestats .hrate { margin: 0 0 4px; color: #e8e0d0; }
#hordestats .hmods { margin: 0 0 4px; color: #ff8a70; font-size: 12.5px; }
#hordestats .hpacts { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
#hordestats table { border-collapse: collapse; width: 100%; }
#hordestats td { padding: 2px 8px 2px 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
#hordestats td.mname { color: #e8e0d0; text-transform: capitalize; }

@media (max-width: 700px) {
  .card { width: 86vw; min-height: 0; }
  #pausecols { flex-direction: column; align-items: stretch; }
  #tip { display: none; }
  #chatframe { display: none; }
  #mapframe { width: 128px; }
  #minimap { width: 112px; height: 112px; }
  #mapstats { font-size: 12px; gap: 10px; }
  #pausebtn { right: 146px; }
  .abar { width: 120px; }
  #toasts { top: 210px; }
}

/* ── zone and difficulty pickers on the title screen ── */
.ztabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ztab { padding: 4px 10px; font-size: 12.5px; }
.ztab.on { border-color: var(--gold); color: var(--gold); }
.ztab:disabled { opacity: .45; cursor: default; }
.ztab.endless.on { border-color: #c061ff; color: #c061ff; }
.tiers { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.tbtn { padding: 3px 9px; font-size: 11.5px; letter-spacing: .5px; }
.tbtn.on { border-color: #ff8a3c; color: #ff8a3c; }
.tbtn:disabled { opacity: .4; cursor: default; }
.zbests { font-size: 12px; margin: 8px 0 0; }

/* ── worn equipment / stats panel ── */
#equipbtn { position: absolute; right: 262px; top: 10px; pointer-events: auto; padding: 4px 10px; font-size: 15px; }
#equipframe { position: absolute; right: 10px; top: 300px; width: 262px; pointer-events: auto; z-index: 25; }
#equiptabs { display: flex; border-bottom: 1px solid #0b0d0f; }
#equiptabs button { flex: 1; padding: 4px 2px; font-size: 11.5px; background: none; border: 0;
  border-right: 1px solid #0b0d0f; color: var(--muted); cursor: pointer; letter-spacing: .5px; }
#equiptabs button:last-child { border-right: 0; }
#equiptabs button.on { color: #e7c66b; background: #ffffff0d; }
#equipbody { padding: 9px 11px; font-size: 12.5px; max-height: 44vh; overflow-y: auto; }
#equipbody table { width: 100%; border-collapse: collapse; }
#equipbody td { padding: 2.5px 0; color: var(--muted); }
#equipbody td + td { text-align: right; color: #e8e4da; font-weight: bold; }
#equipbody .eqgrid { display: flex; gap: 6px; justify-content: center; margin: 4px 0 8px; }
#equipbody .eqslot { width: 40px; height: 40px; border-radius: 4px; background: #15181b;
  border: 1px solid #0b0d0f; box-shadow: 0 0 0 1px #434c55; display: grid; place-items: center; color: #5a6168; }
#equipbody .eqslot img { width: 34px; height: 34px; }
#equipbody .eqslot.missing { opacity: .4; }
#equipbody .setline { text-align: center; font-size: 11.5px; color: var(--muted); margin: 0 0 8px; }
#equipbody .setline.lit { color: #7dff8a; }
#equipbody .srow { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
#equipbody .srow .icon img { width: 22px; height: 22px; }
#equipbody h4 { margin: 8px 0 3px; font-family: var(--serif); font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: #e7c66b; }
@media (max-width: 700px) { #equipframe { display: none; } #equipbtn { right: 186px; } }

/* ── spell pool tab ── */
.tab-pool { display: flex; gap: 22px; }
#poolside { width: 280px; flex: none; }
#poollist { flex: 1; overflow-y: auto; }
#poollist h3 { font-family: var(--serif); color: var(--gold); margin: 10px 0 6px; }
.poolrow { display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--panel-edge); border-radius: 6px; padding: 8px 12px; margin-bottom: 7px; opacity: .72; }
.poolrow.on { opacity: 1; border-color: #2e5d32; }
.poolrow .icon img { width: 30px; height: 30px; }
.poolrow .pbody { flex: 1; min-width: 0; }
.poolrow .pbody b { color: var(--gold); display: block; }
.poolrow .pbody .muted { font-size: 12px; }
.pstate { font-size: 11.5px; letter-spacing: .5px; white-space: nowrap; }
.pstate.in { color: #7dff8a; }
.pstate.locked { color: #c0564a; }
.poolrow button small { display: block; font-size: 10.5px; color: var(--muted); }
@media (max-width: 900px) { .tab-pool { flex-direction: column; } #poolside { width: auto; } }

/* ── 14-hero character select ── */
/* 14-hero character select — 2-column grid for density, text clipped so names don't bleed. */
#heroes { overflow-x: hidden; padding: 2px 6px 8px 2px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  grid-auto-flow: dense; align-content: start; }
#heroes .hclass { grid-column: 1 / -1; margin: 8px 2px 2px; font-family: var(--serif); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--gold-dim); border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 2px; }
#heroes .hclass:first-child { margin-top: 0; }
#heroes .hero { padding: 8px 12px 8px 82px; min-height: 74px;
  background-size: 72px auto;
  background-position: 4px 15%;        /* top-biased so faces show, not chest armor */
  background-repeat: no-repeat;
  background-color: #0b0906;
  overflow: hidden; }
#heroes .hero b { font-size: 13.5px; line-height: 1.15; letter-spacing: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#heroes .hero .style { font-size: 10.5px; letter-spacing: 0.3px;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
#heroes .hero .htrait { display: block; font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--gold); font-family: var(--serif);
  margin-top: 2px; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#heroes .hstats { gap: 8px; margin-top: 3px; font-size: 11px; }
#heroes .dot { right: 3px; top: 3px; }
#heroes .hero .htrait::before { content: "\2726\00A0"; opacity: 0.75; margin-right: 2px; }
/* ── spell pool filters ── */
#poolsearch { width: 100%; margin: 10px 0 8px; padding: 7px 10px; background: #15181b; color: #e8e0d0;
  border: 1px solid var(--panel-edge); border-radius: 4px; font: inherit; font-size: 13px; }
#poolsearch:focus { outline: none; border-color: var(--gold-dim); }
.pfilter { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.pchip { padding: 3px 9px; font-size: 11.5px; letter-spacing: .3px; }
.pchip.on { border-color: var(--gold); color: var(--gold); }
.pmine { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 12.5px;

  color: var(--muted); cursor: pointer; }
.pmine input { accent-color: #c9960c; }

/* ── meta progression hub (PokéBonk-style tile row above the Enter button) ── */
#metahub { display: flex; gap: 14px; justify-content: center;
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 2; }
/* Meta-progression hub tiles use the dark navy RS3 panel chrome with corner diamonds.
   The source panel is ~1200×1200; border-image slice keeps the corner gems and stretches
   the muddy centre to any tile size without squashing them. */
.hubbtn { display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 108px; min-height: 72px; padding: 6px 10px 4px; gap: 4px;
  font-family: 'RS Sans', sans-serif; color: #ffe9b8;
  background: transparent;
  border: 14px solid transparent; border-radius: 0;
  border-image: url('assets/ui/chrome/panel.webp') 100 fill / 14px / 0 stretch;
  cursor: pointer; transition: filter .12s, transform .1s;
  text-shadow: 0 1px 0 #000; }
.hubbtn:hover { filter: brightness(1.2) saturate(1.15); color: var(--gold); transform: translateY(-2px); }
.hubbtn > span { font-size: 22px; line-height: 1; color: var(--gold); }
.hubbtn > b { font-size: 12px; font-family: var(--serif); letter-spacing: 1px; }
.hubbtn > small { font-size: 10.5px; color: var(--muted); letter-spacing: 0.5px; }
@media (max-width: 540px) {
  #metahub { gap: 4px; }
  .hubbtn { min-width: 0; flex: 1 1 60px; padding: 6px 4px 4px; }
  .hubbtn > b { font-size: 10px; }
  .hubbtn > small { font-size: 9px; }
}
.pstate.sig { color: #c061ff; }

.poolrow .pnums { display: block; font-size: 11.5px; color: #8fd18b; margin-top: 1px; }

.card .cunit { color: #8fd18b; font-size: 12.5px; }

/* ── polish wave 3: weekly modifier banner, daily button, mobile pass ── */
#zonecard .weekly-mod { background: #2a1a08cc; border: 1px solid var(--gold-dim);
  border-radius: 6px; padding: 8px 12px; margin-top: 10px; font-size: 13px; }
#zonecard .weekly-mod b { color: var(--gold); display: block; font-family: var(--serif);
  letter-spacing: 1px; text-transform: uppercase; font-size: 12px; margin-bottom: 2px; }
#zonecard .weekly-mod em { color: #e7c66b; font-style: normal; }
#enterbtn.daily { background: linear-gradient(#4a3220, #2a1c0e); border-color: var(--gold); }
#enterbtn.daily small { color: #ffd97a; }
#dailybtn { margin-left: 6px; }

/* Mobile: stick is already drag-anywhere; shrink HUD + action bar so it fits a phone. */
@media (max-width: 540px) {
  #mapframe { width: 110px; right: 6px; top: 6px; }
  #minimap { width: 94px; height: 94px; }
  #mapstats { font-size: 10.5px; gap: 6px; padding: 1px 4px 3px; }
  #nextboss { font-size: 10px; padding: 0 4px 4px; }
  #actionbar { padding: 4px 6px 5px; bottom: 6px; }
  .abar { width: 36vw; max-width: 180px; height: 15px; }
  #pausebtn, #equipbtn { padding: 3px 7px; font-size: 13px; }
  #titlegrid { grid-template-columns: 1fr; grid-template-rows: auto auto auto; max-height: 70vh; }
  #heroes { max-height: 32vh; }
  #heroes .hero { padding: 5px 8px 5px 60px; min-height: 50px; background-size: 48px auto; }
  #titlebtns { flex-direction: column; width: 100%; align-items: stretch; }
  #titlebtns button { width: 100%; }
  #enterbtn { padding: 10px 14px; font-size: 18px; }
  #over .overbanner { aspect-ratio: 2/1; }
  #over .overbody { margin: -40px auto 0; padding: 0 14px 18px; }
}

/* Make the touch stick more visible on phones so players see the virtual joystick. */
@media (hover: none) and (pointer: coarse) {
  #stick { border-color: #ffcf7acc; background: rgba(0, 0, 0, 0.35); }
  #stick i { background: #ffd97aaa; }
}

/* ── RS3 chrome kit: 9-slice panels only. Buttons keep their original gradient styling. ── */
.tpanel, #hcard, .setpanel, #lb-head, #lb-rows, #pausestats, #overstats,
#equipframe, #mapframe, #chatframe, #actionbar, #bossbar {
  border: 14px solid transparent;
  border-image: url('assets/ui/chrome/panel.webp') 60 fill / 14px 14px 14px 14px / 0 stretch;
  background: transparent;
}
/* Slot frames: ability icons, equipment squares, pact-card icons. */
.eq, .tnode, .cicon, #equipbody .eqslot, #actionbar .slot {
  border: 6px solid transparent;
  border-image: url('assets/ui/chrome/slot.webp') 90 fill / 6px 6px 6px 6px / 0 stretch;
  background: transparent;
}
/* RS3-looking button accents, keep original gradient background from base rule. */
/* RS3 button chrome lives on the base rules above; nothing left to tweak here. */

/* Per-hero stats grid under the hero card */
.hero-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 8px;
  margin: 6px 2px 4px; padding: 7px 10px;
  border: 8px solid transparent;
  border-image: url('assets/ui/chrome/panel.webp') 60 fill / 8px 8px 8px 8px / 0 stretch; }
.hero-stats span { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-stats b { font-family: var(--serif); color: var(--gold); font-size: 15px; line-height: 1; }
.hero-stats small { color: var(--muted); font-size: 10.5px; letter-spacing: 0.5px;
  text-transform: uppercase; margin-top: 2px; }

/* ── Boss intro banner: cinematic black bars + sliding gold text ── */
#bossintro { position: fixed; inset: 0; z-index: 50; pointer-events: none;
  overflow: hidden; }
#bossintro .bar { position: absolute; left: 0; right: 0; background: #000;
  transition: transform .5s cubic-bezier(.6, 0, .3, 1); }
#bossintro .bar.top { top: 0; height: 18vh; transform: translateY(-100%); }
#bossintro .bar.bot { bottom: 0; height: 18vh; transform: translateY(100%); }
#bossintro .body { position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); text-align: center;
  opacity: 0; transition: opacity .4s ease .25s; }
#bossintro .affix { display: block; font-family: var(--serif); font-size: 15px;
  letter-spacing: 6px; color: #ff8c42; text-transform: uppercase;
  margin-bottom: 10px; text-shadow: 0 2px 8px #000; opacity: 0;
  transform: translateY(-14px);
  transition: opacity .5s ease .35s, transform .5s cubic-bezier(.3, 1.5, .5, 1) .35s; }
#bossintro .name { display: block; font-family: var(--serif); font-size: clamp(42px, 7vw, 92px);
  letter-spacing: 4px; color: #ffd77a; margin: 0; line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 4px 0 #000, 0 0 32px rgba(255, 190, 60, .7), 0 0 72px rgba(255, 100, 30, .5);
  -webkit-text-stroke: 1px #4b2e0b;
  opacity: 0; transform: scale(0.86);
  transition: opacity .55s ease .45s, transform .65s cubic-bezier(.2, 1.6, .4, 1) .45s; }
#bossintro .desc { display: block; font-family: var(--serif); font-size: 15px;
  letter-spacing: 3px; color: #d8c8a0; margin-top: 12px; text-transform: uppercase;
  text-shadow: 0 2px 6px #000; opacity: 0;
  transition: opacity .5s ease .65s; }
#bossintro .rule { display: block; width: 0; height: 2px; margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transition: width .7s cubic-bezier(.4, 0, .2, 1) .5s; }
#bossintro.in .bar.top { transform: translateY(0); }
#bossintro.in .bar.bot { transform: translateY(0); }
#bossintro.in .body { opacity: 1; }
#bossintro.in .affix { opacity: 1; transform: translateY(0); }
#bossintro.in .name { opacity: 1; transform: scale(1); }
#bossintro.in .desc { opacity: 1; }
#bossintro.in .rule { width: min(540px, 60vw); }
#bossintro.final .name { color: #ff7a3a;
  text-shadow: 0 4px 0 #000, 0 0 40px rgba(255, 60, 20, .85), 0 0 90px rgba(255, 30, 0, .7);
  -webkit-text-stroke: 1px #5a1a05; }
#bossintro.final .affix { color: #ff5a2a; }
#bossintro.final .bar.top, #bossintro.final .bar.bot {
  box-shadow: 0 0 60px 20px rgba(220, 40, 20, .35) inset; }

/* Win-count crown ribbon on hero portraits (bronze/silver/gold). */
.hero .crown { position: absolute; left: -4px; top: -6px; font-style: normal;
  font-size: 16px; line-height: 1; width: 22px; height: 22px;
  display: inline-grid; place-items: center; border-radius: 50%;
  background: #1a1510; border: 1px solid currentColor;
  box-shadow: 0 2px 6px #000a, 0 0 10px currentColor;
  z-index: 2; pointer-events: auto; cursor: help; }
.hero .crown.bronze { color: #c37440; }
.hero .crown.silver { color: #d6d4cf; }
.hero .crown.gold { color: #ffcb3c; }

/* Hero card passive list: one row per gear slot (five bosses = five pieces). */
.passlist { list-style: none; margin: 8px 0 6px; padding: 0;
  display: flex; flex-direction: column; gap: 3px; text-align: left; }
.passline { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px; align-items: center;
  font-size: 11.5px; padding: 2px 6px; border-radius: 4px;
  border: 1px solid transparent; cursor: help; }
.passline:hover { background: #0b090655; border-color: var(--panel-edge); }
.passline .pix { display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 0;
  background: transparent;
  border: 5px solid transparent;
  border-image: url('assets/ui/chrome/slot.webp') 140 fill / 5px / 0 stretch;
  color: var(--muted); font-size: 11px; font-weight: bold; font-style: normal;
  overflow: hidden; }
.passline .pix img { width: 28px; height: 28px; object-fit: contain; display: block; }
.passline.locked .pix img { filter: grayscale(1) brightness(0.55); opacity: 0.6; }
.passline.got .pix { border-color: var(--gold-dim);
  box-shadow: 0 0 6px rgba(255, 203, 60, 0.3); }
.passline .pname { font-family: var(--serif); color: #c8bb94;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: 0.5px; }
.passline.got .pname { color: var(--gold); }
.passline.locked .pname { color: #7a6f58; }
.passline .pbonus { font-size: 10.5px; color: var(--muted); letter-spacing: 0.3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.passline.got .pbonus { color: #c8e0a0; }
