.game-setup-page {
  min-height: 100vh;
  background: #0a1628;
  color: #f8fafc;
}

.game-setup-page .badge-watermark {
  display: block;
}

.game-setup-page__home {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: #0f2147;
  color: #7a8fa8;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.game-setup-page__home:hover {
  color: #c9a227;
  border-color: rgba(201, 162, 39, 0.45);
}

.game-setup-page__hero {
  max-width: 40rem;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.game-setup-page__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #d4b84a;
  text-shadow: 0 0 32px rgba(201, 162, 39, 0.35);
}

.game-setup-page__tagline {
  margin: 0.65rem 0 0;
  color: #7a8fa8;
  font-size: 1rem;
}

.game-setup {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.setup-section + .setup-section {
  margin-top: 2rem;
}

.setup-section__label {
  margin: 0 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7a8fa8;
}

.setup-formation-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.setup-formation-pill {
  appearance: none;
  border: 2px solid rgba(201, 162, 39, 0.2);
  border-radius: 10px;
  background: #0f2147;
  color: #e2e8f0;
  padding: 0.55rem 0.25rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.setup-formation-pill:hover {
  border-color: rgba(201, 162, 39, 0.55);
}

.setup-formation-pill.is-selected {
  border-color: #c9a227;
  color: #d4b84a;
  background: #132a52;
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, 0.35),
    0 0 18px rgba(201, 162, 39, 0.25);
}

.setup-formation-desc {
  margin: 1rem 0 0;
  color: #94a3b8;
  font-size: 0.875rem;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
}

.setup-preview {
  margin-top: 1.25rem;
}

.setup-preview__field {
  position: relative;
  aspect-ratio: 2 / 3;
  max-height: 22rem;
  margin: 0 auto;
  border-radius: 14px;
  border: 2px solid rgba(201, 162, 39, 0.35);
  background:
    linear-gradient(
      180deg,
      rgba(10, 61, 31, 0.95) 0%,
      rgba(13, 74, 38, 0.95) 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 32px rgba(0, 0, 0, 0.3);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  overflow: hidden;
}

.setup-preview__field::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      transparent 49.5%,
      rgba(255, 255, 255, 0.12) 49.5%,
      rgba(255, 255, 255, 0.12) 50.5%,
      transparent 50.5%
    ),
    radial-gradient(
      circle at 50% 50%,
      transparent 0,
      transparent 11%,
      rgba(255, 255, 255, 0.1) 11%,
      rgba(255, 255, 255, 0.1) 12%,
      transparent 12%
    );
  pointer-events: none;
}

.setup-preview__row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--players), 1fr);
  gap: 0.35rem;
  align-items: center;
  justify-items: center;
}

.setup-preview__slot {
  min-width: 2rem;
  padding: 0.2rem 0.15rem;
  border-radius: 999px;
  border: 2px solid rgba(201, 162, 39, 0.75);
  background: rgba(15, 33, 71, 0.9);
  color: #d4b84a;
  font-size: 0.5625rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.2);
}

.setup-preview__slot--gk {
  background: rgba(15, 33, 71, 0.95);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.setup-options {
  display: grid;
  gap: 0.55rem;
}

.setup-options--2 {
  grid-template-columns: 1fr 1fr;
}

.setup-option {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  border: 2px solid rgba(201, 162, 39, 0.15);
  background: #0f2147;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.setup-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.setup-option__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f8fafc;
}

.setup-option__desc {
  font-size: 0.75rem;
  color: #7a8fa8;
  line-height: 1.35;
}

.setup-option--green.is-selected,
.setup-option--purple.is-selected {
  border-color: #c9a227;
  background: #132a52;
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, 0.35),
    0 0 16px rgba(201, 162, 39, 0.2);
}

.setup-option--green.is-selected .setup-option__title,
.setup-option--purple.is-selected .setup-option__title {
  color: #d4b84a;
}

.setup-option-grid--party-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.setup-option--party.is-selected {
  border-color: #c9a227;
  background: linear-gradient(
    145deg,
    rgba(201, 162, 39, 0.18) 0%,
    #132a52 55%
  );
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, 0.45),
    0 0 20px rgba(201, 162, 39, 0.28);
}

.setup-option--party.is-selected .setup-option__title {
  color: #d4b84a;
}

.setup-option--party.is-selected .setup-option__desc {
  color: #cbd5e1;
}

.setup-option--snake.is-selected {
  border-color: #38bdf8;
  background: linear-gradient(
    145deg,
    rgba(56, 189, 248, 0.16) 0%,
    #0f2147 55%
  );
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.45),
    0 0 20px rgba(56, 189, 248, 0.22);
}

.setup-option--snake.is-selected .setup-option__title {
  color: #7dd3fc;
}

.setup-option--snake.is-selected .setup-option__desc {
  color: #bae6fd;
}

.setup-era-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.setup-era-pill {
  appearance: none;
  border: 2px solid rgba(201, 162, 39, 0.2);
  border-radius: 999px;
  background: #0f2147;
  color: #cbd5e1;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.setup-era-pill:hover {
  border-color: rgba(201, 162, 39, 0.45);
}

.setup-era-pill.is-selected {
  border-color: #c9a227;
  color: #d4b84a;
  background: #132a52;
}

.setup-era-range__labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #d4b84a;
  margin-bottom: 0.35rem;
}

.setup-era-slider {
  width: 100%;
  margin: 0.35rem 0;
  accent-color: #c9a227;
}

.setup-era-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #7a8fa8;
  line-height: 1.4;
}

.setup-club-picker {
  margin-top: 0.85rem;
}

.setup-club-picker.is-hidden {
  display: none;
}

.setup-club-picker__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a8fa8;
}

.setup-club-picker__select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 2px solid rgba(201, 162, 39, 0.25);
  background: #0f2147;
  color: #f8fafc;
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}

.setup-club-picker__select:focus {
  outline: none;
  border-color: #c9a227;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25);
}

.setup-club-picker__select.is-invalid {
  border-color: #f87171;
  animation: club-select-shake 0.35s ease;
}

@keyframes club-select-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.setup-start-btn {
  display: block;
  width: 100%;
  margin-top: 2.25rem;
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0a1628;
  cursor: pointer;
  background: linear-gradient(90deg, #8b6914 0%, #c9a227 45%, #d4b84a 100%);
  box-shadow:
    0 4px 20px rgba(201, 162, 39, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.setup-start-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 28px rgba(201, 162, 39, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
}

.challenge-banner {
  margin-bottom: 1.75rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(15, 33, 71, 0.95) 0%,
    rgba(10, 22, 40, 0.98) 100%
  );
  border: 1px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.challenge-banner--error {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.2);
}

.challenge-banner__title {
  margin: 0 0 0.35rem;
  font-family: var(--font-sans);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: #d4b84a;
}

.challenge-banner__title strong {
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.challenge-banner__rules {
  margin: 0;
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.45;
}

.challenge-banner__hint {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.game-setup--challenge .setup-section {
  opacity: 0.72;
  pointer-events: none;
  user-select: none;
}

.game-setup--challenge .setup-start-btn {
  pointer-events: auto;
  opacity: 1;
}

@media (max-width: 520px) {
  .setup-formation-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .setup-options--2,
  .setup-option-grid--party-mode {
    grid-template-columns: 1fr;
  }

  .game-setup-page__hero {
    padding-top: 3.75rem;
  }
}
