@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&display=swap');

:root {
  --bg: #03040a; --ink: #e9ecff; --dim: #8f97b8; --line: rgba(150, 170, 255, .18);
  --glass: rgba(10, 13, 28, .82); --glass2: rgba(22, 27, 52, .9);
  --pink: #ff5fa2; --cyan: #7df9ff; --gold: #ffc94a; --green: #6dffa8; --red: #ff5566;
  --font: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.35 var(--font); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
small { color: var(--dim); font-size: 11px; }

#space { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#space:active { cursor: grabbing; }
#fade { position: fixed; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .22s; }
#fade.on { opacity: 1; }

/* ---- labels pinned to 3D things ---- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; text-align: center; text-shadow: 0 1px 4px #000, 0 0 10px #000; will-change: transform; }
.label.clickable { pointer-events: auto; cursor: pointer; }
.label.sc b { display: block; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; }
.label.sc small { color: var(--dim); }
.label.sc:hover b { color: var(--cyan); }
.label.body span { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 99px; background: rgba(5, 8, 20, .55); border: 1px solid transparent; font-size: 12px; }
.label.body:hover span { border-color: var(--cyan); }
.label em { display: block; color: var(--pink); font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; animation: bob 1.4s ease-in-out infinite; }
.label.dead span { color: var(--dim); }
.label.meteor span { font-size: 10.5px; color: #c9c0b4; }
.lflag { display: inline-flex; border-radius: 2px; overflow: hidden; outline: 1px solid rgba(255, 255, 255, .5); }
@keyframes bob { 50% { transform: translateY(-3px); } }

.flag { display: inline-flex; border-radius: 3px; overflow: hidden; outline: 1px solid rgba(255, 255, 255, .35); flex: none; }
.flag-svg { display: block; }

/* ---- buttons ---- */
.btn { padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line); background: rgba(120, 140, 255, .12); font-weight: 600; white-space: nowrap; transition: .12s; }
.btn:hover:not(:disabled) { background: rgba(120, 140, 255, .26); border-color: rgba(170, 190, 255, .5); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.hot { background: linear-gradient(135deg, #ff5fa2, #b14dff); border-color: transparent; color: #fff; }
.btn.hot:hover:not(:disabled) { filter: brightness(1.15); background: linear-gradient(135deg, #ff5fa2, #b14dff); }
.btn.ghost { background: transparent; }
.btn.big { padding: 11px 18px; font-size: 15px; }
.x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; color: var(--dim); line-height: 1; }
.x:hover { color: #fff; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; }
#hud > * { pointer-events: auto; }
#top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: linear-gradient(var(--glass), rgba(10, 13, 28, .55)); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); flex-wrap: wrap; }
#top .grow { flex: 1; }
.who { display: flex; align-items: center; gap: 9px; }
.who b { display: block; font-size: 15px; }
.lvl { display: grid; grid-template-columns: auto 90px; column-gap: 8px; align-items: center; }
.lvl b { font-size: 16px; color: var(--cyan); grid-row: span 2; }
.lvl small { grid-column: 2; }
.bar { height: 7px; border-radius: 9px; background: rgba(255, 255, 255, .12); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), #6f8cff); border-radius: 9px; transition: width .3s; }
.bar.gold i { background: linear-gradient(90deg, #ffb84a, var(--gold)); }
.res { display: flex; align-items: baseline; gap: 5px; }
.res b { font-size: 18px; min-width: 2ch; font-variant-numeric: tabular-nums; }
.res .ico, .loc .ico { font-size: 16px; }
.res.wealth .ico, .res.wealth b { color: var(--gold); }
.res.energy .ico, .res.energy b { color: var(--cyan); }
.loc { display: flex; gap: 6px; align-items: center; background: none; border: 1px dashed var(--line); border-radius: 8px; padding: 5px 10px; }
.loc:hover { border-color: var(--pink); color: var(--pink); }
.btn.worm { background: linear-gradient(135deg, rgba(125, 249, 255, .25), rgba(177, 77, 255, .35)); border-color: rgba(125, 249, 255, .5); }
.btn.worm.locked { opacity: .55; background: none; }

#crumbs { display: flex; align-items: center; gap: 6px; padding: 8px 14px; flex-wrap: wrap; pointer-events: none !important; }
#crumbs > * { pointer-events: auto; }
#crumbs button { border: 0; background: rgba(10, 13, 28, .6); padding: 3px 9px; border-radius: 6px; color: var(--dim); }
#crumbs button:hover { color: #fff; }
#crumbs button.cur { color: var(--ink); font-weight: 700; }
#crumbs span { color: var(--dim); }
#crumbs em { margin-left: 8px; color: var(--dim); font-size: 11px; font-style: normal; opacity: .8; pointer-events: none; }

#panel { position: absolute; right: 12px; top: 106px; width: 290px; max-height: calc(100% - 330px); overflow: auto; padding: 14px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); display: flex; flex-direction: column; gap: 9px; }
#panel h2 { font-size: 19px; padding-right: 20px; }
.sub { color: var(--dim); text-transform: capitalize; }
.sheet .sub, .ob-card .sub { text-transform: none; }
.hint { color: var(--dim); font-size: 12px; }
.warn { color: var(--red); }
.row { display: flex; justify-content: space-between; gap: 10px; }
.row span { color: var(--dim); }
.meter { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: center; }
.meter span { color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border: 1px solid; border-radius: 99px; font-size: 11.5px; background: rgba(0, 0, 0, .3); }
.chip i { display: inline-flex; }
.owner { display: flex; gap: 9px; align-items: center; padding: 7px; border-radius: 8px; background: rgba(255, 95, 162, .12); }
.owner b, .owner small { display: block; }

/* ---- dock ---- */
#dock { margin-top: auto; display: flex; gap: 10px; padding: 10px 12px 12px; align-items: flex-end; background: linear-gradient(transparent, rgba(3, 4, 10, .88) 40%); flex-wrap: wrap; }
#dock section { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; backdrop-filter: blur(8px); }
#dock h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
#dock h3 small { text-transform: none; letter-spacing: 0; }
.fleet { border-color: rgba(255, 95, 162, .45) !important; max-width: 330px; }
.market { margin-left: auto; }
.slots { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.benchwrap .slots { display: grid; grid-template-columns: repeat(5, auto); }
.fleet .slots { max-width: 268px; }
#dock h3 { flex-wrap: wrap; }
.slot { width: 62px; height: 70px; border-radius: 9px; border: 1px dashed rgba(160, 175, 255, .28); background: rgba(255, 255, 255, .035); display: grid; place-items: center; position: relative; }
.slot.army { border-color: rgba(255, 95, 162, .5); background: rgba(255, 95, 162, .07); }
.slot.sel { outline: 2px solid var(--cyan); outline-offset: 1px; }
.dragging .slot.empty { border-style: solid; border-color: var(--cyan); }
.item { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; cursor: grab; border-radius: 8px; border-bottom: 3px solid var(--tier); position: relative; padding-top: 3px; }
.item:hover { background: rgba(255, 255, 255, .08); }
.item i { display: grid; }
.item small { font-size: 9.5px; color: var(--ink); max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 2px; }
.item .st { position: absolute; top: 0; left: 3px; font-size: 10px; color: var(--gold); text-shadow: 0 0 4px #000; }
.item.raw i { transform: scale(.78); opacity: .95; }
.sell { grid-column: 1 / -1; height: 24px; padding: 0 12px; display: grid; place-items: center; border: 1px dashed rgba(255, 85, 102, .4); color: var(--dim); border-radius: 9px; font-size: 11.5px; text-align: center; opacity: .35; transition: .15s; }
.sell.on, .dragging .sell { opacity: 1; color: #ffb3bb; cursor: pointer; background: rgba(255, 85, 102, .12); }
.cards { display: flex; gap: 6px; align-items: stretch; }
.card { width: 88px; height: 112px; border-radius: 10px; border: 1px solid var(--tier); background: linear-gradient(160deg, color-mix(in srgb, var(--tier) 26%, #0d1124), #0d1124 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; transition: .12s; padding: 4px; }
.card:hover { transform: translateY(-4px); box-shadow: 0 6px 18px color-mix(in srgb, var(--tier) 45%, transparent); }
.card b { font-size: 12px; }
.card small { display: flex; align-items: center; gap: 3px; }
.card .mini { display: inline-flex; }
.card .cost { position: absolute; top: 4px; right: 6px; font-size: 11px; font-weight: 700; color: var(--gold); }
.card .own { position: absolute; top: 4px; left: 6px; font-size: 10px; color: var(--cyan); font-weight: 700; }
.card.ready { box-shadow: 0 0 0 2px var(--cyan), 0 0 16px rgba(125, 249, 255, .5); }
.card.poor { filter: saturate(.3) brightness(.7); }
.card.sold { border: 1px dashed var(--line); background: none; }
.card i { display: grid; }
.acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.market .acts { flex-direction: column; justify-content: center; }
.odds { display: inline-flex; gap: 6px; font-weight: 700; }

#tooltip { position: fixed; left: 0; top: 0; pointer-events: none; padding: 5px 10px; border-radius: 7px; background: var(--glass2); border: 1px solid var(--line); z-index: 5; }
#tooltip b, #tooltip small { display: block; }
#tooltip small { text-transform: capitalize; }
#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 60; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 9px; background: var(--glass2); border: 1px solid var(--line); font-weight: 600; animation: tin .25s; transition: .4s; }
.toast.good { border-color: var(--green); color: var(--green); }
.toast.bad { border-color: var(--red); color: #ffb3bb; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; z-index: 20; }
#modal { background: rgba(3, 4, 10, .7); display: grid; place-items: center; z-index: 40; backdrop-filter: blur(3px); }
.sheet { position: relative; width: min(560px, 94vw); max-height: 86vh; overflow: auto; padding: 22px; border-radius: 14px; background: var(--glass2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 4px 11px; color: var(--dim); }
.tabs button.on { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 700; }
.board { display: flex; flex-direction: column; gap: 3px; }
.brow { display: grid; grid-template-columns: 30px auto 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .04); border: 0; text-align: left; width: 100%; }
button.brow { grid-template-columns: 30px 1fr auto; }
button.brow:hover { background: rgba(255, 255, 255, .1); }
.brow.me { background: rgba(255, 95, 162, .18); outline: 1px solid var(--pink); }
.brow .rank { color: var(--dim); font-weight: 700; text-align: center; }
.brow b { color: var(--gold); font-size: 15px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.code { display: block; padding: 14px; border-radius: 10px; background: #05060f; border: 1px dashed var(--cyan); color: var(--cyan); font: 600 15px/1.5 ui-monospace, Consolas, monospace; word-break: break-all; text-align: center; user-select: all; }

/* ---- onboarding ---- */
#onboard { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(3, 4, 10, .25), rgba(3, 4, 10, .85)); overflow: auto; padding: 20px; }
.ob-card { width: min(760px, 100%); padding: 30px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.kicker { color: var(--pink); letter-spacing: .3em; text-transform: uppercase; font-size: 11px; font-weight: 700; }
.title { display: flex; flex-direction: column; font-size: clamp(30px, 6.4vw, 62px); line-height: .98; text-transform: uppercase; font-weight: 700; letter-spacing: .02em; }
.title span { background: linear-gradient(90deg, #ff5fa2, #ffc94a, #6dffa8, #7df9ff, #b14dff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: #c5cbea; max-width: 54ch; margin: 0 auto; font-size: 15px; }
.ob-card h2 { font-size: 26px; }
.ob-card textarea { width: 100%; background: #05060f; color: var(--cyan); border: 1px dashed var(--cyan); border-radius: 10px; padding: 12px; font: 600 15px ui-monospace, Consolas, monospace; text-align: center; resize: none; }
.flag-builder { display: grid; grid-template-columns: 300px 1fr; gap: 22px; text-align: left; align-items: start; }
.flag-builder > div:first-child { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.flag-preview { border-radius: 8px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); outline: 1px solid rgba(255, 255, 255, .3); line-height: 0; }
.flag-controls { display: flex; flex-direction: column; gap: 9px; }
.ctl label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; max-width: 380px; }
.swatches button { aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(255, 255, 255, .25); padding: 0; }
.swatches button.on { outline: 2px solid #fff; outline-offset: 1px; }
.thumbs button { padding: 0; border: 1px solid rgba(255, 255, 255, .2); border-radius: 4px; overflow: hidden; line-height: 0; background: none; }
.thumbs button.on { outline: 2px solid var(--cyan); outline-offset: 1px; }
.name-preview { display: flex; gap: 12px; align-items: center; justify-content: center; font-size: 28px; }
.wordcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wordlist { height: 230px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); align-content: start; }
.wordlist button { border: 0; background: rgba(255, 255, 255, .05); border-radius: 6px; padding: 5px; }
.wordlist button:hover { background: rgba(255, 255, 255, .14); }
.wordlist button.on { background: var(--pink); color: #fff; font-weight: 700; }
.check { display: flex; gap: 8px; justify-content: center; align-items: center; cursor: pointer; }

/* ---- wormhole ---- */
#wormhole { background: #05030f; display: grid; grid-template-columns: 1fr 300px; grid-template-rows: auto 1fr; overflow: hidden; }
.wh-bg { position: absolute; inset: 0; background: radial-gradient(circle at 42% 45%, #3a1466 0, #12083a 30%, #05030f 70%); overflow: hidden; }
.wh-bg i { position: absolute; left: 42%; top: 45%; width: 60vmax; height: 60vmax; margin: -30vmax; border-radius: 50%; border: 2px solid rgba(125, 249, 255, .28); box-shadow: 0 0 40px rgba(177, 77, 255, .4), inset 0 0 40px rgba(255, 95, 162, .25); animation: tunnel 6s linear infinite; }
.wh-bg i:nth-child(2) { animation-delay: -1.2s; } .wh-bg i:nth-child(3) { animation-delay: -2.4s; }
.wh-bg i:nth-child(4) { animation-delay: -3.6s; } .wh-bg i:nth-child(5) { animation-delay: -4.8s; }
@keyframes tunnel { from { transform: scale(.02) rotate(0); opacity: 0; } 15% { opacity: 1; } to { transform: scale(2.6) rotate(140deg); opacity: 0; } }
.wh-top { grid-column: 1 / -1; position: relative; display: flex; gap: 12px; align-items: center; padding: 14px 20px; background: linear-gradient(rgba(5, 3, 15, .9), transparent); }
.wh-top > div { flex: 1; }
.wh-top h1 { font-size: 26px; letter-spacing: .14em; background: linear-gradient(90deg, var(--cyan), #b14dff, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wh-top p { color: var(--dim); }
.wh-map { position: relative; overflow: hidden; }
.wh-track { position: absolute; left: 0; right: 0; top: 70%; transition: transform .9s cubic-bezier(.3, .8, .3, 1); }
.wh-link { position: absolute; height: 5px; margin-top: -2.5px; transform-origin: 0 50%; border-radius: 3px; background: repeating-linear-gradient(90deg, rgba(160, 175, 255, .35) 0 8px, transparent 8px 15px); }
.wh-link.done { background: linear-gradient(90deg, var(--pink), var(--cyan)); box-shadow: 0 0 10px rgba(125, 249, 255, .6); }
.wh-node { position: absolute; width: 46px; height: 46px; margin: -23px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #151a3a; border: 2px solid rgba(160, 175, 255, .45); color: var(--dim); }
.wh-node.done { background: linear-gradient(135deg, #ff5fa2, #7a4dff); border-color: #fff; color: #fff; box-shadow: 0 0 14px rgba(255, 95, 162, .7); }
.wh-node.next { border-color: var(--cyan); color: var(--cyan); animation: pulse 1.2s infinite; }
.wh-node.boss { width: 64px; height: 64px; margin: -32px; font-size: 24px; border-color: var(--red); color: var(--red); }
.wh-node.boss.done { color: #fff; }
.wh-node small { position: absolute; bottom: -17px; color: var(--dim); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(125, 249, 255, 0), 0 0 22px rgba(125, 249, 255, .9); } from, to { box-shadow: 0 0 0 0 rgba(125, 249, 255, .6); } }
.wh-token { position: absolute; transform: translate(-50%, -128%); transition: left .9s ease-in-out, top .9s ease-in-out; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); z-index: 3; }
.wh-bob { display: grid; justify-items: center; animation: bob 1.4s ease-in-out infinite; }
.wh-token i { width: 0; height: 0; border: 7px solid transparent; border-top-color: #fff; }
.wh-side { position: relative; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: rgba(5, 3, 15, .72); border-left: 1px solid var(--line); overflow: auto; }
.wh-depth b { display: block; font-size: 60px; line-height: 1; color: var(--cyan); }
.wh-next { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.wh-next b, .wh-next small { display: block; }
.wh-next.boss { border-color: var(--red); } .wh-next.boss small:first-child { color: var(--red); font-weight: 700; }
.wh-log { display: flex; flex-direction: column; gap: 3px; }
.wh-log div { display: flex; justify-content: space-between; padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, .04); font-size: 12px; }
.wh-log .w b { color: var(--green); } .wh-log .l b { color: var(--red); }

/* ---- 2.5D battle ---- */
#battle { z-index: 50; background: radial-gradient(ellipse at 50% 30%, #1a1040, #05030f 75%); display: flex; flex-direction: column; overflow: hidden; }
.b-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; }
.b-top h2 { letter-spacing: .12em; text-transform: uppercase; }
.arena { flex: 1; display: grid; place-items: center; perspective: 1150px; perspective-origin: 50% 20%; min-height: 0; }
.floor { position: relative; width: min(1040px, 94vw); height: min(600px, 66vh); transform: rotateX(46deg); transform-style: preserve-3d; border-radius: 26px;
  background: linear-gradient(90deg, rgba(125, 249, 255, .1), transparent 46%, transparent 54%, rgba(255, 85, 102, .12)),
    repeating-linear-gradient(0deg, rgba(150, 170, 255, .16) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(90deg, rgba(150, 170, 255, .16) 0 1px, transparent 1px 52px), rgba(14, 18, 44, .7);
  border: 1px solid rgba(150, 170, 255, .4); box-shadow: 0 0 80px rgba(120, 90, 255, .35), inset 0 0 90px rgba(0, 0, 0, .6); }
.unit { position: absolute; width: 0; height: 0; transform-style: preserve-3d; }
.unit .shadow { position: absolute; height: 18px; left: 0; top: 0; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, .65), transparent 70%); }
.unit .up { position: absolute; left: 0; bottom: 0; transform: translateX(-50%) rotateX(-46deg); transform-origin: 50% 100%; display: grid; justify-items: center; gap: 2px; transition: opacity .5s, filter .5s; }
.unit .sprite { display: grid; filter: drop-shadow(0 0 9px var(--c)); animation: hover 2.2s ease-in-out infinite; }
.unit.s0 .sprite svg { transform: rotate(90deg); } .unit.s1 .sprite svg { transform: rotate(-90deg); }
.unit:nth-child(odd) .sprite { animation-delay: -.9s; }
@keyframes hover { 50% { transform: translateY(-5px); } }
.unit .sprite.recoil { animation: recoil .22s; }
.unit.s0 .recoil { --kick: -8px; } .unit.s1 .recoil { --kick: 8px; }
@keyframes recoil { 40% { transform: translateX(var(--kick)); } }
.unit.hit .up { animation: hit .2s; }
@keyframes hit { 30% { filter: brightness(2.6); transform: translateX(-50%) rotateX(-46deg) scale(.93); } }
.hpbar { width: 56px; height: 6px; background: rgba(0, 0, 0, .7); border-radius: 4px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .25); }
.hpbar i { display: block; height: 100%; width: 100%; background: var(--green); transition: width .18s; }
.unit.s1 .hpbar i { background: var(--red); }
.unit.boss .hpbar { width: 110px; height: 9px; }
.unit .nm { font-size: 10.5px; white-space: nowrap; text-shadow: 0 1px 3px #000; color: #dfe4ff; }
.unit .nm b { color: var(--gold); }
.unit.dead .up { opacity: .12; filter: grayscale(1) blur(1px); }
.unit.dead .shadow { opacity: .3; }
.unit.retreat .up { opacity: 0; }
.shot { position: absolute; left: 0; top: 0; width: 30px; height: 5px; margin: -2.5px 0 0 -15px; border-radius: 4px; background: linear-gradient(90deg, transparent, var(--c), #fff); box-shadow: 0 0 12px 2px var(--c); pointer-events: none; }
.shot.crit { height: 9px; margin-top: -4.5px; width: 44px; }
.shot.heal { border-radius: 50%; width: 12px; height: 12px; margin: -6px; background: var(--c); }
.pop { position: absolute; top: -8px; font-weight: 700; font-size: 14px; animation: rise .8s forwards; pointer-events: none; text-shadow: 0 1px 3px #000; }
.pop.dmg { color: #fff; } .pop.crit { color: var(--gold); font-size: 19px; } .pop.heal { color: var(--green); }
@keyframes rise { to { transform: translateY(-34px); opacity: 0; } }
.banner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; background: rgba(3, 4, 10, .55); cursor: pointer; animation: tin .3s; }
.banner h1 { font-size: clamp(48px, 9vw, 110px); letter-spacing: .1em; line-height: 1; }
.banner.win h1 { background: linear-gradient(90deg, var(--gold), var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.banner.lose h1 { color: var(--red); }
.banner p { font-size: 19px; font-weight: 600; }

@media (max-width: 900px) {
  #wormhole { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .wh-side { border-left: 0; border-top: 1px solid var(--line); max-height: 30vh; }
  .flag-builder { grid-template-columns: 1fr; }
  #panel { top: auto; bottom: 320px; right: 8px; left: 8px; width: auto; max-height: 34vh; }
  .market { margin-left: 0; }
  .card { width: 64px; height: 96px; } .slot { width: 52px; height: 62px; }
  #crumbs em { display: none; }
}
