/* A compact treasure popup leaves the battlefield interactive outside its bounds. */
.chestLootOverlay { position: fixed; inset: 0; z-index: 91; display: flex; justify-content: center; align-items: center; padding: 14px; pointer-events: none; }
.chestLootOverlay[hidden] { display: none; }
.chestLootPanel { --loot-color: #f0c040; position: relative; display: flex; flex-direction: column; width: min(510px, 100%); min-height: 0; max-height: calc(100dvh - 28px); overflow: hidden; padding: 22px 24px 16px; pointer-events: auto; border: 1px solid #ac8143; border-radius: 12px; background: radial-gradient(ellipse at 50% 5%, #463128 0, #241b2b 45%, #18131e 100%); color: var(--text, #e8dcc0); box-shadow: 0 24px 85px #000b, 0 0 0 4px #161019dd, inset 0 0 0 4px #5d442b55; animation: chestLootAppear .2s ease-out; }
.chestLootPanel::before { content: ""; position: absolute; pointer-events: none; top: 0; left: 22%; right: 22%; height: 2px; background: linear-gradient(90deg, transparent, #ffe4a0, transparent); }
.chestLootClose { position: absolute; z-index: 3; right: 8px; top: 8px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #947344; background: #211724; color: var(--text); }
.chestLootClose .gi { width: 13px; height: 13px; opacity: .8; }
.chestLootClose:hover { background: #503127; }
.chestLootPanel button:focus-visible, .chestLootPanel summary:focus-visible { outline: 2px solid #ffe3a2; outline-offset: 4px; }
.chestLootHead { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 13px; min-height: 44px; margin: 0 34px 16px 0; }
.chestLootBody { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #917043 #211824; }
.chestLootSigil { width: 46px; height: 46px; display: grid; place-items: center; transform: rotate(-8deg); background: #a57b2520; border: 1px solid #bd8e424d; border-radius: 10px; }
.chestLootSigil .gi { width: 30px; height: 30px; }
.chestLootSubtitle, .chestLootEyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 2.1px; font-weight: 700; color: #b29a76; }
.chestLootHead h2 { font-size: clamp(22px, 4.2vw, 29px); line-height: 1.2; color: #f9d891; margin-top: 3px; }
.chestLootProgress { text-align: center; color: #c5b699; font-size: 11px; margin: 0 0 11px; }
.chestLootProgress[hidden] { display: none; }
.chestLootReel { position: relative; overflow: hidden; height: 143px; border-block: 1px solid #91703d80; background: #0d0a12; isolation: isolate; }
.chestLootReel::after { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; background: linear-gradient(90deg, #0f0b13 0%, transparent 19%, transparent 81%, #0f0b13 100%); box-shadow: inset 0 8px 12px #0007, inset 0 -8px 12px #0007; }
.chestLootTrack { display: flex; width: max-content; gap: 10px; padding-top: 13px; will-change: transform; }
.chestLootCard { position: relative; width: 104px; height: 116px; flex: 0 0 104px; text-align: center; padding: 6px 5px 7px; background: linear-gradient(150deg, #39313c, #201a28); border: 1px solid var(--loot-color); border-radius: 6px; overflow: hidden; box-shadow: inset 0 -3px 0 var(--loot-color); }
.chestLootCardArt { display: flex; align-items: center; justify-content: center; height: 56px; }
.chestLootCardArt canvas { image-rendering: pixelated; max-width: 56px; max-height: 52px; object-fit: contain; filter: drop-shadow(0 3px 3px #0009); }
.chestLootCardArt .skillArt { width: 52px; height: 52px; flex: 0 0 52px; border-color: var(--loot-color); }
.chestLootCardName { display: block; font-size: 10px; line-height: 1.18; min-height: 25px; margin: 3px 0 2px; color: #f2e9d7; }
.chestLootCardRarity { font-size: 9px; color: var(--loot-color); }
.chestLootMarker { position: absolute; z-index: 3; left: calc(50% - 56px); top: 4px; bottom: 4px; width: 112px; border: 1px solid #eec66a; border-radius: 8px; box-shadow: 0 0 14px #f0c04030; pointer-events: none; }
.chestLootMarker::before, .chestLootMarker::after { content: ""; position: absolute; left: calc(50% - 6px); width: 0; height: 0; border-inline: 6px solid transparent; }
.chestLootMarker::before { top: -4px; border-top: 7px solid #ffe6a0; }
.chestLootMarker::after { bottom: -4px; border-bottom: 7px solid #ffe6a0; }
.chestLootCard.isWinner { background: radial-gradient(ellipse at top, #71532860, transparent), #302431; box-shadow: inset 0 -3px 0 var(--loot-color), 0 0 14px color-mix(in srgb, var(--loot-color) 35%, transparent); }
.chestLootResult { min-height: 143px; padding: 16px 8px 12px; text-align: center; }
.chestLootResultName { font-size: 22px; margin: 4px 0; color: var(--loot-color); letter-spacing: .4px; }
.chestLootResultMeta { font-size: 11px; color: var(--loot-color); }
.chestLootResultDesc { color: #d2c6b3; line-height: 1.45; font-size: 12px; margin: 8px auto 0; max-width: 385px; }
.chestLootBag { display: inline-block; margin-top: 10px; color: #abdb9d; font-size: 11px; font-weight: 600; }
.chestLootBag::before { content: "✓"; margin-right: 5px; }
.chestLootBag[hidden] { display: none; }
.isSpinning .chestLootResult { display: flex; flex-direction: column; justify-content: center; }
.isSpinning .chestLootResultName, .isSpinning .chestLootResultMeta, .isSpinning .chestLootResultDesc { display: none; }
.isRevealed .chestLootResult { animation: chestLootAppear .25s ease-out; }
.chestLootOdds { border-top: 1px solid #b1936330; margin-top: 2px; font-size: 11px; }
.chestLootOdds summary { padding: 10px 0; color: #c6b394; cursor: pointer; }
.chestLootOddsList { padding-right: 4px; }
.chestLootOddsRow { display: grid; grid-template-columns: minmax(0, 1fr) auto 46px; align-items: center; column-gap: 8px; padding: 5px 0; border-top: 1px solid #fff1; }
.chestLootOddsName { color: var(--loot-color); }
.chestLootOddsRarity { font-size: 9px; color: var(--loot-color); opacity: .85; }
.chestLootOddsChance { text-align: right; color: #e4d3b4; font-variant-numeric: tabular-nums; font-size: 10px; }
.chestLootOddsNote { font-size: 10px; color: #b4a58f; padding: 8px 0; line-height: 1.4; }
.chestLootFooter { position: relative; z-index: 2; display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0 max(0px, env(safe-area-inset-bottom)); border-top: 1px solid #b1936366; background: #201725; box-shadow: 0 -8px 16px #18131e66; }
.chestLootCombatNote { color: #c4ac8b; font-size: 10px; }
.chestLootCombatNote::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #cfad6e; vertical-align: 1px; margin-right: 6px; }
.chestLootFooter .btn { flex: 0 0 auto; font-size: 13px; min-width: 136px; min-height: 44px; padding: 5px 8px; }
.chestLootLive { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes chestLootAppear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 540px) {
  .chestLootOverlay { align-items: flex-start; padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)); }
  .chestLootPanel { padding: 18px 13px 13px; max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); }
  .chestLootHead { gap: 10px; margin-bottom: 13px; }
  .chestLootResult { padding-inline: 2px; }
  .chestLootResultName { font-size: 20px; }
  .chestLootFooter { gap: 6px; }
  .chestLootFooter .btn { min-width: 124px; font-size: 12px; }
  .chestLootOddsRow { column-gap: 5px; }
}
@media (max-height: 620px) and (min-width: 541px) {
  .chestLootPanel { padding-top: 15px; }
  .chestLootHead { margin-bottom: 10px; }
  .chestLootResult { min-height: 108px; padding-block: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .chestLootPanel, .isRevealed .chestLootResult { animation: none; }
  .chestLootTrack { transition: none !important; }
}
