#lobby {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  background: var(--menu-ink);
  color: var(--menu-text);
}

.lobby-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1250px, 100%);
  height: 100%;
  margin: auto;
  padding: clamp(10px, 3vh, 30px) clamp(14px, 3.2vw, 42px) clamp(10px, 2.8vh, 26px);
}

.lobby-header, .lobby-brand, .lobby-currencies, .lobby-currencies > div, .lobby-currencies dt {
  display: flex;
  align-items: center;
}

.lobby-header {
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 62px;
  gap: 6px 16px;
  padding-block: 8px;
  border-bottom: 1px solid var(--menu-line);
}

.lobby-brand { gap: 9px; }

.lobby-brand img {
  display: block;
  width: 144px;
  height: auto;
  image-rendering: pixelated;
}

.lobby-currencies {
  gap: 8px;
  font-size: 12px;
  margin: 0;
}

.lobby-currencies > div {
  justify-content: space-between;
  gap: 12px;
  min-width: 102px;
  padding: 5px 11px;
  border: 1px solid var(--menu-line);
  background: var(--menu-panel);
  color: var(--menu-muted);
}

.lobby-currencies dt { gap: 6px; white-space: nowrap; }
.lobby-currencies dd {
  margin: 0;
  color: var(--menu-gold);
  font: 700 14px var(--menu-mono);
  overflow-wrap: anywhere;
  text-align: right;
}

#lobby-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin-block: clamp(12px, 2.8vh, 27px);
}

#lobby-content > :is(.lobby-heading, .squad-header, .unit-filter, .detail-back, .sortie-back) {
  flex: none;
}

.lobby-nav {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1vw, 12px);
  border-top: 1px solid var(--menu-line);
  padding-top: 12px;
}

#lobby button span:not(.unit-emblem, .collection-art, .collection-caption) {
  float: none;
  opacity: 1;
  letter-spacing: 0;
}

#lobby :is(button, input, select):focus-visible, #modal .lobby-character-options button:focus-visible {
  outline: 2px solid var(--menu-gold);
  outline-offset: 2px;
}

.lobby-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 9px;
  max-width: 156px;
  min-width: 0;
  min-height: 48px;
  color: var(--menu-muted);
  padding: 6px;
  white-space: nowrap;
}

.lobby-nav button[aria-current="page"] {
  color: var(--menu-text);
  background: var(--menu-selected);
  border-color: var(--menu-line);
  box-shadow: inset 0 -2px var(--menu-gold);
}

#lobby h1 {
  font: 700 clamp(27px, 3.6vw, 39px)/1.2 var(--menu-serif);
  letter-spacing: .11em;
  overflow-wrap: anywhere;
  margin: 0;
}

.lobby-heading {
  margin-bottom: 22px;
}

.lobby-heading p, .lobby-note {
  color: var(--menu-muted);
  margin: 8px 0 0;
}

.lobby-panel {
  background: var(--menu-panel);
  border: 1px solid var(--menu-line);
  padding: clamp(16px, 2.2vw, 29px);
}

.lobby-panel h2 {
  margin: 0;
  font: 600 21px/1.4 var(--menu-serif);
  color: var(--menu-text);
}

#lobby:is([data-view="home"], [data-view="sortie"]) #lobby-content {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--menu-metal) var(--menu-ink);
  padding: 3px;
}

.lobby-home {
  display: grid;
  flex: 1 0 auto;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 74px);
  min-height: 395px;
}

.lobby-character {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.lobby-character-art {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 0;
}

.lobby-character-art > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

#lobby .lobby-character-art .unit-emblem {
  width: 108px;
  height: 108px;
  background: var(--menu-panel);
  border: 1px solid var(--menu-line);
  font-size: 48px;
}

.lobby-character-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  justify-self: center;
  gap: 12px;
  width: min(100%, 340px);
  padding: 9px 2px 4px;
  border-top: 1px solid var(--menu-metal);
}

