/* ============================================================================
   Interactive Rugby Pitch — Squad Builder
   ========================================================================== */

.pitch-wrap {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-width: 460px;
  margin: 0 auto;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 10%),
    linear-gradient(180deg, #1f8f52 0%, #1a7d47 50%, #1f8f52 100%);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.85), inset 0 0 40px rgba(0,0,0,0.15);
}

.pitch::before {
  /* try/goal lines */
  content: '';
  position: absolute; left: 4%; right: 4%; top: 8%; bottom: 8%;
  border: 2px solid rgba(255,255,255,0.65);
  border-radius: 2px;
  pointer-events: none;
}
.pitch .halfway-line {
  position: absolute; left: 4%; right: 4%; top: 50%;
  height: 2px; background: rgba(255,255,255,0.65);
  transform: translateY(-50%);
}
.pitch .try-line-top, .pitch .try-line-bottom {
  position: absolute; left: 4%; right: 4%; height: 2px; background: rgba(255,255,255,0.8);
}
.pitch .try-line-top { top: 8%; }
.pitch .try-line-bottom { bottom: 8%; }

.pitch-spot {
  position: absolute;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 5;
}
.pitch-spot .spot-circle {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
  border: 2.5px dashed var(--n-400);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--n-500);
  transition: all var(--t-fast) var(--ease-spring);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.pitch-spot:active .spot-circle { transform: scale(0.92); }
.pitch-spot.filled .spot-circle {
  border-style: solid;
  border-color: var(--brand-red);
  background: #fff;
  color: var(--brand-navy-dark);
}
.pitch-spot.filled.captain .spot-circle { border-color: #f5c518; box-shadow: 0 0 0 3px rgba(245,197,24,0.35); }
.pitch-spot .spot-label {
  position: absolute;
  top: 100%;
  margin-top: 2px;
  font-size: 9px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  left: 50%;
  transform: translateX(-50%);
}
.pitch-spot .spot-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* Bench strip below pitch */
.bench-strip {
  margin-top: 18px;
}
.bench-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 480px) {
  .bench-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}
.bench-slot {
  background: var(--n-50);
  border: 2px dashed var(--border-default);
  border-radius: var(--r-md);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  min-height: 84px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.bench-slot:hover { border-color: var(--brand-red); background: var(--n-100); }
.bench-slot.filled { border-style: solid; background: var(--bg-card); border-color: var(--border-default); }
.bench-slot .num { font-size: 11px; font-weight: 800; color: var(--text-tertiary); }
.bench-slot .name { font-size: 11px; font-weight: 700; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Player picker sheet */
.player-pick-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  border: 1.5px solid transparent;
}
.player-pick-item:hover { background: var(--n-50); }
.player-pick-item.disabled { opacity: 0.35; pointer-events: none; }
.player-pick-item.selected { border-color: var(--brand-red); background: var(--danger-bg); }

.formation-legend {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.formation-legend .badge { cursor: default; }
