:root {
  --bg: #0d0a1a;
  --bg-elevated: #16122a;
  --surface: #1e1838;
  --border: #3d3570;
  --text: #f4f2ff;
  --muted: #a89fd4;
  --accent-hot: #ff2d6a;
  --accent-cool: #00d4ff;
  --accent-gold: #ffd23c;
  --vanguard: #4ec4ff;
  --duelist: #ff7b4a;
  --strategist: #7dff9a;
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --font-display: "Bebas Neue", Impact, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.5;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 80% at 50% -30%, rgba(138, 80, 255, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 20%, rgba(255, 60, 120, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 45% at 0% 70%, rgba(0, 220, 200, 0.14), transparent 45%),
    radial-gradient(ellipse 50% 40% at 80% 90%, rgba(255, 200, 60, 0.1), transparent 40%),
    linear-gradient(180deg, #120c24 0%, var(--bg) 35%, #0a0818 100%);
  background-attachment: fixed;
}

a {
  color: #9ae8ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid rgba(120, 100, 200, 0.35);
  background: linear-gradient(
    180deg,
    rgba(40, 25, 80, 0.55) 0%,
    rgba(13, 10, 26, 0.3) 100%
  );
  box-shadow: 0 4px 24px rgba(100, 60, 200, 0.15);
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.1rem;
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 8vw, 4rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
}

.site-title a {
  display: inline-block;
  color: transparent;
  background: linear-gradient(
    115deg,
    var(--accent-gold) 0%,
    #ff6b9d 25%,
    #b967ff 55%,
    var(--accent-cool) 85%,
    #7dffec 100%
  );
  background-size: 120% auto;
  -webkit-background-clip: text;
  background-clip: text;
  text-decoration: none;
  filter: drop-shadow(0 2px 12px rgba(180, 100, 255, 0.35));
  transition: filter 0.2s ease, transform 0.2s ease;
}

.site-title a:hover {
  filter: drop-shadow(0 4px 20px rgba(100, 220, 255, 0.45));
  transform: scale(1.02);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.nav a {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(180, 160, 255, 0.35);
}

.nav a[aria-current="page"] {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent-cool), #a855f7);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.35);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.page-heading {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-cool), #e8a0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 52ch;
  margin: 0 0 1.75rem;
}

.panel {
  background: linear-gradient(145deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid rgba(130, 100, 220, 0.35);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.count-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.count-field input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(10, 8, 24, 0.65);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.count-field input:focus {
  outline: none;
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.count-field--vanguard label {
  color: var(--vanguard);
  text-shadow: 0 0 20px rgba(78, 196, 255, 0.35);
}

.count-field--duelist label {
  color: var(--duelist);
  text-shadow: 0 0 20px rgba(255, 123, 74, 0.35);
}

.count-field--strategist label {
  color: var(--strategist);
  text-shadow: 0 0 20px rgba(125, 255, 154, 0.25);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.form-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#count-total {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

#count-total.is-valid {
  color: var(--strategist);
}

#count-total.is-invalid {
  color: #ffc46b;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-hot) 0%, #ff5e9c 40%, #a855f7 100%);
  color: #fff;
  box-shadow: 0 6px 24px rgba(255, 45, 106, 0.45);
}

.btn--primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(255, 45, 106, 0.55);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid rgba(160, 140, 220, 0.4);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--accent-cool);
  background: rgba(0, 212, 255, 0.1);
}

.lineup-error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 45, 106, 0.12);
  border: 1px solid rgba(255, 100, 140, 0.45);
  border-radius: 8px;
  color: #ffb8d4;
  font-size: 0.95rem;
}

.lineup-output {
  margin-top: 0.5rem;
}

.lineup-empty {
  margin: 0 0 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.lineup-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.btn--sm {
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
}

.btn:focus-visible,
.nav a:focus-visible {
  outline: 2px solid var(--accent-cool);
  outline-offset: 2px;
}

.lineup-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1rem 1.25rem;
  justify-content: center;
}