.lobby-character-caption small, .lobby-character-caption strong { display: block; }
.lobby-character-caption small { color: var(--menu-muted); }
.lobby-character-caption small > span { margin-left: 6px; color: var(--menu-gold); font-family: var(--menu-mono); }
.lobby-character-caption strong { font: 700 clamp(19px, 2.2vw, 27px)/1.2 var(--menu-serif); }
.lobby-character-caption button { flex: none; min-height: 40px; padding: 6px 13px; }

.lobby-operations {
  align-self: center;
  width: min(100%, 505px);
}

.lobby-patrol, .sortie-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 146px;
  padding: clamp(14px, 2.2vw, 24px);
  background: #090807;
}

.lobby-patrol-art {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.lobby-patrol small, .sortie-stage small, .sortie-stages legend {
  color: var(--menu-gold);
  font-size: 12px;
}

.lobby-patrol h2, .sortie-stage strong {
  display: block;
  margin: 3px 0;
  font: 700 clamp(23px, 3vw, 35px)/1.18 var(--menu-serif);
}

.lobby-patrol p { margin: 6px 0 0; color: var(--menu-muted); font-size: 12px; }

.lobby-commands {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 10px;
  margin-top: 12px;
}

#lobby .lobby-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 3px 8px;
  min-height: 84px;
  padding: 12px clamp(12px, 2vw, 22px);
  border-color: var(--menu-metal);
}

.lobby-command strong { font: 700 29px/1 var(--menu-serif); letter-spacing: .1em; }
.lobby-command small { color: var(--menu-muted); font-size: 11px; }
.lobby-command > span { grid-area: 1 / 2 / span 2; place-self: center; }

#lobby .lobby-command-sortie {
  color: #1a1008;
  background: #c3945c;
  border-color: #edc68e;
  box-shadow: inset 0 -4px #916439;
}

#lobby .lobby-command-sortie:hover { background: #e4ba7f; }
.lobby-command-sortie small { color: #402710; }
.lobby-command-sortie::before, .lobby-command-sortie::after { border-color: #ffe0a9; }
.lobby-arrow {
  width: 23px;
  height: 17px;
  background: currentColor;
  clip-path: polygon(0 35%, 55% 35%, 55% 0, 69% 0, 69% 18%, 83% 18%, 83% 35%, 100% 35%, 100% 65%, 83% 65%, 83% 82%, 69% 82%, 69% 100%, 55% 100%, 55% 65%, 0 65%);
}

.sortie-back { align-self: start; margin-bottom: 12px; }

.sortie-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(14px, 3vw, 35px);
  width: min(950px, 100%);
}

.sortie-stages { min-width: 0; margin: 0; padding: 0; border: 0; }
.sortie-stages legend { padding: 0; margin-bottom: 8px; }
.sortie-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; cursor: pointer; }
.sortie-stage:has(input:checked) { border-color: var(--menu-metal); }
.sortie-stage input { width: 18px; height: 18px; margin: 0; accent-color: var(--menu-gold); cursor: pointer; }
.sortie-stage strong { font-size: clamp(20px, 2.6vw, 28px); }

.sortie-brief { background: var(--menu-panel); padding: clamp(16px, 2.2vw, 28px); margin-top: 27px; }
.sortie-brief h2 { margin: 0; font: 700 22px/1.25 var(--menu-serif); }
.sortie-brief p { margin: 9px 0 0; color: var(--menu-muted); }
.sortie-brief .sortie-status { color: var(--menu-gold); }
.sortie-brief button { display: flex; justify-content: space-between; width: 100%; margin-top: 18px; }

.lobby-character-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
  gap: 8px;
  padding: 3px;
}

.lobby-character-options button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  min-height: 48px;
  overflow-wrap: anywhere;
}

#modal .lobby-character-options button[aria-pressed="true"] { border-color: var(--menu-gold); background: var(--menu-selected); }
.lobby-character-options button > span { display: grid; place-items: center; flex: 0 0 32px; opacity: 1; }
.lobby-character-options img { width: 32px; height: 32px; object-fit: contain; }

