/* Battle HUD — Paper Kingdom UI v4. The Pixi battle draws in #stage (1280×720, scaled by main.js fit()); the DOM HUD lives
   in #hud beside it with its own layout box (main.js fit()): 1920×1080 on landscape screens — the same rect as the stage —
   or 390 px wide on portrait phones. So every px below is the v4 mock's px (screens-v4.html: .bt / .bt--m).
   Navy glass, thin white lines, one gold #f0d23c for "ready / selected", ult buttons fill from the bottom. */
:root{
  --ink:#1d2140; --cream:#f6ead2; --coral:#e8584a; --teal:#2f9c95; --mustard:#f2b632; --wood:#0c1020;
  --font:Anuphan,Prompt,"Leelawadee UI","Thonburi",sans-serif;
  --hud-num:Anuphan,Prompt,sans-serif;   /* one UI family (docs/ui-taste/fonts.md); #hud sets tabular figures */
  --hud-text:#f4f1ea; --hud-text-2:#c9d0de; --hud-gold:#f0d23c; --hud-teal:#3ec8c0; --hud-danger:#ff8a7a;
  --hud-panel:rgba(16,22,44,.86); --hud-line:rgba(255,255,255,.16); --hud-paper:#fbf4e2;
  --hud-lip:0 1px 0 rgba(255,255,255,.18) inset,0 -3px 0 rgba(0,0,0,.25) inset,0 4px 0 rgba(3,6,16,.55),0 10px 22px rgba(3,6,16,.35);
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:#0c1020;overflow:hidden;font-family:var(--font);color:var(--hud-text);
  -webkit-user-select:none;user-select:none;touch-action:manipulation}
/* fixed (not absolute): a scaled 1280-wide box must not widen a phone's layout viewport */
#stage{position:fixed;left:50%;top:50%;z-index:1;width:1280px;height:720px;transform-origin:0 0;overflow:hidden;background:#000}
/* portrait phones: the stage is a cropped band (main.js fit()); a dim, blurred copy of the stage's map fills above and below it */
#frame::before{content:"";position:absolute;inset:-24px;z-index:0;pointer-events:none;opacity:0;background:var(--battle-bg,none) center/cover no-repeat;filter:blur(16px) brightness(.34) saturate(.8)}
#frame:has(#stage.portrait.battle)::before{opacity:1}
#canvas,#canvas canvas{position:absolute;inset:0;width:1280px;height:720px;display:block}
/* portrait phones, every battle (main.js setExt; R1 phone battle stage, was the dragon only): the canvas grows --ext above and below
   the 1280×720 stage box (which stays the box every DOM↔stage mapping reads) to the screen's edges and covers only the phone's
   view (--cx … --cx + --cw); the box stops clipping. The map's tall art fills the bands (else they clear to the blurred backdrop) */
#stage.tall{overflow:visible;background:transparent}
#stage.tall #canvas canvas{left:var(--cx,0px);width:var(--cw,1280px);top:calc(-1 * var(--ext,0px));height:calc(720px + 2 * var(--ext,0px))}
[hidden]{display:none!important}

/* ---------- the HUD box ---------- */
#hud{position:fixed;left:50%;top:50%;width:1920px;height:1080px;transform-origin:0 0;z-index:5;pointer-events:none;
  font-family:var(--font);color:var(--hud-text);line-height:1.5;--pk-ico-sw:1.5px;font-variant-numeric:tabular-nums lining-nums;
  --t-xs:17px;--t-sm:19px;--t-md:21px;--t-lg:26px;--t-xl:34px;--t-3xl:64px;--btn-h:60px}
#hud.is-m{--t-xs:13px;--t-sm:14px;--t-md:16px;--t-lg:19px;--t-xl:23px;--t-3xl:36px;--btn-h:48px}
#hud button,#hud #speed{pointer-events:auto}
#hud .ico{display:inline-block;width:1em;height:1em;flex:none;vertical-align:middle}
#hud .ico use{fill:none;stroke:currentColor}
/* the battle HUD only shows while a stage is being played (main.js puts .battle on #stage) */
#stage:not(.battle) ~ #hud :is(#top,#skills,#ultHint,#auto,#mute,#speed,#waves,#bossTag,#waveCard,#chain){visibility:hidden}

/* ---------- top: scrim, clock (m:ss + what it means), stage + wave beside the pause button, ×1 | ×2 ---------- */
#top{position:absolute;left:0;right:0;top:0;height:170px;z-index:1;display:flex;justify-content:center;pointer-events:none}
#top::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,rgba(7,10,20,.82) 0,rgba(7,10,20,.55) 50%,transparent)}
#top .bar{display:none}   /* v4 shows health on the units and the boss bar; main.js still writes the team bars */
#clock{margin-top:16px;text-align:center;line-height:1.1}
#clock b{display:block;font-family:var(--hud-num);font-size:var(--t-3xl);font-weight:600;font-variant-numeric:tabular-nums}
#clock span{display:inline-block;margin-top:2px;padding:0 12px;border-radius:999px;background:rgba(8,6,20,.62);font-size:var(--t-xs);color:var(--hud-text-2)}
#clock b{text-shadow:0 2px 3px rgba(8,6,20,.8),0 0 18px rgba(8,6,20,.6)}
/* F4 Rush (last 30 s, energy ×2) and Sudden death: the clock turns red on a coral plate and beats every second (see the F4 block) */
#stage.rush ~ #hud #clock b{color:#ff7a6a}
#stage.rush ~ #hud #clock span{color:#ffb0a6;font-weight:600}
#stage.sudden ~ #hud #clock b{color:#ff4a5a}
#stage.between ~ #hud #clock b{color:var(--hud-text-2)}

#waves{position:absolute;left:118px;top:24px;height:60px;z-index:2;display:flex;align-items:center;gap:14px;white-space:nowrap;pointer-events:none;font-size:var(--t-md)}
#waves .sid{display:inline-flex;align-items:center;padding:3px 12px;border:1px solid var(--hud-teal);border-radius:999px;background:var(--hud-panel);
  font-family:var(--hud-num);font-weight:500;font-size:var(--t-sm);line-height:1.3;color:var(--hud-teal)}
#waves .snm{font-size:var(--t-lg);font-weight:500}
#waves .wv{display:inline-flex;align-items:center;gap:8px;padding-left:14px;border-left:1px solid rgba(255,255,255,.34);color:var(--hud-text-2)}
#waves .wv .ico{width:24px;height:24px;color:var(--hud-teal)}
#waves .wv b{font-family:var(--hud-num);font-weight:500;font-size:var(--t-lg);color:var(--hud-text)}
#waves .sub,#waves .pips{display:none}

#speed{position:absolute;right:40px;top:26px;z-index:2;display:inline-flex;gap:0;padding:4px;border-radius:30px;
  border:1px solid rgba(255,255,255,.2);background:rgba(8,6,18,.7)}
#speed button{min-width:64px;min-height:calc(var(--btn-h) - 12px);padding:0 18px;border:0;border-radius:24px;background:none;cursor:pointer;
  font-family:var(--hud-num);font-size:var(--t-md);font-weight:600;color:#dcd6f2}
#speed button.on{color:#1a1530;background:#fff;box-shadow:none}

/* ---------- boss bar ---------- */
#bossTag{position:absolute;left:50%;top:124px;width:820px;z-index:2;transform:translateX(-50%);padding:10px 20px 16px;border-radius:18px;pointer-events:none;
  background:var(--hud-panel);border:1px solid var(--hud-line);box-shadow:0 2px 0 rgba(255,255,255,.06) inset,0 18px 40px rgba(3,6,16,.45)}
