:root{
  --bg:#0b0512;
  --panel:#150b21;
  --ink:#f6eefc;
  --muted:#a99ac0;
  --gold:#ffd24a;
  --gold-soft:#ffe9a3;
  --red:#ff2d3d;
  --cyan:#8fe3ff;
  --mono:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(120% 70% at 50% -14%, rgba(42,18,69,.52) 0%, rgba(18,6,26,.12) 62%),
    radial-gradient(95% 65% at 50% 114%, rgba(51,6,15,.52) 0%, rgba(18,6,26,.1) 58%),
    linear-gradient(rgba(9,4,15,.22), rgba(9,4,15,.4)),
    url("assets/bg-cascade.jpg") 50% 42% / cover no-repeat var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
  overflow:hidden;
}
.mono{font-family:var(--mono);letter-spacing:.08em}

#app{
  /* the fighters' auras are wider than their column; clip sideways so the
     board can never be dragged sideways by a glow that is only decoration */
  overflow-x:hidden;
  overflow-x:clip;
  height:100dvh;
  max-height:100dvh;
  padding:calc(8px + env(safe-area-inset-top)) 12px calc(6px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:6px;
  max-width:720px;
  margin:0 auto;
}

/* ---------------- HUD ---------------- */
#hud{display:flex;flex-direction:column;gap:6px}
/* obsidian plate with a gold hairline — the shrine the counter sits on */
.hud-top{
  position:relative;display:flex;align-items:center;gap:12px;
  padding:7px 9px 7px 14px;border-radius:16px;
  background:
    radial-gradient(115% 150% at 0% 50%,rgba(255,210,74,.16),rgba(255,210,74,0) 42%),
    radial-gradient(115% 150% at 100% 50%,rgba(255,45,61,.18),rgba(255,45,61,0) 42%),
    linear-gradient(180deg,rgba(46,25,68,.86),rgba(9,4,16,.93));
  border:1px solid rgba(255,210,74,.3);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1),inset 0 -14px 24px rgba(0,0,0,.45),0 12px 30px rgba(0,0,0,.55);
  backdrop-filter:blur(7px);
}
.hud-top::after{
  content:'';position:absolute;left:12px;right:12px;bottom:-1px;height:1px;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(255,210,74,.4),rgba(255,45,61,.35),transparent);
}
#lv{
  flex:1;min-width:0;display:flex;align-items:center;gap:9px;
  text-shadow:0 1px 6px rgba(0,0,0,.8);
  white-space:nowrap;overflow:hidden;
}
#lv::before{
  content:'';flex:0 0 auto;width:9px;height:9px;transform:rotate(45deg);border-radius:1px;
  background:linear-gradient(135deg,#fffbe6,#ffd24a 45%,#c98a12);
  box-shadow:0 0 12px rgba(255,210,74,.85),0 0 3px rgba(255,255,255,.8);
}
.lvCap{font-family:var(--mono);font-size:8px;letter-spacing:.26em;color:rgba(255,233,163,.6);flex:0 0 auto}
.lvNum{
  font-family:Georgia,"Times New Roman",serif;font-weight:700;font-size:19px;line-height:1;
  font-variant-numeric:tabular-nums;color:#ffe9a3;
  text-shadow:0 2px 10px rgba(0,0,0,.85),0 0 18px rgba(255,210,74,.25);
}
.lvOf{font-family:var(--mono);font-size:9px;letter-spacing:.04em;color:rgba(255,233,163,.45);margin-left:2px}
/* The boss's name rides centred over the board, so the fight is named where you look
   rather than tucked beside the level number. Serif and the gold-to-blood sweep, which
   is what the plates and the result line already use. */
.bossName{
  font-family:Georgia,"Times New Roman",serif;font-weight:700;font-size:clamp(11px,2.1vh,17px);
  line-height:1;letter-spacing:.14em;text-transform:uppercase;text-align:center;
  /* the row is pulled into the gaps around it: a title line should not cost the board
     a whole tile step, and the board is the thing being played */
  margin:-3px 0 -1px;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  background:linear-gradient(180deg,#fff3cf 0%,#ffc94a 44%,#ff5a3c 76%,#b3162c 100%);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 2px 10px rgba(0,0,0,.9)) drop-shadow(0 0 16px rgba(255,90,50,.35));
}
.scoreWrap{display:flex;flex-direction:column;align-items:flex-end;line-height:1;gap:1px}
.scCap{font-family:var(--mono);font-size:7.5px;letter-spacing:.3em;color:rgba(169,154,192,.72)}
#sc{
  font-family:Georgia,"Times New Roman",serif;font-weight:700;font-size:27px;
  font-variant-numeric:tabular-nums;letter-spacing:.01em;
  background:linear-gradient(180deg,#fffdf2,#ffd24a 56%,#c98a12);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 0 12px rgba(255,210,74,.4)) drop-shadow(0 2px 3px rgba(0,0,0,.85));
}
#sc.neg{
  background:linear-gradient(180deg,#ffe2e2,#ff2d3d 58%,#8a0018);
  -webkit-background-clip:text;background-clip:text;
  filter:drop-shadow(0 0 12px rgba(255,45,61,.5)) drop-shadow(0 2px 3px rgba(0,0,0,.85));
}
.hud-btns{display:flex;gap:7px}
/* gold medallion: frame on the wrapper, glyph tinted gold on the button */
.medal{
  display:grid;place-items:center;width:35px;height:35px;border-radius:50%;
  background:radial-gradient(circle at 50% 24%,rgba(92,54,132,.96),rgba(9,4,17,.98));
  border:1px solid rgba(255,210,74,.44);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18),inset 0 -7px 14px rgba(0,0,0,.55),0 4px 12px rgba(0,0,0,.5),0 0 16px rgba(255,210,74,.12);
}
.iconBtn{
  width:100%;height:100%;border:0;background:transparent;color:#f6e2ab;font-size:14px;
  line-height:1;cursor:pointer;display:grid;place-items:center;border-radius:50%;
  filter:sepia(.85) saturate(2.1) hue-rotate(-12deg) brightness(1.06);
  transition:transform .12s,filter .18s;
}
.iconBtn:active{transform:scale(.94)}
.iconBtn:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

/* the scale of judgement: heaven gold pours left, hell red pours right */
.meterRow{display:flex;align-items:center;gap:8px}
#meter{
  position:relative;flex:1;min-width:0;height:21px;border-radius:999px;overflow:hidden;
  background:
    radial-gradient(58% 170% at 2% 50%,rgba(255,210,74,.3),rgba(255,210,74,0) 72%),
    radial-gradient(58% 170% at 98% 50%,rgba(255,45,61,.32),rgba(255,45,61,0) 72%),
    linear-gradient(90deg,#2b1306,#150a1e 44%,#1a0e24 56%,#2a0810);
  border:1px solid rgba(255,210,74,.3);
  box-shadow:inset 0 2px 10px rgba(0,0,0,.82),inset 0 -1px 0 rgba(255,255,255,.05),0 8px 22px rgba(0,0,0,.45);
}
#meterFill{
  position:absolute;top:0;bottom:0;z-index:1;transition:width .25s,left .25s;
  box-shadow:0 0 14px rgba(0,0,0,.5);
}
#meterFill.heaven{
  background:linear-gradient(90deg,rgba(201,154,18,.95),#ffe9a3 62%,#fffbe6);
  box-shadow:0 0 16px rgba(255,210,74,.65),inset 0 0 10px rgba(255,255,255,.55);
}
#meterFill.hell{
  background:linear-gradient(90deg,#a8001c,#ff3b45 60%,#ff9a7a);
  box-shadow:0 0 16px rgba(255,45,61,.6),inset 0 0 10px rgba(255,120,100,.35);
}
/* engraved graduations, cut into the trough */
#meter::before{
  content:'';position:absolute;inset:0;z-index:2;border-radius:inherit;pointer-events:none;opacity:.45;
  background:
    repeating-linear-gradient(90deg,rgba(0,0,0,.6) 0 1px,rgba(0,0,0,0) 1px 6.25%),
    linear-gradient(180deg,rgba(255,255,255,.07),rgba(0,0,0,.2));
}
/* the arms of the scale: a gold pivot set into the heaven end, a crimson one at the
   hell end, so the trough is ornamented where it is actually visible */
