/* Sân 16:9 dùng cùng tỉ lệ với tọa độ va chạm 800 × 450. */
body.battle-mode #battle-card{
  inset:0;transform:none;width:100%;height:100dvh;max-width:none;
  padding:env(safe-area-inset-top) max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left));
  gap:0;align-items:center;justify-content:center;overflow:hidden;background:#081b1b!important;box-shadow:none!important;
}
body.battle-mode #battle-card .battle-title{
  flex:0 0 46px;width:100%;max-width:1600px;min-height:46px;
  display:flex;gap:8px;align-items:center;margin:0;padding:3px 0;border-bottom:1px solid #37554b;
}
body.battle-mode #battle-exit{align-self:center;min-width:72px;min-height:40px}
body.battle-mode #battle-beast-name{flex:1;min-width:0;color:#ffe9bc!important;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
body.battle-mode #battle-beast-element{color:#b8d3bd;font-size:10px}
body.battle-mode #battle-card .battle-sound,body.battle-mode #battle-fullscreen{position:static;flex:none;min-height:40px;padding:5px 9px;border:1px solid #7b8d76;border-radius:6px;background:#173b36;color:#f4e3b8;font-size:11px}
body.battle-mode #battle-card .battle-scene,
body[data-online=true].battle-mode #battle-card .battle-scene{
  flex:0 0 auto;align-self:center;position:relative;
  width:min(100%,1600px,calc((100dvh - 46px - env(safe-area-inset-top) - env(safe-area-inset-bottom))*16/9));
  height:auto;min-height:0;aspect-ratio:16/9;margin:auto 0;border:0;border-radius:0;box-shadow:none;container-type:inline-size;
}
body.battle-mode #battle-card>.enemy-rage-stats,
body.battle-mode #battle-card>:is(.beast-status-row,.battle-combo,.enemy-intent,.enemy-state,.active-build-status,.relation-result,.battle-technique,.secret-status,.advanced-status,.kim-status,.water-status,.wood-status,.fire-status,.earth-status,.battle-log){display:none}
body.battle-mode #battle-card .arena-hint{top:6px;left:28%;right:auto;width:44%;min-height:0;padding:4px 7px;pointer-events:none}
body.battle-mode #battle-card .arena-hint strong{font-size:11px}
body.battle-mode #battle-card #arena-hint-copy{font-size:9px}
body.battle-mode #battle-card .encounter-progress{position:absolute;z-index:10;top:6px;right:8px;width:25%;margin:0;gap:3px;align-items:flex-end;flex-direction:column;color:#fff4d0;text-shadow:0 1px 3px #000}
body.battle-mode #battle-card .encounter-progress strong{font-size:10px}
body.battle-mode #battle-card .encounter-progress button{min-height:40px;font-size:10px;padding:3px 6px}
body.battle-mode #battle-card .battle-item-bar{position:absolute;z-index:12;left:42%;bottom:12px;transform:translateX(-50%);width:250px;max-width:40%;margin:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
body.battle-mode #battle-card .battle-potion{position:relative;min-height:44px;padding:2px;border-radius:6px;font-size:9px;justify-content:center;gap:2px;overflow:hidden}
body.battle-mode #battle-card .battle-potion kbd{position:absolute;left:2px;top:1px;font-size:8px}
body.battle-mode #battle-card .battle-potion img{width:19px;height:19px}
body.battle-mode #battle-card .battle-potion span{line-height:1.05;font-size:9px}
body.battle-mode #battle-card .fate-battle-status{position:absolute;z-index:10;left:10px;top:7px;max-width:25%;margin:0;padding:2px;font-size:9px}
body.battle-mode #battle-card .arena-joystick{width:90px;height:90px;left:14px;bottom:14px}
body.battle-mode #battle-card .combat-help{left:14px;bottom:114px;width:58px;height:40px;min-height:40px}
body.battle-mode #battle-card .battle-actions{width:180px;height:130px;right:12px;bottom:12px;transform:none;z-index:12}
body.battle-mode #battle-card .battle-actions button{width:54px;height:54px;padding:3px;gap:2px}
body.battle-mode #battle-card #attack-beast{right:0;bottom:0;width:66px;height:66px}
body.battle-mode #battle-card #guard-beast{right:72px;bottom:0}
body.battle-mode #battle-card #cast-movement{right:132px;bottom:0}
body.battle-mode #battle-card #cast-secret{right:66px;bottom:62px}
body.battle-mode #battle-card #cast-ultimate{right:6px;bottom:74px}
body.battle-mode #battle-card .battle-actions .skill-name{font-size:9px;text-shadow:none}
body.battle-mode #battle-card .battle-actions .skill-status{font-size:8px;color:inherit}
body.battle-mode #battle-card .fighter.hero,body[data-online=true].battle-mode #battle-card .fighter.hero{width:11%;height:28%}
body.battle-mode #battle-card .fighter.beast,body[data-online=true].battle-mode #battle-card .fighter.beast,
body.battle-mode #battle-card .fighter.beast.wave-beast,body[data-online=true].battle-mode #battle-card .fighter.beast.wave-beast{width:12%;height:26%}
body.battle-mode #battle-card .fighter.hero img,body.battle-mode #battle-card .fighter.beast img,
body.battle-mode #battle-card .fighter.beast.wave-beast img{width:100%;height:100%;object-fit:contain}
body.battle-mode #battle-card .arena-vitals{top:max(48px,calc(var(--actor-y,50%) - 12%));width:108px;min-width:0}
body.battle-mode #battle-card.finished{display:flex;gap:0}
body.battle-mode #battle-card.finished::after{content:'';position:absolute;inset:0;z-index:550;background:#061b286b;pointer-events:none}
body.battle-mode #battle-card.finished .hunt-result{position:absolute;z-index:600;left:50%;top:50%;transform:translate(-50%,-50%);width:min(460px,calc(100% - 32px));max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain;margin:0;padding:18px;border-width:2px;box-shadow:0 12px 50px #071c28a3;text-align:center}
body.battle-mode #battle-card.finished .hunt-result strong{font-size:21px}
body.battle-mode #battle-card.finished .hunt-result p{font-size:13px;line-height:1.5}
body.battle-mode #battle-card.finished .hunt-result-actions button{min-height:44px;font-size:12px;padding:9px}
body.battle-mode #battle-card.finished :is(.battle-item-bar,.encounter-progress,.fate-battle-status){display:none}
.battle-rotate-dialog{width:min(420px,calc(100vw - 28px));max-height:calc(100dvh - 28px);padding:22px;border:1px solid #bfa76e;border-radius:14px;background:#fff8e5;color:#3e513f;text-align:center;font:14px/1.5 "Segoe UI",sans-serif}
.battle-rotate-dialog::backdrop{background:#061b20e8}
.battle-rotate-dialog h2{font-size:21px;margin:8px 0}
.battle-rotate-dialog button{width:100%;min-height:44px;margin-top:8px;padding:8px;border:1px solid #738775;border-radius:7px;background:#285e4d;color:#fff9e5}
.battle-rotate-dialog button:disabled{opacity:.5}
.battle-rotate-dialog button:last-child{background:#f5edda;color:#3e513f}
.rotate-phone{font-size:36px;color:#6b815f}
#combat-rotate-note{padding:12px;background:#fff0bf;border:1px solid #af8742;border-radius:7px;font-weight:700}
#combat-rotate-exit{width:100%;min-height:44px;margin-top:8px;border:1px solid #8f7951;border-radius:7px;background:#f7edd5;color:#59462b}
@container(max-width:680px){
  body.battle-mode #battle-card .battle-item-bar{grid-template-columns:repeat(3,minmax(0,1fr));width:142px;left:40%;bottom:10px;gap:3px}
  body.battle-mode #battle-card .battle-potion{min-height:40px}
  body.battle-mode #battle-card .arena-joystick{width:78px;height:78px;left:8px;bottom:10px}
  body.battle-mode #battle-card .combat-help{left:8px;bottom:98px;width:48px}
  body.battle-mode #battle-card .battle-actions{right:6px;bottom:10px;width:158px;height:118px}
  body.battle-mode #battle-card .battle-actions button{width:48px;height:48px}
  body.battle-mode #battle-card #attack-beast{width:58px;height:58px;right:0;bottom:0}
  body.battle-mode #battle-card #guard-beast{right:64px;bottom:0}
  body.battle-mode #battle-card #cast-movement{right:118px;bottom:0}
  body.battle-mode #battle-card #cast-secret{right:56px;bottom:56px}
  body.battle-mode #battle-card #cast-ultimate{right:2px;bottom:66px}
  body.battle-mode #battle-card .arena-vitals{width:96px;left:clamp(49px,var(--actor-x,50%),calc(100% - 49px))}
}
@media(max-width:700px){body.battle-mode #battle-beast-element{display:none}body.battle-mode #battle-fullscreen span{display:none}body.battle-mode #battle-card .battle-title{gap:5px}}
@media(max-height:400px){body.battle-mode #battle-card.finished .hunt-result{padding:12px}body.battle-mode #battle-card.finished .hunt-result strong{font-size:18px}}
#hunt-result-loot[hidden],#hunt-result-copy:empty{display:none}
#hunt-result-loot{margin:10px 0 12px;text-align:left}
#hunt-loot-title{margin:0 0 6px;color:#415344;font-size:13px;font-weight:750}
#hunt-loot-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0;padding:0;list-style:none}
#hunt-loot-list li{display:grid;grid-template-columns:34px minmax(0,1fr) auto;align-items:center;gap:7px;padding:7px 8px;border:1px solid #bcab82;border-radius:7px;background:#fff8e8;color:#302d21}
#hunt-loot-list img{display:block;box-sizing:border-box;width:34px;height:34px;padding:2px;object-fit:contain;background:#ede2c6;border-radius:6px}
#hunt-loot-list small,#hunt-loot-list b{display:block;line-height:1.25}
#hunt-loot-list small{color:#615638;font-size:10px}
#hunt-loot-list b{font-size:13px;overflow-wrap:anywhere}
#hunt-loot-list em{font-size:16px;font-weight:800;font-style:normal;color:#185949;font-variant-numeric:tabular-nums}
@media(max-width:420px){#hunt-loot-list li{gap:4px;grid-template-columns:24px minmax(0,1fr) auto;padding:5px}#hunt-loot-list img{width:24px;height:24px}}
@media(max-height:370px){#hunt-result-loot{margin:5px 0 7px}#hunt-loot-list li{padding-block:4px}}

body.battle-mode #battle-card .battle-potion small{position:absolute;right:1px;top:1px;padding:0 2px;border-radius:3px;background:#263d35;color:#fff7d9;font:700 9px/1.2 sans-serif}
body.battle-mode #battle-card .battle-potion small:empty{display:none}
body.battle-mode #battle-card .battle-potion:has(small:not(:empty)):disabled{opacity:1;color:#37443a}