.squad-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.squad-header .lobby-heading {
  margin-bottom: 0;
}

.squad-core {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 8px 12px;
  background: var(--menu-panel);
  border-color: var(--menu-metal);
  text-align: left;
}

.squad-core-copy {
  display: grid;
  gap: 2px;
}

.squad-core-copy small {
  color: var(--menu-gold);
  font-size: 10px;
  white-space: nowrap;
}

.squad-core-copy strong {
  font-size: 14px;
  line-height: 1.2;
}

.squad-core-link {
  color: var(--menu-gold);
  font-size: 11px;
  white-space: nowrap;
}

.squad-choice small { color: var(--menu-muted); font-size: 11px; }

.squad-layout {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  min-height: 0;
}

.squad-adjustment, .recruit-pool {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}

.squad-seats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.squad-seat {
  min-height: 105px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 10px 4px;
  text-align: center;
  background: var(--menu-panel);
}

.squad-seat small {
  color: var(--menu-muted);
  font-size: 10px;
}

.squad-seat strong {
  max-width: 100%;
  line-height: 1.3;
  font-size: 12px;
  overflow-wrap: anywhere;
}

#lobby .squad-seat[aria-pressed="true"] {
  background: var(--menu-selected);
  border-color: var(--menu-gold);
}

#lobby .unit-emblem {
  display: grid;
  place-items: center;
  float: none;
  opacity: 1;
  letter-spacing: 0;
  width: 35px;
  height: 35px;
  overflow: hidden;
  background: color-mix(in srgb, var(--role-color) 12%, #100d0c);
  border: 1px solid color-mix(in srgb, var(--role-color) 39%, transparent);
  color: var(--role-color);
  font: 21px var(--menu-serif);
}

.unit-emblem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#lobby :is(.squad-layout, .squad-core, .detail-art) .unit-emblem:has(img) {
  background: transparent;
  border: 0;
}

:is(.squad-layout, .squad-core, .detail-art) .unit-emblem img {
  object-fit: contain;
}

.squad-choice-list {
  display: grid;
  gap: 6px;
  max-height: min(51vh, 400px);
  min-height: 0;
  overflow: auto;
  margin-top: 13px;
  padding: 4px 5px 4px 4px;
}

.squad-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  background: var(--menu-ink);
  font-size: 12px;
}

.squad-choice strong small {
  display: block;
  font-weight: 400;
}

.squad-choice-action {
  text-align: right;
}

#lobby .lobby-text-button {
  padding: 6px 0;
  background: none;
  border-color: transparent;
  color: var(--menu-gold);
}

#lobby .lobby-text-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.squad-adjustment .lobby-text-button {
  align-self: flex-start;
  margin-top: 10px;
}

.recruit-layout {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(200px, .8fr) minmax(0, 1.2fr);
  flex: 1;
  gap: 14px;
  min-height: 0;
  max-height: 560px;
}

.recruit-stage {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 32px;
  padding: clamp(16px, 3vw, 34px);
}

.recruit-writ {
  position: relative;
  isolation: isolate;
  width: min(100%, 178px);
  aspect-ratio: 5 / 3;
  background: #6f422e;
  clip-path: polygon(0 12%, 4% 12%, 4% 4%, 9% 4%, 9% 0, 91% 0, 91% 4%, 96% 4%, 96% 12%, 100% 12%, 100% 88%, 96% 88%, 96% 96%, 91% 96%, 91% 100%, 9% 100%, 9% 96%, 4% 96%, 4% 88%, 0 88%);
}

.recruit-writ::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 4px;
  background:
    linear-gradient(90deg, #a46b43 0 7%, #cb955b 7% 13%, #d8a96b 13% 88%, #b57b4c 88% 94%, #895638 94%);
  clip-path: inherit;
  box-shadow: inset 0 3px #f4d197, inset 0 -4px #a36a44;
}

