/* Last-layer battle layout: edge-to-edge world with safe-area HUD and dock. */
.is-online-battle #online-root{position:fixed!important;inset:0!important;width:100%!important;max-width:none!important;height:100dvh!important;margin:0!important;border:0!important;border-radius:0!important}
.is-online-battle #online-content{height:100%;max-height:none!important}
.battle-game{height:100%;overflow:hidden}
.battle-game .battle-playfield{position:absolute;inset:0 0 calc(138px + env(safe-area-inset-bottom));width:100%;height:auto;min-height:0}
.battle-game .battle-game-hud{padding:calc(7px + env(safe-area-inset-top)) 9px 7px;background:linear-gradient(#092336a6,transparent);align-items:flex-start}
.battle-game-hud .battle-rival strong{font-size:17px;max-width:180px}.battle-game-hud .battle-rival small{font-size:9px}.battle-game-hud .battle-rival-badge{width:25px;height:30px}
.battle-game #battle-clock{font-size:25px;min-width:58px;min-height:43px}.battle-game .battle-menu-button{min-width:44px;min-height:44px}
.battle-game .battle-crown-line{top:calc(66px + env(safe-area-inset-top));right:9px;transform:none;flex-direction:row;width:auto;gap:8px;padding:3px 7px}.battle-game .battle-crown-line>span,.battle-game .battle-crown-line>span:last-child{flex-direction:row}.battle-game .battle-crown-line strong{font-size:16px}
.battle-game .battle-controls{position:absolute;bottom:0;left:0;right:0;--battle-hand-height:94px;--battle-rail:42px;grid-template-rows:94px 20px;row-gap:7px;padding:7px 9px calc(8px + env(safe-area-inset-bottom));height:auto;min-height:0}
.battle-controls .hand-monster-traits,.battle-controls .monster-traits,.battle-controls .hand-ready,.battle-next-name{display:none!important}
.battle-controls .battle-hand-card>strong{font-size:10px;bottom:13px;min-height:20px}.battle-controls .battle-hand-card .hand-portrait{bottom:17px}.battle-controls .battle-hand-card .hand-energy{width:27px;height:29px;font-size:22px;bottom:-7px}
.battle-game .battle-lane-actions{bottom:calc(100% + 8px);opacity:.85}.battle-game .battle-lane-actions>span{display:none}.battle-game .battle-lane-actions button{font-size:10px;min-height:44px;max-width:76px;padding:4px}
.battle-emotes{position:absolute;left:8px;bottom:calc(155px + env(safe-area-inset-bottom));z-index:15}.battle-emotes button{min-width:44px;min-height:44px;padding:5px;border:2px solid #9fd9e8;border-radius:13px;background:linear-gradient(#29658b,#103555);font-size:26px;box-shadow:0 3px #071e34}.emote-picker{position:absolute;bottom:54px;left:0;width:208px;display:grid;grid-template-columns:repeat(4,44px);gap:6px;padding:8px;background:#0a2c49f5;border:1px solid #96d5e6;border-radius:15px}.emote-picker[hidden],.emote-bubble[hidden]{display:none}.emote-bubble{position:fixed;left:24px;bottom:calc(220px + env(safe-area-inset-bottom));padding:10px 16px;background:#fff9df;border:3px solid #e5b554;border-radius:24px 24px 24px 5px;box-shadow:0 4px #17394b80;font-size:42px;pointer-events:none}.emote-bubble.enemy{left:auto;right:24px;bottom:auto;top:calc(100px + env(safe-area-inset-top));border-radius:24px 5px 24px 24px}
@media(min-width:700px){.battle-game .battle-controls{max-width:680px;left:50%;right:auto;width:100%;transform:translateX(-50%)}.battle-game .battle-playfield{inset:0 0 138px}}
@media(max-height:500px) and (orientation:landscape){.battle-game .battle-playfield{inset:0 180px 0 0}.battle-game .battle-controls{left:auto;right:0;top:0;width:180px;bottom:0;grid-template-columns:34px 1fr;grid-template-rows:1fr 20px;--battle-hand-height:82px;transform:none;padding-top:8px}.battle-controls .hand{grid-template-columns:repeat(2,1fr);gap:12px 6px}.battle-game .battle-rival{max-width:180px}.battle-emotes{bottom:12px}.battle-game .battle-lane-actions{display:none}}
.is-online-battle #online-root{transform:none!important;left:0!important;right:0!important;top:0!important;bottom:0!important}
.battle-game .battle-game-hud{position:absolute;inset:0 0 auto;height:auto;flex:none;border:0;box-shadow:none;pointer-events:none}.battle-game .battle-menu-button{pointer-events:auto}
.battle-game .battle-lane-actions button:before{content:none!important}
.battle-game .battle-lane-actions{left:64px;right:8px;justify-content:space-between;pointer-events:none}.battle-game .battle-lane-actions button{pointer-events:auto;background:#173f5199}
@media(max-height:500px) and (orientation:landscape){
 .battle-game{display:block}.battle-game .battle-playfield{grid-area:auto;inset:0 180px 0 0;width:auto;height:auto}.battle-game .battle-game-hud{grid-area:auto;right:180px;height:auto}.battle-game .battle-controls{grid-area:auto;max-width:none}.battle-game .battle-crown-line{right:190px;top:60px}.battle-game .battle-controls .battle-hand-card{height:110px;min-height:0}.battle-game .battle-controls .hand{height:auto;grid-template-rows:auto;align-self:center}.battle-game .battle-controls .battle-next{grid-row:1}
}
@media(max-height:650px) and (orientation:portrait){.battle-game .battle-rival{max-width:130px}.battle-game-hud .battle-rival strong{max-width:105px;font-size:13px}.battle-game-hud .battle-rival small{font-size:8px}.battle-game-hud .battle-rival-badge{display:none}}
/* Original Blue Dragon stickers: lightweight transform animation, no video decoder. */
.battle-emotes .emote-toggle{position:relative;width:50px;height:50px;padding:2px;overflow:visible}.emote-toggle .emote-art{width:44px;height:44px;object-fit:contain}.emote-toggle-mark{position:absolute;right:-4px;bottom:-3px;border-radius:8px;border:1px solid #92d4ec;background:#092b49;color:white;font:bold 11px/14px sans-serif;padding:0 3px}.battle-emotes .emote-picker{width:254px;grid-template-columns:repeat(3,74px);gap:5px;padding:10px;bottom:58px;background:linear-gradient(#1b4b70fa,#0b2946fa);box-shadow:0 8px 25px #03182bb3}.emote-picker button[data-emote]{height:88px;padding:3px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #78b8d966;background:#163e60;box-shadow:0 2px #061f36;border-radius:10px}.emote-picker .emote-art{width:61px;height:61px;object-fit:contain}.emote-picker small{font:700 9px/1.2 'DM Sans',sans-serif;color:#dfedfc}.emote-picker .emote-mute{grid-column:1/-1;min-height:32px;font-size:18px;padding:2px}.emote-picker button:active .emote-art{transform:scale(.92)}
.battle-emotes .emote-bubble{width:120px;padding:0;border:0;background:none;box-shadow:none;filter:drop-shadow(0 4px 3px #051c3d66);border-radius:0;display:flex;flex-direction:column;align-items:center}.emote-bubble .emote-art{width:112px;height:112px;object-fit:contain;transform-origin:50% 80%;animation:dragon-emote-pop .28s ease-out both}.emote-caption{padding:3px 9px;border-radius:12px;background:#092b4fe6;color:#dceeff;font:700 10px/1.2 'DM Sans',sans-serif}.emote-bubble[data-reaction="hello"] .emote-art{animation:dragon-emote-pop .25s ease-out both,dragon-emote-wave .6s ease-in-out .25s 3}.emote-bubble[data-reaction="well-played"] .emote-art{animation:dragon-emote-pop .25s ease-out both,dragon-emote-clap .3s ease-in-out .25s 5}.emote-bubble[data-reaction="surprised"] .emote-art{animation:dragon-emote-surprise .65s ease-out both}.emote-bubble[data-reaction="attack"] .emote-art,.emote-bubble[data-reaction="keep-going"] .emote-art{animation:dragon-emote-pop .25s ease-out both,dragon-emote-cheer .5s ease-in-out .25s 3}.emote-bubble[data-reaction="good-game"] .emote-art{animation:dragon-emote-pop .25s ease-out both,dragon-emote-heart .65s ease-in-out .25s 3}
@keyframes dragon-emote-pop{from{opacity:0;transform:translateY(12px) scale(.55)}70%{opacity:1;transform:scale(1.08)}to{opacity:1;transform:scale(1)}}@keyframes dragon-emote-wave{0%,100%{transform:rotate(0)}30%{transform:rotate(-9deg)}70%{transform:rotate(7deg)}}@keyframes dragon-emote-clap{50%{transform:translateY(-5px) scaleX(.94)}}@keyframes dragon-emote-cheer{50%{transform:translateY(-9px) rotate(-4deg)}}@keyframes dragon-emote-heart{50%{transform:scale(1.08)}}@keyframes dragon-emote-surprise{0%{opacity:0;transform:scale(.5)}45%{opacity:1;transform:scale(1.16) rotate(-5deg)}75%{transform:scale(.96) rotate(3deg)}100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.emote-bubble .emote-art{animation:none!important}}
.battle-emotes .emote-bubble[hidden]{display:none}

/* Battle menus stay inside the device safe area; secondary settings open on demand. */
.is-online-battle .game-battle-dialog {
  box-sizing:border-box;
  width:min(340px,calc(100vw - 32px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)));
  max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
  margin:auto;
  padding:18px 16px;
  border-radius:18px;
  overscroll-behavior:contain;
  scrollbar-width:thin;
}
.is-online-battle .game-battle-dialog h2 {font-size:25px;margin:0 0 10px;}
.is-online-battle .game-battle-dialog .battle-continues {font-size:13px;line-height:1.4;margin:0 0 14px;padding:0;border:0;background:none;}
.is-online-battle .game-dialog-menu {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;}
.is-online-battle .game-dialog-menu button,.is-online-battle .game-dialog-actions button {min-width:0;min-height:44px;padding:10px 8px;font-size:14px;line-height:1.25;}
.is-online-battle .game-dialog-menu .primary,.is-online-battle .game-dialog-menu .danger {grid-column:1/-1;}
.is-online-battle .game-dialog-menu .primary {font-size:17px;min-height:48px;}
.is-online-battle .game-dialog-menu .danger {background:#6c3043;border-color:#a65968;box-shadow:0 3px #402032;}
.battle-menu-settings {margin-top:16px;border-top:1px solid #a7d9f43b;}
.battle-menu-settings>summary {display:flex;align-items:center;justify-content:space-between;min-height:44px;cursor:pointer;list-style:none;font-size:15px;font-weight:800;}
.battle-menu-settings>summary::-webkit-details-marker {display:none;}
.battle-menu-settings>summary::after {content:'＋';font-size:20px;color:#c3e9ff;}
.battle-menu-settings[open]>summary::after {content:'−';}
.battle-menu-settings>summary:focus-visible {outline:3px solid #ffefa1;outline-offset:2px;border-radius:6px;}
.is-online-battle .battle-menu-settings h3 {font-size:16px;line-height:1.3;margin:10px 0 6px;}
.is-online-battle .battle-menu-settings .game-audio-controls.compact {margin:8px 0 14px;gap:10px;}
.is-online-battle .battle-menu-settings .game-audio-heading strong {font-size:14px;}
.is-online-battle .battle-menu-settings .game-audio-toggle {min-width:58px;min-height:44px;padding:6px 10px;font-size:14px;}
.is-online-battle .battle-menu-settings .game-audio-channel {gap:0;}
.is-online-battle .battle-menu-settings .game-audio-volume input {height:44px;}
.is-online-battle .battle-menu-settings .game-audio-note {font-size:11px!important;line-height:1.4;}
.is-online-battle .battle-menu-settings p {font-size:12px;line-height:1.4;margin:6px 0 10px;}
.is-online-battle .battle-menu-settings .battle-mode-tabs[aria-label="Battle graphics"] {display:grid;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px;padding:4px;}
.is-online-battle .battle-menu-settings .battle-mode-tabs button {min-width:0;min-height:44px;padding:7px 3px;font-size:12px;}

/* Keep active battles clear of transient toast overlays, including queued menu notices.
   Connection recovery and placement feedback have dedicated battle HUD controls. */
.is-online-battle #online-status,
.is-online-battle #online-status.show { display:none; }
