/* Thème : patinoire (fond), tableau de score de hockey (solde), piste Hot Wheels et Pokéballs (coches). */
:root {
  --glace: #eef6fc;
  --marine: #1b2a4a;
  --marine-2: #24375f;
  --rouge: #e3350d;
  --jaune: #ffcb05;
  --bleu: #3d7dca;
  --orange: #ff6b00;
  --orange-2: #ff9a3c;
  --vert: #22a559;
  --encre: #1b2a4a;
  --doux: #6b7a99;
  --carte: #ffffff;
  --rayon: 20px;
  --ombre: 0 4px 0 rgba(27, 42, 74, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--encre);
  /* Patinoire : glace, ligne rouge centrale, lignes bleues */
  background:
    linear-gradient(transparent 0 calc(50% - 3px), rgba(227, 53, 13, .10) calc(50% - 3px) calc(50% + 3px), transparent 0),
    linear-gradient(transparent 0 calc(25% - 4px), rgba(61, 125, 202, .09) calc(25% - 4px) calc(25% + 4px), transparent 0),
    linear-gradient(transparent 0 calc(75% - 4px), rgba(61, 125, 202, .09) calc(75% - 4px) calc(75% + 4px), transparent 0),
    radial-gradient(circle at 20% 10%, #fff 0, transparent 40%),
    var(--glace);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

.vue {
  max-width: 480px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(30px + env(safe-area-inset-bottom));
  position: relative;
}

/* ---------- Boutons et champs ---------- */
.btn {
  border: none; border-radius: 14px; padding: 11px 16px; font: inherit; font-weight: 800; font-size: 15px;
  cursor: pointer; transition: transform .08s;
}
.btn:active { transform: scale(.96); }
.btn.prim { background: var(--rouge); color: #fff; box-shadow: 0 4px 0 #a82508; }
.btn.ok { background: var(--vert); color: #fff; box-shadow: 0 3px 0 #17773f; }
.btn.non { background: #fde4e0; color: var(--rouge); }
.btn.doux { background: #fff; color: var(--marine); box-shadow: var(--ombre); }
.btn.mini { padding: 5px 10px; font-size: 13px; background: #fff; color: var(--marine); }
.btn.large { width: 100%; margin-top: 14px; padding: 14px; }

label { display: block; font-weight: 800; font-size: 13px; margin: 12px 0 5px; color: var(--marine-2); }
input, select {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 2px solid #d9e3f2; font: inherit; font-size: 16px;
  background: #fff; color: var(--encre);
}
input:focus, select:focus { outline: none; border-color: var(--bleu); }

.erreur { color: var(--rouge); font-weight: 800; min-height: 1.2em; }

/* ---------- Pokéball (CSS) ---------- */
.pokeball {
  position: relative; aspect-ratio: 1; border-radius: 50%; border: 3px solid #222;
  background: linear-gradient(to bottom, var(--rouge) 0 45%, #222 45% 55%, #fff 55%);
}
.pokeball::after {
  content: ""; position: absolute; inset: 34%; border-radius: 50%; background: #fff; border: 3px solid #222;
}
.pokeball.geante { width: 120px; margin: 0 auto 8px; border-width: 6px; animation: balance 2.4s ease-in-out infinite; }
.pokeball.geante::after { border-width: 6px; }
@keyframes balance { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* ---------- Connexion ---------- */
.connexion { min-height: 85vh; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.connexion h1 {
  font-size: 44px; margin: 0 0 22px; color: var(--marine); letter-spacing: -1px;
  text-shadow: 3px 3px 0 var(--jaune);
}
.connexion input { text-align: center; font-size: 22px; margin-bottom: 14px; }
.connexion .btn { width: 100%; font-size: 20px; padding: 15px; }

/* ---------- Vue enfant ---------- */
.discret {
  position: absolute; top: max(8px, env(safe-area-inset-top)); right: 10px; z-index: 2;
  border: none; background: none; font-size: 22px; color: var(--doux); opacity: .35; cursor: pointer; padding: 6px 10px;
}
.bandeau-apercu {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -6px 0 14px;
  background: var(--bleu); color: #fff; font-weight: 800; font-size: 14px; padding: 8px 12px; border-radius: 14px;
}

/* Tableau de score de hockey */
.tableau-score {
  position: relative; margin-top: 18px; text-align: center; border-radius: 24px; padding: 16px 12px 22px;
  background: linear-gradient(180deg, var(--marine-2), var(--marine));
  border: 5px solid #0f1830; box-shadow: 0 6px 0 #0f1830, inset 0 0 0 3px rgba(255, 255, 255, .06);
}
.tableau-score .titre {
  display: inline-block; background: var(--rouge); color: #fff; font-weight: 900; font-size: 14px; letter-spacing: 1px;
  text-transform: uppercase; padding: 4px 14px; border-radius: 999px; box-shadow: 0 3px 0 #a82508;
}
.solde {
  font-family: "Arial Black", "Segoe UI Black", system-ui, sans-serif; font-weight: 900;
  color: var(--jaune); font-size: clamp(58px, 20vw, 88px); line-height: 1.05; margin-top: 10px; letter-spacing: -2px;
  text-shadow: 0 0 18px rgba(255, 203, 5, .55), 0 4px 0 #b88a00;
  font-variant-numeric: tabular-nums;
}
.solde small { font-size: .5em; letter-spacing: 0; }
.palet {
  position: absolute; left: 50%; bottom: -14px; width: 56px; height: 18px; transform: translateX(-50%);
  background: #111; border-radius: 50%; box-shadow: 0 -5px 0 #333;
}

/* Piste Hot Wheels */
.piste {
  margin: 30px 0 22px; background: var(--carte); border-radius: var(--rayon); padding: 14px 14px 12px; box-shadow: var(--ombre);
}
.piste-haut { display: flex; justify-content: space-between; font-weight: 900; font-size: 15px; margin-bottom: 10px; }
.piste-haut span:last-child { color: var(--orange); }
.grille-coches {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 6px; padding: 10px;
  border-radius: 16px; background: repeating-linear-gradient(90deg, var(--orange) 0 18px, var(--orange-2) 18px 36px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15);
}
.place {
  aspect-ratio: 1; border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .8); display: grid; place-items: center;
  font-size: 20px;
}
.place.pokeball { border-style: solid; }
.place.voiture { border-color: #fff; background: rgba(255, 255, 255, .35); animation: vroum 1.2s ease-in-out infinite; }
@keyframes vroum { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
.arrivee { margin-top: 10px; text-align: center; font-weight: 800; color: var(--doux); font-size: 14px; }
.arrivee b { color: var(--vert); }

.sous-titre { font-size: 22px; font-weight: 900; margin: 0 4px 12px; }
.vide { text-align: center; color: var(--doux); font-weight: 700; }

/* Missions */
.mission {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--carte); border-radius: var(--rayon); padding: 12px 14px; margin-bottom: 12px;
  box-shadow: var(--ombre); border: 3px solid transparent; cursor: pointer; transition: transform .1s;
}
.mission:active { transform: scale(.97); }
.mission .image {
  font-size: 38px; width: 60px; height: 60px; flex: none; display: grid; place-items: center;
  background: #eaf2fc; border-radius: 16px;
}
.mission .nom { flex: 1; font-weight: 900; font-size: 18px; line-height: 1.2; }
.mission .detail { display: block; font-weight: 700; font-size: 13px; color: var(--doux); margin-top: 2px; }
.mission .etat {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 4px solid #d3ddec;
  display: grid; place-items: center; font-size: 24px; font-weight: 900;
}
.mission.attente { border-color: var(--jaune); background: #fffbe6; }
.mission.attente .etat { border-color: var(--jaune); background: var(--jaune); }
.mission.attente .detail { color: #9a7500; }
.mission.validee { border-color: var(--vert); cursor: default; }
.mission.validee .etat { border-color: var(--vert); background: var(--vert); color: #fff; }
.mission.validee .detail { color: var(--vert); }
.mission.tilt { animation: tilt .35s; }
@keyframes tilt { 30% { transform: scale(1.05) rotate(-2deg); } 60% { transform: scale(.98) rotate(1deg); } }

/* Fête : carte remplie ou sous reçus */
.fete {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(27, 42, 74, .75);
  color: #fff; text-align: center; font-weight: 900; cursor: pointer; overflow: hidden;
}
.fete .gros { font-size: 64px; color: var(--jaune); text-shadow: 0 4px 0 #b88a00; }
.fete .petit { font-size: 22px; margin-top: 8px; }
.fete .pluie { position: absolute; top: -40px; font-size: 30px; animation: pluie 2.6s linear forwards; }
@keyframes pluie { to { transform: translateY(110vh) rotate(360deg); } }

/* ---------- Vue parents ---------- */
.entete-parent { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.entete-parent h1 { flex: 1; margin: 0; font-size: 24px; }
.resume {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.resume > div {
  flex: 1; background: var(--marine); color: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: var(--ombre);
}
.resume b { display: block; font-size: 24px; color: var(--jaune); }
.etiquette { font-size: 12px; font-weight: 800; opacity: .8; text-transform: uppercase; }

.onglets { display: flex; gap: 6px; margin-bottom: 14px; }
.onglet {
  flex: 1; position: relative; border: none; font: inherit; font-weight: 800; font-size: 14px; padding: 10px 4px;
  border-radius: 12px; background: #fff; color: var(--doux); cursor: pointer; box-shadow: var(--ombre);
}
.onglet.actif { background: var(--bleu); color: #fff; }
.pastille {
  position: absolute; top: -7px; right: -3px; background: var(--rouge); color: #fff; border-radius: 10px;
  font-size: 12px; padding: 1px 7px;
}
.pastille:empty { display: none; }
.panneau { display: none; }
.panneau.actif { display: block; }
.panneau h3 { margin: 18px 4px 8px; }

.bloc { background: #fff; border-radius: 16px; padding: 14px; margin-bottom: 10px; box-shadow: var(--ombre); }
.ligne { display: flex; align-items: center; gap: 10px; }
.ligne .image { font-size: 28px; width: 40px; text-align: center; }
.ligne .texte { flex: 1; font-weight: 800; min-width: 0; }
.ligne .texte small { display: block; color: var(--doux); font-weight: 600; font-size: 12px; }
.ligne .actions { display: flex; gap: 4px; }
.ligne .actions .btn { padding: 8px 10px; }
.montant { font-weight: 900; white-space: nowrap; }
.montant.plus { color: var(--vert); }
.montant.moins { color: var(--rouge); }
.deux { display: flex; gap: 10px; }
.deux > * { flex: 1; }
.boutons { display: flex; gap: 8px; margin-top: 14px; }
.boutons .btn { flex: 1; }

.pictos { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.picto {
  font-size: 24px; padding: 4px 0; border-radius: 10px; border: 2px solid transparent; background: none; cursor: pointer;
}
.picto.choisi { border-color: var(--bleu); background: #e6f0fb; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 11;
  background: var(--marine); color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 14px; max-width: 90vw;
}
.toast.erreur-toast { background: var(--rouge); }
