/* Gameplay-only full-window composition. The lobby and all dialogs keep their
   existing styles. Controls overlay the arena; no layout space is reserved. */
body.game-running {
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body.game-running #game-stage {
  position: fixed;
  inset: auto;
  left: var(--game-viewport-left, 0px);
  top: var(--game-viewport-top, 0px);
  width: var(--game-viewport-width, 100%);
  height: 100vh;
  height: var(--game-viewport-height, 100dvh);
  min-width: 0;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}
body.game-running .standard-stage {
  --game-safe-top: env(safe-area-inset-top, 0px);
  --game-safe-right: env(safe-area-inset-right, 0px);
  --game-safe-bottom: env(safe-area-inset-bottom, 0px);
  --game-safe-left: env(safe-area-inset-left, 0px);
  --hud-edge: 8px;
  --control-edge: 16px;
  --joystick-size: 156px;
  --bomb-size: 88px;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  isolation: isolate;
  background: #dbeee2;
}
body.game-running .standard-stage #view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  display: block;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  z-index: 0;
  touch-action: none;
}
body.game-running .standard-top {
  position: absolute;
  top: calc(var(--hud-edge) + env(safe-area-inset-top, 0px));
  left: calc(var(--hud-edge) + env(safe-area-inset-left, 0px));
  right: calc(var(--hud-edge) + env(safe-area-inset-right, 0px));
  bottom: auto;
  height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 0;
  border: 0;
  color: #fff;
  background: none;
  z-index: 6;
  pointer-events: none;
}
body.game-running .standard-identity {
  position: relative;
  width: min(240px, calc(50% - 54px));
  min-width: 0;
  flex: 0 1 auto;
}
body.game-running .hud-chips { display: flex; align-items: flex-start; gap: 5px; }
body.game-running .chip-face,
body.game-running .clock-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid #ffffff80;
  border-radius: 18px;
  color: #fff;
  background: #142333d1;
  box-shadow: 0 2px 7px #08132426;
  white-space: nowrap;
}
body.game-running .chip-label { font-size: 9px; font-weight: 700; line-height: 1; }
body.game-running .chip-face b { font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
body.game-running .score-chip .chip-face b { color: #ffe5a4; }
body.game-running .chip-chevron { font-size: 14px; line-height: 1; }
body.game-running .alive-chip { gap: 5px; padding-inline: 8px; }
body.game-running .alive-chip svg { width: 13px; height: 14px; fill: currentColor; flex: 0 0 auto; }
body.game-running .match-details { position: relative; pointer-events: auto; }
body.game-running .score-chip {
  display: block;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
}
body.game-running .score-chip::-webkit-details-marker { display: none; }
body.game-running .match-details[open] .chip-chevron { transform: rotate(180deg); }
body.game-running .match-detail-panel {
  position: absolute;
  top: 48px;
  left: 0;
  width: min(252px, calc(var(--game-viewport-width, 100vw) - 32px));
  padding: 7px;
  border: 1px solid #ffffff80;
  border-radius: 12px;
  background: #142333eb;
  box-shadow: 0 5px 18px #08132433;
  color: #fff;
}
body.game-running .match-detail-panel #roster {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  width: 100%;
  max-height: min(240px, calc(var(--game-viewport-height, 100dvh) - 124px));
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
}
body.game-running .match-detail-note {
  margin: 0 0 6px;
  color: #fff;
  font-size: 9px;
  line-height: 12px;
}
/* Paused score inspection is scrollable and stays above the touch joystick. */
body.game-running.is-touch .match-detail-panel #roster {
  max-height: clamp(40px, calc(var(--game-viewport-height, 100dvh) - var(--game-safe-top, 0px) - var(--game-safe-bottom, 0px) - 242px), 160px);
}
body.game-running .match-detail-panel .standard-player {
  min-width: 0;
  padding: 7px 8px;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 3px 6px;
  border: 1px solid #ffffff30;
  border-radius: 7px;
  color: #fff;
  background: #ffffff0d;
  box-shadow: none;
  font-size: 11px;
  line-height: 1.25;
}
body.game-running .match-detail-panel .standard-player.you { border-color: #ffe5a499; background: #ffe5a415; }
body.game-running .match-detail-panel .standard-player i { width: 9px; height: 9px; margin: 0; box-shadow: none; }
body.game-running .match-detail-panel .standard-player b { color: #ffe5a4; font-size: 15px; }
body.game-running .match-detail-panel .player-state { font-size: 8px; color: #bdeaba; }
body.game-running .match-detail-panel .standard-player.out .player-state { color: #ffc0cf; }
body.game-running .match-detail-panel .player-power { font-size: 8px; color: #d9e1ed; }
body.game-running #power-stats {
  position: absolute;
  top: 34px;
  left: 3px;
  width: 100%;
  margin: 0;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 11px;
  text-shadow: 0 1px 3px #102532, 0 0 2px #102532;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
body.game-running .standard-top .standard-clock {
  position: absolute;
  left: 50%;
  top: 0;
  width: 88px;
  display: grid;
  justify-items: center;
  gap: 4px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
body.game-running .clock-face { width: 88px; gap: 5px; padding: 3px 8px; }
body.game-running .clock-face svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
body.game-running .standard-top #countdown {
  position: static;
  margin: 0;
  padding: 0;
  transform: none;
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
  background: none;
  box-shadow: none;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}
body.game-running #round-label {
  display: block;
  max-width: 112px;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 11px;
  white-space: nowrap;
  text-shadow: 0 1px 3px #102532, 0 0 2px #102532;
}
body.game-running .standard-top nav { display: flex; gap: 4px; pointer-events: auto; flex: 0 0 auto; }
body.game-running .standard-top nav button,
body.game-running .standard-top nav #again,
body.game-running .standard-top nav #pause-open {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #ffffff90;
  border-radius: 13px;
  background: #142333bc;
  color: #fff;
  box-shadow: 0 2px 6px #08132426;
  touch-action: manipulation;
}
body.game-running .standard-top nav #pause-open { background: #fff7dfeb; border-color: #fff; color: #28384b; }
body.game-running .standard-top nav button:hover { background: #2f4567e6; color: #fff; }
body.game-running .standard-top nav button:active { transform: translateY(1px); }
body.game-running .standard-top nav button:disabled { opacity: .58; cursor: default; }
body.game-running .standard-top nav svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.game-running .standard-top .pause-symbol { width: 13px; height: 17px; border-left-width: 4px; border-right-width: 4px; }
body.game-running #fullscreen-toggle[data-fullscreen="active"] { background: #376354d9; }
body.game-running #spectator-label {
  top: calc(60px + env(safe-area-inset-top, 0px));
  bottom: auto;
  max-width: calc(100% - 40px);
  z-index: 5;
  padding: 4px 10px;
  font-size: 10px;
  line-height: 1.4;
  background: #142333bf;
  color: #fff4bf;
  border: 1px solid #ffffff44;
  border-radius: 14px;
}
body.game-running #round-result { z-index: 9; max-width: calc(100% - 36px); }
body.game-running #game-alert,
body.game-running #appearance-notice {
  position: absolute;
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  padding: 4px 9px;
  border: 1px solid #ffffff44;
  border-radius: 10px;
  background: #142333b8;
  color: #fff;
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  pointer-events: none;
}
body.game-running #game-alert { bottom: calc(36px + env(safe-area-inset-bottom, 0px)); background: #542338e8; border-color: #ffc2d1; }
body.game-running #game-alert:empty,
body.game-running #appearance-notice:empty { display: none; }
body.game-running.is-touch #game-alert,
body.game-running.is-touch #appearance-notice {
  max-width: min(420px, calc(100% - 2 * (var(--joystick-size) + var(--control-edge) + max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)) + 12px)));
}

