/* БУМБА — the bottom of the fight screen, direction B «Стикер» (UI wave 2b, art/ui/plan.md; look: /lab/ui-concept/hud.html?dir=b).
   Phones: the action buttons in an arc under the right thumb (#pad .act, icons fx/icons/act-*.png, captions hidden),
   the super with its charge ring, the gadget as a square with its recharge, the grenade on БОМБА; a ghost stick
   bottom left. Desktop: the own panel #mine at the bottom (avatar + lives, super H, grenade E, gadget G).
   Newcomer hints: a small tag next to the button they are about (.k-hint, features/hints.js).
   Selectors start with :root (the specificity the rules were tuned with — over stamina.js's #pad button.tired and
   the base #stick in style.css). State classes (features/pad.js):
   #touch/#mine .gone (between rounds, out — the buttons leave), .dim (dead: death cam), .quiet (no animation).
   Motion animates scale / translate / rotate separately (never transform), so presses, rotations and loops compose. */

/* ---------- the pad (phones) ---------- */
/* --k: the pad's scale (narrow phones .92, landscape .8); --reach: how far its leftmost button reaches from the right
   edge at --k 1 (the gadget square) — the floating stick's zone stops there, so a thumb never lands on both */
:root #touch{--k:1;--reach:216px;--top:340}   /* --top: the topmost button's edge with its rim at scale 1 (features/pad.js fit()) */
@media (orientation:portrait) and (max-width:380px){:root #touch{--k:.92}}
@media (orientation:landscape) and (max-height:520px){:root #touch{--k:.8}}
:root #pad{position:absolute;right:var(--safe-r);bottom:var(--safe-b);width:240px;height:350px;pointer-events:none;
  transform-origin:100% 100%;scale:var(--k)}
:root #stick{width:min(50%,calc(100% - var(--reach) * var(--k) - var(--safe-r)))}
:root #pad .act{--s:70;--bg:var(--paper);position:absolute;box-sizing:border-box;width:calc(var(--s) * 1px);height:calc(var(--s) * 1px);
  right:calc(var(--x) * 1px - var(--s) * .5px);bottom:calc(var(--y) * 1px - var(--s) * .5px);
  display:grid;place-items:center;padding:0;margin:0;border-radius:50%;pointer-events:auto;touch-action:none;
  background:radial-gradient(circle at 50% 28%,color-mix(in srgb,var(--bg) 62%,#fff) 0%,var(--bg) 52%,color-mix(in srgb,var(--bg) 84%,#000) 100%);
  border:4px solid var(--ink);box-shadow:0 0 0 4px var(--rim-c),5px 6px 0 4px var(--ink),inset 0 -5px 0 #0000002a;
  color:var(--ink);opacity:1;filter:none;
  /* release: springs back past rest (the kit's press) */
  transition:scale var(--t-slow) var(--ease-pop),translate var(--t-slow) var(--ease-pop),box-shadow var(--t-slow) var(--ease-pop),filter .25s,opacity .25s}
:root #pad .act>img,:root #pad .act .ic{width:66%;height:66%;object-fit:contain;pointer-events:none;filter:drop-shadow(0 2px 0 #0004);
  transition:scale var(--t-slow) var(--ease-pop),translate .25s var(--ease-out)}
:root #pad .act b{display:none}     /* captions: hidden (the hint tags name the buttons for newcomers) */
:root #pad .act.down{scale:.88;translate:3px 4px;box-shadow:0 0 0 4px var(--rim-c),1px 1px 0 4px var(--ink),inset 0 -2px 0 #0000002a;
  transition-duration:var(--t-press),var(--t-press),var(--t-press),.1s,.1s;transition-timing-function:var(--ease-out)}
:root #pad .act.down>img,:root #pad .act.down .ic{scale:1.08 .9;transition-duration:var(--t-press)}
/* the arc: punch biggest, closest to the thumb; x, y = the centre from the pad's right / bottom edge */
:root #pad .punch{--bg:var(--sun);--x:76;--y:122;--s:92}
:root #pad .punch>img{width:62%;height:62%}
:root #pad .jump{--bg:var(--grass);--x:164;--y:60}
:root #pad .bomb{--bg:var(--coral);--x:168;--y:150}
:root #pad .grab{--bg:var(--sky);--x:98;--y:218}
:root #pad .super{--x:46;--y:300;--s:66}
:root #pad .gadget{--bg:var(--paper);--x:170;--y:268;--s:56;border-radius:14px;rotate:-6deg}
/* landscape phones: the super and the gadget go left of the arc. Under Telegram's row a 360–375 px tall screen has no
   room above it — the pad had to shrink to ×.73 (a 41 px gadget, a 30 px super icon); beside the arc it keeps ×.8 */
