/* Le monde magique d'Orane — styles */
:root {
  --pink: #f472b6;
  --pink-soft: #fce7f3;
  --purple: #a78bfa;
  --purple-dark: #6d28d9;
  --blue: #60a5fa;
  --green: #4ade80;
  --yellow: #facc15;
  --orange: #fb923c;
  --ink: #4c1d95;
  --white: #ffffff;
  --radius: 28px;
  --shadow: 0 8px 0 rgba(76, 29, 149, 0.18), 0 14px 30px rgba(76, 29, 149, 0.15);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Quicksand", "Comic Sans MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #c7d2fe 0%, #fbcfe8 45%, #fde68a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 5px solid var(--purple-dark); outline-offset: 4px; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Ciel animé ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute; width: 160px; height: 52px; background: #fff; border-radius: 60px; opacity: .8;
  animation: drift 40s linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 70px; height: 70px; top: -34px; left: 26px; }
.cloud::after { width: 54px; height: 54px; top: -24px; left: 84px; }
.c1 { top: 14%; left: -180px; }
.c2 { top: 42%; left: -180px; animation-duration: 55s; animation-delay: -20s; transform: scale(.7); }
.c3 { top: 72%; left: -180px; animation-duration: 48s; animation-delay: -35s; transform: scale(.85); }
@keyframes drift { to { left: 110%; } }

