:root {
  --gold: #f2c35b; --gold2: #ffe7a3; --gold3: #9a6a1f; --ink: #f6ecd9; --ink2: #cbbfa9; --mute: #8f8473;
  --panel: rgba(20, 13, 18, 0.72); --panel2: rgba(34, 22, 28, 0.86); --line: rgba(255, 214, 140, 0.20); --line2: rgba(255, 214, 140, 0.38);
  --crimson: #b3262e; --crimson2: #7c1720; --good: #7ee07a; --bad: #ff5a4a;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --disp: "Cinzel", "Trajan Pro", Georgia, serif; --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #140d12; color: var(--ink); font-family: var(--ui); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.screen { position: absolute; inset: 0; display: none; pointer-events: none; }
.screen.active { display: block; }
.screen > * { pointer-events: auto; }
#hud.screen > * { pointer-events: none; }
#hud .hud-top > *, #hud .unit-pop, #hud .tray > *, #hud .tray .cards * { pointer-events: auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); box-shadow: 0 8px 28px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,240,200,.06); }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 240px; padding: 15px 26px; border-radius: 14px;
  font-family: var(--disp); font-weight: 700; font-size: 18px; letter-spacing: .06em; color: var(--ink);
  background: linear-gradient(180deg, rgba(60,38,40,.9), rgba(30,19,24,.92)); border: 1px solid var(--line2);
  box-shadow: 0 10px 26px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,235,190,.12); transition: transform .12s ease, filter .12s ease, box-shadow .2s; }
