@font-face {
  font-family: 'D-DIN';
  src: url(fonts/d-din-regular.woff2?v=1.0.4) format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'D-DIN';
  src: url(fonts/d-din-bold.woff2?v=1.0.4) format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url(fonts/ibm-plex-mono-regular.woff2?v=1.0.4) format('woff2');
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #000;
  --brand-tracking: .3em;
  --icon-scale: 1.25;
  --panel: #080809;
  --recess: #101113;
  --surface: #202125;
  --border: #323438;
  --line: #42454a;
  --muted: #afb1b7;
  --ink: #f0f0fa;
  --accent: #f00;
  --on-accent: #000;
  --accent-edge: #710c0c;
  --accent-tint: color-mix(in srgb, var(--accent) 13%, var(--panel));
  --accent-border: color-mix(in srgb, var(--accent) 50%, var(--border));
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --display: 'D-DIN', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* {
  box-sizing: border-box;
}
img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.45 var(--display);
  -webkit-font-smoothing: antialiased;
}
button,
input {
  font: inherit;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.52;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: inherit;
}
button {
  background: none;
  border: 0;
}
button,
dialog,
input {
  border-radius: 2px;
}
[hidden] {
  display: none !important;
}
#app-shell { display: contents; }
#startup-splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  background: linear-gradient(180deg, #05060788, #03040491 52%, #020303ef),
    url(home-terrain.webp?v=1.0.4) 64% center / cover no-repeat #080909;
  text-align: center;
  color: #f0f0fa;
  font: 700 14px/normal var(--display);
}
.splash-content { grid-row: 2; padding: 24px; }
.splash-mark {
  width: clamp(50px, 7vw, 80px);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  background: var(--accent);
  mask: url(icons/favicon.svg?v=1.0.4) center / contain no-repeat;
}
.splash-title {
  padding-left: .19em;
  font: 700 clamp(24px, min(8vw, 5vh), 36px)/1.05 var(--display);
  letter-spacing: .19em;
}
@media (min-width: 400px) {
  .splash-title { font-size: clamp(36px, 6.4vw, 88px); }
}
.wordmark { white-space: nowrap; }
.wordmark b { color: var(--accent); font-weight: inherit; }
.splash-loading { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 0; color: #c6c6c9; letter-spacing: .08em; }
.splash-version {
  grid-row: 3;
  align-self: end;
  margin: 0 0 max(16px, env(safe-area-inset-bottom));
  color: #c6c6c9;
}
.splash-loading::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .splash-loading::before { animation: splash-pulse 1.3s ease-in-out infinite alternate; }
  @keyframes splash-pulse { to { opacity: .35; } }
}
i {
  display: inline-flex;
  font-style: normal;
  align-items: center;
  justify-content: center;
}
svg {
  display: block;
  flex-shrink: 0;
}
.ui-icon, .rank-insignia {
  width: calc(var(--icon-size, 18px) * var(--icon-scale));
  height: calc(var(--icon-size, 18px) * var(--icon-scale));
}
.mast {
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.mast-inner,
main,
.site-footer > div {
  --page-gutter: clamp(var(--min-page-gutter, 10px), 12.5vw - 39px, 36px);
  width: calc(100% - 2 * var(--page-gutter));
  max-width: var(--desktop-page-width, max(1180px, calc(125dvh + 340px)));
  margin: auto;
}
@media (min-width: 901px) {
  body:has(#battle-screen[hidden]) {
    --desktop-page-width: min(88vw, 1690px);
  }
}
.mast-inner {
  height: 65px;
  display: flex;
  align-items: center;
  gap: var(--nav-gap, 26px);
}
.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  text-decoration: none;
  font: 700 var(--brand-size, clamp(12px, 1.15vw, 16px))/1 var(--display);
  letter-spacing: var(--brand-tracking);
  transform-origin: top left;
  view-transition-name: game-brand;
}
#header-brand { display: flex; align-items: center; }
::view-transition-group(root), ::view-transition-group(game-brand) {
  animation-duration: 460ms;
}
::view-transition-group(game-brand) { animation-timing-function: cubic-bezier(.25,.8,.25,1); }
::view-transition-old(game-brand), ::view-transition-new(game-brand) {
  width: 100%;
  height: 100%;
}
#header-brand .brand::after { content: ''; position: absolute; inset: -10px 0; }
.brand-mark {
  flex: none;
  width: 1.6em;
  aspect-ratio: 30 / 25;
  margin-inline-end: .6em;
  color: var(--accent);
}
.brand-mark svg { width: 100%; height: 100%; }
.mast nav {
  display: flex;
  align-self: stretch;
  margin-inline-start: auto;
  gap: var(--nav-gap, 26px);
}
.nav-link {
  position: relative;
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 14px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  padding: 0 2px;
  border-radius: 0;
}
.nav-link svg {
  --icon-size: 16px;
}
.nav-link:hover,
.account:hover {
  color: var(--ink);
}
.nav-link.current {
  color: var(--accent);
}
.nav-link.current:after {
  content: '';
  position: absolute;
  background: var(--accent);
  height: 2px;
  bottom: 0;
  left: 0;
  right: 0;
}
.account {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  white-space: nowrap;
}
.account:has(#account-symbol:not([hidden])) {
  text-transform: uppercase;
}
.account svg {
  --icon-size: 16px;
}
.callsign {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
#invite-count,
.num-badge {
  border: 1px solid var(--accent-border);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 5px;
  font: 12px/1.5 var(--mono);
}
main {
  padding: 21px 0 10px;
}
.turn-tag,
.capture-title small,
.pill,
.small-label {
  font: 600 11px/1.3 var(--mono);
  letter-spacing: 1.4px;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(295px, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}
.panel {
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.panel-head :is(h1, h2),
.subheading {
  display: flex;
  gap: 10px;
  margin: 0;
  align-items: center;
  font: 700 clamp(22px, 2.4vw, 34px)/1 var(--display);
  text-transform: uppercase;
  letter-spacing: -.018em;
}
.panel-head :is(h1, h2) i {
  color: var(--muted);
}
.panel-head :is(h1, h2) svg {
  --icon-size: 19px;
}
.section-rule,
.page-title::after {
  display: block;
  height: 8px;
  border: 0;
  margin: var(--rule-gap, clamp(8px, 1.5dvh, 14px)) 0;
  background: linear-gradient(90deg, var(--border), var(--accent-border) 42%, var(--accent) 50%, var(--accent-border) 58%, var(--border))
    center / 100% 1px no-repeat;
}
main:has(:is(#account-screen, #guide-screen):not([hidden])) .page-title::after {
  content: '';
  margin-bottom: 0;
}
@property --seat-0-lift {
  syntax: '<number>';
  inherits: true;
  initial-value: 1;
}
@property --seat-1-lift {
  syntax: '<number>';
  inherits: true;
  initial-value: 1;
}
@property --turn-light {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
@property --enemy-pending {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
.board-wrap {
  display: grid;
  position: relative;
}
#enemy-deployment-notice {
  grid-area: 2 / 2;
  align-self: start;
  height: 40%;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
  visibility: hidden;
  opacity: var(--enemy-pending);
}
#enemy-deployment-notice span {
  padding: .38em .72em;
  border: 1px solid #ffffff45;
  border-radius: 3px;
  background: #101314ed;
  color: #f4f4ef;
  font: 700 clamp(16px, 3.4cqw, 28px)/1.1 var(--display);
  letter-spacing: .045em;
  text-transform: uppercase;
}
.board-wrap[data-deployment="waiting"] { --enemy-pending: 1; }
.board-wrap[data-deployment="waiting"] #enemy-deployment-notice { visibility: visible; }
.board-wrap[data-deployment] .opponent-piece {
  --neutral: calc(100% * var(--enemy-pending));
  --face: color-mix(in srgb, var(--army-face), #858b8e var(--neutral));
  --edge: color-mix(in srgb, var(--army-edge), #303438 var(--neutral));
  --hi: color-mix(in srgb, var(--army-hi), #b5babd var(--neutral));
  --shadow: color-mix(in srgb, var(--army-shadow), #43484b var(--neutral));
  --mark: color-mix(in srgb, var(--army-face), #c4c9cc var(--neutral));
}
.board-wrap[data-turn="0"] { --seat-1-lift: 0; }
.board-wrap[data-turn="1"] { --seat-0-lift: 0; }
.board-wrap:is([data-turn="0"], [data-turn="1"]) #board[aria-busy="false"] { --turn-light: 1; }
@media (prefers-reduced-motion: no-preference) {
  .board-wrap[data-deployment="arriving"] { animation: enemy-deployment-reveal 700ms ease-in-out; }
  .board-wrap[data-deployment="arriving"] #enemy-deployment-notice { visibility: visible; }
  @keyframes enemy-deployment-reveal {
    from { --enemy-pending: 1; }
    to { --enemy-pending: 0; }
  }
  .board-wrap { transition: --seat-0-lift 560ms ease-in-out, --seat-1-lift 560ms ease-in-out; }
  #board { transition: --turn-light 220ms ease-in-out; }
}
.coordinates {
  font: var(--coordinate-size)/1 var(--mono);
  color: var(--muted);
}
.cols {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  align-items: end;
  padding: 0 1px var(--coordinate-inset);
  text-align: center;
}
.rows {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  align-items: center;
  text-align: end;
  padding-block: 1px;
  padding-inline-end: var(--coordinate-inset);
}
#board {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  border: 1px solid #a5b0a373;
  box-shadow:
    0 0 0 3px #0c1415,
    0 0 0 var(--frame-width) #47524b;
  aspect-ratio: 1.27;
  background: #53574a;
  isolation: isolate;
}
#board .board-row {
  display: contents;
}
#board::after {
  content: '';
  position: absolute;
  pointer-events: none;
  top: 100%;
  left: -1px;
  right: -1px;
  height: var(--rim-depth);
  background: linear-gradient(#879084 0 1px, #4a554d 1px, #29332f 65%, #151c1a);
  box-shadow: 0 2px 3px #040a0999;
}
.cell {
  position: relative;
  cursor: default;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  background: transparent;
  box-shadow: inset -1px -1px #e9f3e137;
  outline-offset: -2px;
  outline-color: var(--accent);
}
.cell:disabled { opacity: 1; }
.cell:is(.selectable, .destination, .placement-square, .swap-target) { cursor: pointer; }
.cell:is(.destination, .swap-target):hover {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cell.selected {
  z-index: 2;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.cell.placement-square {
  background-color: #4c675331;
}
.cell.placement-square > svg {
  color: #e2e7d298;
  --icon-size: 14px;
  pointer-events: none;
}
.cell.destination {
  background-color: color-mix(in srgb, var(--accent) 48%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.cell:focus-visible {
  z-index: 3;
  outline: 2px dashed white;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 4px #101214;
}
@media (forced-colors: active) {
  .cell.destination { border: 1px solid Highlight; }
}
.piece {
  --lift: var(--seat-0-lift, 1);
  --counter-depth: calc((var(--raised-depth, 3px) + 1px) * var(--lift) - 1px);
  --army-face: var(--seat-0-face);
  --army-edge: var(--seat-0-edge);
  --army-hi: var(--seat-0-hi);
  --army-shadow: var(--seat-0-shadow);
  --face: var(--army-face);
  --edge: var(--army-edge);
  --hi: var(--army-hi);
  --shadow: var(--army-shadow);
  width: 86%;
  height: 84%;
  max-width: 60px;
  position: relative;
  display: grid;
  grid-area: 1 / 1;
  backface-visibility: hidden;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 2px 6px 2px 2px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--edge) 70%, #222923) 0%, #1b2020eb 77%) padding-box;
  pointer-events: none;
  transform: translateY(calc(-1 * var(--counter-depth)));
}
.piece.enemy {
  --lift: var(--seat-1-lift, 1);
  --army-shadow: var(--seat-1-shadow);
  --army-face: var(--seat-1-face);
  --army-edge: var(--seat-1-edge);
  --army-hi: var(--seat-1-hi);
}
.piece:before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 22%;
  height: 2px;
  background: var(--face);
}
.piece-rim {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
}
.piece-rim::before, .piece-rim::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid;
  border-radius: inherit;
}
.piece-rim::before {
  opacity: var(--lift);
  border-color: var(--rim-outline, color-mix(in srgb, var(--hi) 27%, var(--face)));
  box-shadow:
    inset 0 1px #ffffff28,
    inset 0 -2px var(--rim-base, var(--face)),
    0 var(--raised-depth) var(--rim-side, color-mix(in srgb, var(--shadow) 45%, #121919)),
    1px calc(var(--raised-depth) + 2px) 3px #090e0cba;
}
.piece-rim::after {
  opacity: calc(1 - var(--lift));
  border-color: #111813cf #e9eddb6b #eef2e28c #273029cc;
  box-shadow:
    inset 1px 3px 4px #050a08df,
    inset -1px -1px 0 color-mix(in srgb, var(--hi) 28%, transparent);
}
.board-wrap:is([data-turn="0"], [data-turn="1"]) .cell > .piece::after {
  --light: calc(var(--lift) * var(--turn-light));
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--hi);
  border-radius: inherit;
  box-shadow: 0 0 0 1px #141719, inset 0 0 0 1px #141719;
  opacity: calc(.95 * var(--light));
}
@media (prefers-reduced-motion: no-preference) {
  .board-wrap:is([data-turn="0"], [data-turn="1"]) .cell > .piece::after {
    border-color: color-mix(in srgb, var(--hi) 60%, #858984);
    animation: army-turn-pulse 2s ease-in-out infinite both;
    animation-delay: calc(var(--board-diagonal) * 80ms - var(--turn-elapsed));
  }
  @keyframes army-turn-pulse {
    0%, 28%, 100% { opacity: calc(.28 * var(--light)); }
    10%, 13% { opacity: calc(.65 * var(--light)); }
  }
}
.cell.no-moves > .piece:has(.unit-label) {
  --rim-outline: #686e70;
  --rim-base: #505658;
  --rim-side: #292e30;
}
.cell.no-moves > .piece:has(.unit-label)::after { content: none; animation: none; }
.piece img {
  width: 94%;
  height: 95%;
  min-height: 0;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px #050807) contrast(1.08);
}
.piece .unit-label {
  position: absolute;
  bottom: 1px;
  right: 1px;
  min-width: 1.05em;
  text-align: center;
  font: 400 clamp(10px, 1.05vw, 15px) / 1 var(--mono);
  color: #fff;
  background: #101113f5;
  border-left: 1px solid var(--edge);
  padding: 0 2px;
}
.legend {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--muted);
}
.capture-title span {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-wrap: anywhere;
}
.key {
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #ffffff60;
}
.key.first {
  background: var(--seat-0-face);
}
.key.second {
  background: var(--seat-1-face);
}
aside {
  display: grid;
  gap: 16px;
}
.turn-tag {
  color: var(--accent);
  font: 400 12px/1.3 var(--mono);
  letter-spacing: 0;
  white-space: nowrap;
}
.command-body,
.capture-body {
  padding: 0;
}
.command-post { container-type: inline-size; min-width: 0; }
.turn-box {
  position: relative;
  min-width: 0;
  padding: 0;
}
.turn-box h1 {
  margin: 0;
  color: var(--ink);
  font: 700 clamp(22px, 14cqi, 52px)/1 var(--display);
  letter-spacing: -.035em;
  text-transform: uppercase;
  white-space: nowrap;
}
.turn-box p {
  margin: 12px 0 0;
  line-height: 1.45;
  font-size: clamp(12px, 4.8cqi, 17px);
  white-space: nowrap;
  color: var(--ink);
}
#turn-detail {
  min-height: 1.4em;
  margin: 0;
  line-height: 1.4;
  color: var(--muted);
}
#battle-screen:has(.cell:focus-visible) #turn-detail:empty::before {
  content: 'Arrow Keys · Enter to Choose';
  color: var(--muted);
  font-size: .85em;
  white-space: normal;
}
.privacy {
  width: 100%;
  margin-top: 14px;
  padding: 13px 0 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 14px;
  text-align: left;
}
.privacy i {
  color: var(--muted);
}
.privacy kbd {
  margin-left: 0;
}
.switch {
  margin-left: auto;
  flex-shrink: 0;
  background: #33353a;
  border: 1px solid #686a70;
  border-radius: 18px;
  width: 33px;
  height: 18px;
  padding: 2px;
  display: flex;
}
.switch b {
  height: 12px;
  width: 12px;
  background: var(--ink);
  border-radius: 50%;
}
.privacy[aria-checked='true'] .switch {
  background: var(--accent-edge);
  border-color: var(--accent);
}
.privacy[aria-checked='true'] .switch b {
  transform: translateX(15px);
  background: #fff;
}
@media (prefers-reduced-motion: no-preference) {
  .switch {
    transition: background-color 180ms ease, border-color 180ms ease;
  }
  .switch b {
    transition: transform 180ms ease, background-color 180ms ease;
  }
}
kbd {
  font: 10px/1 var(--mono);
  color: var(--muted);
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
}
.capture-body {
  display: grid;
  gap: 0;
}
.capture-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
}
.capture-title small {
  min-width: 7ch;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  font-weight: 400;
}
.slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}
.slots[data-seat='0'] { --army-ink: var(--seat-0-ink); }
.slots[data-seat='1'] { --army-ink: var(--seat-1-ink); }
.slot {
  position: relative;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  background: var(--panel);
  font-variant-numeric: tabular-nums;
}
.slot:has(img) {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--army-ink) 52%, var(--border));
}
.slot img {
  position: absolute;
  inset: 5% 0 0;
  width: 100%;
  height: 95%;
  object-fit: contain;
}
.slot b, .slot small {
  position: absolute;
  padding: 0 2px;
  background: var(--panel);
}
.slot b { top: 1px; left: 1px; font: 700 12px/1 var(--display); }
.slot small { bottom: 1px; right: 1px; font: 400 11px/1.15 var(--mono); }
.slot:has(img) small { color: var(--army-ink); }

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  padding: 8px 14px;
  font: 400 14px/1.1 var(--display);
  text-transform: uppercase;
}
.btn:hover,
.account:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.btn.primary {
  color: var(--accent);
  border-color: var(--accent-border);
}
.btn svg {
  --icon-size: 16px;
}
#deployment:empty {
  display: none;
}
#report {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
#deployment .line {
  margin-top: 10px;
}
#reserve-picker {
  background-color: var(--recess);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
  font-size: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23b5b5b8' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-size: calc(12px * var(--icon-scale)) auto;
  background-repeat: no-repeat;
  padding: 5px 30px 5px 10px;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 32px;
}
.line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.game-code {
  color: var(--accent);
  font: 13px var(--mono);
  padding: 4px 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.game-code svg {
  --icon-size: 14px;
}
.text-btn {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
  padding: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
dialog {
  width: min(460px, calc(100% - 26px));
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 20px 80px #0009;
}
dialog::backdrop {
  background: #000b;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
dialog .panel-head :is(h1, h2) {
  font-size: 23px;
}
.dialog-content,
.content-pad {
  padding: 0;
}
.dialog-content p,
.content-pad p {
  margin: 0 0 14px;
  color: #c9cacc;
}
.dialog-content label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  margin: 13px 0;
}
.dialog-content input,
.search-input {
  width: 100%;
  background: var(--recess);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.dialog-content .btn {
  width: 100%;
  margin-top: 7px;
}
.dialog-content .text-btn {
  display: block;
  margin: 12px auto 0;
}
.icon-btn {
  padding: 4px;
  color: var(--muted);
}
.form-error {
  color: #ffb7a8;
  margin: 10px 0 0;
  font-size: 13px;
}
.choices {
  display: grid;
  gap: 4px;
}
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  align-items: center;
  text-align: left;
  background: transparent;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 0;
}
.choice:hover {
  color: var(--accent);
}
.choices > .choice:first-child { border-top: 0; padding-top: 4px; }
.choices > .choice:last-child { padding-bottom: 4px; }
.choice svg {
  grid-row: span 2;
  color: var(--accent);
  --icon-size: 23px;
}
.choice small {
  color: var(--muted);
  font-size: 13px;
}
.toast {
  position: fixed;
  z-index: 9;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 28px);
  padding: 12px 20px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 4px 15px #080809;
  font-size: 14px;
}
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr);
  gap: clamp(32px, 8vw, 140px);
  align-items: start;
}
.stack {
  display: grid;
  align-content: start;
  gap: clamp(24px, 4dvh, 40px);
}
.battle-list-actions { margin-bottom: 20px; }
.battle-list-actions [data-act='new'] {
  gap: 6px;
  padding-inline: 13px 15px;
}
/* The Material plus has wide internal margins. Enlarge the glyph within its icon slot. */
.battle-list-actions [data-act='new'] use {
  transform-origin: center;
  transform: scale(1.4);
}
.battle-limit-note { margin: 0; color: var(--muted); font-size: 14px; }
.battle-list-actions .battle-limit-note { flex-basis: 100%; }
.battle-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@container (min-width: 580px) {
  .tab-pane > .battle-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 880px) {
  .tab-pane > .battle-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.battle-card {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  min-width: 0;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: 5px;
  filter: grayscale(1);
}
.battle-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(to top, #070707ed, transparent 48%),
    linear-gradient(100deg, #090909dc 12%, #090909ab 55%, #09090966),
    var(--terrain-scene) center / cover no-repeat;
}
.battle-card::before, .battle-card .terrain-layer, .battle-card .battle-preview::before { filter: grayscale(1); }
.battle-card:is(:hover, :has(:focus-visible)) {
  filter: grayscale(0);
  border-color: var(--accent-border);
}
@media (prefers-reduced-motion: no-preference) {
  .battle-card { transition: filter 180ms ease-out, border-color 180ms ease-out; }
}
.battle-card-open {
  display: grid;
  grid-template-columns: clamp(72px, 32%, 124px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.1vw, 16px);
  width: 100%;
  padding: 12px;
  text-align: left;
}
.battle-card-open:focus-visible { outline-offset: -2px; }
.battle-card-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.battle-card-info strong { font: 700 clamp(17px, 1.8vw, 23px)/1.1 var(--display); color: var(--ink); }
.battle-card-info small { margin-top: 5px; font: 12px/1.3 var(--mono); }
.battle-card-info .orders-due { color: #fff; }
.opponent-standing { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; color: var(--ink); font: 14px/1.35 var(--display); }
.opponent-rank { display: inline-flex; align-items: center; gap: 5px; }
.opponent-rank .rank-insignia { --icon-size: 14px; }
.opponent-record { white-space: nowrap; font: 12px/1.4 var(--mono); }
.standing-context { color: var(--muted); }
.match-row .opponent-standing { margin-top: 4px; }
.battle-card-arrow { color: var(--muted); }
.battle-card footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 12px; padding-block: 4px; border-top: 1px solid var(--border); }
.battle-card footer small { color: var(--muted); font: 11px var(--mono); }
.battle-card footer button { min-height: 32px; }
.battle-preview {
  position: relative;
  display: grid;
  grid-template: repeat(10, minmax(0, 1fr)) / repeat(10, minmax(0, 1fr));
  width: 100%;
  aspect-ratio: 1.25;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  pointer-events: none;
}
.battle-preview::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #0c161e4d 1px, transparent 1px) 0 0 / 10% 100%,
    linear-gradient(#0c161e4d 1px, transparent 1px) 0 0 / 100% 10%;
}
.battle-preview i { z-index: 1; margin: 10% 14%; border-radius: 1px; background: color-mix(in srgb, var(--own) 80%, #14191d); box-shadow: inset 0 0 0 1px #ffffff58, 0 1px 1px #000a; }
.battle-preview .opposing { border-radius: 50%; background: color-mix(in srgb, var(--enemy) 80%, #14191d); }
.battle-preview.enemy-waiting .opposing { background: #888e91; }
.match-row .battle-preview, .battle-confirm .battle-preview { width: 76px; flex: none; }
.list-row.match-row, .battle-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.match-row > div:first-of-type, .battle-confirm p { flex: 1 1 9rem; min-width: 0; overflow-wrap: anywhere; }
.match-row .line { margin-inline-start: auto; }
.battle-confirm { margin-bottom: 16px; }
.battle-confirm p { margin: 0; }
.guest-lobby .battle-cards { margin-bottom: 1.25rem; }
.tab-count { padding: 2px 5px; border-radius: 3px; color: var(--ink); background: var(--surface); font: 12px var(--mono); }
.tab-pane {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--line) transparent;
  padding: 0 12px 12px 0;
  line-height: 1.5;
  container-type: inline-size;
}
.tab-pane > p, .tab-pane > .manual-list { color: #d5d5dd; }
#lobby-screen .tab-pane > p { max-width: 68ch; }
.tab-pane > p { margin: 0 0 14px; }
.tab-pane .battle-slots { align-self: center; color: var(--muted); font: 12px var(--mono); }
@container (max-width: 430px) {
  .battle-card-open { grid-template-columns: minmax(60px,24%) minmax(0,1fr); padding: 10px; gap: 9px; }
  .battle-card-arrow { display: none; }
  .battle-card-info strong { font-size: clamp(16px,5cqi,19px); }
}
@container (max-width: 280px) {
  .battle-card-open { grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 8px; }
  .battle-card-open .battle-preview { max-width: 120px; }
  .battle-card-arrow { display: none; }
  .battle-card footer { flex-wrap: wrap; margin-inline: 8px; }
  .tab-pane .list-row { flex-wrap: wrap; overflow-wrap: anywhere; }
  .tab-pane .rank-list > div { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; }
  .tab-pane .rank-list > div > div { display: contents; }
  .tab-pane .rank-list img { width: 30px; height: 34px; }
  .tab-pane .rank-list small { grid-column: 3; grid-row: 1; }
}
.list-row + [data-act='clear-history'] { margin-block-start: 18px; }
.content-pad > :last-child { margin-bottom: 0; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:first-child {
  padding-top: 0;
}
.list-row:last-child {
  border: 0;
  padding-bottom: 0;
}
.list-row strong,
.list-row small {
  display: block;
}
.list-row small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.list-row .btn {
  font-size: 13px;
  min-height: 34px;
}
.list-row:has([data-end-match]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  overflow-wrap: anywhere;
}
.list-row [data-end-match] {
  inline-size: 6em;
  min-height: 34px;
  white-space: nowrap;
}
.empty {
  font-size: 14px;
  color: var(--muted);
}
.search-input {
  margin-bottom: 12px;
  font-size: 14px;
  border-radius: 4px;
}
.guest-lobby {
  max-width: 36rem;
}
.manual-list {
  padding-left: 20px;
  color: #c9cacc;
  font-size: 15px;
}
.manual-list li {
  margin: 8px 0;
}
.rank-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px clamp(24px, 4cqi, 56px);
}
.rank-list > div {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 14px;
}
.rank-list > div > div {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 6px;
}
.rank-list strong b {
  color: var(--accent);
  font-family: var(--mono);
}
.rank-list p {
  grid-column: 1 / -1;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}
.rank-list img {
  width: 46px;
  height: 46px;
  flex: none;
  object-fit: contain;
}
.rank-list small {
  color: var(--muted);
  margin-left: auto;
  font: 11px var(--mono);
}
.result-card {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(91%, 560px);
  max-height: 100%;
  overflow: auto;
  isolation: isolate;
  border: 1px solid #828378;
  background: #151918;
  box-shadow: 0 12px 48px #000c, 0 0 0 4px #0b0d0e94;
}
.result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, #050707ed, #080a0b66 48%, transparent 78%),
    linear-gradient(90deg, #06080969, transparent 76%), var(--terrain-scene) center / cover;
}
.result-card[data-outcome='defeat']::before { filter: saturate(.55) brightness(.89); }
.result-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: min(314px, 76cqh);
  padding: clamp(15px, 4cqw, 31px);
}
.result-flag {
  position: absolute;
  right: 5%;
  top: 8%;
  width: 32%;
  height: auto;
  max-height: 69%;
  filter: drop-shadow(0 0 .6px #ebeee1aa) drop-shadow(1px 2px 2px #1115);
  mask-image: linear-gradient(#000 94%, transparent 99%);
}
.result-card h2 {
  font: 700 clamp(35px, 8.2cqw, 64px)/.94 var(--display);
  letter-spacing: -.035em;
  text-transform: uppercase;
  margin: 0;
  color: #fffaf1;
  text-shadow: 0 2px 14px #000a;
}
.result-card p {
  margin: 6px 0 0;
  font-size: clamp(14px, 2.6cqw, 17px);
  color: #f2eee5;
}
.result-actions { margin-top: 15px; }
.result-actions .btn:not(.primary) { background: #0d1012c9; }

.coordinates {
  color: #afb1b5;
  letter-spacing: 0.04em;
}
[data-terrain='steppe'] { --terrain-image: url(sector-terrain.webp?v=1.0.4); --terrain-scene: url(results/steppe.webp?v=1.0.4); }
[data-terrain='dunes'] { --terrain-image: url(dunes-terrain.webp?v=1.0.4); --terrain-scene: url(results/dunes.webp?v=1.0.4); }
[data-terrain='alpine'] { --terrain-image: url(alpine-terrain.webp?v=1.0.4); --terrain-scene: url(results/alpine.webp?v=1.0.4); }
[data-terrain='woodland'] { --terrain-image: url(woodland-terrain.webp?v=1.0.4); --terrain-scene: url(results/woodland.webp?v=1.0.4); }
.terrain-layer, .map-plan {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
}
.terrain-layer {
  position: absolute;
  inset: 0;
  grid-template-rows: repeat(10, 1fr);
  pointer-events: none;
  background:
    linear-gradient(#26332a1c, #1d2c2a25),
    var(--terrain-image) center/100% 100%;
  z-index: -1;
}
.reversed .terrain-layer {
  transform: rotate(180deg);
}
.terrain-layer span {
  background: url(reservoir.webp?v=1.0.4) center/100% 100% no-repeat;
  filter: hue-rotate(12deg) saturate(1.12) brightness(1.08);
}
.terrain-layer span:nth-child(2) { background-image: url(reservoir-ledge.webp?v=1.0.4); }
.terrain-layer span:nth-child(3) { background-image: url(reservoir-cove.webp?v=1.0.4); }
.terrain-layer span:nth-child(4) { background-image: url(reservoir-gravel.webp?v=1.0.4); }
[data-terrain='alpine'] .terrain-layer span { filter: saturate(.75) brightness(1.18); }
#board:is([data-terrain='alpine'], [data-terrain='dunes']) .placement-square > svg {
  color: #fff;
  filter: drop-shadow(0 1px 1px #17211c);
}
#battle-map {
  color: var(--muted);
  font: 400 14px/1.25 var(--display);
}
#map-picker fieldset {
  min-inline-size: 0;
  padding: 0;
  border: 0;
  margin: 0 0 17px;
}
#map-picker legend {
  width: 100%;
  padding: 0;
  margin-bottom: 7px;
  font: 700 18px var(--display);
}
.map-terrains, .map-layouts { display: grid; gap: 7px; }
.map-terrains { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 420px) {
  .map-terrains { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.map-layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#map-picker .map-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--border);
  cursor: pointer;
}
#map-picker .map-choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-tint);
  color: #fff;
}
@media (forced-colors: active) {
  #map-picker .map-choice:has(input:checked) { border: 3px double Highlight; padding: 3px; }
}
.map-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-swatch { height: 36px; background: var(--terrain-image) center/cover; }
.map-option-name { padding: 6px 2px 1px; font-weight: 700; }
#map-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.map-choice small { margin: 3px 2px; font-size: 13px; line-height: 1.2; color: var(--muted); }
.map-plan {
  --plan-rows: 4;
  position: relative;
  grid-template-rows: repeat(var(--plan-rows), minmax(0, 1fr));
  height: 36px;
  background: #323c35;
}
.map-plan span { background: #71aeb8; }
.map-plan::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #121a1d77 1px, transparent 1px) 0 0/10% 100%,
    linear-gradient(#121a1d77 1px, transparent 1px) 0 0/100% calc(100% / var(--plan-rows));
}
.battlefield-guide + .battlefield-guide { margin-top: 28px; }
.battlefield-guide h3, #guide-pane-play h3 { margin: 0 0 4px; font-size: 22px; line-height: 1.15; }
#guide-pane-play h3:not(:first-of-type) { margin-top: 28px; }
.battlefield-guide > p { margin: 0 0 14px; color: #d5d5dd; }
.manual-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 14px; }
.manual-figures figure { min-width: 0; margin: 0; }
.manual-landscape { display: block; width: 100%; aspect-ratio: 1.65; object-fit: cover; background: var(--recess); }
.manual-plan {
  --plan-rows: 10;
  height: auto; aspect-ratio: 1.25;
  background: linear-gradient(to bottom, #303a36 40%, #576252 40% 60%, #303a36 60%);
}
.manual-plan span { background: #68b2c7; }
.manual-plan::after { box-shadow: inset 0 0 0 1px #84959166; }
.manual-figures figcaption { margin-top: 7px; }
.manual-figures figcaption:first-child { margin: 0 0 6px; }
.manual-figures h4 { margin: 0; font-size: 18px; line-height: 1.2; }
@container (max-width: 575px) {
  .manual-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 275px) {
  .manual-figures { grid-template-columns: minmax(0, 1fr); }
}
.piece .card-back {
  width: 65%;
  height: 76%;
  fill: var(--mark, var(--face));
  filter: drop-shadow(0 1px 1px #05080783);
}
.card-back.dark-mark { stroke: var(--hi); stroke-width: .8px; }
.board-wrap[data-deployment] .opponent-piece .card-back.dark-mark { stroke-opacity: calc(1 - var(--enemy-pending)); }
.radar-screen {
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(24px, 13cqi, 48px);
  height: clamp(24px, 13cqi, 48px);
}
.radar-screen:has(.unit-focus[hidden] + .end-symbol[hidden]) { display: none; }
.unit-focus { width: 100%; height: 100%; object-fit: contain; }
.end-symbol { color: var(--accent); }
.capture-title small,
.turn-tag {
  white-space: nowrap;
}
.rank-list img,
.slot img {
  filter: drop-shadow(0 1px 1px #0008);
}
@media (prefers-reduced-motion: no-preference) {
  .btn,
  .account,
  .nav-link,
  .cell {
    transition:
      background-color 0.12s,
      border-color 0.12s,
      color 0.12s;
  }
}
#guide-screen ol.manual-list li::marker {
  color: var(--accent);
  font-family: var(--mono);
}
#guide-screen ol.manual-list {
  padding-inline-start: 2.1em;
}
.rank-list > div + div {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
@container (min-width: 36rem) {
  .rank-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-list > div:nth-child(2) { padding-top: 0; border-top: 0; }
}
/* The shell owns the viewport. Only long reference screens and open drawers scroll. */
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
main {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.7dvh, 18px);
  min-height: 0;
  margin: 0 auto;
  padding: clamp(8px, 1.7dvh, 18px) 0 max(10px, env(safe-area-inset-bottom));
}
.page-title, .play-intro {
  --rule-gap: clamp(10px, 2dvh, 20px);
  flex: none;
  margin: clamp(10px, 4dvh, 46px) 0 var(--rule-gap);
}
.page-title {
  font: 700 clamp(52px, min(8vw, 11dvh), 120px)/.94 var(--display);
  text-transform: uppercase;
  letter-spacing: -.028em;
}
#practice-level, #final-practice-level {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font: 400 12px/1.3 var(--mono);
}
#practice-level {
  justify-self: start;
  padding: 0;
  text-align: left;
  color: var(--accent);
  text-transform: uppercase;
}
#practice-level i { margin-left: 3px; vertical-align: middle; }
#practice-level svg { --icon-size: 1.2em; }
@container (min-width: 270px) {
  #practice-level::before { content: 'Practice · '; color: var(--muted); }
}
.difficulty-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  max-width: 780px; margin: 0; padding: 0; list-style: none;
}
.difficulty-card {
  min-width: 0; display: grid; justify-items: start; align-content: start; gap: 4px;
  padding: clamp(8px, 2cqi, 18px); text-align: left;
  border: 1px solid var(--border); border-radius: 4px;
  background: linear-gradient(145deg, #191b1eeb, #0a0b0deb);
}
.difficulty-card strong { font: 700 clamp(16px, 3.8cqi, 24px)/1.1 var(--display); }
.difficulty-card small { color: var(--muted); font: 12px/1.35 var(--mono); }
.difficulty-dial { width: calc(40px * var(--icon-scale)); height: auto; margin-bottom: 8px; color: var(--accent); }
.difficulty-dial path { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.difficulty-dial .dial-track { stroke: var(--line); }
button.difficulty-card:is(:hover, :focus-visible, [aria-pressed='true']) {
  border-color: var(--accent); background: var(--accent-tint);
}
@container (max-width: 320px) {
  .difficulty-grid { grid-template-columns: 1fr; }
  .difficulty-card { grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; }
  .difficulty-dial { width: 36px; grid-row: span 2; margin-bottom: 0; }
}
dialog :is(p, h2, strong, small, label, .form-error) { overflow-wrap: anywhere; }
.mast-inner {
  height: clamp(46px, 6.5dvh, 64px);
}
.account {
  min-width: 0;
  max-width: 30%;
}
.account span {
  overflow: hidden;
  text-overflow: ellipsis;
}
#lobby-screen,
#account-screen,
#guide-screen {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) var(--bg);
}
.page-grid,
.guest-lobby {
  margin-top: 0;
}
.game-layout {
  container-type: size;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 1.6vw, 20px);
  margin: 0;
}
.battlefield {
  container: battlefield / inline-size;
  --coordinate-size: 11px;
  --frame-width: 4px;
  --coordinate-inset: calc(var(--frame-width) + 7px);
  /* Reserve room for two digits plus the gap to the outside of the frame. */
  --left: calc(1.5 * var(--coordinate-size) + var(--coordinate-inset));
  --top: calc(var(--coordinate-size) + var(--coordinate-inset));
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-width: calc((100cqh - 45px) * 1.25 + 40px);
  max-height: 100%;
}
.board-stage {
  --board-ratio: 1.25;
  --pitch: 24deg;
  --map-stretch: 1.34;
  --lens: min(176cqw, 214cqh);
  --rim-depth: 5px;
  --raised-depth: 3px;
  --gutter: 10px;
  flex: 1 1 0;
  min-height: 0;
  container-type: size;
  position: relative;
  display: grid;
  place-items: center;

}
.board-wrap {
  /* The near edge stays anchored. Cells, coordinates and moving pieces share this camera. */
  transform-origin: 50% 100%;
  transform: perspective(var(--lens)) rotateX(var(--pitch)) scaleY(var(--map-stretch));
  width: min(
    100%,
    calc(
      (100cqh - var(--top) - var(--gutter) - 2px) * var(--board-ratio) + var(--left) + 2 * var(--gutter)
    )
  );
  padding: 1px var(--gutter) var(--gutter);
  grid-template-columns: var(--left) minmax(0, 1fr);
  grid-template-rows: var(--top) auto;
}
#board {
  aspect-ratio: var(--board-ratio);
}
.legend {
  align-items: center;
  flex: none;
  gap: 16px;
  padding: 4px 14px;
  min-height: 34px;
}
.legend [data-army] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow-wrap: anywhere;
  padding: 5px 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.legend [data-army] svg {
  --icon-size: 12px;
  color: var(--muted);
}
#board-end {
  width: 100%;
  margin-top: 10px;
}
.legend button[data-army]:hover:enabled {
  color: var(--accent);
}
aside {
  flex: 0 0 clamp(265px, 24%, 345px);
  min-width: 265px;
  gap: clamp(8px, 1.5dvh, 16px);
}
.drawer-bar {
  display: none;
  gap: 8px;
}
.drawer-bar .btn {
  flex: 1;
  min-width: 0;
}
#captured-count {
  min-width: 2ch;
  box-sizing: content-box;
  font: 11px var(--mono);
  color: var(--accent);
  background: var(--recess);
  padding: 2px 5px;
  border-radius: 3px;
}
#drawer {
  padding: 0;
  max-height: 90dvh;
  overflow: auto;
  margin: auto max(14px, calc((100vw - 1180px) / 2)) auto auto;
}
#drawer > .panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#drawer .panel-head {
  padding-right: 46px;
}
#drawer-close {
  position: absolute;
  right: 8px;
  top: 5px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
}
.color-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.color-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 6px 2px;
  text-align: left;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
}
.color-option .swatch {
  flex: 0 0 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #ffffff38;
}
.color-option span {
  display: grid;
}
.color-option small:empty {
  display: none;
}
.color-option small {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.color-option[aria-pressed='true'] {
  border-color: var(--accent);
  color: #fff;
}
.color-option:hover:enabled {
  border-color: var(--accent);
}
@container (max-height: 525px) {
  aside #captured-panel {
    display: none;
  }
  .drawer-bar {
    display: flex;
  }
}
@media (max-width: 1000px) {
  .mast-inner {
    --nav-gap: 17px;
  }
  .piece {
    width: 86%;
  }
}
@media (max-width: 900px) and (orientation: portrait) {
  main:has(#battle-screen:not([hidden])),
  body:has(#battle-screen:not([hidden])) .site-footer > div {
    --min-page-gutter: 4px;
  }
  .mast-inner {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
  }
  .account {
    grid-area: 1/2;
    max-width: 40vw;
    padding: 5px 9px;
  }
  .mast nav {
    grid-area: 2/1/3/-1;
    height: 32px;
    justify-content: space-between;
    gap: 7px;
  }
  .nav-link {
    font-size: 12px;
    gap: 5px;
  }
  .nav-link svg {
    --icon-size: 13px;
  }
  main {
    gap: 8px;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  }
  .game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 7px;
  }
  .game-layout aside {
    display: contents;
  }
  .game-layout aside > .command-post {
    grid-area: 1/1;
  }
  .game-layout aside > .command-post .panel-head {
    display: none;
  }
  .battlefield {
    --coordinate-size: 9px;
    grid-area: 2/1;
    max-width: none;
    max-height: none;
    align-self: stretch;
  }
  .board-stage {
    --board-ratio: 1;
    --pitch: 16deg;
    --map-stretch: 1.16;
    --lens: min(220cqw, 232cqh);
    --rim-depth: 3px;
    --raised-depth: 1.5px;
    --gutter: 3px;
  }
  .panel-head {
    min-height: 34px;
    padding: 6px 11px;
  }
  .legend {
    font-size: 11px;
    gap: 13px;
    min-height: 30px;
    padding: 3px 8px;
  }
  .piece {
    border-width: 1px;
    border-radius: 2px;
  }
  .piece .unit-label {
    font-size: clamp(9px, 3vw, 13px);
    right: 2px;
  }
  aside .command-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 9px;
    padding: 6px 9px;
  }
  .turn-box {
    flex: 1;
    min-width: 120px;
    border: 0;
    background: transparent;
    padding: 0;
    gap: 7px;
  }
  .turn-box h1 {
    font-size: 17px;
  }
  .turn-box p {
    font-size: 12px;
    margin: 0;
  }
  .radar-screen {
    display: none;
  }

  .privacy {
    width: auto;
    margin: 0;
    border: 0;
    padding: 6px 0;
    gap: 6px;
    font-size: 12px;
  }
  .privacy i,
  .privacy kbd {
    display: none;
  }
  #deployment:not(:empty) {
    order: 3;
    flex-basis: 100%;
  }
  #deployment .line {
    margin: 0;
  }
  #deployment .btn {
    min-height: 27px;
    padding: 3px 8px;
    font-size: 12px;
  }
  .drawer-bar {
    grid-area: 3/1;
    display: flex;
  }
  #captured-launch {
    display: inline-flex;
  }
  aside #captured-panel {
    display: none;
  }
  #drawer {
    margin: auto auto max(8px, env(safe-area-inset-bottom));
    width: calc(100% - 16px);
  }
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}
@media (max-height: 540px) {
  .mast-inner {
    height: 36px;
    min-height: 0;
    display: flex;
    gap: 14px;
  }
  .mast nav {
    height: auto;
    gap: 12px;
  }
  .nav-link {
    font-size: 12px;
    gap: 4px;
  }
  .account {
    padding: 3px 6px;
    font-size: 12px;
  }
  main {
    padding: 5px 0;
    gap: 5px;
  }
  .game-layout {
    gap: 7px;
  }
  .battlefield {
    --coordinate-size: 9px;
    max-width: calc((100cqh - 65px) * 1.25 + 28px);
  }
  .board-stage {
    --gutter: 4px;
    --pitch: 17deg;
    --map-stretch: 1.2;
    --rim-depth: 3px;
    --raised-depth: 1.5px;
  }
  .panel-head {
    min-height: 28px;
    padding: 4px 10px;
  }
  .panel-head :is(h1, h2) {
    font-size: 17px;
  }
  .legend {
    min-height: 25px;
    padding: 2px 6px;
    gap: 10px;
    font-size: 10px;
  }
  .legend [data-army] {
    padding: 2px 4px;
  }
  .piece {
    border-width: 1px;
  }
  .piece .unit-label {
    font-size: 10px;
    right: 1px;
  }
  aside {
    min-width: 220px;
  }
  .drawer-bar .btn {
    font-size: 12px;
    padding: 6px;
  }
  .result-copy { padding: 12px 16px; }
  .result-actions { margin-top: 8px; }
  .result-actions .btn { min-height: 30px; }
}
@media (max-width: 580px) and (max-height: 540px) {
  .mast-inner {
    gap: 8px;
  }
  .nav-link i {
    display: none;
  }
  .mast nav {
    gap: 8px;
  }
  .account {
    max-width: 23vw;
  }
  .battlefield {
    max-width: 100%;
  }
  .legend [data-army] {
    gap: 3px;
  }
}
@media (orientation: portrait) and (max-width: 900px) {
  .drawer-bar .btn {
    font-size: 13px;
    white-space: nowrap;
    padding: 5px 8px;
  }
}
/* Use the available phone screen, allowing the cells to grow taller or wider as space permits. */
@media (orientation: portrait) and (max-width: 600px) {
  .board-stage {
    --board-ratio: 1.25;
  }
  #board {
    aspect-ratio: auto;
    height: min(
      calc(100cqh - var(--top) - var(--gutter) - 2px),
      calc((100cqw - var(--left) - 2 * var(--gutter)) / 0.75)
    );
  }
}
@media (orientation: portrait) and (max-height: 690px) {
  .radar-screen {
    display: none;
  }
  .command-body .turn-box {
    min-width: 88px;
  }
}
@media (orientation: landscape) and (max-height: 540px) {
  aside {
    flex-basis: 32%;
    min-width: clamp(155px, 32vw, 264px);
  }
  aside > .command-post .panel-head {
    display: none;
  }
  aside .command-body {
    padding: 7px 9px;
  }
  .turn-box {
    gap: 6px;
    padding: 5px 7px;
  }
  .turn-box h1 {
    font-size: 17px;
  }
  .turn-box p {
    font-size: 12px;
    line-height: 1.25;
  }
  .radar-screen {
    display: none;
  }
  .privacy {
    margin-top: 6px;
    padding-top: 6px;
    white-space: nowrap;
    font-size: 12px;
  }
  .privacy kbd,
  .privacy i {
    display: none;
  }
  #deployment .line {
    margin-top: 4px;
    gap: 3px;
  }
  #deployment .btn {
    font-size: 12px;
    min-height: 26px;
    padding: 2px 5px;
  }
  .drawer-bar {
    flex-direction: column;
    gap: 4px;
  }
  .drawer-bar .btn {
    min-height: 30px;
    white-space: nowrap;
  }
  .legend {
    flex-wrap: wrap;
    gap: 3px 8px;
  }
}

