/* The touch controls use the same measured positions as the layout editor. */
#battle.keyboard-controls .touch-controls{display:none}
#battle .touch-controls .stick-caption,#battle .touch-controls .action-button small:not(.skill-readout){display:none}
#battle .touch-controls .action-button{gap:3px;padding:2px;overflow:hidden;letter-spacing:0}
#battle .touch-controls .action-button>b{font-size:12px;line-height:1.13;white-space:nowrap}
#battle .touch-controls .action-button.attack>b{font-size:16px}
#battle .touch-controls .action-icon{width:17px;height:17px}
#battle .touch-controls .action-button.attack .action-icon{width:23px;height:23px}
#battle .touch-controls .action-button:has(.skill-readout){gap:1px;padding:2px}
#battle .touch-controls .action-button:has(.skill-readout)>b{font-size:clamp(9px,1.22cqw,13px);transform:none}
#battle .touch-controls .action-button:has(.skill-readout) .action-icon{width:clamp(12px,1.7cqw,17px);height:clamp(12px,1.7cqw,17px);opacity:.95}
#battle .touch-controls .action-button .skill-readout{display:block;visibility:visible;font-size:clamp(9px,1.1cqw,12px);line-height:1.13;white-space:nowrap;font-variant-numeric:tabular-nums;color:#dcebe8;font-weight:650}
#battle .touch-controls .action-button.cooling .skill-readout,#battle .touch-controls .action-button.counter-ready .skill-readout{color:#ffe2a4}
#battle .touch-controls .action-button.ultimate.ready .skill-readout{color:#19313b}
#battle .touch-controls .action-button.ultimate.ready:before{background:linear-gradient(135deg,#ffe4a0,#d3aa5a);opacity:max(.75,var(--plate-opacity,.9))}
#battle .touch-controls .action-button.ultimate:not(.ready)::after{content:'';position:absolute;bottom:3px;left:29%;width:42%;height:2px;background:linear-gradient(to right,#ffe19a var(--ult-meter,0%),#b5cbc24d var(--ult-meter,0%));border-radius:5px}
#battle .touch-controls .control-state{font-size:0}
#battle .touch-controls .control-state::first-letter{font-size:0}
#battle .resource-label{display:none}
#keyboardHUD{
 display:none;position:absolute;z-index:5;bottom:max(10px,env(safe-area-inset-bottom));
 left:50%;width:min(570px,94%);transform:translateX(-50%);
 pointer-events:none;gap:clamp(6px,1.6vw,20px);
}
#battle.keyboard-controls #keyboardHUD,#battle.local-mode #keyboardHUD{display:grid}
#keyboardHUD.duo{width:min(1100px,96%);grid-template-columns:repeat(2,minmax(0,1fr))}
#keyboardHUD .keyboard-player{min-width:0}
#keyboardHUD .keyboard-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(3px,.6vw,8px)}
#keyboardHUD .keyboard-skill{
 display:grid;gap:3px;align-content:center;min-width:0;padding:4px clamp(3px,.7vw,9px);
 background:#142b37f2;border:1px solid #78949a8f;border-radius:6px;
 color:#f3f0de;line-height:1.2;font-size:clamp(10px,1.15cqw,13px);
}
#keyboardHUD .keyboard-skill-title{display:flex;gap:4px;align-items:center;min-height:2.4em}
#keyboardHUD .keyboard-skill-title b{overflow-wrap:anywhere}
#keyboardHUD kbd{color:#fff2cd;font:inherit;font-weight:750;white-space:nowrap}
#keyboardHUD .keyboard-skill kbd{
 flex:none;min-width:1.45em;padding:2px 3px;text-align:center;border:1px solid #afc2bc80;
 border-radius:4px;background:#314956;
}
#keyboardHUD .keyboard-skill small{font-size:.92em;line-height:1.25;color:#c2d9d4;font-variant-numeric:tabular-nums}
#keyboardHUD .keyboard-skill[data-phase="cooling"] small{color:#f7d89b}
#keyboardHUD .keyboard-skill[data-phase="special"],#keyboardHUD [data-skill="ult"][data-phase="ready"]{border-color:#efce7f;background:#433e2a}
#keyboardHUD .keyboard-skill[data-phase="special"] small,#keyboardHUD [data-skill="ult"][data-phase="ready"] small{color:#ffe2a4}
#keyboardHUD .keyboard-strip{
 display:flex;align-items:center;justify-content:center;gap:3px clamp(5px,1.5cqw,16px);flex-wrap:wrap;
 margin-top:4px;padding:4px;border-radius:5px;background:#101e29df;color:#d9e5df;
 font-size:clamp(9px,1.05cqw,12px);line-height:1.25;
}
#keyboardHUD .keyboard-strip b{font-weight:500}
#keyboardHUD .keyboard-strip kbd{padding:1px 3px;border:1px solid #6a858c;border-radius:3px;background:#263e4b}
#keyboardHUD .keyboard-seat{display:none;color:#a5d6df}
#keyboardHUD.duo .keyboard-seat{display:inline}
#battle #roleStatus{display:flex;align-items:center;gap:6px;margin:5px 0 0;min-height:14px;white-space:nowrap;color:#e1eadf;font-size:11px;line-height:1.2}
#roleStatus .status-glyphs{display:inline-flex;align-items:center;gap:3px}
#roleStatus svg{width:13px;height:13px;stroke-width:1.5;flex:none}
#roleStatus .status-glyphs span{color:#94a7ad;display:flex}
#roleStatus .status-glyphs .filled{color:#ffe196}
#battle #encounterStatus{left:50%;right:auto;top:78px;transform:translateX(-50%);white-space:nowrap;font-size:11px;pointer-events:none}
.is-adventure #battle #arenaLabel,.is-adventure #battle #pWins,.is-adventure #battle #eWins{display:none}
#battle #connectionStatus{right:4%;top:155px}
#battle #actionFeedback{max-width:80%;font-size:12px}
@media(max-height:500px) and (orientation:landscape){
 #battle #encounterStatus{top:65px}
 #battle #roleStatus{font-size:10px;gap:4px}
 #battle .battle-tools{top:80px}
 #battle #connectionStatus{top:128px}
 #battle .rescue-hint{top:88px}
 #battle #arenaLabel{top:70px}
}

