/* ========================================
   MathLamb — Page de configuration
   ======================================== */

:root {
  --ocre: #D4A843;
  --terracotta: #C75B39;
  --vert-foret: #2D6A4F;
  --bleu-ciel: #87CEEB;
  --creme: #FFF8F0;
  --texte: #2C1810;
  --blanc: #FFFFFF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--creme);
  color: var(--texte);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Background Pattern --- */
.setup-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 1.5rem 1rem 2rem;
}

.pattern-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      var(--terracotta) 40px,
      var(--terracotta) 41px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      var(--ocre) 40px,
      var(--ocre) 41px
    ),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 56px,
      var(--vert-foret) 56px,
      var(--vert-foret) 57px
    );
}

/* --- Header --- */
.setup-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 600px;
}

.back-link {
  align-self: flex-start;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #8a7a6a;
  text-decoration: none;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--terracotta);
}

.game-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  background: var(--blanc);
  border-radius: 16px;
  border: 3px solid var(--ocre);
  box-shadow: 0 3px 12px rgba(212, 168, 67, 0.2);
}

.game-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.game-badge-icon svg {
  width: 100%;
  height: 100%;
}

.game-badge-name {
  font-family: 'Baloo 2', cursive;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--texte);
}

/* --- Main Form --- */
.setup-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* --- Teams Setup --- */
.teams-setup {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.team-input-group {
  flex: 1;
  min-width: 180px;
}

.team-input-group label {
  display: block;
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.team1-group label { color: var(--vert-foret); }
.team2-group label { color: var(--terracotta); }

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--blanc);
  border: 3px solid #e0d5c5;
  border-radius: 12px;
  padding: 0.25rem 0.75rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: var(--ocre);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.2);
}

.team1-group .input-wrapper:focus-within { border-color: var(--vert-foret); box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.2); }
.team2-group .input-wrapper:focus-within { border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.2); }

.team-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.team-emoji svg {
  width: 100%;
  height: 100%;
}

.input-wrapper input {
  border: none;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--texte);
  background: transparent;
  width: 100%;
  padding: 0.6rem 0;
}

.input-wrapper input::placeholder {
  color: #b0a090;
  font-weight: 400;
}

/* --- VS Divider --- */
.vs-divider {
  flex-shrink: 0;
}

.vs-divider span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ocre);
  color: var(--blanc);
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 3px 8px rgba(212, 168, 67, 0.3);
}

/* --- Level Selection --- */
.level-selection {
  text-align: center;
}

.level-selection h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  color: var(--texte);
  margin-bottom: 1rem;
}

.level-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.level-btn {
  flex: 1;
  min-width: 140px;
  max-width: 180px;
  cursor: pointer;
}

.level-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.level-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border-radius: 16px;
  border: 3px solid #e0d5c5;
  background: var(--blanc);
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.level-btn:hover .level-content {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.level-btn input:checked + .level-content {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.level-easy input:checked + .level-content {
  border-color: var(--vert-foret);
  background: rgba(45, 106, 79, 0.08);
}

.level-medium input:checked + .level-content {
  border-color: var(--ocre);
  background: rgba(212, 168, 67, 0.08);
}

.level-hard input:checked + .level-content {
  border-color: var(--terracotta);
  background: rgba(199, 91, 57, 0.08);
}

.level-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.level-icon svg {
  width: 100%;
  height: 100%;
}

.level-name {
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--texte);
}

.level-desc {
  font-size: 0.8rem;
  color: #8a7a6a;
}

/* --- Start Button --- */
.start-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 1rem 2rem;
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--blanc);
  background: linear-gradient(135deg, var(--vert-foret), #3a8963);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(45, 106, 79, 0.35);
  transition: all 0.3s ease;
  min-height: 56px;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(45, 106, 79, 0.45);
}

.start-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .teams-setup {
    flex-direction: column;
  }

  .team-input-group {
    width: 100%;
  }

  .vs-divider span {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .level-buttons {
    flex-direction: column;
    align-items: center;
  }

  .level-btn {
    max-width: 280px;
    width: 100%;
  }

  .game-badge-name {
    font-size: 1.3rem;
  }
}
