/* Moonward - cyanotype night garden.
   Everything is Prussian blue and photogram white. The only warm things are the moth, her dust, and fire. */

:root {
  --ink: #06142b;
  --prussian: #0d2a52;
  --wash: #16407a;
  --line: #7fb0e6;
  --paper: #e9f1fb;
  --ember: #ff8f2e;
  --flame: #ffd27a;
  --dust: #f5df94;
  --rose: #ff5c7c;
  --cut: #10335f;
  --serif: 'IM Fell English', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Alegreya Sans', 'Gill Sans', 'Trebuchet MS', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--ink); color: var(--paper);
  font: 400 17px/1.4 var(--sans);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: manipulation;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(130% 75% at 50% -5%, #17437e 0%, #0c2a55 42%, #06142b 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--dust); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ic { width: 1em; height: 1em; fill: currentColor; flex: none; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ---------- shared pieces ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: 26px;
  font-weight: 700; font-size: 18px; letter-spacing: .01em;
  background: rgba(22, 64, 122, .7); box-shadow: inset 0 0 0 1px rgba(127, 176, 230, .45);
}
.btn.primary { background: var(--ember); color: #2a1200; box-shadow: 0 0 26px rgba(255, 143, 46, .35); }
.btn.quiet { background: none; box-shadow: none; color: var(--line); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.btn[aria-disabled="true"] { opacity: .4; }
.btn.wide { width: 100%; }

.screen { padding: max(18px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; flex: 1; }
.serif { font-family: var(--serif); }
.muted { color: var(--line); }
.warm { color: var(--dust); }
.rosy { color: var(--rose); }

.md { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--dust); }
.md .ic { width: 16px; height: 16px; }

/* a brushed cyanotype plate: the rough pale edge is the paper showing round the wash */
.plate { position: relative; }
.plate > .edge { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); pointer-events: none; overflow: visible; }
.plate > .edge rect { fill: #1a4a8c; filter: url(#rough); }

/* ---------- the hollow ---------- */

.hollow { align-items: stretch; gap: 14px; }
.hol-top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--line); }
.icon-btn .ic { width: 22px; height: 22px; }
.hero { display: grid; justify-items: center; text-align: center; gap: 2px; margin-top: -6px; }
.moon { width: 132px; height: 132px; }
.moon .rim { fill: none; stroke: rgba(233, 241, 251, .4); stroke-width: 1; }
.moon .dark { fill: #081a36; }
.moon .lit { fill: var(--paper); filter: drop-shadow(0 0 10px rgba(233, 241, 251, .7)); }
.title { font: italic 400 58px/1 var(--serif); margin-top: -34px; letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(6, 20, 43, .9); }
.lede { font-size: 17px; color: var(--line); max-width: 30ch; }
.specimen { width: 168px; height: 150px; margin: 2px auto -4px; color: #f3f7e6; --cut: #0f3162; filter: drop-shadow(0 0 14px rgba(255, 200, 130, .28)); }
.specimen.sp-tiger { color: #ffe3bb; } .specimen.sp-hawk { color: #f4dbe8; } .specimen.sp-ghost { color: #f6f6ff; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(127, 176, 230, .28); margin-top: 6px; }
.tab { flex: 1; min-height: 46px; font-size: 16px; color: var(--line); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--dust); font-weight: 700; }
.tabbody { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid rgba(127, 176, 230, .16); }
.row h3 { font: 400 20px/1.2 var(--serif); }
.row p { font-size: 15.5px; color: var(--line); grid-column: 1; }
.row .side { grid-column: 2; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 4px; }
.row.locked h3, .row.locked p { opacity: .55; }
.pill { min-height: 40px; min-width: 76px; padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 16px; background: rgba(22, 64, 122, .8); box-shadow: inset 0 0 0 1px rgba(127, 176, 230, .5); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pill .ic { width: 14px; height: 14px; }
.pill.can { background: var(--dust); color: #2a2100; box-shadow: none; }
.pill.sel { background: var(--paper); color: #0a2145; box-shadow: none; }
.pill[aria-disabled="true"] { opacity: .45; }
.ranks { display: flex; gap: 4px; }
.ranks i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--dust); }
.ranks i.on { background: var(--dust); }
.note { font-size: 15.5px; color: var(--line); padding: 12px 0 2px; }
.scale-slot { display: grid; grid-template-columns: 40px 1fr; gap: 2px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(127, 176, 230, .16); text-align: left; width: 100%; }
.scale-slot .spot { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px rgba(245, 223, 148, .6); color: var(--dust); --cut: #0f3162; }
.scale-slot .spot .ic { width: 22px; height: 22px; }
.scale-slot.empty .spot { box-shadow: inset 0 0 0 1.5px rgba(127, 176, 230, .35); }
.scale-slot h3 { font: 400 20px/1.2 var(--serif); }
.scale-slot p { font-size: 15.5px; color: var(--line); }
.scale-slot.pick { background: rgba(245, 223, 148, .1); box-shadow: inset 3px 0 0 var(--dust); padding-left: 10px; }

/* ---------- path, gifts, events, endings ---------- */

.runbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.runbar .where { display: grid; }
.zname { font: italic 400 24px/1.1 var(--serif); }
.zstep { font-size: 14.5px; color: var(--line); }
.vitals { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.trail { display: flex; gap: 5px; align-items: center; }
.trail i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px rgba(127, 176, 230, .6); }
.trail i.done { background: var(--line); }
.trail i.here { background: var(--dust); box-shadow: 0 0 8px var(--dust); }
.trail i.boss { border-radius: 2px; transform: rotate(45deg); }
.trail .gap { width: 8px; }

.heading { font: 400 30px/1.1 var(--serif); }
.sub { color: var(--line); font-size: 16.5px; max-width: 36ch; }
.choices { display: flex; flex-direction: column; gap: 18px; margin-top: 4px; }
.choice { display: block; text-align: left; width: 100%; }
.choice .in { position: relative; padding: 14px 16px; background: linear-gradient(160deg, rgba(22, 64, 122, .9), rgba(13, 42, 82, .92)); border-radius: 3px; display: grid; gap: 6px; }
.choice h3 { font: 400 23px/1.15 var(--serif); }
.choice p { font-size: 15.5px; color: var(--line); }
.choice .kin { display: flex; gap: 2px; flex-wrap: wrap; color: var(--paper); --cut: #123a70; }
.choice .kin .ic { width: 36px; height: 36px; filter: drop-shadow(0 0 3px rgba(170, 210, 255, .45)); }
.choice .gain { font-size: 15px; color: var(--dust); }
.choice.sel .in { box-shadow: 0 0 0 2px var(--dust); }
.choice[aria-disabled="true"] { opacity: .45; }
.gift-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--dust); box-shadow: inset 0 0 0 1.5px rgba(245, 223, 148, .6); --cut: #123a70; }
.gift-ic .ic { width: 20px; height: 20px; }
.gift-head { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; }
.rar { font-size: 14px; color: var(--line); }
.rar.r1 { color: #b9e3ff; } .rar.r2 { color: var(--dust); }
.actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; }
.gifts-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 18px; font-size: 15px; background: rgba(22, 64, 122, .6); box-shadow: inset 0 0 0 1px rgba(127, 176, 230, .35); }
.chip .ic { width: 14px; height: 14px; color: var(--dust); }
.tally { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 16.5px; padding: 12px 0; border-top: 1px solid rgba(127, 176, 230, .25); border-bottom: 1px solid rgba(127, 176, 230, .25); }
.tally dt { color: var(--line); } .tally dd { margin: 0; text-align: right; font-weight: 700; }
.epitaph { font: italic 400 21px/1.35 var(--serif); max-width: 32ch; }

/* ---------- the fight ---------- */

.fight { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); user-select: none; -webkit-user-select: none; }
.hud { display: grid; gap: 4px; }
.hud-top { display: flex; align-items: center; gap: 6px; }
.hud-top .where { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.hud-top .zname { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; min-height: 24px; }
.stat { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.stat .ic { width: 15px; height: 15px; }
.pips { display: flex; gap: 3px; align-items: center; }
.pip { width: 8px; height: 13px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: #fff3d6; }
.pip.off { background: none; box-shadow: inset 0 0 0 1.2px rgba(255, 243, 214, .4); }
.stat.en .pip { width: 11px; height: 11px; border-radius: 2px; transform: rotate(45deg); background: var(--ember); margin: 0 2px; box-shadow: 0 0 6px rgba(255, 143, 46, .7); }
.stat.en .pip.off { background: none; box-shadow: inset 0 0 0 1.2px rgba(255, 143, 46, .5); }
.stat.du { color: var(--dust); }

.board-wrap { display: grid; place-items: center; min-height: 0; padding: 5px; }
.board {
  position: relative; display: grid; grid-template-columns: repeat(6, 1fr); width: 100%; aspect-ratio: 6 / 7;
  background: linear-gradient(170deg, #1a4c8f 0%, #133d78 45%, #0e2f61 100%);
  box-shadow: inset 0 0 40px rgba(6, 20, 43, .55);
}
.zone-lane .board { background: linear-gradient(170deg, #1d4a86 0%, #17406f 50%, #1a3354 100%); }
.zone-dark .board { background: linear-gradient(170deg, #142f66 0%, #0d2250 50%, #08173a 100%); }
.zone-lane .plate > .edge rect { fill: #2a4f7e; }
.zone-dark .plate > .edge rect { fill: #17346c; }

.tile { position: relative; aspect-ratio: 1; display: block; box-shadow: inset 0 0 0 .5px rgba(160, 200, 245, .13); color: var(--paper); }
.tile.alt { background: rgba(255, 255, 255, .024); }
.tile .l { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.tile.rock .rock { opacity: .34; inset: 6%; width: 88%; height: 88%; }
.tile.has-litter .litter { opacity: .5; color: #efe6c4; inset: 8%; width: 84%; height: 84%; }
.tile.has-wet .wet { opacity: .42; color: #a8d6ff; inset: 10%; width: 80%; height: 80%; }
.tile.has-web .web { opacity: .7; }
.tile.has-dust .dust { opacity: 1; color: var(--dust); inset: 5%; width: 90%; height: 90%; filter: drop-shadow(0 0 3px rgba(245, 223, 148, .8)); animation: twinkle 2.6s ease-in-out infinite; }
.tile:nth-child(3n).has-dust .dust { animation-delay: -.9s; } .tile:nth-child(3n+1).has-dust .dust { animation-delay: -1.7s; }
.tile.has-flame .flame { opacity: .9; color: var(--ember); inset: 14%; width: 72%; height: 72%; animation: flick .5s ease-in-out infinite alternate; }
.tile.has-remains .remains { opacity: .9; color: var(--dust); inset: 14%; width: 72%; height: 72%; }
.tile.has-mark .mark { opacity: 1; background: repeating-linear-gradient(135deg, rgba(255, 92, 124, .46) 0 3px, rgba(255, 92, 124, .08) 3px 8px); box-shadow: inset 0 0 0 1.5px rgba(255, 92, 124, .85); }
.tile.has-spawn .mark { opacity: 1; background: none; box-shadow: none; }
.tile.has-spawn .mark::after { content: ""; position: absolute; inset: 16%; border-radius: 50%; border: 2px dashed rgba(255, 92, 124, .9); animation: spin 6s linear infinite; }
.tile.can-move .hint, .tile.target .hint { opacity: 1; }
.tile.can-move .hint::after { content: ""; position: absolute; left: 50%; top: 50%; width: 24%; height: 24%; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(233, 241, 251, .7); }
.tile.target { background: rgba(255, 143, 46, .16); }
.tile.target .hint::after { content: ""; position: absolute; inset: 7%; border-radius: 50%; box-shadow: inset 0 0 0 2.5px var(--ember), 0 0 12px rgba(255, 143, 46, .6); animation: pulse 1s ease-in-out infinite; }
.tile.will-burn { box-shadow: inset 0 0 0 1.5px rgba(255, 190, 110, .8), inset 0 0 16px rgba(255, 143, 46, .7); }
.unit[data-pv]::before { content: attr(data-pv); position: absolute; right: 2%; top: 2%; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ember); color: #2a1200; font: 700 12.5px/18px var(--sans); text-align: center; z-index: 2; }
.unit.pv-kill .hp { background: var(--ember); color: #2a1200; text-decoration: line-through; }
.tile.sel { box-shadow: inset 0 0 0 2px var(--paper); }
.tile .badge { position: absolute; top: 2px; right: 2px; z-index: 5; font: 700 12.5px/1 var(--sans); background: var(--rose); color: #2b0010; border-radius: 8px; padding: 2px 5px; pointer-events: none; }
.tile .mk { position: absolute; left: 2px; bottom: 2px; z-index: 5; font: 700 12.5px/1 var(--sans); background: #2b0010; color: var(--rose); border-radius: 8px; padding: 2px 5px; pointer-events: none; box-shadow: 0 0 0 1px var(--rose); }
.tile .badge:empty, .tile .mk:empty { display: none; }
.tile .cost { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); font: 700 12px/1 var(--sans); color: var(--ember); pointer-events: none; }
.tile .cost:empty { display: none; }

.units, .fx { position: absolute; inset: 0; pointer-events: none; }
.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lines line { stroke: rgba(233, 241, 251, .5); stroke-width: .035; stroke-dasharray: .09 .09; stroke-linecap: round; }
.lines circle { fill: none; stroke: rgba(233, 241, 251, .6); stroke-width: .035; }
.lines .hit { stroke: var(--rose); }
.unit { position: absolute; left: 0; top: 0; width: calc(100% / 6); height: calc(100% / 7); transition: transform .13s cubic-bezier(.3, .7, .3, 1); color: #dbe9fa; --cut: #133d78; }
.unit > .ic { position: absolute; inset: 8%; width: 84%; height: 84%; filter: drop-shadow(0 0 3px rgba(170, 210, 255, .5)); transition: transform .12s, opacity .25s; }
.unit .hp { position: absolute; right: 2%; bottom: 2%; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #071a36; color: var(--paper); font: 700 12.5px/18px var(--sans); text-align: center; box-shadow: 0 0 0 1px rgba(160, 200, 245, .55); }
.unit .st { position: absolute; left: 2%; top: 2%; display: none; width: 17px; height: 17px; border-radius: 50%; background: #071a36; color: var(--dust); place-items: center; }
.unit .st .ic { width: 11px; height: 11px; }
.unit.dazed .st { display: grid; }
.unit.dazed > .ic { opacity: .55; }
.unit.smo > .ic { filter: drop-shadow(0 0 5px rgba(255, 143, 46, .95)); }
.unit.neutral { color: #b9cfe8; }
.unit.neutral .hp { display: none; }
.unit.small > .ic { inset: 20%; width: 60%; height: 60%; }
.unit.elite > .ic { inset: 2%; width: 96%; height: 96%; }
.unit.boss { z-index: 2; }
.unit.boss > .ic { inset: -14%; width: 128%; height: 128%; filter: drop-shadow(0 0 7px rgba(190, 220, 255, .7)); }
.unit.will-hit::after { content: "!"; position: absolute; left: 2%; top: 2%; width: 17px; height: 17px; border-radius: 50%; background: var(--rose); color: #2b0010; font: 700 13px/17px var(--sans); text-align: center; }
.unit.will-hit > .ic { filter: drop-shadow(0 0 5px rgba(255, 92, 124, .95)); }
.unit.swoop { transition-duration: .24s; }
.unit.push { transition-duration: .18s; }
.unit.bump > .ic { transform: scale(1.22); }
.unit.dying > .ic { transform: scale(.3) rotate(40deg); opacity: 0; }
.unit.dying .hp, .unit.dying .st { display: none; }
.unit.arriving > .ic { transform: scale(.2); opacity: 0; }
.unit.moth { z-index: 3; color: #f0f8e2; --cut: #1a4c8f; }
.unit.moth.sp-tiger { color: #ffe3bb; } .unit.moth.sp-hawk { color: #f4dbe8; } .unit.moth.sp-ghost { color: #f6f6ff; }
.unit.moth > .ic { inset: 3%; width: 94%; height: 94%; filter: drop-shadow(0 0 6px rgba(255, 190, 110, .8)); }
.unit.moth.flit { transition-duration: .22s; }
.unit.moth.flit > .ic { transform: scale(1.3); }
.unit.moth.rooted::after { content: ""; position: absolute; inset: 0; background: repeating-conic-gradient(rgba(233, 241, 251, .5) 0 4deg, transparent 4deg 45deg); border-radius: 50%; opacity: .7; }
.board.shake { animation: shake .3s; }

.fxt { position: absolute; width: calc(100% / 6); height: calc(100% / 7); left: 0; top: 0; }
.fx-burn { background: radial-gradient(circle, #fff6d8 0%, #ffc04d 28%, #ff7a1a 55%, rgba(255, 90, 20, 0) 74%); animation: burn .52s ease-out forwards; mix-blend-mode: screen; }
.fx-spark { background: radial-gradient(circle, #fff 0%, #ffd27a 30%, rgba(255, 143, 46, 0) 65%); animation: burn .26s ease-out forwards; }
.fx-boom { background: radial-gradient(circle, #fff 0%, #ffe9a8 35%, rgba(255, 160, 60, 0) 72%); animation: burn .42s ease-out forwards; }
.fx-acid, .fx-swoop, .fx-zap, .fx-stoop, .fx-web, .fx-gale, .fx-bolt { background: radial-gradient(circle, rgba(255, 255, 255, .95) 0%, rgba(255, 92, 124, .8) 45%, rgba(255, 92, 124, 0) 75%); animation: burn .38s ease-out forwards; }
.fx-beam, .fx-puff, .fx-wave { background: radial-gradient(circle, rgba(255, 250, 225, .9) 0%, rgba(245, 223, 148, .5) 45%, rgba(245, 223, 148, 0) 72%); animation: burn .4s ease-out forwards; }
.fx-warn { box-shadow: inset 0 0 0 2px var(--rose); animation: fade .3s ease-out forwards; }
.float { position: absolute; left: 0; top: 0; width: calc(100% / 6); text-align: center; font: 700 19px/1 var(--sans); text-shadow: 0 1px 6px #06142b, 0 0 2px #06142b; animation: rise .85s ease-out forwards; z-index: 9; white-space: nowrap; }
.float.f-fire { color: var(--flame); } .float.f-hit { color: var(--paper); } .float.f-hurt { color: var(--rose); font-size: 23px; } .float.f-heal { color: #b6f2c9; } .float.f-note { color: var(--dust); font-size: 15px; }
.banner { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; text-align: center; background: rgba(6, 20, 43, .6); font: italic 400 32px/1.15 var(--serif); padding: 20px; animation: fadein .35s ease-out; }
.banner small { display: block; font: 400 17px/1.3 var(--sans); color: var(--line); margin-top: 6px; }

.info { min-height: 46px; padding: 0 4px; font-size: 15.5px; line-height: 1.3; color: var(--line); display: flex; align-items: center; }
.info b { color: var(--paper); font-weight: 700; }
.info .warm { color: var(--dust); }
.bar { display: flex; gap: 7px; align-items: stretch; min-width: 0; }
.bar.crowded { gap: 5px; }
.bar.crowded .ab .lbl { display: none; }
.bar.crowded .ab .ic { width: 28px; height: 28px; }
.bar.crowded .end { font-size: 16px; }
.bar.crowded .end .subl { font-size: 12.5px; }
.ab { position: relative; flex: 0 1 58px; min-width: 0; height: 62px; border-radius: 13px; background: rgba(22, 64, 122, .8); box-shadow: inset 0 0 0 1px rgba(127, 176, 230, .4); display: grid; place-items: center; align-content: center; gap: 1px; --cut: #16407a; }
.ab .ic { width: 26px; height: 26px; }
.ab .lbl { font-size: 12.5px; line-height: 1; font-weight: 500; max-width: 100%; overflow: hidden; white-space: nowrap; }
.ab .cost { position: absolute; top: 5px; right: 6px; display: flex; gap: 2px; }
.ab .cost i { width: 5px; height: 5px; background: var(--ember); transform: rotate(45deg); }
.ab.spark { color: var(--flame); }
.ab.on { background: var(--ember); color: #2a1200; box-shadow: 0 0 18px rgba(255, 143, 46, .5); --cut: var(--ember); }
.ab.on .cost i { background: #2a1200; }
.ab.off { opacity: .4; }
.ab .cd { position: absolute; inset: 0; display: grid; place-items: center; font: 700 24px/1 var(--sans); color: var(--paper); background: rgba(6, 20, 43, .72); border-radius: 13px; }
.ab.slim { flex: 0 1 46px; color: var(--line); }
.ab.slim .ic { width: 22px; height: 22px; }
.end { flex: 1 0 92px; min-width: 92px; padding: 0 4px; height: 62px; border-radius: 13px; background: var(--paper); color: #0a2145; font-weight: 700; font-size: 17.5px; line-height: 1.1; display: grid; place-items: center; align-content: center; }
.end .subl { font-weight: 500; font-size: 14px; opacity: .8; }
.end.hurt { background: var(--rose); color: #2b0010; }
.end.fatal { background: #2b0010; color: var(--rose); box-shadow: inset 0 0 0 2px var(--rose); }
.fight.busy .bar { opacity: .55; }

/* ---------- modal ---------- */

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(4, 12, 28, .78); display: grid; place-items: end center; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; background: linear-gradient(170deg, #15407a, #0c2a55); border-radius: 18px 18px 0 0; padding: 22px 20px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -1px 0 rgba(127, 176, 230, .45); animation: up .22s ease-out; }
.sheet h2 { font: 400 28px/1.1 var(--serif); }
.sheet p { color: #c5dbf5; max-width: 40ch; }
.sheet .lore { font: italic 400 19.5px/1.42 var(--serif); color: var(--paper); }
.rules { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.rules li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: #c5dbf5; }
.rules li .ic { width: 26px; height: 26px; color: var(--dust); margin-top: 1px; --cut: #15407a; }
.rules li b { color: var(--paper); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; width: 100%; text-align: left; border-bottom: 1px solid rgba(127, 176, 230, .2); }
.toggle .sw { width: 46px; height: 26px; border-radius: 13px; background: rgba(6, 20, 43, .7); position: relative; flex: none; box-shadow: inset 0 0 0 1px rgba(127, 176, 230, .5); }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--line); transition: transform .15s; }
.toggle[aria-pressed="true"] .sw { background: var(--dust); }
.toggle[aria-pressed="true"] .sw::after { transform: translateX(20px); background: #2a2100; }

@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }
@keyframes flick { from { transform: scale(.92); } to { transform: scale(1.08); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.9); } }
@keyframes burn { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.15); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes fade { from { opacity: 1; } to { opacity: 0; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { 0% { opacity: 0; margin-top: 6%; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -9%; } }
@keyframes shake { 0%, 100% { transform: translate(0); } 20% { transform: translate(-5px, 2px); } 45% { transform: translate(5px, -2px); } 70% { transform: translate(-3px, 1px); } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .tile.has-dust .dust, .tile.target .hint::after, .tile.has-spawn .mark::after, .tile.has-flame .flame { animation: none; }
  .board.shake { animation: none; }
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px rgba(127, 176, 230, .12); }
}
