/* Algator Story — son style à lui : une chambre de créateur la nuit, bleu nuit, corail et vert Algator. */
[hidden] { display: none !important; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
:root {
  --nuit0: #0d1030; --nuit1: #161a3a; --nuit2: #222852; --nuit3: #30386e; --ligne: rgba(255,255,255,.1);
  --texte: #f4f1ff; --doux: #b7b9e0; --corail: #ff7a59; --corail2: #ffa184; --vert: #2fbf87; --vert2: #6fe0b1; --jaune: #ffd166; --rouge: #ff5f6d;
  --carte: #fffaf3; --encre: #1c1f3b; --gris: #6b6f93;
  --rayon: 20px; --ombre: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 700; color: var(--texte);
  background: radial-gradient(110% 60% at 80% -10%, #3b2f6e 0%, transparent 60%), radial-gradient(90% 60% at 0% 110%, #12405a 0%, transparent 60%), var(--nuit0) fixed; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.05; font-weight: 800; }
.chargement { text-align: center; padding: 30vh 16px; color: var(--doux); }
.err { color: var(--rouge); margin: 0; }
.doux { color: var(--doux); }

/* Boutons doux */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border: 0; border-radius: 14px; cursor: pointer; font-weight: 800; text-decoration: none;
  background: var(--nuit3); color: var(--texte); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); transition: transform .12s, filter .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.corail { background: linear-gradient(180deg, var(--corail2), var(--corail)); color: #2a0f06; }
.btn.vert { background: linear-gradient(180deg, var(--vert2), var(--vert)); color: #062a1c; }
.btn.fantome { background: transparent; box-shadow: inset 0 0 0 2px var(--ligne); }
.btn.petit { min-height: 34px; padding: 4px 12px; font-size: 14px; border-radius: 11px; }
.btn.plein { width: 100%; }
.btn:focus-visible, .action:focus-visible { outline: 3px solid var(--jaune); outline-offset: 3px; }

/* En-tête */
.haut { position: sticky; top: 0; z-index: 20; background: rgba(13,16,48,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--ligne); }
.haut-in { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marque .logo { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--corail), #c8507a); }
.marque .logo svg { width: 22px; height: 22px; }
.marque b { font-size: 19px; letter-spacing: .02em; }
.marque small { display: block; font-size: 11px; color: var(--doux); margin-top: -3px; }
.espace { flex: 1; }
.lien-album { font-size: 14px; color: var(--vert2); text-decoration: none; white-space: nowrap; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }

/* Cartes et champs */
.bloc { background: var(--nuit1); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); }
.bloc.clair { background: var(--carte); color: var(--encre); border: 0; }
.champ { display: grid; gap: 5px; }
.champ label { font-size: 14px; color: var(--doux); }
.bloc.clair .champ label { color: var(--gris); }
.champ input, .champ select { min-height: 46px; border-radius: 12px; border: 2px solid var(--ligne); background: var(--nuit0); padding: 6px 12px; font-weight: 800; }
.bloc.clair .champ input { background: #fff; color: var(--encre); border-color: rgba(28,31,59,.15); }
.case-a-cocher { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Accueil sans compte */
.entree { max-width: 980px; margin: 0 auto; display: grid; gap: 18px; grid-template-columns: 1.2fr 1fr; align-items: center; }
.entree .titre-jeu { font-size: clamp(44px, 9vw, 84px); line-height: .95; }
.entree .titre-jeu span { color: var(--corail); }
.entree p { color: var(--doux); font-size: 18px; }
.entree .formulaires { display: grid; gap: 14px; }
@media (max-width: 800px) { .entree { grid-template-columns: 1fr; } }

/* Création du créateur */
.creation { max-width: 860px; margin: 0 auto; display: grid; gap: 16px; }
.niches { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.niche { padding: 14px; border-radius: 16px; border: 2px solid var(--ligne); background: var(--nuit1); cursor: pointer; text-align: left; }
.niche b { display: block; font-size: 18px; }
.niche small { color: var(--doux); font-size: 13px; }
.niche[aria-pressed="true"] { border-color: var(--corail); background: rgba(255,122,89,.12); }
.couleurs { display: flex; gap: 10px; flex-wrap: wrap; }
.pastille { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.pastille[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.apercu { display: grid; place-items: center; }
.apercu svg { width: 160px; height: 160px; }

/* Le jeu : barre d'état */
.etat { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin-bottom: 14px; }
.jour { display: grid; gap: 2px; padding: 10px 14px; border-radius: 16px; background: var(--nuit1); border: 1px solid var(--ligne); }
.jour b { font-size: 22px; }
.jour .moments { display: flex; gap: 5px; }
.jour .moments i { width: 26px; height: 6px; border-radius: 4px; background: var(--nuit3); }
.jour .moments i.fait { background: var(--doux); opacity: .4; }
.jour .moments i.ici { background: var(--jaune); }
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chiffre { padding: 8px 12px; border-radius: 16px; background: var(--nuit1); border: 1px solid var(--ligne); min-width: 0; }
.chiffre b { display: block; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chiffre span { font-size: 12px; color: var(--doux); }
.jauge { height: 8px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 4px; }
.jauge i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--vert), var(--vert2)); transition: width .4s; }
.jauge.insp i { background: linear-gradient(90deg, #8b6cff, #c4a8ff); }
.jauge.bas i { background: linear-gradient(90deg, var(--rouge), var(--corail)); }
.chiffre.abos b { color: var(--jaune); }
@media (max-width: 640px) { .etat { grid-template-columns: 1fr; } .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* La chambre */
.jeu { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .jeu { grid-template-columns: 1fr; } }
.chambre { position: relative; border-radius: 24px; overflow: hidden; background: #1b1f45; border: 1px solid var(--ligne); }
.chambre svg { display: block; width: 100%; height: auto; }
.tendance { position: absolute; left: 12px; top: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(13,16,48,.8); font-size: 14px; }
.tendance b { color: var(--corail2); }
.collab { position: absolute; right: 12px; top: 12px; padding: 6px 12px; border-radius: 999px; background: var(--vert); color: #062a1c; font-size: 13px; }
.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (max-width: 520px) { .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.action { display: grid; gap: 2px; justify-items: start; padding: 10px 12px; border: 0; border-radius: 16px; background: var(--nuit1); box-shadow: inset 0 0 0 1px var(--ligne); cursor: pointer; text-align: left; min-height: 72px; transition: transform .12s, background .12s; }
.action:hover:not(:disabled) { background: var(--nuit2); }
.action:active:not(:disabled) { transform: translateY(2px); }
.action:disabled { opacity: .4; cursor: not-allowed; }
.action svg { width: 26px; height: 26px; color: var(--corail2); }
.action b { font-size: 16px; }
.action small { font-size: 12px; color: var(--doux); }
.action.dormir { background: linear-gradient(180deg, #3a2f78, #2a2360); }
.action.dormir svg { color: var(--jaune); }
.action.conseil { box-shadow: inset 0 0 0 2px var(--corail); }

/* Onglets du panneau */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.onglet { padding: 7px 14px; border-radius: 999px; border: 0; background: var(--nuit1); box-shadow: inset 0 0 0 1px var(--ligne); cursor: pointer; font-weight: 800; font-size: 14px; position: relative; }
.onglet[aria-pressed="true"] { background: var(--texte); color: var(--nuit0); }
.onglet .pt { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--corail); color: #2a0f06; font-size: 11px; display: grid; place-items: center; }
.panneau { display: grid; gap: 10px; }

/* Studio */
.video { display: grid; grid-template-columns: 84px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 16px; background: var(--nuit1); border: 1px solid var(--ligne); }
.mini { width: 84px; aspect-ratio: 16 / 9; border-radius: 10px; position: relative; overflow: hidden; display: grid; place-items: center; font-size: 11px; color: #fff; }
.mini em { position: absolute; right: 4px; bottom: 3px; font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.6); }
.video .t { min-width: 0; }
.video .t b { display: block; font-size: 15px; line-height: 1.15; }
.video .t small { color: var(--doux); font-size: 12px; }
.qualite { display: inline-block; padding: 0 7px; border-radius: 6px; font-size: 12px; background: var(--nuit3); }
.etiquette { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11px; background: var(--jaune); color: #3a2a00; margin-left: 4px; }
.vide { color: var(--doux); text-align: center; padding: 18px 8px; }

/* Histoire */
.chapitre { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; background: var(--nuit1); border: 1px solid var(--ligne); }
.chapitre .n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--nuit3); font-size: 16px; }
.chapitre.fini .n { background: var(--vert); color: #062a1c; }
.chapitre.courant { border-color: var(--corail); }
.chapitre.verrou { opacity: .5; }
.chapitre b { display: block; }
.chapitre small { color: var(--doux); font-size: 13px; }
.chapitre .jauge { margin-top: 6px; }
.recompense { font-size: 12px; color: var(--vert2); white-space: nowrap; }

/* Matériel */
.objet { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px; border-radius: 16px; background: var(--nuit1); border: 1px solid var(--ligne); }
.niveaux { display: flex; gap: 3px; margin-top: 4px; }
.niveaux i { width: 18px; height: 6px; border-radius: 3px; background: var(--nuit3); }
.niveaux i.ok { background: var(--jaune); }
.competences { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.competence { padding: 10px; border-radius: 14px; background: var(--nuit1); border: 1px solid var(--ligne); text-align: center; }
.competence b { display: block; font-size: 22px; color: var(--jaune); }
.competence span { font-size: 12px; color: var(--doux); }

/* Journal */
.entree-journal { padding: 8px 12px; border-radius: 12px; background: var(--nuit1); border-left: 4px solid var(--nuit3); font-size: 14px; }
.entree-journal small { color: var(--doux); margin-right: 6px; }
.entree-journal.buzz { border-left-color: var(--jaune); }
.entree-journal.histoire { border-left-color: var(--corail); }
.entree-journal.bon { border-left-color: var(--vert); }
.entree-journal.mauvais { border-left-color: var(--rouge); }
.entree-journal.commentaire { border-left-color: #8b6cff; }
.entree-journal.jour { opacity: .7; }
.classement { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.classement li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 14px; background: var(--nuit1); }
.classement li.moi { background: rgba(255,122,89,.18); }
.classement .r { color: var(--jaune); text-align: center; }
.classement small { color: var(--doux); display: block; font-size: 12px; }

/* Fenêtres, dialogues et résultats */
.voile { position: fixed; inset: 0; z-index: 60; background: rgba(5,6,20,.7); display: grid; place-items: end center; padding: 0; }
@media (min-width: 700px) { .voile { place-items: center; padding: 16px; } }
.fenetre { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--nuit1); border: 1px solid var(--ligne); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; animation: monte .25s ease-out; }
@media (min-width: 700px) { .fenetre { border-radius: 24px; } }
.choix { display: grid; gap: 8px; }
.choix button { text-align: left; padding: 12px 14px; border-radius: 14px; border: 0; background: var(--nuit2); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.choix button:hover { background: var(--nuit3); }
.choix .chaud { color: var(--corail2); font-size: 13px; }
.dialogue { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; width: min(680px, calc(100% - 24px)); display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: end;
  padding: 14px; border-radius: 24px; background: var(--carte); color: var(--encre); box-shadow: 0 20px 60px rgba(0,0,0,.55); animation: monte .3s ease-out; }
.dialogue .portrait { width: 84px; height: 84px; border-radius: 50%; background: #e9e4ff center / cover no-repeat; overflow: hidden; box-shadow: 0 0 0 4px var(--corail); }
.dialogue .portrait svg { width: 100%; height: 100%; }
.dialogue b { color: var(--corail); font-size: 15px; }
.dialogue p { margin: 2px 0 10px; font-size: 17px; line-height: 1.35; }
.dialogue .ligne { justify-content: flex-end; }
.resultat { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; background: rgba(5,6,20,.8); cursor: pointer; }
.resultat .boite { text-align: center; display: grid; gap: 6px; padding: 24px; }
.resultat .gros { font-size: clamp(54px, 16vw, 110px); line-height: 1; color: var(--jaune); font-weight: 800; }
.resultat .sous { color: var(--doux); }
.resultat .viral { font-size: clamp(28px, 7vw, 48px); color: var(--corail2); }
.resultat .boite.secoue { animation: secoue .5s; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; padding: 10px 18px; border-radius: 14px; background: var(--carte); color: var(--encre); font-weight: 800; box-shadow: var(--ombre); max-width: calc(100% - 32px); text-align: center; }
.toast.erreur { background: var(--rouge); color: #fff; }
@keyframes monte { from { transform: translateY(20px); opacity: 0; } }
.dialogue { animation-name: monteD; }
@keyframes monteD { from { transform: translate(-50%, 20px); opacity: 0; } }
@keyframes secoue { 0%, 100% { transform: none; } 25% { transform: translateX(-6px) rotate(-1deg); } 75% { transform: translateX(6px) rotate(1deg); } }
@keyframes flotte { 50% { transform: translateY(-4px); } }
.chambre .createur { animation: flotte 3s ease-in-out infinite; transform-box: fill-box; }
body.photosensible *, body.photosensible *::before, body.photosensible *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.hero-perso { max-width: 240px; }
@media (max-width: 800px) { .hero-perso { max-width: 120px; margin: -6px auto 0; } .entree p { font-size: 16px; } }