.meterCap{
  position:absolute;top:50%;width:9px;height:9px;z-index:3;pointer-events:none;
  transform:translateY(-50%) rotate(45deg);border-radius:1.5px;
}
.meterCap.l{
  left:7px;
  background:linear-gradient(135deg,#fffbe6,#ffd24a 55%,#a87210);
  box-shadow:0 0 9px rgba(255,210,74,.72);
}
.meterCap.r{
  right:7px;
  background:linear-gradient(135deg,#ffd8cd,#ff3b45 55%,#7d0012);
  box-shadow:0 0 9px rgba(255,45,61,.65);
}
/* wax-seal plaque, so the state name is legible over either colour */
#meterLab{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:4;
  padding:1px 12px;border-radius:999px;white-space:nowrap;
  font-family:Georgia,"Times New Roman",serif;font-size:8px;line-height:13px;letter-spacing:.22em;
  color:#ffeeb8;
  background:linear-gradient(180deg,rgba(40,21,58,.99),rgba(7,3,13,.99));
  border:1px solid rgba(255,210,74,.45);
  box-shadow:0 0 16px rgba(0,0,0,.9),inset 0 1px 0 rgba(255,255,255,.14);
  pointer-events:none;
}
/* what the meter is worth right now, spelled out beside the trough */
.meterVal{
  flex:none;font-family:var(--mono);font-size:8.5px;line-height:1;letter-spacing:.12em;white-space:nowrap;
  padding:5px 9px;border-radius:999px;color:#ffe9a3;
  background:linear-gradient(180deg,rgba(40,21,58,.98),rgba(7,3,13,.98));
  border:1px solid rgba(255,210,74,.42);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 6px 16px rgba(0,0,0,.5);
  transition:color .2s,border-color .2s,box-shadow .2s;
}
.meterVal.hell{
  color:#ffb3b8;border-color:rgba(255,45,61,.5);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 0 14px rgba(255,45,61,.35);
}
.meterVal.off{color:rgba(214,200,170,.68);border-color:rgba(255,210,74,.2);box-shadow:inset 0 1px 0 rgba(255,255,255,.06)}
.meterVal.ready{
  color:#fff;border-color:rgba(255,45,61,.92);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.14),0 0 20px rgba(255,45,61,.6);
  animation:meterPulse 1.1s ease-in-out infinite;
}
@keyframes meterPulse{to{box-shadow:inset 0 1px 0 rgba(255,255,255,.14),0 0 6px rgba(255,45,61,.25)}}

.chips{display:flex;gap:6px;align-items:center;min-height:21px;padding-left:2px}
.chip{
  font-family:var(--mono);font-size:8.5px;letter-spacing:.18em;padding:3px 10px;border-radius:999px;
  color:#ffe2bd;
  background:linear-gradient(180deg,rgba(76,31,10,.86),rgba(14,4,8,.92));
  border:1px solid rgba(255,150,60,.42);
  box-shadow:inset 0 1px 0 rgba(255,222,170,.26),0 0 16px rgba(255,120,40,.22),0 4px 12px rgba(0,0,0,.35);
}
.chip.warn{
  color:#fff4ea;border-color:rgba(255,96,64,.72);
  background:linear-gradient(180deg,rgba(126,18,10,.85),rgba(28,4,6,.92));
  box-shadow:inset 0 1px 0 rgba(255,206,186,.22),0 0 18px rgba(255,70,44,.5);
  animation:emberPulse 1.05s infinite alternate;
}
.chip.boss{
  color:#ffe9a3;background:linear-gradient(180deg,rgba(64,42,8,.82),rgba(20,12,4,.9));
  border-color:rgba(255,210,74,.48);cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,240,190,.2),0 0 16px rgba(255,210,74,.22);
}
.chip.daily{
  color:#d5f1ff;background:linear-gradient(180deg,rgba(14,44,64,.82),rgba(4,12,22,.9));
  border-color:rgba(143,227,255,.42);box-shadow:inset 0 1px 0 rgba(200,240,255,.2),0 0 16px rgba(143,227,255,.2);
}
@keyframes emberPulse{to{box-shadow:inset 0 1px 0 rgba(255,206,186,.22),0 0 26px rgba(255,86,54,.72)}}

/* ---------------- board ---------------- */
/* overflow:hidden zeroes the flex item's automatic minimum size: without it the
   canvas (sized from the stage) grows the stage, which grows the row, which
   pushes the HUD off the top of short screens like 1080p TVs. */
