/* Le Défi du Salon : interface autour de la maquette (palette claire, une couleur d'accent) */
:root {
  --encre: #152233; --accent: #1D7A8C; --accent-clair: #5FC2D4; --orange: #E07B4F; --papier: #F7F3EC;
  --fond: #eee7da; --carte: #ffffff; --ligne: #e6dfd2; --doux: #6b7480; --vert: #2EAD6B; --ambre: #E9B824;
  --ombre: 0 10px 30px -12px rgba(21, 34, 51, .25), 0 2px 6px rgba(21, 34, 51, .06);
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--encre); font-family: "Inter", system-ui, sans-serif; font-size: 14px; }
h1, h2, h3, .titre { font-family: "Barlow Condensed", system-ui, sans-serif; font-weight: 800; letter-spacing: .01em; margin: 0; }
button { font: inherit; cursor: pointer; }
textarea, input { font: inherit; color: inherit; }
.cache { display: none !important; }

#carte { position: fixed; inset: 0; }
#carte canvas { display: block; }
.calque-etiquettes { position: absolute; inset: 0; pointer-events: none; }

/* Étiquettes projetées */
.lbl { padding: 4px 9px; border-radius: 999px; background: #fff; box-shadow: var(--ombre); font-size: 12px; font-weight: 600; white-space: nowrap; transform: translateY(-6px); }
.lbl-doux { background: rgba(255, 255, 255, .86); color: var(--doux); font-weight: 500; }
.lbl-plein { background: var(--accent); color: #fff; }
.lbl-equipe { background: var(--c); color: #fff; font-family: "Barlow Condensed", sans-serif; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pin-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; pointer-events: none; transform: translateY(-2px); }
.etat-stand { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.etat-stand:empty { display: none; }
.etat-stand.fait { background: var(--vert); color: #fff; }
.etat-stand.afaire { background: #fff; color: var(--doux); box-shadow: var(--ombre); }
.etat-stand.ici { background: var(--accent); color: #fff; }

/* Barre du haut */
.barre { position: fixed; left: 16px; right: 16px; top: 14px; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--carte); border-radius: var(--r); box-shadow: var(--ombre); }
.marque { display: flex; flex-direction: column; line-height: 1; padding-right: 10px; border-right: 1px solid var(--ligne); }
.marque b { font-family: "Barlow Condensed", sans-serif; font-size: 20px; font-weight: 900; letter-spacing: .02em; }
.marque b em { font-style: normal; color: var(--accent-clair); }
.marque span { font-size: 11px; color: var(--doux); margin-top: 3px; }
.puce-equipe { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--papier); font-weight: 700; }
.puce-equipe i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.phases { display: flex; gap: 4px; margin: 0 auto; }
.phases span { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; color: var(--doux); white-space: nowrap; }
.phases span b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--papier); font-size: 11px; }
.phases span.faite b { background: var(--accent); color: #fff; }
.phases span.encours { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--encre); font-weight: 700; }
.phases span.encours b { background: var(--accent); color: #fff; box-shadow: 0 0 0 0 rgba(29, 122, 140, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 10px rgba(29, 122, 140, 0); } }
.compteur { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.compteur b { font-family: "Barlow Condensed", sans-serif; font-size: 22px; font-weight: 800; }
.compteur span { font-size: 11px; color: var(--doux); }
.live { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #e9f6ee; color: #1f7a48; font-weight: 700; font-size: 12px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--vert); animation: pulse-vert 1.6s infinite; }
@keyframes pulse-vert { 50% { opacity: .35; } }

/* Panneaux */
.panneau { position: fixed; top: 84px; bottom: 96px; z-index: 15; width: 380px; background: var(--carte); border-radius: var(--r); box-shadow: var(--ombre); display: flex; flex-direction: column; overflow: hidden; }
.panneau.gauche { left: 16px; }
.panneau.droite { right: 16px; width: 340px; }
.panneau .entete { padding: 16px 18px 12px; border-bottom: 1px solid var(--ligne); display: flex; gap: 12px; align-items: flex-start; }
.panneau .entete .sur { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.panneau .entete h2 { font-size: 24px; line-height: 1.05; margin-top: 2px; }
.panneau .entete p { margin: 4px 0 0; color: var(--doux); font-size: 12px; }
.panneau .corps { padding: 14px 18px 18px; overflow-y: auto; flex: 1; }
.fermer { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--ligne); background: #fff; color: var(--doux); flex-shrink: 0; }
.bloc { margin-bottom: 16px; }
.bloc h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--doux); font-weight: 700; margin-bottom: 8px; font-family: "Inter", sans-serif; }
.bloc p { margin: 0 0 6px; line-height: 1.5; }
.recit { font-size: 15px; line-height: 1.6; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--papier); border-radius: 0 10px 10px 0; }
.video { width: 100%; border-radius: 12px; background: #0b111a; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #9fb0c0; font-size: 12px; text-align: center; padding: 10px; }
video.video { padding: 0; }
.probleme { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--ligne); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.probleme:hover { border-color: var(--orange); }
.probleme b { width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; }
.champ { margin-bottom: 10px; }
.champ label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.champ small { display: block; color: var(--doux); font-size: 11px; margin-bottom: 4px; }
.champ textarea, .champ input { width: 100%; border: 1px solid var(--ligne); border-radius: 10px; padding: 9px 11px; background: #fff; resize: vertical; }
.champ textarea { min-height: 64px; }
.champ textarea:focus, .champ input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 700; }
.bouton:disabled { background: #c9cfd6; cursor: not-allowed; }
.bouton.secondaire { background: #fff; color: var(--encre); border: 1px solid var(--ligne); }
.bouton.plein { width: 100%; }
.valider { display: flex; gap: 8px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, white); border: 1px dashed color-mix(in srgb, var(--accent) 50%, white); margin-bottom: 14px; }
.valider input { flex: 1; font-family: "Barlow Condensed", sans-serif; font-size: 26px; font-weight: 800; letter-spacing: .3em; text-align: center; border: 1px solid var(--ligne); border-radius: 10px; width: 100%; }
.valide { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #e9f6ee; color: #1f7a48; font-weight: 700; margin-bottom: 14px; }
.enregistre { font-size: 11px; color: var(--doux); }
.qr { margin-bottom: 12px; }
.qr .q { font-weight: 600; }
.qr .r { margin-top: 4px; padding: 9px 12px; background: var(--papier); border-radius: 10px; line-height: 1.5; }
.qr .r.attente { color: var(--doux); font-style: italic; }

/* Mission (droite) */
.cas { padding: 14px; border-radius: 12px; background: var(--encre); color: #fff; margin-bottom: 14px; }
.cas .sur { color: var(--accent-clair); }
.cas h2 { font-size: 22px; line-height: 1.05; margin: 4px 0; }
.cas p { margin: 0; color: #c5ceda; font-size: 12px; }
.consigne { padding: 10px 12px; border-radius: 12px; background: var(--papier); margin-bottom: 14px; line-height: 1.45; }
.consigne b { color: var(--accent); }
.jauge { height: 8px; background: var(--papier); border-radius: 999px; overflow: hidden; margin: 6px 0 12px; }
.jauge i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s; }
.ligne-stand { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--ligne); cursor: pointer; }
.ligne-stand:hover { background: var(--papier); }
.ligne-stand .nom { font-weight: 600; flex: 1; }
.ligne-stand .nom small { display: block; font-weight: 400; color: var(--doux); font-size: 11px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--papier); color: var(--doux); white-space: nowrap; }
.badge.ok { background: #e9f6ee; color: #1f7a48; }
.badge.notes { background: #fff4dc; color: #8a6a10; }
.score-detail { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; color: var(--doux); }
.score-detail b { color: var(--encre); text-align: right; }

/* Bascule de lieu et dock */
.bascule { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 15; display: flex; padding: 5px; gap: 4px; background: var(--carte); border-radius: 999px; box-shadow: var(--ombre); }
.bascule button { border: 0; background: transparent; padding: 10px 18px; border-radius: 999px; font-weight: 700; color: var(--doux); }
.bascule button.actif { background: var(--encre); color: #fff; }
.camera { position: fixed; bottom: 22px; right: 372px; z-index: 15; display: flex; gap: 4px; padding: 5px; background: var(--carte); border-radius: 999px; box-shadow: var(--ombre); }
.camera button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; font-size: 16px; color: var(--encre); }
.camera button:hover { background: var(--papier); }

/* Rejoindre */
.voile { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(21, 34, 51, .55); backdrop-filter: blur(6px); padding: 16px; }
.boite { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--carte); border-radius: 22px; padding: 28px; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .5); }
.boite .sur { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.boite h1 { font-size: 40px; line-height: 1; margin: 6px 0 8px; }
.boite > p { color: var(--doux); line-height: 1.5; margin: 0 0 18px; }
.bracelets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.bracelet { padding: 16px 10px; border-radius: 14px; border: 2px solid var(--ligne); background: #fff; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; }
.bracelet i { width: 54px; height: 18px; border-radius: 999px; background: var(--c); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); }
.bracelet.choisi { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); }
.code-equipe { display: flex; gap: 10px; }
.code-equipe input { flex: 1; font-family: "Barlow Condensed", sans-serif; font-size: 30px; font-weight: 800; letter-spacing: .4em; text-align: center; border: 1px solid var(--ligne); border-radius: 12px; }
.erreur { color: #b33a3a; font-weight: 600; margin-top: 10px; min-height: 1em; }

/* Construire */
.grande { width: min(1100px, 100%); }
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin: 16px 0; }
.zone { border: 1px solid var(--ligne); border-radius: 14px; padding: 12px; }
.zone h3 { font-size: 18px; }
.zone p { color: var(--doux); font-size: 12px; margin: 2px 0 8px; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.puce { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--ligne); background: #fff; font-size: 12px; font-weight: 600; }
.puce.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.zone textarea { width: 100%; min-height: 70px; border: 1px solid var(--ligne); border-radius: 10px; padding: 8px 10px; resize: vertical; }

/* Notifications */
#toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-radius: 12px; box-shadow: var(--ombre); font-weight: 600; animation: entre .4s cubic-bezier(.2, .8, .2, 1); }
.toast i { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--accent)); }
@keyframes entre { from { transform: translateY(-12px); opacity: 0; } }

/* Petits écrans : panneaux en bas */
@media (max-width: 900px) {
  .phases { display: none; }
  .panneau { top: auto; bottom: 76px; left: 10px !important; right: 10px; width: auto !important; max-height: 46vh; }
  .panneau.droite { max-height: 52vh; }
  .panneau.droite.repli .corps { display: none; }
  .panneau.droite .entete { cursor: pointer; }
  .panneau.droite .entete::after { content: "▴"; margin-left: auto; color: var(--doux); font-size: 18px; }
  .panneau.droite.repli .entete::after { content: "▾"; }
  body.fiche-ouverte .panneau.droite { display: none; }
  .camera { display: none; }
  .barre { left: 10px; right: 10px; top: 10px; gap: 8px; }
  .marque span { display: none; }
  .live { display: none; }
}

/* Dictée vocale */
.avec-micro { position: relative; }
.avec-micro textarea { padding-right: 46px !important; }
.micro { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ligne); background: #fff; color: var(--accent); display: grid; place-items: center; padding: 0; }
.micro:hover { background: var(--papier); }
.micro:disabled { opacity: .4; cursor: not-allowed; }
.micro.ecoute { background: #d64545; border-color: #d64545; color: #fff; animation: ecoute 1.2s infinite; }
@keyframes ecoute { 0% { box-shadow: 0 0 0 0 rgba(214, 69, 69, .5); } 100% { box-shadow: 0 0 0 12px rgba(214, 69, 69, 0); } }
.corrige { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #e9f6ee; color: #1f5c3b; font-size: 13px; line-height: 1.45; }
.corrige b { color: #1f7a48; }
.pb-ligne { border: 1px solid var(--ligne); border-radius: 14px; padding: 12px; }
.pb-ligne h3 { font-size: 17px; display: flex; gap: 8px; align-items: center; }
.pb-ligne h3 b { width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; font-family: "Inter", sans-serif; }
.pb-ligne p { color: var(--doux); font-size: 12px; margin: 4px 0 8px; }