#deployment .line > :only-child { width: 100%; }
#deployment { min-width: 0; max-width: 100%; }
#reserve-picker { min-width: 0; }
.mast .nav-link { white-space: nowrap; }
.form-error:empty { margin: 0; }
.search-input:focus-visible { outline-offset: -2px; }
:is(.dialog-content input,#reserve-picker):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
@media (min-width: 901px), (orientation: landscape) {
  .game-layout { justify-content: space-between; gap: clamp(16px, 3.5vw, 60px); }
  .game-layout aside {
    gap: clamp(16px, 3.5dvh, 42px);
    margin-block: clamp(0px, calc((100cqh - 560px) * .15), 54px) 0;
    flex-basis: clamp(250px, 24%, 350px);
  }
  .panel-head { margin: 0 0 12px; }
  aside .panel-head h2 { font-size: clamp(20px, 2.8dvh, 27px); }
}
@media (min-height: 600px) and (orientation: landscape), (min-height: 600px) and (min-width: 901px) {
  .mast .nav-link i { display: none; }
  .mast-inner { --nav-gap: clamp(16px, 2.6vw, 38px); }
  #deployment .line {
    display: grid;
    grid-template: minmax(40px, auto) auto / repeat(2, minmax(0, 1fr));
  }
  #deployment #reserve-picker, #deployment [data-act="recall"] { grid-area: 1 / 1 / 2 / -1; }
  #deployment :is([data-act="fill"],[data-act="shuffle"]) { grid-area: 2 / 1; }
  #deployment [data-act="ready"] { grid-area: 2 / 2; }
  #reserve-picker { width: 100%; }
}
@media (max-height: 599px), (max-width: 900px) and (orientation: portrait) {
  #deployment .line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(48px, 24cqi, 66px) clamp(40px, 20cqi, 54px);
    min-height: 34px;
  }
  #deployment :is(#reserve-picker, [data-act="recall"]) { grid-column: 1; width: 100%; }
  #deployment :is([data-act="fill"],[data-act="shuffle"]) { grid-column: 2; }
  #deployment [data-act="ready"] { grid-column: 3; }
  #deployment .btn { white-space: nowrap; }
}
@media (orientation: landscape) and (max-height: 540px) {
  aside .drawer-bar { padding: 4px; }
  aside .panel-head { min-height: 25px; padding: 7px 9px 0; }
}
/* Full capture trays or longer match text can need the drawer even on a large display. */
.game-layout[data-fold] aside #captured-panel {
  display: none;
}
.game-layout[data-fold] aside {
  max-height: 100%;
  overflow-y: auto;
  padding: 5px;
  scrollbar-width: thin;
}
.game-layout[data-fold] .drawer-bar {
  display: flex;
}
@media (pointer: coarse) {
  .dialog-content input,
  .search-input {
    font-size: 16px;
  }
}