@media (orientation:landscape) and (max-height:520px){
  :root #touch{--reach:300px;--top:258}
  :root #pad{width:300px}
  :root #pad .gadget{--x:256;--y:60}
  :root #pad .super{--x:256;--y:152}
}
/* stamina (features/stamina.js .tired): the action would be the weak one — drained colour, the icon sags */
:root #pad .act.tired{filter:saturate(.3) brightness(.8);opacity:.78}
:root #pad .act.tired>img,:root #pad .act.tired .ic{translate:0 3px}

/* counters: charges of the gadget / grenade */
:root :is(#pad,#mine) .cnt{position:absolute;right:-8px;top:-8px;z-index:2;box-sizing:border-box;min-width:24px;height:24px;padding:0 5px;border-radius:12px;
  background:var(--sun);color:var(--ink);border:2.5px solid var(--ink);box-shadow:0 0 0 2px var(--rim-c);
  font:900 12px/19px var(--f-num);font-variant-numeric:tabular-nums;text-align:center;pointer-events:none}
/* the grenade loaded into the bomb button (top left of БОМБА) */
:root #pad .bomb .load{position:absolute;left:-14px;top:-14px;z-index:2;width:36px;height:36px;border-radius:50%;background:var(--paper);
  border:2.5px solid var(--ink);box-shadow:0 0 0 2px var(--rim-c),2px 3px 0 1px var(--ink);display:grid;place-items:center;pointer-events:none}
:root #pad .bomb .load img{width:28px;height:28px;object-fit:contain}
:root #pad .bomb .load .cnt{right:-11px;top:-8px;min-width:20px;height:20px;font-size:10px;line-height:15px;padding:0 4px}

/* two copies of one icon: grey below, the coloured one revealed bottom-up by a percentage (super charge, gadget recharge) */
:root .ic{position:relative;display:block}
:root .ic img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
:root .ic .off{filter:grayscale(1) brightness(.95) contrast(.85);opacity:.6}