body.game-running .game-sr-only {
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  min-width: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
/* Device classification, not viewport width, controls touch UI visibility. */
body.game-running .standard-controls { display: none; }
body.game-running.is-touch .standard-controls {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 4;
  margin: 0;
  padding: 0;
  pointer-events: none;
}
body.game-running #joystick {
  position: absolute;
  left: calc(var(--control-edge) + env(safe-area-inset-left, 0px));
  bottom: calc(var(--control-edge) + env(safe-area-inset-bottom, 0px));
  width: var(--joystick-size);
  height: var(--joystick-size);
  border: 2px solid #edf4ffad;
  border-radius: 50%;
  background: #1322393d;
  box-shadow: 0 0 0 2px #10223855, inset 0 0 0 5px #eef4ff12, 0 3px 10px #10223824;
  outline-offset: 5px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  cursor: grab;
}
body.game-running #joystick::before { content: ""; position: absolute; inset: 19%; border: 1px solid #edf4ff26; border-radius: 50%; pointer-events: none; }
body.game-running #joystick[data-active="true"] { background: #142c4852; border-color: #fff; cursor: grabbing; }
body.game-running #joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffffaa, #cad2ddaa);
  box-shadow: 0 3px 8px #06132566, inset 0 -3px 0 #98a4b44d;
  pointer-events: none;
  will-change: transform;
}
body.game-running .joystick-arrow { position: absolute; width: 0; height: 0; border: 6px solid transparent; opacity: .8; pointer-events: none; }
body.game-running .arrow-up { left: calc(50% - 6px); top: 5px; border-bottom: 8px solid #eef4ff; border-top: 0; }
body.game-running .arrow-right { top: calc(50% - 6px); right: 5px; border-left: 8px solid #eef4ff; border-right: 0; }
body.game-running .arrow-down { left: calc(50% - 6px); bottom: 5px; border-top: 8px solid #eef4ff; border-bottom: 0; }
body.game-running .arrow-left { top: calc(50% - 6px); left: 5px; border-right: 8px solid #eef4ff; border-left: 0; }
body.game-running #joystick[data-direction="up"] .arrow-up,
body.game-running #joystick[data-direction="right"] .arrow-right,
body.game-running #joystick[data-direction="down"] .arrow-down,
body.game-running #joystick[data-direction="left"] .arrow-left { opacity: 1; filter: drop-shadow(0 0 4px #fff); }
body.game-running .standard-controls #bomb {
  position: absolute;
  top: auto;
  right: calc(var(--control-edge) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--control-edge) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--bomb-size);
  height: var(--bomb-size);
  min-width: 76px;
  min-height: 76px;
  margin: 0;
  padding: 7px;
  transform: none;
  border: 3px solid #fff3ec;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 20%, #ff8a93ed, #cd344ed6 66%, #9b2444c9);
  box-shadow: 0 0 0 3px #25374d99, inset 0 0 0 3px #65162c66, 0 4px 12px #10223833;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  z-index: 4;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
body.game-running .standard-controls #bomb small { display: block; font-size: 10px; line-height: 1.2; font-weight: 800; color: #fff; letter-spacing: 1px; }
body.game-running .bomb-icon { width: 39px; height: 39px; overflow: visible; fill: #fff8f0; }
body.game-running .bomb-icon path { fill: none; stroke: #fff8f0; stroke-width: 3; stroke-linecap: round; }
body.game-running .bomb-icon .bomb-spark { stroke-width: 2; }
body.game-running .bomb-icon .bomb-shine { stroke: #c64256; stroke-width: 2; }
body.game-running .standard-controls #bomb:active { transform: scale(.96); background: #e54b63e8; }
body.game-running #game-stage button:focus-visible,
body.game-running #joystick:focus-visible,
body.game-running .score-chip:focus-visible { outline: 3px solid #ffe89a; outline-offset: 3px; }
body.game-running #view:focus-visible { outline: 2px solid #ffe89a88; outline-offset: -2px; }
@media (max-height: 430px) {
  body.game-running .standard-stage { --control-edge: 12px; --joystick-size: 140px; --bomb-size: 80px; }
  body.game-running #power-stats { font-size: 8px; }
}
@media (max-height: 340px) {
  body.game-running .standard-stage { --control-edge: 8px; --bomb-size: 76px; }
}
/* Very narrow desktop windows remain playable. Touch phones retain the
   existing portrait/orientation gate; these rules do not change that flow. */
@media (max-width: 520px) {
  body.game-running .standard-identity { width: min(132px, calc(50% - 51px)); }
  body.game-running .hud-chips { flex-wrap: wrap; gap: 0 4px; }
  body.game-running .score-chip { min-height: 44px; padding-bottom: 9px; }
  body.game-running .chip-face { min-height: 26px; padding: 3px 7px; }
  body.game-running #power-stats { position: static; width: 132px; max-width: 100%; margin-top: 4px; font-size: 8px; }
  body.game-running .standard-top nav { display: grid; grid-template-columns: repeat(2, 44px); gap: 4px; }
  body.game-running .standard-top #pause-open { grid-column: 2; grid-row: 1; }
  body.game-running .standard-top #fullscreen-toggle { grid-column: 1; grid-row: 1; }
  body.game-running .standard-top #characters-open { grid-column: 1; grid-row: 2; }
  body.game-running .standard-top #again { grid-column: 2; grid-row: 2; }
  body.game-running #round-label { font-size: 7px; }
  body.game-running .match-detail-panel { top: 82px; }
}

/* v7: real grid columns allocate room to all HUD groups, including cutouts. */
body.game-running .standard-top{display:grid;grid-template-columns:minmax(0,1fr) 88px minmax(188px,1fr);gap:8px}
body.game-running .standard-identity{width:100%;max-width:240px}
body.game-running .standard-top .standard-clock{position:static;transform:none;width:88px;justify-self:center}
body.game-running .standard-top nav{justify-self:end}
@media(max-width:740px){body.game-running .standard-top{grid-template-columns:minmax(0,1fr) 88px 188px;gap:6px}body.game-running .chip-face{padding-inline:7px;gap:4px}body.game-running .alive-chip .chip-label{display:none}body.game-running .chip-face b{font-size:13px}body.game-running .hud-chips{gap:4px}}
@media(max-width:520px){body.game-running .standard-top{grid-template-columns:minmax(0,1fr) 88px 92px;gap:6px}body.game-running .standard-identity{width:100%;max-width:132px}}
@media(max-height:280px){body.game-running .standard-stage{--joystick-size:128px}body.game-running #joystick-knob{width:48px;height:48px}}
/* Transient fullscreen capability notice, never a fake native-fullscreen badge. */
body.game-running #mobile-fullscreen-note{position:absolute;left:50%;bottom:calc(62px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:6;max-width:min(330px,calc(100% - 2 * (var(--joystick-size) + var(--control-edge) + max(env(safe-area-inset-left,0px),env(safe-area-inset-right,0px)))));width:max-content;margin:0;padding:5px 9px;border:1px solid #ffffff80;border-radius:8px;background:#142333dc;color:#fff;font-size:9px;line-height:1.4;text-align:center;pointer-events:none}
body.game-running:not(.is-touch) #mobile-fullscreen-note{display:none}