.writ-lines {
  position: absolute;
  left: 17%;
  top: 31%;
  width: 47%;
  height: 9%;
  border-top: 2px solid #a06d46;
  border-bottom: 2px solid #b58051;
}

.writ-lines::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 68%;
  height: 2px;
  background: #b58051;
}

.writ-seal {
  position: absolute;
  right: 16%;
  bottom: 14%;
  display: grid;
  place-items: center;
  width: 23%;
  aspect-ratio: 1;
  background: #753935;
  box-shadow: inset 0 3px #b45d47, inset 0 -3px #512927;
  clip-path: polygon(20% 0, 80% 0, 80% 10%, 90% 10%, 90% 20%, 100% 20%, 100% 80%, 90% 80%, 90% 90%, 80% 90%, 80% 100%, 20% 100%, 20% 90%, 10% 90%, 10% 80%, 0 80%, 0 20%, 10% 20%, 10% 10%, 20% 10%);
}

.recruit-controls {
  width: min(100%, 240px);
  text-align: center;
}

.recruit-controls small {
  display: block;
  margin-top: 9px;
  color: var(--menu-muted);
  font-size: 11px;
}

.recruit-draw {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 45px;
  padding: 8px 12px;
}

.recruit-draw:disabled { justify-content: center; }

.recruit-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 9px;
  border-left: 1px solid #865a36;
  font: 700 12px var(--menu-mono);
}

.recruit-cost .menu-icon { filter: brightness(.32); }

.recruit-pool {
  min-width: 0;
  background: var(--menu-panel);
}

.recruit-pool header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--menu-line);
}

.recruit-pool h2 {
  margin: 0;
  font: 700 19px/1.3 var(--menu-serif);
}

.recruit-pool h2 span {
  margin-left: 5px;
  color: var(--menu-gold);
  font: 12px var(--menu-mono);
  white-space: nowrap;
}

.recruit-pool header small {
  color: var(--menu-muted);
  font-size: 11px;
}

.recruit-pool ul {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0 15px;
  list-style: none;
  background: var(--menu-ink);
}

.recruit-pool li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding-block: 6px;
  border-bottom: 1px solid #30251e;
}

.recruit-pool li:last-child { border-bottom: 0; }

.recruit-pool-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--menu-panel);
  color: var(--menu-gold);
  font-size: 19px;
}

.recruit-pool-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.recruit-pool li strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.recruit-pool li small {
  display: block;
  color: var(--menu-muted);
  font-size: 11px;
}

.recruit-pool li b {
  color: var(--menu-gold);
  font: 700 13px var(--menu-mono);
  text-align: right;
}

.recruit-pool p {
  margin: 0;
  padding: 8px 15px;
  border-top: 1px solid var(--menu-line);
  color: var(--menu-muted);
  font-size: 11px;
}

#modal:has(.recruit-result) {
  width: 422px;
  padding: clamp(15px, 2.6vw, 26px);
}

.recruit-result {
  display: grid;
  gap: 15px;
}

.recruit-result-stage {
  position: relative;
  height: clamp(128px, 29vh, 198px);
  border: 1px solid var(--menu-line);
  background: var(--menu-ink);
}

.recruit-result-stage::before {
  content: "";
  position: absolute;
  bottom: 9%;
  left: 24%;
  width: 52%;
  height: 3px;
  background: #30241d;
}

canvas.recruit-idle {
  position: absolute;
  inset: 6px 8px;
  width: calc(100% - 16px);
  height: calc(100% - 12px);
  object-fit: contain;
  pointer-events: none;
}

.recruit-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recruit-result-icon {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid var(--menu-metal);
  background: var(--menu-panel);
  color: var(--menu-gold);
  font-size: 24px;
}

.recruit-result-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.5);
}

#modal .recruit-identity h2 {
  min-width: 0;
  margin: 0;
  font-size: clamp(19px, 4.2vw, 26px);
  letter-spacing: .05em;
  overflow-wrap: anywhere;
}

#close-recruit-result {
  justify-self: end;
  min-width: 90px;
  text-align: center;
}