/* This layer shares the board's grid area, including when the viewport rotates. */
#move-layer {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  align-self: stretch;
  min-height: 0;
  min-width: 0;
  margin: 1px;
  pointer-events: none;
  z-index: 3;
}
.moving-unit {
  position: absolute;
  width: 10%;
  height: 10%;
  display: grid;
  place-items: center;
  animation: unit-advance var(--travel-time) cubic-bezier(0.26, 0.65, 0.3, 1) both;
}
@keyframes unit-advance {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(var(--travel-x), var(--travel-y));
  }
}
.cell.travel-origin > .piece {
  visibility: hidden;
}
.attacker-captured .moving-unit,
.defender-captured .travel-target > .piece,
#capture-preview .arriving {
  visibility: hidden;
}
#move-layer.advancing .moving-unit {
  animation: secure-square 450ms ease-out both;
}
@keyframes secure-square {
  from { transform: translate(var(--travel-x), var(--travel-y)); }
  to { transform: translate(var(--arrival-x), var(--arrival-y)); }
}
.capture-flight {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  --raised-depth: 1px;
}
.capture-flight > .piece {
  width: 100%;
  height: 100%;
  max-width: none;
  transform: none;
}
#capture-preview {
  display: inline-flex;
  align-items: center;
}
.loss-symbol {
  display: grid;
  place-items: center;
  width: 35px;
  flex: none;
}
#capture-preview:empty, .loss-symbol:has(#capture-preview img) > i {
  display: none;
}
#capture-preview img {
  width: 19px;
  height: 21px;
  object-fit: contain;
}
#capture-preview img + img {
  margin-left: -3px;
}
.cell.travel-origin {
  background-color: color-mix(in srgb, var(--accent) 15%, transparent);
}
.cell.travel-target {
  box-shadow: inset 0 0 0 2px var(--accent);
  background-color: color-mix(in srgb, var(--accent) 16%, transparent);
}
#move-layer.contact .moving-unit::after {
  content: '';
  position: absolute;
  inset: 3%;
  border: 2px solid var(--accent);
  border-radius: 4px;
  animation: contact-ring 0.5s ease-out both;
}
@keyframes contact-ring {
  from {
    transform: scale(0.65);
    opacity: 0.95;
  }
  to {
    transform: scale(1.28);
    opacity: 0;
  }
}
#engagement {
  width: min(460px, calc(100% - 24px));
  overflow: auto;
}
#engagement-route {
  font: 12px var(--mono);
  color: var(--accent);
  letter-spacing: 0.09em;
  white-space: nowrap;
}
.engagement-body {
  padding: clamp(12px, 2.7vh, 22px);
}
#engagement-units {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.combatant {
  display: grid;
  justify-items: center;
  align-content: start;
  min-width: 0;
  gap: 5px;
  padding: 6px 0;
}
.combat-role {
  font: 400 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--affiliation);
  text-align: center;
}
.combatant img {
  width: 100%;
  height: clamp(52px, 12dvh, 106px);
  object-fit: contain;
  filter: drop-shadow(0 2px 3px #08100d);
}
.combatant strong {
  font: 550 clamp(16px, 3.1vw, 21px) / 1.12 var(--display);
  letter-spacing: -.035em;
  text-align: center;
}
.combat-rank {
  display: inline-block;
  vertical-align: middle;
  color: var(--affiliation);
  font: 400 14px/1 var(--mono);
  padding: 2px 3px;
  margin-right: 5px;
}
.combat-status {
  font-size: 12px;
  line-height: 18px;
  min-height: 18px;
  margin-top: 4px;
  color: var(--affiliation);
}
.combatant[data-muted='true'] img,
.slot[data-muted='true'] img,
#capture-preview img[data-muted='true'],
.capture-flight[data-muted='true'] img {
  filter: grayscale(1);
}
@media (prefers-reduced-motion: no-preference) {
  .combatant[data-muted='true'] img,
  .capture-flight[data-muted='true'] img {
    animation: loss-grayscale 240ms ease-out both;
  }
  @keyframes loss-grayscale {
    from { filter: grayscale(0); }
    to { filter: grayscale(1); }
  }
  .blast .travel-target::before {
    content: '';
    position: absolute;
    z-index: 2;
    inset: -18%;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, #fff7d6 6%, #ffbe52 22%, #e47734b8 39%, #72503d88 57%, transparent 72%);
    animation: impact-burst 540ms ease-out both;
  }
  @keyframes impact-burst {
    0% { transform: scale(.12); opacity: 0; }
    18% { transform: scale(.62); opacity: 1; }
    56% { transform: scale(1); opacity: .75; }
    100% { transform: scale(1.35); opacity: 0; }
  }
}
.versus {
  font: 400 12px var(--mono);
  color: var(--accent);
}
#engagement-outcome {
  min-height: 2.6em;
  margin: 16px 0 0;
  color: var(--ink);
  text-align: center;
  font-size: 15px;
  line-height: 1.3;
}
.engagement-actions {
  display: flex;
  justify-content: flex-end;
}
@media (prefers-reduced-motion: no-preference) {
  #engagement[open]:not(.resolved) .combatant {
    animation: encounter-arrival 0.32s ease-out both;
  }
  #engagement[open]:not(.resolved) .combatant:last-child {
    animation-delay: 90ms;
  }
  @keyframes encounter-arrival {
    from {
      opacity: 0.4;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .board-wrap, #board { transition-property: none; }
  #move-layer.contact .moving-unit::after {
    animation: none;
    opacity: 0.55;
  }
}
@media (max-height: 480px) {
  .engagement-body {
    padding: 8px 12px;
  }
  .combatant {
    padding: 4px;
  }
  .combatant img {
    height: 45px;
  }
  .combat-status {
    margin-top: 0;
  }
  #engagement-outcome {
    min-height: 1.4em;
    margin: 8px 0;
  }
  #engagement { --rule-gap: 6px; }
}

