:root {
  --bg-color: #020617;
  --bg-card: #020617;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.2);
  --accent-strong: #2563eb;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at top, #1f2937 0, #020617 45%);
  color: var(--text-main);
}

/* App layout */

.app {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.app-header {
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  letter-spacing: 0.04em;
}

.app-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.2rem;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Cards */

.card {
  background: linear-gradient(145deg, #020617, #020617);
  border-radius: 1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.7);
  padding: 1rem 1rem 1.1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Timer */

.card-timer {
  text-align: center;
}

.timer-display {
  font-size: clamp(3rem, 9vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0.5rem 0 0.6rem;
  margin-bottom: 0.7rem;
  border-radius: 0.9rem;
  background: radial-gradient(circle at top, #0b1120 0, #020617 60%);
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-variant-numeric: tabular-nums;
}

.timer-display--finished {
  animation: timerFlash 1.2s ease-out 2;
  border-color: var(--danger);
}

@keyframes timerFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.8);
    background: radial-gradient(circle at top, #7f1d1d 0, #020617 60%);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(248, 113, 113, 0);
    background: radial-gradient(circle at top, #0b1120 0, #020617 60%);
  }
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.timer-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.timer-settings label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.timer-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Bouton de toggle pénalités sous le chrono */

.penalties-toggle-wrapper {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
}

.toggle-penalties-btn {
  font-size: 0.8rem;
}

/* Score */

.card-score {
  margin-top: 0.3rem;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: flex-start;
}

.team-col {
  background: radial-gradient(circle at top, #0f172a 0, #020617 65%);
  border-radius: 0.9rem;
  padding: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.team-name-input {
  background: transparent;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.4rem 0.6rem;
  color: var(--text-main);
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.team-name-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.9);
}

.score-value {
  font-size: clamp(2.2rem, 7vw, 2.8rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.score-buttons {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

/* Penalties */

.card-penalties {
  flex: 1;
}

/* Masquer le panneau pénalités par défaut */
.card-penalties--hidden {
  display: none;
}

.penalties-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.penalty-column {
  background: radial-gradient(circle at top, #020617 0, #020617 70%);
  border-radius: 0.8rem;
  padding: 0.6rem 0.7rem;
  border: 1px dashed rgba(148, 163, 184, 0.55);
}

.penalty-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.penalty-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 1.6rem;
  font-size: 0.9rem;
}

.penalty-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  margin-bottom: 0.25rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.65);
  font-variant-numeric: tabular-nums;
}

.penalty-item-time {
  font-weight: 500;
}

.penalty-item-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.penalty-item-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.penalty-item-remove:hover {
  color: var(--danger);
}

.penalty-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Beep */

.card-beep {
  margin-top: 0.4rem;
}

.beep-layout {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.beep-layout label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.beep-buttons {
  display: flex;
  gap: 0.6rem;
}

.beep-buttons .btn {
  flex: 1;
}

.beep-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.beep-indicator {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  transform: scale(1);
}

.beep-indicator--active {
  background: var(--accent);
  animation: ping 0.6s ease-out;
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(59, 130, 246, 0);
    transform: scale(1.18);
  }
}

.sound-selects {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.sound-selects label {
  display: flex;
  flex-direction: column;      /* texte au-dessus du select */
  align-items: flex-start;
  gap: 0.2rem;
}

.sound-selects select {
  width: 100%;                 /* prend toute la largeur dispo */
  background: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.sound-selects select:focus {
  outline: none;
  border-color: var(--accent);
}




/* Buttons & inputs */

button,
input {
  font-family: var(--font-family);
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: background-color 0.15s ease, transform 0.05s ease,
    box-shadow 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0, var(--accent-strong) 100%);
  color: white;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-strong) 0, var(--accent) 100%);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 0.85);
}

.btn-ghost {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.9);
}

.btn-small {
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
}

/* Numeric inputs */

input[type="number"] {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--text-main);
  padding: 0.3rem 0.7rem;
  max-width: 5rem;
  font-size: 0.9rem;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* Footer */

.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Responsive */

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .app {
    padding-inline: 0.9rem;
  }
}

@media (max-width: 600px) {
  .app {
    padding-inline: 0.6rem;
  }

  .timer-controls {
    flex-direction: row;
  }

  .beep-buttons {
    flex-direction: column;
  }

  .beep-buttons .btn {
    width: 100%;
  }
}
/* Titre + icône BenchPulse */

.app-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.app-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 0.4rem;
}

.title-muted {
  opacity: 0.7;
}

/* Pénalités urgentes */

.penalty-warning {
  border-color: #f59e0b !important;     /* orange */
  background: rgba(245, 158, 11, 0.15);
}

.penalty-danger {
  border-color: #ef4444 !important;     /* rouge */
  background: rgba(239, 68, 68, 0.15);
  animation: pulseDanger 1s infinite alternate;
}

@keyframes pulseDanger {
  from {
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
  to {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  }
}
