.technique-buttons button.ultimate-skill,.skill-loadout button.ultimate-skill{border-color:#d9b46c;background:linear-gradient(125deg,#fff9ed,#fff1d6);color:#8a521f;font-weight:700}
.technique-buttons button.ultimate-skill.selected,.skill-loadout button.ultimate-skill.selected{border-color:#b98033;box-shadow:inset 0 0 0 1px #c6944d;background:#ffedc4}
.ultimate-title{color:#a96828}
.arena-backdrop{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0;border-radius:inherit}
.combat-scene.fx-scene{isolation:isolate;overflow:hidden;border-radius:14px;min-height:200px}
.combat-scene.fx-scene>.fighter,.combat-scene.fx-scene>.vs{position:relative;z-index:1}
.ultimate-banner{position:absolute;left:50%;top:48px;z-index:7;transform:translate(-50%,-5px);max-width:92%;width:max-content;padding:9px 17px;border-radius:6px;border:1px solid #f7d99977;background:linear-gradient(100deg,#171b24eb,#403127ed,#171b24eb);color:#fff1c7;font-size:15px;font-weight:800;letter-spacing:1px;opacity:0;transition:opacity .18s,transform .3s;pointer-events:none;text-align:center;box-shadow:0 5px 23px #0005}
.ultimate-active[data-cast-beat="charge"] .ultimate-banner{opacity:1;transform:translate(-50%,0)}
.ultimate-active[data-element="water"] .ultimate-banner{border-color:#91e9ff99;color:#d9faff;background:linear-gradient(100deg,#112936ed,#244c61ed,#112936ed)}
.ultimate-active[data-element="grass"] .ultimate-banner{border-color:#c1ee8099;color:#eaffc6;background:linear-gradient(100deg,#163122ed,#38582eed,#163122ed)}
.ultimate-impact .preview-fighter,.ultimate-impact .fighter{animation:ultimate-recoil .34s ease-out}
@keyframes ultimate-recoil{0%,100%{translate:0 0}18%{translate:-3px 1px}40%{translate:2px -1px}65%{translate:-1px 0}}
@media(max-width:767px){.ultimate-banner{top:40px;font-size:12px;padding:8px 12px;letter-spacing:.5px}.combat-scene.fx-scene{min-height:180px}}
@media(prefers-reduced-motion:reduce){.ultimate-impact .preview-fighter,.ultimate-impact .fighter{animation:none}.ultimate-banner{transition:opacity .2s}}

/* Live battles occupy the viewport; administrator skill previews keep their own layout. */
.modal.battle-overlay{
 inset:0;padding:0;display:block;overflow:hidden;background:#24351d;backdrop-filter:none;
}
.modal.battle-overlay>.dialog.battle-panel{
 position:relative;width:100%;max-width:none;height:100vh;height:100dvh;max-height:none;
 margin:0;padding:0;border:0;border-radius:0;overflow:hidden;isolation:isolate;box-shadow:none;
 /* One continuous viewport-sized habitat through combat and capture. */
 background:#648448 url('assets/arenas/grass-clearing-v1.webp') center 56% / cover no-repeat;
}
.battle-overlay .battle-panel>.dialog-close{
 position:absolute;z-index:12;top:max(18px,env(safe-area-inset-top,0px));right:max(20px,env(safe-area-inset-right,0px));
 width:44px;height:44px;min-width:44px;min-height:44px;display:grid;place-items:center;
 padding:0;background:#14271edb;border:1px solid #ffffff66;color:#fff;font-size:28px;line-height:1;border-radius:50%;
 box-shadow:0 3px 14px #0003;
}
.battle-overlay .battle-heading{
 position:absolute;z-index:6;top:max(24px,env(safe-area-inset-top,0px));left:50%;transform:translateX(-50%);
 display:flex;flex-direction:column;justify-content:center;gap:5px;width:max-content;max-width:36%;margin:0;
 color:#fff;text-align:center;text-shadow:0 2px 8px #10261edb;pointer-events:none;
}
.battle-overlay .battle-heading .eyebrow{justify-content:center;color:#f2f8e8;font-size:11px;letter-spacing:1.5px}
.battle-overlay .battle-heading .eyebrow::before{display:none}
.battle-overlay .battle-heading h2{font-size:23px;line-height:1.3;color:#fff;letter-spacing:0}
.battle-overlay .combat-scene.fx-scene.battle-arena{
 position:absolute;inset:0;display:block;width:100%;height:100%;min-height:0;margin:0;gap:0;
 border:0;border-radius:0;isolation:isolate;overflow:hidden;
 background:transparent;
}
.battle-overlay .battle-panel::before{
 content:'';position:absolute;inset:0;z-index:0;pointer-events:none;
 background:linear-gradient(180deg,#11251c66,transparent 30%,transparent 72%,#18301e55);
}
.battle-overlay .battle-arena>.arena-backdrop{z-index:0;border-radius:0}
.battle-overlay .battle-arena>.arena-fx{position:absolute;inset:0;width:100%;height:100%;z-index:3;pointer-events:none}
.battle-overlay .battle-arena>.fighter{display:contents;position:static;z-index:auto}
.battle-overlay .battle-arena>.fighter>.sprite{
 position:absolute;z-index:1;bottom:max(23%,290px);--battle-pet-size:min(31vw,48vh,400px);width:var(--battle-pet-size);height:auto;aspect-ratio:1;margin:0;
}
.battle-overlay #you-fighter>.sprite{left:calc(27% - min(31vw,48vh,400px) / 2)}
.battle-overlay #foe-fighter>.sprite{right:calc(27% - min(31vw,48vh,400px) / 2)}
.battle-overlay .fighter-status{
 position:absolute;z-index:6;top:max(26px,env(safe-area-inset-top,0px));width:clamp(190px,23vw,300px);
 padding:14px 17px 12px;border:1px solid #ffffff80;border-radius:16px;background:#14271ee8;
 box-shadow:0 6px 20px #07180d26;color:#fff;text-align:left;backdrop-filter:blur(10px);
}
.battle-overlay #you-fighter .fighter-status{left:max(28px,env(safe-area-inset-left,0px))}
.battle-overlay #foe-fighter .fighter-status{right:max(82px,calc(env(safe-area-inset-right,0px) + 64px))}
.battle-overlay .fighter-status h3{font-size:16px;line-height:1.4;min-height:1.4em;margin:0 0 9px;color:#fff;overflow-wrap:anywhere}
.battle-overlay .fighter-status .progress{height:9px;margin:0 0 5px;background:#07150d99;border:1px solid #ffffff26}
.battle-overlay .fighter-status .progress>i{background:linear-gradient(90deg,#7bd58a,#bae694)}
.battle-overlay #foe-fighter .progress>i{background:linear-gradient(90deg,#ee956d,#f0cc89)}
.battle-overlay .fighter-status small{display:block;color:#f5f8ef;font-size:12px;text-align:right;font-variant-numeric:tabular-nums;line-height:1.4}
.battle-overlay .battle-arena .ultimate-banner{top:150px;z-index:7;max-width:80%;font-size:16px}
.battle-overlay .battle-footer{
 position:absolute;z-index:8;bottom:0;left:50%;transform:translateX(-50%);width:min(600px,100%);
 padding:0 20px max(24px,env(safe-area-inset-bottom,0px));max-height:34vh;max-height:34dvh;overflow-y:auto;
 overscroll-behavior:contain;scrollbar-width:thin;pointer-events:none;
}
.battle-overlay #combat-outcome:empty{display:none}
.battle-overlay #combat-outcome{
 display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:stretch;
 padding:16px;border:1px solid #ffffff9c;border-radius:20px;background:#fffffff2;
 box-shadow:0 8px 36px #11241c45;color:#223b2b;pointer-events:auto;
}
.battle-overlay #combat-outcome .combat-result{grid-column:1/-1;margin:0;padding:0 0 3px;background:transparent;border-radius:0}
.battle-overlay #combat-outcome .combat-result strong{font-size:20px;color:#254d32}
.battle-overlay #combat-outcome .combat-result p{font-size:13px;line-height:1.6;color:#455b48;margin-top:6px}
.battle-overlay #combat-outcome .capture-caption{grid-column:1/-1;color:#455b48;font-size:13px;line-height:1.5;text-align:center;margin:0}
.battle-overlay #combat-outcome button{width:100%;min-height:46px;margin:0;padding:11px 15px;font-size:13px;line-height:1.4}
.battle-overlay #combat-outcome>.secondary:only-of-type:last-child{grid-column:1/-1}
.battle-overlay #combat-outcome:has(>.primary)>.secondary:last-child{grid-column:auto}
.battle-overlay #battle-status.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:767px){
 .battle-overlay .battle-panel>.dialog-close{top:max(12px,env(safe-area-inset-top,0px));right:max(12px,env(safe-area-inset-right,0px))}
 .battle-overlay .battle-heading{top:max(16px,env(safe-area-inset-top,0px));max-width:66%;gap:3px}
 .battle-overlay .battle-heading .eyebrow{font-size:10px;letter-spacing:1px}
 .battle-overlay .battle-heading h2{font-size:20px}
 .battle-overlay .battle-panel{background-position:50% 50%}
 .battle-overlay .battle-arena>.fighter>.sprite{bottom:max(27%,200px);--battle-pet-size:min(45vw,250px);width:var(--battle-pet-size);max-width:250px;height:auto}
 .battle-overlay #you-fighter>.sprite{left:2%}
 .battle-overlay #foe-fighter>.sprite{right:2%}
 .battle-overlay .fighter-status{top:calc(max(12px,env(safe-area-inset-top,0px)) + 76px);width:calc(50% - 20px);padding:11px 12px 9px;border-radius:13px}
 .battle-overlay #you-fighter .fighter-status{left:max(12px,env(safe-area-inset-left,0px))}
 .battle-overlay #foe-fighter .fighter-status{right:max(12px,env(safe-area-inset-right,0px))}
 .battle-overlay .fighter-status h3{font-size:13px;line-height:1.35;margin-bottom:8px}
 .battle-overlay .fighter-status .progress{height:8px}
 .battle-overlay .fighter-status small{font-size:11px}
 .battle-overlay .battle-arena .ultimate-banner{top:calc(max(12px,env(safe-area-inset-top,0px)) + 178px);max-width:90%;font-size:13px;padding:9px 13px}
 .battle-overlay .battle-footer{width:100%;padding:0 12px max(14px,env(safe-area-inset-bottom,0px));max-height:32vh;max-height:32dvh}
 .battle-overlay #combat-outcome{padding:13px;border-radius:16px;gap:8px}
 .battle-overlay #combat-outcome .combat-result strong{font-size:18px}
 .battle-overlay #combat-outcome .combat-result p,.battle-overlay #combat-outcome .capture-caption{font-size:12px}
 .battle-overlay #combat-outcome button{font-size:12px;padding:10px 8px}
}
@media(max-height:520px) and (min-width:568px){
 .battle-overlay .battle-heading{top:max(12px,env(safe-area-inset-top,0px));gap:2px}
 .battle-overlay .battle-heading h2{font-size:18px}
 .battle-overlay .fighter-status{top:max(12px,env(safe-area-inset-top,0px));width:24%;padding:9px 12px}
 .battle-overlay #you-fighter .fighter-status{left:max(14px,env(safe-area-inset-left,0px))}
 .battle-overlay #foe-fighter .fighter-status{right:max(66px,calc(env(safe-area-inset-right,0px) + 54px))}
 .battle-overlay .battle-arena>.fighter>.sprite{bottom:max(18%,142px);--battle-pet-size:min(25vw,32vh,170px);width:var(--battle-pet-size)}
 .battle-overlay #you-fighter>.sprite{left:calc(27% - var(--battle-pet-size) / 2)}
 .battle-overlay #foe-fighter>.sprite{right:calc(27% - var(--battle-pet-size) / 2)}
 .battle-overlay .battle-arena .ultimate-banner{top:104px;font-size:12px}
 .battle-overlay .battle-footer{width:min(620px,90%);max-height:40dvh;padding-bottom:max(10px,env(safe-area-inset-bottom,0px))}
}

/* Reserve the same control space before and after victory on short phones. */
@media(max-height:650px) and (max-width:567px){
 .battle-overlay .battle-arena>.fighter>.sprite{bottom:max(27%,182px)}
 .battle-overlay .battle-heading{top:12px}
 .battle-overlay .battle-heading .eyebrow{display:none}
 .battle-overlay .battle-heading h2{font-size:17px}
 .battle-overlay .battle-arena .fighter-status{top:60px;padding:8px 10px}
 .battle-overlay .fighter-status h3{font-size:12px;margin-bottom:5px}
 .battle-overlay .fighter-status .progress{height:6px;margin-bottom:3px}
 .battle-overlay .fighter-status small{font-size:10px}
}