/* Reserve room for the short effect, its details, and a stable confirm button. */
#advLayer.ordinary-reward .adventure-modal{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto auto;gap:8px;min-height:min(420px,100%);max-height:100%;width:min(1060px,100%);padding:20px 24px}
#advLayer.ordinary-reward .adventure-heading{grid-row:1}
#advLayer.ordinary-reward .adventure-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
#advLayer.ordinary-reward #advTools{flex:none}
#advLayer.ordinary-reward #advTools .reroll-button{margin:0;white-space:nowrap}
#advLayer.ordinary-reward #advTeam{grid-row:2}
#advLayer.ordinary-reward #advChoices{grid-row:3}
#advLayer.ordinary-reward #advRewardDetail{grid-row:4}
#advLayer.ordinary-reward .adv-actionbar{grid-row:5}
#advLayer.ordinary-reward .adventure-heading h2{font-size:clamp(18px,3.2cqw,33px)!important;margin:0;letter-spacing:0;text-wrap:balance}
#advLayer.ordinary-reward #advEyebrow,#advLayer.ordinary-reward #advJourney,#advLayer.ordinary-reward #advDescription{display:none}
#advLayer.ordinary-reward #advTeam:empty{display:none}
#advLayer.ordinary-reward #advChoices{min-height:0;overflow:auto;padding:0 4px 4px;scrollbar-gutter:auto}
#advLayer.ordinary-reward .blessing-player{padding:0;margin:0}
#advLayer.ordinary-reward .blessing-player h3{font-size:12px;margin:0 0 5px}
#advLayer.ordinary-reward .blessing-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#advLayer.ordinary-reward .blessing-card{width:100%;min-height:0;height:100%;display:flex;flex-direction:column;align-items:stretch;gap:5px;overflow:hidden;padding:0 0 10px;text-align:left}
#advLayer.ordinary-reward .blessing-card>b,#advLayer.ordinary-reward .blessing-card>.reward-hook,#advLayer.ordinary-reward .blessing-card>small{margin:0 11px}
#advLayer.ordinary-reward .blessing-card>b{font-size:clamp(13px,1.55cqw,21px);line-height:1.16}
#advLayer.ordinary-reward .blessing-card>.reward-hook{font-size:clamp(11px,1.15cqw,15px);line-height:1.3;color:#32424a}
#advLayer.ordinary-reward .blessing-card>small{font-size:10px;line-height:1.2;margin-top:auto;color:#53646a}
#advLayer.ordinary-reward .choice-emblem{width:100%;height:clamp(42px,10dvh,85px);border-radius:0;background:linear-gradient(135deg,#264651,#476969);color:#f6e7ba}
.reward-scene{width:100%;height:clamp(65px,19dvh,150px);object-fit:cover;display:block;background:#283b50}
#advRewardDetail{border-left:3px solid #bc8b45;background:#f1ecdd;color:#243940;border-radius:0 7px 7px 0;min-height:50px;max-height:67px;overflow:auto;padding:6px 10px;font-size:12px;line-height:1.35}
#advRewardDetail p{margin:0 0 4px;font-size:inherit;line-height:inherit}
#advRewardDetail p:last-child{margin:0}
#advLayer.ordinary-reward .adv-actionbar{padding-top:5px}
#advLayer.ordinary-reward #advSelectionStatus:not(.error){display:none}
#advLayer.ordinary-reward #advContinue,#advLayer.ordinary-reward #advBack{margin:0;min-height:42px}
#advLayer.ordinary-reward .reroll-button{margin:5px 0 0;min-height:36px}
@media(max-height:450px) and (orientation:landscape){
 #advLayer.ordinary-reward{padding:5px max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left))}
 #advLayer.ordinary-reward .adventure-modal{gap:4px;padding:8px 10px;border-radius:12px}
 #advLayer.ordinary-reward .blessing-player h3{display:none}
 #advLayer.ordinary-reward .local-coop-choices .blessing-player h3{display:block}
 #advLayer.ordinary-reward .blessing-card{padding-bottom:4px;gap:3px}
 #advLayer.ordinary-reward .blessing-card>b,#advLayer.ordinary-reward .blessing-card>.reward-hook,#advLayer.ordinary-reward .blessing-card>small{margin-left:7px;margin-right:7px}
 #advRewardDetail{min-height:43px;max-height:54px;font-size:11px;padding:4px 7px}
 #advLayer.ordinary-reward .reroll-button{min-height:29px;padding:3px 8px;font-size:11px}
 #battle .name-line strong{font-size:12px}
 #battle .name-line span{font-size:11px}
 #battle #roleStatus svg{width:11px;height:11px}
}
@media (orientation:portrait){#advLayer.ordinary-reward .blessing-grid{grid-template-columns:1fr}.reward-scene{height:96px}}
