:root {
	--fond: #10131c; --fond2: #171b28; --ligne: rgba(140, 170, 255, .16);
	--texte: #e4e8f5; --doux: #9aa3c0; --cyan: #3fd9e0; --violet: #9b7bff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font-family: "Exo 2", system-ui, sans-serif; }
body { min-height: 100vh; background: radial-gradient(ellipse 80% 60% at 70% -10%, rgba(155,123,255,.18), transparent 60%), radial-gradient(ellipse 60% 50% at 0% 100%, rgba(63,217,224,.12), transparent 60%), var(--fond); }

.entete { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--ligne); }
.logo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 18px rgba(63,217,224,.25); }
.entete h1 { margin: 0; font-family: Syncopate, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: .08em; background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.entete p { margin: 2px 0 0; color: var(--doux); font-size: 14px; }

.atelier { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; padding: 20px; max-width: 1400px; margin: 0 auto; }
.scene { min-width: 0; }
.cadre { position: relative; border: 1px solid var(--ligne); border-radius: 14px; background: #0b0d14; min-height: 340px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cadre.survol { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(63,217,224,.2) inset; }
.empile { position: relative; display: inline-block; line-height: 0; max-width: 100%; transform-origin: 0 0; }
.loupe { position: absolute; width: 120px; height: 120px; border-radius: 50%; pointer-events: none; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.loupe[hidden] { display: none; }
.viseur { position: absolute; z-index: 5; pointer-events: none; border-radius: 50%; border: 2px solid #3fd9e0; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.4); }
.viseur::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #3fd9e0; }
.viseur[hidden] { display: none; }
.option-doigt small { display: block; color: var(--doux); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .option-doigt { display: none !important; } } /* à la souris, pas besoin de viseur */
.recentrer { position: absolute; top: 10px; right: 10px; z-index: 4; background: rgba(16,19,28,.85); }
.recentrer[hidden] { display: none; }
canvas.sculpture { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; touch-action: none; cursor: grab; }
#retour-relief { z-index: 4; left: 10px; right: auto; background: #10131c; color: #fff; border-color: var(--cyan); opacity: 1; }
.chargement3d { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(16,19,28,.75); color: var(--texte); font-size: 14px; }
.chargement3d[hidden] { display: none; }
.atelier3d { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 12px; background: rgba(10,12,18,.82); backdrop-filter: blur(3px); }
.atelier3d[hidden] { display: none; }
.a3d-boite { width: min(340px, 100%); padding: 20px 18px; border-radius: 16px; border: 1px solid rgba(155,123,255,.45); background: var(--fond2); text-align: center; box-shadow: 0 0 40px rgba(63,217,224,.15); }
.a3d-anneau { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid rgba(155,123,255,.25); border-top-color: var(--cyan); animation: a3d-tour 1s linear infinite; }
@keyframes a3d-tour { to { transform: rotate(360deg); } }
.a3d-boite h3 { margin: 0 0 12px; font-size: 17px; color: var(--texte); }
.a3d-etapes { list-style: none; margin: 0 0 14px; padding: 0; text-align: left; font-size: 14px; }
.a3d-etapes li { padding: 4px 0 4px 26px; position: relative; color: var(--doux); opacity: .55; }
.a3d-etapes li::before { content: ''; position: absolute; left: 4px; top: 9px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.a3d-etapes li.en-cours { color: var(--texte); opacity: 1; font-weight: 600; }
.a3d-etapes li.en-cours::before { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: a3d-pouls 1.2s ease-in-out infinite; }
.a3d-etapes li.fait { color: var(--texte); opacity: .9; }
.a3d-etapes li.fait::before { content: '✓'; border: 0; top: 3px; left: 3px; width: auto; height: auto; color: var(--cyan); font-size: 14px; }
@keyframes a3d-pouls { 50% { opacity: .4; } }
.a3d-barre { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.a3d-barre span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width .8s ease; }
.a3d-temps { margin: 8px 0 4px; font-size: 13px; color: var(--texte); }
.a3d-note { margin: 0; font-size: 12px; color: var(--doux); }
@media (prefers-reduced-motion: reduce) { .a3d-anneau, .a3d-etapes li.en-cours::before { animation: none; } }
.chargement3d span { width: 180px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--cyan) var(--p, 0%), rgba(255,255,255,.12) var(--p, 0%)); }
.pleine-largeur { width: 100%; }
.mode-selection { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 8px 0; }
.mode-selection button { padding: 12px 6px; border-radius: 12px; border: 2px solid var(--ligne); background: transparent; color: var(--texte); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.bouton.avancee { margin: 2px 0 8px; border-style: dashed; border-color: rgba(60,219,211,.5); }
.bouton.avancee.actif { border-style: solid; border-color: var(--cyan); background: rgba(60,219,211,.18); }
.mode-selection button.actif { border-color: var(--cyan); background: rgba(60,219,211,.18); }
#voir3d[hidden], #aide-3d[hidden] { display: none; }
#bloc-modelage .ligne .bouton { flex: 1 1 0; }
#bloc-symetrie[hidden], #autre-version[hidden] { display: none; }
.symetrie { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.symetrie button { padding: 9px 6px; border-radius: 9px; border: 1px solid var(--ligne); background: transparent; color: var(--texte); font: inherit; font-size: 13px; cursor: pointer; }
.symetrie button.actif { border-color: var(--violet); background: rgba(155,123,255,.18); }
#bloc-modelage .bouton.principal { width: 100%; }
.sculpture-bouton { width: 100%; border-color: rgba(155,123,255,.6); }
.sculpture-bouton.actif { background: rgba(155,123,255,.25); }
.pro { margin-left: 8px; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; background: linear-gradient(90deg, var(--cyan), var(--violet)); color: #10131c; }
#rendu { display: block; max-width: 100%; max-height: calc(100vh - 170px); touch-action: none; }
#calque { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cadre.peindre #rendu { cursor: crosshair; }
.vide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--doux); pointer-events: none; }
.vide small { opacity: .75; }
.vide[hidden] { display: none; }
.legende { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 14px; color: var(--doux); }
.legende[hidden] { display: none; }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; border: 1px solid rgba(255,255,255,.2); }

.panneau { display: flex; flex-direction: column; gap: 14px; }
.bloc { background: var(--fond2); border: 1px solid var(--ligne); border-radius: 14px; padding: 14px 16px; }
.bloc h2, .bloc summary { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); cursor: default; }
details.bloc summary { cursor: pointer; margin: 0; }
details[open] summary { margin-bottom: 10px; }
.ligne { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.bouton { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--ligne); background: rgba(255,255,255,.04); color: var(--texte); font: inherit; font-size: 14px; cursor: pointer; transition: border-color .2s, background .2s; }
.bouton:hover { border-color: var(--cyan); }
.bouton:disabled { opacity: .4; cursor: default; }
.bouton.principal { width: 100%; background: linear-gradient(90deg, rgba(63,217,224,.25), rgba(155,123,255,.25)); border-color: rgba(63,217,224,.5); font-weight: 600; }
.bouton.actif { border-color: var(--violet); background: rgba(155,123,255,.18); }

.lumiere { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
#pad { width: 120px; height: 120px; border-radius: 50%; cursor: grab; touch-action: none; }
.reglages { display: flex; flex-direction: column; gap: 8px; }
label { display: block; font-size: 13px; color: var(--doux); margin-bottom: 6px; }
label output { float: right; color: var(--texte); }
input[type=range] { width: 100%; accent-color: var(--cyan); }

.onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.onglets button { flex: 1 1 auto; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--ligne); background: transparent; color: var(--doux); font: inherit; font-size: 13px; cursor: pointer; }
.onglets button.actif { color: var(--texte); border-color: var(--violet); background: rgba(155,123,255,.18); }
.note { margin: 0; font-size: 12px; color: var(--doux); text-align: center; }
.sous-titre { margin: 14px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--doux); }
.aide { margin: 6px 0 0; font-size: 12px; line-height: 1.4; color: var(--doux); }
#bloc-horizon { margin-top: 10px; }
.bloc h2 .num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #10131c; font-size: 12px; letter-spacing: 0; }
.lien { padding: 0; border: 0; background: none; color: var(--cyan); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.question { margin: 14px 0 8px; font-size: 14px; color: var(--texte); }
.aide.fort { font-size: 13px; color: var(--texte); margin: 0 0 10px; }
.espace { margin-top: 12px; }
#bloc-verif .ligne .bouton, #bloc-correction .ligne .bouton { flex: 1 1 0; width: auto; }
#bloc-verif .bouton.principal { width: 100%; }
details.bloc .onglets + label, details.bloc .bouton { margin-top: 8px; }
.ambiances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.ambiances button { padding: 8px 4px; border-radius: 9px; border: 1px solid var(--ligne); background: transparent; color: var(--texte); font: inherit; font-size: 12.5px; cursor: pointer; }
.ambiances button.actif, .ambiances button:hover { border-color: var(--violet); background: rgba(155,123,255,.18); }
.pastilles { display: flex; gap: 10px; flex-wrap: wrap; }
.pastilles button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); background: var(--c); cursor: pointer; }
.pastilles button.actif { border-color: #fff; box-shadow: 0 0 0 3px rgba(63,217,224,.45); }
#etape2 .sous-titre { margin-top: 4px; }
label.case { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; color: var(--texte); cursor: pointer; }
label.case input { accent-color: var(--violet); margin-top: 2px; }
#bloc-horizon[hidden], label[hidden] { display: none; }
.guide { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; background: rgba(16,19,28,.92); }
.guide[hidden] { display: none; }
.guide ol { display: grid; grid-template-columns: repeat(3, minmax(0, 170px)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.guide li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border: 1px solid var(--ligne); border-radius: 12px; background: var(--fond2); text-align: center; font-size: 13px; color: var(--doux); line-height: 1.35; }
.guide li svg { width: 64px; height: 64px; }
.guide li b { color: var(--texte); font-size: 14px; }
.guide .bouton.principal { width: auto; padding: 10px 28px; }
@media (max-width: 520px) { .guide ol { grid-template-columns: 1fr; } .guide li { flex-direction: row; text-align: left; } .guide li svg { width: 44px; height: 44px; flex: none; } }
.toast { z-index: 6; position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(16,19,28,.9); border: 1px solid rgba(155,123,255,.45); font-size: 14px; color: var(--texte); text-align: center; }
.toast[hidden] { display: none; }

/* bêta privée : crédits restants et porte d'entrée par code */
.credits { margin-left: auto; padding: 6px 12px; border: 1px solid var(--ligne); border-radius: 999px; font-size: 13px; color: var(--doux); white-space: nowrap; }
.credits[hidden], .porte[hidden] { display: none; }
.porte { position: fixed; inset: 0; z-index: 50; overflow-y: auto; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 30%, rgba(155,123,255,.18), transparent 60%), rgba(10,12,18,.96); }
.porte-boite { width: min(420px, 100%); padding: 32px 26px; border: 1px solid rgba(155,123,255,.35); border-radius: 18px; background: var(--fond2); text-align: center; box-shadow: 0 0 60px rgba(63,217,224,.12); }
.porte-logo { width: 150px; margin: 0 auto 6px; display: block; }
.porte h2 { margin: 6px 0 10px; font-family: Syncopate, sans-serif; font-size: 17px; letter-spacing: .1em; text-transform: uppercase; background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.porte p { color: var(--doux); font-size: 14px; line-height: 1.5; }
.porte input { width: 100%; margin: 10px 0 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--fond); color: var(--texte); font: 600 17px 'Exo 2', sans-serif; letter-spacing: .12em; text-align: center; text-transform: uppercase; }
.porte input:focus { outline: none; border-color: var(--cyan); }
.porte .bouton.principal { width: 100%; }
.porte-erreur { min-height: 1.2em; margin: 10px 0 0; color: #ff8fa3 !important; }
.porte-note { font-size: 12px !important; }
.porte-note a { color: var(--cyan); }
@media (max-width: 520px) { /* sur téléphone, la barre du haut doit tenir dans l'écran, crédits compris */
	.entete { gap: 8px 10px; padding: 10px 14px; flex-wrap: wrap; } /* très petit écran : les crédits passent à la ligne */
	.entete p { display: none; }
	.entete h1 { font-size: 12px; }
	.logo { width: 40px; height: 40px; }
	.credits { font-size: 11px; padding: 4px 9px; white-space: normal; text-align: center; max-width: 104px; line-height: 1.3; border-radius: 10px; }
}

@media (max-width: 900px) {
	.atelier { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
	#rendu { max-height: 60vh; }
	.entete { padding: 12px 16px; }
}
@media (max-width: 420px) {
	.entete { gap: 10px; }
	.entete h1 { font-size: 13px; letter-spacing: .03em; }
	.entete p { font-size: 13px; }
	.logo { width: 44px; height: 44px; }
	.lumiere { grid-template-columns: 100px 1fr; }
	#pad { width: 100px; height: 100px; }
}
