/* Special events keep the original dice and a clear view through to the board. */
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
  body#top[data-page='play'].phone-match-active {
    --phone-combat-top:calc(96px + var(--phone-safe-top)); --phone-combat-bottom:calc(50px + var(--phone-footer-inset));
    --phone-battle-size:clamp(68px,11vw,98px);
    --phone-combat-width:clamp(120px,18vw,180px);
  }
  body#top[data-page='play'].phone-match-active .row-popup {
    position:fixed!important;top:50%!important;left:calc(var(--phone-board-start) + var(--phone-reserve-width) + 8px)!important;
    right:auto!important;width:140px;min-width:140px;max-width:140px;max-height:none;
    transform:translateY(-50%)!important;padding:10px;gap:7px;border:1px solid var(--phone-azure);border-radius:14px;
    background:linear-gradient(155deg,#123347f7,#1b0d2bf7)!important;color:var(--phone-ink);overflow:visible;box-shadow:0 10px 26px #0006;
  }
  body#top[data-page='play'].phone-match-active .row-popup.popup-p2 {left:auto!important;right:calc(var(--phone-controls-end) + var(--phone-reserve-width) + 8px)!important;border-color:var(--phone-violet);background:linear-gradient(155deg,#471633f7,#1b0d2bf7)!important;}
  body#top[data-page='play'].phone-match-active .popup-big-val {height:58px;min-height:58px;font:900 46px/1 Orbitron,sans-serif;background:none!important;color:#f7dd90;box-shadow:none;border:0;}
  body#top[data-page='play'].phone-match-active .popup-actions .btn {min-height:44px;padding:5px 2px;font:800 11px/1.2 Inter,sans-serif;border-radius:8px;}
  body#top[data-page='play'].phone-match-active .chip-pending-val {display:none!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active .row-popup {background:linear-gradient(155deg,#cbe9fbfa,#f9edfffa)!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active .row-popup.popup-p2 {background:linear-gradient(155deg,#f2ceecfa,#f9edfffa)!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active .popup-big-val {color:#795c16;}
  body#top[data-page='play'].phone-match-active.combat-active .side-stash {
    top:var(--phone-combat-top);bottom:var(--phone-combat-bottom);width:var(--phone-combat-width)!important;
    height:calc(100dvh - var(--phone-combat-top) - var(--phone-combat-bottom))!important;
    max-height:none!important;border-radius:14px!important;border:1px solid var(--phone-azure)!important;
    background:linear-gradient(180deg,#064066f2,#120c22ed)!important;backdrop-filter:none;-webkit-backdrop-filter:none;
    box-shadow:0 8px 24px #0004,inset 0 0 24px #0099ff15!important;
  }
  body#top[data-page='play'].phone-match-active.combat-active .stash-p2 {border-color:var(--phone-violet)!important;background:linear-gradient(180deg,#52103bf2,#120c22ed)!important;}
  body#top[data-page='play'].phone-match-active.combat-active #board-col {opacity:.86;pointer-events:none;}
  body#top[data-page='play'].phone-match-active.combat-active .combat-stash-content {inset:8px;width:calc(100% - 16px)!important;height:calc(100% - 16px)!important;}
  body#top[data-page='play'].phone-match-active.combat-active :is(.cb-role-badge,.csp-unit) {height:22px;line-height:14px;font-size:9px!important;letter-spacing:0!important;}
  body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell {inset:26px 0 0;height:calc(100% - 26px)!important;border-radius:9px;padding:16px 2px 42px;box-shadow:none!important;background:#0c081534;}
  body#top[data-page='play'].phone-match-active.combat-active .cb-battle-die-pill {font-size:9px!important;min-width:0;padding:3px 8px!important;}
  body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-desc {bottom:5px;max-height:38px;overflow:visible;}
  body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-text {font-size:11px!important;line-height:1.25!important;}
  body#top[data-page='play'].phone-match-active.combat-active .bg3-prompt-badge {min-width:0;min-height:28px;font-size:10px!important;padding:5px 6px!important;}
  body#top[data-page='play'].phone-match-active.combat-active #action-bar {inset:auto var(--phone-controls-end) var(--phone-footer-inset) var(--phone-board-start);width:auto;height:44px;padding:4px 10px;border:1px solid var(--phone-line);border-radius:12px;background:var(--phone-surface);z-index:80;}
  body#top[data-page='play'].phone-match-active.combat-active #combat-result-container {display:flex;align-items:center;justify-content:center;gap:8px;height:100%;}
  body#top[data-page='play'].phone-match-active.combat-active:has(#evade-decision-container[style*='flex']) #cb-outcome {visibility:hidden;}
  body#top[data-page='play'].phone-match-active.combat-active #btn-combat-done {min-height:36px;border-radius:8px;font-size:11px!important;}
  body#top[data-page='play'].phone-match-active.tutorial-active.combat-active #tutorial-banner {display:none!important;}
  body#top[data-page='play'].phone-match-active #phone-unit-inspector::backdrop {background:#08041338;backdrop-filter:none;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active .side-stash {background:linear-gradient(180deg,#b8dff5f5,#f9edfff2)!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active .stash-p2 {background:linear-gradient(180deg,#f0bfe2f5,#f9edfff2)!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active #cb-p1-role {color:#075074!important;}
  html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active :is(#cb-p1-role,#cb-p2-role) {text-shadow:none!important;}
  body#top[data-page='play'].phone-match-active #online-turn-banner-container {position:fixed!important;top:65px!important;left:auto!important;right:calc(var(--phone-controls-end) + 52px)!important;transform:none!important;width:var(--phone-reserve-width)!important;max-width:var(--phone-reserve-width);gap:0!important;}
  body#top[data-page='play'].phone-match-active :is(#online-turn-status-banner,#hotseat-momentum-banner) {display:none!important;}
  body#top[data-page='play'].phone-match-active #opponent-disconnect-banner {white-space:normal!important;font-size:10px;flex-wrap:wrap;width:100%;padding:6px!important;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:350px) {
 body#top[data-page='play'].phone-match-active {--phone-combat-top:88px;--phone-battle-size:68px;}
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell {padding-bottom:34px;}
 body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-text {font-size:10px!important;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active .row-popup.popup-p1 {left:calc(var(--phone-board-start) + var(--phone-reserve-width) + 8px)!important;}
 body#top[data-page='play'].phone-match-active .phone-reserve-toggle {visibility:visible!important;}
 body#top[data-page='play'].phone-match-active #action-bar .act-text {font-size:11px;}
 body#top[data-page='play'].phone-match-active .hp-pips::before {display:none!important;}
 body#top[data-page='play'].phone-match-active .hex-poly.hex-control {stroke:#e7be58d4!important;}
 body#top[data-page='play'].phone-match-active .hud-player.active {animation:phone-turn-aura .65s ease-out;}
}
@keyframes phone-turn-aura {0%{filter:brightness(1.55);}100%{filter:brightness(1);}}
@media(prefers-reduced-motion:reduce){body#top[data-page='play'].phone-match-active .hud-player.active{animation:none;}}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active:not(.combat-active) .side-stash.phone-reserve-carousel {padding-bottom:5px!important;}
 body#top[data-page='play'].phone-match-active .phone-reserve-markers:not([hidden]) {position:absolute;top:100%;left:0;width:100%;min-height:44px;background:transparent;box-shadow:none;}
 body#top[data-page='play'].phone-match-active .stash-p2 .phone-reserve-markers {left:auto;right:0;}
 /* Combat overlays the field; the field keeps exactly the same inset and size. */
 body#top[data-page='play'].phone-match-active.combat-active #board-col {opacity:1;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner[style*='flex'] {display:flex!important;width:var(--phone-reserve-width);max-width:var(--phone-reserve-width);padding:4px 6px;border-radius:8px;min-height:26px;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner .turn-pill-content {gap:4px;padding:0;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner #turn-pill-text {font:700 8px/1.3 Inter,sans-serif;letter-spacing:0;white-space:normal;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner .pulse-dot {width:5px;height:5px;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner .momentum-dots {display:none!important;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active #log-panel:not(.collapsed) .log-toggle-btn::after {content:'Close ×';margin-left:auto;font:700 11px/1.2 Inter,sans-serif;letter-spacing:0;color:var(--phone-ink);padding-left:14px;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active.combat-active #hex-board {transform:none!important;}
 body#top[data-page='play'].phone-match-active.combat-active[data-phone-phase='EVADE_SELECT'] #board-col {pointer-events:auto;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active :is(#hex-board,.die-chip) {-webkit-touch-callout:none;user-select:none;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active .side-stash {transition:border-color .3s,box-shadow .3s!important;}
 body#top[data-page='play'].phone-match-active .hud-player {transition:border-color .3s,box-shadow .3s,background-color .3s;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:350px) {
 body#top[data-page='play'].phone-match-active {--phone-combat-top:calc(72px + var(--phone-safe-top));}
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell {padding-top:18px;padding-bottom:54px;justify-content:flex-start!important;}
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .bg3-battle-die-widget {height:var(--phone-battle-size);min-height:var(--phone-battle-size);}
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked .bg3-prompt-badge {display:none!important;}
 body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-desc {max-height:54px;}
}
/* Each short-screen outcome has separate label, artwork and description rows. */
@media (orientation:landscape) and (max-width:1100px) and (max-height:300px) {
 body#top[data-page='play'].phone-match-active {--phone-combat-top:calc(60px + var(--phone-safe-top));}
 body#top[data-page='play'].phone-match-active.combat-active .combat-stash-content {
  inset:4px;width:calc(100% - 8px)!important;height:calc(100% - 8px)!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell {
  inset:22px 0 0;height:calc(100% - 22px)!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) {
  display:grid!important;grid-template-columns:minmax(0,1fr);
  grid-template-rows:16px minmax(44px,1fr) auto;gap:3px;
  align-items:center;justify-items:center;padding:2px;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .cb-battle-die-pill {
  grid-row:1;position:static!important;inset:auto!important;transform:none!important;
  height:16px;line-height:12px;padding:1px 8px!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked {
  grid-row:2;align-self:stretch;width:100%;height:100%!important;min-height:44px!important;min-width:44px;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked .bg3-die-container {
  width:auto!important;height:min(68px,100%)!important;
  aspect-ratio:1;max-width:100%;max-height:100%;flex:0 0 auto;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked :is(.bg3-3d-canvas,.bg3-die-body) {
  width:100%!important;height:100%!important;max-width:100%;max-height:100%;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked .bg3-die-face-content svg {
  width:100%!important;height:100%!important;max-width:100%;max-height:100%;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .bg3-effect-desc {
  grid-row:3;position:static;inset:auto;width:100%;height:auto;
  max-height:none;overflow:visible;
 }
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active #match-intro-modal > .modal-card {
  display:grid!important;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);grid-template-rows:22px 1fr;gap:12px 20px;
  width:min(700px,100%)!important;max-width:700px!important;height:auto!important;max-height:calc(100dvh - 24px)!important;
  padding:16px 20px!important;overflow:hidden!important;border-radius:18px;
 }
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-label {grid-column:1/-1;font-size:11px;letter-spacing:2px!important;margin:0;}
 body#top[data-page='play'].phone-match-active #match-intro-modal #color-select-section {grid-column:1;align-self:center;margin:0!important;gap:10px!important;}
 body#top[data-page='play'].phone-match-active #color-select-title {font:800 clamp(14px,2vw,18px)/1.4 Orbitron,sans-serif!important;letter-spacing:.7px!important;}
 body#top[data-page='play'].phone-match-active #color-select-status {font:500 12px/1.5 Inter,sans-serif!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(3) {display:none!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) {grid-column:2;gap:6px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) > div:first-child {display:none!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) > div:nth-child(2) {gap:12px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .ro-val {width:54px!important;height:54px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal :is(#btn-roll-azure,#btn-roll-violet) {min-height:44px;padding:5px 4px!important;letter-spacing:.3px!important;font-size:10px!important;}
 body#top[data-page='play'].phone-match-active #intro-ro-result {font:700 11px/1.35 Inter,sans-serif!important;min-height:15px!important;letter-spacing:.1px!important;margin:0!important;}
 body#top[data-page='play'].phone-match-active #intro-ready-container {margin:0!important;gap:6px!important;}
 body#top[data-page='play'].phone-match-active #intro-ready-container .ready-player-badge {padding:4px 8px;font-size:10px;}
 body#top[data-page='play'].phone-match-active #intro-ready-status {margin:0!important;font-size:10px!important;min-height:14px!important;line-height:1.35;}
 body#top[data-page='play'].phone-match-active #btn-intro-start-game {min-height:44px;padding:7px 8px!important;font-size:11px!important;letter-spacing:.5px!important;margin:0!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal:has(#intro-ready-container[style*='flex']) :is(#btn-roll-azure,#btn-roll-violet):disabled {display:none!important;}
}
/* Short initialization keeps the original roll-off and Ready controls fully in view. */
@media (orientation:landscape) and (max-width:1100px) and (max-height:300px) {
 body#top[data-page='play'].phone-match-active #match-intro-modal > .modal-card {
  grid-template-rows:18px minmax(0,1fr);gap:6px 16px;padding:8px 12px!important;
 }
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-label {font-size:10px;line-height:18px;}
 body#top[data-page='play'].phone-match-active #match-intro-modal #color-select-section {gap:8px!important;}
 body#top[data-page='play'].phone-match-active #color-select-status {font-size:11px!important;line-height:1.35!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) {gap:4px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) > div:nth-child(2) {gap:8px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-card > div:nth-child(4) > div:nth-child(2) > div:has(.ro-val) {gap:4px!important;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .ro-val {width:48px!important;height:48px!important;}
 body#top[data-page='play'].phone-match-active #intro-ready-container {padding:2px 8px!important;gap:6px!important;}
 body#top[data-page='play'].phone-match-active #intro-ready-container .ready-player-badge {padding:0 6px;line-height:12px;}
 body#top[data-page='play'].phone-match-active #intro-ready-status {line-height:1.25!important;}
 body#top[data-page='play'].phone-match-active #btn-intro-start-game {height:44px;min-height:44px;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active .hp-name-col {position:relative;}
 body#top[data-page='play'].phone-match-active .player-identity-label:not([style*='display: none']):not([style*='display:none']):not(:empty):not([hidden]) {display:block!important;position:absolute;left:50%;top:-12px;transform:translateX(-50%);white-space:nowrap;padding:1px 4px;border-radius:4px;background:var(--phone-surface);color:var(--phone-muted);font:800 8px/1.2 Inter,sans-serif;letter-spacing:.7px;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active #gameover-modal > .modal-card {display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:18px auto auto auto auto auto 44px;gap:6px 18px;width:min(700px,100%)!important;max-width:700px!important;max-height:calc(100dvh - 24px)!important;padding:14px 20px!important;overflow:hidden;border-radius:18px;}
 body#top[data-page='play'].phone-match-active #go-title {grid-column:1/-1;grid-row:1;font-size:10px;line-height:18px;margin:0;}
 body#top[data-page='play'].phone-match-active #go-winner {grid-column:1;grid-row:2;font:800 clamp(25px,4vw,34px)/1.2 Orbitron,sans-serif;margin:8px 0 0;}
 body#top[data-page='play'].phone-match-active #go-reason {grid-column:1;grid-row:3;font-size:10px!important;line-height:1.4;margin:0!important;letter-spacing:.3px!important;}
 body#top[data-page='play'].phone-match-active #go-tokens {grid-column:1;grid-row:4;font-size:11px;line-height:1.4;margin:0;}
 body#top[data-page='play'].phone-match-active #go-stats {grid-column:2;grid-row:2/5;min-height:108px;margin:0;padding:10px 8px;gap:6px;align-self:stretch;}
 body#top[data-page='play'].phone-match-active #go-stats .stat-num {font-size:14px;line-height:1.25;}
 body#top[data-page='play'].phone-match-active #go-stats .stat-lbl {font-size:8px;line-height:1.2;letter-spacing:.4px;}
 body#top[data-page='play'].phone-match-active #go-ready-container {grid-row:5;grid-column:1/-1;margin:0;gap:6px;}
 body#top[data-page='play'].phone-match-active #go-ready-container .ready-player-badge {padding:3px 8px;font-size:9px;}
 body#top[data-page='play'].phone-match-active #go-ready-status {grid-row:6;grid-column:1/-1;margin:0!important;font-size:10px!important;line-height:1.3;min-height:14px!important;}
 body#top[data-page='play'].phone-match-active #btn-new-game {grid-row:7;grid-column:1;}
 body#top[data-page='play'].phone-match-active #btn-go-exit {grid-row:7;grid-column:2;}
 body#top[data-page='play'].phone-match-active #gameover-modal :is(#btn-new-game,#btn-go-exit) {min-height:44px;min-width:0;width:100%;margin:0!important;padding:6px 8px!important;font:700 11px/1.2 Orbitron,sans-serif;letter-spacing:.3px;}
}
body#top[data-page='play'] .phone-match-intro-close {display:none;}
/* The rematch readiness rows share the same short-screen card as the match result. */
@media (orientation:landscape) and (max-width:1100px) and (max-height:300px) {
 body#top[data-page='play'].phone-match-active #gameover-modal > .modal-card {
  grid-template-rows:14px auto auto auto auto auto 44px;gap:4px 14px;
  padding:8px 12px!important;overflow:hidden!important;
 }
 body#top[data-page='play'].phone-match-active #go-title {line-height:14px;}
 body#top[data-page='play'].phone-match-active #go-winner {margin-top:4px;}
 body#top[data-page='play'].phone-match-active #go-stats {min-height:88px;padding:6px;gap:4px;}
 body#top[data-page='play'].phone-match-active #go-stats .go-stat-box {padding:2px 3px;}
 body#top[data-page='play'].phone-match-active #go-stats .go-stat-mvp {padding-top:4px;margin-top:0;}
 body#top[data-page='play'].phone-match-active #go-stats .stat-lbl {margin-top:2px;}
 body#top[data-page='play'].phone-match-active #go-ready-container {padding:2px 8px;}
 body#top[data-page='play'].phone-match-active #go-ready-container .ready-player-badge {padding:0 6px;line-height:12px;}
 body#top[data-page='play'].phone-match-active #gameover-modal :is(#btn-new-game,#btn-go-exit) {
  height:44px;min-height:44px;justify-content:center;text-align:center;white-space:normal;
 }
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active #match-intro-modal > .modal-card {position:relative;}
 body#top[data-page='play'].phone-match-active #match-intro-modal .modal-label {padding-right:40px;}
 body#top[data-page='play'].phone-match-active .phone-match-intro-close {display:block;position:absolute;top:2px;right:4px;width:44px;height:44px;min-width:44px;min-height:44px;background:transparent;border:0;border-radius:8px;color:var(--phone-ink);font:400 26px/1 Inter,sans-serif;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner[style*='flex'] {position:fixed;top:calc(61px + var(--phone-safe-top))!important;left:var(--phone-board-start);right:auto;min-height:3px;height:3px;padding:0;border:0;border-radius:2px;overflow:hidden;background:var(--phone-line);}
 body#top[data-page='play'].phone-match-active[data-phone-active='p2'] #online-turn-status-banner[style*='flex'] {left:auto;right:calc(var(--phone-controls-end) + 52px);}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner .turn-pill-content {display:none!important;}
 body#top[data-page='play'].phone-match-active #online-turn-status-banner .turn-rope-bar {height:3px;bottom:0;}
}

/* A battle replaces the side HUD, never the board's geometry. */
@media (orientation:landscape) and (max-width:1100px) and (max-height:599px) {
 body#top[data-page='play'].phone-match-active {
  --phone-combat-height:min(clamp(192px,60dvh,270px),calc(100dvh - var(--phone-safe-top) - var(--phone-footer-inset) - var(--phone-action-height) - 48px));
  --phone-combat-top:max(calc(8px + var(--phone-safe-top)),calc((100dvh + var(--phone-safe-top) - var(--phone-safe-bottom) - var(--phone-combat-height)) / 2 - 18px));
  --phone-combat-bottom:auto;
  --phone-combat-width:calc(var(--phone-reserve-width) + 24px);
  --phone-battle-size:min(clamp(76px,14vw,146px),calc(var(--phone-combat-height) - 126px),calc(var(--phone-combat-width) - 16px));
  --phone-result-accent:#e5bc70;
  --phone-result-max-width:min(540px,calc(100vw - 2 * (max(var(--phone-dock-left),var(--phone-dock-right)) + var(--phone-menu-size) + var(--phone-footer-control-gap))));
 }
 body#top[data-page='play'].phone-match-active.combat-winner-p1 {--phone-result-accent:var(--phone-azure);}
 body#top[data-page='play'].phone-match-active.combat-winner-p2 {--phone-result-accent:var(--phone-violet);}
 html[data-theme='light'] body#top[data-page='play'].phone-match-active {--phone-result-accent:#896014;}
 html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-winner-p1 {--phone-result-accent:var(--phone-azure);}
 html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-winner-p2 {--phone-result-accent:var(--phone-violet);}
 body#top[data-page='play'].phone-match-active :is(#board-col,#hex-board) {
  transform:none!important;
  transition:none!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .side-stash {
  top:var(--phone-combat-top)!important;bottom:auto!important;
  height:var(--phone-combat-height)!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active :is(#stash-panel-p1,#stash-panel-p2).phone-side-left {
  left:max(calc(var(--phone-safe-left) + 2px),calc(var(--phone-reserve-left) - (var(--phone-combat-width) - var(--phone-reserve-width)) / 2))!important;right:auto!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active :is(#stash-panel-p1,#stash-panel-p2).phone-side-right {
  right:max(calc(var(--phone-safe-right) + 2px),calc(var(--phone-reserve-right) - (var(--phone-combat-width) - var(--phone-reserve-width)) / 2))!important;left:auto!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active :is(.bar-left,.bar-right,.phone-reserve-toggle,.phone-match-status,#phone-reference-toggle,#tutorial-banner,#online-turn-banner-container,#online-turn-status-banner,#hotseat-momentum-banner),
 body#top[data-page='play'].phone-match-active.combat-active #action-bar .bar-center {
  display:none!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell,
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) {
  display:flex!important;flex-direction:column;align-items:center;justify-content:center!important;
  gap:8px;padding:20px 4px 36px;
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .cb-battle-die-pill {
  position:absolute!important;inset:0 auto auto 50%!important;transform:translateX(-50%)!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget,
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .bg3-battle-die-widget {
  flex:0 0 auto;width:100%;height:calc(var(--phone-battle-size) + 36px)!important;
  min-height:calc(var(--phone-battle-size) + 36px)!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active :is(.bg3-die-container,.bg3-3d-canvas,.bg3-die-body),
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked .bg3-die-container {
  flex:0 0 auto;width:var(--phone-battle-size)!important;height:var(--phone-battle-size)!important;
  max-width:none;max-height:none;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked :is(.bg3-3d-canvas,.bg3-die-body) {
  width:100%!important;height:100%!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-prompt-badge,
 body#top[data-page='play'].phone-match-active.combat-active .bg3-battle-die-widget.is-locked .bg3-prompt-badge {
  display:flex!important;justify-content:center;min-height:28px;line-height:16px;margin:6px auto 0!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-die-face-content svg {
  width:clamp(54px,8vw,78px);height:clamp(54px,8vw,78px);
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-desc,
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) .bg3-effect-desc {
  position:absolute;inset:auto 4px 5px;width:calc(100% - 8px);max-height:none;
  overflow:visible;text-align:center;
 }
 body#top[data-page='play'].phone-match-active.combat-active #action-bar {
  inset:auto auto var(--phone-action-bottom) 50%;transform:translateX(-50%)!important;
  width:min(460px,var(--phone-result-max-width));min-width:0;max-width:var(--phone-result-max-width);
  height:auto;min-height:62px;padding:8px 10px 8px 18px;box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;gap:14px;
  border:1px solid color-mix(in srgb,var(--phone-result-accent) 48%,transparent)!important;
  border-image:none!important;border-radius:12px;
  background:linear-gradient(115deg,color-mix(in srgb,var(--phone-result-accent) 10%,#120d2275),#140d216b)!important;
  box-shadow:0 5px 20px #0003,inset 0 1px color-mix(in srgb,var(--phone-result-accent) 16%,transparent)!important;
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
 }
 body#top[data-page='play'].phone-match-active.combat-active #action-bar .bar-center-container {
  flex:1 1 auto!important;min-width:0;height:100%;align-items:center;justify-content:center;
 }
 body#top[data-page='play'].phone-match-active.combat-active #combat-result-container {
  flex-direction:column!important;align-items:center;justify-content:center;
  width:auto;min-width:0;gap:3px;text-align:center;
 }
 body#top[data-page='play'].phone-match-active.combat-active #cb-outcome {
  color:color-mix(in srgb,var(--phone-result-accent) 74%,var(--phone-ink))!important;
  font:800 clamp(10px,1.3vw,12px)/1.25 Orbitron,sans-serif!important;
  letter-spacing:.6px!important;text-shadow:0 1px 2px #100919cc;overflow:visible;white-space:normal!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active #combat-accept-countdown {
  color:var(--phone-ink);font:500 10px/14px Inter,sans-serif;letter-spacing:0;
 }
 body#top[data-page='play'].phone-match-active.combat-active #btn-combat-done {
  flex:0 0 auto;align-self:center;min-width:88px!important;min-height:44px;height:44px;
  padding:5px 16px!important;margin:0!important;
  border:1px solid color-mix(in srgb,var(--phone-result-accent) 60%,transparent)!important;
  border-radius:8px;clip-path:none;
  background:linear-gradient(145deg,color-mix(in srgb,var(--phone-result-accent) 24%,var(--phone-surface)),color-mix(in srgb,var(--phone-result-accent) 10%,var(--phone-surface)))!important;
  color:var(--phone-ink)!important;box-shadow:inset 0 1px #ffffff14!important;
  font:700 11px/1.2 Orbitron,sans-serif!important;letter-spacing:.25px!important;text-transform:none;
 }
 body#top[data-page='play'].phone-match-active.combat-active #btn-combat-done:enabled:hover {
  border-color:var(--phone-result-accent)!important;
  background:color-mix(in srgb,var(--phone-result-accent) 30%,var(--phone-surface))!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active #btn-combat-done:is(:disabled,[data-combat-accepted='true']) {
  opacity:.65!important;background:color-mix(in srgb,var(--phone-result-accent) 8%,var(--phone-surface))!important;
  box-shadow:none!important;
 }
 body#top[data-page='play'].phone-match-active.combat-active #evade-decision-container {
  justify-content:center!important;align-items:center!important;
  gap:10px!important;padding:0 4px;box-sizing:border-box;
 }
 body#top[data-page='play'].phone-match-active.combat-active #evade-decision-container .btn {
  flex:0 1 auto;min-width:120px;max-width:48%;margin:0!important;
  padding:5px 14px!important;text-align:center;
 }
 body#top[data-page='play'].phone-match-active.combat-active:has(#evade-decision-container[style*='flex']) #action-bar {
  width:min(440px,var(--phone-result-max-width));min-width:0;min-height:var(--phone-action-height);height:var(--phone-action-height);padding:0;
  background:transparent!important;border-color:transparent!important;box-shadow:none!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
 }
 html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active #action-bar {
  background:linear-gradient(115deg,color-mix(in srgb,var(--phone-result-accent) 8%,#fffafc99),#fffafc80)!important;
 }
 html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active #cb-outcome {color:var(--phone-result-accent)!important;text-shadow:none;}
 html[data-theme='light'] body#top[data-page='play'].phone-match-active.combat-active:has(#evade-decision-container[style*='flex']) #action-bar {background:transparent!important;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:350px) {
 body#top[data-page='play'].phone-match-active {
  --phone-battle-size:min(clamp(72px,15vw,128px),calc(var(--phone-combat-height) - 126px),calc(var(--phone-combat-width) - 16px));
 }
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell,
 body#top[data-page='play'].phone-match-active.combat-active .combat-matrix-cell:has(.bg3-battle-die-widget.is-locked) {
  gap:4px;padding-top:20px;padding-bottom:30px;
 }
 body#top[data-page='play'].phone-match-active.combat-active .bg3-effect-text {font-size:10px!important;line-height:1.25!important;}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:300px) {
 body#top[data-page='play'].phone-match-active {
  --phone-combat-height:calc(100dvh - var(--phone-safe-top) - var(--phone-footer-inset) - var(--phone-action-height) - 26px);
  --phone-combat-top:calc(8px + var(--phone-safe-top));
 }
}