.btn small { font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--ink2); opacity: .85; }
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { color: #2a1406; background: linear-gradient(180deg, #ffe3a0, #f2c35b 45%, #c98d2c); border-color: rgba(255,240,200,.7); text-shadow: 0 1px 0 rgba(255,255,255,.35); box-shadow: 0 12px 30px rgba(200,140,40,.35), inset 0 1px 0 rgba(255,255,255,.6); }
.btn.primary small { color: #5a3410; }
.btn.sm { min-width: 0; padding: 9px 14px; font-size: 13px; border-radius: 10px; font-family: var(--ui); font-weight: 700; letter-spacing: .01em; }
.btn.ghost { background: rgba(255,255,255,.05); }
.btn[disabled] { opacity: .45; filter: grayscale(.4); pointer-events: none; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink2); background: rgba(20,13,18,.55); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.chip:hover { color: var(--ink); border-color: var(--line2); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; font-weight: 800; color: var(--ink); background: var(--panel); border: 1px solid var(--line); }
.icon-btn:active { transform: scale(.95); }
.link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; padding: 0; }
.pill { padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; background: var(--panel); border: 1px solid var(--line); }
.pill.gold { color: var(--gold2); }

/* ---------- title ---------- */
#title { background: radial-gradient(ellipse 60% 70% at 50% 48%, rgba(14,7,10,.62), rgba(14,7,10,.38) 60%, rgba(10,5,8,.6) 100%); }
.title-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); display: flex; flex-direction: column; align-items: center; text-align: center; width: min(560px, 92vw); }
.crest { width: 112px; height: 112px; background: url(./icon.svg) center/contain no-repeat; filter: drop-shadow(0 10px 24px rgba(0,0,0,.55)); animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }
.logo { margin: 10px 0 4px; font-family: var(--disp); font-weight: 900; font-size: clamp(46px, 9vw, 92px); line-height: .95; letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff3cf 0%, #f6cd6c 45%, #b9801f 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #3a1a08) drop-shadow(0 14px 22px rgba(0,0,0,.55)); }
.logo span { display: inline-block; }
.tagline { margin: 6px 0 26px; font-size: 15px; color: var(--ink); opacity: .9; letter-spacing: .02em; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title-foot { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }

/* ---------- headers ---------- */
.bar { position: absolute; top: calc(14px + var(--st)); left: calc(16px + var(--sl)); right: calc(16px + var(--sr)); display: flex; align-items: center; gap: 14px; z-index: 2; }
.bar h2 { margin: 0; flex: 1; font-family: var(--disp); font-weight: 900; font-size: 26px; letter-spacing: .06em; color: var(--gold2); text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.bar .icon-btn { font-size: 26px; font-weight: 400; padding-bottom: 3px; }

/* ---------- level select ---------- */
#levels, #armory { background: linear-gradient(180deg, rgba(14,8,12,.82), rgba(14,8,12,.92)); }
.level-grid { position: absolute; top: calc(74px + var(--st)); bottom: 0; left: 0; right: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px calc(16px + var(--sr)) calc(24px + var(--sb)) calc(16px + var(--sl));
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-content: start; }
.lv { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--panel2); text-align: left; transition: transform .15s, border-color .15s, box-shadow .2s; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.lv:hover { transform: translateY(-2px); border-color: var(--line2); box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.lv canvas { display: block; width: 100%; aspect-ratio: 16 / 7; }
.lv .lv-body { padding: 10px 12px 12px; }
.lv .lv-num { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--mute); text-transform: uppercase; }
.lv .lv-name { font-family: var(--disp); font-weight: 700; font-size: 17px; margin-top: 2px; color: var(--ink); }
.lv .lv-stars { position: absolute; top: 8px; right: 10px; font-size: 15px; letter-spacing: 1px; color: rgba(255,255,255,.25); text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.lv .lv-stars b { color: var(--gold); }
.lv .tag { position: absolute; top: 8px; left: 10px; padding: 4px 8px; border-radius: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: rgba(140,20,20,.85); color: #ffe0d6; border: 1px solid rgba(255,120,100,.4); }
.lv .tag.new { background: rgba(200,150,40,.9); color: #2a1406; border-color: rgba(255,240,200,.6); }
.lv.locked { filter: grayscale(.85) brightness(.6); pointer-events: none; }
.lv.locked::after { content: "🔒"; position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 16 / 7; display: grid; place-items: center; font-size: 26px; }
.lv .lv-unlock { font-size: 11.5px; color: var(--ink2); margin-top: 4px; }

/* ---------- armory ---------- */
.armory-note { position: absolute; top: calc(70px + var(--st)); left: calc(18px + var(--sl)); right: 18px; margin: 0; font-size: 13.5px; color: var(--ink2); }
.armory-list { position: absolute; top: calc(104px + var(--st)); bottom: 0; left: 0; right: 0; overflow-y: auto; padding: 4px calc(16px + var(--sr)) calc(24px + var(--sb)) calc(16px + var(--sl)); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.arm { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); }
.arm .a-ico { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: radial-gradient(circle at 40% 35%, #8e1c26, #3a0b12); border: 1px solid var(--line2); }
.arm .a-body { flex: 1; min-width: 0; }
.arm .a-name { font-family: var(--disp); font-weight: 700; font-size: 16px; }
.arm .a-desc { font-size: 12.5px; color: var(--ink2); margin: 2px 0 7px; }
.arm .pips { display: flex; gap: 5px; }
.arm .pips i { width: 22px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); }
.arm .pips i.on { background: linear-gradient(90deg, #ffe3a0, #e2ad48); box-shadow: 0 0 8px rgba(242,195,91,.5); }

/* ---------- HUD ---------- */
.hud-top { position: absolute; top: calc(10px + var(--st)); left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hud-vault { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 9px; min-width: 190px; }
.vault-icon { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #f2c35b 45%, #9a6a1f); box-shadow: 0 0 14px rgba(242,195,91,.55), inset 0 -2px 0 rgba(0,0,0,.25); }
.vault-meta { flex: 1; }
.vault-num { white-space: nowrap; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.vault-num b { font-size: 16px; color: var(--gold2); margin-right: 4px; font-weight: 800; }
.vault-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 3px; }
.vault-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #c98d2c, #ffe3a0); border-radius: 3px; transition: width .25s ease; }
.vault-bar i.low { background: linear-gradient(90deg, #8e1c26, #ff6a5a); }
.hud-center { padding: 6px 18px 7px; text-align: center; min-width: 150px; }
.lvl-name { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; }
.timer { font-family: var(--disp); font-weight: 900; font-size: 22px; letter-spacing: .04em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer.urgent { color: #ffd45c; }
.timer.boss { color: #ff8a70; font-size: 14px; letter-spacing: .08em; padding: 4px 0 2px; }
.hud-right { display: flex; gap: 8px; align-items: center; }
.coins { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 44px; font-weight: 800; font-size: 17px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.coin-ico { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e8b64a 50%, #8a5e1a); box-shadow: inset 0 0 0 2px rgba(120,80,20,.5); }
.coins.bump { animation: bump .25s ease; }
@keyframes bump { 40% { transform: scale(1.08); } }

.boss-bar { position: absolute; top: calc(66px + var(--st)); left: 50%; transform: translate(-50%, -10px); width: min(460px, 70vw); text-align: center; opacity: 0; transition: opacity .3s, transform .3s; }
.boss-bar.on { opacity: 1; transform: translate(-50%, 0); }
.boss-name { font-family: var(--disp); font-weight: 900; font-size: 14px; letter-spacing: .12em; color: #ffd2c4; text-shadow: 0 2px 8px rgba(0,0,0,.8); text-transform: uppercase; }
.boss-track { height: 9px; margin-top: 4px; border-radius: 5px; background: rgba(20,6,6,.75); border: 1px solid rgba(255,120,100,.35); overflow: hidden; }
.boss-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7c1720, #ff5a3a, #ffb86a); transition: width .15s linear; }

.tray { position: absolute; left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); bottom: calc(10px + var(--sb)); display: flex; align-items: flex-end; gap: 10px; justify-content: center; }
.cards { display: flex; gap: 8px; padding: 7px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow-x: auto; scrollbar-width: none; max-width: calc(100% - 90px); }
.cards::-webkit-scrollbar { display: none; }
.card { position: relative; flex: none; width: 74px; height: 78px; border-radius: 12px; background: linear-gradient(180deg, rgba(70,44,44,.85), rgba(32,20,24,.9)); border: 1px solid rgba(255,214,140,.16); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 5px; transition: transform .12s, border-color .12s, box-shadow .12s, filter .12s; }
.card canvas { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 54px; height: 54px; pointer-events: none; }
.card .c-cost { position: relative; display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 13px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.card .c-cost::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e8b64a 50%, #8a5e1a); }
.card .c-key { position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 700; color: var(--mute); }
.card.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242,195,91,.45), 0 8px 20px rgba(242,195,91,.25); transform: translateY(-4px); background: linear-gradient(180deg, rgba(110,70,40,.9), rgba(50,30,24,.95)); }
.card.poor { filter: saturate(.3) brightness(.7); }
.card.poor .c-cost { color: #ff8a7a; }
.card.locked { filter: grayscale(1) brightness(.45); pointer-events: none; }
.card.locked::after { content: "🔒"; position: absolute; top: 18px; font-size: 18px; }
.volley { position: relative; flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #b3262e, #4a0d14); border: 1px solid rgba(255,200,160,.45); box-shadow: 0 10px 24px rgba(0,0,0,.45); }
.volley .v-ring { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(var(--gold) var(--p, 100%), rgba(255,255,255,.08) 0); -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%); }
.volley .v-ico { font-size: 28px; line-height: 1; margin-top: -8px; color: #ffe3c4; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.volley .v-lbl { position: absolute; bottom: 11px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #ffd6c4; }
.volley.cool { filter: saturate(.4) brightness(.7); }
.volley.armed { box-shadow: 0 0 0 3px rgba(255,180,120,.8), 0 0 30px rgba(255,120,60,.6); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

.unit-pop { position: absolute; left: 0; top: 0; width: 210px; padding: 11px 12px 12px; display: none; transform: translate(-50%, -100%); }
.unit-pop.on { display: block; }
.up-head { display: flex; justify-content: space-between; align-items: baseline; }
.up-head b { font-family: var(--disp); font-size: 16px; }
.up-head span { font-size: 11px; font-weight: 800; color: var(--gold); letter-spacing: .08em; }
.up-stats { font-size: 12px; color: var(--ink2); margin: 5px 0 9px; line-height: 1.45; }
.up-stats em { font-style: normal; color: var(--good); font-weight: 700; }
.up-actions { display: flex; gap: 8px; }
.up-actions .btn { flex: 1; }

.toasts { position: absolute; top: calc(70px + var(--st)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; background: rgba(20,13,18,.8); border: 1px solid var(--line); animation: tIn .25s ease, tOut .4s ease 2.4s forwards; white-space: nowrap; }
.toast.warn { border-color: rgba(255,120,100,.5); color: #ffd2c4; }
@keyframes tIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes tOut { to { opacity: 0; transform: translateY(-6px); } }
.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; opacity: 0; transform: scale(.96); transition: opacity .35s, transform .35s; }
.banner.on { opacity: 1; transform: none; }
.banner-k { font-size: 12px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: #ff9a80; }
.banner-t { font-family: var(--disp); font-weight: 900; font-size: clamp(30px, 6vw, 58px); color: #fff0dc; letter-spacing: .04em; text-shadow: 0 4px 0 #3a0b0b, 0 12px 30px rgba(0,0,0,.7); }
.banner-s { font-size: 14px; color: var(--ink2); margin-top: 4px; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.banner::before { content: ""; position: absolute; left: 0; right: 0; top: -18px; bottom: -18px; background: linear-gradient(90deg, transparent, rgba(30,6,8,.65) 25%, rgba(30,6,8,.65) 75%, transparent); z-index: -1; }
.hint { position: absolute; left: 50%; bottom: calc(108px + var(--sb)); transform: translateX(-50%); padding: 9px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; background: rgba(20,13,18,.82); border: 1px solid var(--line2); opacity: 0; transition: opacity .25s; white-space: nowrap; }
.hint.on { opacity: 1; }

/* ---------- modal ---------- */
.modal { position: absolute; inset: 0; display: none; place-items: center; background: rgba(8,4,6,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 20; padding: 16px; }
.modal.on { display: grid; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(440px, 94vw); max-height: 92vh; overflow-y: auto; padding: 24px 24px 22px; text-align: center; background: linear-gradient(180deg, rgba(44,28,32,.96), rgba(22,14,18,.97)); border-color: var(--line2); animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.modal-card h3 { margin: 0 0 4px; font-family: var(--disp); font-weight: 900; font-size: 32px; letter-spacing: .04em; color: var(--gold2); }
.modal-card h3.bad { color: #ff9a86; }
.modal-card .sub { color: var(--ink2); font-size: 14px; margin-bottom: 14px; }
.modal-card .stars { font-size: 46px; letter-spacing: 6px; margin: 4px 0 8px; color: rgba(255,255,255,.14); }
.modal-card .stars b { color: var(--gold); text-shadow: 0 0 18px rgba(242,195,91,.6); display: inline-block; animation: star .5s cubic-bezier(.2,1.6,.4,1) both; }
.modal-card .stars b:nth-child(2) { animation-delay: .2s; } .modal-card .stars b:nth-child(3) { animation-delay: .4s; }
@keyframes star { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 18px; }
.stats div { padding: 9px 4px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06); }
.stats b { display: block; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stats span { font-size: 10.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.modal-actions .btn { min-width: 0; }
.help-steps { text-align: left; display: grid; gap: 10px; margin: 10px 0 18px; }
.help-steps div { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: 13.5px; line-height: 1.45; color: var(--ink2); }
.help-steps b { color: var(--ink); }
.help-steps i { font-style: normal; flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(242,195,91,.15); color: var(--gold); font-weight: 800; }
.unlock-note { margin: -6px 0 14px; padding: 9px 12px; border-radius: 12px; font-size: 13px; background: rgba(242,195,91,.12); border: 1px solid rgba(242,195,91,.3); color: var(--gold2); }

.rotate { position: absolute; inset: 0; display: none; z-index: 30; background: #140d12; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 30px; font-family: var(--disp); font-size: 20px; color: var(--ink); }
.rotate.on { display: flex; }
.rot-ico { font-size: 54px; color: var(--gold); animation: spin 2.4s ease-in-out infinite; }
@keyframes spin { 50% { transform: rotate(90deg); } }

#hud.boss-on .toasts { top: calc(108px + var(--st)); }
/* ---------- compact (phones in landscape) ---------- */
@media (max-height: 500px) {
  .hud-top { top: calc(6px + var(--st)); }
  .hud-vault { min-width: 150px; padding: 5px 12px 5px 7px; }
  .vault-icon { width: 24px; height: 24px; }
  .timer { font-size: 18px; }
  .hud-center { padding: 4px 14px 5px; min-width: 120px; }
  .icon-btn { width: 38px; height: 38px; }
  .coins { height: 38px; font-size: 15px; padding: 0 11px; }
  .tray { bottom: calc(6px + var(--sb)); }
  .cards { padding: 5px; gap: 6px; }
  .card { width: 60px; height: 60px; }
  .card canvas { width: 42px; height: 42px; top: 1px; }
  .card .c-cost { font-size: 11.5px; }
  .volley { width: 60px; height: 60px; }
  .volley .v-ico { font-size: 22px; } .volley .v-lbl { bottom: 8px; font-size: 9px; }
  .boss-bar { top: calc(52px + var(--st)); }
  #hud.boss-on .toasts { top: calc(90px + var(--st)); }
  .unit-pop { width: 178px; padding: 8px 10px 9px; border-radius: 12px; }
  .up-head b { font-size: 14px; }
  .up-stats { font-size: 11px; margin: 3px 0 7px; }
  .up-desc { display: none; }
  .up-actions .btn { padding: 7px 8px; font-size: 12px; }
  .toasts { top: calc(54px + var(--st)); }
  .hint { bottom: calc(80px + var(--sb)); }
  .crest { width: 70px; height: 70px; }
  .logo { font-size: 48px; margin-top: 4px; }
  .tagline { margin: 2px 0 12px; font-size: 13px; }
  .btn { padding: 10px 22px; font-size: 15px; min-width: 210px; }
  .menu { gap: 8px; }
  .title-foot { margin-top: 12px; }
  .modal-card { padding: 16px 18px; }
  .modal-card h3 { font-size: 24px; }
  .modal-card .stars { font-size: 34px; margin: 0 0 4px; }
  .stats { margin: 4px 0 10px; }
  .modal-actions { flex-direction: row; flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; padding: 10px 12px; }
}
@media (max-width: 520px) {
  .hud-vault { min-width: 0; }
  .hud-center { min-width: 0; padding: 5px 10px; }
  .lvl-name { display: none; }
  .card { width: 56px; height: 62px; }
  .card canvas { width: 42px; height: 42px; }
}