#stage{flex:1;min-height:0;overflow:hidden;display:grid;place-items:center;position:relative}
#stage::before{content:'';position:absolute;inset:-3%;pointer-events:none;z-index:0;background:radial-gradient(closest-side,rgba(6,2,12,.6),rgba(6,2,12,0) 74%)}
#c{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:1;display:block;border-radius:16px;background:#12081f;box-shadow:0 0 0 1px rgba(255,210,74,.12),0 18px 60px rgba(0,0,0,.6),0 0 42px rgba(120,40,200,.25)}
body.modal #stage{filter:blur(1px) brightness(.7)}
/* with the verdict up, the board behind is atmosphere rather than puzzle */
body:has(#ov:not([hidden])) #stage{filter:blur(3px) brightness(.5) saturate(.9)}

/* ---------------- arena ---------------- */
#arena{display:grid;grid-template-columns:1fr 118px 1fr;gap:8px;align-items:end}
.fighter{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:0;position:relative}
.bar{width:100%;height:9px;border-radius:999px;background:rgba(0,0,0,.5);overflow:hidden;border:1px solid rgba(255,255,255,.07)}
.bar i{display:block;height:100%;width:100%;transition:width .3s}
.angelBar i{background:linear-gradient(90deg,#ffe27a,#fff)}
.demonBar i{background:linear-gradient(90deg,#ff2d3d,#7a0fbf)}
/* The health bars carry their own numbers: as a 9px grey line below the fighter, "92 / 100"
   was too small to read at a glance, and the numbers are the thing you actually watch.
   They sit on a dark plate so they stay legible over both the filled and the empty part. */
.angelBar,.demonBar{position:relative;height:18px;display:grid;place-items:center}
.angelBar i,.demonBar i{position:absolute;left:0;top:0;bottom:0;height:100%}
.angelBar .hp,.demonBar .hp{
  position:relative;z-index:1;font-size:12px;font-weight:700;line-height:1;padding:3px 8px;border-radius:999px;
  color:#fff;background:rgba(6,2,12,.66);letter-spacing:.05em;text-shadow:0 1px 2px rgba(0,0,0,.9);
}

/* A heal is silent in the maths, so it gets a mark the corner of the eye can catch: a
   rising +N over the fighter and one pulse of its bar. */
.mend{
  position:absolute;top:-4px;left:50%;transform:translate(-50%,0);z-index:3;
  --rise:34px;
  font:800 16px/1 ui-monospace,Consolas,monospace;letter-spacing:.02em;
  pointer-events:none;opacity:0;text-shadow:0 2px 7px rgba(0,0,0,.9);
  will-change:transform,opacity;
}
#aMend{color:#ffe9a3}
#dMend{color:#ff8078}
/* the font size is set per heal in ui.js; these tiers pay out the bloom a big number earned */
.mend.big{text-shadow:0 0 9px currentColor,0 0 20px currentColor,0 2px 6px rgba(0,0,0,.85)}
.mend.huge{text-shadow:0 0 11px currentColor,0 0 26px currentColor,0 0 44px currentColor,0 2px 6px rgba(0,0,0,.8)}
/* an overshoot pop, then a rise that carries the big numbers further */
.mend.show{animation:mendRise .95s cubic-bezier(.18,1.35,.36,1) forwards}
.mend.show.big{animation-duration:1.06s}
.mend.show.huge{animation-duration:1.2s}
@keyframes mendRise{
  0%{opacity:0;transform:translate(-50%,10px) scale(.72)}
  16%{opacity:1;transform:translate(-50%,0) scale(1.3)}
  32%{transform:translate(-50%,-4px) scale(1)}
  72%{opacity:1;transform:translate(-50%,calc(var(--rise) * -0.55))}
  100%{opacity:0;transform:translate(-50%,calc(var(--rise) * -1)) scale(1.06)}
}
.bar.mend{animation:barMend .65s ease-out}
.bar.mend.big{animation:barMend .72s ease-out}
.bar.mend.huge{animation:barMendHuge .85s ease-out}
@keyframes barMendHuge{
  0%{box-shadow:0 0 0 2px var(--flash),0 0 26px var(--flash),0 0 50px var(--flash)}
  100%{box-shadow:0 0 0 1px rgba(255,255,255,0),0 0 0 rgba(0,0,0,0)}
}
.angelBar.mend{--flash:rgba(255,226,122,.9)}
.demonBar.mend{--flash:rgba(255,90,110,.9)}
@keyframes barMend{
  0%{box-shadow:0 0 0 1px var(--flash),0 0 18px var(--flash)}
  100%{box-shadow:0 0 0 1px rgba(255,255,255,0),0 0 0 rgba(0,0,0,0)}
}
.smiteBar{
  height:6px;border-radius:999px;overflow:hidden;
  background:rgba(4,1,10,.8);border:1px solid rgba(255,210,74,.16);
  box-shadow:inset 0 1px 5px rgba(0,0,0,.8);
}
.smiteBar i{width:0;background:linear-gradient(90deg,#c9922a,#ffe27a,#fff);box-shadow:0 0 12px rgba(255,210,74,.6)}
.faceWrap{height:126px;display:grid;place-items:end center;position:relative}

/* soft dark aura so a busy backdrop never swallows a fighter */
.faceWrap::before{content:'';position:absolute;left:50%;bottom:-8%;transform:translateX(-50%);width:168%;height:112%;pointer-events:none;z-index:0;
  background:radial-gradient(closest-side,rgba(6,2,12,.66),rgba(6,2,12,.24) 58%,rgba(6,2,12,0) 100%)}
/* contact shadow */
.faceWrap::after{content:'';position:absolute;left:50%;bottom:0;transform:translateX(-50%);width:88%;height:16px;pointer-events:none;z-index:0;
  background:radial-gradient(closest-side,rgba(0,0,0,.72),rgba(0,0,0,0))}

.face{position:relative;z-index:1;width:84px;height:126px;display:block;transition:transform .2s}
/* heaven reads gold, hell reads cold blue — each pops against the other side of the sky */
#a{filter:drop-shadow(0 0 7px rgba(255,231,150,.95)) drop-shadow(0 0 22px rgba(255,190,70,.62)) drop-shadow(0 12px 20px rgba(0,0,0,.8))}
#d{filter:drop-shadow(0 0 7px rgba(150,240,255,.95)) drop-shadow(0 0 24px rgba(48,190,255,.62)) drop-shadow(0 12px 20px rgba(0,0,0,.8))}
/* bosses loom 12% larger, but the scale grows from the top so it never lifts the head
   above the angel's — the two fighters share a head line across the board */
.face.boss{transform:scale(1.12);transform-origin:50% 0}
.face.boss#d{filter:drop-shadow(0 0 9px rgba(190,255,255,1)) drop-shadow(0 0 30px rgba(60,210,255,.75)) drop-shadow(0 12px 20px rgba(0,0,0,.8))}
.hp{font-size:9px;color:var(--muted)}

.power{display:flex;flex-direction:column;gap:5px;align-self:center}
/* reliquary button: obsidian slab, gold hairline inset, serif name over a mono charge */
#bt{
  position:relative;width:100%;padding:12px 10px 11px;border-radius:14px;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:2px;
  border:1px solid rgba(255,210,74,.26);color:#c3addf;
  background:
    radial-gradient(130% 150% at 50% -25%,rgba(104,62,150,.5),transparent 68%),
    linear-gradient(180deg,rgba(40,22,58,.96),rgba(12,5,20,.98));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.09),inset 0 -14px 22px rgba(0,0,0,.45),0 10px 22px rgba(0,0,0,.45);
  transition:transform .12s,box-shadow .2s,color .2s,background .25s;
}
#bt::before{
  content:'';position:absolute;inset:3px;border-radius:11px;pointer-events:none;
  border:1px solid rgba(255,210,74,.16);
}
#bt::after{
  content:'';position:absolute;left:50%;top:4px;width:26px;height:1px;transform:translateX(-50%);
  pointer-events:none;background:linear-gradient(90deg,transparent,rgba(255,233,163,.7),transparent);
}
.btLab{font-family:Georgia,"Times New Roman",serif;font-size:14.5px;letter-spacing:.14em;text-transform:uppercase;line-height:1.15}
.btPct{font-family:var(--mono);font-size:9.5px;letter-spacing:.22em;opacity:.6}
#bt:active{transform:scale(.985)}
#bt.on{
  color:#3b2400;border-color:rgba(255,250,226,.92);
  background:linear-gradient(180deg,#fffdf2,#ffd24a 56%,#e0a21a);
  box-shadow:0 0 28px rgba(255,210,74,.6),inset 0 1px 0 rgba(255,255,255,.95),0 10px 22px rgba(0,0,0,.4);
  animation:pulse .9s infinite alternate;
}
#bt.on::before{border-color:rgba(120,74,0,.28)}
#bt.on::after{background:linear-gradient(90deg,transparent,rgba(120,74,0,.5),transparent)}
#bt.on .btPct{opacity:.75}
#bt.on.rage{
  color:#2c0008;
  background:linear-gradient(180deg,#ffc39a,#ff3b45 58%,#8a0018);
  box-shadow:0 0 28px rgba(255,45,61,.65),inset 0 1px 0 rgba(255,214,196,.8),0 10px 22px rgba(0,0,0,.4);
}
#bt:disabled{cursor:default}
#bt:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

@keyframes pulse{to{transform:scale(1.05)}}
@keyframes hit{0%{transform:none}20%{transform:translateX(-10px) scale(.88);filter:brightness(2.6)}55%{transform:translateX(8px)}100%{transform:none}}
@keyframes atk{45%{transform:translateX(26px) scale(1.22)}100%{transform:none}}
@keyframes atkd{45%{transform:translateX(-26px) scale(1.22)}100%{transform:none}}
.hit{animation:hit .4s}
.atk{animation:atk .34s}
.atkd{animation:atkd .34s}

/* Relics sit under the angel rather than on a row of their own: they belong to her, and
   the row they used to occupy is worth a tile of board. */
#relicBar{display:flex;gap:4px;justify-content:center;align-items:center;min-height:20px;flex-wrap:nowrap;width:100%;max-width:100%;margin-top:1px;overflow:hidden}
.relic{font-size:14px;line-height:20px;width:22px;flex:0 1 22px;min-width:15px;text-align:center;border-radius:6px;background:rgba(255,210,74,.12)}
/* The hint lives at the end of the chips row instead of on its own line under the board:
   a whole grid row of height is worth a tile of board, and this line is worth neither. */
#foot{margin-left:auto;min-width:0;text-align:right;font-size:9px;letter-spacing:.04em;white-space:nowrap;
  color:rgba(169,154,192,.62);line-height:1.4;pointer-events:none;overflow:hidden;text-overflow:ellipsis}

/* ---------------- overlays ---------------- */
.overlay{
  position:fixed;inset:0;z-index:20;
  background:radial-gradient(90% 70% at 50% 0%,rgba(58,20,88,.3),rgba(5,2,10,.6));
  backdrop-filter:blur(2px);
  display:flex;align-items:center;justify-content:center;
  padding:calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  overflow:auto;
}
.shell{
  width:min(460px,100%);text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:12px;
  padding:22px 18px;border-radius:22px;
  background:linear-gradient(180deg,rgba(30,14,46,.94),rgba(14,6,22,.96));
  border:1px solid rgba(255,210,74,.18);
  box-shadow:0 30px 90px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.06);
}
.shell.wide{width:min(620px,100%)}
.eyebrow{font-size:9px;letter-spacing:.24em;color:var(--muted);margin:0}
.logo{
  margin:0;font-size:clamp(30px,9vw,48px);line-height:.92;letter-spacing:.02em;
  font-family:Georgia,"Times New Roman",serif;font-weight:700;
  background:linear-gradient(180deg,#fff,var(--gold) 55%,#c47a12);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 6px 26px rgba(255,210,74,.28));
}
.logo .amp{color:var(--red);-webkit-text-fill-color:var(--red);font-size:.7em;vertical-align:.05em;margin:0 .05em}
.logo em{font-style:normal;font-size:.62em;letter-spacing:.34em;display:block;margin-top:6px}
h2{margin:0;font-size:clamp(19px,5vw,25px);font-family:Georgia,serif}
.lede{margin:0;font-size:13px;line-height:1.5;color:var(--muted)}
.tiny{font-size:9px;color:rgba(169,154,192,.85);margin:0}
.menuBtns{display:flex;flex-direction:column;gap:8px;width:100%}
.row{display:flex;gap:8px}
.row .btn{flex:1}
.btn{
  border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:var(--ink);
  border-radius:12px;padding:12px 16px;font-weight:800;font-size:14px;cursor:pointer;
  transition:transform .1s,background .2s;font-family:inherit;
}
.btn:active{transform:scale(.985)}
.btn.primary{background:linear-gradient(#fff6d8,var(--gold));color:#3c2500;border-color:transparent;font-weight:900}
.btn.ghost{background:transparent;color:var(--muted)}
.btn:focus-visible,.mapCell:focus-visible,.relicCard:focus-visible{outline:2px solid var(--cyan);outline-offset:3px}

.rules{text-align:left;font-size:12.5px;line-height:1.6;color:#dcd2ea;margin:0;padding-left:18px;max-height:52vh;overflow:auto}
.rules b{color:var(--gold-soft)}

/* ---------------- shared plates ---------------- */
/* One slab under every full-screen plate — the level map, the pause card and the four
   overlays above — one gold serif title recipe and one reliquary button. A surface
   keeps only its own width, padding and layout, so none of them can drift apart. */
.shell.plate, .shell.slab{
  position:relative;overflow:hidden;border-radius:20px;
  background:
    radial-gradient(var(--glowA,58% 46% at 6% -8%),rgba(255,210,74,.16),rgba(18,9,30,0) 66%),
    radial-gradient(var(--glowB,58% 46% at 94% -8%),rgba(255,45,61,.2),rgba(18,9,30,0) 66%),
    linear-gradient(180deg,var(--plateTop,rgba(26,13,40,.97)),rgba(8,4,14,.99));
  border:1px solid rgba(255,210,74,.22);
  box-shadow:var(--plateShadow,0 30px 90px rgba(0,0,0,.8),inset 0 1px 0 rgba(255,255,255,.06));
}
.shell.slab{padding:24px 20px 20px}
/* the gold-to-crimson hairline that crowns the map and pause plates */
.shell.slab::after{
  content:'';position:absolute;left:12%;right:12%;top:0;height:1px;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(255,210,74,.8),rgba(255,45,61,.6),transparent);
}
.slab .eyebrow{color:rgba(255,210,74,.62);font-size:8.5px;letter-spacing:.3em}
/* gold gradient serif titles: the map, the pause card and the slab headings */
.plate .plateTitle, .slab h2{
  margin:0;font-family:Georgia,"Times New Roman",serif;font-weight:700;letter-spacing:.02em;
  background:linear-gradient(180deg,#fffdf2,#ffd24a 56%,#c98a12);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 4px 16px rgba(255,210,74,.28));
}
.slab h2{font-size:clamp(23px,5.4vw,30px)}
.slab .lede{color:rgba(216,202,232,.86)}
.slab .tiny{color:rgba(169,154,192,.9);letter-spacing:.12em}
/* serif reliquary buttons: the pause card and the overlays share one recipe */
.serifBtns .btn, .slab .btn{
  font-family:Georgia,"Times New Roman",serif;font-weight:700;letter-spacing:.1em;text-transform:uppercase;
  font-size:12.5px;padding:13px 14px;border-radius:12px;
  background:linear-gradient(180deg,rgba(40,22,58,.92),rgba(10,4,18,.96));
  border:1px solid rgba(255,210,74,.2);color:#e9dcf7;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 8px 20px rgba(0,0,0,.45);
}
.serifBtns .btn:hover, .slab .btn:hover{border-color:rgba(255,210,74,.5);color:#fff6d8}
.serifBtns .btn.primary, .slab .btn.primary{
  background:linear-gradient(180deg,#fffdf2,#ffd24a 56%,#e0a21a);color:#3b2400;border-color:transparent;
  box-shadow:0 0 26px rgba(255,210,74,.35),inset 0 1px 0 rgba(255,255,255,.95),0 8px 20px rgba(0,0,0,.4);
}
.serifBtns .btn.ghost, .slab .btn.ghost{background:transparent;border-color:rgba(255,255,255,.08);color:rgba(169,154,192,.9)}
.serifBtns .btn.ghost:hover, .slab .btn.ghost:hover{color:#e9dcf7}
/* the overlays add a little more life on hover; the pause card keeps its plain hover */
.slab .btn:hover{background:linear-gradient(180deg,rgba(52,30,72,.94),rgba(13,5,22,.97))}
.slab .btn.primary:hover{color:#2c1a00;background:linear-gradient(180deg,#fffef8,#ffe27a 56%,#e8ae22)}
.slab .btn.ghost{box-shadow:none}
.slab .btn.ghost:hover{border-color:rgba(255,210,74,.34);background:rgba(255,210,74,.06)}

/* the rules read as carved diamonds rather than a browser bullet list */
.slab .rules{list-style:none;padding-left:0;color:#ded4ec;scrollbar-width:thin;scrollbar-color:rgba(255,210,74,.3) transparent}
.slab .rules li{position:relative;padding-left:15px;margin-bottom:9px}
.slab .rules li:last-child{margin-bottom:0}
.slab .rules li::before{
  content:'';position:absolute;left:1px;top:.5em;width:6px;height:6px;border-radius:1px;
  transform:rotate(45deg);background:linear-gradient(135deg,#fffbe6,#ffd24a 55%,#b07a12);
  box-shadow:0 0 7px rgba(255,210,74,.5);
}
.slab .rules b{color:#ffe9a3}
.slab .rules::-webkit-scrollbar{width:5px}
.slab .rules::-webkit-scrollbar-thumb{background:rgba(255,210,74,.3);border-radius:9px}

/* ---------------- level result: a full-screen verdict ----------------
   The winner stands in the game itself instead of sitting in a box: the cascade backdrop
   behind, the fighter on the floor, the verdict and its stars under the fighter. */
#ov.resultOv{
  align-items:stretch;justify-content:center;
  background:
    radial-gradient(62% 46% at 50% 30%,rgba(24,8,38,.62),rgba(5,2,10,.5) 62%,rgba(5,2,10,.86) 100%),
    radial-gradient(120% 58% at 50% 112%,rgba(92,10,24,.42),rgba(5,2,10,0) 70%);
  backdrop-filter:blur(1.5px);
}
.resultHero{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:clamp(6px,1.5vh,16px);width:100%;max-height:100dvh;overflow:auto;
  padding:calc(10px + env(safe-area-inset-top)) 18px calc(12px + env(safe-area-inset-bottom));
}
/* The winner stands in light that is never quite still: a halo breathing behind the
   figure and warmth travelling around its own edges. Heaven breathes gold, hell burns
   cold — the two layers run at different rates so the glow reads as alive rather than
   as a pulse. */
.heroArtWrap{
  position:relative;display:flex;align-items:flex-end;justify-content:center;flex:0 0 auto;
  --glowA:255,206,120;--glowB:255,150,60;--rimIn:255,186,80;--rimOut:255,212,120;
}
.heroArtWrap.demon{--glowA:150,220,255;--glowB:70,140,255;--rimIn:150,235,255;--rimOut:196,246,255}
.heroArtWrap::before{
  content:'';position:absolute;left:50%;bottom:-7%;width:136%;height:106%;z-index:0;
  transform:translateX(-50%);pointer-events:none;border-radius:50%;filter:blur(10px);
  background:radial-gradient(closest-side,rgba(var(--glowA),.44),rgba(var(--glowB),.2) 52%,rgba(var(--glowB),0) 76%);
  animation:heroHalo 4.6s ease-in-out infinite;
}
/* no fighter on the daily result, so no halo either */
.heroArtWrap:has(> .heroArt[hidden]){display:none}
.heroArt{
  position:relative;z-index:1;
  height:clamp(170px,44vh,430px);width:auto;flex:0 0 auto;
  /* the art's own feet sit on the bottom edge, so an ellipse there is a floor to stand on */
  background:radial-gradient(56% 5% at 50% 99.4%,rgba(0,0,0,.72),rgba(0,0,0,0) 74%);
  filter:drop-shadow(0 20px 46px rgba(0,0,0,.78)) drop-shadow(0 0 30px rgba(var(--rimIn),.26));
  animation:heroWarmth 3.7s ease-in-out infinite;
}
.heroArt[hidden]{display:none}
@keyframes heroHalo{
  0%,100%{opacity:.55;transform:translateX(-50%) scale(.93)}
  50%{opacity:1;transform:translateX(-50%) scale(1.06)}
}
@keyframes heroWarmth{
  0%,100%{filter:drop-shadow(0 20px 46px rgba(0,0,0,.78)) drop-shadow(0 0 28px rgba(var(--rimIn),.24))}
  50%{filter:drop-shadow(0 20px 46px rgba(0,0,0,.78)) drop-shadow(0 0 64px rgba(var(--rimOut),.62))}
}
.heroCopy{display:flex;flex-direction:column;align-items:center;gap:clamp(5px,1.2vh,12px);width:min(620px,100%);text-align:center}
#ov h2{
  margin:0;font-family:Georgia,'Times New Roman',serif;font-weight:400;
  font-size:clamp(22px,5.2vw,42px);letter-spacing:.03em;line-height:1.08;
  background:linear-gradient(180deg,#fffdf2,#ffd24a 40%,#ff6a5a);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 5px 20px rgba(255,110,60,.32));
}
#ov .lede{font-size:clamp(12px,1.7vh,15px);line-height:1.55;margin:0;color:#d9cfe8;text-align:center}
.heroStars{display:flex;gap:clamp(6px,1.3vw,12px);font-size:clamp(20px,4.2vh,38px);line-height:1}
.heroStars span{color:rgba(255,210,74,.18);text-shadow:none}
.heroStars span.on{color:var(--gold);text-shadow:0 0 14px rgba(255,210,74,.6),0 0 30px rgba(255,210,74,.35)}
.heroBtns{flex-direction:row;flex-wrap:wrap;gap:10px;justify-content:center;width:min(560px,100%)}
.heroBtns .btn{flex:1 1 180px;min-height:44px}
.heroBtns .btn.ghost{background:rgba(8,3,14,.55);border-color:rgba(255,255,255,.12)}
@media (max-height:520px){
  .heroArt{height:clamp(110px,34vh,220px)}
  .resultHero{gap:4px}
  .heroBtns .btn{min-height:38px;padding:8px 14px;font-size:13px}
}

/* relic cards */

/* relic cards */
.relicChoices{display:grid;gap:8px;width:100%}
.relicCard{
  display:grid;grid-template-columns:44px 1fr;grid-template-areas:"i n" "i d";
  gap:2px 10px;text-align:left;padding:12px;border-radius:14px;cursor:pointer;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,210,74,.2);color:var(--ink);
  font-family:inherit;
}
.relicCard:hover{background:rgba(255,210,74,.12)}
.slab .relicCard{
  background:linear-gradient(180deg,rgba(46,26,68,.92),rgba(10,4,18,.96));
  border:1px solid rgba(255,210,74,.2);border-radius:12px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07),0 6px 16px rgba(0,0,0,.42);
  transition:border-color .16s,box-shadow .2s,background .2s,transform .1s;
}
.slab .relicCard:hover{
  border-color:rgba(255,210,74,.6);transform:translateY(-1px);
  background:linear-gradient(180deg,rgba(66,38,92,.94),rgba(14,6,22,.97));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 8px 20px rgba(0,0,0,.5),0 0 20px rgba(255,210,74,.26);
}
.slab .relicCard:active{transform:scale(.99)}
.slab .rcIcon{filter:drop-shadow(0 0 8px rgba(255,210,74,.4))}
.slab .rcName{font-family:Georgia,"Times New Roman",serif;font-weight:700;letter-spacing:.04em;font-size:14.5px;color:#fff3d8}
.slab .rcDesc{color:rgba(214,200,230,.78)}
.rcIcon{grid-area:i;font-size:30px;align-self:center;text-align:center}
.rcName{grid-area:n;font-weight:800;font-size:14px}
.rcDesc{grid-area:d;font-size:11.5px;color:var(--muted)}

/* ---------------- pause ---------------- */
/* The pause is a duel card: heaven gold on the left, hellfire on the right, with
   the angel and the demon it is fighting standing in the middle. */
/* the plate itself is shared; this card only sizes and spaces it */
.shell.pausePlate{width:min(440px,100%);gap:9px;padding:20px 18px 18px}
.shell.pausePlate::after{
  content:'';position:absolute;left:14%;right:14%;top:0;height:1px;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(255,210,74,.8),rgba(255,45,61,.6),transparent);
}
.pausePlate .eyebrow{color:rgba(255,210,74,.6);font-size:8.5px;letter-spacing:.3em}
.plate .pauseTitle{font-size:clamp(26px,7vw,34px)}
.pausePlate #pauseInfo{font-size:8.5px;letter-spacing:.16em;color:rgba(169,154,192,.9)}

.duel{
  display:grid;grid-template-columns:1fr auto 1fr;align-items:end;gap:8px;width:100%;
  margin-top:2px;padding:9px 10px 7px;border-radius:14px;
  background:linear-gradient(90deg,rgba(255,210,74,.1),rgba(10,4,18,.55) 48%,rgba(255,45,61,.12));
  border:1px solid rgba(255,255,255,.06);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.duelSide{display:flex;flex-direction:column;align-items:center;gap:1px;min-width:0}
.duelArt{display:block;width:64px;height:96px}
#pAngel{filter:drop-shadow(0 0 6px rgba(255,231,150,.85)) drop-shadow(0 8px 14px rgba(0,0,0,.75))}
#pDemon{filter:drop-shadow(0 0 6px rgba(150,240,255,.8)) drop-shadow(0 8px 14px rgba(0,0,0,.75))}
.duelHp{font-size:8px;color:var(--muted)}
.duelName{font-family:var(--mono);font-size:7px;letter-spacing:.22em;color:rgba(255,233,163,.72)}
.duelMid{display:flex;flex-direction:column;align-items:center;gap:5px;padding-bottom:22px}
.duelVs{font-family:Georgia,serif;font-size:12px;letter-spacing:.18em;color:rgba(255,233,163,.75)}
.duelMeter{
  display:block;width:2px;height:52px;border-radius:2px;opacity:.55;
  background:linear-gradient(180deg,rgba(255,210,74,.9),rgba(170,110,60,.5),rgba(255,45,61,.9));
  box-shadow:0 0 10px rgba(255,180,74,.28);transition:opacity .25s,box-shadow .25s;
}
.duelMeter.heaven{opacity:1;box-shadow:0 0 14px rgba(255,210,74,.8)}
.duelMeter.hell{opacity:1;box-shadow:0 0 14px rgba(255,45,61,.8)}

/* spacing only: the button look itself is in the shared plate block above */
.pausePlate .menuBtns{gap:9px;margin-top:4px}
/* keep "Restart level" on one line on a narrow phone */
@media (max-width:430px){
  .pausePlate .row .btn{font-size:11px;letter-spacing:.06em;padding:12px 8px}
}

/* ---------------- level map ---------------- */
/* A war chart on an obsidian slab: gold serif heading, a rail of realm sigils and
   a grid of carved level stones that heat from gold to crimson as the campaign
   descends. */
.shell.mapPlate{
  width:min(780px,100%);max-height:calc(100dvh - 28px);gap:0;padding:0;
  /* the only plate that really differs: a wider corner glow and a lower shadow */
  --glowA:62% 52% at 6% -12%;--glowB:62% 52% at 94% -12%;--plateTop:rgba(26,13,40,.98);
  --plateShadow:0 34px 90px rgba(0,0,0,.8),inset 0 1px 0 rgba(255,255,255,.07);
}
.mapHead{
  position:relative;width:100%;padding:16px 20px 12px;text-align:center;
  background:
    linear-gradient(100deg,rgba(255,210,74,.1),rgba(20,10,32,0) 42%,rgba(255,45,61,.12)),
    linear-gradient(180deg,rgba(58,32,86,.4),rgba(14,7,24,0));
  border-bottom:1px solid rgba(255,210,74,.14);
}
.mapHead::after{
  content:'';position:absolute;left:12%;right:12%;bottom:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(255,210,74,.8),rgba(255,45,61,.6),transparent);
}
.mapHead .eyebrow{font-size:8.5px;letter-spacing:.3em;color:rgba(255,210,74,.6);margin:0 0 5px}
.plate .mapTitle{font-size:clamp(23px,4.4vw,31px)}
.mapStats{display:flex;justify-content:center;gap:7px;margin-top:11px;flex-wrap:wrap}
.mapStats .stat{
  display:flex;flex-direction:column;align-items:center;gap:1px;padding:5px 11px;border-radius:11px;
  background:linear-gradient(180deg,rgba(14,6,24,.9),rgba(6,2,12,.9));
  border:1px solid rgba(255,210,74,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.mapStats b{font-family:Georgia,serif;font-size:15px;line-height:1;color:#ffe9a3;font-variant-numeric:tabular-nums}
.mapStats i{font-style:normal;font-family:var(--mono);font-size:7.5px;letter-spacing:.18em;color:rgba(169,154,192,.85);text-transform:uppercase}

.realmRail{
  display:flex;gap:6px;width:100%;padding:11px 14px 7px;
  overflow-x:auto;overflow-y:hidden;scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
  -webkit-mask-image:linear-gradient(90deg,transparent,#000 16px,#000 calc(100% - 16px),transparent);
  mask-image:linear-gradient(90deg,transparent,#000 16px,#000 calc(100% - 16px),transparent);
}
.realmRail::-webkit-scrollbar{display:none}
.realmChip{
  flex:0 0 auto;display:flex;align-items:baseline;gap:5px;padding:5px 9px;border-radius:9px;cursor:pointer;
  font-family:var(--mono);font-size:8.5px;letter-spacing:.1em;color:rgba(169,154,192,.85);
  background:linear-gradient(180deg,rgba(36,19,54,.85),rgba(9,4,16,.92));
  border:1px solid rgba(255,210,74,.13);
  transition:color .15s,border-color .15s,box-shadow .18s,background .18s;
}
.realmChip b{font-family:Georgia,serif;font-size:11px;letter-spacing:.04em;color:rgba(255,233,163,.7)}
.realmChip.opened{border-color:rgba(255,210,74,.36)}
.realmChip:hover{border-color:rgba(255,210,74,.5);color:#ffe9a3}
.realmChip.active{
  color:#3b2400;border-color:transparent;
  background:linear-gradient(180deg,#fffdf2,#ffd24a 58%,#d99a1e);
  box-shadow:0 0 18px rgba(255,210,74,.45),inset 0 1px 0 rgba(255,255,255,.9);
}
.realmChip.active b{color:#3b2400}

.realmBar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  width:calc(100% - 32px);margin:2px 16px 9px;padding:6px 11px;border-radius:9px;
  background:linear-gradient(90deg,rgba(255,210,74,.14),rgba(120,60,20,.07) 50%,rgba(255,45,61,.15));
  border:1px solid rgba(255,210,74,.14);
}
#realmName{font-family:Georgia,serif;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:#ffe9a3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#realmRange{font-size:8.5px;letter-spacing:.16em;color:rgba(169,154,192,.9);white-space:nowrap}

.mapGrid{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;flex:0 1 auto;min-height:0;
  width:100%;padding:2px 16px 4px;max-height:min(62vh,470px);overflow:auto;
  scrollbar-width:thin;scrollbar-color:rgba(255,210,74,.3) transparent;
}
/* a full decade per row once there is room: every tenth stone ends the row */
@media (min-width:520px){
  .mapGrid{grid-template-columns:repeat(10,minmax(0,1fr))}
}
.mapGrid::-webkit-scrollbar{width:5px}
.mapGrid::-webkit-scrollbar-track{background:transparent}
.mapGrid::-webkit-scrollbar-thumb{background:rgba(255,210,74,.3);border-radius:9px}

.mapCell{
  position:relative;aspect-ratio:1;padding:0;border-radius:11px;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;
  font-family:Georgia,"Times New Roman",serif;color:var(--ink);
  background:
    linear-gradient(180deg,rgba(255,255,255,.06),rgba(255,255,255,0) 46%),
    linear-gradient(180deg,rgba(30,17,46,.94),rgba(7,3,13,.97));
  border:1px solid var(--accA,rgba(255,255,255,.1));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07),0 3px 10px rgba(0,0,0,.45);
  transition:transform .12s,box-shadow .18s,border-color .18s;
}
/* an ember of the realm colour smoulders along the base of every stone */
.mapCell::after{
  content:'';position:absolute;left:16%;right:16%;bottom:3px;height:2px;border-radius:2px;
  background:var(--accC,var(--gold));opacity:.45;
}
.mapCell b{font-size:14px;font-weight:700;line-height:1.05;text-shadow:0 1px 6px rgba(0,0,0,.95)}
.mapCell .stars{font-size:9px;line-height:1;color:var(--gold);letter-spacing:.5px}
.mapCell:not(.locked):hover{
  transform:translateY(-1px);border-color:var(--accB,var(--gold));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 6px 16px rgba(0,0,0,.5),0 0 16px var(--accB,var(--gold));
}
.mapCell.boss{
  background:
    radial-gradient(90% 120% at 50% 115%,rgba(255,45,61,.22),transparent 70%),
    linear-gradient(180deg,rgba(74,10,22,.9),rgba(12,3,8,.97));
  border-color:rgba(255,45,61,.5);
}
.mapCell.boss b{color:#ffd9cb}
.mapCell.boss .stars{color:#ff8a74}
.mapCell.boss::after{background:linear-gradient(90deg,transparent,#ff2d3d,transparent);opacity:.7}
.mapCell.cleared{border-color:var(--accB,var(--gold))}
.mapCell.cleared .stars{color:#ffe9a3}
.mapCell.here{
  box-shadow:0 0 0 2px var(--gold) inset,0 0 22px rgba(255,210,74,.55),0 4px 14px rgba(0,0,0,.5);
  animation:herePulse 1.7s infinite alternate;
}
.mapCell.here b{color:#fffdf2}
.mapCell.locked{opacity:.44;cursor:default;filter:grayscale(.35)}
.mapCell.locked b{color:rgba(205,195,220,.85)}
.mapCell.locked .stars{color:rgba(169,154,192,.6)}
@keyframes herePulse{
  to{box-shadow:0 0 0 2px #ffe9a3 inset,0 0 30px rgba(255,210,74,.8),0 4px 14px rgba(0,0,0,.5)}
}
.mapPlate .btn{margin:12px auto 16px;min-width:190px}

/* toast */
#toast{
  position:fixed;left:50%;top:calc(14px + env(safe-area-inset-top));transform:translate(-50%,-14px);
  z-index:30;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:9px 16px;border-radius:12px;pointer-events:none;
  background:rgba(10,4,16,.92);border:1px solid rgba(255,210,74,.35);
  box-shadow:0 14px 40px rgba(0,0,0,.6);opacity:0;transition:opacity .25s,transform .25s;
  max-width:92vw;text-align:center;
}
#toast.in{opacity:1;transform:translate(-50%,0)}
#toast b{font-size:12px;letter-spacing:.1em;color:var(--gold-soft)}
#toast span{font-size:11px;color:var(--muted)}

/* ---------------- landscape only ----------------
   A browser cannot turn the phone round (the APK locks its manifest to landscape), so a
   portrait phone gets a card instead of a board squeezed into a strip. Coarse pointers
   only: a narrow desktop window still plays in portrait as it always did. The card is
   tappable: fullscreen plus an orientation lock is the one way past a phone whose
   auto-rotate is switched off, and a phone that simply will not turn gets told why. */
#rotate{display:none}
@media (pointer:coarse) and (orientation:portrait){
  #rotate{
    position:fixed;inset:0;z-index:40;display:grid;place-items:center;padding:26px;
    background:radial-gradient(80% 60% at 50% 0%,rgba(58,20,88,.55),rgba(4,1,8,.95));
    backdrop-filter:blur(3px);text-align:center;cursor:pointer;
  }
  #app{filter:blur(2px) brightness(.55)}
}
.rotCard{display:flex;flex-direction:column;align-items:center;gap:10px;max-width:330px}
.rotIcon{
  font-size:46px;line-height:1;color:var(--gold);
  text-shadow:0 0 26px rgba(255,210,74,.55);animation:rotNudge 2.6s ease-in-out infinite;
}
.rotCard b{font-family:Georgia,"Times New Roman",serif;font-size:21px;font-weight:400;letter-spacing:.02em}
.rotCard span.mono{font-size:9.5px;letter-spacing:.18em;text-transform:uppercase;color:var(--muted);line-height:1.7}
/* the card itself is the button, so the plate inside it does not take the click */
.rotCard .btn{margin-top:4px;min-width:190px;pointer-events:none}
@keyframes rotNudge{0%,55%,100%{transform:rotate(0)}25%{transform:rotate(90deg)}}

/* ---------------- landscape: the fighters flank the board ----------------
   The angel stands left of the board and the demon right, so the war no longer spends
   a row of vertical space under the board — on a phone held sideways the board is the
   only thing that really needs the height. #arena is only a box in portrait; here it
   dissolves and its three children place themselves in the page grid. */
@media (min-aspect-ratio:1/1){
  #app{
    --fh:clamp(84px,25vh,190px);
    max-width:min(1680px,100%);
    display:grid;
    grid-template-columns:clamp(74px,12.5vw,250px) minmax(0,1fr) clamp(74px,12.5vw,250px);
    grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:"hud hud hud" "angel stage demon" "power power power";
    align-content:stretch;
    gap:5px 14px;
    padding:calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  }
  #hud{grid-area:hud}
  #stage{grid-area:stage}
  #arena{display:contents}
  #aFig{grid-area:angel;align-self:center}
  #dFig{grid-area:demon;align-self:center}
  /* the under-board strip takes the board's width (--board, set in fit()), never the
     screen's, so it sits under the box rather than spanning the page */
  #power{grid-area:power;justify-self:center;align-self:center;width:min(var(--board,420px),100%);gap:4px}
  #foot{display:none}
  .faceWrap{height:var(--fh)}
  .face{width:calc(var(--fh)/1.5);height:var(--fh)}
}

/* sideways phones are short: give the board what is left of the height */
@media (min-aspect-ratio:1/1) and (max-height:480px){
  #app{gap:6px 10px}
  /* the plate is a bar here, not a shrine: every pixel of HUD is a pixel of board */
  #hud{gap:3px}
  .hud-top{padding:2px 8px 2px 10px;border-radius:12px}
  .lvNum{font-size:15px}
  #meter{height:15px}
  /* the label was a solid plug over the middle of the trough, hiding the exact point where
     heaven and hell meet: let the fill read straight through it */
  #meterLab{
    font-size:7px;line-height:11px;padding:0 9px;letter-spacing:.18em;
    background:none;border-color:transparent;box-shadow:none;
    color:rgba(255,238,184,.72);text-shadow:0 1px 3px rgba(0,0,0,.95)
  }
  .meterRow{gap:6px}
  .chips{display:none}
  #power{width:min(260px,46%)}
  #bt{padding:6px 8px 5px}
  .btLab{font-size:11px}
  #relicBar{display:none}
}

/* wider screens / TV */
/* A grid, not a wrapped flex row: with flex the stage row was only as tall as
   the fighter column, so the board stalled around 500px on a 1080p desktop and
   left the bottom of the screen empty. The 1fr row gives the board all the
   height that is actually free. */
@media (min-width:900px) and (min-aspect-ratio:1/1){
  #app{
    --fh:clamp(120px,22vh,280px);
    grid-template-columns:clamp(120px,15vw,300px) minmax(0,1fr) clamp(120px,15vw,300px);
    grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:"hud hud hud" "angel stage demon" "power power power";
    gap:10px 18px;padding:18px 26px;
  }
  .faceWrap::after{height:24px;width:90%}
  #foot{display:block}
}

/* On a wide screen the board is limited by height, so the margin beside it is spare and
   the fighters take it. Narrow desktops (4:3, 3:2) are left alone: there the board is
   limited by width and every pixel of it matters. Declared after the block above so it
   wins over that block's column rule. */
@media (min-width:1000px) and (min-aspect-ratio:16/10){
  #app{grid-template-columns:clamp(120px,17.5vw,340px) minmax(0,1fr) clamp(120px,17.5vw,340px)}
}

/* Portrait phones crop the backdrop hard, so favour the heaven side. */
@media (max-aspect-ratio:3/4){
  body{background-position:50% 0, 50% 100%, 0 0, 34% 42%}
}

@media (max-width:430px){
  /* the level plate has no room for the caption next to the score and medals */
  .lvCap{display:none}
  .lvNum{font-size:17px}
  .medal{width:31px;height:31px}
}
@media (max-width:390px){
  #sc{font-size:22px}
  .face{width:70px;height:105px}
  .faceWrap{height:106px}
  #arena{grid-template-columns:1fr 104px 1fr}
}
/* Phones: the war chart is one page. The plate grows to its full height and the overlay
   scrolls it, so the grid never scrolls inside the panel and never slices a row. Auto
   margins keep it centred when it does fit and pin it to the top when it does not. */
@media (max-width:899px){
  #mapOv{align-items:flex-start}
  .shell.mapPlate{max-height:none;margin:auto}
  .mapGrid{flex:0 0 auto;max-height:none;overflow:visible}
}
@media (max-height:640px) and (max-width:899px) and (max-aspect-ratio:1/1){
  #foot{display:none}
  .faceWrap{height:88px}
  .face{width:58px;height:87px}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001s !important;transition-duration:.001s !important}
}

/* Android TV / wide-and-short: 1920x1080 at density 2 is only 540 CSS pixels
   tall, so every row has to earn its space. Last in the file so it wins. */
@media (min-width:900px) and (max-height:620px){
  #app{gap:8px;padding:8px 16px 6px}
  .hud-top{padding:3px 6px 3px 10px}
  .scCap{display:none}
  #sc{font-size:22px}
  .medal{width:28px;height:28px}
  .iconBtn{font-size:12px}
  #meter{height:15px}
  #meterLab{font-size:7px;line-height:11px;padding:0 9px;letter-spacing:.18em}
  .meterVal{font-size:7px;padding:4px 7px;letter-spacing:.1em}
  .lvNum{font-size:13px}
  .lvCap{font-size:7px;letter-spacing:.2em}
  .bossName{font-size:10px;letter-spacing:.1em}
  .chips{min-height:17px}
  .chip{font-size:7.5px;padding:1px 8px}
  .faceWrap{height:112px}
  .face{width:74px;height:112px}
  .faceWrap::after{height:14px;width:82%}
  #arena{gap:8px}
  #bt{padding:8px 6px 7px;border-radius:12px}
  .btLab{font-size:12px}
  .btPct{font-size:8.5px}
  #relicBar{min-height:16px}
  #foot{display:none}
  .shell.pausePlate{padding:13px 14px 12px;gap:7px;width:min(400px,100%)}
  .plate .pauseTitle{font-size:24px}
  .pausePlate .eyebrow{display:none}
  .duel{padding:6px 8px 5px}
  .duelArt{width:52px;height:78px}
  .duelMeter{height:38px}
  .duelMid{padding-bottom:18px}
  .pausePlate .btn{padding:9px 12px;font-size:11px}
  .shell.mapPlate{width:min(700px,100%)}
  .mapHead{padding:9px 14px 7px}
  .mapHead .eyebrow{display:none}
  .plate .mapTitle{font-size:20px}
  .mapStats{margin-top:6px;gap:5px}
  .mapStats .stat{padding:3px 8px;border-radius:8px}
  .mapStats b{font-size:12px}
  .mapStats i{font-size:6.5px;letter-spacing:.14em}
  .realmRail{padding:6px 10px 4px;gap:5px}
  .realmChip{padding:3px 7px}
  .realmBar{margin:0 10px 6px;padding:4px 9px}
  #realmName{font-size:10.5px}
  #realmRange{font-size:7.5px}
  .mapGrid{gap:5px;padding:0 10px 2px}
  .mapCell{aspect-ratio:auto;min-height:44px}
  .mapCell b{font-size:11px}
  .mapCell .stars{font-size:7px}
  .mapPlate .btn{margin:8px auto 10px;padding:9px 14px;font-size:12.5px}
  .shell.slab{padding:13px 16px 12px;gap:8px}
  .slab h2,#ov .shell h2{font-size:20px}
  .slab .logo{font-size:32px}
  .slab .btn{padding:9px 12px;font-size:11px}
  .slab .rules{max-height:42vh;font-size:11.5px}
}
