/* Interface du site : style « bitmap » (gros pixels, liserés noirs, couleurs vives) d'après les visuels d'édition et la planche d'éléments de jeu rétro.
   Tout se règle avec les variables de css/theme.css. */
html, body { margin: 0; height: 100%; background: var(--fond); overflow: hidden; font-family: var(--police); color: var(--texte); cursor: var(--cur-fleche, default); -webkit-font-smoothing: none; }
#scene3d, #scene3d canvas { position: fixed; inset: 0; display: block; }
[hidden] { display: none !important; }
button, input[type=range] { font-family: inherit; cursor: var(--cur-main, pointer); }

/* cadre « pixel » : un liseré noir de 3px aux coins crantés */
.px { box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000; }

.btn { --c: var(--magenta); position: relative; margin: 3px; padding: 8px 16px; border: 0; border-radius: 0; background: var(--c); color: #fff; font-size: 18px; letter-spacing: 1px; text-transform: uppercase; text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -5px 0 0 rgba(0,0,0,.28), inset 0 5px 0 0 rgba(255,255,255,.38); }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(2px); box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 5px 0 0 rgba(0,0,0,.28), inset 0 -5px 0 0 rgba(255,255,255,.2); }
.btn.sec { --c: var(--violet-btn); }
#retour { --c: var(--violet-btn); position: fixed; left: 18px; top: 16px; z-index: 10; }
#quitter { --c: var(--rouge); position: fixed; right: 18px; top: 16px; z-index: 10; display: inline-flex; align-items: center; gap: 10px; }      /* reste rouge ; icône « sortie » + le mot Quitter */
#quitter .ico { margin: -3px 0; }          /* l'icône (22 px) déborde un peu de la ligne de texte sans agrandir le bouton : même hauteur que « Retour » */
#passer { --c: #6b6b80; position: fixed; right: 18px; bottom: 18px; z-index: 10; box-sizing: border-box; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; }      /* discret : carré, icône seule centrée, gris neutre */
#passer .ico { display: block; }

/* navigation du studio : une rangée de boutons en haut à gauche, À DROITE de « Retour » (sa place est réservée même quand Retour est caché : les boutons ne bougent pas),
   un bouton par point de vue avec son libellé dedans (« 2. Michel ») ; ça passe à la ligne si la fenêtre est étroite pour ne pas toucher « Quitter » */
#points { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; top: 19px; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 10px; max-width: calc(100vw - 2 * 195px * var(--ui, 1)); z-index: 10; }          /* centrée ; la même marge de chaque côté (celle du plus large des deux : « Retour », ~160 px ; « Quitter » fait ~155 px) pour ne toucher ni « Retour » ni « Quitter » ; top 19 = même ligne que « Retour » */
#points button { width: auto; height: auto; padding: 8px 12px; line-height: 20.5px; border: 0; border-radius: 0; background: var(--violet-btn); color: #fff; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -4px 0 0 rgba(0,0,0,.28), inset 0 4px 0 0 rgba(255,255,255,.38); }
#points button:hover { filter: brightness(1.2); }
#points button.actif { background: var(--jaune); color: #000; text-shadow: none; }
#plaque { position: fixed; left: 50%; bottom: 7%; transform: translateX(-50%); padding: 8px 28px; background: var(--magenta); color: #fff; font-size: 44px; letter-spacing: 4px; text-transform: uppercase; pointer-events: none; z-index: 5;
  text-shadow: 3px 3px 0 #000; box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -6px 0 0 rgba(0,0,0,.28), inset 0 6px 0 0 rgba(255,255,255,.38); }
/* indications de touches : icône pixel + mot court (voir src/ui/icones.js) */
#aide { position: fixed; left: 18px; bottom: 16px; display: flex; gap: 36px; align-items: center; color: #fff; font-size: 18px; text-transform: uppercase; letter-spacing: 2px; text-shadow: 2px 2px 0 #000; pointer-events: none; z-index: 5; animation: aide-entree .6s .5s backwards; }
.aide-it { display: inline-flex; align-items: center; gap: 12px; }
.aide-it b { font-weight: normal; }
.ico { image-rendering: pixelated; }
.aide-it .ico-molette { animation: aide-haut-bas 1s steps(1) infinite; }
.aide-it .ico-clic { animation: aide-appui 1.4s steps(1) infinite; }
@keyframes aide-haut-bas { 0% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes aide-appui { 0% { transform: translateY(0); } 70% { transform: translateY(3px); } 85% { transform: translateY(0); } }
@keyframes aide-entree { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aide-it .ico { animation: none; } }
#astuce { position: fixed; left: 18px; bottom: 16px; color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; pointer-events: none; text-shadow: 2px 2px 0 #000; z-index: 5; }

/* bulles : le texte survolé et les messages sont des bulles de BD en pixels */
#tip, #toast { background: #fff; color: #000; text-transform: uppercase; letter-spacing: 1px; z-index: 12; box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000; }
#tip { position: fixed; pointer-events: none; padding: 6px 12px; font-size: 16px; display: none; margin: 10px 0 0 10px; }
#tip::before { content: ''; position: absolute; left: 4px; top: -15px; width: 18px; height: 15px; background: #000; clip-path: polygon(0 100%, 100% 100%, 0 0); }
#tip::after { content: ''; position: absolute; left: 7px; top: -9px; width: 12px; height: 12px; background: #fff; clip-path: polygon(0 100%, 100% 100%, 0 0); }
#toast { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); padding: 8px 20px; font-size: 18px; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 50; }
#toast.on { opacity: 1; }

#flash { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .3s; }
#flash.on { opacity: 1; }
/* écran de chargement : « Capelo », une seule barre de progression pour TOUT le site (télé, studio, préparation de la scène), pourcentage et phrase d'étape */
#chargement { position: fixed; inset: 0; display: grid; place-items: center; background: #000; z-index: 40; transition: opacity .45s; }
#chargement.fin { opacity: 0; pointer-events: none; }
#chargement .cadre { width: min(480px, 84vw); text-align: center; text-transform: uppercase; }
#chargement-titre { font-family: 'Typo Workshop', serif; font-size: clamp(64px, 14vw, 120px); line-height: 1; color: #fff; letter-spacing: 2px; text-transform: none; }
#chargement-sous { margin-top: 6px; font-size: 18px; letter-spacing: 9px; color: var(--lilas, #c9b8ff); }
#chargement .barre { margin: 34px 3px 0; height: 30px; padding: 4px; background: #000; box-shadow: 0 0 0 3px #fff; box-sizing: border-box; }
#chargement .barre i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--magenta) 0 14px, transparent 14px 18px); }
#chargement .ligne { display: flex; justify-content: space-between; align-items: center; margin: 16px 3px 0; font-size: 15px; letter-spacing: 3px; color: #fff; }
#chargement-phrase { text-align: left; opacity: .85; }
#chargement-pct { display: inline-flex; align-items: center; gap: 4px; font-size: 24px; letter-spacing: 2px; }
#chargement-pct svg { width: 18px; height: 18px; }
#erreur { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; color: #f77; padding: 24px; font: 15px system-ui; z-index: 60; background: var(--fond); }

#lecteur { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--violet-btn); z-index: 12; font-size: 17px; text-transform: uppercase; max-width: 92vw;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5); box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -5px 0 0 rgba(0,0,0,.28), inset 0 5px 0 0 rgba(255,255,255,.3); }
#lecteur #lec-titre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
#lecteur input[type=range] { -webkit-appearance: none; appearance: none; height: 12px; background: #000; margin: 0; }
#lecteur input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; background: var(--jaune); box-shadow: 0 0 0 3px #000; border: 0; border-radius: 0; }
#lecteur input[type=range]::-moz-range-thumb { width: 14px; height: 22px; background: var(--jaune); border: 3px solid #000; border-radius: 0; }
#lec-barre { width: 160px; } #lec-vol { width: 70px; }
body.admin-on #lecteur { bottom: 220px; }
/* le lecteur est posé AU-DESSUS des indications de touches (#aide, bas gauche, ~55 px de haut), et la plaque du nom remonte encore au-dessus du lecteur */
body.lecteur-on #lecteur { bottom: 76px; }
body.admin-on.lecteur-on #lecteur { bottom: 220px; }          /* en mode admin, le panneau garde sa place habituelle */
body.lecteur-on #plaque { bottom: 150px; }
body.lecteur-on.lec-cassette #plaque { bottom: 225px; }          /* le lecteur « cassette » est plus haut (3 lignes) */
body.lecteur-on.lec-mini #plaque { bottom: 135px; }

/* indicateurs de clic : une petite bulle qui rebondit au-dessus de ce qui est cliquable (cassettes, personnages, affiches) */
#marques { position: fixed; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.marque { position: absolute; left: 0; top: 0; will-change: transform; }
.marque i { display: block; position: relative; padding: 2px 9px; background: #fff; color: #000; font-style: normal; font-size: 17px; letter-spacing: 1px; text-transform: uppercase;
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000; animation: rebond .9s infinite; }
.marque i::before { content: ''; position: absolute; left: var(--q, 50%); margin-left: -9px; top: 100%; margin-top: 3px; width: 18px; height: 14px; background: #000; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.marque i::after { content: ''; position: absolute; left: var(--q, 50%); margin-left: -6px; top: 100%; margin-top: 0; width: 12px; height: 9px; background: #fff; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.marque.cass i { background: var(--jaune); }
.marque.cass i::after { background: var(--jaune); }
@keyframes rebond { 0%, 49% { transform: translateY(0); } 50%, 100% { transform: translateY(-6px); } }

/* mode libre : titre et rappel des commandes */
#libre-titre { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); padding: 10px 34px; background: var(--magenta); color: #fff; font-size: 42px; letter-spacing: 4px; text-shadow: 3px 3px 0 #000; z-index: 14; pointer-events: none;
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -6px 0 0 rgba(0,0,0,.28), inset 0 6px 0 0 rgba(255,255,255,.38); animation: titre-libre 3.2s forwards; }
@keyframes titre-libre { 0% { opacity: 0; } 8%, 70% { opacity: 1; } 100% { opacity: 0; } }
#libre-hud { position: fixed; left: 50%; bottom: 16px; width: max-content; transform: translateX(-50%); display: flex; gap: 16px; align-items: flex-end; padding: 8px 14px 7px; background: var(--violet-btn); z-index: 14; max-width: 96vw; flex-wrap: wrap; justify-content: center;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; text-shadow: 2px 2px 0 rgba(0,0,0,.5); opacity: .92;
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -5px 0 0 rgba(0,0,0,.28), inset 0 5px 0 0 rgba(255,255,255,.3); }
#libre-hud .grp { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#libre-hud .rang { display: flex; gap: 5px; align-items: flex-end; }
.touche { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; background: #fff; color: #000; font-size: 14px; text-shadow: none; box-sizing: border-box;
  box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, inset 0 -4px 0 0 rgba(0,0,0,.25); }
.touche.on { background: var(--jaune); transform: translateY(2px); box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000; }
.touche.rouge { background: var(--rouge); color: #fff; }
.touche.large { padding: 0 12px; }

/* ---- mode admin ---- */
#admin { position: fixed; right: 0; top: 0; bottom: 0; width: 350px; background: rgba(8,8,24,.94); color: #cdd6e6; font: 13px/1.4 system-ui, sans-serif; z-index: 26; border-left: 1px solid #334; display: flex; flex-direction: column; }
#adm-onglets { display: flex; } #adm-onglets button { flex: 1; padding: 9px; background: #123; color: #cde; border: 0; border-bottom: 3px solid transparent; font: 13px system-ui; } #adm-onglets button.actif { border-bottom-color: var(--jaune); background: #1c2138; color: #fff; }
#adm-contenu { overflow: auto; padding: 10px 12px 18px; flex: 1; }
#adm-contenu h3 { margin: 12px 0 4px; font-size: 13px; color: var(--jaune); font-weight: bold; }
#adm-contenu .mini, #adm-contenu em { color: #8a96a8; font-size: 12px; font-style: normal; }
#adm-contenu .ligne { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 3px; cursor: pointer; } #adm-contenu .ligne:hover { background: #1c2138; } #adm-contenu .ligne.sel { background: #2a3160; }
#adm-contenu .ligne span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#adm-contenu button { margin: 2px 4px 2px 0; padding: 3px 9px; background: #123; color: #cde; border: 1px solid #345; border-radius: 3px; font: 12px system-ui; } #adm-contenu button.del { background: #3a1420; border-color: #6a2535; }
#adm-contenu .champ { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 6px; margin: 4px 0; }
#adm-contenu .vals { display: flex; gap: 4px; align-items: center; } #adm-contenu .vals input[type=range] { flex: 1; min-width: 0; }
#adm-contenu input[type=number], #adm-contenu input[type=text], #adm-contenu select { box-sizing: border-box; background: #10142a; color: #dfe6f5; border: 1px solid #334; border-radius: 3px; padding: 2px 4px; font: 12px system-ui; }
#adm-contenu input[type=text], #adm-contenu select { width: 100%; } #adm-contenu input[type=number] { width: 62px; flex: none; }
#adm-contenu input[type=color] { width: 46px; height: 22px; padding: 0; border: 1px solid #334; background: none; }
#adm-json { width: 100%; height: 200px; margin-top: 8px; font: 11px monospace; background: #000; color: var(--vert); border: 1px solid #444; box-sizing: border-box; }
#adm-inset { position: fixed; z-index: 25; border: 2px solid var(--jaune); pointer-events: none; box-sizing: border-box; }
#adm-inset span { position: absolute; left: 0; top: 0; background: var(--jaune); color: #000; font: 11px system-ui; padding: 1px 6px; }
#adm-opts { display: block; padding: 7px 12px; font: 12px system-ui; color: #cde; border-bottom: 1px solid #334; }
