/* The Last Defense. Cream cards, dark outlines, hard shadows: drawn like the sprites (the same look as Hold the Line). */
:root {
  --ink: #2a1d14;
  --cream: #f6e7c4;
  --cream2: #ead3a2;
  --paper: #fff6dd;
  --gold: #f2b631;
  --gold2: #c9861b;
  --green: #5c9c33;
  --green2: #3b6d20;
  --red: #d8432f;
  --red2: #962819;
  --blue: #3f86c8;
  --sky: #9fd3ef;
  --mute: #7a6249;
  --shadow: 0 4px 0 var(--ink);
  --r: 14px;
  --display: "Lilita One", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #2b4a1f; color: var(--ink); font-family: var(--body); font-weight: 800; }
body { overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- shared pieces */
.card {
  background: var(--cream); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: 0 6px 0 var(--ink);
  padding: 22px 26px; max-width: min(560px, 94vw); max-height: 92vh; overflow: auto; position: relative;
}
.card.wide { max-width: min(980px, 96vw); }
.card h1, .card h2, .card h3 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; letter-spacing: .5px; }
.card h2 { font-size: 30px; }
.card h3 { font-size: 20px; margin-top: 14px; }
.sub { margin: 0 0 12px; color: var(--mute); font-weight: 800; }
.small { font-size: 14px; margin: 12px 0 0; text-align: center; }
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 20; }
.screen.dim { background: rgba(23, 16, 10, .55); }
.btns { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.btns.col { flex-direction: column; align-items: stretch; }
.btn {
  font-family: var(--display); font-size: 20px; letter-spacing: .4px; padding: 10px 20px; border: 3px solid var(--ink);
  border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); transition: transform .06s, box-shadow .06s;
}
.btn:hover { background: #fffaf0; }
.btn:active, .btn.down { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #ffc94a; }
.btn.small { font-size: 16px; padding: 6px 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn:focus-visible, .sq:focus-visible, .ab:focus-visible, .pick:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.price::before, .coin {
  content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--gold);
  border: 2px solid var(--ink); vertical-align: -2px; margin: 0 4px 0 6px; box-shadow: inset -2px -2px 0 var(--gold2);
}
.coin { width: 18px; height: 18px; margin: 0 6px 0 0; }
.valor { font-family: var(--display); color: #7b3fb0; }
.valor:not(:empty)::before { content: "\2726  "; }
.valor.big { font-size: 22px; }
.icon { display: inline-block; background-repeat: no-repeat; border-radius: 10px; border: 2px solid var(--ink); flex: none; }

/* ---------- title */
.title { text-align: center; padding: 30px 36px 22px; }
.title h1 { font-size: clamp(44px, 8vw, 76px); line-height: .95; color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.title .tag { font-size: 20px; margin: 8px 0 6px; }
#scrTitle { background: linear-gradient(180deg, rgba(20, 30, 10, .1), rgba(20, 30, 10, .45)); }

/* ---------- site menu (site/assets/menu.js) on the title card and in the pause card */
.titlemenu, .pausesettings { --vm-accent: var(--gold2); --vm-gap: 10px; --vm-muted: var(--mute); --vm-danger: var(--red2); }
.titlemenu { --vm-width: 330px; margin-top: 14px; }
.titlemenu[data-vm-view="load"], .titlemenu[data-vm-view="replace"] { --vm-width: 440px; }
.titlemenu .btn { font-size: 20px; padding: 6px 16px; }
.vm-menu .btn .vm-sub { font-family: var(--body); font-weight: 800; font-size: 12.5px; letter-spacing: 0; color: var(--mute); opacity: 1; }
.vm-menu a.btn { color: var(--ink); }
.vm-menu .vm-list [data-vm="continue"]:not([disabled]),
.vm-menu .vm-list:has([data-vm="continue"][disabled]) [data-vm="new"] { background: var(--gold); }
.vm-menu .vm-list [data-vm="continue"]:not([disabled]):hover,
.vm-menu .vm-list:has([data-vm="continue"][disabled]) [data-vm="new"]:hover { background: #ffc94a; }
.vm-menu .vm-list .btn:disabled { box-shadow: 0 2px 0 var(--ink); }
.vm-menu .vm-h { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .5px; }
.vm-menu .vm-note { font-weight: 800; }
.vm-menu .vm-note a { color: var(--blue); }
.vm-menu .vm-slot-btn .vm-label { font-size: 18px; }
.vm-menu .vm-del { font-family: var(--display); border: 3px solid currentColor; border-radius: 12px; background: var(--paper); }
.vm-menu .vm-slider label, .vm-menu .vm-slider output { font-family: var(--display); font-size: 18px; }
.vm-menu .vm-credits .vm-maker { font-family: var(--display); font-weight: 400; font-size: 28px; }
.vm-menu .vm-credits .vm-role { color: var(--mute); }
.vm-menu .vm-back { margin-top: 8px; }
.pausesettings { min-width: min(320px, 80vw); }
.pausesettings .vm-panel { max-width: 340px; margin: 0 auto; }

/* ---------- hero select (six heroes) */
.herolist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rows2 { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 26px; }
.rows2 .row { margin-top: 10px; }
.hero {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 7px 9px; cursor: pointer;
  box-shadow: var(--shadow); display: grid; grid-template-columns: 62px 1fr; grid-template-rows: auto auto auto 1fr; column-gap: 8px; row-gap: 3px; min-width: 0; text-align: left;
}
.hero[aria-checked="true"] { background: #fff1b8; outline: 4px solid var(--gold); }
.hero canvas { grid-row: 1 / 5; width: 62px; height: 62px; align-self: center; display: block; }
.hero h3 { margin: 0; font-size: 19px; line-height: 1; }
.hero .role { font-size: 12.5px; color: var(--mute); margin: 0; }
.hero .paths { display: flex; gap: 4px; flex-wrap: wrap; }
.hero .paths button { font-size: 11.5px; padding: 2px 6px; border: 2px solid var(--ink); border-radius: 8px; background: var(--cream2); }
.hero .paths button[aria-pressed="true"] { background: var(--gold); }
.hero .paths button:disabled { opacity: .45; cursor: not-allowed; }
.hero .desc { font-size: 12px; margin: 0; line-height: 1.25; }
.row { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.row .lbl { font-family: var(--display); font-size: 18px; text-align: right; }
.diff button { border: 3px solid var(--ink); border-radius: 10px; background: var(--paper); padding: 5px 14px; font-family: var(--display); font-size: 17px; }
.diff button[aria-checked="true"] { background: var(--gold); }

/* ---------- map picker */
.maplist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.mapcard { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 7px; box-shadow: var(--shadow); min-width: 0; }
.mapcard[aria-checked="true"] { background: #fff1b8; outline: 4px solid var(--gold); }
.mapcard canvas { width: 100%; max-width: 130px; aspect-ratio: 168 / 104; border: 2px solid var(--ink); border-radius: 8px; display: block; }
.mapcard b { font-family: var(--display); font-weight: 400; font-size: 17px; }
.mapcard small { font-size: 11.5px; color: var(--mute); line-height: 1.2; }

/* ---------- perks, how, saves, end */
.perklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.perk { display: flex; gap: 10px; align-items: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 8px; }
.perk .icon { width: 44px; height: 44px; }
.perk .txt { flex: 1; min-width: 0; }
.perk b { font-family: var(--display); font-weight: 400; font-size: 17px; display: block; }
.perk small { display: block; color: var(--mute); font-size: 12.5px; }
.pips { display: flex; gap: 3px; margin-top: 3px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream2); }
.pips i.on { background: #9a5bd0; }
.perk .btn { font-size: 15px; padding: 5px 10px; white-space: nowrap; }
.how { padding-left: 20px; margin: 0; line-height: 1.45; }
.how li { margin-bottom: 7px; }
.savelist { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.savelist li { display: flex; gap: 8px; align-items: stretch; }
.savelist .btn { flex: 1; text-align: left; display: flex; flex-direction: column; }
.savelist .btn b { font-weight: 400; }
.savelist .btn small { font-family: var(--body); font-size: 12.5px; color: var(--mute); }
.savelist .btn.empty { opacity: .7; }
.savelist .del { font-family: var(--display); border: 3px solid var(--red2); color: var(--red2); border-radius: 12px; background: var(--paper); padding: 0 10px; }
.center { text-align: center; }
.stats { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.stats li { display: flex; justify-content: space-between; border-bottom: 2px dotted var(--cream2); }

/* ---------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud .items, #hud .herobox, #hud .strip { pointer-events: auto; }
.topbar {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 6px 10px; background: var(--cream); border: 3px solid var(--ink);
  border-radius: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 140px);
}
.topbar .lbl { font-family: var(--display); font-size: 15px; color: var(--mute); }
.clock { font-family: var(--display); font-size: 22px; display: flex; flex-direction: column; align-items: center; line-height: 1; min-width: 74px; }
.clock small { font-family: var(--body); font-size: 11px; color: var(--mute); margin-top: 2px; }
.fortbox { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; }
.goldbox { font-family: var(--display); font-size: 22px; display: flex; align-items: center; white-space: nowrap; }
.goldbox small { font-family: var(--body); font-size: 12px; color: var(--mute); margin-left: 4px; }
.tools { display: flex; gap: 6px; }
.sq { position: relative; min-width: 40px; height: 40px; border: 3px solid var(--ink); border-radius: 10px; background: var(--paper); box-shadow: 0 3px 0 var(--ink); font-family: var(--display); font-size: 17px; padding: 0 6px; }
.sq.wide { padding: 0 10px; }
.sq kbd { position: absolute; right: 2px; bottom: -1px; font-family: var(--body); font-size: 9.5px; color: var(--mute); }
.sq.glow { background: var(--gold); animation: glow 1.4s ease-in-out infinite; }
.sq.cool { color: var(--mute); }
@keyframes glow { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 4px rgba(242, 182, 49, .45); } }
.badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 12px; line-height: 16px; padding: 0 4px; }
.bar { position: relative; height: 18px; border: 3px solid var(--ink); border-radius: 9px; background: #4a3426; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--green); box-shadow: inset 0 -4px 0 var(--green2); transition: width .15s; }
.bar span { position: relative; display: block; text-align: center; font-size: 11.5px; line-height: 12px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.bar.fort { width: clamp(90px, 13vw, 180px); }
.mine .bar.fort i { background: #6db2e6; box-shadow: inset 0 -4px 0 #3a78ad; }
.theirs .bar.fort i { background: #e0442f; box-shadow: inset 0 -4px 0 #962819; }
.bar.xp { height: 10px; border-width: 2px; margin-top: 3px; }
.bar.xp i { background: #b36be0; box-shadow: none; }
.strip { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 4px 8px; background: rgba(246, 231, 196, .92); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.strip .side { display: flex; gap: 3px; align-items: center; }
.strip .col { display: flex; flex-direction: column; gap: 3px; }
.strip .vs { font-family: var(--display); color: var(--mute); font-size: 14px; }
.chip { position: relative; width: 18px; height: 16px; border: 2px solid var(--ink); border-radius: 4px; background: #4a3426; padding: 0; overflow: hidden; }
.chip.fort { width: 26px; height: 35px; border-radius: 6px; }
.chip i { position: absolute; left: 0; right: 0; bottom: 0; background: #6db2e6; }
.chip.en i { background: #e0442f; }
.chip.shield { border-style: dashed; }
.chip.shield i { opacity: .65; }
.chip.dead { background: #2a1d14; opacity: .55; }
.chip.dead::after { content: "\00d7"; position: absolute; inset: 0; color: #fff; font-size: 13px; line-height: 12px; text-align: center; }
.chip.hit { outline: 2px solid #ffe066; }
.banner {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font-family: var(--display); font-size: clamp(24px, 3.4vw, 40px);
  color: var(--gold); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); white-space: nowrap; animation: pop .35s ease-out;
}
.banner.red { color: #ff7b5c; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.toast { position: absolute; left: 16px; top: 16px; font-family: var(--display); font-size: 15px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 4px 10px; box-shadow: 0 3px 0 var(--ink); max-width: 320px; }
.shophint { position: absolute; left: 50%; bottom: calc(var(--cmdh, 150px) + 14px); transform: translateX(-50%); font-family: var(--display); font-size: 15px; color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.aimhint { position: absolute; left: 50%; bottom: calc(var(--cmdh, 150px) + 44px); transform: translateX(-50%); font-size: 14px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 4px 10px; }
.respawn { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--display); font-size: 30px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }

.herobox {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; align-items: flex-end;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 6px 10px 6px 6px;
}
.portrait { width: 64px; height: 64px; border: 3px solid var(--ink); border-radius: 12px; background: var(--sky); overflow: hidden; flex: none; }
.portrait canvas { width: 100%; height: 100%; display: block; }
.herobars { width: clamp(150px, 15vw, 210px); }
.heroname { font-family: var(--display); font-size: 17px; display: flex; justify-content: space-between; margin-bottom: 2px; }
.heroname span { color: var(--mute); font-size: 15px; }
.passives { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; max-width: 210px; }
.passives .pv { position: relative; }
.passives .icon { width: 26px; height: 26px; border-radius: 7px; }
.passives b { position: absolute; right: -3px; bottom: -4px; font-family: var(--display); font-weight: 400; font-size: 11px; color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }

.bottom { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.skillbar { display: flex; gap: 6px; padding: 6px; background: rgba(246, 231, 196, .9); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); pointer-events: auto; }
.ab { position: relative; width: 56px; height: 56px; padding: 0; border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); overflow: hidden; }
.ab.buy { border-color: #6b4a99; }
.ab.empty { background: var(--cream2); }
.ab.empty::before { content: "+"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 24px; color: var(--mute); }
.ab .ic { position: absolute; inset: 0; background-repeat: no-repeat; }
.ab .slv { position: absolute; left: 3px; top: 1px; font-family: var(--display); font-size: 11px; color: #fff; text-shadow: 0 0 3px #000, 0 1px 0 #000; }
.ab .cd { position: absolute; inset: 0; background: rgba(20, 14, 8, .62); color: #fff; font-family: var(--display); font-size: 20px; display: flex; align-items: center; justify-content: center; }
.ab .cd:empty { display: none; }
.ab .key { position: absolute; right: 3px; bottom: 1px; font-family: var(--display); font-size: 14px; color: #fff; text-shadow: 0 0 3px #000, 0 1px 0 #000; }
.ab.aiming { outline: 4px solid var(--gold); }
.ab.ready { animation: ready .4s ease-out; }
@keyframes ready { 50% { transform: scale(1.12); } }
.items { display: flex; gap: 4px; }
.items .slot, .gearslots .slot { position: relative; width: 36px; height: 36px; border: 3px dashed rgba(42, 29, 20, .5); border-radius: 9px; background: rgba(246, 231, 196, .55); padding: 0; }
.items .slot.full, .gearslots .slot.full { border-style: solid; border-color: var(--ink); background: var(--paper); }
.items .slot .icon, .gearslots .slot .icon { width: 100%; height: 100%; border: 0; border-radius: 6px; }
.items .slot b, .gearslots .slot b { position: absolute; right: -4px; bottom: -5px; font-family: var(--display); font-weight: 400; font-size: 12px; color: var(--gold); -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }
.r0 { --rc: #9a8f80; } .r1 { --rc: #4f9d3a; } .r2 { --rc: #3a7fd0; } .r3 { --rc: #9b4fd6; } .r4 { --rc: #e08a1a; }
.slot.full, .ware { box-shadow: inset 0 0 0 2px var(--rc, transparent); }

/* ---------- panels (they never pause the battle) */
.panel {
  position: absolute; right: 10px; top: 76px; bottom: calc(var(--cmdh, 150px) + 8px); width: min(520px, calc(100vw - 20px)); z-index: 15; display: flex; flex-direction: column;
  background: var(--cream); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: 0 6px 0 var(--ink);
}
.panel.shop { width: min(900px, calc(100vw - 20px)); }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0; }
.panel h3 { font-family: var(--display); font-weight: 400; font-size: 18px; margin: 12px 0 6px; }
.panel h3 small { color: var(--mute); font-size: 14px; }
.panelbody { padding: 4px 12px 12px; overflow: auto; flex: 1; min-height: 0; }
.panelbody .sub { margin: 4px 0 8px; font-size: 13.5px; }
.where { margin: 0 0 8px; font-size: 13.5px; color: var(--red2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.where.ok { color: var(--green2); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 3px solid var(--ink); }
.tabs .tab { font-family: var(--display); font-size: 15px; padding: 5px 10px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--cream2); margin-bottom: -3px; }
.tabs .tab[aria-selected="true"] { background: var(--paper); }
.shopcols { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin-top: 8px; }
.rarrow { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.rarrow button { font-size: 12px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); padding: 2px 7px; }
.rarrow button[aria-pressed="true"] { background: var(--gold); }
.rarrow button.r0, .rarrow button.r1, .rarrow button.r2, .rarrow button.r3, .rarrow button.r4 { border-color: var(--rc); }
.rarrow input { flex: 1; min-width: 90px; font: inherit; font-size: 13px; border: 2px solid var(--ink); border-radius: 8px; padding: 3px 7px; background: var(--paper); }
.wares { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.ware { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 5px 3px; text-align: center; }
.ware .icon { width: 48px; height: 48px; border-color: var(--rc); }
.ware .nm { font-size: 11.5px; line-height: 1.15; min-height: 2.3em; }
.ware .price { font-family: var(--display); font-size: 13px; }
.ware.sel { outline: 3px solid var(--gold); background: #fff1b8; }
.ware.cant .price { color: var(--red2); }
.gear .gearslots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.gearslots .slot { width: auto; aspect-ratio: 1; height: auto; }
.gearslots .slot.sel { outline: 3px solid var(--gold); }
.hint { font-size: 12.5px; color: var(--mute); }
.detail { margin-top: 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 8px; }
.detail header { display: flex; gap: 8px; align-items: center; padding: 0; }
.detail header .icon { width: 48px; height: 48px; border-color: var(--rc); }
.detail header b { font-family: var(--display); font-weight: 400; font-size: 17px; display: block; }
.detail .rar { font-size: 12px; color: var(--rc); }
.detail .st { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.detail .sp { font-size: 12.5px; margin: 4px 0; }
.detail .tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.detail .tags span { display: flex; align-items: center; gap: 3px; font-size: 11.5px; border: 2px solid var(--ink); border-radius: 7px; padding: 0 4px 0 0; background: var(--cream2); }
.detail .tags .icon { width: 18px; height: 18px; border-radius: 5px; border-width: 1px; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.why { font-size: 12px; color: var(--mute); margin: 2px 0 0; width: 100%; }
.maxed { font-family: var(--display); color: var(--green2); }
.shrine .btn.gold { margin: 6px 0; }
.skilllist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 13px; }
.skilllist li { display: flex; gap: 6px; align-items: center; }
.skilllist .icon { width: 28px; height: 28px; border-radius: 7px; }
.skilllist b { font-family: var(--display); font-weight: 400; }
.skilllist small { color: var(--mute); }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 8px; }
.pick:hover { background: #fff1b8; }
.pick:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.pick .icon { width: 56px; height: 56px; }
.pick b { font-family: var(--display); font-weight: 400; font-size: 17px; }
.pick small { font-size: 12.5px; color: var(--mute); }
.pick .kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #7b3fb0; }
.pick.rare { background: #f1e3ff; }
.bstats { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; font-size: 13.5px; }
.bstats li { display: flex; justify-content: space-between; border-bottom: 2px dotted var(--cream2); }
.bstats b { font-family: var(--display); font-weight: 400; }
.note { font-size: 12.5px; color: var(--blue); margin: 4px 0; }
.board { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.brow { display: flex; gap: 5px; align-items: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 5px 7px; margin-bottom: 5px; }
.brow.col { flex-direction: column; align-items: stretch; }
.brow .nm { flex: 1; min-width: 0; }
.brow .nm b { font-family: var(--display); font-weight: 400; font-size: 15px; }
.brow .nm small { color: var(--mute); font-size: 12px; }
.brow .nm .tx { display: block; }
.brow .btn { font-size: 14px; padding: 4px 8px; white-space: nowrap; }
.brow .opts { display: flex; gap: 4px; flex-wrap: wrap; }
.brow .opts small { font-size: 10.5px; color: var(--mute); }

/* ---------- misc */
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #2b4a1f; color: var(--cream); font-family: var(--display); font-size: 26px; z-index: 50; }
.tip { position: fixed; z-index: 60; max-width: 280px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; box-shadow: var(--shadow); padding: 7px 9px; font-size: 13px; pointer-events: none; }
.tip b { font-family: var(--display); font-weight: 400; font-size: 16px; display: block; }
.portrait-hint { display: none; }
.legal { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 14px; justify-content: center; font-size: 11px; padding: 2px; z-index: 5; pointer-events: none; }
.legal a { color: rgba(255, 246, 221, .75); pointer-events: auto; text-decoration: none; }
body.playing .legal { display: none; }
body:has(#scrTitle[hidden]) .legal { display: none; }
@media (max-width: 1250px) {
  .topbar { max-width: calc(100vw - 80px); }
  .bar.fort { width: clamp(80px, 10vw, 150px); }
  .shopcols { grid-template-columns: 1fr 220px; }
}
@media (max-width: 899px), (max-height: 520px) {
  .portrait-hint { display: flex; position: absolute; inset: 0; z-index: 70; background: rgba(23, 16, 10, .88); color: var(--cream); align-items: center; justify-content: center; text-align: center; padding: 30px; font-family: var(--display); font-size: 22px; }
  .herolist { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- auto-buy (right-click a troop in the barracks): a spark of light runs round the button while it is on */
.panelbody .btn.small.off { opacity: .55; filter: grayscale(.4); }
.panelbody .btn.auto { position: relative; overflow: hidden; background: #ffe58a; border-color: #b8860b; box-shadow: 0 3px 0 var(--ink), inset 0 0 0 2px var(--gold); }
.panelbody .btn.auto.off { opacity: .9; filter: none; }
.panelbody .btn.auto .spark { position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--a, 0deg), transparent 0 70%, rgba(255, 215, 102, .95) 82%, #fff 86%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 3px;
  animation: spark 1.6s linear infinite; }
@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spark { to { --a: 360deg; } }
@media (prefers-reduced-motion: reduce) { .panelbody .btn.auto .spark { animation: none; } }
#btnCenter { position: absolute; z-index: 6; pointer-events: auto; padding: 5px 10px; font-size: 13px; }
#btnCenter kbd { margin-left: 6px; font-size: 11px; opacity: .8; }
/* the forge (2026-10-16) */
.ware { position: relative; }
.ware .fg, .ware .pt { position: absolute; left: 3px; top: 2px; font-style: normal; font-size: 13px; line-height: 1; color: var(--gold2); -webkit-text-stroke: .5px var(--ink); }
.ware .pt { color: var(--mute); -webkit-text-stroke: 0; }
.ware.forged { background: linear-gradient(#fff6dd, #fbe7b4); }
.ware .have { position: absolute; right: 3px; top: 2px; font-style: normal; font-family: var(--display); font-size: 11px; background: var(--green2, #3d8a2a); color: #fff; border-radius: 6px; padding: 0 4px; }
.rarrow .forgebtn { border-color: var(--gold2); }
.detail.recipe h4 { margin: 8px 0 4px; font-family: var(--display); font-weight: 400; font-size: 14px; color: var(--mute); }
.rtree, .rtree ul { list-style: none; margin: 0; padding: 0; }
.rtree ul { margin-left: 14px; padding-left: 8px; border-left: 2px dashed var(--cream2); }
.rtree li { margin: 3px 0; }
.rtree .fee { font-size: 12px; color: var(--mute); display: flex; justify-content: space-between; padding: 0 6px; }
.rnode { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: var(--cream); border: 2px solid var(--ink); border-radius: 9px; padding: 3px 6px; font: inherit; font-size: 12.5px; box-shadow: inset 0 0 0 2px var(--rc, transparent); }
.rnode:hover { background: #fff1b8; }
.rnode .icon { width: 28px; height: 28px; border-radius: 7px; border-color: var(--rc); }
.rnode span { flex: 1; line-height: 1.15; }
.rnode small { display: block; font-size: 11px; color: var(--mute); }
.rnode .price { flex: none; font-family: var(--display); font-size: 12.5px; }
.rnode.own { background: #e3f3cf; }
.rnode .tick { flex: none; font-size: 11.5px; color: var(--green2, #3d8a2a); }
.rinto { display: grid; gap: 4px; }
/* Settings > Controls and camera */
#ctlBox { display: flex; flex-direction: column; gap: 12px; min-width: min(460px, 84vw); text-align: left; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ctl input[type=range] { width: 100%; accent-color: var(--gold2); }
.ctl.chk { flex-direction: row; align-items: flex-start; gap: 8px; }
.ctl.chk input { width: 20px; height: 20px; accent-color: var(--gold2); margin-top: 2px; flex: none; }
.ctl small { display: block; color: var(--mute); font-size: 12.5px; }
#ctlBox .btns { display: flex; gap: 8px; justify-content: flex-end; }
/* consumables bag (2026-10-16) */
.itemrow { display: flex; gap: 14px; align-items: center; }
.bag { display: flex; gap: 4px; pointer-events: auto; }
.bag .slot { position: relative; width: 40px; height: 40px; border: 3px dashed rgba(42, 29, 20, .5); border-radius: 50%; background: rgba(246, 231, 196, .55); padding: 0; cursor: pointer; }
.bag .slot.full { border-style: solid; border-color: var(--ink); background: var(--paper); }
.bag .slot.on { outline: 3px solid var(--gold); }
.bag .slot .icon { width: 100%; height: 100%; border: 0; border-radius: 50%; }
.bag .slot kbd { position: absolute; right: -4px; bottom: -5px; font-family: var(--display); font-size: 11px; color: var(--cream); background: var(--ink); border-radius: 5px; padding: 0 3px; }
.bagslots { grid-template-columns: repeat(5, 1fr); margin-bottom: 6px; }

/* ---------- the command bar (2026-10-16, after DotA's): minimap, hero, stats, health and skills, items and bag, towers */
#hud .cmd { pointer-events: auto; }
.cmd {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%) scale(var(--cs, 1)); transform-origin: 50% 100%;
  display: flex; align-items: stretch; gap: 7px; height: 162px; box-sizing: border-box; padding: 9px 10px 8px;
  background: linear-gradient(#5b4131, #3b2a1e 60%, #2e2117); border: 3px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0;
  box-shadow: inset 0 3px 0 rgba(255, 236, 200, .18), 0 -4px 0 rgba(20, 14, 8, .35); white-space: nowrap;
}
.cmd > div { position: relative; background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; box-shadow: inset 0 -3px 0 rgba(42, 29, 20, .12); }
/* minimap */
.cmd .c-mini { width: 236px; padding: 4px; background: #1b130d; }
.minislot { width: 100%; height: 100%; border-radius: 8px; overflow: hidden; }
.minicv { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
/* hero */
.cmd .c-hero { width: 118px; display: flex; flex-direction: column; align-items: center; padding: 6px 6px 5px; gap: 3px; }
.cmd .portrait { width: 96px; height: 92px; border: 3px solid var(--ink); border-radius: 10px; background: var(--sky); overflow: hidden; padding: 0; cursor: pointer; }
.cmd .portrait.glow { animation: glow 1.4s ease-in-out infinite; border-color: var(--gold2); }
.cmd .portrait canvas { width: 100%; height: 100%; display: block; }
.lvring { position: absolute; left: 2px; top: 74px; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 14px; box-shadow: 0 2px 0 var(--ink); }
.c-hero .badge { top: 0; right: 0; }
.cmd .heroname { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cmd .bar.xp { width: 100%; height: 9px; margin: 0; }
/* stats */
.cmd .c-stats { width: 132px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; }
.stats { display: flex; flex-direction: column; gap: 2px; }
.stats .st { display: flex; align-items: center; gap: 5px; font-family: var(--display); font-size: 14px; line-height: 1; }
.stats .k { font-style: normal; font-family: var(--body); font-weight: 900; font-size: 9.5px; letter-spacing: .3px; color: var(--cream); background: var(--ink); border-radius: 4px; padding: 2px 3px 1px; min-width: 25px; text-align: center; }
.stats .add { color: #2f8a1d; font-size: 13px; }
.cmd .plus { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 50%; background: var(--gold); font-family: var(--display); font-size: 16px; line-height: 16px; padding: 0; box-shadow: 0 2px 0 var(--ink); cursor: pointer; }
.statspop { position: absolute; left: 50%; bottom: calc(var(--cmdh, 150px) + 10px); width: min(380px, 92vw); max-height: calc(100vh - var(--cmdh, 150px) - 110px); overflow: auto; background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--ink); padding: 8px 12px 10px; pointer-events: auto; z-index: 14; }
.statspop header { display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-size: 18px; margin-bottom: 4px; }
.statspop header .sq { min-width: 30px; height: 30px; font-size: 16px; }
.statspop h4 { margin: 8px 0 4px; font-family: var(--display); font-weight: 400; color: var(--mute); }
.statlist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.statlist li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 2px 0; border-bottom: 2px dotted var(--cream2); }
.statlist li b { font-family: var(--display); font-weight: 400; font-size: 14px; text-align: right; }
.statlist li small { grid-column: 1 / -1; color: var(--mute); font-size: 11.5px; white-space: normal; }
.statlist li small:empty { display: none; }
.statlist li small i { color: #2f8a1d; font-style: normal; }
.statlist.sets .icon { width: 16px; height: 16px; border-radius: 4px; border-width: 1px; vertical-align: -3px; }
/* health and skills */
.cmd .c-center { padding: 6px 8px 5px; display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.hprow { display: flex; align-items: center; gap: 6px; }
.cmd .bar.hp { flex: 1; height: 22px; }
.cmd .bar.hp span { line-height: 16px; font-size: 13px; font-family: var(--display); }
.cmd .bar.hp .sh { position: absolute; left: 0; top: 0; height: 5px; width: 0; background: #ffb347; }
#regenTxt { font-family: var(--display); font-size: 13px; color: #2f8a1d; min-width: 34px; }
.cmd .skillbar { padding: 0; background: none; border: 0; box-shadow: none; gap: 5px; }
.cmd .ab { width: 58px; height: 58px; }
.cmd .passives { margin: 0; max-width: none; min-height: 24px; }
.cmd .passives .icon { width: 22px; height: 22px; }
/* items 3 x 3 and the bag */
.cmd .c-items { padding: 6px; display: flex; gap: 8px; align-items: center; }
.cmd .items { display: grid; grid-template-columns: repeat(3, 42px); gap: 4px; }
.cmd .items .slot { width: 42px; height: 42px; cursor: pointer; }
.cmd .bag { flex-direction: column; gap: 5px; }
.cmd .bag .slot { width: 40px; height: 40px; }
/* tower control */
.cmd .c-towers { padding: 5px 7px; display: flex; flex-direction: column; gap: 4px; width: 210px; }
.twhead { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.twhead .goldbox { font-size: 19px; }
.twhead .sq { height: 32px; font-size: 15px; }
.towerctl { display: flex; flex-direction: column; gap: 4px; }
.towerctl .tw { display: flex; gap: 3px; align-items: center; }
.towerctl .col { display: flex; flex-direction: column; gap: 3px; }
.towerctl .lbl { font-family: var(--display); font-size: 11px; color: var(--mute); margin-right: 2px; }
.towerctl .chip { width: 28px; height: 26px; border-radius: 6px; cursor: pointer; }
.towerctl .chip.fort { width: 40px; height: 55px; border-radius: 8px; margin-right: 3px; }
.towerctl .chip.sm { width: 13px; height: 9px; border-width: 1.5px; border-radius: 3px; }
.towerctl .chip.fort.sm { width: 16px; height: 21px; margin: 0 0 0 3px; }
.towerctl .chip.sm.dead::after { font-size: 9px; line-height: 6px; }
.towerctl .lvn { position: absolute; inset: 0; font-family: var(--display); font-weight: 400; font-size: 12px; line-height: 22px; color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }
.towerctl .chip.fort .lvn { line-height: 51px; font-size: 14px; }
.towerctl .chip.cheap { animation: alarm .8s ease-in-out infinite; }
@keyframes alarm { 50% { outline: 3px solid #ff4a3a; } }
#btnCenter { left: 14px !important; right: auto !important; top: auto !important; bottom: calc(var(--cmdh, 150px) + 10px); }