@media (max-width: 480px) and (max-height: 540px) {
  .mast nav .nav-link {
    font-size: 0;
    gap: 0;
    min-width: 28px;
  }
  .mast nav .nav-link i { display: inline-flex; }
}
@media (max-width: 360px) {
  .color-options { gap: 5px; }
  .color-option { gap: 4px; font-size: 12px; }
  .color-option .swatch { flex-basis: 12px; }
}

.match-status {
  display: grid;
  gap: 12px;
  margin-bottom: clamp(8px, 1.4dvh, 14px);
}
.match-status section { min-width: 0; }
.match-status h2 { margin: 0 0 4px; color: var(--muted); text-transform: uppercase; }
.match-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 12px; }
#match-label { font: 700 18px/1.15 var(--display); }
#enemy-standing, #enemy-standing .opponent-standing { display: contents; }
.match-status .game-code { padding-block: 0; white-space: nowrap; }
.turn-tag { text-transform: uppercase; }
#battle-map { overflow-wrap: anywhere; }
@container (max-width: 245px) {
  .match-facts { column-gap: 8px; }
  .match-status .game-code { font-size: 11px; gap: 4px; }
  #battle-map { font-size: 12px; text-wrap: balance; }
}
.orders { min-width: 0; }
.capture-body > div {
  padding-block: 8px;
}
.capture-body > div:first-child { padding-top: 0; }
.capture-body > div:last-child { padding-bottom: 0; }
.slots:not(:empty) { margin-top: 6px; }
#captured-count { background: transparent; }
.legend { padding-inline: var(--left) 0; }
.legend [data-army] { padding-inline: 0; }
.legend button[data-army]:hover:enabled { text-decoration: underline; text-underline-offset: 3px; }
.privacy { border-top: 0; }
.btn:hover:enabled, .btn:focus-visible { border-color: var(--ink); background-color: #171719; }
.btn.primary:hover:enabled { background-color: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#reserve-picker { background-color: transparent; }
#reserve-picker option { background-color: #151517; }
.guest-lobby p { margin: 0 0 18px; color: var(--muted); }
.guest-lobby .btn { padding-inline: 22px; min-height: 46px; }
.content-pad { line-height: 1.5; }
.content-pad p, .manual-list { color: #d5d5dd; }
.manual-list { font-size: 16px; }
.rank-list small { font-size: 13px; }
.rank-list strong { font-size: 17px; }
.rank-list p { margin: 0; font-size: 15px; }
.page-grid { padding: 0 4px 32px 0; }
.page-grid .panel-head { margin: 0 0 12px; padding: 0; }
.panel-head, .page-title { text-wrap: balance; }
dialog, #drawer, #engagement {
  width: min(520px, calc(100% - 28px));
  padding: clamp(18px, 3.5vw, 40px);
  background: var(--panel);
  border-radius: 2px;
}
dialog .panel-head {
  min-height: 0;
  padding: 0;
  margin: 0 0 20px;
  align-items: flex-start;
}
dialog .panel-head h2 { font: 700 clamp(28px, 3.5vw, 44px)/.98 var(--display); overflow-wrap: anywhere; }
#dialog-body > .panel-head { margin-bottom: 0; }
#dialog-body { container-type: inline-size; }
#dialog-body .panel-head h2 { display: block; min-width: 0; font-size: clamp(24px, 9cqi, 42px); }
#dialog-body .panel-head .icon-btn { flex: none; }
#drawer-close { inset: 12px 10px auto auto; }
dialog .dialog-content p { font-size: 17px; }
.dialog-content label { margin-block: 17px; }
.choices { gap: 0; }
.choice strong { font-size: 19px; }
.choice small { font-size: 15px; }
.engagement-body { padding: 0; }
#engagement-route { margin-top: 6px; }
.combatant strong { font-weight: 700; }
#engagement-units { align-items: start; }
.versus { align-self: center; }
@media (max-width: 400px) {
  #modal { max-width: calc(100% - 20px); padding-inline: 12px; }
  #modal .panel-head { gap: 6px; }
  #modal .panel-head h2 { font-size: clamp(20px, 6.25vw, 25px); }
  #engagement { padding-inline: 12px; }
  #engagement-units { grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr); }
  .versus { justify-self: center; }
  .combatant { padding-inline: 0; }
  .combatant strong { font-size: clamp(14px, 4.35vw, 15px); overflow-wrap: normal; }
}
.nav-toggle { display: none; }
@media (min-width: 901px) and (min-height: 541px) {
  .mast-inner { height: clamp(54px, 7.4dvh, 74px); }
  #deployment .line { margin-top: 20px; gap: 8px; }
  #reserve-picker { min-height: 37px; }
  .page-grid .content-pad { max-width: 66ch; }
}
@media (max-width: 900px) {
  .mast .mast-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    height: clamp(38px, 6.8dvh, 56px);
  }
  .mast .account { order: 1; margin-left: auto; max-width: 44%; }
  .nav-toggle {
    position: relative;
    display: grid;
    place-items: center;
    order: 2;
    width: 44px;
    align-self: stretch;
    padding: 0;
  }
  .mast:has(#invite-count:not([hidden])) .nav-toggle::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    top: 20%;
    right: 5px;
  }
  .mast #main-nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    height: auto;
    padding: 0 var(--page-gutter) 10px;
    background: #050506;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle[aria-expanded='true'] + #main-nav { display: grid; gap: 0; }
  .mast #main-nav .nav-link {
    font: 700 18px/1.25 var(--display);
    padding: 12px 0;
    border-top: 1px solid var(--border);
    gap: 8px;
  }
  .mast #main-nav .nav-link i, .mast #main-nav .nav-link::after { display: none; }
}
@media (orientation: portrait) and (max-width: 900px) {
  .match-status { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 0; }
  .match-status:has(#enemy-info[hidden]) { grid-template-columns: minmax(0,1fr); }
  .game-layout aside .command-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding: 4px 10px;
  }
  .match-status { grid-area: 1/1; }
  .turn-box, .command-body .privacy { grid-area: 2/1; }
  .command-body .privacy { justify-self: end; position: relative; }
  #deployment { grid-area: 3/1; }
  .turn-box h1 { font-size: clamp(22px, 6vw, 36px); }
  .privacy { white-space: nowrap; }
  .legend { justify-content: center; }
  .page-grid { gap: 32px; padding-inline: 2px 6px; }
  .page-title { font-size: clamp(42px, 10vw, 70px); }
}
@media (orientation: landscape) and (max-height: 650px) {
  /* Fit four rows of square counters and their headings in the losses drawer. */
  #drawer:has(#captured-panel) {
    max-width: clamp(205px, calc(135dvh - 246px), 520px);
    padding: 12px 16px;
  }
  #drawer #captured-panel h2 { font-size: 24px; }
  #drawer #captured-panel .panel-head { margin-bottom: 8px; padding-right: 32px; }
  #drawer .capture-body > div { padding-block: 4px; }
  #drawer .slots { margin-top: 3px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .game-layout aside { flex: 0 0 clamp(154px, 32vw, 280px); gap: 6px; }
  aside .command-body { padding: 0 2px; }
  .turn-box { padding: 0; }
  .turn-box h1 { font-size: clamp(18px, 3.5vw, 28px); }
  #turn-detail:empty { min-height: 0; }
  .match-status { margin-bottom: 4px; gap: 4px; font-size: 10px; }
  #match-label { font-size: 15px; }
  #practice-level, .turn-tag { font-size: 10px; }
}
@media (max-height: 480px) {
  dialog, #engagement, #drawer { padding: 12px 16px; }
  dialog .panel-head { margin: 0 0 10px; }
  .page-title, .play-intro { --rule-gap: 6px; margin-block: 6px; }
  .page-title { font-size: 38px; }
}

