#chest-reveal{position:fixed;box-sizing:border-box;z-index:850;top:20px;left:50%;transform:translateX(-50%);width:min(440px,calc(100vw - 680px));color:#fff;background:linear-gradient(145deg,#193441f5,#101c30f5);border:1px solid #bea064;border-radius:9px;box-shadow:0 5px 18px #0006;overflow:hidden;font:600 12px system-ui;pointer-events:none}
#chest-reveal .cr-head{display:flex;align-items:center;justify-content:space-between;padding:6px 9px;gap:8px}
#chest-reveal button{pointer-events:auto;background:#dfad53;color:#21180c;border:1px solid #efd18f;border-radius:5px;padding:5px 8px;font:700 11px system-ui;white-space:nowrap;cursor:pointer}
#chest-reveal button:focus-visible{outline:2px solid white;outline-offset:-3px}
.cr-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cr-window{position:relative;height:76px;overflow:hidden;background:#0b1624;border-block:1px solid #526270}.cr-reel{display:flex;gap:10px;height:100%;will-change:transform}.cr-card{box-sizing:border-box;flex:0 0 90px;background:linear-gradient(#24374b,#142238);border-bottom:3px solid var(--rarity);padding:4px;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}.cr-card img{width:32px;height:32px;object-fit:contain}.cr-card span{font-size:9px;line-height:1.15;max-height:21px;overflow:hidden}.cr-card small{font-size:8px;color:var(--rarity);text-transform:uppercase}.cr-marker{position:absolute;z-index:2;top:0;bottom:0;left:50%;width:2px;background:#ffe6a0;box-shadow:0 0 6px #ffc35b}.cr-marker:before{content:'';position:absolute;top:0;left:-4px;border:5px solid transparent;border-top-color:#ffe6a0}.cr-result{text-align:center;padding:5px 8px;font-size:10px;color:#ddd7c8}.settled .cr-title{color:#ffe2a1}.settled .cr-window{display:none}.settled .cr-result{padding-top:0}.settled .cr-reel{will-change:auto}
@media(max-width:899px){#chest-reveal{top:132px;left:12px;transform:none;width:233px;max-width:calc(100vw - 154px);border-radius:5px;font-size:10px}#chest-reveal .cr-head{padding:2px 5px;gap:4px;height:17px;box-sizing:border-box}#chest-reveal button{font-size:9px;padding:0 4px;min-height:14px}.cr-window{height:26px}.cr-card{flex-basis:48px;padding:1px;border-bottom-width:2px}.cr-card img{width:21px;height:21px}.cr-card span,.cr-card small{display:none}.cr-result{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%)}#chest-reveal.settled{min-height:22px}#chest-reveal.settled .cr-head{height:20px}}
@media(max-width:899px) and (orientation:landscape){#chest-reveal{top:12px;left:50%;transform:translateX(-50%);width:240px;max-width:max(160px,calc(100vw - 480px))}}
@media(prefers-reduced-motion:reduce){.cr-reel{will-change:auto}}

/* Reward result occupies the center reading lane only after the compact reel ends. */
#chest-reveal .cr-auto{font-size:10px;color:#d6c294;white-space:nowrap}
#chest-reveal.settled{top:clamp(130px,20vh,190px);left:50%;transform:translateX(-50%);width:min(390px,92vw);max-width:92vw;border-color:var(--loot-color,#bea064);border-radius:12px}
#chest-reveal.settled .cr-head{height:auto;padding:10px 13px;font-size:14px}
#chest-reveal.settled .cr-auto{display:none}
.cr-summary{display:grid;grid-template-columns:58px 1fr;gap:12px;padding:0 13px 9px;font-size:12px}
.cr-summary>img{width:58px;height:58px;object-fit:contain;background:#ffffff08;border-radius:8px}
.cr-summary b{font-size:12px}.cr-summary small{display:block;font-size:11px;color:#e0d6c5;margin-top:7px}
.cr-stats .loot-stat{display:flex;justify-content:space-between;gap:10px;margin-top:4px}
.cr-stats .gain{color:#91e5a3}.cr-stats .loss{color:#ff9b97}.cr-stats .equal{color:#c9d2db}
.cr-stats .loot-effects{display:grid;gap:3px;font-size:10px;font-weight:400;color:#bdcbd6;margin-top:7px}
#chest-reveal.settled .cr-result{position:static;width:auto;height:auto;clip-path:none;padding:8px 13px;background:#080f1a77;font-size:12px;color:#f7e3ae}
@media(max-height:500px){#chest-reveal.settled{top:64px}.cr-summary{padding-bottom:3px}.cr-stats .loot-effects{max-height:42px;overflow:auto}}

/* Let the actual winning slot breathe before presenting the full comparison. */
#chest-reveal.landed .cr-title{white-space:normal;overflow:visible;color:#fff0bf}
#chest-reveal.landed{border-color:var(--loot-color);box-shadow:0 0 18px color-mix(in srgb,var(--loot-color) 35%,transparent),0 5px 18px #0006}
#chest-reveal.landed .cr-card:not(.cr-winner){opacity:.35}
#chest-reveal .cr-winner{background:linear-gradient(#3e4855,#202c3e);box-shadow:inset 0 0 0 2px var(--rarity)}
#chest-reveal .cr-winner img{filter:drop-shadow(0 0 5px var(--rarity))}
#chest-reveal.landed .cr-marker{opacity:.3}
#chest-reveal.settled .cr-head{font-size:16px;line-height:1.3}
#chest-reveal.settled .cr-summary{grid-template-columns:66px 1fr}
#chest-reveal.settled .cr-summary>img{width:66px;height:66px}
@media(max-width:899px){#chest-reveal.landed:not(.settled) .cr-head{height:auto;min-height:25px}#chest-reveal.landed:not(.settled) .cr-window{height:76px}#chest-reveal.landed .cr-card span,#chest-reveal.landed .cr-card small{display:block}#chest-reveal.landed .cr-card img{width:30px;height:30px}}

/* Read the reward along the top edge, keeping the character/action lane clear. */
#chest-reveal.settled{top:calc(env(safe-area-inset-top) + 12px);width:min(680px,calc(100vw - 740px));max-width:calc(100vw - 24px);display:grid;grid-template-columns:52px minmax(0,1fr);column-gap:12px;padding:9px 13px;border-radius:9px}
#chest-reveal.settled .cr-head{grid-column:2;padding:0;min-width:0;height:auto;font-size:14px;line-height:1.25}
#chest-reveal.settled .cr-title{white-space:normal;overflow-wrap:anywhere}
#chest-reveal.settled .cr-summary{display:contents}
#chest-reveal.settled .cr-summary>img{grid-column:1;grid-row:1 / 4;align-self:start;width:52px;height:52px}
#chest-reveal.settled .cr-summary>div{grid-column:2;min-width:0;font-size:11px;line-height:1.3}
#chest-reveal.settled .cr-summary b{font-size:11px}
#chest-reveal.settled .cr-stats{display:flex;flex-wrap:wrap;column-gap:18px;row-gap:3px;margin-top:3px}
#chest-reveal.settled .loot-stat{justify-content:flex-start;gap:7px;margin:0;font-size:11px;white-space:nowrap}
#chest-reveal.settled .loot-effects{flex-basis:100%;display:flex;flex-wrap:wrap;gap:2px 14px;margin:0;max-height:none;overflow:visible;font-size:10px;line-height:1.3}
#chest-reveal.settled .loot-effects span{overflow-wrap:anywhere}
#chest-reveal.settled .cr-summary small{margin-top:3px;font-size:10px;line-height:1.3}
#chest-reveal.settled .cr-result{grid-column:2;padding:3px 0 0;text-align:left;background:none;font-size:11px;line-height:1.3}
@media(max-width:899px){
 #chest-reveal.settled{width:min(620px,calc(100vw - 24px));grid-template-columns:40px minmax(0,1fr);column-gap:9px;padding:7px 10px}
 #chest-reveal.settled .cr-summary>img{width:40px;height:40px}
 #chest-reveal.settled .cr-head{font-size:12px}
 #chest-reveal.settled .cr-stats{column-gap:12px}
}
@media(max-width:899px) and (orientation:portrait){
 .adventure-hud #chest-reveal.settled{top:calc(var(--hud-identity-bottom,112px) + 10px)}
}
@media(min-width:1101px){
 body:has(#bosshpwrap.on:not(.officer-team):not(.prison-boss)) #chest-reveal.settled{top:calc(env(safe-area-inset-top) + 100px)}
}
@media(min-width:900px) and (max-width:1100px){
 #chest-reveal.settled{top:calc(env(safe-area-inset-top) + 168px);width:min(620px,calc(100vw - 520px))}
 body:has(#bosshpwrap.on) #chest-reveal.settled{top:calc(env(safe-area-inset-top) + 246px)}
}
@media(max-width:899px) and (orientation:landscape){
 #chest-reveal.settled{width:max(240px,calc(100vw - 480px))}
}

/* Retained rewards teach the bag shortcut without adding another popup. */
#chest-reveal.settled .cr-open-bag{grid-column:1 / -1;display:flex;align-items:center;justify-content:center;gap:8px;margin-top:7px;padding:7px 10px;background:#e8b858;color:#211809;border-color:#ffdda0;font-size:12px}
.cr-open-bag img{width:23px;height:23px;object-fit:contain}.cr-open-bag kbd{font:800 13px system-ui;background:#291d0b;color:#fff0c2;border:1px solid #6e4c1e;border-bottom-width:3px;padding:2px 7px;border-radius:4px}
#chest-reveal.settled .cr-open-bag:hover{background:#ffd37c}

/* One compact action row: equip immediately, or inspect the whole bag. */
#chest-reveal.settled .cr-actions{grid-column:1 / -1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:9px;margin-top:8px}
#chest-reveal.settled .cr-actions:has(>button:only-child){grid-template-columns:1fr}
#chest-reveal.settled .cr-actions button{grid-column:auto;display:flex;align-items:center;justify-content:center;gap:7px;min-height:40px;margin:0;padding:7px 9px;border-radius:8px;white-space:normal;line-height:1.25}
.cr-actions img{width:23px;height:23px;object-fit:contain;flex-shrink:0}
.cr-actions kbd{font:800 13px system-ui;flex-shrink:0;border:1px solid #6c9271;border-bottom-width:3px;padding:2px 7px;border-radius:5px}
#chest-reveal.settled .cr-equip{color:#edfff1;border:1px solid #9de6ab;background:linear-gradient(135deg,#346844,#214a3e);box-shadow:inset 0 1px #c2ffbd30,0 0 12px #83d79b1a;font-size:12px}
.cr-equip kbd{background:#112d20;color:#e6ffd8}
#chest-reveal.settled .cr-equip:hover:not(:disabled){background:linear-gradient(135deg,#438954,#2b6550);border-color:#d2ffbc}
#chest-reveal.settled .cr-equip:disabled{cursor:default;background:#26303b;color:#bec9d5;border-color:#71829170;box-shadow:none}
#chest-reveal.settled .cr-equip:disabled img{opacity:.5}
#chest-reveal.settled.cr-equipped{border-color:#a8e5ad;box-shadow:0 0 16px #86db9a30,0 5px 18px #0006}
#chest-reveal.settled.cr-equipped .cr-equip{color:#d8ffdc;border-color:#9de6ab;background:#244e37}
#chest-reveal.settled.cr-equipped .cr-equip img{opacity:1}
#chest-reveal.settled.cr-equipped .cr-result{color:#b9efbb}
@media(max-width:480px){#chest-reveal.settled .cr-actions{gap:6px}#chest-reveal.settled .cr-actions button{font-size:11px;gap:5px;padding:7px 5px}.cr-actions img{width:19px;height:19px}.cr-actions kbd{padding:2px 5px}}