.unit-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
  color: var(--menu-muted);
}

.unit-filter select {
  border: 1px solid var(--menu-line);
  background: var(--menu-panel);
  color: var(--menu-text);
  padding: 6px 10px;
  min-width: 115px;
  font: inherit;
}

.unit-collection {
  display: grid;
  min-height: 0;
  overflow: auto;
  grid-template-columns: repeat(auto-fill, minmax(137px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  padding: 4px;
  margin-inline: -4px;
  margin-bottom: -4px;
}

:is(.unit-collection, .recruit-pool ul, .squad-choice-list) {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--menu-metal) var(--menu-ink);
}

.collection-unit {
  display: grid;
  padding: 0;
  overflow: hidden;
  border-top-color: color-mix(in srgb, var(--role-color) 57%, transparent);
}

#lobby .collection-art, #lobby .collection-caption {
  float: none;
  opacity: 1;
  letter-spacing: 0;
}

.collection-art {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--role-color) 9%, var(--menu-ink));
  color: var(--role-color);
  font: 44px/1 var(--menu-serif);
}

.collection-art {
  height: 88px;
}

.collection-art img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

#lobby .collection-caption {
  padding: 9px 11px;
  font-size: 13px;
}

.collection-caption small {
  display: block;
  color: var(--menu-muted);
  margin-top: 2px;
}

.detail-layout {
  display: grid;
  grid-template-columns: clamp(142px, 16vw, 184px) minmax(0, 1fr);
  grid-template-areas:
    "media heading"
    "media stats"
    "media skills"
    "actions actions";
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px 22px;
  min-height: 0;
  padding: clamp(14px, 2vw, 24px);
}

.detail-back {
  align-self: flex-start;
  margin-bottom: 9px;
}

.detail-heading {
  grid-area: heading;
  min-width: 0;
}

#lobby .detail-heading h1 {
  font-size: clamp(24px, 3vw, 38px);
}

.detail-media {
  grid-area: media;
  display: grid;
  grid-template-rows: clamp(132px, 23vh, 192px) 112px;
  gap: 8px;
  min-width: 0;
}

.detail-art {
  display: grid;
  place-items: center;
  padding: 8px;
  background: color-mix(in srgb, var(--role-color) 9%, var(--menu-ink));
  border: 1px solid color-mix(in srgb, var(--role-color) 30%, var(--menu-line));
}

.detail-art > img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.detail-preview {
  display: grid;
  grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
  place-items: center;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--menu-line);
  background: var(--menu-panel);
}

canvas.detail-idle {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-preview figcaption {
  width: 85%;
  border-top: 1px solid var(--menu-line);
  color: var(--menu-muted);
  font-size: 10px;
  text-align: center;
}

.detail-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  color: var(--role-color);
  margin-top: 7px;
}

.detail-status span {
  color: var(--menu-muted);
  border: 1px solid var(--menu-line);
  padding: 1px 6px;
  font-size: 11px;
}

.detail-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--menu-line);
}

.unit-growth, .detail-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.unit-growth {
  margin-right: auto;
  color: var(--menu-muted);
}

.unit-growth b { color: var(--menu-gold); }

.detail-actions button {
  padding: 6px 11px;
}

.detail-stats {
  grid-area: stats;
  align-self: start;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}

.detail-stats div {
  padding: 6px 8px;
  background: var(--menu-panel);
  border-bottom: 1px solid var(--menu-line);
  overflow-wrap: anywhere;
}

.detail-stats dt, .detail-skill small {
  color: var(--menu-muted);
  font-size: 11px;
}

.detail-stats dd {
  color: #eedaaa;
  font: 700 16px/1.25 var(--menu-mono);
  margin: 3px 0 0;
}