.twinkle { position: absolute; color: #fff; font-size: 26px; animation: twinkle 2.6s ease-in-out infinite; text-shadow: 0 0 10px #fff; }
.t1 { top: 8%; left: 12%; } .t2 { top: 22%; left: 84%; animation-delay: .6s; }
.t3 { top: 58%; left: 6%; animation-delay: 1.2s; } .t4 { top: 80%; left: 90%; animation-delay: 1.8s; }
.t5 { top: 35%; left: 50%; animation-delay: .9s; }
@keyframes twinkle { 0%,100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.2); } }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(76, 29, 149, .12);
}
.title { flex: 1; margin: 0; font-size: clamp(20px, 4.5vw, 34px); line-height: 1.05; text-align: center; }
.title-name {
  background: linear-gradient(90deg, #ec4899, #a855f7, #3b82f6, #10b981, #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 52px; height: 52px; border: 0; border-radius: 50%; font-size: 26px;
  background: var(--white); box-shadow: 0 4px 0 rgba(76, 29, 149, .2);
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.stars {
  display: flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 30px;
  background: var(--yellow); font-size: 24px; font-weight: 800; box-shadow: 0 4px 0 #ca8a04;
}
.stars.pop { animation: pop .5s; }

/* ---------- Écrans ---------- */
main { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 16px 16px 60px; }
.screen { display: none; animation: appear .4s ease-out; }
.screen.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

h2 { text-align: center; font-size: clamp(26px, 6vw, 40px); margin: 8px 0 4px; }
.hint { text-align: center; font-size: 20px; margin: 4px 0 12px; opacity: .85; }
.question { text-align: center; font-size: clamp(24px, 5.5vw, 34px); font-weight: 800; margin: 12px 0; }

/* ---------- Accueil ---------- */
.mascot {
  display: flex; flex-direction: column; align-items: center; margin: 0 auto 8px;
  border: 0; background: none; position: relative;
}
.unicorn-small { width: min(280px, 70vw); height: auto; animation: bob 3s ease-in-out infinite; overflow: visible; }
.mascot:active .unicorn-small { animation: jump .6s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes jump { 30% { transform: translateY(-50px) rotate(-8deg); } 60% { transform: translateY(0); } }
.bubble {
  margin-top: 4px; padding: 10px 18px; background: #fff; border-radius: 22px; font-size: 20px; font-weight: 700;
  box-shadow: var(--shadow);
}

.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 14px; }
.card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 14px; border: 0; border-radius: var(--radius);
  font-size: 21px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.15);
  box-shadow: var(--shadow); transition: transform .15s;
}
.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(76, 29, 149, .2); }
.card-emoji { font-size: 56px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.12)); }
.card-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.card-purple { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.card-blue { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.card-green { background: linear-gradient(135deg, #34d399, #10b981); }
.card-yellow { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.card-orange { background: linear-gradient(135deg, #fb923c, #f97316); }

/* ---------- Boutons de réponse ---------- */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 16px 0; }
.choice {
  min-width: 96px; height: 96px; padding: 0 22px; border: 0; border-radius: 24px;
  font-size: 48px; font-weight: 900; background: #fff; box-shadow: var(--shadow);
  transition: transform .15s;
}
.choice:active { transform: scale(.94); }
.choice.good { background: var(--green); color: #fff; animation: pop .5s; }
.choice.bad { background: #fecaca; animation: wiggle .4s; }
@keyframes pop { 50% { transform: scale(1.25); } }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

.big-btn {
  padding: 14px 26px; border: 0; border-radius: 40px; font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, #f472b6, #a855f7); color: #fff; box-shadow: var(--shadow);
}
.big-btn:active { transform: translateY(4px); }
.btn-soft { background: #fff; color: var(--ink); }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 18px 0; }

/* ---------- Coloriage ---------- */
.color-layout { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 18px; }
.unicorn-big {
  width: min(520px, 100%); height: auto; background: rgba(255,255,255,.7); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px; touch-action: manipulation;
}
.unicorn-big .part { cursor: pointer; transition: fill .25s; }
.unicorn-big .part:hover { filter: brightness(.96); }
.palette {
  display: grid; grid-template-columns: repeat(4, 58px); gap: 12px; padding: 14px;
  background: rgba(255,255,255,.8); border-radius: var(--radius); box-shadow: var(--shadow);
}
.swatch { width: 58px; height: 58px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.swatch[aria-checked="true"] { outline: 5px solid var(--ink); outline-offset: 2px; transform: scale(1.08); }
.swatch-rainbow { background: conic-gradient(#ff6b8b, #ffb347, #ffe66d, #7ee081, #6ec6ff, #b388ff, #ff6b8b); }
.swatch-gold { background: radial-gradient(circle at 35% 30%, #fff3a0, #f5b700); }
.swatch-white { background: #fff; border-color: #e9d5ff; }

/* ---------- Compter ---------- */
.items {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; min-height: 120px;
  padding: 16px; background: rgba(255,255,255,.6); border-radius: var(--radius);
}
.item { font-size: 60px; border: 0; background: none; padding: 4px; animation: dropin .45s backwards; position: relative; }
.item.counted { opacity: .55; transform: scale(.9); }
.item .num {
  position: absolute; top: -4px; right: -4px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--purple-dark); color: #fff; font-size: 18px; font-weight: 800; line-height: 30px;
}
@keyframes dropin { from { opacity: 0; transform: translateY(-40px) scale(.5); } }

/* ---------- Lettres ---------- */
.word-card {
  position: relative; margin: 8px auto; max-width: 460px; padding: 18px; text-align: center;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
}
.word-emoji { font-size: 110px; line-height: 1.1; }
.word { font-size: clamp(34px, 9vw, 54px); font-weight: 900; letter-spacing: 4px; }
.word .missing { color: var(--pink); display: inline-block; min-width: 1ch; border-bottom: 5px dashed var(--pink); }
.listen { position: absolute; top: 12px; right: 12px; }
.letters-choices .choice { min-width: 110px; font-size: 56px; }

/* ---------- Potions ---------- */
.potion { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.cauldron {
  min-width: 120px; min-height: 120px; max-width: 220px; padding: 12px; display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center; gap: 4px; font-size: 34px;
  background: radial-gradient(circle at 50% 30%, #ede9fe, #c4b5fd); border-radius: 30px 30px 60px 60px;
  border: 5px solid #8b5cf6; box-shadow: var(--shadow);
}
.cauldron.result { font-size: 60px; font-weight: 900; color: var(--purple-dark); background: radial-gradient(circle, #fff, #fbcfe8); border-color: var(--pink); }
.op { font-size: 54px; font-weight: 900; }

/* ---------- Memory ---------- */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 560px; margin: 0 auto; perspective: 800px; }
@media (max-width: 480px) { .memory-grid { grid-template-columns: repeat(3, 1fr); } }
.mcard { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; position: relative; transform-style: preserve-3d; transition: transform .45s; }
.mcard.flipped, .mcard.found { transform: rotateY(180deg); }
.mcard .face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow);
}
.mcard .back { background: linear-gradient(135deg, #a78bfa, #f472b6); font-size: 40px; color: #fff; }
.mcard .front { background: #fff; transform: rotateY(180deg); font-size: clamp(40px, 10vw, 64px); }
.mcard.found .front { background: #dcfce7; }

/* ---------- Arc-en-ciel ---------- */
.rainbow-svg { display: block; width: min(560px, 100%); margin: 0 auto; }
.rainbow-svg path { transition: stroke .4s; }
.rainbow-choices .choice { width: 86px; min-width: 86px; height: 86px; border-radius: 50%; font-size: 0; }

/* ---------- Célébration ---------- */
.celebrate { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(76, 29, 149, .35); }
.celebrate[hidden] { display: none; }
.celebrate-box {
  text-align: center; padding: 26px 30px; background: #fff; border-radius: 36px; box-shadow: var(--shadow);
  max-width: 90vw; animation: pop .6s;
}
.celebrate-emoji { font-size: 96px; animation: bob 2s ease-in-out infinite; }
#celebrate-text { font-size: 30px; font-weight: 900; margin: 8px 0 18px; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Lecture syllabique ---------- */
.card-teal { background: linear-gradient(135deg, #2dd4bf, #0ea5e9); }
.card-wide { grid-column: 1 / -1; min-height: 120px; flex-direction: row; gap: 16px; font-size: 26px; }

.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0 16px; }
.tab {
  padding: 12px 18px; border: 0; border-radius: 30px; font-size: 19px; font-weight: 800;
  background: rgba(255,255,255,.7); box-shadow: 0 4px 0 rgba(76, 29, 149, .18);
}
.tab[aria-selected="true"] { background: linear-gradient(135deg, #2dd4bf, #0ea5e9); color: #fff; }
.panel[hidden] { display: none; }
.inline-btn { width: 46px; height: 46px; font-size: 22px; vertical-align: middle; margin-left: 6px; }

/* Lettres et syllabes : police ronde, minuscules, gros caractères */
.syl, .slot, .letter-btn, .balloon, .syl-tile, .target-syl {
  font-family: "Andika", "Comic Sans MS", var(--font);
  text-transform: none;
}
.target-syl {
  display: inline-block; padding: 2px 18px; border-radius: 18px; background: #fff;
  color: #0ea5e9; font-size: 1.3em; box-shadow: 0 4px 0 rgba(14, 165, 233, .3);
}

/* Le chaudron */
.forge { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 8px 0; }
.slot {
  width: 96px; height: 96px; display: flex; align-items: center; justify-content: center;
  font-size: 60px; font-weight: 800; border-radius: 24px; background: rgba(255,255,255,.75);
  border: 4px dashed #a78bfa; color: #dc2626;
}
.slot-v { color: #2563eb; }
.slot-result { width: 150px; border-style: solid; border-color: #2dd4bf; background: #fff; color: var(--ink); }
.slot-result.merge { animation: merge .7s; }
@keyframes merge { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.2) rotate(5deg); } 100% { transform: none; opacity: 1; } }
.letter-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 10px; }
.letter-btn {
  width: 78px; height: 78px; border: 0; border-radius: 50%; font-size: 46px; font-weight: 800;
  background: #fff; box-shadow: var(--shadow);
}
.letter-btn.consonant { color: #dc2626; }
.letter-btn.vowel { color: #2563eb; background: #e0f2fe; }
.letter-btn:active { transform: scale(.92); }

/* Les ballons */
.balloons { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; padding: 20px 0 40px; min-height: 260px; }
.balloon {
  position: relative; width: 120px; height: 145px; border: 0; border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%;
  font-size: 46px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.2);
  box-shadow: inset -10px -12px 0 rgba(0,0,0,.12), 0 10px 20px rgba(0,0,0,.12);
  animation: float 3s ease-in-out infinite;
}
.balloon::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 46px; background: #9ca3af;
}
.balloon:nth-child(2) { animation-delay: -.8s; } .balloon:nth-child(3) { animation-delay: -1.6s; } .balloon:nth-child(4) { animation-delay: -2.2s; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-16px) rotate(3deg); } }
.balloon.fly { animation: flyaway 1.2s ease-in forwards; }
@keyframes flyaway { to { transform: translateY(-120vh) rotate(15deg); opacity: .6; } }
.balloon.bad { animation: wiggle .4s; }

/* Mots découpés en syllabes (couleurs alternées comme au CP) */
.syl-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0; }
.syl {
  min-width: 88px; padding: 10px 16px; border: 0; border-radius: 20px; font-size: 52px; font-weight: 800;
  background: #fff; box-shadow: var(--shadow);
}
.syl.c0 { color: #dc2626; }
.syl.c1 { color: #2563eb; }
.syl.empty { color: transparent; border: 4px dashed #a78bfa; background: rgba(255,255,255,.5); box-shadow: none; }
.syl.speaking { transform: translateY(-6px); background: #fef9c3; }
.pic-choices .choice { width: 120px; height: 120px; font-size: 76px; padding: 0; }

/* Range les syllabes */
.order-pic { text-align: center; font-size: 120px; line-height: 1.1; }
.listen-center { display: block; margin: 0 auto; }
.syl-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.syl-tile {
  min-width: 96px; height: 84px; padding: 0 16px; border: 0; border-radius: 20px; font-size: 46px; font-weight: 800;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--ink); box-shadow: var(--shadow);
}
.syl-tile.used { visibility: hidden; }
.syl-tile.bad { animation: wiggle .4s; background: #fecaca; }

@media (prefers-reduced-motion: reduce) {
  .balloon, .balloon.fly { animation: none !important; }
}

/* ---------- Nouvelles cartes ---------- */
.card-rose { background: linear-gradient(135deg, #fb7185, #e11d48); }
.card-indigo { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.card-sky { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.card-lime { background: linear-gradient(135deg, #a3e635, #65a30d); }
.card-album { background: linear-gradient(135deg, #f472b6, #a855f7, #3b82f6); }

/* ---------- Relie les points ---------- */
.dots-svg {
  display: block; width: min(560px, 100%); height: auto; margin: 0 auto; touch-action: manipulation;
  background: rgba(255,255,255,.8); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dots-svg .dot { cursor: pointer; }
.dots-svg .dot circle { fill: #fff; stroke: var(--ink); stroke-width: .8; }
.dots-svg .dot .hit { fill: transparent; stroke: none; }
.dots-svg .dot text { font-size: 5.2px; font-weight: 800; fill: var(--ink); pointer-events: none; font-family: var(--font); }
.dots-svg .dot.next circle.pt { fill: #fde047; animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.dots-svg .dot.done circle.pt { fill: #a78bfa; }
.dots-svg .dot.bad circle.pt { fill: #fecaca; }
.dots-svg .trace { fill: none; stroke: #ec4899; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dots-svg .shape { stroke: none; opacity: 0; transition: opacity 1s; }
.dots-svg .shape.show { opacity: .85; }
.dots-svg .reveal { font-size: 26px; opacity: 0; transition: opacity 1s .5s; }
.dots-svg .reveal.show { opacity: 1; }
@keyframes pulse { 50% { transform: scale(1.5); } }

/* ---------- Suites ---------- */
.pattern-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 18px; margin: 8px 0;
  background: rgba(255,255,255,.7); border-radius: var(--radius); box-shadow: var(--shadow);
}
.pattern-cell {
  width: 76px; height: 76px; display: flex; align-items: center; justify-content: center;
  font-size: 50px; background: #fff; border-radius: 18px; box-shadow: 0 3px 0 rgba(76,29,149,.15);
}
.pattern-cell.hole { border: 4px dashed #818cf8; color: #818cf8; font-weight: 900; background: #eef2ff; }
.pattern-cell.filled { animation: pop .5s; background: #dcfce7; }

/* ---------- Sons cachés ---------- */
.sound-chip-wrap { text-align: center; font-size: 24px; font-weight: 800; margin: 6px 0 10px; }
.sound-chip {
  display: inline-block; margin-left: 6px; padding: 4px 20px; border-radius: 20px; font-size: 40px;
  background: #0284c7; color: #fff; box-shadow: 0 4px 0 #075985; font-family: "Andika", "Comic Sans MS", var(--font);
}
.sound-word { text-transform: none; font-family: "Andika", "Comic Sans MS", var(--font); letter-spacing: 2px; }
.sound-word .hl { color: #fff; background: #0284c7; border-radius: 10px; padding: 0 4px; }
.yesno .choice { font-size: 26px; height: 90px; padding: 0 24px; }

/* ---------- Boutique ---------- */
.shop-item { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 6px 0; }
.shop-emoji { font-size: 110px; animation: bob 3s ease-in-out infinite; }
.price-tag {
  position: relative; padding: 14px 24px 14px 34px; font-size: 44px; font-weight: 900; color: #fff;
  background: #e11d48; border-radius: 10px 22px 22px 10px; box-shadow: var(--shadow); transform: rotate(-6deg);
}
.price-tag::before { content: ""; position: absolute; left: 12px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; }
.tray {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 104px;
  padding: 12px; margin: 0 auto; max-width: 620px; border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #fef3c7, #fef3c7 12px, #fde68a 12px, #fde68a 24px);
  box-shadow: inset 0 4px 10px rgba(0,0,0,.1);
}
.purse { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 10px 0; }
.coin {
  width: 80px; height: 80px; border-radius: 50%; border: 0; font-size: 24px; font-weight: 900; color: #78350f;
  background: radial-gradient(circle at 35% 30%, #fef3c7, #f59e0b 70%); box-shadow: inset 0 0 0 6px rgba(180, 83, 9, .35), 0 5px 0 #b45309;
}
.coin.c2 { width: 90px; height: 90px; background: radial-gradient(circle at 35% 30%, #fff, #cbd5e1 45%, #f59e0b 46%, #fbbf24 70%); }
.coin.c1 { background: radial-gradient(circle at 35% 30%, #fef3c7, #fbbf24 40%, #cbd5e1 41%, #94a3b8 75%); color: #1e293b; }
.note {
  width: 130px; height: 74px; border: 0; border-radius: 10px; font-size: 28px; font-weight: 900; color: #3f3f46;
  background: linear-gradient(135deg, #d4d4d8, #a1a1aa); box-shadow: inset 0 0 0 5px rgba(255,255,255,.5), 0 5px 0 #71717a;
}
.tray .coin, .tray .note { transform: scale(.85); animation: dropin .3s; }
.purse button:active { transform: translateY(4px) scale(.96); }

/* ---------- Album ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.sticker {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 58px;
  background: #fff; border-radius: 22px; box-shadow: var(--shadow); border: 0;
}
.sticker.locked { background: rgba(255,255,255,.45); font-size: 40px; color: #a78bfa; box-shadow: none; border: 3px dashed #c4b5fd; }
.sticker:not(.locked) { animation: appear .4s; }
.sticker.fresh { animation: pop .8s 2; background: #fef9c3; }

/* ---------- Petite notification ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 25; transform: translateX(-50%);
  padding: 14px 22px; border-radius: 30px; font-size: 21px; font-weight: 800; background: #fff;
  box-shadow: var(--shadow); animation: appear .4s; max-width: 92vw; text-align: center;
}
.toast[hidden] { display: none; }

/* ---------- Ma licorne ---------- */
.card-ranch { background: linear-gradient(135deg, #f9a8d4, #c084fc 50%, #fbbf24); }

.adopt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.adopt-model {
  border: 4px solid transparent; border-radius: var(--radius); background: rgba(255,255,255,.8); padding: 8px;
  box-shadow: var(--shadow); font-size: 20px; font-weight: 800;
}
.adopt-model svg { width: 100%; height: auto; display: block; }
.adopt-model[aria-checked="true"] { border-color: var(--purple-dark); background: #fff; transform: scale(1.04); }
.name-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.name-btn {
  padding: 12px 20px; border: 0; border-radius: 30px; font-size: 22px; font-weight: 800; background: #fff;
  box-shadow: 0 4px 0 rgba(76, 29, 149, .2);
}
.name-btn[aria-checked="true"] { background: var(--pink); color: #fff; }

.pet-status { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 26px; margin: 4px 0 10px; font-size: 20px; font-weight: 800; }
.gauge { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: rgba(255,255,255,.8); border-radius: 30px; }
.gauge-icons { font-size: 24px; letter-spacing: 2px; }
.gauge-icons .off { filter: grayscale(1); opacity: .35; }

.scene {
  position: relative; height: clamp(300px, 62vw, 460px); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: background .6s;
}
.bg-prairie { background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 58%, #86efac 58%, #4ade80 100%); }
.bg-plage { background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 45%, #38bdf8 45%, #0ea5e9 60%, #fde68a 60%, #fcd34d 100%); }
.bg-espace { background: radial-gradient(circle at 20% 20%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 30%, #fff 0 1px, transparent 2px), radial-gradient(circle at 40% 60%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 85% 70%, #fff 0 1px, transparent 2px), linear-gradient(180deg, #1e1b4b, #4c1d95 70%, #a78bfa 70%, #7c3aed); }
.bg-neige { background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 58%, #ffffff 58%, #e2e8f0 100%); }
.bg-arc { background: radial-gradient(circle at 50% 110%, transparent 38%, #f87171 38% 42%, #fb923c 42% 46%, #facc15 46% 50%, #4ade80 50% 54%, #60a5fa 54% 58%, #a78bfa 58% 62%, transparent 62%), linear-gradient(180deg, #fce7f3 0%, #fbcfe8 62%, #f9a8d4 62%, #f472b6 100%); }
.bg-chateau { background: linear-gradient(180deg, #ddd6fe 0%, #f5f3ff 58%, #c4b5fd 58%, #a78bfa 100%); }

.scene-home, .scene-bowl, .scene-obj { position: absolute; line-height: 1; filter: drop-shadow(0 6px 4px rgba(0,0,0,.18)); }
.scene-home { left: 3%; bottom: 10%; font-size: clamp(64px, 16vw, 130px); }
.scene-bowl { right: 4%; bottom: 6%; font-size: clamp(40px, 9vw, 70px); }
.scene-obj { font-size: clamp(34px, 8vw, 64px); }

.pet-unicorn {
  position: absolute; left: 50%; bottom: 1%; width: min(60%, 400px); transform: translateX(-46%);
  border: 0; padding: 0; background: none; touch-action: manipulation;
}
.pet-unicorn svg { display: block; width: 100%; height: auto; overflow: visible; animation: bob 3.2s ease-in-out infinite; }
.pet-unicorn.sad svg { animation: none; filter: saturate(.6); }
.pet-unicorn.hug svg { animation: hug .6s; }
@keyframes hug { 40% { transform: scale(1.08) rotate(-4deg); } }
.acc { pointer-events: none; }

.scene-hearts span { position: absolute; font-size: 34px; animation: heartup 1.6s ease-out forwards; pointer-events: none; }
@keyframes heartup { from { opacity: 1; transform: translateY(0) scale(.6); } to { opacity: 0; transform: translateY(-160px) scale(1.4); } }
.flying-food { position: absolute; font-size: 54px; animation: eat 1s ease-in forwards; pointer-events: none; }
@keyframes eat { 0% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translate(-40px, -60px) scale(.2); opacity: 0; } }

.night {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 28px;
  background: rgba(30, 27, 75, .72); color: #fff; font-size: 54px; animation: appear .6s;
}
.night[hidden] { display: none; }
.zzz { font-size: 40px; font-weight: 900; animation: twinkle 1.6s ease-in-out infinite; align-self: center; }

.pet-hint { margin-top: 8px; }
.pet-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 10px 0; }
.pet-actions .big-btn[aria-disabled="true"] { filter: grayscale(.8); opacity: .65; }
.food-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 6px 0 12px; }
.food-row[hidden] { display: none; }
.food-btn { position: relative; width: 84px; height: 84px; border: 0; border-radius: 22px; font-size: 48px; background: #fff; box-shadow: var(--shadow); }
.food-btn .qty { position: absolute; right: -6px; top: -6px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; background: var(--pink); color: #fff; font-size: 18px; font-weight: 900; line-height: 30px; }

.shop-title { text-align: center; font-size: 28px; margin: 22px 0 4px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.shop-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; text-align: center;
  background: #fff; border-radius: 24px; box-shadow: var(--shadow); border: 0; font-size: 17px; font-weight: 800;
}
.shop-card .shop-card-emoji { font-size: 54px; line-height: 1.1; }
.shop-card .shop-card-price { padding: 4px 12px; border-radius: 20px; background: #fde047; font-size: 18px; }
.shop-card.owned .shop-card-price { background: #bbf7d0; }
.shop-card.worn { outline: 5px solid var(--pink); }
.shop-card.locked { opacity: .55; }
.shop-card.too-expensive .shop-card-price { background: #fecaca; }

/* ---------- Sélecteur de voix ---------- */
.voice-box { max-height: 90vh; overflow-y: auto; width: min(560px, 92vw); }
.voice-box h3 { font-size: 30px; margin: 0 0 6px; }
.voice-label { font-size: 20px; font-weight: 800; margin: 14px 0 8px; }
.voice-styles, .voice-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.voice-opt {
  padding: 12px 18px; border: 0; border-radius: 26px; font-size: 19px; font-weight: 800; background: #f5f3ff;
  box-shadow: 0 4px 0 rgba(76, 29, 149, .18);
}
.voice-opt[aria-checked="true"] { background: linear-gradient(135deg, #f472b6, #a855f7); color: #fff; }
.voice-help { font-size: 15px; opacity: .8; margin: 14px 0; }

/* ---------- Connexion ---------- */
body.auth-locked .topbar, body.auth-locked main { visibility: hidden; }
.auth {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto;
  background: linear-gradient(180deg, #c7d2fe 0%, #fbcfe8 50%, #fde68a 100%);
}
.auth[hidden] { display: none; }
.auth-box {
  width: min(620px, 100%); margin: auto 0; padding: 22px 20px 26px; text-align: center;
  background: rgba(255,255,255,.88); border-radius: 36px; box-shadow: var(--shadow);
}
.auth-logo { font-size: 70px; animation: bob 3s ease-in-out infinite; }
.auth-title { margin: 0 0 8px; }
.auth-view[hidden] { display: none; }
.field { display: block; text-align: left; font-weight: 800; font-size: 17px; margin: 12px auto; max-width: 420px; }
.field input {
  display: block; width: 100%; margin-top: 6px; padding: 14px 16px; font: inherit; font-size: 20px;
  border: 3px solid #ddd6fe; border-radius: 16px; background: #fff; color: var(--ink);
  user-select: text; -webkit-user-select: text;
}
.field input:focus { outline: none; border-color: var(--purple-dark); }
.field-title { font-weight: 800; margin: 14px 0 6px; }
.auth-error { min-height: 1.4em; color: #be123c; font-weight: 800; margin: 8px 0; }
.link-btn { margin-top: 14px; border: 0; background: none; font-size: 18px; font-weight: 800; color: var(--purple-dark); text-decoration: underline; }
.small-btn { display: block; width: min(420px, 100%); margin: 8px auto; padding: 12px; border: 0; border-radius: 18px; font-size: 17px; font-weight: 800; background: #f5f3ff; box-shadow: 0 3px 0 rgba(76,29,149,.15); }

.profile-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.profile-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 150px; padding: 16px 10px;
  border: 0; border-radius: 28px; background: #fff; box-shadow: var(--shadow); font-size: 22px; font-weight: 900;
}
.profile-btn .avatar { font-size: 72px; line-height: 1.1; }
.profile-btn:active { transform: translateY(4px); }

.code-who { font-size: 64px; }
.code-who span { display: block; font-size: 26px; font-weight: 900; }
.code-dots { display: flex; justify-content: center; gap: 12px; margin: 8px 0 14px; min-height: 64px; }
.code-dots span {
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; font-size: 40px;
  border-radius: 18px; border: 4px dashed #c4b5fd; background: #faf5ff;
}
.code-dots span.on { border-style: solid; border-color: var(--purple-dark); background: #fff; }
.code-dots.shake { animation: wiggle .4s 2; }
.code-grid { display: grid; grid-template-columns: repeat(3, 92px); justify-content: center; gap: 12px; }
.code-grid button { height: 92px; border: 0; border-radius: 24px; font-size: 54px; background: #fff; box-shadow: var(--shadow); }
.code-grid button:active { transform: scale(.92); }
.code-grid.small { grid-template-columns: repeat(3, 70px); }
.code-grid.small button { height: 70px; font-size: 40px; }

.parent-list { display: grid; gap: 12px; margin: 10px 0; text-align: left; }
.parent-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border-radius: 20px; box-shadow: 0 3px 0 rgba(76,29,149,.12); }
.parent-card .avatar { font-size: 44px; }
.parent-card .info { flex: 1; min-width: 150px; font-size: 16px; }
.parent-card .info strong { font-size: 20px; display: block; }
.parent-card .btns { display: flex; flex-wrap: wrap; gap: 6px; }
.parent-card .btns button { padding: 8px 12px; border: 0; border-radius: 14px; font-size: 15px; font-weight: 800; background: #f5f3ff; }
.parent-card .btns .danger { background: #ffe4e6; color: #be123c; }
.parent-tools { margin: 18px 0 10px; padding-top: 12px; border-top: 2px dashed #ddd6fe; }
.avatar-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.avatar-grid button { width: 60px; height: 60px; border: 3px solid transparent; border-radius: 18px; font-size: 36px; background: #fff; }
.avatar-grid button[aria-checked="true"] { border-color: var(--purple-dark); background: #f5f3ff; }
.code-mode { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-weight: 700; }
.code-mode label { display: flex; align-items: center; gap: 6px; }
.player-btn { font-size: 30px; }