.lineup-role-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.lineup-role-group[data-role="vanguard"] {
  border-color: rgba(78, 196, 255, 0.55);
  box-shadow: 0 0 24px rgba(78, 196, 255, 0.12);
}

.lineup-role-group[data-role="duelist"] {
  border-color: rgba(255, 123, 74, 0.55);
  box-shadow: 0 0 24px rgba(255, 123, 74, 0.12);
}

.lineup-role-group[data-role="strategist"] {
  border-color: rgba(125, 255, 154, 0.45);
  box-shadow: 0 0 24px rgba(125, 255, 154, 0.1);
}

.hero-card {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 18, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  min-width: 132px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.hero-card:hover {
  transform: translateY(-2px);
}

.hero-card[data-role="vanguard"] {
  border-left: 4px solid var(--vanguard);
  box-shadow: 0 4px 16px rgba(78, 196, 255, 0.15);
}

.hero-card[data-role="duelist"] {
  border-left: 4px solid var(--duelist);
  box-shadow: 0 4px 16px rgba(255, 123, 74, 0.15);
}

.hero-card[data-role="strategist"] {
  border-left: 4px solid var(--strategist);
  box-shadow: 0 4px 16px rgba(125, 255, 154, 0.12);
}

.hero-card__role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.hero-card__name {
  font-weight: 700;
  font-size: 1rem;
}

@keyframes hero-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-card--enter {
  animation: hero-card-enter 0.38s ease backwards;
  animation-delay: calc(var(--stagger, 0) * 45ms);
}

@media (prefers-reduced-motion: reduce) {
  .hero-card--enter {
    animation: none;
  }
}

.page-tools {
  margin-bottom: 2rem;
}

.filter-row {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-row--heroes {
  align-items: center;
  gap: 1rem 1.25rem;
}

.filter-cluster {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.filter-cluster--grow {
  flex: 1 1 220px;
  min-width: min(100%, 200px);
}

.filter-cluster__label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.filter-cluster__control {
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  line-height: 1.25;
}

.filter-cluster .hero-search-input,
.filter-cluster select.filter-cluster__control {
  min-width: 0;
}

.filter-cluster--grow .filter-cluster__control {
  flex: 1 1 auto;
  width: 100%;
  min-width: 12rem;
}

.filter-row label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.filter-row select,
.filter-row .hero-search-input,
.filter-row input[type="search"],
.filter-row input[type="text"] {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Inline “Show” dropdown should size to content, not stretch like full-width rows */
.filter-row--heroes .filter-cluster:not(.filter-cluster--grow) select.filter-cluster__control {
  width: auto;
  min-width: 11.5rem;
  max-width: 100%;
}

.filter-row .hero-search-input::placeholder,
.filter-row input[type="search"]::placeholder,
.filter-row input[type="text"]::placeholder {
  color: rgba(168, 159, 212, 0.65);
}

.filter-row select:focus,
.filter-row .hero-search-input:focus,
.filter-row input[type="search"]:focus,
.filter-row input[type="text"]:focus,
.filter-cluster__control:focus {
  outline: none;
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.hero-search-empty {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.role-section {
  margin-bottom: 2rem;
}

.role-section--live {
  animation: role-section-in 0.55s ease backwards;
  animation-delay: calc(var(--section-i, 0) * 70ms);
}

@keyframes role-section-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .role-section--live {
    animation: none;
  }
}

.role-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.01) 100%
  );
  border: 1px solid rgba(130, 100, 220, 0.25);
}

.role-section__name {
  letter-spacing: 0.02em;
}

.role-section__count {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.role-section[data-role="vanguard"] .role-section__title {
  color: var(--vanguard);
  border-color: rgba(78, 196, 255, 0.35);
  box-shadow: 0 0 24px rgba(78, 196, 255, 0.08);
}

.role-section[data-role="vanguard"] .role-section__count {
  color: var(--vanguard);
  border-color: rgba(78, 196, 255, 0.35);
  background: rgba(78, 196, 255, 0.1);
}

.role-section[data-role="duelist"] .role-section__title {
  color: var(--duelist);
  border-color: rgba(255, 123, 74, 0.35);
  box-shadow: 0 0 24px rgba(255, 123, 74, 0.08);
}

.role-section[data-role="duelist"] .role-section__count {
  color: var(--duelist);
  border-color: rgba(255, 123, 74, 0.35);
  background: rgba(255, 123, 74, 0.1);
}

.role-section[data-role="strategist"] .role-section__title {
  color: var(--strategist);
  border-color: rgba(125, 255, 154, 0.3);
  box-shadow: 0 0 24px rgba(125, 255, 154, 0.06);
}

.role-section[data-role="strategist"] .role-section__count {
  color: var(--strategist);
  border-color: rgba(125, 255, 154, 0.35);
  background: rgba(125, 255, 154, 0.1);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}

.hero-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 14, 36, 0.75);
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
  animation: hero-row-in 0.42s ease backwards;
  animation-delay: calc(var(--i, 0) * 38ms + var(--section-i, 0) * 70ms);
}

@keyframes hero-row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-list__item {
    animation: none;
  }
}

