.playing #engine-frame{transition:opacity .65s ease,filter .65s ease}
.playing.is-dead #engine-frame{opacity:.3;filter:saturate(.45)}
.death-overlay{position:fixed;inset:0;z-index:9;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;background:radial-gradient(ellipse at center,#1b03042b,transparent 65%);opacity:0;transition:opacity .55s ease;outline:none;pointer-events:none}
.death-overlay.visible{opacity:1}
.death-skull{width:76px;height:76px;color:#bc4546;filter:drop-shadow(0 0 20px #a8161640);transform:translateY(12px) scale(.92);transition:transform .7s cubic-bezier(.2,.8,.2,1)}
.death-overlay.visible .death-skull{transform:translateY(0) scale(1)}
.death-overlay h2{font:clamp(20px,3vw,36px)/1.7 var(--pixel);letter-spacing:3px;color:#da5353;text-shadow:0 2px 15px #b218182e;margin:0;transform:translateY(10px);transition:transform .65s ease}
.death-overlay.visible h2{transform:translateY(0)}
.death-overlay p{font:12px/1.7 'Segoe UI',sans-serif;letter-spacing:1px;color:#c2aaa2;margin:0}
.death-progress{width:190px;height:2px;background:#b8554a26;overflow:hidden;margin-top:1px}
.death-progress span{display:block;width:100%;height:100%;background:#bc4546;transform-origin:left}
.death-overlay.visible .death-progress span{animation:respawn-countdown 9s linear forwards}
@keyframes respawn-countdown{to{transform:scaleX(0)}}
.playing.is-dead .topbar,.playing.is-dead #online-strip,.playing.is-dead #touch{opacity:.2;pointer-events:none}
@media(max-width:750px){.death-overlay{gap:17px}.death-skull{width:58px;height:58px}.death-overlay h2{font-size:20px;letter-spacing:1px}.death-overlay p{font-size:11px}}
@media(prefers-reduced-motion:reduce){.playing #engine-frame,.death-overlay,.death-skull,.death-overlay h2{transition:none}.death-overlay.visible .death-progress span{animation:none}}

/* Competitive farewell: a fractured hourglass seal scatters into sand. */
#battle-death{position:fixed;inset:0;z-index:40;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:19px;padding:22px;text-align:center;outline:none;pointer-events:none;background:radial-gradient(ellipse at center,#210e125c,transparent 68%);opacity:0}#battle-death.visible{animation:fallen-arrival .65s ease forwards}.fallen-seal{position:relative;width:145px;height:145px;margin-bottom:3px}.fallen-seal svg{width:100%;height:100%;overflow:visible;fill:none;stroke:#d8a66b;stroke-width:1.4}.fallen-ring{stroke:#ba73546b;stroke-dasharray:377;stroke-dashoffset:0;transform:rotate(-90deg);transform-origin:center;animation:fallen-clock 9s linear forwards}.fallen-diamond{stroke:#9e5c4b55;animation:fallen-turn 9s ease-out forwards;transform-origin:center}.fallen-hourglass{stroke:#d5b17b;stroke-width:2;animation:fallen-hourglass 1.6s ease .15s forwards;transform-origin:center}.fallen-sand{fill:#d3a16a;stroke:none}.fallen-crack{stroke:#f47968;stroke-width:2;stroke-dasharray:170;stroke-dashoffset:170;animation:fallen-fracture 1s ease .5s forwards}.fallen-seal i{position:absolute;top:50%;left:50%;width:3px;height:5px;background:#d6aa76;opacity:0;transform:rotate(calc(var(--shard)*30deg)) translateY(-25px);animation:fallen-shard 2.1s ease-out calc(.75s + var(--shard)*.035s) forwards}#battle-death h2{font:clamp(23px,4vw,46px)/1.6 var(--pixel);letter-spacing:3px;color:#df625c;margin:0;text-shadow:0 0 25px #bf353133;animation:fallen-title 1s cubic-bezier(.2,.7,.2,1) both}.fallen-kicker{font:8px/1.8 var(--pixel);letter-spacing:3px;color:#bd9a76;margin:0;animation:fallen-title 1s .15s both}.fallen-result{display:flex;gap:50px;justify-content:center;margin:10px 0 0;animation:fallen-title 1s .45s both}.fallen-result>div{display:flex;flex-direction:column;gap:13px}.fallen-result span{font:8px/1.6 var(--pixel);color:#ae927e}.fallen-result strong{font:27px/1.4 'Courier New',monospace;font-weight:600;color:#ecd0a2;font-variant-numeric:tabular-nums;letter-spacing:2px}#battle-death #fallen-status{font:12px/1.7 'Segoe UI',sans-serif;color:#baa89a;margin:6px 0 0}#battle-death #fallen-countdown{font:11px/1.8 'Segoe UI',sans-serif;color:#988277;margin:0}@keyframes fallen-arrival{to{opacity:1}}@keyframes fallen-clock{to{stroke-dashoffset:377}}@keyframes fallen-turn{to{transform:rotate(55deg);opacity:.3}}@keyframes fallen-hourglass{0%,30%{transform:rotate(0)}50%{transform:rotate(-8deg)}65%{transform:rotate(7deg)}100%{transform:rotate(-14deg);opacity:.35}}@keyframes fallen-fracture{to{stroke-dashoffset:0}}@keyframes fallen-shard{0%{opacity:0}15%{opacity:1}100%{opacity:0;transform:rotate(calc(var(--shard)*30deg + 35deg)) translateY(-110px) scale(.2)}}@keyframes fallen-title{from{opacity:0;transform:translateY(14px);filter:blur(3px)}to{opacity:1;transform:translateY(0);filter:blur(0)}}@media(max-width:650px){.fallen-seal{width:110px;height:110px}.fallen-result{gap:22px}.fallen-result span{font-size:6px}.fallen-result strong{font-size:21px;letter-spacing:0}#battle-death{gap:15px}#battle-death h2{font-size:24px;letter-spacing:1px}.fallen-kicker{font-size:6px;letter-spacing:2px}}@media(prefers-reduced-motion:reduce){#battle-death.visible,.fallen-ring,.fallen-diamond,.fallen-hourglass,.fallen-crack,.fallen-seal i,#battle-death h2,.fallen-kicker,.fallen-result{animation:none;opacity:1;transform:none;filter:none}.fallen-seal i{display:none}.fallen-crack{stroke-dashoffset:0}}


.death-skip-slot{height:44px;display:flex;align-items:center;justify-content:center}
#death-skip{pointer-events:auto;min-height:44px;min-width:88px;padding:8px 22px;border:1px solid #cf5353;border-radius:8px;background:#240d1026;color:#df6565;font:500 13px/1.4 'Segoe UI',sans-serif;letter-spacing:.7px;text-transform:none;text-shadow:none;box-shadow:none;touch-action:manipulation;cursor:pointer;transition:color .2s ease,background .2s ease,border-color .2s ease,transform .2s ease}
#death-skip:not([hidden]){animation:death-skip-appear .4s cubic-bezier(.2,.7,.3,1)}
#death-skip:hover{color:#ff8989;background:#8d29291a;border-color:#ff7979;transform:none;box-shadow:none}
#death-skip:active{transform:translateY(0);background:#8d29292b}
#death-skip:focus-visible{outline:2px solid #e47777;outline-offset:4px}
@keyframes death-skip-appear{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){#death-skip{transition:none}#death-skip:not([hidden]){animation:none}}

.death-overlay{z-index:200;pointer-events:auto}.death-overlay[hidden]{display:none}.death-overlay:not(.visible){pointer-events:none}
.death-skip-slot{gap:12px;flex-wrap:wrap;height:auto;min-height:44px}
#death-menu{pointer-events:auto;min-height:44px;padding:8px 16px;border:1px solid #bf666666;border-radius:8px;background:#240d1026;color:#cfa5a5;font:500 12px/1.4 'Segoe UI',sans-serif;cursor:pointer;touch-action:manipulation;transition:background .2s,color .2s}
#death-menu:hover{background:#8d29291a;color:#ffe0e0}#death-menu:focus-visible{outline:2px solid #e47777;outline-offset:4px}
.death-summary{position:absolute;top:max(65px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(640px,90vw);max-height:24dvh;overflow:auto;text-align:center;padding:14px 18px;border:1px solid #ebd39655;border-radius:12px;background:#15182de8;box-shadow:0 8px 32px #0005;color:#ffe7a3;pointer-events:auto;font:12px/1.8 var(--pixel);}
.death-summary>strong{display:block;font-size:11px;color:#a0f2df;margin-bottom:10px;}
.death-summary-items{display:flex;justify-content:center;flex-wrap:wrap;gap:8px 18px;}
.death-summary-items>span{display:inline-block;animation:death-reward-reveal .5s cubic-bezier(.16,1,.3,1) both;animation-delay:var(--reward-delay);}
@keyframes death-reward-reveal{from{opacity:0;transform:translateY(10px) scale(.93);filter:blur(3px)}to{opacity:1;transform:none;filter:blur(0)}}
@media(max-height:480px){.death-summary{top:8px;max-height:22dvh;padding:8px 12px;font-size:9px}.death-summary>strong{font-size:9px;margin-bottom:4px}}
@media(prefers-reduced-motion:reduce){.death-summary-items>span{animation:none}}
.death-summary-items .summary-reward{display:flex;align-items:center;gap:9px;padding:9px 13px;border:1px solid #e7d09222;border-radius:10px;background:#ffffff08;}
.summary-icon{width:28px;height:28px;display:inline-flex;flex-shrink:0;color:#96ffc0;filter:drop-shadow(0 0 8px #73f4aa55);}
.summary-icon svg{width:100%;height:100%;}
.summary-special .summary-icon,.summary-medal .summary-icon{color:#ffdb76;filter:drop-shadow(0 0 8px #ffd87066);}
.summary-potion .summary-icon{color:#d69dff;}
.summary-sword .summary-icon{color:#ddeafa;}
.death-summary-items>span{animation-duration:.7s;}
.phase-summary{position:fixed;z-index:10;top:max(65px,env(safe-area-inset-top));animation:phase-summary-in .55s cubic-bezier(.16,1,.3,1) both;transition:opacity .45s,translate .45s;}
.summary-leaving{opacity:0;translate:0 -12px;}
@keyframes phase-summary-in{from{opacity:0;translate:0 -16px}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){.phase-summary{animation:none;transition:none}}
/* Compact floating rewards: no panel, cards or heading over the game. */
.death-summary,.phase-summary{width:auto;max-width:88vw;max-height:18dvh;padding:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:visible;pointer-events:none;font-size:12px;}
.death-summary>strong{display:none;}
.death-summary-items{gap:10px 20px;align-items:center;}
.death-summary-items .summary-reward{border:0;background:none;border-radius:0;padding:0;gap:6px;max-width:180px;font:12px/1.5 var(--pixel);text-shadow:0 2px 4px #000,0 0 8px #000;}
.summary-icon{width:25px;height:25px;}
.summary-reward>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.summary-spark{display:none!important;}
.death-summary-items>span{animation-duration:.8s;}
@media(max-width:600px){.death-summary-items{gap:8px 14px}.death-summary-items .summary-reward{font-size:10px;max-width:120px}.summary-icon{width:22px;height:22px}}
.sword-hint{color:#ffe4a3!important;font:clamp(10px,1.5vw,15px)/1.8 var(--pixel)!important;max-width:80vw;text-align:center;animation:hint-in .8s ease both;}
@keyframes hint-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