#bossTag .bn{display:flex;align-items:center;gap:10px;margin-bottom:8px}
#bossTag .bn .ico{width:24px;height:24px;color:var(--hud-danger)}
#bossTag .bn b{font-size:var(--t-md);font-weight:500}
#bossTag .bn .t2{font-size:var(--t-sm);color:var(--hud-text-2)}
#bossTag .pc{margin-left:auto;font-family:var(--hud-num);font-weight:500;font-size:var(--t-lg);line-height:1.2}
#bossTag .bbar{position:relative;display:block;height:14px;border-radius:99px;overflow:hidden;background:rgba(7,10,20,.78);border:1px solid rgba(255,255,255,.55)}
#bossTag .bbar em,#bossTag .bbar u{position:absolute;left:0;top:0;bottom:0;width:100%;border-radius:99px}
#bossTag .bbar u{background:rgba(255,255,255,.6);transition:width .5s ease-out .35s}
#bossTag .bbar em{background:linear-gradient(180deg,#ff9a88,#e8584a 60%,#b8392e)}

/* ---------- banner / chain / wave card ---------- */
#banner{position:absolute;left:50%;top:220px;z-index:3;transform:translate(-50%,-420px);padding:10px 40px 12px;border-radius:999px;pointer-events:none;
  background:rgba(16,22,44,.92);border:1px solid rgba(255,255,255,.3);box-shadow:0 0 0 5px rgba(62,200,192,.18),0 16px 36px rgba(3,6,16,.45);
  font-size:var(--t-xl);font-weight:600;white-space:nowrap;transition:transform .22s cubic-bezier(.2,1.5,.4,1)}
#banner.show{transform:translate(-50%,0)}
#banner.foe{color:var(--hud-danger);border-color:rgba(232,88,74,.75);box-shadow:0 0 0 5px rgba(232,88,74,.18),0 16px 36px rgba(3,6,16,.45)}
#banner:empty{display:none}
/* #chain: the chain HUD (left-edge combo counter) — see the "chain HUD" block in the F1 section (src/juice/interrupt-hud.js builds it) */
#waveCard{position:absolute;left:50%;top:230px;z-index:3;min-width:540px;padding:18px 54px 24px;text-align:center;border-radius:22px;pointer-events:none;
  background:rgba(16,22,44,.92);border:1px solid rgba(255,255,255,.22);box-shadow:0 2px 0 rgba(255,255,255,.06) inset,0 18px 40px rgba(3,6,16,.45);
  transform:translate(-50%,-100px) scale(.7);opacity:0;transition:transform .24s steps(4),opacity .12s steps(2)}
#waveCard.show{transform:translate(-50%,0) scale(1);opacity:1}
#waveCard small{display:block;font-size:var(--t-sm);color:var(--hud-text-2)}
#waveCard b{display:block;font-size:60px;font-weight:600;line-height:1.2}
#waveCard i{display:block;font-style:normal;font-size:var(--t-sm);margin-top:4px;color:var(--hud-text-2)}
#waveCard.clear{border-color:var(--hud-teal)}
#waveCard.clear b{color:var(--hud-teal)}
#waveCard.boss{border-color:rgba(232,88,74,.8);padding-top:32px}
#waveCard.boss b{color:var(--hud-gold);font-size:64px}
#waveCard.boss::before{content:"BOSS";position:absolute;left:50%;top:-22px;transform:translateX(-50%);padding:0 22px;border-radius:999px;
  font-family:var(--font);font-weight:700;font-size:24px;letter-spacing:.14em;line-height:42px;background:var(--hud-gold);color:#10162b;box-shadow:0 4px 0 rgba(3,6,16,.5)}

/* ---------- ult cards (Dusk Veil, room 8 — main.js buildButtons / syncButtons) ----------
   A tall card per hero: the bust under a dark veil that lifts as the gauge fills, a white ink line rising with the charge,
   a bar along the foot. READY: the card springs up on a gold edge with a white core, a crisp gold sunburst turns behind it,
   a shine sweeps the art, the state reads "พร้อม!" in gold. Press / fire: WAAPI one-shots from main.js (squash, punch,
   flash, shock rings, gold shards). Motion is transform / opacity on the frame clock (smooth at ×1 and ×2, --spd). */
#skills{position:absolute;left:50%;bottom:52px;z-index:2;transform:translateX(-50%);display:flex;align-items:flex-end;gap:16px}
#skills::before{content:"";position:absolute;left:50%;bottom:-52px;width:1920px;height:420px;transform:translateX(-50%);z-index:-1;pointer-events:none;
  background:linear-gradient(0deg,rgba(6,5,14,.92) 0,rgba(6,5,14,.66) 42%,transparent)}
#skills button{--e:0;--o:0;position:relative;width:146px;display:flex;flex-direction:column;align-items:center;padding:0;border:0;background:none;cursor:pointer;
  font-family:inherit;color:#fff;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
#skills .ring{position:relative;z-index:1;display:block;width:146px;height:170px;border-radius:18px;overflow:hidden;background:#15112c;
  box-shadow:0 0 0 1.5px rgba(255,255,255,.34),0 14px 26px rgba(4,2,12,.55);will-change:transform;
  transition:translate calc(.34s / var(--spd,1)) cubic-bezier(.34,1.56,.64,1),scale calc(.34s / var(--spd,1)) cubic-bezier(.34,1.56,.64,1)}
