/* B4 chest overlay: no normal-flow allocation. Texture bytes match the approved manifest. */
.bonus-chest-overlay[hidden]{display:none!important}
.bonus-chest-overlay{position:fixed;inset:0;z-index:500;background:radial-gradient(ellipse at 50% 48%,#243746f7,#08101bee 75%);display:flex;align-items:center;justify-content:center;color:#f7eedc;pointer-events:auto}
.bonus-chest-overlay[data-scope=tv2]{pointer-events:none}
.bonus-chest-celebration{text-align:center;max-width:740px;width:100%;padding:20px;box-sizing:border-box}
.bonus-chest-recipient{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:10px;color:#dfc58f;font-size:14px;letter-spacing:2px;overflow-wrap:anywhere}
.bonus-chest-recipient img{width:35px;height:35px;object-fit:cover;border-radius:50%}
.bonus-chest-avatar{width:35px;height:35px;display:grid;place-items:center;border:1px solid #c7ac76;border-radius:50%;background:#243549;color:#fff0c9;font:700 22px Georgia,serif}
.bonus-chest-art{position:relative;display:block;width:300px;height:300px;margin:8px auto 0;isolation:isolate}
.bonus-chest-overlay[data-scope=tv2] .bonus-chest-art{width:340px;height:340px}
.bonus-chest-art .bronze-sprite{position:absolute;inset:0;width:100%;height:100%;background-image:url('/shared/bonus-chest-b4.webp');background-size:200% 100%;background-repeat:no-repeat}
.bonus-chest-art .aura{position:absolute;width:70%;height:70%;left:15%;top:20%;border-radius:50%;background:#e4a84940;filter:blur(35px);opacity:0}
.bonus-chest-art .reward{position:absolute;left:50%;transform:translate(-50%,5%) scale(.15);font:bold 75px Georgia,serif;color:#fff0bb;text-shadow:0 2px 3px #392913,0 0 20px #ffdf85,0 0 45px #d49b35;opacity:0}
.bonus-chest-art .sparks{position:absolute;inset:0;overflow:visible;pointer-events:none}
.bonus-chest-art .spark{position:absolute;left:50%;top:48%;height:5px;width:5px;background:#fff0bc;border-radius:50%;opacity:0;box-shadow:0 0 8px #ffd173}
.bonus-chest-celebration h2{font:700 34px/1.12 Georgia,serif;margin:0 0 13px;color:#fff0d3;overflow-wrap:anywhere}
.bonus-chest-celebration .why{color:#e2cc9e;font:16px/1.4 system-ui,sans-serif;margin:0;overflow-wrap:anywhere}
.bonus-chest-overlay[data-scope=tv2] h2{font-size:54px}
.bonus-chest-overlay[data-scope=tv2] .why{font-size:24px}
.bonus-chest-overlay[data-scope=tv2] .bonus-chest-recipient{font-size:24px}
@keyframes spark{0%{opacity:1;transform:translate(0,0)}100%{opacity:0;transform:translate(var(--x),var(--y)) scale(.2)}}
.bonus-chest-live{position:fixed;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.black-bonus-anchor{position:relative}
.black-bonus-mark{position:absolute;z-index:5;top:-6px;right:-4px;width:22px;height:22px;display:grid;place-items:center;border:1px solid #dfc07b;border-radius:50%;background:#07111b;color:#ffe1a2;font:bold 19px/1 Georgia,serif;pointer-events:none;box-sizing:border-box}
#players .black-bonus-mark{width:28px;height:28px;font-size:24px;top:-6px;right:50%;transform:translateX(50%)}
.turn-card>.black-bonus-mark{left:8px;right:auto;top:-9px}
.bonus-chest-overlay.image-failed .bronze-sprite{display:none}
.bonus-chest-overlay.image-failed .reward{opacity:1;transform:translate(-50%,-110%) scale(1)}
@media(max-height:700px){.bonus-chest-overlay .bonus-chest-art{width:230px;height:230px}.bonus-chest-art .reward{font-size:65px}.bonus-chest-celebration{padding:12px 20px}}
@media(max-width:360px){.bonus-chest-overlay .bonus-chest-art{width:220px;height:220px}.bonus-chest-celebration h2{font-size:30px}}
@media(prefers-reduced-motion:reduce){.bonus-chest-art *{animation:none!important;transition:none!important}}
/* B4: separately moving lid layers, fixed body and cavity; exact B2 texture. */
.bonus-chest-art .chest-rig{position:absolute;inset:0;perspective:650px;transform-origin:50% 82%;isolation:isolate}
.bonus-chest-art .bronze-sprite{transition:none;filter:none;backface-visibility:visible;will-change:transform,opacity}
.bonus-chest-art .chest-base{background-position:0 50%;clip-path:inset(55% 0 0);z-index:4}
.bonus-chest-art .chest-cavity{background-position:100% 50%;clip-path:inset(44% 0 44%);z-index:2;opacity:0}
.bonus-chest-art .lid-shut{background-position:0 50%;clip-path:inset(0 0 45%);transform-origin:50% 54%;z-index:6}
.bonus-chest-art .lid-raised{background-position:100% 50%;clip-path:inset(0 0 56%);transform-origin:50% 44%;z-index:1;opacity:0;transform:translateY(11%) rotateX(64deg)}
.bonus-chest-art .chest-seam{position:absolute;left:14%;right:13%;top:54.6%;height:2px;background:#fff2c1;box-shadow:0 0 7px 2px #ffc85e;z-index:5;opacity:0}
.bonus-chest-art .chest-beam{position:absolute;left:15%;top:6%;width:70%;height:49%;background:linear-gradient(0deg,#fff0b6db 0%,#f5bd5266 35%,#e8b84900 100%);clip-path:polygon(0 0,100% 0,78% 100%,22% 100%);transform-origin:50% 100%;opacity:0;z-index:3;filter:blur(4px)}
.bonus-chest-overlay:not([hidden]) .bonus-chest-art .chest-rig{animation:chestAnticipate .44s .2s both}
.bonus-chest-overlay.opening .bonus-chest-art .lid-shut{animation:lidSwingOut 1s cubic-bezier(.2,.65,.3,1) both}
.bonus-chest-overlay.opening .bonus-chest-art .lid-raised{animation:lidSwingIn 1s cubic-bezier(.2,.65,.3,1) both}
.bonus-chest-overlay.opening .bonus-chest-art .chest-cavity{animation:cavityLight .85s both}
.bonus-chest-overlay.opening .bonus-chest-art .chest-seam{animation:seamLight 1.3s both}
.bonus-chest-overlay.opening .bonus-chest-art .chest-beam{animation:chestBeam 1.25s ease-out both}
.bonus-chest-overlay.opening .bonus-chest-art .aura{animation:chestAura 1.3s ease-out both}
.bonus-chest-overlay.reveal .bonus-chest-art .reward{animation:chestReward 1s cubic-bezier(.15,.65,.22,1) both}
.bonus-chest-overlay.reveal .bonus-chest-art .spark{animation:spark 1.1s calc(.15s + var(--delay)) ease-out both}
.bonus-chest-art .reward{z-index:8;top:51%;font-size:75px}
@keyframes chestAnticipate{0%,100%{transform:translateX(0) rotate(0)}20%{transform:translateX(-3px) rotate(-1.7deg)}43%{transform:translateX(3px) rotate(1.5deg)}66%{transform:translateX(-2px) rotate(-1deg)}85%{transform:translateX(1px) rotate(.5deg)}}
@keyframes lidSwingOut{0%{transform:translateY(0) rotateX(0);opacity:1}22%{transform:translateY(-2%) rotateX(10deg);opacity:1}48%{transform:translateY(-9%) rotateX(29deg);opacity:.85}75%{transform:translateY(-17%) rotateX(48deg);opacity:0}100%{transform:translateY(-18%) rotateX(52deg);opacity:0}}
@keyframes lidSwingIn{0%{transform:translateY(11%) rotateX(64deg);opacity:0}23%{transform:translateY(7%) rotateX(48deg);opacity:0}48%{transform:translateY(2%) rotateX(24deg);opacity:.5}80%{transform:translateY(-.8%) rotateX(-3deg);opacity:1}100%{transform:translateY(0) rotateX(0);opacity:1}}
@keyframes cavityLight{0%{opacity:0}20%{opacity:.3}65%,100%{opacity:1}}
@keyframes seamLight{0%{opacity:0;transform:scaleX(.2)}20%{opacity:1;transform:scaleX(1)}65%{opacity:.75}100%{opacity:.3}}
@keyframes chestBeam{0%{opacity:0;transform:scaleY(.03) scaleX(.4)}28%{opacity:.4;transform:scaleY(.35) scaleX(.75)}80%{opacity:.85;transform:scaleY(1.1) scaleX(1)}100%{opacity:.5;transform:scaleY(1) scaleX(1)}}
@keyframes chestAura{0%{opacity:0;transform:scale(.3)}50%{opacity:.4;transform:scale(.7)}85%{opacity:.9;transform:scale(1.1)}100%{opacity:.65;transform:scale(1)}}
@keyframes chestReward{0%{opacity:0;transform:translate(-50%,5%) scale(.15)}18%{opacity:1}75%{opacity:1;transform:translate(-50%,-117%) scale(1.08)}100%{opacity:1;transform:translate(-50%,-110%) scale(1)}}
@media(prefers-reduced-motion:reduce){.bonus-chest-overlay:not([hidden]) .bonus-chest-art .chest-rig{animation:none!important}.bonus-chest-overlay.opening .bonus-chest-art .lid-shut{animation:none!important;opacity:0}.bonus-chest-overlay.opening .bonus-chest-art .lid-raised{animation:none!important;opacity:1;transform:none}.bonus-chest-overlay.opening .bonus-chest-art .chest-cavity,.bonus-chest-overlay.opening .bonus-chest-art .chest-beam,.bonus-chest-overlay.opening .bonus-chest-art .aura{animation:none!important;opacity:.6}.bonus-chest-overlay.reveal .bonus-chest-art .reward{animation:none!important;opacity:1;transform:translate(-50%,-110%)}.bonus-chest-art .spark{display:none}}