.detail-skills {
  grid-area: skills;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.detail-skill {
  padding: 8px 10px;
  background: var(--menu-panel);
  border-left: 2px solid var(--menu-metal);
}

.detail-passive {
  border-left-color: var(--green);
}

.detail-skill:only-child { grid-column: 1 / -1; }

.detail-skill h2 {
  margin: 0;
  font: 700 16px/1.35 var(--menu-serif);
}

.detail-skill p {
  margin: 4px 0 0;
  color: var(--menu-muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-layout {
  display: grid;
  gap: 12px;
  max-width: 750px;
  min-height: 0;
  overflow: auto;
  padding: 4px;
  margin: -4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--menu-line);
  cursor: pointer;
}

.setting-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--menu-gold);
  cursor: pointer;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.settings-actions button {
  padding: 7px 12px;
}

body.in-lobby #toast {
  top: auto;
  bottom: 83px;
}

@media (max-width: 720px) {
  .lobby-shell { padding-top: 8px; }
  .lobby-header { min-height: 52px; }
  .lobby-nav { padding-top: 8px; }
  .lobby-nav button { gap: 4px; }
  .squad-header { flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
  .squad-layout, .recruit-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .squad-seats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .squad-seat { min-height: 60px; padding: 5px 3px; gap: 2px; }
  #lobby .squad-seat .unit-emblem { width: 28px; height: 28px; font-size: 16px; }
  .squad-seat strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; line-height: 1.2; }
  .squad-adjustment { padding: 12px 14px; }
  .squad-adjustment h2 { font-size: 18px; }
  .squad-choice-list { margin-top: 8px; }
  .squad-adjustment .lobby-text-button { margin-top: 6px; padding: 4px 0; }
  .recruit-stage {
    grid-template: auto / minmax(0, .75fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }
  .recruit-writ { width: min(100%, 110px); }
  .writ-seal .icon-crest { width: 16px; height: 16px; background-size: auto; }
}

@media (max-width: 720px), (max-height: 520px) {
  #lobby[data-view="detail"] .lobby-header { display: none; }
  #lobby[data-view="detail"] .lobby-shell { grid-template-rows: minmax(0, 1fr) auto; padding-block: 9px; }
  #lobby[data-view="detail"] #lobby-content { margin-block: 0; }
  .detail-media { grid-template-rows: 102px 74px; }
}

@media (max-width: 530px) {
  .lobby-brand img { width: 112px; }
  .lobby-brand .icon-crest { width: 16px; height: 16px; background-size: auto; }
  .lobby-currencies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 4px; font-size: 10px; }
  .lobby-currencies > div { gap: 3px; min-width: 0; padding-inline: 5px; }
  .lobby-currencies dt { gap: 3px; }
  .lobby-currencies dd { font-size: 12px; }
  .lobby-nav button { flex-direction: column; font-size: 12px; }
  .lobby-heading { margin-bottom: 16px; }
  .lobby-home { grid-template: minmax(260px, 1fr) auto / minmax(0, 1fr); gap: 14px; }
  .lobby-home .lobby-heading { margin-bottom: 9px; }
  .lobby-character-caption { width: 100%; }
  .lobby-patrol, .sortie-stage { min-height: 109px; }
  #lobby .lobby-command { min-height: 68px; }
  .lobby-command strong { font-size: 25px; }
  .sortie-layout { grid-template-columns: minmax(0, 1fr); }
  .sortie-brief { margin-top: 0; }
  .squad-header { gap: 8px; margin-bottom: 10px; }
  .squad-core { width: 100%; padding: 5px 10px; }
  #lobby .squad-core .unit-emblem { width: 28px; height: 28px; font-size: 16px; }
  .squad-seats { gap: 5px; }
  .detail-layout {
    grid-template-columns: 78px minmax(0, 1fr);
    grid-template-areas: "heading heading" "media stats" "skills skills" "actions actions";
    gap: 8px 10px;
    padding: 10px;
  }
  .detail-media { grid-template-rows: 84px 68px; gap: 4px; }
  .detail-art { padding: 3px; }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-stats div { padding: 4px; }
  .detail-stats dd, .detail-skill h2 { font-size: 14px; }
  .detail-actions { padding-top: 8px; }
}