.settings-layout, .section-screen {
  --section-menu-width: clamp(175px, 21%, 240px);
  grid-template-columns: [menu] var(--section-menu-width) [detail] minmax(0, 1fr);
  gap: clamp(28px, 5vw, 76px);
}
[data-section-menu="right"] :is(.settings-layout, .section-screen) {
  grid-template-columns: [detail] minmax(0, 1fr) [menu] var(--section-menu-width);
}
:is(.settings-layout, .section-screen) > .section-nav { grid-area: 1 / menu; }
.settings-detail, .section-screen > .tab-pane { grid-area: 1 / detail; }
.settings-layout {
  display: grid;
  align-items: start;
  padding-bottom: 36px;
}
body:has(.section-screen:not([hidden])) {
  --page-terrain: url(woodland-terrain.webp?v=1.0.4);
  --terrain-shade: 89%;
  background:
    linear-gradient(100deg, rgb(0 0 0 / 97%), rgb(0 0 0 / 94%) 45%, rgb(0 0 0 / var(--terrain-shade))),
    var(--page-terrain) center / cover no-repeat var(--bg);
  background-blend-mode: normal, luminosity;
}
body:has(#guide-screen:not([hidden])) {
  --page-terrain: url(alpine-terrain.webp?v=1.0.4);
  --terrain-shade: 93%;
}
body:has(.section-screen:not([hidden])) .mast { background: transparent; }
body:has(#play-intro:not([hidden])) {
  background:
    linear-gradient(to top, rgb(0 0 0 / 84%), transparent 14%),
    linear-gradient(to right, rgb(0 0 0 / 52%), rgb(0 0 0 / 24%)),
    url(home-terrain.webp?v=1.0.4) 64% center / cover no-repeat var(--bg);
  background-blend-mode: normal;
}
main:has(> #play-intro:not([hidden])) { grid-area: 2 / 1; }
main { --title-brand-size: clamp(38px, 5vw, 80px); }
main > .page-title {
  font-size: var(--title-brand-size);
  letter-spacing: min(var(--brand-tracking), var(--fitted-tracking, var(--brand-tracking)));
  line-height: 1.12;
}
.play-intro h1 {
  --brand-size: var(--title-brand-size);
  display: flex;
  align-items: center;
  margin: 0;
  font-size: var(--brand-size);
  height: 1.12em;
}
@property --heading-entry {
  syntax: '<number>';
  inherits: false;
  initial-value: 1;
}
@media (prefers-reduced-motion: no-preference) {
  main > .page-title, main .brand {
    letter-spacing: calc(var(--heading-entry, 1) * min(var(--brand-tracking), var(--fitted-tracking, var(--brand-tracking))));
    transition: --heading-entry 460ms cubic-bezier(.25, .8, .25, 1);
  }
  main .heading-entry-start {
    --heading-entry: 0;
    transition-duration: 0s;
  }
  body:has(#play-intro:not([hidden])) #modal[open]::backdrop {
    animation: home-dialog-backdrop 360ms ease-in;
  }
  @keyframes home-dialog-backdrop { from { opacity: 0; } to { opacity: 1; } }
}
#lobby-screen .btn.primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
#lobby-screen .btn.primary:is(:hover, :focus-visible):enabled {
  background: var(--accent-edge);
  color: #fff;
  border-color: var(--accent);
}
#lobby-screen .btn:disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--recess);
  border-color: var(--border);
  filter: grayscale(1);
}
@media (max-width: 620px) {
  main { --title-brand-size: clamp(18px, 8vw, 45px); }
}
@media (max-height: 520px) {
  main { --title-brand-size: clamp(18px, min(8vw, 7dvh), 38px); }
}
.section-screen:has(> .section-nav) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  max-height: 46rem;
  padding-block: clamp(12px, 1.8vw, 26px);
}
#guide-screen:has(> .section-nav) { padding-block-start: 0; }
.section-screen > .section-nav { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
[data-scroll-fade] {
  scroll-padding-block: 22px;
  mask-image: linear-gradient(to bottom, transparent, black var(--fade-top),
    black calc(100% - var(--fade-bottom)), transparent);
}
@media (forced-colors: active) {
  [data-scroll-fade] { mask-image: none; }
}
.section-nav { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 3px; }
@media (min-height: 600px) {
  #settings-nav { position: sticky; top: 0; }
}
.section-nav :is(a, button) {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 12px;
  text-decoration: none;
  text-align: left;
  font: 700 16px/1.2 var(--display);
  color: var(--muted);
  border-inline-start: 2px solid transparent;
}
.section-nav svg { --icon-size: 17px; flex: none; }
.section-nav :is(a, button):hover { color: #fff; background: var(--recess); }
.section-nav :is([aria-current='page'], [aria-selected='true']) {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent-tint);
}
:is(.section-nav, .settings-detail) :is(a, button, input):focus-visible { outline-offset: -2px; }
#settings-nav .section-rule { --rule-gap: 7px; }
#account[aria-current='page'] { color: var(--accent); }
.settings-detail { min-width: 0; }
.settings-detail h2, .tab-pane > h2 { margin: 0 0 12px; font: 700 clamp(26px, 3.4vw, 42px)/1 var(--display); }
.mast :is(button,a):focus-visible, .tab-pane :is(button,a,input):focus-visible { outline-offset: -4px; }
.settings-detail p { margin: 0 0 20px; max-width: 58ch; color: var(--muted); }
.settings-detail label {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  max-width: 410px;
  font-weight: 700;
}
.settings-detail input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--recess);
  border: 1px solid var(--line);
  font-weight: 400;
}
.settings-detail .btn { min-height: 42px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions .destructive { border-color: #99564e; color: #ffb7a8; }
#settings-error, #settings-status { margin: 14px 0 0; }
#settings-error { color: #ffb7a8; }
#settings-status { color: var(--accent); }
#settings-error:empty, #settings-status:empty { display: none; }
.settings-results { margin-bottom: 18px; }
#preferred-colors { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#preferred-colors .color-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 6px;
  min-height: 108px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--recess);
  font: 700 16px/1.2 var(--display);
}
#preferred-colors .color-option img { width: 52px; height: 48px; object-fit: contain; }
#preferred-colors .color-option span { gap: 2px; }
#preferred-colors .color-option small { font: 400 12px/1 var(--display); }
#preferred-colors .color-option[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-tint); }
#preferred-colors .color-option:hover { border-color: var(--ink); }
@media (max-width: 780px) {
  #preferred-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .settings-layout, .section-screen { --section-menu-width: clamp(88px, 24vw, 128px); gap: 14px; }
  .section-screen:has(> .section-nav) { --section-menu-width: clamp(94px, 24vw, 128px); padding-block: 10px; }
  .section-nav :is(a, button) { min-height: 44px; padding: 8px; font-size: 15px; }
  .section-nav [role="tab"] { flex-wrap: wrap; gap: 3px; padding-inline: 5px; font-size: 14px; }
  .section-nav svg { display: none; }
  #preferred-colors { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  #preferred-colors .color-option { min-height: 90px; padding: 8px; }
  #preferred-colors .color-option img { width: 40px; height: 36px; }
  .settings-detail .list-row { flex-wrap: wrap; }
  .settings-detail p { margin-bottom: 14px; }
}

