/* Presentation density only. Existing animation layers, timing and transactions stay intact. */
#overlay[data-game-presentation]:has(.compact-chest,.upgrade-view){padding:10px;overflow:hidden}
#overlay[data-game-presentation]>.panel:has(.compact-chest,.upgrade-view){padding:10px;max-height:calc(100dvh - 20px);min-height:0}
.compact-chest{max-height:calc(100dvh - 42px);width:100%;display:flex;flex-direction:column;gap:5px}
.compact-chest .treasure-stage{width:100%;flex:none;height:clamp(130px,calc(100dvh - 190px),350px);margin:8px auto}
.compact-chest .eyebrow{font-size:9px;margin:0 0 3px}
.compact-chest h2{font-size:24px!important;line-height:1.2;margin:3px 0!important}
.compact-chest .chest-subtitle{font-size:12px;line-height:1.3;margin:0!important}
.compact-chest[data-revealed=true] .eyebrow{display:none}
.compact-chest[data-revealed=true] .treasure-stage{height:clamp(72px,20dvh,160px);flex:none;margin:5px auto;width:100%}
.compact-chest[data-revealed=true] .treasure-fans{bottom:38px;height:64px}
.compact-chest[data-revealed=true] .treasure-stage .reel-prize span{font-size:23px}
.compact-chest[data-revealed=true] .treasure-stage .reel-prize small{font-size:9px}
.compact-chest[data-revealed=true] .treasure-stage .chest-art{bottom:18px;transform:scale(.45)!important}
.compact-chest[data-revealed=true] .treasure-counter{bottom:4px;font-size:13px}
.compact-chest #chest-result:not([hidden]){display:flex;flex-direction:column;gap:5px;min-height:0}
.compact-chest .chest-totals{margin:2px 0;gap:10px;font-size:12px;line-height:1.3;align-items:center}
.compact-chest .chest-totals small{font-size:10px;color:#9cac9c}
.compact-chest .chest-rewards{display:grid;grid-template-columns:1fr;gap:4px;margin:0}
.compact-chest .chest-reward{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:4px 8px;align-items:center;min-height:42px;padding:5px 9px;text-align:left}
.compact-chest .chest-reward .reward-icon{font-size:25px;display:block;line-height:1}
.compact-chest .chest-reward strong{font-size:14px;line-height:1.25;margin:0;overflow-wrap:anywhere}
.compact-chest .chest-change{font-size:11px;white-space:nowrap;color:#d6c69c}
.compact-chest .chest-evolution-effect{grid-column:2/-1;font-size:11px;line-height:1.3}
.compact-chest .chest-help{display:none}
.compact-chest #chest-continue{width:100%;min-height:46px;padding:8px;margin:2px 0 0;flex:none;font-size:16px}
.compact-chest #chest-reward-pages:not([hidden]){display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:11px}
.compact-chest #chest-reward-pages button{min-height:44px;padding:6px 12px;font-size:12px}
/* Keep the same awakening/card/icon keyframes while reducing their occupied layout space. */
#overlay[data-game-presentation] .upgrade-view{position:relative;max-height:calc(100dvh - 42px)}
#overlay[data-game-presentation] .upgrade-view .level-burst{position:absolute;top:-12px;left:calc(50% - 12px);font-size:24px;line-height:1;margin:0;pointer-events:none}
#overlay[data-game-presentation] .upgrade-view .eyebrow{font-size:9px;margin:6px 0 3px}
#overlay[data-game-presentation] .upgrade-view h2{font-size:22px;margin:3px 0;line-height:1.25}
#overlay[data-game-presentation] .upgrade-view>p{font-size:11px;line-height:1.4;margin:5px 0}
#overlay[data-game-presentation] .upgrade-view .choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:8px 0}
#overlay[data-game-presentation] .upgrade-view .choice{padding:10px;min-height:0;min-width:0;text-align:left}
#overlay[data-game-presentation] .upgrade-view .choice .icon{font-size:28px;line-height:1;margin:0 0 6px;display:block}
#overlay[data-game-presentation] .upgrade-view .choice small{font-size:10px;line-height:1.3;display:block}
#overlay[data-game-presentation] .upgrade-view .choice strong{font-size:15px;line-height:1.3;margin:2px 0;display:block}
#overlay[data-game-presentation] .upgrade-view .choice p{font-size:12px;line-height:1.45;margin:3px 0;overflow-wrap:anywhere}
#overlay[data-game-presentation] .upgrade-view .upgrade-tools{display:flex;gap:6px;flex-wrap:nowrap;justify-content:center;margin:5px 0}
#overlay[data-game-presentation] .upgrade-view .upgrade-tools button{min-width:0;flex:1;min-height:44px;padding:6px;font-size:12px}
#overlay[data-game-presentation] .upgrade-view .upgrade-help{font-size:10px;color:#97a69b}
@media(max-width:600px){
 #overlay[data-game-presentation] .upgrade-view .choices{grid-template-columns:1fr;gap:6px}
 #overlay[data-game-presentation] .upgrade-view .choice{display:grid;grid-template-columns:35px minmax(0,1fr);gap:1px 8px;padding:8px 10px}
 #overlay[data-game-presentation] .upgrade-view .choice .icon{grid-column:1;grid-row:1/4;margin:0;align-self:center;font-size:29px}
 #overlay[data-game-presentation] .upgrade-view .choice small,#overlay[data-game-presentation] .upgrade-view .choice strong,#overlay[data-game-presentation] .upgrade-view .choice p{grid-column:2}
}
@media(orientation:landscape) and (max-height:520px){
 .compact-chest[data-revealed=true]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:4px 12px;align-items:center}
 .compact-chest[data-revealed=true] h2{grid-column:1/-1;font-size:20px!important}
 .compact-chest[data-revealed=true] .chest-subtitle{display:none}
 .compact-chest[data-revealed=true] .treasure-stage{grid-column:1;grid-row:2;height:min(50dvh,190px);margin:0}
 .compact-chest[data-revealed=true] #chest-result{grid-column:2;grid-row:2}
 .compact-chest .chest-reward{min-height:36px;padding:4px 7px}
 .compact-chest .chest-reward strong{font-size:12px}
 .compact-chest #chest-continue{min-height:44px;font-size:14px}
 #overlay[data-game-presentation] .upgrade-view .level-burst{font-size:20px;top:-8px}
 #overlay[data-game-presentation] .upgrade-view h2{font-size:20px;margin:0}
 #overlay[data-game-presentation] .upgrade-view .choices{grid-template-columns:repeat(3,minmax(0,1fr));margin:5px 0}
 #overlay[data-game-presentation] .upgrade-view .choice{display:block;padding:7px;min-height:0}
 #overlay[data-game-presentation] .upgrade-view .choice .icon{font-size:22px;margin-bottom:4px}
 #overlay[data-game-presentation] .upgrade-view .choice p{font-size:11px;line-height:1.3}
 #overlay[data-game-presentation] .upgrade-view .eyebrow{margin:0 0 2px}
 #overlay[data-game-presentation] .upgrade-view .upgrade-tools{margin:4px 0}
 #overlay[data-game-presentation] .upgrade-view .upgrade-help{display:none}
}

.compact-chest .chest-evolution-effect{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Settlement: a compact report with fixed actions and lossless detail pages. */
#overlay[data-game-presentation]:has(.compact-result){padding:10px;overflow:hidden}
#overlay[data-game-presentation]>.panel:has(.compact-result){padding:10px;max-height:calc(100dvh - 20px);width:100%;min-height:0}
.run-result.compact-result{height:min(580px,calc(100dvh - 44px));width:100%;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:8px;overflow:hidden}
.compact-result .result-heading{display:block;position:static;padding:0;margin:0;text-align:center;background:none;border:0}
.compact-result .result-heading .eyebrow{font-size:9px;line-height:1.3;margin:0 0 4px}
.compact-result .result-heading h2{font-size:24px;line-height:1.25;margin:0}
.compact-result .result-content{min-height:0;overflow:hidden;overflow-wrap:anywhere}
.compact-result .result-content>p{font-size:12px;line-height:1.45;margin:6px 0;text-align:left}
.compact-result .result-content h3{font-size:13px;line-height:1.4;margin:10px 0 6px}
.compact-result .results{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin:12px 0;text-align:center}
.compact-result .results strong{font-size:25px;line-height:1.25}
.compact-result .results small{font-size:10px}
.compact-result .result-loadout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.compact-result .result-loadout span{padding:8px;font-size:12px;line-height:1.4}
.compact-result .damage-row{font-size:12px;margin:8px 0;gap:4px}
.compact-result .damage-note,.compact-result .reward-breakdown{font-size:11px;line-height:1.45}
.compact-result .result-text-piece{display:block;margin:4px 0;font-size:12px;line-height:1.45}
.compact-result .result-pages,.compact-result .result-actions{display:flex;gap:6px;align-items:center;margin:0;padding:0;position:static;border:0;background:none}
.compact-result .result-pages button{font-size:12px;min-height:44px;padding:6px 9px;white-space:nowrap}
.compact-result .result-page-status{flex:1;text-align:center;font-size:11px;line-height:1.3}
.compact-result .result-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.compact-result .result-actions #again,.compact-result .result-actions #camp,.compact-result .result-actions #retry-save{width:100%;min-height:44px;margin:0;padding:8px 5px;font-size:13px;line-height:1.3}
.compact-result .result-actions #retry-save{grid-column:1/-1}
.compact-result [data-result-hidden]{display:none!important}
body:has(#overlay:not([hidden]) .compact-result) #debug-toggle{bottom:auto;top:max(8px,env(safe-area-inset-top));left:auto;right:max(10px,env(safe-area-inset-right));min-height:32px;padding:5px 8px}
@media(orientation:landscape) and (max-height:520px){
 .compact-result .result-heading h2{font-size:20px}
 .compact-result .result-heading .eyebrow{font-size:8px;margin-bottom:2px}
 .run-result.compact-result{gap:5px}
 .compact-result .results{margin:6px 0}
 .compact-result .results strong{font-size:22px}
 .compact-result .result-content>p{font-size:11px;margin:4px 0;line-height:1.3}
 .compact-result .result-loadout{grid-template-columns:repeat(3,minmax(0,1fr))}
}
