:root {
  --shell-max: 1540px;
  --card-surface: rgba(12, 21, 38, 0.94);
  --card-surface-strong: rgba(17, 29, 51, 0.98);
}

@media (min-width: 801px) {
  .app-shell {
    width: min(96vw, var(--shell-max)) !important;
    max-width: var(--shell-max);
  }

  .setup-panel {
    padding: 14px 16px 12px;
  }

  .roster-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
}

@media (min-width: 1780px) {
  .app-shell {
    --shell-max: 1660px;
  }

  .roster-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 801px) and (max-width: 1280px) {
  .roster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.page-header {
  padding-inline: 4px;
}

.page-header > div:first-child {
  min-width: 0;
}

.subtitle {
  max-width: 980px;
}

.setup-panel {
  background:
    radial-gradient(circle at 7% 0%, rgba(71, 143, 211, 0.09), transparent 34%),
    radial-gradient(circle at 94% 4%, rgba(202, 81, 120, 0.08), transparent 30%),
    rgba(8, 14, 26, 0.94);
}

.team-preview-grid {
  gap: 14px;
}

.team-preview {
  padding: 14px;
}

.team-slot-hint {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: right;
}

.team-slots {
  gap: 9px;
}

button.team-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 62px;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  align-items: center;
  place-items: initial;
  gap: 9px;
  border-style: solid;
  border-color: rgba(176, 197, 226, 0.23);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--slot-color) 10%, transparent), transparent 58%),
    rgba(4, 9, 18, 0.62);
  padding: 8px 8px 8px 9px;
  color: var(--text);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button.team-slot:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--slot-color) 68%, #dbeafe);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--slot-color) 18%, transparent), transparent 62%),
    rgba(8, 15, 28, 0.9);
}

button.team-slot:active {
  transform: translateY(0) scale(0.985);
}

.team-slot-portrait {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--slot-color) 70%, white);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.48), transparent 22%),
    linear-gradient(145deg, var(--slot-color), #101827 88%);
  color: #08101b;
  font-size: 0.88rem;
  font-weight: 950;
  box-shadow:
    0 0 16px color-mix(in srgb, var(--slot-color) 30%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.team-slot-copy {
  min-width: 0;
}

.team-slot-copy strong,
.team-slot-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-slot-copy strong {
  color: var(--text);
  font-size: 0.73rem;
}

.team-slot-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.6rem;
}

.team-slot-remove {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 150, 166, 0.36);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ff9db0;
  font-size: 0.88rem;
  line-height: 1;
  background: rgba(104, 20, 39, 0.22);
}

.team-slot.empty {
  min-height: 62px;
  background: rgba(4, 8, 15, 0.28);
}

.roster-grid {
  scrollbar-color: rgba(135, 163, 204, 0.58) rgba(5, 9, 17, 0.35);
  scrollbar-width: thin;
}

.roster-grid::-webkit-scrollbar {
  width: 9px;
}

.roster-grid::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(5, 9, 17, 0.4);
}

.roster-grid::-webkit-scrollbar-thumb {
  border: 2px solid rgba(5, 9, 17, 0.55);
  border-radius: 999px;
  background: linear-gradient(#57779d, #7f5b85);
}

.fighter-card {
  min-height: 0;
  border-color: color-mix(in srgb, var(--ability-color) 28%, var(--line));
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--ability-color) 18%, transparent), transparent 40%),
    linear-gradient(155deg, var(--card-surface-strong), var(--card-surface));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 9px 24px rgba(0, 0, 0, 0.12);
}

.fighter-card:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 38px rgba(0, 0, 0, 0.28),
    0 0 24px color-mix(in srgb, var(--ability-color) 12%, transparent);
}

.fighter-badge {
  position: relative;
  isolation: isolate;
}

.fighter-badge::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
}

.fighter-card h3 {
  font-size: 0.88rem;
}

.fighter-summary {
  font-size: 0.73rem;
  line-height: 1.42;
}

.skill-preview,
.fighter-card .ultimate-preview {
  backdrop-filter: blur(7px);
}

.fighter-card .ultimate-preview {
  box-shadow: inset 0 0 20px rgba(232, 190, 91, 0.045);
}

.skill-description {
  font-size: 0.69rem;
}

.team-buttons button {
  min-height: 34px;
  padding-block: 6px;
  font-size: 0.73rem;
}

.setup-actions {
  padding-top: 1px;
}

@media (max-width: 800px) {
  .team-slot-hint {
    text-align: left;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 560px) {
  .roster-grid {
    grid-template-columns: 1fr !important;
  }

  button.team-slot {
    min-height: 58px;
  }
}
