/* Tom Pearl: Poop Troops vs. Clean Freaks — page, HUD and menus.
 * Look (11-13): a sunny backyard. Sky-blue screens, white panels, thick navy outlines, toxic green
 * for "go", gold for rewards and Poop Coins, clean-freak light blue for the enemy side. Brown is
 * kept for the logo only (it is the poop), so nothing reads dark or muddy. The battle HUD (#hud) is a fixed
 * 1600×900 layer that ui.js scales with the canvas, so everything in it uses logical px. */
:root {
  --ink: #1a2348; --logo-ink: #2a1810;
  --hd: #2460d8; --sub: #5a6890; --sub2: #46557d; --strip: #2450b8; --navy: 26,35,72;
  --toxic: #9fd65a; --toxic2: #5fa83a; --gold: #ffd23f; --gold2: #f0a91e;
  --clean: #7fc8ff; --clean2: #3d8fd6; --danger: #ff6a5a; --danger2: #c8302a;
  --coin: radial-gradient(circle at 35% 35%, #fff4b0, #ffd23f 45%, #c98a12);
  --bg: #3fa0ee; --sky: radial-gradient(130% 95% at 50% 0%, #b8e8ff, #5cbcff 50%, #2f88e0);
  --paper: #ffffff; --tile: #e6f2ff; --tile2: #c4dbf4; --card: radial-gradient(ellipse 70% 62% at 50% 50%, #ffffff 0 34%, #dcefff 70%, #b3d7f7 100%);
  --head: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --body: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--paper); font: 600 18px/1.25 var(--body);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: var(--gold); }
h2, h3, h4 { font-family: var(--head); font-weight: 400; margin: 0; letter-spacing: .01em; }