/* ---------- super: the ring and the fill follow --charge (client/hud.js superHud) ---------- */
:root :is(#pad,#mine) .super[data-super]{--charge:0%;background:conic-gradient(var(--lime) var(--charge),var(--ink-3) 0)}
:root :is(#pad,#mine) .super[data-super]::before{content:'';position:absolute;inset:6px;border-radius:50%;background:radial-gradient(circle at 50% 30%,#5d5682,var(--ink-2));
  border:2.5px solid var(--ink);transition:background .25s}
:root :is(#pad,#mine) .super[data-super] .ic{width:70%;height:70%}   /* of the box inside the 4 px border: ≥ 32 px at the landscape scale ×.8 */
:root .super[data-super] .ic .on{clip-path:inset(calc(100% - var(--charge)) 0 0 0)}
:root :is(#pad,#mine) .super[data-super].full{background:var(--lime)}
:root :is(#pad,#mine) .super[data-super].full::before{background:radial-gradient(circle at 50% 30%,#fff7a0,var(--sun))}
:root .super[data-super].full .ic .off{opacity:0}
/* ready: one pop, then a soft pulse + a glint every 1.5 s and a lime glow until it is used */
:root :is(#pad,#mine) .super[data-super].sup-ready{animation:sup-ready .32s var(--ease-pop)}
:root .super[data-super].full .ic{animation:sup-pulse 1.5s ease-in-out infinite}
:root .super[data-super].full::after{content:'';position:absolute;inset:-4px;border-radius:inherit;pointer-events:none;animation:sup-glow .8s ease-in-out infinite alternate}
:root .super[data-super] .ic::after{content:'';position:absolute;inset:0;pointer-events:none;opacity:0;
  background:linear-gradient(105deg,transparent 38%,#ffffffd0 50%,transparent 62%) -120% 0/250% 100% no-repeat;
  -webkit-mask:url(fx/icons/act-super.png) center/contain no-repeat;mask:url(fx/icons/act-super.png) center/contain no-repeat}
:root .super[data-super].full .ic::after{opacity:1;animation:sup-shine 1.5s ease-in-out infinite}
@keyframes sup-ready{0%{scale:1}45%{scale:1.16}100%{scale:1}}
@keyframes sup-pulse{0%,62%,100%{scale:1}76%{scale:1.1}}
@keyframes sup-glow{from{box-shadow:0 0 0 0 #ddff6500}to{box-shadow:0 0 16px 6px #ddff65cc}}
@keyframes sup-shine{0%,40%{background-position:-120% 0}75%,100%{background-position:220% 0}}

/* ---------- gadget: recharge fills the icon back in (--rd), a ping when ready, a sky glow while it works ---------- */
:root :is(#pad .gadget,#mine .slot) .ic{--rd:100%}
:root .gadget .ic .on,:root #mine .slot .ic .on{clip-path:inset(calc(100% - var(--rd)) 0 0 0)}
:root #pad .act.gadget .ic{width:88%;height:88%}
:root :is(.gadget,#mine .slot.d).cool .ic .off{opacity:1;filter:grayscale(1) brightness(.55) contrast(.9)}
:root :is(.gadget,#mine .slot.d):not(.cool) .ic .off{opacity:0}
:root :is(.gadget,#mine .slot.d).on{box-shadow:0 0 0 4px var(--rim-c),5px 6px 0 4px var(--ink),0 0 18px 6px #9fe8ffcc}
:root #pad .gadget.down{box-shadow:0 0 0 4px var(--rim-c),1px 1px 0 4px var(--ink)}

/* one-shots: a slot jumps when an item is picked up, the grenade flips when it changes, a ping when ready again */
:root .k-jump{animation:k-jump .42s var(--ease-pop)}
:root .k-flip{animation:k-flip .36s var(--ease-pop)}
:root .k-ready{animation:k-ready .2s var(--ease-pop)}
@keyframes k-jump{0%{translate:0 0;scale:.6}40%{translate:0 -14px;scale:1.12}100%{translate:0 0;scale:1}}
@keyframes k-flip{0%{rotate:0deg;scale:1}40%{rotate:-200deg;scale:.6}100%{rotate:-360deg;scale:1}}
@keyframes k-ready{0%{scale:1}50%{scale:1.12}100%{scale:1}}

/* ---------- the pad's states (features/pad.js): appear / leave / dim ---------- */
:root #touch.in #pad .act{animation:pad-in .38s var(--ease-pop) both;animation-delay:calc(var(--i,0) * 45ms)}
:root #touch.gone #pad .act{animation:pad-out .22s var(--ease-in) both;animation-delay:calc(var(--i,0) * 22ms);pointer-events:none}
:root #touch.gone.quiet #pad .act{animation:none;opacity:0;scale:.5}
:root #touch.dim #pad .act{filter:saturate(.15) brightness(.72);opacity:.5}
@keyframes pad-in{0%{opacity:0;scale:.35;translate:30px 40px}60%{opacity:1}100%{opacity:1;scale:1;translate:0 0}}
@keyframes pad-out{to{opacity:0;scale:.5;translate:24px 30px}}

/* the ghost stick: where the left thumb goes (the real one shows under the finger) */
:root #stick::before{content:'';position:absolute;left:calc(46px + var(--safe-l));bottom:calc(96px + var(--safe-b));width:128px;height:128px;box-sizing:border-box;
  border-radius:50%;border:3px dashed #ffffffa0;background:radial-gradient(circle,#ffffff66 0 26px,#ffffffaa 26px 29px,#ffffff14 30px);
  filter:drop-shadow(0 2px 0 #0005);opacity:.6;transition:opacity .25s,scale .3s var(--ease-pop);pointer-events:none}
:root #stick.on::before,:root #touch.gone #stick::before,:root #touch.dim #stick::before{opacity:0;scale:.7}
@media (orientation:landscape) and (max-height:520px){:root #stick::before{left:calc(70px + var(--safe-l));bottom:calc(36px + var(--safe-b));width:110px;height:110px}}
:root #stick i{border:3px solid #ffffffb0;background:#ffffff1c;box-shadow:0 0 0 2px #1d1b2640}
:root #stick i::after{background:#ffffffc8;border:3px solid var(--ink);box-shadow:2px 3px 0 var(--ink)}

/* ---------- left-handed (profile → «Управление» → «Левша»: client/ui/prefs.js puts html.lefty on) ----------
   the arc mirrored into the bottom-left corner (the same --x / --y from the left edge), the stick's zone and its ghost
   circle on the right; the system lines move off the pad to the right */
:root.lefty #pad{right:auto;left:var(--safe-l);transform-origin:0 100%}
:root.lefty #pad .act{right:auto;left:calc(var(--x) * 1px - var(--s) * .5px)}
:root.lefty #pad .gadget{rotate:6deg}
:root.lefty #pad .bomb .load{left:auto;right:-14px}
:root.lefty #stick{left:auto;right:0;width:min(50%,calc(100% - var(--reach) * var(--k) - var(--safe-l)))}
:root.lefty #stick::before{left:auto;right:calc(46px + var(--safe-r))}
@media (orientation:landscape) and (max-height:520px){:root.lefty #stick::before{left:auto;right:calc(70px + var(--safe-r))}}
:root.lefty body.touch #feed{left:auto;right:10px;align-items:flex-end}

/* ---------- desktop: the own panel at the bottom ---------- */
:root #mine{position:absolute;left:50%;bottom:calc(16px + var(--safe-b));translate:-50% 0;display:flex;align-items:flex-end;gap:16px;pointer-events:none;
  transition:translate var(--t-slow) var(--ease-pop),opacity .25s,filter .25s}
body.touch #mine{display:none}
:root #mine.gone{translate:-50% 140px;opacity:0;transition-timing-function:var(--ease-in);transition-duration:.25s}
:root #mine.dim{filter:saturate(.2) brightness(.75);opacity:.6}
:root #mine .me{display:flex;align-items:center;gap:10px;height:64px;padding:6px 18px 6px 6px;border-radius:999px;background:var(--sun);color:var(--ink);
  border:var(--ow) solid var(--ink);box-shadow:var(--sticker);transform:skewX(var(--skew))}
:root #mine .ava{flex:none;width:50px;height:50px;border-radius:50%;box-sizing:border-box;background:var(--c,var(--sky)) center 16%/150% no-repeat;
  border:3px solid var(--ink);box-shadow:0 0 0 2.5px var(--lime)}
:root #mine .nm{transform:skewX(calc(var(--skew) * -1))}
:root #mine .nm b{display:block;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:800 15px/1.1 var(--f-text)}
:root #mine .hp{display:flex;gap:2px;margin-top:3px;font-size:18px;color:var(--coral)}
:root #mine .hp .empty{color:#1d1b2633}
:root #mine .hp .empty use.o{display:none}
:root #mine .hp .lost{animation:k-flip .4s var(--ease-pop)}
:root #mine .slot{position:relative;box-sizing:border-box;width:64px;height:64px;border-radius:18px;background:var(--paper);border:var(--ow) solid var(--ink);
  box-shadow:4px 4px 0 var(--ink),0 0 0 3px var(--rim-c);display:grid;place-items:center;transition:box-shadow .2s,background .2s}
:root #mine .slot .ic{width:46px;height:46px}
:root #mine .slot>.k-kbd{position:absolute;left:-8px;bottom:-8px;z-index:2}
:root #mine .slot.empty{background:#2d2840b3;border-style:dashed;border-color:#ffffff70;box-shadow:none}
:root #mine .slot.empty .ic img{opacity:.4;filter:grayscale(1)}
:root #mine .slot.empty .cnt{display:none}
:root #mine .slot.super{width:78px;height:78px;border-radius:50%}
:root #mine .slot.super[data-super] .ic{width:48px;height:48px}
:root body:not(.touch) #feed{bottom:calc(112px + var(--safe-b))}   /* system lines over the panel, not on it */

/* ---------- newcomer hint: a tag beside the button it is about (features/hints.js) ---------- */
:root .k-hint{position:fixed;left:0;top:0;z-index:7;pointer-events:none;will-change:transform}
/* the hints live outside #hud (over its whole stack): a sheet or a modal up — they step aside, not over its rows */
:root body:has(.k-sheet:not([hidden]),.k-modal:not([hidden])) .k-hint{visibility:hidden}
:root .k-hint .t{--ax:50%;--ay:50%;position:relative;display:flex;align-items:center;gap:6px;padding:5px 9px 6px;border-radius:11px;background:var(--paper);color:var(--ink);
  border:2.5px solid var(--ink);box-shadow:3px 3px 0 var(--ink),0 0 0 2.5px var(--rim-c);white-space:nowrap;transform-origin:var(--ax) 100%;
  opacity:0;scale:.4;transition:scale .32s var(--ease-pop),opacity .14s,background .15s}
:root .k-hint.a-t .t{transform-origin:var(--ax) 0}
:root .k-hint.a-r .t{transform-origin:100% var(--ay)}
:root .k-hint.a-l .t{transform-origin:0 var(--ay)}
:root .k-hint.on .t{opacity:1;scale:1;animation:k-hint-bob 1.1s ease-in-out .35s infinite alternate}
:root .k-hint.out .t{opacity:0;scale:.6;transition:scale .22s var(--ease-in),opacity .22s}
/* the arrow: a rotated square on the side facing the thing (a-b: below the tag, a-t: above, a-r / a-l: right / left) */
:root .k-hint .t::after{content:'';position:absolute;left:calc(var(--ax) - 6px);bottom:-8px;width:11px;height:11px;background:inherit;
  border:2.5px solid var(--ink);border-width:0 2.5px 2.5px 0;rotate:45deg}
:root .k-hint.a-t .t::after{bottom:auto;top:-8px;rotate:225deg}
:root .k-hint.a-r .t::after{left:auto;right:-8px;bottom:auto;top:calc(var(--ay) - 6px);rotate:-45deg}
:root .k-hint.a-l .t::after{left:-8px;bottom:auto;top:calc(var(--ay) - 6px);rotate:135deg}
:root .k-hint .t>span:not(.keys){display:flex;flex-direction:column;line-height:1.08}
:root .k-hint b{font:900 12px/1.1 var(--f-display);text-transform:uppercase}
:root .k-hint small{font:700 10.5px/1.15 var(--f-text);color:#1d1b26b0;margin-top:1px}
:root .k-hint small:empty{display:none}
:root .k-hint .keys{display:flex;gap:3px}
:root .k-hint .keys:empty{display:none}
:root .k-hint .keys.wasd{display:grid;grid-template-columns:repeat(3,auto);gap:2px}
:root .k-hint .keys.wasd .k-kbd{min-width:20px;height:20px;font-size:10px}
:root .k-hint .keys.wasd .k-kbd:first-child{grid-column:2}
:root .k-hint .k-kbd{min-width:24px;height:24px;font-size:12px}
:root .k-hint.press .k-kbd{animation:k-hint-key 1s ease-in-out infinite}
:root .k-hint img{width:26px;height:26px;object-fit:contain;flex:none}
:root .k-hint.ok .t{background:var(--lime);animation:k-bump .4s var(--ease-pop)}
@keyframes k-hint-bob{from{translate:0 0;rotate:-2deg}to{translate:0 -3px;rotate:2deg}}
@keyframes k-hint-key{0%,40%,100%{translate:0 0}55%,75%{translate:0 2px}}
/* the real button it is about: a lime ring pulses out of it */
:root .hintp::after{content:'';position:absolute;inset:-10px;border-radius:inherit;border:4px solid var(--lime);pointer-events:none;animation:hintp 1s ease-out infinite}
@keyframes hintp{0%{scale:.85;opacity:1}100%{scale:1.3;opacity:0}}

/* ---------- reduced motion (system setting or ?motion=0 → html.k-still) ---------- */
@media (prefers-reduced-motion:reduce){
  :root #touch .act,:root .super[data-super],:root .super[data-super] .ic,:root .super[data-super]::after,:root .k-hint .t,
  :root .k-jump,:root .k-flip,:root .k-ready,:root .hintp::after,:root .k-hint .k-kbd{animation:none!important}
  :root .super[data-super].full .ic::after{display:none}
}
html.k-still #touch .act,html.k-still .super[data-super],html.k-still .super[data-super] .ic,html.k-still .super[data-super]::after,html.k-still .k-hint .t,
html.k-still .k-jump,html.k-still .k-flip,html.k-still .k-ready,html.k-still .hintp::after,html.k-still .k-hint .k-kbd{animation:none!important}
html.k-still .super[data-super].full .ic::after{display:none}
html.k-still #touch.gone .act{opacity:0;pointer-events:none}
