/*
 * Basket Tactics — mobile d'abord, aucune police web, aucun framework.
 * Le SVG travaille en mètres : ses épaisseurs et rayons sont des attributs, jamais
 * du CSS. Ici on ne fixe que sa place dans la page (pleine largeur, ratio du viewBox).
 */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #1f1f1f;
  background: #fafafa;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 0 2rem;
}

.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
}

.retour {
  color: #444444;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.retour:hover,
.retour:focus {
  text-decoration: underline;
}

.entete h1,
.titre {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Terrain : pleine largeur, hauteur déduite du viewBox ; le glissé ne doit jamais
   faire défiler la page ni sélectionner du texte. */
.scene {
  width: 100%;
  line-height: 0;
}

.scene svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Contrôles, sous le terrain */
.controles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
}

button,
.bouton {
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  background: #ececec;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.principal {
  color: #ffffff;
  background: #333333;
  border-color: #333333;
}

button.principal:active {
  background: #111111;
}

.etape-libelle {
  flex: 1 1 auto;
  min-width: 7rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.controles-etapes button.nav {
  font-size: 1.5rem;
  padding: 0 0.75rem;
}

/* Vitesse de lecture : le tempo appartient au système, pas à la session. */
.controles-vitesse {
  padding-top: 0;
}

.vitesse-titre {
  font-weight: 600;
  opacity: 0.75;
}

/* Vitesse et terrain : le choix retenu se lit d'un coup d'œil. */
.controles-fond {
  padding-top: 0;
}

.controles-vitesse button.vitesse[aria-pressed='true'],
.controles-fond button.fond[aria-pressed='true'] {
  color: #ffffff;
  background: #333333;
  border-color: #333333;
}

/* Couleur des pions et actions d'étape */
.controles-couleur,
.controles-etape-actions {
  padding-top: 0;
}

.controles-couleur label {
  font-weight: 600;
  opacity: 0.75;
}

input[type="color"] {
  width: 56px;
  min-height: 44px;
  padding: 2px;
  background: #ffffff;
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  cursor: pointer;
}

/* Nom et partage */
.partage-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.75rem;
}

.partage-form label {
  width: 100%;
  font-size: 0.875rem;
  color: #444444;
}

input[type="text"] {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.75rem;
  font: inherit;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid #b9b9b9;
  border-radius: 8px;
}

input[type="text"]:focus {
  outline: 2px solid #333333;
  outline-offset: 1px;
}

input[type="text"].invalide {
  border-color: #c62828;
  outline: 2px solid #c62828;
  outline-offset: 1px;
}

.message {
  margin: 0.5rem 0.75rem 0;
  min-height: 1.4em;
  white-space: pre-line;
  color: #444444;
}

.message.erreur {
  color: #c62828;
}

.message:empty {
  display: none;
}

/* Panneau de partage */
.partage {
  margin: 0.75rem;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
}

.partage h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.partage ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.partage li {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.partage a {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1f1f1f;
}

.telecharger {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.telecharger .bouton {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Page publique : liens de sortie */
.liens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
}

.liens a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid #b9b9b9;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

@media (min-width: 40rem) {
  .entete {
    padding: 0.75rem 0;
  }

  .controles,
  .partage-form,
  .liens {
    padding-left: 0;
    padding-right: 0;
  }

  .message,
  .partage {
    margin-left: 0;
    margin-right: 0;
  }
}