#pt { position: fixed; inset: 0; overflow: hidden; }
#ptc { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ── buttons ─────────────────────────────────────────────────────────────────── */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 400 22px/1 var(--head); color: var(--ink); padding: 11px 24px 12px; min-height: 48px;
  background: linear-gradient(#ffe68a, var(--gold) 55%, var(--gold2)); border: 4px solid var(--ink); border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.55); text-shadow: 0 1px 0 rgba(255,255,255,.5);
  transition: transform .06s, box-shadow .06s, filter .12s; touch-action: manipulation; }
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.4); }
.btn.big { font-size: 30px; padding: 13px 38px 15px; background: linear-gradient(#d3f59a, var(--toxic) 50%, var(--toxic2)); }
.btn.ghost { background: linear-gradient(#fffdf8, var(--tile) 60%, var(--tile2)); }
.btn.small { font-size: 17px; padding: 7px 14px 8px; min-height: 38px; border-width: 3px; border-radius: 12px; box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.5); }
.btn.danger { background: linear-gradient(#ffb2a6, var(--danger) 55%, var(--danger2)); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.btn.off { filter: grayscale(.8); }
.btn:disabled { filter: grayscale(1) brightness(.75); opacity: .65; box-shadow: 0 3px 0 var(--ink); }

/* ── logo ─────────────────────────────────────────────────────────────────────── */
.logo { display: flex; flex-direction: column; align-items: center; font-family: var(--head); line-height: .9; text-align: center; transform: rotate(-2deg); }
.logo span { display: block; -webkit-text-stroke: 9px var(--logo-ink); paint-order: stroke fill; }
.logo .l1 { font-size: clamp(22px, 4.2vh, 40px); color: var(--gold); letter-spacing: .06em; filter: drop-shadow(0 4px 0 var(--logo-ink)); }
.logo .l2 { font-size: clamp(54px, 13vh, 132px); color: #b56f32; letter-spacing: .01em; -webkit-text-stroke: 11px var(--logo-ink); paint-order: stroke fill;
  filter: drop-shadow(0 7px 0 var(--logo-ink)); }
.logo .l3 { font-size: clamp(26px, 6.4vh, 64px); color: var(--clean); margin-top: .1em; filter: drop-shadow(0 5px 0 var(--logo-ink)); }
.logo .l3 em { font-style: normal; color: var(--paper); font-size: .7em; vertical-align: .12em; margin-right: .1em; }
.logo.small { transform: none; }
.logo.small .l1 { font-size: 26px; }
.logo.small .l2 { font-size: 70px; }

/* ── screens ──────────────────────────────────────────────────────────────────── */
.scr { position: fixed; inset: 0; z-index: 10; display: none; flex-direction: column; align-items: center; overflow: auto;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scr.on { display: flex; animation: scrIn .22s ease-out; }
@keyframes scrIn { from { opacity: 0; } }
.panel { background: linear-gradient(#ffffff, var(--tile)); color: var(--ink); border: 5px solid var(--ink); border-radius: 24px;
  box-shadow: 0 8px 0 var(--ink), 0 18px 40px rgba(var(--navy),.3); padding: 18px 22px; margin: auto; width: min(960px, 100%); position: relative;
  background-image: linear-gradient(rgba(36,96,216,.05) 2px, transparent 2px), linear-gradient(90deg, rgba(36,96,216,.05) 2px, transparent 2px), linear-gradient(#ffffff, var(--tile));
  background-size: 46px 46px, 46px 46px, auto; }
.panel.narrow { width: min(440px, 100%); display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }
.panel h2 { font-size: 34px; color: var(--hd); -webkit-text-stroke: 0; }
.panel h4 { font-size: 18px; color: var(--hd); margin: 12px 0 6px; }
.panel h4 small { font-family: var(--body); font-size: 15px; color: var(--sub); }
header.bar { width: min(1180px, 100%); display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex: none; }
header.bar h2 { font-size: 34px; flex: 1; color: var(--paper); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 4px 0 var(--ink)); }
.pearlcount { display: inline-flex; align-items: center; gap: 7px; margin: 0; font: 400 22px var(--head); color: var(--paper); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.pearlcount.big { font-size: 34px; justify-content: center; margin: 8px 0; color: var(--ink); -webkit-text-stroke: 0; }
i.pearl { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); flex: none;
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, #f3ece4 30%, #cfc1b4 75%, #a8978a); }
.pearlcount.big i.pearl { width: 30px; height: 30px; }
.scroll { width: min(1180px, 100%); flex: 1; overflow: auto; min-height: 0; }
.lead { font-size: 19px; margin: 0 0 12px; }

/* loading: open sky over a strip of lawn; title: the battle lawn, edges barely tinted */
#s-load, #s-title { background: linear-gradient(transparent 80%, #3f8f2c 80%, #3f8f2c calc(80% + 6px), #6cc24a calc(80% + 6px), #57ad3a), var(--sky), var(--bg); justify-content: center; gap: 14px; }
#s-title { background: radial-gradient(110% 85% at 50% 35%, rgba(255,255,255,0), rgba(30,80,170,.22) 80%); }
.loadbar { width: min(460px, 80vw); height: 30px; border: 4px solid var(--ink); border-radius: 15px; background: #fff; overflow: hidden; box-shadow: 0 4px 0 var(--ink); }
.loadbar i { display: block; height: 100%; width: 0; border-radius: 0 11px 11px 0; transition: width .2s;
  background: repeating-linear-gradient(-45deg, #b7ec6e 0 14px, var(--toxic2) 14px 28px); box-shadow: inset 0 4px 0 rgba(255,255,255,.35); }
#l-msg { margin: 0; font: 400 22px var(--head); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#l-go { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 8px rgba(159,214,90,.5); } }

/* title */
#t-cast { width: min(1100px, 96vw); height: clamp(110px, 24vh, 230px); display: block; flex: none; margin-top: -6px; }
.tmenu { display: grid; grid-template-columns: repeat(4, auto); gap: 12px 12px; justify-content: center; align-items: center; }
.tmenu #t-play { grid-column: 1 / -1; justify-self: center; min-width: 260px; font-size: 38px; }
.tmenu .btn { min-width: 160px; }
.tmenu .btn.ghost { font-size: 18px; min-width: 0; }
#s-title .pearlcount { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); }
.back-hub { position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); font: 400 18px var(--head); color: var(--paper); text-decoration: none;
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#s-title aside { width: min(660px, 100%); }

/* world map */
#s-map { background: linear-gradient(rgba(70,165,250,.6), rgba(70,165,250,.18) 30%, rgba(30,70,160,.3)); }
#m-tabs { display: flex; gap: 10px; width: min(1180px, 100%); overflow-x: auto; padding: 4px 2px 12px; flex: none; scrollbar-width: none; }
#m-tabs::-webkit-scrollbar { display: none; }
.wtab { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 150px; padding: 7px 14px 8px; text-align: left;
  background: linear-gradient(#ffffff, #d6e9fb); color: var(--ink); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.wtab b { font: 400 13px var(--head); color: var(--hd); letter-spacing: .06em; }
.wtab span { font: 400 19px var(--head); white-space: nowrap; }
.wtab small { font-size: 15px; color: var(--sub); min-height: 1em; }
.wtab.on { background: linear-gradient(#ffe68a, var(--gold)); transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.wtab.bonus b { color: var(--danger2); }
.wtab.locked { filter: grayscale(1) brightness(.6); }
.mapcard { width: min(1180px, 100%); flex: 1; min-height: 300px; display: flex; flex-direction: column; border: 5px solid var(--ink); border-radius: 26px; overflow: hidden;
  background: rgba(255,255,255,.18); box-shadow: 0 8px 0 var(--ink); backdrop-filter: blur(1.5px); }
.minfo { padding: 10px 18px; background: linear-gradient(rgba(70,155,240,.95), rgba(40,104,200,.95)); border-bottom: 4px solid var(--ink); }
.minfo p { color: #fff; text-shadow: 0 2px 0 rgba(var(--navy),.55); }
.minfo h3 { font-size: 30px; color: var(--gold); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.minfo p { margin: 2px 0 0; font-size: 18px; }
.minfo .mtag b { display: inline-block; font: 400 14px var(--head); color: var(--ink); background: var(--clean); border: 3px solid var(--ink); border-radius: 8px; padding: 1px 8px; margin-right: 4px; }
#m-path { position: relative; flex: 1; min-height: 240px; background: #5d9e3e; }
#m-path .mboard { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#m-path .mp-in { position: absolute; inset: 84px 30px 116px; }
/* a stop: a round medal with the face it is about, its number on a ribbon, stars + name under it */
.node { position: absolute; transform: translate(-50%, -50%); width: 96px; height: 96px; padding: 0; z-index: 1; background: none; border: 0; box-shadow: none;
  color: var(--ink); transition: transform .12s; }
.node:hover:not(.locked) { transform: translate(-50%, -54%) scale(1.06); z-index: 2; }
.node .medal { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; border: 5px solid var(--ink);
  background: radial-gradient(circle at 50% 38%, #ffffff, #d9efff 58%, #8fc6f2); box-shadow: 0 6px 0 var(--ink), inset 0 0 0 4px #eef8ff; }
.node .medal .pc { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.node.t-boss { width: 116px; height: 116px; }
.node.t-boss .medal { background: radial-gradient(circle at 50% 38%, #ffe2da, #ff9a8a 58%, var(--danger2)); box-shadow: 0 6px 0 var(--ink), inset 0 0 0 4px #ffd0c4; }
.node.done .medal { border-color: #7a5208; box-shadow: 0 6px 0 var(--ink), 0 0 0 4px var(--gold), 0 0 0 8px var(--ink), inset 0 0 0 4px #fff3b0; }
.node .num { position: absolute; left: 50%; top: calc(100% - 16px); transform: translateX(-50%); z-index: 1; font: 400 21px/1 var(--head); white-space: nowrap;
  padding: 3px 12px 4px; color: #fff; background: linear-gradient(#5aa8f0, #2f74d0); border: 4px solid var(--ink); border-radius: 10px;
  text-shadow: 0 2px 0 var(--ink); box-shadow: 0 3px 0 var(--ink); }
.node.done .num { background: linear-gradient(#ffe68a, var(--gold)); color: var(--ink); text-shadow: none; }
.node.next .num { background: linear-gradient(#b7f26a, var(--toxic)); color: var(--ink); text-shadow: none; }
.node .stars { position: absolute; left: 50%; top: calc(100% + 13px); transform: translateX(-50%); display: flex; gap: 1px; font-size: 19px; line-height: 1;
  text-shadow: 0 0 2px var(--ink), 0 2px 0 var(--ink); }
.node .stars em { font-style: normal; color: rgba(255,255,255,.5); }
.node .stars em.on { color: var(--gold); }
.node small { position: absolute; top: calc(100% + 35px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 16px; color: var(--paper);
  background: rgba(var(--navy),.86); border: 2px solid rgba(255,255,255,.25); border-radius: 8px; padding: 1px 9px; }
.node .badge { position: absolute; top: -8px; right: -26px; transform: rotate(9deg); z-index: 1; font: 400 13px/1 var(--head); font-style: normal; white-space: nowrap;
  padding: 4px 8px; border: 3px solid var(--ink); border-radius: 8px; background: var(--clean); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.node.t-boss .badge { background: var(--danger); color: #fff; text-shadow: 0 1px 0 var(--ink); right: -18px; }
.node.t-stand .badge { background: var(--gold); }
.node.t-belt .badge { background: var(--toxic); }
.node.next .medal { animation: nodeNext 1.2s ease-in-out infinite; }
@keyframes nodeNext { 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 6px var(--toxic), 0 0 0 10px var(--ink), 0 0 26px 12px rgba(160,240,90,.5); } }
/* you are here: Slingshot Tom on a pin over the stop to play next */
.node .you { position: absolute; left: -44px; top: -34px; width: 54px; height: 54px; border-radius: 50% 50% 50% 6px; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 50% 35%, #fff, #e3f3ff); border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink); overflow: visible;
  animation: youBob 1.1s ease-in-out infinite; }
.node .you .pc { position: absolute; inset: 0; border-radius: 50% 50% 50% 6px; }
.node .you em { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); font: 400 12px/1 var(--head); font-style: normal; color: var(--ink);
  background: var(--gold); border: 3px solid var(--ink); border-radius: 6px; padding: 2px 5px; }
@keyframes youBob { 50% { transform: translateY(-7px); } }
.node.locked { cursor: default; }
.node.locked .medal { filter: grayscale(.85) brightness(.62); }
.node.locked::after { content: ''; position: absolute; left: -4px; bottom: 10px; width: 22px; height: 17px; z-index: 2; background: #d5dde9; border: 3px solid var(--ink); border-radius: 5px; box-shadow: 0 2px 0 var(--ink); }
.node.locked::before { content: ''; position: absolute; left: 1px; bottom: 26px; width: 12px; height: 13px; z-index: 2; border: 4px solid var(--ink); border-bottom: 0; border-radius: 9px 9px 0 0; }
.node.locked .num { background: #7a83a3; }
.node.locked .stars { visibility: hidden; }
.node.locked small { color: rgba(255,255,255,.65); }

/* stage card / loadout: the troop grid takes what is left so START always shows */
#s-card { background: rgba(30,75,160,.42); }
.loadout { display: flex; flex-direction: column; max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); width: min(1060px, 100%); }
.loadout > * { flex: none; }
.lrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.loadout header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.loadout header h2 { font-size: 32px; }
#c-world { margin: 0; color: var(--sub); font-size: 18px; }
.tip { margin: 6px 0 4px; padding: 8px 12px; background: #fff3c4; border: 3px solid var(--ink); border-radius: 12px; font-size: 18px; }
#c-freaks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
#c-freaks li { position: relative; display: flex; flex-direction: column; align-items: center; width: 82px; padding: 4px 2px 6px; border: 3px solid var(--ink); border-radius: 12px;
  background: linear-gradient(#e8f5ff, #bfe2ff); font-size: 14px; text-align: center; line-height: 1.05; }
#c-freaks li.boss { background: linear-gradient(#ffe2dc, #ffa598); }
#c-freaks li .new { position: absolute; top: -8px; right: -6px; font: 400 11px var(--head); font-style: normal; background: var(--danger); color: #fff; border: 2px solid var(--ink); border-radius: 6px; padding: 1px 4px; }
#c-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.slot { position: relative; width: 74px; height: 86px; padding: 0; border: 4px dashed rgba(var(--navy),.3); border-radius: 14px; background: rgba(36,96,216,.06); }
.slot.full { border-style: solid; border-color: var(--ink); background: linear-gradient(color-mix(in srgb, var(--fam) 45%, #fff), color-mix(in srgb, var(--fam) 75%, #1a2348)); box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.slot .tag { position: absolute; left: 0; right: 0; bottom: 14px; border-width: 2px 0; border-radius: 0; font-size: 10px; padding: 1px 0; text-align: center; }
.slot canvas { display: block; margin: 2px auto 0; }
.slot canvas.body { position: absolute; left: 0; top: -4px; margin: 0; }
.slot.full { background: radial-gradient(ellipse 70% 60% at 50% 46%, #ffffff 0 34%, #dcefff 70%, #b3d7f7 100%); border-top: 6px solid var(--fam); }
.slot b { z-index: 1; }
.slot b { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font: 400 15px var(--head); color: var(--gold); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#c-troops { flex: 1 1 auto; min-height: 110px; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); grid-auto-rows: min-content; gap: 8px; margin-top: 10px; overflow: auto; padding: 2px; }
.troop { --fam: #a0662e; position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  padding: 4px 8px 4px 4px; border: 3px solid var(--ink); border-left-width: 9px; border-left-color: var(--fam); border-radius: 12px; background: #fff; color: var(--ink); }
.troop .pic { grid-row: 1 / 3; position: relative; width: 64px; height: 72px; border-radius: 10px; overflow: hidden; border: 2px solid var(--ink);
  background: radial-gradient(circle at 50% 36%, #fff 0 26%, color-mix(in srgb, var(--fam) 35%, #fff) 70%); }
.troop .pic canvas { display: block; margin: -2px 0 0 -2px; }
.troop .pic canvas.body { position: absolute; left: 0; top: -8px; margin: 0; }
.troop .pic { background: radial-gradient(ellipse 70% 60% at 50% 46%, #ffffff 0 34%, #dcefff 70%, #b3d7f7 100%); }
.troop .pic .tag { position: absolute; left: 0; right: 0; bottom: 17px; border-width: 2px 0; border-radius: 0; font-size: 10px; padding: 1px 0; text-align: center; }
.troop b { font: 400 17px/1.05 var(--head); align-self: end; padding-right: 18px; }
.troop span { font-size: 14px; color: var(--sub2); align-self: start; line-height: 1.1; }
.tag { font: 400 11px/1 var(--head); font-style: normal; letter-spacing: .06em; color: #fff; background: var(--fam); border: 2px solid var(--ink); border-radius: 6px; padding: 2px 5px 1px; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; }
.troop .cost { position: absolute; left: 0; right: 0; bottom: 0; height: 17px; display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--strip); font: 400 15px var(--head); font-style: normal; color: var(--gold); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.troop .rank { position: absolute; top: 3px; right: 6px; font: 400 12px var(--head); font-style: normal; color: var(--hd); }
.troop.on { background: linear-gradient(#e9ffd0, #c4ec8c); box-shadow: inset 0 0 0 3px var(--toxic2); }
.troop:disabled { opacity: .55; }
.fixed { margin: 6px 0 0; font-size: 17px; color: var(--danger2); }
.info { min-height: 1.3em; margin: 8px 0 0; font-size: 16px; color: var(--sub2); }
#c-supers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sup { display: flex; flex-direction: column; text-align: left; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.sup b { font: 400 17px var(--head); }
.sup span { font-size: 13px; color: var(--sub); line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sup.on { background: linear-gradient(#fff1b5, var(--gold)); }
.loadout footer { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; padding-bottom: 4px; }

/* pause + settings */
#s-pause, #s-settings { background: rgba(30,70,150,.5); }
#s-settings { background: radial-gradient(110% 85% at 50% 35%, rgba(60,140,230,.25), rgba(25,60,140,.62) 75%); }
.vol { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 14px; background: rgba(36,96,216,.06); text-align: left; }
.vol label { display: grid; grid-template-columns: 80px 1fr; align-items: center; font-family: var(--head); font-size: 17px; }
.vol .btn { align-self: center; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 14px; border-radius: 7px; border: 3px solid var(--ink); background: linear-gradient(90deg, var(--clean2), var(--toxic)); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 4px solid var(--ink); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 4px solid var(--ink); }
.keys { margin: 0; font-size: 15px; color: var(--sub); }

/* results */
#s-results { background: rgba(30,70,150,.4); }
.results { width: min(620px, 100%); text-align: center; }
.results h2 { font-size: clamp(36px, 7vh, 54px); line-height: 1; }
#s-results.won .results h2 { color: var(--gold2); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 4px 0 var(--ink)); }
#s-results.lost .results h2 { color: var(--clean); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 4px 0 var(--ink)); }
#s-results.lost .panel { background-image: linear-gradient(rgba(61,143,214,.06) 2px, transparent 2px), linear-gradient(90deg, rgba(61,143,214,.06) 2px, transparent 2px), linear-gradient(#f5fbff, #dcefff); }
.results .sub { margin: 6px 0 4px; font-size: 20px; color: var(--sub2); }
#r-stars { display: flex; justify-content: center; gap: 14px; margin: 6px 0 2px; }
#r-stars:empty { display: none; }
.star { display: flex; flex-direction: column; align-items: center; width: 110px; }
.star em { font-style: normal; font-size: 64px; line-height: 1; color: #cfdbec; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.star small { font-size: 14px; color: var(--sub); line-height: 1.1; }
.star.on em { color: var(--gold); animation: starPop .45s cubic-bezier(.3,1.7,.5,1) both; animation-delay: inherit; }
.star.on { animation: none; }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
#r-extra { display: flex; flex-direction: column; gap: 8px; align-items: stretch; margin: 6px 0; }
#r-extra .big { font: 400 28px var(--head); color: var(--hd); margin: 0; }
#r-extra .standing { margin: 0; font-size: 18px; }
.unlock { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; border: 4px solid var(--ink); border-radius: 14px;
  background: linear-gradient(#f0ffd8, #c4ec8c); animation: unlockIn .5s .9s cubic-bezier(.3,1.5,.5,1) both; }
.unlock i { display: block; font: 400 13px var(--head); font-style: normal; color: var(--toxic2); letter-spacing: .06em; }
.unlock b { display: block; font: 400 22px/1.05 var(--head); }
.unlock span { display: block; font-size: 15px; color: var(--sub2); line-height: 1.15; }
@keyframes unlockIn { from { transform: scale(.6); opacity: 0; } }
#r-board { margin: 6px 0; text-align: left; }
.results footer { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.results aside { color: var(--ink); }

/* barracks */
#s-barracks, #s-almanac, #s-credits { background: var(--sky), var(--bg); }
#b-troops { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.bt, .bu { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 4px solid var(--ink); border-radius: 16px; background: linear-gradient(#ffffff, var(--tile)); color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.bt > div, .bu > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bt b, .bu b { font: 400 20px/1.05 var(--head); }
.bt span, .bu span { font-size: 15px; color: var(--sub); }
.bt .pips { display: flex; gap: 4px; margin-top: 4px; }
.bt .pips em { width: 16px; height: 9px; border-radius: 4px; border: 2px solid var(--ink); background: #d6e2f2; }
.bt .pips em.on { background: var(--toxic); }
.bt.locked { filter: grayscale(.9); opacity: .6; }
.buy { flex: none; font: 400 16px var(--head); color: var(--ink); padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; background: linear-gradient(#ffe68a, var(--gold)); box-shadow: 0 3px 0 var(--ink); }
.buy:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.buy:disabled { filter: grayscale(1); opacity: .6; }
#s-barracks h3 { font-size: 26px; margin: 18px 0 8px; color: var(--gold); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
#b-throne { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; padding-bottom: 14px; }

/* almanac */
#a-tabs { display: flex; gap: 6px; }
#a-tabs button { font: 400 17px var(--head); padding: 6px 12px; border: 3px solid var(--ink); border-radius: 12px; background: var(--tile2); color: var(--ink); }
#a-tabs button.on { background: var(--gold); }
#a-tabs button[data-tab=freaks].on { background: var(--clean); }
.almanac { width: min(1180px, 100%); flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; gap: 14px; }
#a-grid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; align-content: start; padding: 2px; }
.ae { display: flex; flex-direction: column; align-items: center; padding: 4px 2px 6px; border: 3px solid var(--ink); border-radius: 12px; background: linear-gradient(#ffffff, var(--tile)); color: var(--ink); font-size: 14px; line-height: 1.05; text-align: center; }
.ae.boss { background: linear-gradient(#ffe2dc, #ffb2a6); }
.ae.on { box-shadow: 0 0 0 4px var(--gold); transform: translateY(-2px); }
.ae.unknown { background: #8f9ab8; color: #27315a; }
#a-detail { margin: 0; width: auto; overflow: auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
#a-detail canvas.big { width: 210px; height: 210px; flex: none; }
#a-detail h3 { font-size: 28px; color: var(--hd); margin-top: 4px; }
#a-detail .role { margin: 2px 0; font: 400 15px var(--head); color: var(--clean2); letter-spacing: .05em; }
#a-detail .short { font-weight: 700; color: var(--ink); }
#a-detail p { margin: 4px 0; font-size: 16px; line-height: 1.2; }
#a-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; text-align: left; font-size: 15px; width: 100%; }
#a-detail dt { font-family: var(--head); color: var(--hd); }
#a-detail dd { margin: 0; }

/* credits */
.credits { max-width: 900px; }
.credits h3 { font-size: 24px; color: var(--gold); margin: 16px 0 4px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.credits p { margin: 4px 0; }
.credits ul { margin: 4px 0; padding-left: 20px; font-size: 15px; font-weight: 600; line-height: 1.3; opacity: .9; }
.credits a { color: var(--clean); }

/* menu toast */
#menu-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 40; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: 90vw; padding: 9px 18px; font-size: 19px; color: var(--ink); background: var(--paper); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); transition: transform .2s, opacity .2s; }
#menu-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── battle HUD (logical 1600×900) ──────────────────────────────────────────── */
#hud { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; pointer-events: none; z-index: 5; display: none; font-size: 18px; }
body.battle #hud { display: block; }
#hud > * { pointer-events: auto; position: absolute; }
#hud { transition: opacity .3s; }
body.pt-cine #hud { opacity: 0; }
body.pt-cine #hud > * { pointer-events: none; }
#hud button { touch-action: none; }

/* Poop Coin jar: coins fly to (92, 74) */
#h-jar { left: 22px; top: 6px; width: 140px; height: 170px; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.jar { position: relative; width: 124px; height: 132px; margin-top: 10px; border: 5px solid var(--ink); border-radius: 22px 22px 30px 30px; overflow: hidden;
  background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(220,240,255,.28) 40%, rgba(255,255,255,.45)); box-shadow: 0 5px 0 var(--ink); }
.jar::before { content: ''; position: absolute; left: -5px; right: -5px; top: -5px; height: 22px; background: linear-gradient(#ff9a8a, #ec4a3a 60%, #b8302a); border-bottom: 5px solid var(--ink); z-index: 2; }
.jar i { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; background: repeating-linear-gradient(0deg, #b97a10 0 2px, #ffd23f 2px 7px, #e6a91e 7px 10px), #ffd23f; box-shadow: inset 0 6px 8px rgba(255,255,255,.35); }
.jar i::before, .jar i::after { content: ''; position: absolute; top: -14px; width: 30px; height: 30px; background: var(--coin) center / contain no-repeat; animation: bub 2.2s ease-in-out infinite; }
.jar i::before { left: 14px; } .jar i::after { left: 66px; width: 24px; animation-delay: -1.1s; }
@keyframes bub { 50% { transform: translateY(-5px) scale(1.12); } }
.jar b { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 3; min-width: 92px; text-align: center; padding: 1px 6px 3px;
  font: 400 34px/1 var(--head); color: var(--paper); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; background: rgba(var(--navy),.3); border-radius: 10px; }
#h-jar small { margin-top: 4px; font: 400 16px var(--head); letter-spacing: .06em; white-space: nowrap; color: var(--gold); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }

/* troop cards */
#h-cards { left: 182px; top: 10px; height: 158px; display: flex; gap: 8px; }
#h-cards .card { position: relative; width: 96px; height: 150px; padding: 0; border: 4px solid var(--ink); border-radius: 14px; overflow: hidden; --fam: #a0662e;
  background: var(--card);
  box-shadow: 0 5px 0 var(--ink), inset 0 -3px 0 rgba(var(--navy),.12); transition: transform .1s, box-shadow .1s; }
#h-cards .card canvas { position: absolute; left: 0; top: 18px; pointer-events: none; }
#h-cards .card .nm { position: absolute; left: 0; right: 0; top: 0; height: 22px; display: flex; align-items: center; justify-content: center; z-index: 1; pointer-events: none;
  font: 400 15px/1 var(--head); letter-spacing: .02em; white-space: nowrap; color: var(--paper); -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill;
  background: var(--fam); border-bottom: 3px solid var(--ink); }
#h-cards .card .nm.long { font-size: 12.5px; letter-spacing: 0; }
#h-tip { left: 182px; top: 176px; max-width: 900px; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px; pointer-events: none !important; z-index: 3;
  color: var(--ink); background: linear-gradient(#ffffff, var(--tile)); border: 4px solid var(--ink); border-left: 12px solid var(--fam); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); font-size: 21px; line-height: 1.1; }
#h-tip .tag { font-size: 15px; padding: 3px 7px 2px; }
#h-tip b { font: 400 22px var(--head); color: var(--hd); white-space: nowrap; }
#h-tip i { display: flex; align-items: center; gap: 3px; font: 400 22px var(--head); font-style: normal; color: var(--gold); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#h-cards .card .cost { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; display: flex; align-items: center; justify-content: center; gap: 3px; z-index: 1;
  font: 400 27px/1 var(--head); color: var(--paper); background: var(--strip); border-top: 3px solid var(--ink); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#h-cards .card .cost::before { content: ''; width: 23px; height: 23px; flex: none; background: var(--coin) center / contain no-repeat; }
#h-cards .card .cd { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 2; background: rgba(var(--navy),.6); pointer-events: none; }
#h-cards .card kbd { position: absolute; bottom: 36px; right: 4px; z-index: 1; font: 400 13px var(--head); color: var(--ink); opacity: .5; pointer-events: none; }
#h-cards .card.poor .cost { color: var(--danger); }
#h-cards .card.poor canvas, #h-cards .card.poor .nm { filter: grayscale(.85) brightness(.85); }
#h-cards .card.sel { transform: translateY(8px) scale(1.04); box-shadow: 0 0 0 5px var(--gold), 0 4px 0 var(--ink); }
#h-cards .card:hover:not(.sel) { transform: translateY(2px); }
/* conveyor (belt stages): one long toilet-paper belt across the whole card row, between two steel rollers */
#h-cards.belt { width: 852px; display: block; border: 4px solid var(--ink); border-radius: 18px;
  background: linear-gradient(#9aa4b5, #6a7383 50%, #4a5262); box-shadow: 0 5px 0 var(--ink), 0 12px 22px rgba(26,35,72,.35); }
#h-cards.belt::after { content: 'CONVEYOR'; position: absolute; right: 14px; bottom: -24px; font: 400 15px var(--head); letter-spacing: .06em; color: var(--paper); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#h-cards .belt-paper { position: absolute; left: 18px; right: 18px; top: 16px; bottom: 16px; overflow: hidden;
  background: radial-gradient(circle, rgba(150,165,195,.45) 1.5px, transparent 2.3px) 0 0 / 13px 13px, linear-gradient(#ffffff, #f2f4f8 55%, #dfe4ec);
  box-shadow: inset 0 7px 8px -5px rgba(20,28,60,.45), inset 0 -7px 8px -5px rgba(20,28,60,.4); animation: beltRun .52s linear infinite; }
#h-cards .belt-paper::before { content: ''; position: absolute; inset: 0 -100px 0 0;   /* the sheet perforations */
  background: repeating-linear-gradient(90deg, transparent 0 98px, rgba(26,35,72,.35) 98px 100px);
  -webkit-mask: repeating-linear-gradient(transparent 0 3px, #000 3px 8px); mask: repeating-linear-gradient(transparent 0 3px, #000 3px 8px); animation: beltSheet 4s linear infinite; }
@keyframes beltRun { to { background-position: -13px 0, 0 0; } }
@keyframes beltSheet { to { transform: translateX(-100px); } }
#h-cards .belt-rail { position: absolute; left: 10px; right: 10px; height: 13px; border: 3px solid var(--ink); border-radius: 7px; z-index: 0;
  background: radial-gradient(circle, #2a3148 2px, transparent 2.6px) 6px 50% / 50px 100% repeat-x, linear-gradient(#e6eaf1, #a9b2c1 60%, #7d8798); }
#h-cards .belt-rail.top { top: 4px; } #h-cards .belt-rail.bot { bottom: 4px; }
#h-cards .belt-roll { position: absolute; top: 10px; bottom: 10px; width: 24px; border: 3px solid var(--ink); border-radius: 10px; z-index: 0; }
#h-cards .belt-roll.l { left: 2px; background: repeating-linear-gradient(transparent 0 9px, rgba(26,35,72,.35) 9px 11px), linear-gradient(90deg, #5d6676, #e3e8ef 45%, #7a8495); animation: beltRoll .44s linear infinite; }
#h-cards .belt-roll.r { right: 2px; width: 30px; background: linear-gradient(90deg, #c9d0db, #ffffff 40%, #e8ecf2 70%, #b8c0cd); }   /* the toilet roll */
@keyframes beltRoll { to { background-position: 0 -11px, 0 0; } }
#h-cards .belt-empty { position: absolute; left: 0; right: 40px; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none;
  font: 400 24px var(--head); letter-spacing: .04em; color: rgba(26,35,72,.38); opacity: 0; transition: opacity .3s; }
#h-cards.belt.empty .belt-empty { opacity: 1; }
#h-cards .beltcard { position: absolute; top: 4px; height: 142px; z-index: 1; transition: left .9s cubic-bezier(.22,.8,.3,1), opacity .35s, transform .1s, box-shadow .1s; }
#h-cards .beltcard.arrive { opacity: 0; transform: scale(.85); transition: none; }
#h-cards .beltcard .cost { font-size: 19px; color: var(--toxic); }
#h-cards .beltcard .cost::before { display: none; }

/* throne supers */
#h-supers { left: 1044px; top: 10px; display: flex; gap: 8px; }
#h-supers .super { position: relative; width: 122px; height: 150px; padding: 0 6px 8px; border: 4px solid var(--ink); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; background: linear-gradient(#2f4aa8, #1d2c70); box-shadow: 0 5px 0 var(--ink); }
#h-supers .super .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(var(--sc1), var(--sc2)); transition: height .2s; }
#h-supers .super::before { content: ''; position: absolute; left: 50%; top: 12px; width: 62px; height: 62px; margin-left: -31px; z-index: 1; border-radius: 50%;
  border: 4px solid var(--ink); background: radial-gradient(circle at 38% 32%, #fff 0 10%, var(--sc1) 35%, var(--sc2)); }
#h-supers .super b { position: relative; z-index: 1; font: 400 18px/1 var(--head); color: var(--paper); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-align: center; }
#h-supers .super span { position: relative; z-index: 1; font: 400 15px var(--head); color: var(--gold); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#h-supers .super kbd { position: absolute; top: 4px; left: 7px; z-index: 1; font: 400 14px var(--head); color: var(--paper); opacity: .6; }
#h-supers .super.ready { animation: superReady 1s ease-in-out infinite; }
#h-supers .super.ready::before { box-shadow: 0 0 18px 6px var(--sc1); }
@keyframes superReady { 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 5px var(--gold); } }
.s-ultragag { --sc1: #c8f07c; --sc2: #5fa83a; }
.s-flush { --sc1: #9fe4ff; --sc2: #2f86c8; }
.s-swarm { --sc1: #8b9a6a; --sc2: #33331f; }
.s-rain { --sc1: #fff07a; --sc2: #e0a91e; }
#h-supers .s-ultragag::before { background: radial-gradient(circle at 38% 32%, #fff 0 10%, var(--sc1) 35%, var(--sc2)), var(--sc2); }

/* right block: charge, waves, stage + buttons */
#h-side { left: 1312px; top: 8px; width: 278px; display: flex; flex-direction: column; gap: 6px; }
#h-charge-box { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px; border: 4px solid var(--ink); border-radius: 14px;
  background: linear-gradient(#4a9cf0, #2862c4); box-shadow: 0 4px 0 var(--ink); }
#h-charge-box span { font: 400 16px var(--head); letter-spacing: .08em; color: var(--gold); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#h-charge { font: 400 28px/1 var(--head); color: var(--paper); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#h-wave { padding: 6px 10px 4px; border: 4px solid var(--ink); border-radius: 14px; background: rgba(30,60,140,.82); box-shadow: 0 4px 0 var(--ink); }
#h-wave .track { position: relative; height: 18px; border: 3px solid var(--ink); border-radius: 9px; background: #33447e; }
#h-wave-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(var(--clean), var(--clean2)); }
#h-flags { position: absolute; inset: 0; }
#h-flags i { position: absolute; top: -12px; width: 16px; height: 22px; margin-left: -8px; }
#h-flags i::before { content: ''; position: absolute; left: 3px; top: 0; width: 3px; height: 22px; background: var(--ink); }
#h-flags i::after { content: ''; position: absolute; left: 6px; top: 1px; width: 11px; height: 9px; background: var(--danger); border: 2px solid var(--ink); }
#h-flags i.up::after { background: var(--clean); }
#h-wave-label { display: block; margin-top: 3px; font-size: 16px; text-align: center; color: var(--paper); }
#h-side .row { display: flex; align-items: center; gap: 6px; }
#h-next { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px; border: 4px solid var(--ink); border-radius: 14px; cursor: pointer;
  background: linear-gradient(#ffd85a, #e8a21e); box-shadow: 0 4px 0 var(--ink); font: 400 19px/1.1 var(--head); color: var(--ink); }
#h-next[hidden] { display: none; }
#h-next b { font: 400 22px/1 var(--head); color: #3b2a10; }
#h-next:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#h-stage { flex: 1; min-width: 0; font: 400 16px var(--head); color: var(--paper); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb { width: 54px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font: 400 20px var(--head); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 12px; background: linear-gradient(#fffdf8, var(--tile) 60%, var(--tile2)); box-shadow: 0 4px 0 var(--ink); }
.hb:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#h-pause i { width: 8px; height: 22px; border-radius: 2px; background: var(--ink); }

/* boss bar */
#h-boss { left: 520px; top: 858px; width: 560px; display: flex; align-items: center; gap: 10px; pointer-events: none; }
#h-boss-name { flex: none; max-width: 210px; font: 400 20px var(--head); color: var(--danger); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#h-boss .track { flex: 1; height: 24px; border: 4px solid var(--ink); border-radius: 12px; background: #23317a; overflow: hidden; }
#h-boss-fill { display: block; height: 100%; width: 100%; background: linear-gradient(#ff9c8e, var(--danger) 45%, var(--danger2)); transition: width .15s; }

/* start button on last-stand days (below the board) */
#h-begin { left: 800px; top: 846px; transform: translateX(-50%); padding: 6px 34px 8px; font: 400 28px/1 var(--head); color: var(--ink); white-space: nowrap;
  background: linear-gradient(#d3f59a, var(--toxic) 50%, var(--toxic2)); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); animation: beginPulse 1s ease-in-out infinite; }
@keyframes beginPulse { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 8px rgba(159,214,90,.55); } }

/* unit menu */
#h-umenu { width: 320px; padding: 12px 12px 10px; color: var(--ink); background: linear-gradient(#ffffff, var(--tile)); border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink), 0 14px 30px rgba(var(--navy),.35); display: flex; flex-direction: column; gap: 6px; z-index: 3; }
#h-umenu h4 { font-size: 21px; padding-right: 34px; color: var(--hd); }
#h-umenu .job { margin: 2px 0 6px; padding: 3px 8px; font-size: 16px; line-height: 1.15; border-left: 6px solid var(--fam); background: rgba(255,255,255,.6); border-radius: 6px; }
#h-umenu .opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 6px 70px 7px 10px;
  border: 3px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
#h-umenu .opt b { font: 400 18px/1.05 var(--head); }
#h-umenu .opt span { font-size: 15px; line-height: 1.1; color: var(--sub2); }
#h-umenu .opt i { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 400 20px var(--head); font-style: normal; color: var(--toxic); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#h-umenu .opt.up { background: linear-gradient(#fff6cc, #ffe57a); }
#h-umenu .opt.br-b { background: linear-gradient(#e8f6ff, #bfe2ff); }
#h-umenu .opt.sell { background: linear-gradient(#ffe8e3, #ffc6bc); }
#h-umenu .opt:disabled { filter: grayscale(1); opacity: .55; }
#h-umenu .opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
#h-umenu .note { margin: 0; font-size: 15px; color: var(--sub); }
#h-umenu .x { position: absolute; top: 6px; right: 8px; width: 34px; height: 34px; padding: 0; font: 400 26px/1 var(--head); color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; background: var(--tile2); }

/* banners */
#h-banner { left: 800px; top: 300px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; pointer-events: none; z-index: 2; white-space: nowrap; }
#h-banner > div { display: flex; flex-direction: column; align-items: flex-start; }
#hb-face { width: 150px; height: 150px; flex: none; }
#hb-kick { font: 400 22px var(--head); font-style: normal; letter-spacing: .14em; color: var(--paper); padding: 1px 12px; border: 3px solid var(--ink); border-radius: 8px; background: var(--clean2); }
#hb-kick:empty { display: none; }
#hb-title { font: 400 64px/1 var(--head); color: var(--paper); -webkit-text-stroke: 11px var(--ink); paint-order: stroke fill; filter: drop-shadow(0 5px 0 var(--ink)); }
#hb-sub { max-width: 640px; white-space: normal; font-size: 22px; color: var(--paper); text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink); }
#h-banner.intro, #h-banner.boss { padding: 10px 30px 12px 14px; border: 5px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--ink); }
#h-banner.intro { background: linear-gradient(rgba(127,200,255,.92), rgba(61,143,214,.92)); }
#h-banner.boss { background: repeating-linear-gradient(-45deg, rgba(var(--navy),.92) 0 24px, rgba(200,48,42,.92) 24px 48px); }
#h-banner.boss #hb-kick { background: var(--danger); font-size: 26px; }
#h-banner.boss #hb-title { color: var(--gold); font-size: 72px; }
#h-banner.wave { top: 380px; }
#h-banner.wave #hb-title { font-size: 76px; color: var(--danger); }
#h-banner.go { animation: bannerIn .5s cubic-bezier(.25,1.6,.5,1); }
#h-banner.wave.go { animation: waveIn .6s cubic-bezier(.25,1.6,.5,1); }
@keyframes bannerIn { from { transform: translateX(-50%) scale(.3) rotate(-6deg); opacity: 0; } }
@keyframes waveIn { from { transform: translateX(-50%) scale(2.2); opacity: 0; } }

/* in-battle tips */
#h-toast { left: 800px; top: 184px; transform: translateX(-50%); max-width: 900px; padding: 7px 18px; font-size: 21px; text-align: center; color: var(--ink);
  background: var(--paper); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); pointer-events: none; z-index: 2; animation: toastIn .25s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, -10px); opacity: 0; } }

/* first-time guide: a bubble next to the glowing card, then next to the glowing pad */
#h-tut { width: 330px; padding: 10px 14px 10px; color: var(--ink); background: linear-gradient(#fffbe0, #ffe98a); border: 4px solid var(--ink); border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink), 0 12px 26px rgba(0,0,0,.35); z-index: 3; animation: toastIn .25s ease-out; }
#h-tut::before { content: ''; position: absolute; width: 22px; height: 22px; background: #fff3b0; border: 4px solid var(--ink); border-right: 0; border-bottom: 0; }
#h-tut.card::before { left: 30px; top: -15px; transform: rotate(45deg); }
#h-tut.pad::before { left: -15px; top: 62px; transform: rotate(-45deg); }
#h-tut.look { width: 380px; }
#h-tut.look::before { right: 22px; bottom: -15px; transform: rotate(225deg); }
#ht-ok { margin-right: 8px; padding: 4px 16px; font: 400 18px var(--head); color: #fff; background: var(--hd); border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink); }
#ht-n { display: block; font: 400 15px var(--head); font-style: normal; letter-spacing: .1em; color: var(--hd); }
#ht-text { margin: 2px 0 6px; font-size: 21px; line-height: 1.2; }
#ht-skip { padding: 2px 10px; font-size: 14px; color: var(--sub2); background: none; border: 2px solid #9fb4d8; border-radius: 8px; }
#h-cards .card.tut { animation: tutCard 1s ease-in-out infinite; z-index: 1; }
@keyframes tutCard { 0%, 100% { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 var(--ink); transform: translateY(0); } 50% { box-shadow: 0 0 0 9px rgba(255,210,63,.75), 0 4px 0 var(--ink); transform: translateY(6px); } }

/* ── small screens (phones in landscape) ────────────────────────────────────── */
@media (max-height: 560px) {
  html, body { font-size: 16px; }
  .scr { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #s-title { gap: 6px; }
  .tmenu { gap: 7px; grid-template-columns: repeat(7, auto); }
  .tmenu #t-play { grid-column: auto; min-width: 0; font-size: 24px; }
  .tmenu .btn { min-width: 0; font-size: 16px; padding: 7px 12px 8px; min-height: 38px; border-width: 3px; box-shadow: 0 4px 0 var(--ink); }
  .btn.big { font-size: 22px; padding: 9px 22px 10px; }
  header.bar { margin-bottom: 4px; }
  header.bar h2 { font-size: 24px; }
  .panel { padding: 10px 14px; border-width: 4px; border-radius: 18px; }
  .panel h2 { font-size: 26px; }
  .panel h4 { margin: 6px 0 4px; font-size: 16px; }
  .minfo { padding: 5px 14px; } .minfo h3 { font-size: 22px; } .minfo p { font-size: 15px; }
  .wtab { min-width: 120px; padding: 4px 10px 5px; border-width: 3px; } .wtab span { font-size: 16px; }
  #m-tabs { padding-bottom: 6px; }
  #m-path { min-height: 150px; } #m-path .mp-in { inset: 58px 22px 82px; }
  .wtab { min-width: 0; } .wtab b { font-size: 11px; } .wtab small { display: none; } #m-tabs { gap: 7px; }
  .minfo { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; } #m-place { display: none; } .minfo .mtag { margin: 0; font-size: 14px; } .minfo .mtag b { font-size: 12px; }
  .node { width: 66px; height: 66px; } .node.t-boss { width: 80px; height: 80px; } .node .medal { border-width: 4px; }
  .node .num { font-size: 15px; padding: 2px 8px 3px; border-width: 3px; top: calc(100% - 12px); } .node .stars { font-size: 14px; top: calc(100% + 9px); }
  .node small { font-size: 12px; top: calc(100% + 25px); padding: 0 6px; } .node .badge { font-size: 10px; padding: 3px 5px; right: -20px; }
  .node .you { width: 40px; height: 40px; left: -26px; top: -30px; border-width: 3px; } .node .you em { font-size: 10px; top: -14px; }
  .mapcard { min-height: 220px; }
  .loadout { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .loadout header h2 { font-size: 22px; } #c-world { font-size: 14px; }
  /* phones: the whole card scrolls and START sticks to the bottom edge */
  .loadout { overflow-y: auto; padding-bottom: 0; }
  #c-troops { flex: none; min-height: 0; overflow: visible; margin-top: 6px; } #c-info { display: none; }
  .loadout footer { position: sticky; bottom: 0; z-index: 2; margin: 6px -14px 0; padding: 6px 14px 8px; background: linear-gradient(rgba(255,255,255,0), #fff 30%); }
  .slot { width: 52px; height: 60px; border-width: 3px; } .slot canvas { width: 44px !important; height: 44px !important; } .slot canvas.body { width: 46px !important; height: 64px !important; }
  .troop { grid-template-columns: 48px 1fr; } .troop .pic { width: 48px; height: 58px; } .troop canvas { width: 44px !important; height: 44px !important; margin-left: 0 !important; } .troop canvas.body { width: 44px !important; height: 64px !important; }
  #c-freaks li canvas { width: 34px !important; height: 34px !important; } #c-freaks { gap: 5px; }
  .sup { padding: 4px 8px; } .sup span { -webkit-line-clamp: 1; }
  .tip { font-size: 15px; padding: 5px 10px; }
  #c-freaks li { width: 62px; font-size: 11px; padding: 2px 1px 3px; border-width: 2px; }
  .results h2 { font-size: 32px; }
  .star em { font-size: 44px; }
  .pearlcount.big { font-size: 24px; }
  .almanac { grid-template-columns: 1fr 280px; }
  #a-detail canvas.big { width: 140px; height: 140px; }
}
@media (max-width: 760px) {
  .tmenu { grid-template-columns: repeat(2, auto); }
  .almanac { grid-template-columns: 1fr; }
  #a-detail { display: none; }
  #s-title .pearlcount { top: auto; bottom: 10px; }
}

/* every Poop Coin price gets the coin in front of it */
.troop .cost::before, #h-tip i::before, #h-umenu .opt i::before { content: ''; width: 1em; height: 1em; flex: none; background: var(--coin) center / contain no-repeat; }
#h-umenu .opt i { display: flex; align-items: center; gap: 2px; color: var(--gold) !important; }
