.squad-dialog {
  width: min(890px, calc(100vw - 28px));
  max-height: calc(100dvh - 24px);
  padding: 14px;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: #f0e1c8;
  box-shadow: 0 16px 62px #17120fa8;
}

.squad-dialog::backdrop { background: #15120f8c; }
.squad-scroll {
  max-height: calc(100dvh - 52px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #977649 #2a2420;
  padding: 7px clamp(8px, 2.4vw, 24px) clamp(12px, 2.4vw, 24px);
}

.squad-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.squad-heading .eyebrow { color: var(--data); }
.squad-heading h2 { margin-top: 4px; font-size: clamp(1.35rem, 3.3vw, 2rem); line-height: 1.08; font-weight: 400; }
.squad-heading .map-key { border-block-end-color: #7d9299; }
.squad-message:not(:empty) { margin-top: 9px; color: #d9c5a4; font-size: .87rem; }

.squad-roster-labels {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 1.25vw, 13px);
  margin-top: 14px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.squad-roster-labels span + span { grid-column: 2 / -1; text-align: start; }

.squad-roster {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 1.25vw, 13px);
  margin: 4px 0 18px;
  padding: 8px 1px 11px;
  border-block: 1px solid #879a9e50;
  list-style: none;
}

.squad-slot { min-width: 0; text-align: center; }
.squad-slot-portrait {
  position: relative;
  width: min(100%, 68px);
  margin-inline: auto;
  aspect-ratio: 2 / 3;
}

.squad-slot-portrait::before, .squad-runim-seal::before {
  content: "";
  position: absolute;
  inset: 5% 8%;
  border-radius: 5%;
  background: radial-gradient(ellipse at 44% 62%, #584734, #29231e 87%);
}

.squad-slot-image { position: absolute; inset: 6% 8%; width: 84%; height: 88%; object-fit: cover; border-radius: 3%; }
.squad-slot[data-occupied="false"] .squad-slot-image { object-fit: contain; opacity: .85; }
.squad-slot-name { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: .75rem; }
.squad-slot[data-occupied="true"] .squad-slot-name { color: var(--moss-light); }

#squad-loadout { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: -4px 0 15px; }
#squad-loadout dt { color: var(--steel-blue-light); }
#squad-loadout dd { margin: 0; text-align: start; }
#squad-loadout[hidden] { display: none; }

.squad-groups { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.squad-groups button {
  min-height: 41px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  color: #ead6b4;
  background: #0003;
  font-size: .91rem;
}

.squad-groups button:hover { border-color: var(--steel-blue); color: var(--steel-blue-light); }
.squad-groups button[aria-pressed="true"] {
  border-color: var(--steel-blue);
  background: linear-gradient(#f3dcb8bd, #e7cba1b9), #ddc39a url("/art/paper.jpg") center / 390px auto;
  box-shadow: inset 0 2px var(--steel-ink);
  color: var(--steel-ink);
}

.squad-catalog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: start;
  border: 1px solid #ac8c5e;
  color: #261f19;
  background: linear-gradient(105deg, #ebd4b0c9, #f3dfbdd9 54%, #ecd4aeca), #dbc299 url("/art/paper.jpg") center 46% / cover;
  box-shadow: inset 0 0 26px #7956373d;
}

.squad-catalog-body :focus-visible { outline-color: var(--steel-ink); outline-offset: -2px; }
.squad-entries {
  align-self: stretch;
  max-height: min(39dvh, 312px);
  margin: 0;
  padding: 9px 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #8b6948 #c8aa80;
  background: #684c2a19;
  border-inline-end: 1px solid var(--paper-rule);
}

.squad-entries li { margin: 0; }
.squad-entries button {
  width: 100%;
  min-height: 36px;
  padding: 4px 9px 4px 13px;
  border: 0;
  border-inline-start: 3px solid transparent;
  background: transparent;
  color: inherit;
  text-align: start;
  overflow-wrap: anywhere;
  font-size: .91rem;
  line-height: 1.23;
}

.squad-entries button:hover { background: #b4c4ce3d; }
.squad-entries button[aria-pressed="true"] {
  border-inline-start-color: var(--steel-ink);
  color: var(--steel-ink);
  background: #b4c4ce66;
}
.squad-entry-picker { display: none; }
.squad-entry-detail { min-width: 0; min-height: 200px; padding: 13px clamp(12px, 2.2vw, 23px) 17px; }
.squad-entry-intro { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.squad-entry-headline { min-width: 0; }
.squad-entry-detail h3 { font-size: clamp(1.08rem, 3vw, 1.49rem); line-height: 1.12; font-weight: 400; overflow-wrap: anywhere; }
.squad-entry-kind, .squad-runim-role { color: #4d321e; font-size: .87rem; }
.squad-entry-kind { margin-top: 3px; }
.squad-ability-icon { flex: 0 0 44px; width: 44px; height: 44px; object-fit: contain; }
.squad-runim-seal { position: relative; flex: 0 0 36px; aspect-ratio: 2 / 3; }
.squad-runim-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.squad-entry-description { font-size: .99rem; line-height: 1.42; white-space: pre-line; overflow-wrap: anywhere; }
.squad-runim-role { margin-bottom: 5px; }

.squad-facts { margin-block: 8px; font-size: .86rem; }
.squad-facts > div { display: grid; grid-template-columns: 1fr 1.15fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--paper-rule); }
.squad-facts dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
.squad-facts dt { color: #523b27; }
.squad-fold { margin-top: 7px; border-top: 1px solid var(--paper-rule); }
.squad-fold summary { padding: 6px 0; color: var(--steel-ink); font-size: .92rem; cursor: pointer; }
.squad-fold summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.squad-fold .squad-facts { margin-block: 0 8px; }
.squad-influences { padding-left: 17px; font-size: .9rem; }
.squad-influences li + li { margin-top: 8px; }
.squad-influences strong { display: block; color: #4d321e; }
.squad-branch { padding: 1px 0 7px 15px; overflow-wrap: anywhere; }
.squad-branch-skills { margin-top: 5px; font-size: .86rem; }
.squad-entry-link { margin-top: 4px; padding: 5px 6px 5px 0; border: 0; background: none; color: var(--steel-ink); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 720px) {
  .squad-roster-labels { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 470px; margin-inline: auto; }
  .squad-roster { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 470px; margin-inline: auto; }
  .squad-slot-portrait { max-width: 56px; }
  .squad-entries { display: none; }
  .squad-catalog-body { display: block; }
  .squad-entry-picker { display: grid; gap: 3px; padding: 8px 12px; border-bottom: 1px solid var(--paper-rule); }
  .squad-entry-picker label { font-size: .82rem; color: var(--steel-ink); }
  .squad-entry-picker select { width: 100%; min-height: 38px; padding-inline: 5px; font: inherit; color: var(--steel-ink); background: #eed7b0; border: 1px solid var(--steel-ink); }
  .squad-entry-detail { min-height: 140px; }
}

@media (max-width: 420px) {
  .squad-dialog { width: calc(100vw - 10px); padding: 10px; }
  .squad-scroll { max-height: calc(100dvh - 44px); }
  .squad-groups button { padding-inline: 6px; min-height: 40px; font-size: .82rem; }
  .squad-slot-portrait { max-width: 47px; }
  .squad-roster { margin-bottom: 12px; }
}