body {
  --footer-min: 52px;
  --footer-mark: 36px;
  --footer-pad: 8px;
  --site-footer-height: calc(max(var(--footer-min), var(--footer-mark) + var(--footer-pad) + var(--footer-pad) + 1px) + env(safe-area-inset-bottom));
  --activity-inset: clamp(10px, 1.2vw, 18px);
  --activity-right: max(var(--activity-inset), env(safe-area-inset-right));
  --activity-bottom: calc(var(--site-footer-height) + var(--activity-inset));
  --activity-width: 102px;
  --activity-height: 28px;
  --activity-gap: 8px;
}
.activity {
  position: fixed;
  right: var(--activity-right);
  bottom: var(--activity-bottom);
  z-index: 6;
}
#activity-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: var(--activity-width);
  height: var(--activity-height);
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 60%);
  font: 700 12px/1 var(--display);
  white-space: nowrap;
}
#activity-toggle:is(:hover, :focus-visible) { color: #fff; outline-color: currentColor; }
#activity-toggle svg { --icon-size: 11px; }
.unread-count {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 15px;
  padding: 1px 3px;
  border: 1px solid var(--recess);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: bold 10px/1.1 var(--mono);
}
#activity-panel {
  position: absolute;
  bottom: calc(var(--activity-height) + var(--activity-gap));
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(350px, calc(100vw - var(--activity-right) - max(var(--activity-inset), env(safe-area-inset-left))));
  max-height: calc(100dvh - var(--activity-bottom) - var(--activity-height) - var(--activity-gap) - max(var(--activity-inset), env(safe-area-inset-top)));
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 6px 28px #000b;
  overflow: hidden;
}
#activity-list { list-style: none; margin: 0; padding: 0; min-height: 0; max-height: min(65dvh, 520px); overflow: auto; overscroll-behavior: contain; }
.activity-row { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px; }
.activity-copy { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 5px 8px; }
.activity-row:not(:has(.battle-preview)) .activity-copy { grid-column: 1 / -1; }
.activity-row + .activity-row { border-top: 1px solid var(--border); }
.activity-row strong { font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.activity-row time, .activity-row small { font: 11px/1.4 var(--mono); color: var(--muted); }
.activity-copy > :is(small, span, div) { grid-column: 1 / -1; }
.activity-record { font-size: 14px; }
.activity-actions { display: flex; gap: 8px; margin-top: 3px; }
.activity-actions .btn { min-height: 32px; padding: 4px 12px; }
.activity-open::after { content: ''; position: absolute; inset: 0; }
.activity-row:has(.activity-open):is(:hover, :focus-within) { background: var(--accent-tint); }
.activity-own { color: #aaaab0; background: var(--recess); }
.activity-own .battle-preview { filter: grayscale(.85) brightness(.78); }
.activity-own small, .activity-own time { color: #98999e; }
#activity-empty { margin: 0; padding: 15px; color: var(--muted); }
body:has(#activity:not([hidden])) #account-screen,
body:has(#activity:not([hidden])) main:has(> :is(#lobby-screen, #guide-screen):not([hidden])) {
  padding-bottom: calc(var(--activity-inset) + var(--activity-height));
}
@media (max-width: 900px), (max-height: 540px) {
  body { --activity-height: 26px; }
}
@media (min-width: 901px), (orientation: landscape) {
  body:has(#activity:not([hidden])) .legend {
    --legend-clearance: calc(var(--activity-width) + var(--activity-right) + 6px);
    padding-inline: calc(var(--left) + var(--legend-clearance)) var(--legend-clearance);
    min-height: calc(var(--activity-inset) + var(--activity-height));
  }
  @container battlefield (max-width: 490px) {
    body:has(#activity:not([hidden])) .legend {
      padding-inline: var(--left) 0;
      padding-bottom: calc(var(--activity-inset) + var(--activity-height));
    }
  }
}
@media (max-width: 900px) and (orientation: portrait) {
  body:has(#activity:not([hidden])) .drawer-bar {
    margin-inline-end: calc(var(--activity-width) + var(--activity-right));
    min-height: calc(var(--activity-height) + 4px);
  }
}

/* Header section shortcuts share their destinations with the page sidebars. */
.nav-group { position: relative; display: flex; align-items: stretch; min-width: 0; }
.account-group { max-width: 32%; }
.mast .account-group .account { order: 0; margin: 0; min-width: 0; max-width: none; }
#account-callsign { font-weight: 700; }
#account-rank {
  display: grid; place-items: center; flex: none; width: 32px; min-height: 38px; padding-inline: 0;
  color: var(--accent); border-radius: 3px;
}
#account-rank > svg { --icon-size: 18px; }
#account-rank[data-rank="unranked"] { color: var(--muted); }
#account-rank:is(:hover, :focus-visible) { background: var(--accent-tint); color: #fff; }
#modal:has(#rank-award:not([hidden])) {
  width: min(438px, calc(100% - 28px));
  padding: 0;
  background: var(--recess);
  box-shadow: 0 18px 72px #000c;
}
#rank-award {
  --award-face: color-mix(in srgb, var(--accent-edge) 35%, #25282b);
  background: radial-gradient(ellipse at 50% 28%, var(--award-face), #191b1d 47%, #0e0f10 88%);
  text-align: center;
}
.award-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 15px 0 21px;
  color: #fff; font: 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.award-head button { display: grid; place-items: center; width: 34px; height: 34px; }
.award-display { padding: 2px 16px 24px; }
.award-display:has(.award-decoration[hidden]) { padding-block: 20px 28px; }
.award-decoration {
  position: relative; width: 112px; height: 139px; margin: 0 auto 20px;
  filter: drop-shadow(0 5px 5px #0008);
}
.award-ribbon {
  position: absolute; inset: 0 26% auto; height: 49px;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
  background:
    repeating-linear-gradient(0deg, #0003 0 1px, #ffffff0a 1px 2px, transparent 2px 3px),
    linear-gradient(90deg, var(--accent-edge) 0 8%, var(--accent) 8% 12%, transparent 12% 88%, var(--accent) 88% 92%, var(--accent-edge) 92%),
    linear-gradient(90deg, var(--accent-edge), var(--accent), var(--accent-edge));
  border-top: 3px solid var(--accent);
}
.award-decoration::before {
  content: ''; position: absolute; top: 42px; left: calc(50% - 5px); width: 10px; height: 12px;
  border: 2px solid var(--accent); border-radius: 50%;
}
#award-medal {
  position: absolute; inset: auto 8px 0; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; isolation: isolate;
  background: conic-gradient(from 30deg, var(--accent-edge), var(--accent) 26%, var(--accent-edge) 42%, var(--accent) 57%, var(--accent-edge));
  box-shadow: inset 0 0 0 1px #ffffff52, 0 2px 1px var(--accent-edge);
}
#award-medal::before {
  content: ''; position: absolute; inset: 5px; z-index: -1; border: 1px solid var(--accent-edge);
  border-radius: 50%;
  background: repeating-linear-gradient(120deg, #ffffff07 0 1px, transparent 1px 3px),
    linear-gradient(145deg, var(--award-face), #181a1d 52%, var(--award-face));
  box-shadow: inset 0 0 0 2px #181a1d, inset 0 0 0 3px var(--accent-border);
}
#award-medal .rank-insignia {
  --icon-size: 53%; color: #fff;
  transform: translateY(-6%);
  filter: drop-shadow(0 1px 0 var(--accent-edge)) drop-shadow(0 2px 1px #08090b);
}
#award-holder {
  margin: 0 0 5px; color: #fff;
  font: 12px/1.4 var(--mono); letter-spacing: .11em; text-transform: uppercase; overflow-wrap: anywhere;
}
#award-title {
  margin: 0;
  font: 700 clamp(22px, 6vw, 31px)/1.16 var(--display);
  text-transform: uppercase; letter-spacing: min(var(--brand-tracking), var(--fitted-tracking, var(--brand-tracking)));
  text-wrap: balance; color: #fff;
}
.award-record { padding: 16px 20px 19px; background: #0b0d0db3; color: var(--ink); }
#award-first { margin: 0; font-size: 15px; text-wrap: balance; }
#award-first:not([hidden]) + #award-stats { margin-top: 14px; }
#award-stats { display: flex; justify-content: space-evenly; gap: 10px; margin: 0; }
#award-stats div { display: flex; flex-direction: column-reverse; }
#award-stats dt { font-size: 13px; color: var(--muted); }
#award-stats dd { margin: 0 0 3px; font: 18px/1.1 var(--mono); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  #modal[open] .award-decoration { animation: present-medal 420ms ease-out both; }
  @keyframes present-medal {
    from { opacity: 0; transform: translateY(-9px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
@media (max-height: 480px) {
  .award-decoration { height: 104px; width: 86px; margin-bottom: 9px; }
  .award-ribbon { height: 37px; }
  .award-decoration::before { top: 29px; }
  .award-display { padding-bottom: 13px; }
  .award-record { padding-block: 12px; }
}
#rank-notice {
  position: fixed; z-index: 8; inset: auto max(12px, env(safe-area-inset-right)) max(calc(var(--site-footer-height) + 68px), calc(var(--activity-bottom) + var(--activity-height) + var(--activity-gap))) auto;
  display: flex; align-items: flex-start; gap: 14px; width: max-content; max-width: calc(100vw - 24px);
  padding: 14px; background: var(--panel); border: 1px solid var(--accent-border); box-shadow: 0 6px 22px #0009;
}
#rank-notice-message { display: flex; align-items: center; gap: 12px; }
#rank-notice-message .rank-insignia { --icon-size: 30px; color: var(--accent); }
#rank-notice-message strong { display: block; font-size: 19px; line-height: 1.2; }
#rank-notice-message small { color: var(--muted); }
#dismiss-rank { padding: 4px; }
.result-rank .rank-insignia { margin-right: 6px; color: #fff; }
.section-toggle { display: grid; place-items: center; min-width: 30px; padding-inline: 0; color: var(--muted); }
.section-toggle:is(:hover, [aria-expanded="true"]) { color: var(--accent); }
.section-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.section-links {
  position: absolute;
  inset: 100% 0 auto auto;
  z-index: 1;
  width: max-content;
  min-width: 190px;
  max-height: min(65dvh, 28rem);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border);
  background: #101113;
  box-shadow: 0 10px 24px #0009;
}
.section-links button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px;
  padding: 7px 11px; text-align: left; color: var(--ink);
}
.section-links button:is(:hover, :focus-visible) { background: var(--accent-tint); color: #fff; }
.section-links svg { --icon-size: 17px; }
@media (max-width: 900px) {
  .mast .account-group { order: 1; max-width: 52%; margin-left: auto; }
  .mast-inner:has(#account-rank:not([hidden])) .nav-toggle { order: 0; }
  .mast .section-toggle { min-width: 36px; }
  .mast #main-nav { max-height: 80dvh; overflow-y: auto; }
  #main-nav .nav-group { display: grid; grid-template-columns: 1fr auto; }
  #main-nav .section-links {
    position: static; grid-column: 1 / -1; width: 100%; max-height: none;
    padding-inline-start: 14px; border: 0; box-shadow: none;
  }
}
@media (max-width: 400px) {
  .mast .mast-inner { gap: 6px; }
}
@media (max-width: 600px) {
  .mast .account-group { max-width: 60%; min-width: 0; }
  .mast #account { gap: 5px; padding: 3px 0; }
  .mast .account-group .section-toggle { min-width: 24px; }
}

.career-summary { margin: 0 0 20px; }
.guest-lobby .session-record { margin: 14px 0 0; }
.career-summary h2, .leaderboard-heading { margin: 0 0 7px; font-size: 18px; }
.career-summary dl { display: flex; flex-wrap: wrap; gap: 8px 30px; margin: 0; }
.career-summary dt { color: var(--muted); font-size: 14px; }
.career-summary dd, .standing-record, .standing-place { font: 13px/1.5 var(--mono); }
.career-summary dd { margin: 2px 0 0; }
.standings { margin: 10px 0; padding: 0; list-style: none; container-type: inline-size; }
.standings li {
  display: grid; grid-template-columns: 3ch minmax(0,1fr) auto;
  gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.standing-identity { display: flex; gap: 6px; align-items: center; color: var(--muted); overflow-wrap: anywhere; }
.standing-identity > span { min-width: 0; }
.standing-identity strong { color: var(--ink); }
.standing-place { align-self: start; padding-top: 4px; color: var(--accent); }
.standing-record { display: block; margin-top: 3px; }
.standings .btn { justify-self: start; }
.rank-insignia { display: inline-block; vertical-align: middle; --icon-size: 1.1em; }
.rank-list .rank-insignia { margin-inline-end: 5px; color: var(--accent); }
.promotion-list { margin: 0; padding: 0; list-style: none; }
.promotion-list li { display: flex; align-items: center; gap: .5em; margin-block: 5px; }
.standings .rank-insignia, .promotion-list .rank-insignia { color: var(--accent); }
.piece > .rank-insignia {
  position: absolute; top: 2px; left: 2px; --icon-size: 23%; pointer-events: none;
  color: #fff; background: #101113db; border-radius: 1px;
}
.piece:has(> .rank-insignia)::before { left: auto; right: 2px; }
@container (max-width: 410px) {
  .standings li { grid-template-columns: 3ch minmax(0,1fr); }
  .standings .btn { grid-column: 2; }
}


@media (max-width: 620px) {
  .section-screen:has(> .section-nav), [data-section-menu] .settings-layout {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: auto minmax(0,1fr);
    gap: 8px;
  }
  [data-section-menu] :is(.section-screen,.settings-layout) > .section-nav {
    grid-area: 1 / 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    position: static;
  }
  [data-section-menu] :is(.section-screen > .tab-pane,.settings-detail) { grid-area: 2 / 1; }
  .section-nav :is([role="tab"],a,button) { flex: none; white-space: nowrap; }
  .section-nav [role="tab"] { flex-wrap: nowrap; }
  .section-nav .section-rule { display: none; }
  .tab-pane { padding-inline-end: 8px; }
  .match-row > div:has(> strong) { min-width: min(100%, 23ch); }
}

@media (max-width: 620px) {
  #lobby-screen > .section-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0,1fr);
    grid-template-columns: none;
  }
  #lobby-screen .section-nav [role="tab"] {
    justify-content: center;
    flex-wrap: wrap;
    column-gap: 3px;
    padding-inline: 2px;
    white-space: normal;
    text-align: center;
  }
  .mast #account-callsign { line-height: 1.1; }
  .mast .account-group { max-width: 74%; }
}
@media (max-width: 420px) {
  .mast:has(.long-callsign) #header-brand .brand { font-size: 0; letter-spacing: 0; }
  .mast:has(.long-callsign) #header-brand .brand-mark { width: 20px; margin: 0; }
}

@media (max-width: 359px) {
  #lobby-screen .section-nav [role="tab"] { font-size: 13px; padding-inline: 1px; }
}

#home-brand .brand { cursor: default; }
.settings-detail a, .notice-page main a, .notice-content a, noscript a { color: var(--ink); text-underline-offset: .18em; }
.settings-detail .terms-check { display: block; line-height: 1.5; }
.settings-detail .terms-check input, :is(.notice-page, .notice-content) input[type=checkbox] { display: inline-block; width: 1rem; height: 1rem; min-height: 0; vertical-align: middle; margin-right: .35em; }
html.notice-root { height: auto; overflow: auto; }
body.notice-page { display: block; position: static; height: auto; overflow: visible; }
.notice-page main { display: block; width: min(100%, 48rem); margin: auto; padding: 2rem clamp(1rem,4vw,3rem) 4rem; height: auto; overflow: visible; }
.notice-page section { margin-block: 2.25rem; scroll-margin-top: 1rem; }
.notice-page h1 { font-size: clamp(2rem,6vw,3.5rem); line-height: 1.05; }
:is(.notice-page, .notice-content) :is(p, li) { line-height: 1.55; }
:is(.notice-page, .notice-content) :is(input:not([type=checkbox]), textarea) { display: block; width: 100%; margin-block: .45rem .9rem; }
:is(.notice-page, .notice-content) textarea { font: inherit; color: inherit; background: var(--surface); padding: .7rem; }
:is(.notice-page, .notice-content) form { margin-block: 1.25rem; }
:is(.notice-page, .notice-content) [role=status] { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-page #contact:not(:target) { display: none; }

body:has(#app-shell) { grid-template-rows: auto minmax(0,1fr) var(--site-footer-height); }
@media (max-width: 520px) {
  body {
    --footer-min: clamp(42px, 26px + 5vw, 52px);
    --footer-mark: clamp(32px, 25.6px + 2vw, 36px);
    --footer-pad: clamp(5px, 3.4px + .5vw, 6px);
  }
}
.site-footer {
  grid-area: 3 / 1;
  display: grid;
  align-items: center;
  min-height: var(--site-footer-height);
  padding-block: var(--footer-pad) calc(var(--footer-pad) + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .07);
  background-color: rgb(0 0 0 / 60%);
  color: var(--muted);
}
.site-footer > div, .site-footer nav { display: flex; align-items: center; }
.site-footer > div { justify-content: space-between; gap: 4px; }
.site-footer nav { gap: clamp(6px, 1.6vw, 20px); }
.site-footer small, .splash-version { font: 700 12px/1.25 var(--display); }
.site-footer a { font: 400 13px/1.25 var(--display); color: #b1b1b5; text-decoration: none; }
.site-footer nav a { display: inline-flex; min-height: 26px; align-items: center; color: #858585; }
.site-footer nav a:first-child { font-weight: 700; }
.site-footer a:is(:hover,:focus-visible) { color: white; }
.site-footer a:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.creator-credit { display: grid; place-items: center; width: var(--footer-mark); height: var(--footer-mark); }
.creator-credit img { width: 100%; height: 100%; opacity: .65; }
.creator-credit:is(:hover,:focus-visible) img { opacity: 1; }

#modal:has(.notice-content) { width: min(660px, calc(100% - 28px)); overflow: hidden; }
#modal:has(.notice-content) #dialog-body { display: flex; flex-direction: column; max-height: calc(84dvh - 2 * clamp(18px, 3.5vw, 40px)); }
#modal:has(.notice-content) .dialog-content { overflow: auto; overscroll-behavior: contain; padding: 3px; }
.notice-content { line-height: 1.55; }
.notice-content h3 { margin-block: 1.25em .4em; }
.notice-content ul { padding-inline-start: 1.3em; }
.notice-content li { margin-block: .55em; }
.notice-content #preference-control { display: block; }
.notice-content #preference-control[hidden] { display: none; }
.notice-content textarea { resize: vertical; max-height: 35dvh; min-height: 5em; }