.hero-list__item:hover {
  transform: translateY(-2px);
  background: rgba(30, 24, 56, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hero-list__item[data-role="vanguard"] {
  border-left: 3px solid var(--vanguard);
}

.hero-list__item[data-role="vanguard"]:hover {
  border-color: rgba(78, 196, 255, 0.45);
  box-shadow: 0 8px 28px rgba(78, 196, 255, 0.12);
}

.hero-list__item[data-role="duelist"] {
  border-left: 3px solid var(--duelist);
}

.hero-list__item[data-role="duelist"]:hover {
  border-color: rgba(255, 123, 74, 0.45);
  box-shadow: 0 8px 28px rgba(255, 123, 74, 0.12);
}

.hero-list__item[data-role="strategist"] {
  border-left: 3px solid var(--strategist);
}

.hero-list__item[data-role="strategist"]:hover {
  border-color: rgba(125, 255, 154, 0.4);
  box-shadow: 0 8px 28px rgba(125, 255, 154, 0.1);
}

.hero-media {
  position: relative;
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
}

.hero-media--card {
  width: 3.5rem;
  height: 3.5rem;
  flex-basis: 3.5rem;
}

.hero-portrait {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}

.hero-media--has-photo .hero-portrait {
  display: block;
}

.hero-media--has-photo .hero-initial {
  display: none;
}

.hero-media--no-photo .hero-portrait {
  display: none;
}

.hero-media--no-photo .hero-initial {
  display: flex;
}

.hero-media .hero-initial {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hero-media--card .hero-initial {
  font-size: 1.05rem;
}

.hero-card[data-role="vanguard"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(78, 196, 255, 0.55),
    rgba(78, 196, 255, 0.15)
  );
  box-shadow:
    0 0 0 1px rgba(78, 196, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-card[data-role="duelist"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(255, 123, 74, 0.55),
    rgba(255, 123, 74, 0.15)
  );
  box-shadow:
    0 0 0 1px rgba(255, 123, 74, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-card[data-role="strategist"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(125, 255, 154, 0.45),
    rgba(125, 255, 154, 0.12)
  );
  box-shadow:
    0 0 0 1px rgba(125, 255, 154, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-list__item[data-role="vanguard"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(78, 196, 255, 0.55),
    rgba(78, 196, 255, 0.15)
  );
  box-shadow:
    0 0 0 1px rgba(78, 196, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-list__item[data-role="duelist"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(255, 123, 74, 0.55),
    rgba(255, 123, 74, 0.15)
  );
  box-shadow:
    0 0 0 1px rgba(255, 123, 74, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-list__item[data-role="strategist"] .hero-initial {
  background: linear-gradient(
    145deg,
    rgba(125, 255, 154, 0.45),
    rgba(125, 255, 154, 0.12)
  );
  box-shadow:
    0 0 0 1px rgba(125, 255, 154, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-name {
  min-width: 0;
  line-height: 1.3;
}

.site-footer {
  margin-top: auto;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid rgba(120, 100, 200, 0.25);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}