#skills .uc-art{position:absolute;inset:0;background-repeat:no-repeat;background-size:calc(142% * var(--uck, 1)) auto;transform-origin:50% 28%}   /* --uck: a costume's own zoom (main.js CARD_FACE_C) */
#skills .uc-art--sprite{inset:auto;left:50%;top:44%;width:78px;height:78px;margin:-39px 0 0 -39px;scale:1.5}
#skills .uc-veil{position:absolute;inset:0;background:linear-gradient(0deg,rgba(8,6,20,.94) 0,rgba(8,6,20,.62) 46%,rgba(8,6,20,.42));opacity:calc(1 - var(--e) * .0062)}
#skills .uc-ink{position:absolute;left:0;right:0;bottom:0;height:100%;will-change:transform;transform:translateY(calc((100 - var(--e)) * 1%));
  background:linear-gradient(180deg,#fff 0,#fff 2.5px,rgba(220,214,242,.26) 2.5px,rgba(220,214,242,.07) 72%)}
#skills .uc-bar{position:absolute;left:12px;right:12px;bottom:10px;height:7px;border-radius:4px;overflow:hidden;background:rgba(8,6,20,.82);box-shadow:0 0 0 1px rgba(255,255,255,.28)}
#skills .uc-bar i{display:block;height:100%;border-radius:4px;background:#fff;transform-origin:0 50%;transform:scaleX(calc(var(--e) / 100))}
#skills .uc-shine{position:absolute;top:-20%;bottom:-20%;left:0;width:46%;pointer-events:none;opacity:0;transform:translateX(-170%) skewX(-14deg);
  background:linear-gradient(100deg,transparent,rgba(255,255,255,.45) 42%,#fff 50%,rgba(255,255,255,.45) 58%,transparent)}
#skills .uc-flash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none}
/* the sunburst behind a ready card: 12 gold rays with white cores (crisp, no bloom), clipped at the card's foot so it never
   runs under the name and state; the rays turn inside the clip (::before) */
#skills .uc-sun{position:absolute;left:-72px;top:-60px;z-index:0;width:290px;height:230px;overflow:hidden;pointer-events:none;opacity:0;transform-origin:50% 63%}
#skills .uc-sun::before{content:"";position:absolute;left:0;top:0;width:290px;height:290px;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-100 -100 200 200'%3E%3Cg id='r'%3E%3Cpath d='M-4.5 -34 L0 -98 L4.5 -34 Z' fill='%23f0d23c'/%3E%3Cpath d='M-1.4 -40 L0 -86 L1.4 -40 Z' fill='%23fff'/%3E%3C/g%3E%3Cuse href='%23r' transform='rotate(30)'/%3E%3Cuse href='%23r' transform='rotate(60)'/%3E%3Cuse href='%23r' transform='rotate(90)'/%3E%3Cuse href='%23r' transform='rotate(120)'/%3E%3Cuse href='%23r' transform='rotate(150)'/%3E%3Cuse href='%23r' transform='rotate(180)'/%3E%3Cuse href='%23r' transform='rotate(210)'/%3E%3Cuse href='%23r' transform='rotate(240)'/%3E%3Cuse href='%23r' transform='rotate(270)'/%3E%3Cuse href='%23r' transform='rotate(300)'/%3E%3Cuse href='%23r' transform='rotate(330)'/%3E%3C/svg%3E") center/contain no-repeat}
#skills .key{position:absolute;left:8px;top:8px;z-index:2;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;
  background:#fff;color:#1a1530;font:700 16px/1 var(--hud-num);box-shadow:0 0 0 2px rgba(16,12,36,.85)}
#skills .oc{position:absolute;right:-6px;top:-12px;z-index:3;min-width:58px;padding:0 9px;border-radius:999px;background:var(--hud-gold);color:#1a1530;text-align:center;
  font:700 16px/26px var(--hud-num);font-variant-numeric:tabular-nums;white-space:nowrap;box-shadow:0 0 0 2px #fff,0 3px 0 rgba(3,6,16,.5)}
#skills .oc:empty{display:none}
#skills .nm{margin-top:10px;font-size:19px;font-weight:600;line-height:1.3;white-space:nowrap;text-shadow:0 1px 3px rgba(6,5,14,.9)}
#skills .st{font-family:var(--hud-num),var(--font);font-size:17px;font-weight:500;line-height:1.3;color:#dcd6f2;font-variant-numeric:tabular-nums}
/* ready: up on a gold edge with a white core, art fully lit, sun turning, shine sweeping, the card breathing */
/* (no transform on the button itself: the cards share one stacking layer, so a sunburst never paints over a neighbour card) */
#skills button.ready .ring{translate:0 -14px;scale:1.05;box-shadow:inset 0 0 0 2px #fff,0 0 0 4px var(--hud-gold),0 0 0 6px rgba(16,12,36,.92),0 20px 32px rgba(4,2,12,.6)}
#skills button.ready .uc-veil,#skills button.ready .uc-ink{opacity:0}
#skills button.ready .uc-bar i{background:var(--hud-gold)}
#skills button.ready .uc-sun{opacity:1}
#skills button.ready .uc-sun::before{animation:uc-spin calc(16s / var(--spd,1)) linear infinite}
#skills button.ready .uc-shine{opacity:1;animation:uc-shine calc(2.4s / var(--spd,1)) cubic-bezier(.45,0,.2,1) .2s infinite}
#skills button.ready .key{background:var(--hud-gold)}
#skills button.ready .st{color:var(--hud-gold);font-weight:700;font-size:19px}
#skills button.over .ring{box-shadow:inset 0 0 0 2px #fff,0 0 0 4px var(--hud-gold),0 0 0 6px rgba(16,12,36,.92),0 0 0 calc(6px + var(--o) * .07px) rgba(240,210,60,.55),0 20px 32px rgba(4,2,12,.6)}
#skills button.cast .ring{box-shadow:inset 0 0 0 2px #fff,0 0 0 3px rgba(255,255,255,.75),0 14px 26px rgba(4,2,12,.55)}
#skills button.cast .uc-veil{opacity:.15}
#skills button.sealed .ring{box-shadow:0 0 0 2px #b48cff,0 14px 26px rgba(4,2,12,.55)}
#skills button.dead{cursor:default}
#skills button.dead .ring{box-shadow:0 0 0 1.5px rgba(255,255,255,.16),0 14px 26px rgba(4,2,12,.55)}
#skills button.dead .uc-art{filter:grayscale(1) brightness(.42)}
#skills button.dead :is(.uc-ink,.uc-bar){opacity:0}
#skills button.dead .nm{color:#c4bce6}
#skills button.dead .st{color:var(--hud-danger);font-weight:600}
/* the burst pieces main.js adds for a moment (cardReady / cardFire) */
#skills .uc-shock{position:absolute;left:0;top:0;z-index:3;width:146px;height:170px;border-radius:18px;pointer-events:none;box-shadow:inset 0 0 0 3px #fff}
#skills .uc-shock.gold{box-shadow:inset 0 0 0 4px var(--hud-gold),inset 0 0 0 6px #fff}
#skills .uc-shard{position:absolute;left:73px;top:85px;z-index:3;width:24px;height:7px;margin-top:-3.5px;border-radius:4px;pointer-events:none;transform-origin:0 50%;
  background:linear-gradient(90deg,var(--hud-gold),#fff 50%,var(--hud-gold));box-shadow:0 0 0 1.5px rgba(16,12,36,.85)}
@keyframes uc-bob{50%{transform:translateY(-4px)}}
@keyframes uc-spin{to{transform:rotate(360deg)}}
@keyframes uc-shine{0%{transform:translateX(-170%) skewX(-14deg)}38%,100%{transform:translateX(330%) skewX(-14deg)}}
#ultHint{position:absolute;left:50%;bottom:14px;z-index:2;margin:0;transform:translateX(-50%);display:flex;align-items:center;gap:6px;white-space:nowrap;
  font-size:17px;color:#dcd6f2;pointer-events:none}
#ultHint .kbd{display:inline-flex;align-items:center;justify-content:center;min-width:1.7em;height:1.6em;padding:0 .35em;border:1px solid currentColor;border-radius:6px;
  font:600 16px/1 var(--hud-num);color:#fff}
#hud button:focus-visible{outline:3px solid var(--hud-gold);outline-offset:4px}
@keyframes v4-pulse-hud{0%,100%{box-shadow:0 0 0 3px #fff,0 4px 0 3px rgba(3,6,16,.5),0 0 18px rgba(240,210,60,.55)}50%{box-shadow:0 0 0 3px #fff,0 4px 0 3px rgba(3,6,16,.5),0 0 34px rgba(240,210,60,.95)}}
@keyframes nope{25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}

/* ---------- Auto / sound: Dusk Veil pills, bottom right (white = on) ---------- */
#auto,#mute{position:absolute;bottom:44px;z-index:2;height:52px;padding:0 22px;border-radius:26px;cursor:pointer;font-family:var(--font);font-size:18px;font-weight:500;
  color:#fff;border:1.5px solid rgba(255,255,255,.42);background:rgba(8,6,18,.66);box-shadow:0 8px 18px rgba(4,2,12,.35);transition:transform .12s}
#auto{right:40px} #mute{right:150px}
#auto[aria-pressed="true"]{color:#1a1530;background:#fff;border-color:#fff}
#mute[aria-pressed="true"]{color:#dcd6f2;background:rgba(8,6,18,.9);border-style:dashed}
#auto:active,#mute:active{transform:translateY(2px) scale(.97)}

/* ---------- portrait phones (390 wide): the mock's .bt--m ---------- */
#hud.is-m #top{height:120px}
#hud.is-m #clock{margin-top:12px}
#hud.is-m #clock span{display:none}
#hud.is-m #clock b{font-size:var(--t-xl);line-height:1.3}
#hud.is-m #waves{left:72px;top:10px;height:48px;flex-direction:column;align-items:flex-start;justify-content:center;gap:0;line-height:1.3}
#hud.is-m #waves :is(.sid,.snm,.wv .ico){display:none}
#hud.is-m #waves .wv{padding:0;border:0;gap:4px;font-size:var(--t-md);font-weight:500;color:var(--hud-text)}
#hud.is-m #waves .wv b{font-size:var(--t-md)}
#hud.is-m #waves .sub{display:block;font-size:var(--t-sm);color:var(--hud-text-2)}
#hud.is-m #speed{right:16px;top:12px}
#hud.is-m #speed button{min-width:44px;min-height:44px;padding:0 10px;font-size:var(--t-sm)}
#hud.is-m #bossTag{left:16px;right:16px;top:74px;width:auto;transform:none;padding:8px 14px 12px}
#hud.is-m #bossTag .bn{margin-bottom:6px}
#hud.is-m #bossTag .bn b{font-size:var(--t-sm)}
#hud.is-m #bossTag .bn .t2{display:none}
#hud.is-m #bossTag .pc{font-size:var(--t-md)}
#hud.is-m #bossTag .bbar{height:10px}
#hud.is-m #banner{top:150px;padding:6px 22px 8px;font-size:var(--t-lg)}
#hud.is-m #bossTag:not([hidden]) ~ #banner{top:196px}   /* under the drop chip, which moves under the boss bar (juice/rewards-hud.js) */
#hud.is-m #bossTag:not([hidden]) ~ #waveCard{top:208px}   /* the boss card arrives with the boss bar: its BOSS tab under the chip too */
#hud.is-m #waveCard{top:160px;min-width:290px;padding:12px 24px 16px}
#hud.is-m #waveCard b{font-size:34px}
#hud.is-m #waveCard.boss b{font-size:36px}
#hud.is-m #waveCard.boss::before{font-size:15px;line-height:28px;top:-14px;padding:0 14px}
/* phone ult cards: five 68 × 84 cards across the thumb zone (taps ≥ 44 px, text ≥ 14 px) */
#hud.is-m #skills{bottom:16px;gap:6px}
#hud.is-m #skills::before{width:390px;height:280px;bottom:-16px}
#hud.is-m #skills button{width:68px}
#hud.is-m #skills .ring{width:68px;height:84px;border-radius:12px}
#hud.is-m #skills .uc-art{background-size:calc(150% * var(--uck, 1)) auto}
#hud.is-m #skills .uc-art--sprite{width:56px;height:56px;margin:-28px 0 0 -28px;scale:1.15}
#hud.is-m #skills .uc-bar{left:6px;right:6px;bottom:6px;height:5px}
#hud.is-m #skills .uc-sun{left:-41px;top:-33px;width:150px;height:117px;transform-origin:50% 64%}
#hud.is-m #skills .uc-sun::before{width:150px;height:150px}
#hud.is-m #skills .key{display:none}
#hud.is-m #skills .oc{top:-12px;right:-6px;min-width:50px;font-size:14px;line-height:22px;padding:0 6px}   /* phone text ≥ 14 px */
#hud.is-m #skills .nm{margin-top:6px;font-size:14px}
#hud.is-m #skills .st{font-size:14px}
#hud.is-m #skills button.ready .st{font-size:14px}
#hud.is-m #skills button.ready .ring{translate:0 -8px;scale:1.04;box-shadow:inset 0 0 0 1.5px #fff,0 0 0 3px var(--hud-gold),0 0 0 4.5px rgba(16,12,36,.92),0 12px 20px rgba(4,2,12,.6)}
#hud.is-m #skills button.over .ring{box-shadow:inset 0 0 0 1.5px #fff,0 0 0 3px var(--hud-gold),0 0 0 4.5px rgba(16,12,36,.92),0 0 0 calc(4.5px + var(--o) * .04px) rgba(240,210,60,.55),0 12px 20px rgba(4,2,12,.6)}
#hud.is-m #skills .uc-shock{width:68px;height:84px;border-radius:12px}
#hud.is-m #skills .uc-shard{left:34px;top:42px;width:15px;height:5px;margin-top:-2.5px}
#hud.is-m #ultHint,#hud.is-m #mute{display:none}
#hud.is-m #auto{right:16px;bottom:192px;height:44px;padding:0 14px;font-size:14px}

/* ---------- F4 · a rising tension curve (src/juice/tension.js, src/bosses.js): boss phase ticks, Rush clock + buttons, comeback ----------
   Every beat is STEPPED (steps(1) between held keyframes, bible rule 3) and follows the battle speed (--spd). */
/* boss bar: "เฟส n/3" chip and one tick per break — a gold diamond over an ink notch — that shatters when the boss crosses it */
#bossTag{--ph:#b48cff}
#bossTag .ph{margin-left:auto;padding:0 12px;border-radius:999px;border:1.5px solid var(--hud-gold);background:rgba(240,210,60,.12);
  font-size:var(--t-xs);font-weight:600;line-height:1.6;color:var(--hud-gold);white-space:nowrap}
#bossTag .ph + .pc{margin-left:16px}
#bossTag .bb{position:relative}
#bossTag .ticks{position:absolute;inset:0;pointer-events:none}
#bossTag .ticks s{position:absolute;top:0;bottom:0;width:0;text-decoration:none}
#bossTag .ticks s::before{content:"";position:absolute;left:-2px;top:-3px;bottom:-3px;width:4px;background:#10162b}
#bossTag .ticks s::after{content:"";position:absolute;left:-7px;top:-15px;width:12px;height:12px;border:2px solid #10162b;border-radius:2px;
  background:var(--hud-gold);transform:rotate(45deg)}
#bossTag .ticks s.broke::before{left:-6px;width:12px;background:#10162b;clip-path:polygon(10% 0,70% 18%,40% 42%,85% 64%,55% 100%,25% 100%,50% 70%,8% 46%,38% 22%)}
#bossTag .ticks s.broke::after{background:#6c7386;transform:translate(4px,1px) rotate(72deg) scale(.82);animation:f4-tick calc(.27s / var(--spd,1)) steps(1) both}
@keyframes f4-tick{
  0%{background:#fff;transform:rotate(45deg) scale(2.3);box-shadow:0 0 0 4px var(--ph),0 0 0 8px rgba(255,255,255,.5)}
  25%{background:#fff;transform:rotate(18deg) scale(1.7);box-shadow:0 0 0 3px var(--ph)}
  50%{background:var(--hud-gold);transform:translate(2px,0) rotate(84deg) scale(1.2)}
  75%{background:#9aa0b0;transform:translate(4px,1px) rotate(70deg) scale(.95)}}
#bossTag .ticks .chip{position:absolute;left:-4px;top:-2px;width:10px;height:7px;background:var(--c);clip-path:polygon(0 0,100% 28%,38% 100%);
  animation:f4-chip calc(.6s / var(--spd,1)) steps(6) forwards}
@keyframes f4-chip{70%{opacity:1}to{transform:translate(var(--dx),var(--dy)) rotate(var(--r));opacity:0}}
#bossTag.brk{animation:f4-panel calc(.27s / var(--spd,1)) steps(1) 2}
@keyframes f4-panel{0%{border-color:var(--ph);box-shadow:0 0 0 3px var(--ph),0 18px 40px rgba(3,6,16,.45)}50%{border-color:var(--hud-line)}}
#bossTag.p3{border-color:rgba(255,58,88,.6)}
#bossTag.p3 .bbar em{background:linear-gradient(180deg,#ff8a98,#d83048 60%,#8a1e2e)}
#bossTag.p3 .ph{border-color:#ff5a70;background:rgba(255,58,88,.16);color:#ff9aa8}

/* Rush clock: a coral plate; .beat (re-added each second by tension.js) pops the digits white → red in 4 held drawings;
   .dock flashes the plate when the "RUSH ×2 พลัง" ribbon lands on it */
#stage.rush ~ #hud #clock{margin-top:10px;padding:4px 30px 8px;border-radius:22px;background:rgba(42,12,22,.92);
  box-shadow:0 0 0 2px #e8584a,0 0 0 7px rgba(232,88,74,.22),0 10px 24px rgba(3,6,16,.45)}
#stage.rush ~ #hud #clock.beat b{animation:f4-beat calc(.16s / var(--spd,1)) steps(1) both}
#stage.rush ~ #hud #clock.beat{animation:f4-plate calc(.2s / var(--spd,1)) steps(1) both}
@keyframes f4-beat{0%{scale:1.2;color:#fff}25%{scale:1.1}50%{scale:1.04}}
@keyframes f4-plate{0%{box-shadow:0 0 0 3px #ff7a6a,0 0 0 12px rgba(232,88,74,.42),0 10px 24px rgba(3,6,16,.45)}
  40%{box-shadow:0 0 0 2px #e8584a,0 0 0 9px rgba(232,88,74,.3),0 10px 24px rgba(3,6,16,.45)}}
#stage.rush ~ #hud #clock.dock span{animation:f4-dock calc(.27s / var(--spd,1)) steps(1) 2}
@keyframes f4-dock{0%{color:#10162b;background:var(--hud-gold);border-radius:999px}50%{color:#ffb0a6}}

/* Rush ult buttons: a flickering coral / gold outer ring, a ×2 tag, chevrons rising up the fill (energy fills twice as fast) */
#skills .x2,#skills .chev{display:none}
/* (room 8, ult cards: the Rush / marked / surge / gain beats follow the card shape and run smooth on the frame clock) */
#stage.rush ~ #hud #skills button:not(.dead)::before{content:"";position:absolute;left:-7px;top:-7px;z-index:0;width:160px;height:184px;border-radius:23px;
  pointer-events:none;border:3px solid #e8584a;box-shadow:inset 0 0 0 1px #fff;box-sizing:border-box;animation:f4-ring calc(.5s / var(--spd,1)) ease-in-out infinite alternate}
@keyframes f4-ring{from{opacity:1;transform:scale(1)}to{opacity:.35;transform:scale(1.03)}}
#stage.rush ~ #hud #skills button:not(.dead) .x2{display:block;position:absolute;right:-8px;top:40px;z-index:3;padding:0 8px;border-radius:999px;
  background:#c8283f;border:2px solid #fff;color:#fff;font:800 16px/22px var(--hud-num);box-shadow:0 2px 0 rgba(3,6,16,.5);
  animation:f4-x2 calc(.4s / var(--spd,1)) ease-in-out infinite alternate}
@keyframes f4-x2{to{transform:scale(1.1)}}
#stage.rush ~ #hud #skills button:not(.dead):not(.ready) .chev{display:block;position:absolute;left:0;right:0;bottom:0;z-index:1;height:calc(var(--e) * 1%);pointer-events:none;
  --cv:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18'%3E%3Cpath d='M3 12L8 6.5L13 12' fill='none' stroke='%2310162b' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M3 12L8 6.5L13 12' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background:var(--cv) left 4px bottom 0/16px 18px repeat-y;animation:f4-chev calc(.53s / var(--spd,1)) linear infinite}
#skills .chev::after{content:"";position:absolute;inset:0;background:var(--cv) right 4px bottom 9px/16px 18px repeat-y;animation:f4-chev-r calc(.53s / var(--spd,1)) linear infinite}
@keyframes f4-chev{to{background-position:left 4px bottom 18px}}
@keyframes f4-chev-r{to{background-position:right 4px bottom 27px}}
/* the boss's lock on a hero: its card pulses crimson while the reticle is up */
#skills button.marked .ring{animation:f4-marked calc(.54s / var(--spd,1)) ease-in-out 3}
@keyframes f4-marked{0%,100%{box-shadow:0 0 0 1.5px rgba(255,255,255,.34),0 14px 26px rgba(4,2,12,.55)}50%{box-shadow:inset 0 0 0 2px #fff,0 0 0 4px #ff3a58,0 0 0 10px rgba(255,58,88,.3),0 14px 26px rgba(4,2,12,.55)}}
/* comeback: a paper flame lands — the card swells on an ember edge, then the energy it brought pops over it */
#skills button.surge .ring{animation:f4-surge calc(.42s / var(--spd,1)) cubic-bezier(.2,.8,.2,1) both}
@keyframes f4-surge{0%{transform:scale(1.12);box-shadow:inset 0 0 0 2px #fff,0 0 0 5px #ffa040,0 0 0 12px rgba(255,160,64,.4)}100%{transform:scale(1);box-shadow:0 0 0 1.5px rgba(255,255,255,.34),0 14px 26px rgba(4,2,12,.55)}}
#skills .gain{position:absolute;left:50%;top:60px;z-index:4;translate:-50% 0;padding:0 12px;border-radius:999px;pointer-events:none;white-space:nowrap;
  background:#10162b;border:2px solid #ffa040;color:#ffc06a;font:700 20px/30px var(--hud-num);animation:f4-gain calc(.8s / var(--spd,1)) cubic-bezier(.2,.8,.2,1) forwards}
@keyframes f4-gain{0%{scale:1.5;translate:-50% 6px}15%{scale:1}100%{translate:-50% -54px;opacity:.35}}
#hud.is-m #bossTag .ph{font-size:12px;padding:0 8px}
#hud.is-m #bossTag .ticks s::after{left:-5px;top:-11px;width:9px;height:9px}
#hud.is-m #skills button:not(.dead)::before{display:none}
#stage.rush ~ #hud.is-m #skills button:not(.dead):not(.ready) .ring{box-shadow:inset 0 0 0 1px #fff,0 0 0 3px #e8584a,0 10px 18px rgba(4,2,12,.55)}
#hud.is-m #skills .x2{right:-6px;top:22px;padding:0 6px;font-size:14px;line-height:20px}
#hud.is-m #skills .chev,#hud.is-m #skills .chev::after{background-size:12px 14px}
#hud.is-m #skills .gain{top:26px;font-size:14px;line-height:22px}
@media (prefers-reduced-motion:reduce){
  #bossTag.brk,#bossTag .ticks .chip,#clock.beat,#clock.beat b,#clock.dock span,#skills button::before,#skills .x2,#skills .chev,#skills .chev::after,#skills button.marked .ring,#skills button.surge .ring{animation:none}
}

/* ---------- dev-only result panel (main.js without the screens) ---------- */
.panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:520px;padding:26px 34px 32px;border-radius:22px;text-align:center;
  background:rgba(16,22,44,.92);border:1px solid rgba(255,255,255,.2);box-shadow:0 18px 40px rgba(3,6,16,.45)}

/* HUD transitions follow the battle speed (--spd is set on #stage and #hud by main.js) */
#banner{transition-duration:calc(.22s / var(--spd,1))}
#waveCard{transition-duration:calc(.24s / var(--spd,1)),calc(.12s / var(--spd,1))}

@media (prefers-reduced-motion:reduce){
  #skills button.ready .ring,#skills button.nope{animation:none}
  #banner,#waveCard,#bossTag .bbar u,#skills .ring{transition:none}
}
html.still #hud *,html.still #hud *::before{animation:none!important;transition:none!important}

/* ---------- F1 · "a tap that matters" (src/juice/interrupt.js, interrupt-hud.js): chain ring, interrupt hints, refund ---------- */
/* chain HUD (src/juice/interrupt-hud.js chainRing, 16 Nov): a frameless combo counter on the left edge — our side, clear of
   the formation (heroes from x≈460), the foes' side, the hero cut-in band (top-left, above y≈400) and the ult cards.
   CHAIN ×n (Bungee) · the window bar · โบนัส +x% (Prompt + Bungee). White type on a black fade, no boxes; gold only for the
   bonus and the peak (×5, สำเร็จ). Every move is transform / opacity from JS on the battle clock (smooth, ×2, pause), so no
   CSS transitions or animations here. Phone: in the gap between the battle band and the ult cards, left of Auto. */
#chain.cx{position:absolute;left:0;top:430px;z-index:3;width:620px;padding:0 0 0 64px;border:0;background:none;pointer-events:none;
  visibility:hidden;white-space:nowrap;line-height:1}
#chain.cx.show{visibility:visible}
#chain .cx-fade{position:absolute;left:0;top:-150px;bottom:-150px;width:820px;z-index:-1;will-change:opacity;
  background:radial-gradient(ellipse 66% 50% at 0 50%,rgba(6,3,16,.88) 0,rgba(6,3,16,.7) 38%,rgba(6,3,16,.3) 68%,rgba(6,3,16,0) 100%)}
#chain .cx-in{position:relative;display:grid;grid-template-areas:"cap" "num" "bar" "bon";justify-items:start;will-change:transform,opacity}
#chain .cx-cap{grid-area:cap;font-family:Bungee,var(--hud-num);font-size:30px;letter-spacing:.2em;color:#fff;transform:skewX(-10deg);text-shadow:0 3px 0 #0a0616;will-change:transform}
#chain .cx-nw{grid-area:num;position:relative;width:300px;height:150px;margin:8px 0 0 -4px;transform:skewX(-8deg)}
/* the number is drawn at 2× (300 px) on its own layer and scaled ≤ 1 from JS, so the slam never upscales a raster: crisp at every
   size. top / origin put its baseline where a 150 px line's would be (Bungee: baseline .86em, cap height .72em) */
#chain :is(.cx-num,.cx-gh){position:absolute;left:0;top:-.43em;display:flex;align-items:baseline;font-family:Bungee,var(--hud-num);font-size:300px;line-height:1;
  transform-origin:0 .86em;will-change:transform,opacity}
#chain :is(.cx-num,.cx-gh) i{font-style:normal;font-size:.46em;margin-right:.06em}
#chain .cx-num{color:#fff;text-shadow:0 16px 0 #0a0616,6px 0 0 #0a0616,-6px 0 0 #0a0616,0 -6px 0 #0a0616}
#chain .cx-num.gold{color:var(--hud-gold)}
#chain .cx-gh{color:transparent;-webkit-text-stroke:6px #fff;opacity:0}
#chain .cx-gh.gold{-webkit-text-stroke-color:var(--hud-gold)}
/* speed wedges behind the number, white specks out of it (crisp shapes, cut off — no soft fades) */
#chain .cx-st{position:absolute;left:-70px;top:0;width:400px;height:100%}
#chain .cx-st i{position:absolute;left:0;top:28%;width:300px;height:10px;background:#fff;opacity:0;transform-origin:0 50%;clip-path:polygon(0 44%,100% 0,100% 100%,0 56%);will-change:transform,opacity}
#chain .cx-st i:nth-child(2){top:54%;height:15px}
#chain .cx-st i:nth-child(3){top:76%;height:7px}
#chain .cx-sp{position:absolute;left:96px;top:56%;width:0;height:0}
#chain .cx-sp i{position:absolute;left:-7px;top:-7px;width:14px;height:14px;background:#fff;opacity:0;box-shadow:0 0 0 2px #0a0616;will-change:transform,opacity}
/* the 1-s window: a white bar that drains; coral rim + white core in its last 28 % */
#chain .cx-bar{grid-area:bar;position:relative;width:340px;height:12px;margin:16px 0 20px;transform:skewX(-30deg)}
#chain .cx-bar::before{content:"";position:absolute;left:0;right:0;top:4px;height:4px;background:rgba(255,255,255,.24)}
#chain .cx-bar u{position:absolute;inset:0;background:#fff;transform-origin:0 50%;box-shadow:0 4px 0 #0a0616;will-change:transform,opacity}
#chain .cx-bar.hurry u{background:linear-gradient(#ff5d4d 0 28%,#fff 28% 72%,#ff5d4d 72%)}
#chain :is(.cx-bon,.cx-done){grid-area:bon;display:flex;align-items:baseline;gap:16px;transform-origin:0 70%;will-change:transform,opacity}
#chain :is(.cx-bon,.cx-done) small{font-size:26px;font-weight:600;line-height:1.3;color:#fff;text-shadow:0 2px 0 #0a0616}
#chain .cx-bon b{font-family:Bungee,var(--hud-num);font-size:54px;font-weight:400;color:var(--hud-gold);text-shadow:0 5px 0 #0a0616}
#chain .cx-bon b.next{font-size:40px;color:#fff}
#chain .cx-done{opacity:0}
#chain .cx-done b{font-size:44px;font-weight:700;line-height:1.3;color:#fff;text-shadow:0 4px 0 #0a0616}
#chain .cx-done em{font-style:normal;font-family:Bungee,var(--hud-num);font-size:44px;color:var(--hud-gold);text-shadow:0 5px 0 #0a0616}
/* the finish: a gold-rimmed white blade wipes across */
#chain .cx-slash{position:absolute;left:-40px;top:50%;width:560px;height:16px;opacity:0;transform-origin:0 50%;will-change:transform,opacity;
  background:linear-gradient(var(--hud-gold) 0 22%,#fff 22% 78%,var(--hud-gold) 78%);clip-path:polygon(0 50%,8% 0,100% 32%,100% 68%,8% 100%)}
/* the CHAIN art canvas (src/juice/interrupt-chain.js): behind the counter, inside the block so it rides its slide and kick;
   it reaches up into the air over the block for the fan, the rays and the confetti */
#chain .cx-art{position:absolute;left:-64px;top:-270px;z-index:0;width:640px;height:620px;pointer-events:none}
#hud.is-m #chain .cx-art{left:-16px;top:-150px;width:330px;height:300px}
#hud.is-m #chain.cx{top:auto;bottom:150px;width:300px;padding-left:16px}
#hud.is-m #chain .cx-fade{top:-50px;bottom:-30px;width:380px;background:radial-gradient(ellipse 78% 60% at 0 55%,rgba(6,3,16,.86) 0,rgba(6,3,16,.62) 45%,rgba(6,3,16,0) 100%)}
#hud.is-m #chain .cx-in{grid-template-areas:"cap cap" "num bon" "bar bar";grid-template-columns:auto 1fr;column-gap:10px;align-items:end}
#hud.is-m #chain .cx-cap{font-size:15px;letter-spacing:.18em;text-shadow:0 2px 0 #0a0616}
#hud.is-m #chain .cx-nw{width:130px;height:72px;margin:4px 0 0 -2px}
#hud.is-m #chain :is(.cx-num,.cx-gh){font-size:144px}
#hud.is-m #chain .cx-num{text-shadow:0 8px 0 #0a0616,4px 0 0 #0a0616,-4px 0 0 #0a0616,0 -4px 0 #0a0616}
#hud.is-m #chain .cx-gh{-webkit-text-stroke-width:4px}
#hud.is-m #chain .cx-st{left:-30px;width:220px}
#hud.is-m #chain .cx-st i{width:110px;height:6px}
#hud.is-m #chain .cx-st i:nth-child(2){height:9px}
#hud.is-m #chain .cx-st i:nth-child(3){height:4px}
#hud.is-m #chain .cx-sp{left:46px}
#hud.is-m #chain .cx-sp i{left:-4px;top:-4px;width:8px;height:8px;box-shadow:0 0 0 1.5px #0a0616}
#hud.is-m #chain .cx-bar{width:210px;height:8px;margin:8px 0 2px}
#hud.is-m #chain .cx-bar::before{top:3px;height:2px}
#hud.is-m #chain .cx-bar u{box-shadow:0 3px 0 #0a0616}
#hud.is-m #chain :is(.cx-bon,.cx-done){flex-wrap:wrap;column-gap:6px;row-gap:0;padding-bottom:6px}
#hud.is-m #chain :is(.cx-bon,.cx-done) small{font-size:14px}
#hud.is-m #chain .cx-bon small{flex-basis:100%}
#hud.is-m #chain .cx-bon b{font-size:30px;text-shadow:0 3px 0 #0a0616}
#hud.is-m #chain .cx-bon b.next{font-size:24px}
#hud.is-m #chain .cx-done b{flex-basis:100%;font-size:22px;text-shadow:0 2px 0 #0a0616}
#hud.is-m #chain .cx-done em{font-size:24px;text-shadow:0 3px 0 #0a0616}
#hud.is-m #chain .cx-slash{left:-20px;width:300px;height:10px}

/* ult cards (room 8): "ขัดได้" tag (gold = tap now · dark with a dashed gold edge = has the skill, not charged), the tap-here
   sonar, the chain brackets + "ต่อเชน!", the refund pop and "+50%" (src/juice/interrupt-hud.js buttonHints). Smooth loops on
   transform / opacity, timed by --spd; the one-shots are WAAPI from buttonHints. */
#skills .f1-int{position:absolute;left:50%;top:-46px;z-index:4;display:none;align-items:center;gap:6px;height:34px;padding:0 14px 0 10px;border-radius:999px;
  transform:translateX(-50%);font-size:17px;font-weight:700;line-height:1;white-space:nowrap;pointer-events:none}
#skills .f1-int svg{width:16px;height:16px;flex:none}
#skills .f1-int path{fill:currentColor}
#skills button.f1-can .f1-int{display:inline-flex;background:var(--hud-gold);color:#1a1530;box-shadow:0 0 0 2px #fff,0 0 0 3.5px rgba(16,12,36,.9),0 3px 0 3.5px rgba(3,6,16,.4);
  animation:f1-tag calc(.45s / var(--spd,1)) ease-in-out infinite alternate}
#skills button.f1-could .f1-int{display:inline-flex;background:rgba(10,8,22,.95);color:var(--hud-gold);border:1.5px dashed rgba(240,210,60,.8)}   /* not charged: dashed edge, full-strength text (no opacity: 4.5:1 on any battle art) */
@keyframes f1-tag{to{transform:translateX(-50%) scale(1.1)}}
/* one layer over the card (follows its ready lift): sonar ring, gain pop, chain brackets, the "ต่อเชน!" foot */
#skills .f1-sonar{position:absolute;left:0;top:0;z-index:2;width:146px;height:170px;pointer-events:none;transition:translate calc(.34s / var(--spd,1)) cubic-bezier(.34,1.56,.64,1)}
#skills button.ready .f1-sonar{translate:0 -14px}
#skills .f1-sonar :is(.s,.g){position:absolute;inset:0;border-radius:18px;opacity:0}
#skills .f1-sonar .s{box-shadow:inset 0 0 0 3px #fff,0 0 0 3px var(--hud-gold)}
#skills button.f1-go .f1-sonar .s{animation:f1-sonar calc(.95s / var(--spd,1)) cubic-bezier(.1,.6,.3,1) infinite}
@keyframes f1-sonar{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1.32)}}
#skills .f1-sonar .g{box-shadow:inset 0 0 0 2px #fff,0 0 0 4px #7ff0e6}
#skills .f1-sonar .cd{position:absolute;inset:-12px;display:none;--g:linear-gradient(var(--hud-gold),var(--hud-gold));--w:linear-gradient(#fff,#fff);
  background:var(--w) 2px 2px/26px 1.6px no-repeat,var(--w) 2px 2px/1.6px 26px no-repeat,var(--w) calc(100% - 2px) 2px/26px 1.6px no-repeat,var(--w) calc(100% - 2px) 2px/1.6px 26px no-repeat,
    var(--w) 2px calc(100% - 2px)/26px 1.6px no-repeat,var(--w) 2px calc(100% - 2px)/1.6px 26px no-repeat,var(--w) calc(100% - 2px) calc(100% - 2px)/26px 1.6px no-repeat,var(--w) calc(100% - 2px) calc(100% - 2px)/1.6px 26px no-repeat,
    var(--g) 0 0/30px 5.5px no-repeat,var(--g) 0 0/5.5px 30px no-repeat,var(--g) 100% 0/30px 5.5px no-repeat,var(--g) 100% 0/5.5px 30px no-repeat,
    var(--g) 0 100%/30px 5.5px no-repeat,var(--g) 0 100%/5.5px 30px no-repeat,var(--g) 100% 100%/30px 5.5px no-repeat,var(--g) 100% 100%/5.5px 30px no-repeat;
  filter:drop-shadow(0 0 1.5px rgba(16,12,36,.95))}
#skills button.f1-chain .f1-sonar .cd{display:block;animation:f1-cd calc(.42s / var(--spd,1)) ease-in-out infinite alternate}
@keyframes f1-cd{from{transform:scale(1.09)}to{transform:scale(1)}}
#skills .f1-ch{position:absolute;left:0;right:0;bottom:0;height:36px;display:none;place-items:center;border-radius:0 0 18px 18px;background:var(--hud-gold);color:#1a1530;
  font-size:18px;font-weight:700;line-height:1;box-shadow:inset 0 2px 0 #fff}
#skills button.f1-chain .f1-ch{display:grid;animation:f1-ch calc(.22s / var(--spd,1)) cubic-bezier(.2,.8,.2,1) both}
@keyframes f1-ch{from{transform:translateY(100%)}to{transform:translateY(0)}}
#skills .f1-rf{position:absolute;left:50%;top:-10px;z-index:5;display:block;opacity:0;pointer-events:none;transform:translate(-50%,0);
  font-family:var(--hud-num);font-weight:700;font-size:34px;line-height:1;color:#7ff0e6;paint-order:stroke;-webkit-text-stroke:6px #10162b;text-shadow:0 3px 0 rgba(3,6,16,.5)}
#hud.is-m #skills .f1-int{top:-36px;height:28px;gap:4px;padding:0 9px 0 7px;font-size:14px}
#hud.is-m #skills .f1-int svg{width:12px;height:12px}
#hud.is-m #skills .f1-sonar{width:68px;height:84px}
#hud.is-m #skills button.ready .f1-sonar{translate:0 -8px}
#hud.is-m #skills .f1-sonar :is(.s,.g){border-radius:12px}
#hud.is-m #skills .f1-sonar .cd{inset:-8px;background-size:18px 1.4px,1.4px 18px,18px 1.4px,1.4px 18px,18px 1.4px,1.4px 18px,18px 1.4px,1.4px 18px,20px 4px,4px 20px,20px 4px,4px 20px,20px 4px,4px 20px,20px 4px,4px 20px}
#hud.is-m #skills .f1-ch{height:24px;font-size:14px;border-radius:0 0 12px 12px}
#hud.is-m #skills .f1-rf{font-size:22px;-webkit-text-stroke:4px #10162b}
/* interrupt room (17 Nov 2026, Gain: "สีรุ้งหมุนรอบไว ๆ ในช่วงที่ขัดได้"): a card whose READY ult would break a foe's wind-up in
   time (interrupt.js refresh: the sim's own forecast) wears a rainbow rim that spins fast, and its tag reads "ขัด!" on a rainbow
   edge. The rim is a conic gradient on an oversized square that turns (transform only: the compositor spins it at 60 fps)
   inside a rounded box masked to a ring, so the card art stays untouched; a wider, fainter echo turns the other way; a white
   core line hugs the card. It rides the ready lift with the sonar layer and is gone the frame the class drops (the window
   closed, the card was pressed, Auto). Reduced motion: no spin, a slow pulse. */
#skills .f1-rbg{position:absolute;inset:0;z-index:-1;display:none;pointer-events:none;filter:blur(9px)}
#skills .f1-rb{position:absolute;inset:-15px;display:none;border-radius:32px;padding:13px;overflow:hidden;pointer-events:none;
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}
#skills .f1-rbg .f1-rb{inset:-22px;border-radius:40px;padding:18px}
#skills .f1-rb i{position:absolute;left:50%;top:50%;width:280px;height:280px;margin:-140px 0 0 -140px;will-change:transform;
  background:conic-gradient(#ff4f5e,#ff9a3c,#ffe14d,#5fe08a,#3ec8f0,#6f7dff,#d36cff,#ff4f5e);animation:f1-rb calc(.62s / var(--spd,1)) linear infinite}
#skills .f1-rbw{position:absolute;inset:-2px;display:none;border-radius:20px;pointer-events:none;box-shadow:0 0 0 2.2px #fff}
#skills .f1-rbw::after{content:"";position:absolute;inset:-13px;border-radius:32px;box-shadow:0 0 0 2px rgba(16,12,36,.85)}
#skills button.f1-can .f1-sonar{z-index:2}
#skills button.f1-can :is(.f1-rb,.f1-rbw,.f1-rbg){display:block}
@keyframes f1-rb{to{transform:rotate(1turn)}}
#skills button.f1-can .f1-int{background:linear-gradient(var(--hud-gold),var(--hud-gold)) padding-box,conic-gradient(#ff4f5e,#ff9a3c,#ffe14d,#5fe08a,#3ec8f0,#6f7dff,#d36cff,#ff4f5e) border-box;
  border:3.5px solid transparent;top:-52px;height:38px;padding:0 15px 0 10px;font-size:21px;box-shadow:0 0 0 1.5px #fff,0 0 0 3px rgba(16,12,36,.9),0 3px 0 3px rgba(3,6,16,.4)}
#hud.is-m #skills .f1-rb{inset:-9px;border-radius:20px;padding:7.5px}
#hud.is-m #skills .f1-rbg .f1-rb{inset:-12px;border-radius:23px;padding:9px}
#hud.is-m #skills .f1-rbg{filter:blur(4px)}
#hud.is-m #skills .f1-rb i{width:160px;height:160px;margin:-80px 0 0 -80px}
#hud.is-m #skills .f1-rbw{inset:-1.5px;border-radius:13px;box-shadow:0 0 0 1.5px #fff}
#hud.is-m #skills .f1-rbw::after{inset:-7.5px;border-radius:20px;box-shadow:0 0 0 1.5px rgba(16,12,36,.85)}
#hud.is-m #skills button.f1-can .f1-int{top:-40px;height:30px;font-size:16px;border-width:2.5px;padding:0 9px 0 6px}
/* reduced motion (html.still, or the media query): the rim stands still; interrupt-hud.js buttonHints.update breathes its opacity */
html.still #skills .f1-rb i{animation:none}
@media (prefers-reduced-motion:reduce){#skills .f1-rb i{animation:none}}

/* the refund motes' canvas: over the HUD, under the out-of-battle screens (z 10) */
#f1fx{position:fixed;inset:0;z-index:6;width:100%;height:100%;pointer-events:none}

/* room 7 (assessment B): phone ult state text ≥ 14 px */
#hud.is-m #skills .st{font-size:14px}

/* Dusk Veil (room 8, direction A): the clock sits on its own dark backing so the time reads on any battle art */
#clock{align-self:flex-start;display:flex;flex-direction:column;align-items:center;padding:6px 22px 8px;border-radius:22px;background:rgba(8,6,18,.72);box-shadow:0 8px 20px rgba(4,2,12,.35)}
#clock span{margin-top:0;padding:0;background:none}
#hud.is-m #clock{padding:2px 12px;border-radius:14px}

/* Sky Library (src/library.js): no in-fight loot tally on a floor (the reward is the book); the floor's rule cards in a chip */
#hud[data-mode="library"] #lootTally{display:none}
#libRules{position:absolute;right:28px;top:96px;z-index:2;display:flex;flex-direction:column;align-items:flex-end;gap:6px;pointer-events:none;
  font:500 19px/1.25 var(--pk-font-ui, 'Anuphan', sans-serif);color:#fbf7ee;text-shadow:0 1px 0 rgba(6,4,18,.72)}
#libRules b{font-weight:600;font-size:20px;color:#e9c97c}
#libRules span{padding:5px 12px 6px;border-radius:999px;background:rgba(8,6,26,.62);border:1px solid rgba(233,201,124,.55)}
#libRules[hidden]{display:none}
/* R9: phones put the chip where the (hidden) drop chip would sit: under ×1 | ×2, or under the boss bar while it shows (was top 96
   at any width, so the floor title covered the boss bar) */
#hud.is-m #libRules{right:12px;top:74px;gap:4px;max-width:250px;font-size:14px;transition:top .25s ease}
#hud.is-m #bossTag:not([hidden]) ~ #libRules{top:146px}
#hud.is-m #libRules b{font-size:15px;line-height:1.3;text-align:right}
#hud.is-m #libRules span{padding:3px 10px 4px}

/* ---------- ult cards · compact (Gain, 18 Nov 2026: "เปลี่ยนหลอดขาวเป็นหลอดเลือดจริง ๆ และไม่ต้องมีชื่อ กับ % ด้านล่างแล้ว อยากให้มีแค่กล่อง 5
   กล่อง และเอาคำว่า 'กด 1-5' ออก") ----------
   Only the five boxes: the portrait says who, the sweep over the art is the one gauge, the foot bar is the hero's real HP
   (interrupt-hud.js cardHp sets --hp, --hpt (the trail) and --hpc: mint, yellow under 60 %, coral under 30 %) on the battle
   bars' look: ink backing, light rim. The name, the state line and the "กด 1–5" hint are gone (the 1–5 keys still work); a
   ready card says พร้อม! on a small gold chip inside the box, over the HP bar. A dead card greys out over an empty bar. */
#skills .nm,#ultHint{display:none}
#skills{bottom:28px}
#skills::before{bottom:-28px}
#skills .uc-bar{left:9px;right:9px;bottom:8px;height:11px;border-radius:6px;background:#0a0816;box-shadow:0 0 0 1.5px rgba(255,255,255,.62),0 2px 0 rgba(3,6,16,.55)}
#skills .uc-bar :is(i,.uc-hpt){position:absolute;left:0;top:0;bottom:0;width:100%;border-radius:0;transform-origin:0 50%}
#skills .uc-bar i{background:var(--hpc,#58e0a8);transform:scaleX(var(--hp,1));
  background-image:linear-gradient(180deg,rgba(255,255,255,.55) 0 28%,rgba(255,255,255,0) 28%)}
#skills .uc-bar .uc-hpt{display:block;background:#fff6e2;opacity:.9;transform:scaleX(var(--hpt,1))}
#skills button.ready .uc-bar i{background-color:var(--hpc,#58e0a8)}
#skills button.dead .uc-bar{opacity:1}
/* the state line becomes a chip inside the card: only พร้อม! shows (the ready card lifts, so the chip lifts with it) */
#skills .st{position:absolute;left:50%;bottom:24px;z-index:2;display:none;transform:translateX(-50%);padding:1px 12px;border-radius:999px;pointer-events:none;
  background:var(--hud-gold);color:#1a1530;font:700 17px/1.35 var(--font);white-space:nowrap;box-shadow:0 0 0 2px #fff,0 0 0 3.5px rgba(16,12,36,.9)}
#skills button.ready .st{display:block;color:#1a1530;font-size:17px;translate:0 -14px}
#skills button.ready.f1-chain .st{display:none}
#hud.is-m #skills{bottom:30px}
#hud.is-m #skills::before{bottom:-30px}
#hud.is-m #skills .uc-bar{left:5px;right:5px;bottom:5px;height:7px;border-radius:4px;box-shadow:0 0 0 1.2px rgba(255,255,255,.62),0 1.5px 0 rgba(3,6,16,.55)}
#hud.is-m #skills .st{bottom:15px;padding:0 6px;font-size:14px;line-height:1.3;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px rgba(16,12,36,.9)}
#hud.is-m #skills button.ready .st{font-size:14px;translate:0 -8px}
/* the phone cards now sit 28 px lower (no name / state under them): the CHAIN block and Auto keep their old gaps above them */
#hud.is-m #chain.cx{bottom:122px}
#hud.is-m #auto{bottom:164px}

/* ---- status icons on the ult cards (ORC for Gain, 18 Nov 2026: pick C "backlit kirigami" everywhere a status shows) ----
   juice/interrupt-hud.js cardSt: the statuses that keep the ult from firing (freeze, stun, seal; Gain: nothing else, the card
   stays clean) as lantern discs (src/status-icons.js atlas) down the card's left edge.
   Desktop under the key, phone from the top (the key is hidden there). ?sticons=0 leaves .uc-sti empty: cards as before. */
#skills .uc-sti{position:absolute;left:8px;top:44px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none}
#skills .uc-sti:empty{display:none}
#skills .uc-sti i{display:block;width:32px;height:32px;border-radius:50%;filter:drop-shadow(0 2px 1px rgba(3,6,16,.7));animation:uc-st-pop .26s cubic-bezier(.2,1.6,.4,1) both}
@keyframes uc-st-pop{0%{transform:scale(.4)}100%{transform:scale(1)}}
#hud.is-m #skills .uc-sti{left:3px;top:3px;gap:2px}
#hud.is-m #skills .uc-sti i{width:22px;height:22px}
