/* Portrait reserves a viewport-sized map and keeps its permanent controls outside it. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
.mobile-arena-menu,.mobile-arena-join{display:none}
.map-controls .control-icon{display:none;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.arena-layout-options{display:flex;flex-wrap:wrap;gap:8px;margin:20px 0 0;padding:0;border:0}
.arena-layout-options legend{font-size:.875rem;line-height:1.5;margin-bottom:10px}
.arena-layout-options button{border:1px solid var(--pf-line);border-radius:8px;background:transparent;color:var(--pf-text);padding:10px 12px;min-height:44px;font:inherit;font-size:.875rem}
.arena-layout-options button[aria-pressed=true]{border-color:var(--blue);background:var(--surface2)}
@media(max-width:800px) and (orientation:portrait){
  body{min-width:0;overflow-y:auto}
  .app-shell{height:100dvh;min-height:0;width:100%;min-width:0;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto auto auto auto minmax(180px,1fr) auto;padding-bottom:env(safe-area-inset-bottom)}
  .app-shell>*{min-width:0;max-width:100%}
  .arena-header{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 12px;padding:6px 10px;align-items:stretch}
  .team-score{display:flex;flex-wrap:wrap;gap:0 8px;min-width:0;align-items:center;justify-content:flex-start;line-height:1.4}
  .team-score.blue{grid-column:1;grid-row:1}
  .team-score.red{grid-column:2;grid-row:1;text-align:right}
  .team-score>div{order:0;flex-basis:100%;min-width:0}
  .team-score strong{font-size:.875rem;line-height:1.5;letter-spacing:0;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}
  .team-score span{display:block;font-size:.75rem;line-height:1.4;margin:0;color:var(--muted);overflow-wrap:anywhere}
  .team-score b{order:1;font-size:1.375rem;line-height:1.3;margin:0;font-variant-numeric:tabular-nums;white-space:nowrap}
  .team-score small{order:2;font-size:.875rem;line-height:1.5;margin:0;white-space:nowrap}
  .team-score.blue small{margin-left:auto}
  .team-score.red small{order:1;margin-right:auto}
  .team-score.red b{order:2;margin:0;text-align:right}
  .match-center{grid-column:1/-1;grid-row:2;min-width:0;max-width:none;padding:5px 0 0;border-inline:0;border-top:1px solid var(--line);display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);grid-template-areas:'phase locked' 'phase live';column-gap:10px;row-gap:2px;align-items:center;text-align:left}
  .phase-line{grid-area:phase;display:flex;justify-content:flex-start;align-content:center;align-items:center;gap:6px!important;flex-wrap:wrap;max-width:none;min-width:0}
  .phase-line>span:first-child{font-size:.75rem;letter-spacing:0;padding:4px 6px}
  .phase-line strong{font-size:1.375rem;line-height:1.4;white-space:nowrap}
  .phase-line #roundLabel{font-size:.75rem;line-height:1.5;width:100%;white-space:normal;overflow-wrap:anywhere}
  .phase-line #finalLabel{font-size:.75rem;line-height:1.5;width:auto;letter-spacing:0}
  .locked-line{grid-area:locked;justify-content:flex-end;align-items:center;gap:4px;flex-wrap:wrap;margin:0;font-size:.875rem;line-height:1.4;white-space:normal;text-align:right;min-width:0}
  .locked-line b{font-size:1rem;line-height:1.4;white-space:nowrap}
  .locked-line small{display:none}
  .live-line{grid-area:live;justify-content:flex-end;text-align:right;min-width:0;font-size:.75rem;line-height:1.5;margin:0;white-space:normal;overflow-wrap:anywhere}
  .match-center .live-line span{display:inline;min-width:0}
  .territory-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px;padding:5px 10px}
  .territory-track{grid-column:1/-1;width:100%;min-width:0;height:5px}
  .battle-stage{grid-column:1/-1;justify-content:flex-start;flex-wrap:wrap;white-space:normal;min-width:0;gap:4px 8px;padding:4px 7px}
  .battle-stage span,.battle-stage small{font-size:.75rem;line-height:1.5;min-width:0;overflow-wrap:anywhere}
  .territory-row>span,.territory-row .trend-text{font-size:.75rem;line-height:1.5;white-space:normal;overflow-wrap:anywhere;min-width:0;padding:0;border:0;text-align:left}
  .territory-row .trend-text{text-align:right}
  .arena-toolbar{grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:5px 10px;align-items:center;position:relative}
  .arena-toolbar .brand-chip{display:none}
  .brand-chip>span{display:none}
  .mobile-arena-menu,.mobile-arena-join{display:block;border:1px solid var(--line);border-radius:8px;min-height:44px;padding:8px 12px;background:var(--surface2);font-size:.875rem;line-height:1.4;min-width:0;white-space:normal}
  .mobile-arena-join{grid-column:1/-1;grid-row:2;justify-self:stretch;background:#386bea;border-color:#4c7af1;color:white;font-weight:750}
  .mobile-arena-menu{grid-column:2;grid-row:1}
  .mobile-arena-menu[aria-expanded=true]{border-color:var(--blue)}
  .round-status{grid-column:1;grid-row:1;min-height:0;min-width:0}
  .selection-hud,.result-ribbon{min-width:0;padding:5px 7px;text-align:left;line-height:1.4}
  .selection-hud>span,.result-ribbon>span{font-size:.75rem;letter-spacing:.02em;line-height:1.5}
  .selection-hud strong{justify-content:flex-start;font-size:.875rem;line-height:1.5;margin:3px 0;min-width:0;overflow-wrap:anywhere}
  .selection-hud small,.result-ribbon>small{font-size:.75rem;line-height:1.4;white-space:normal;overflow-wrap:anywhere}
  .result-ribbon>strong{font-size:.875rem;line-height:1.4;overflow-wrap:anywhere}
  .result-numbers{flex-wrap:wrap;justify-content:flex-start;gap:6px 12px;font-size:.875rem;line-height:1.5;min-width:0}
  .result-numbers>*{min-width:0;overflow-wrap:anywhere}
  .arena-toolbar .utility-bar{display:none;position:absolute;inset:auto 12px auto 12px;top:calc(100% + 4px);z-index:25;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:12px;max-height:60dvh;overflow-y:auto;overflow-x:visible;background:var(--surface);box-shadow:var(--shadow)}
  .arena-toolbar.utility-open .utility-bar{display:grid}
  .utility-bar button,.utility-bar .lab-link{min-width:0;min-height:44px;padding:10px 8px;font-size:.875rem;line-height:1.5;white-space:normal;overflow-wrap:anywhere;text-align:center}
  .utility-bar .prototype-pill{grid-column:1/-1;font-size:.75rem;line-height:1.5;white-space:normal}
  .transition-bar{grid-row:6;margin:4px 10px;padding:6px;min-width:0}
  .transition-bar strong{white-space:normal;overflow:visible;font-size:.875rem;line-height:1.5;overflow-wrap:anywhere}
  .transition-bar span,.transition-bar small{font-size:.75rem;line-height:1.5}
  .transition-bar>button{min-height:44px;min-width:44px;font-size:.875rem}
  .arena-stage{grid-row:7;margin:4px 8px;border:0;border-radius:10px;height:auto;min-height:0;min-width:0}
  .arena-dock{display:contents}
  .arena-dock .map-controls{grid-row:8;display:flex;gap:4px;position:static;transform:none;width:auto;max-width:none;min-width:0;padding:4px;margin:0 8px 4px}
  .arena-dock .map-controls button{display:grid;place-items:center;flex:1 1 0;width:0;min-width:44px;min-height:44px;padding:6px 2px;font-size:.75rem;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
  .map-controls .control-icon{display:block}
  .map-controls .control-label{display:none}
  .arena-dock .map-controls #zoomIn,.arena-dock .map-controls #zoomOut{font-size:1.25rem}
  .arena-dock .map-controls .analysis-toggle{min-width:44px;font-size:.875rem;min-height:44px;white-space:normal}
  .map-controls .analysis-toggle[aria-pressed=true]{border-color:var(--blue);color:var(--blue)}
  .arena-dock .rights-hud{grid-row:4;display:grid;grid-template-columns:auto auto minmax(0,1fr);gap:3px 8px;width:auto;max-width:none;min-width:0;position:static;justify-self:stretch;padding:5px 8px;margin:4px 10px 0}
  .rights-hud>span{grid-column:1;grid-row:1;font-size:.75rem;letter-spacing:0;line-height:1.5}
  .rights-hud>strong{grid-column:2;grid-row:1;justify-self:end;font-size:1.25rem;line-height:1.3;margin:0;white-space:nowrap;font-variant-numeric:tabular-nums}
  .rights-hud>div{display:none}
  .rights-hud small{grid-column:3;grid-row:1;font-size:.75rem;line-height:1.4;min-width:0;overflow-wrap:anywhere;text-align:right;align-self:center}
  .rights-hud button{grid-column:1/-1;grid-row:2;min-height:44px;min-width:0;margin:0;padding:6px;font-size:.875rem;line-height:1.4;white-space:normal;overflow-wrap:anywhere;touch-action:manipulation}
  .rights-hud:not([data-empty=true]) button{display:none}
  .arena-dock .legend{grid-row:5;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:auto;min-width:0;margin:0 10px;padding:4px 0;gap:6px;border:0;background:transparent;white-space:normal;font-size:.75rem;line-height:1.5}
  .legend span{min-width:0;gap:4px;align-items:center;overflow-wrap:anywhere}
  .legend i{flex:none;width:8px;height:8px}
  .cell-sheet{left:8px;right:8px;bottom:8px;transform:none;width:auto;max-height:calc(100% - 16px);grid-template-columns:32px minmax(0,1fr);gap:8px;padding:12px 38px 12px 12px;min-width:0}
  .sheet-icon{width:32px;height:32px}
  .sheet-icon svg{width:24px;height:24px}
  .sheet-copy{min-width:0}
  .sheet-copy strong,.sheet-copy small{overflow-wrap:anywhere;line-height:1.5}
  .sheet-copy small{font-size:.875rem}
  .sheet-close{width:32px;height:32px;right:3px;top:3px}
  .sheet-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;min-width:0}
  .sheet-actions button{min-width:0;min-height:44px;padding:10px 8px;font-size:.875rem;line-height:1.5;white-space:normal;touch-action:manipulation}
  .sheet-actions svg{flex:none}
  .cell-result{min-width:0;width:max-content;max-width:calc(100% - 28px);font-size:.875rem;overflow-wrap:anywhere}
  .modal-backdrop{padding:12px}
  .team-modal{min-width:0;max-height:calc(100dvh - 24px);padding:24px 16px}
  .team-options{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:8px}
  .team-option{min-width:0;padding:18px 8px}
  .team-option span{min-width:0;font-size:1rem;line-height:1.4;letter-spacing:0;overflow-wrap:anywhere}
  .team-modal button,.choice-confirm button{max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere;line-height:1.5}
  .welcome-overlay>div{max-width:calc(100% - 32px);min-width:0}
  .welcome-overlay span{font-size:clamp(1.75rem,7vw,3rem);line-height:1.4;letter-spacing:0;overflow-wrap:anywhere}
  .platform-dialog{min-width:0;max-width:calc(100% - 16px);overflow-wrap:anywhere}
  .platform-dialog input,.platform-dialog select{font-size:1rem;min-width:0}
  .relay-actions input{font-size:1rem}
  .toast{font-size:.875rem;line-height:1.5;overflow-wrap:anywhere}
}
@media(max-width:800px) and (orientation:portrait){
  body:not(.team-panel-open) .app-shell{grid-template-rows:auto auto auto auto minmax(180px,1fr) auto auto auto}
  body:not(.team-panel-open) .arena-dock .legend{grid-row:7}
  body:not(.team-panel-open) .transition-bar{grid-row:4}
  body:not(.team-panel-open) .arena-stage{grid-row:5}
  body:not(.team-panel-open) .arena-dock .map-controls{grid-row:6}
  body:not(.team-panel-open) .arena-dock .rights-hud{grid-row:8;gap:2px 8px;padding:4px 8px;margin:0 8px 5px;border-radius:8px;border-inline-start-width:2px}
  body:not(.team-panel-open) .arena-dock .rights-hud>span{font-size:10px;line-height:1.3}
  body:not(.team-panel-open) .arena-dock .rights-hud>strong{font-size:20px;line-height:1.2}
  body:not(.team-panel-open) .arena-dock .rights-hud small{font-size:11px;line-height:1.4}
}

/* Upcoming Quick uses its own waiting room, not a running-game HUD. */
.quick-lobby-page{overflow:auto!important;height:auto!important;min-height:100dvh}
.quick-lobby{box-sizing:border-box;max-width:760px;margin:0 auto;padding:clamp(20px,4vw,40px);display:grid;gap:18px;text-align:center}
.quick-lobby .brand-chip{justify-content:center}.quick-lobby h1,.quick-lobby p{margin:0}
.quick-lobby-match{display:flex;align-items:center;justify-content:center;gap:20px;font-size:clamp(24px,5vw,42px);overflow-wrap:anywhere}
#lobbyCountdown{font-size:clamp(36px,6vw,60px);font-variant-numeric:tabular-nums}
.quick-lobby-map{height:clamp(140px,25vh,240px);overflow:hidden;border:1px solid #34445e;border-radius:16px;background:#101d30}
.quick-lobby-map svg{width:100%;height:100%}.quick-lobby-options,.quick-lobby nav{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}
.quick-lobby-options button{flex:1;min-width:120px;min-height:52px;border:2px solid currentColor}.quick-lobby-options .selected{outline:3px solid currentColor;outline-offset:3px}
.quick-lobby #lobbyConfirm[data-team="0"]{background:#2563eb;color:white}.quick-lobby #lobbyConfirm[data-team="1"]{background:#c6385a;color:white}
@media(orientation:landscape) and (max-height:600px){.quick-lobby{gap:12px}.quick-lobby-map{height:140px}}
.transition-bar .next-arena-entry{flex-shrink:0;font-size:14px;min-height:40px;padding:8px 12px;margin-inline-end:36px}
@media(max-width:600px){.transition-bar:has(.next-arena-entry:not([hidden])){flex-wrap:wrap}.transition-bar .next-arena-entry{margin-inline-end:0;width:100%;box-sizing:border-box}}
