/* ==========================================================================
   Multiplia : styles. Univers cubique, lisible sur téléphone, tablette et PC.
   ========================================================================== */

:root {
  --sky1: #6ec0f2;
  --sky2: #d4f1ff;
  --ink: #1f2330;
  --ink-soft: #4b5163;
  --paper: #fdfaf2;
  --paper-2: #f1ead8;
  --line: #23262f;
  --grass: #5cb83c;
  --grass-d: #3f8f2a;
  --gold: #f2b632;
  --red: #e2574c;
  --blue: #3b82f6;
  --violet: #8e5bd6;
  --stone: #7d8594;
  --crystal: #33c4e6;
  --ok: #3fae5a;
  --ko: #e2574c;
  --radius: 6px;
  --shadow: 0 5px 0 rgba(20, 22, 30, 0.28);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --num: ui-rounded, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 100%) fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
img.vox { width: var(--w, auto); height: auto; }
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.15; }
p { margin: 0 0 0.7em; line-height: 1.45; }
a { color: #1d4ed8; }

/* Nuages cubiques */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky i {
  position: absolute; display: block; width: 120px; height: 28px; background: #fff; opacity: 0.85;
  box-shadow: 28px -20px 0 0 #fff, 56px 0 0 0 #fff, 84px -10px 0 #fff;
  animation: cloud 80s linear infinite;
}
.sky i:nth-child(1) { top: 8%; left: -20%; animation-duration: 90s; }
.sky i:nth-child(2) { top: 22%; left: -40%; animation-duration: 120s; animation-delay: -40s; transform: scale(0.7); }
.sky i:nth-child(3) { top: 55%; left: -30%; animation-duration: 100s; animation-delay: -70s; opacity: 0.6; }
.sky i:nth-child(4) { top: 75%; left: -25%; animation-duration: 140s; animation-delay: -20s; transform: scale(1.3); opacity: 0.5; }
.sky i:nth-child(5) { top: 38%; left: -50%; animation-duration: 110s; animation-delay: -90s; transform: scale(0.5); }
@keyframes cloud { to { left: 120%; } }
body.night { background: linear-gradient(180deg, #2a1640 0%, #6b3fa0 100%) fixed; }
body.night .sky i { opacity: 0.15; }

#app { position: relative; z-index: 1; }
.boot { display: grid; place-items: center; min-height: 100dvh; font-weight: 800; font-size: 1.3rem; color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); }
.noscript { padding: 20px; background: #fff; }

.screen {
  max-width: 1080px; margin: 0 auto;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  animation: fadein 0.25s ease-out;
}
.screen.narrow { max-width: 520px; }
.screen.center { display: flex; flex-direction: column; justify-content: center; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Titres ---------------- */
.logo {
  font-weight: 900; font-size: clamp(2.4rem, 9vw, 4.2rem); letter-spacing: 1px; text-align: center;
  color: #fff; text-shadow: 3px 3px 0 #2d6a1f, 6px 6px 0 rgba(0, 0, 0, 0.25); margin: 8px 0 0;
}
.logo small { display: block; font-size: 0.32em; letter-spacing: 0; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); margin-top: 4px; }
.title-pix { color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); font-weight: 900; }

/* ---------------- Panneaux ---------------- */
.panel {
  background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06), var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.panel.dark { background: rgba(30, 34, 46, 0.92); color: #f4f6fb; border-color: #0d0f14; }
.panel h2 { font-size: 1.25rem; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

/* ---------------- Boutons ---------------- */
.btn {
  --c: var(--grass);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c); color: #fff; border: 3px solid var(--line); border-radius: 5px;
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.25), inset 3px 3px 0 rgba(255, 255, 255, 0.35), 0 3px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  font-weight: 800; font-size: 1.05rem; padding: 0.7em 1.1em; min-height: 48px; cursor: pointer;
  user-select: none; touch-action: manipulation; text-decoration: none; line-height: 1.1;
  transition: transform 0.05s, filter 0.15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(2px); box-shadow: inset 3px 4px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(0, 0, 0, 0.25); }
.btn:focus-visible, .chip:focus-visible, .opt:focus-visible, .key:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
.btn[disabled] { filter: grayscale(0.85) brightness(0.95); cursor: not-allowed; opacity: 0.75; }
.btn.big { font-size: 1.25rem; padding: 0.8em 1.4em; min-height: 58px; }
.btn.block { display: flex; width: 100%; }
.btn.small { font-size: 0.9rem; padding: 0.45em 0.8em; min-height: 40px; }
.btn.blue { --c: var(--blue); }
.btn.gold { --c: var(--gold); }
.btn.red { --c: var(--red); }
.btn.violet { --c: var(--violet); }
.btn.stone { --c: var(--stone); }
.btn.ghost { --c: rgba(255, 255, 255, 0.85); color: var(--ink); text-shadow: none; }
.btn.icon { padding: 0.5em; min-width: 48px; font-size: 1.2rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.center-text { text-align: center; }
.hidden { display: none !important; }
.linkbtn { background: none; border: 0; color: #1d4ed8; text-decoration: underline; cursor: pointer; padding: 6px; font-weight: 600; }

/* ---------------- Formulaires ---------------- */
label.field { display: block; font-weight: 700; margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 5px; }
.input {
  width: 100%; padding: 12px 14px; border: 3px solid var(--line); border-radius: 5px; background: #fff;
  font-size: 1.05rem; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.08); min-height: 50px;
}
.input:focus { outline: 3px solid #ffd54a; outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin: 10px 0 14px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.error { background: #ffe4e1; border: 2px solid var(--red); color: #8a1f17; padding: 10px 12px; border-radius: 5px; font-weight: 600; margin-bottom: 12px; }
.note { background: #eef6ff; border: 2px solid #93c5fd; padding: 10px 12px; border-radius: 5px; margin-bottom: 12px; }

/* ---------------- Barre du haut ---------------- */
.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(253, 250, 242, 0.92); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; box-shadow: var(--shadow); margin-bottom: 14px; position: sticky; top: 8px; z-index: 5;
}
.topbar .who { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 0; font-weight: 800; font-size: 1.05rem; }
.topbar .who img { height: 46px; image-rendering: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: #fff; border: 2px solid var(--line); font-weight: 800; font-variant-numeric: tabular-nums;
}
.pill img { height: 22px; }

/* ---------------- Grilles et cartes ---------------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card {
  background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow); text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.1s;
}
.card:hover { transform: translateY(-2px); }
.card img { height: 120px; object-fit: contain; }
.card .name { font-weight: 800; font-size: 1.05rem; word-break: break-word; }
.card.add { border-style: dashed; background: rgba(255, 255, 255, 0.55); justify-content: center; min-height: 180px; font-weight: 800; }
.card.selected { outline: 4px solid var(--gold); }

/* ---------------- Accueil ---------------- */
.hero { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin: 10px 0 6px; }
.hero img { height: clamp(90px, 22vw, 170px); animation: bob 2.6s ease-in-out infinite; }
.hero img:nth-child(2) { animation-delay: -0.6s; height: clamp(110px, 28vw, 210px); }
.hero img:nth-child(3) { animation-delay: -1.2s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------------- Carte de l'archipel ---------------- */
.map { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.isle {
  position: relative; background: rgba(255, 255, 255, 0.55); border: 3px solid var(--line); border-radius: 10px;
  padding: 10px; text-align: center; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.12s;
}
.isle:hover { transform: translateY(-3px); }
.isle img { height: 140px; object-fit: contain; animation: float 5s ease-in-out infinite; }
.isle:nth-child(2n) img { animation-delay: -2s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.isle .iname { font-weight: 900; font-size: 1.05rem; }
.isle .itables { font-size: 0.9rem; color: var(--ink-soft); font-weight: 700; }
.isle.locked { cursor: not-allowed; filter: grayscale(1) brightness(0.9); opacity: 0.7; }
.isle.locked:hover { transform: none; }
.isle .lock { position: absolute; top: 8px; right: 10px; font-size: 1.4rem; }
.isle.current { outline: 4px solid var(--gold); }
.isle .here { position: absolute; left: 6px; top: 6px; height: 64px; animation: bob 2s ease-in-out infinite; }
.isle.lit { background: rgba(255, 255, 255, 0.8); }

.bar { height: 16px; background: #d6d1c4; border: 2px solid var(--line); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(180deg, #8be36c, #4caf50); transition: width 0.4s; }
.bar.gold > i { background: linear-gradient(180deg, #ffe082, #f2b632); }
.bar.red > i { background: linear-gradient(180deg, #ff8a80, #e2574c); }
.bar.violet > i { background: linear-gradient(180deg, #e1a6ff, #a453e0); }

.menu-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 14px 0; }

/* ---------------- Île ---------------- */
.island-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: center; }
.island-head img.isl { width: 100%; max-height: 260px; object-fit: contain; animation: float 5s ease-in-out infinite; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact {
  padding: 4px 8px; border-radius: 4px; border: 2px solid var(--line); font-weight: 800; font-size: 0.9rem;
  color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4); font-variant-numeric: tabular-nums;
}

/* ---------------- Jeu ---------------- */
.play { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.play-top { display: flex; align-items: center; gap: 8px; }
.play-top .bar { flex: 1; height: 20px; }
.timer {
  display: inline-flex; align-items: center; gap: 4px; min-width: 92px; justify-content: center;
  font-variant-numeric: tabular-nums; font-weight: 900; font-size: 1.1rem; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}
.timer.off { color: var(--ink-soft); font-weight: 700; font-size: 0.95rem; }
.timer.countdown { background: #fff3c4; }
.timer.countdown.low { background: #ffd2cc; animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }

.scene {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  min-height: 150px; padding: 8px 12px 4px; border: 3px solid var(--line); border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1)), var(--scene-bg, #8fd16a);
  box-shadow: var(--shadow); overflow: hidden;
}
.scene::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 12px, transparent 12px 24px), var(--ground, #5cb83c); border-top: 3px solid rgba(0, 0, 0, 0.25); z-index: 0; }
.scene img { position: relative; z-index: 1; height: clamp(96px, 20vh, 170px); }
.scene .pet { animation: bob 2.4s ease-in-out infinite; }
.scene .pet.jump { animation: jump 0.5s ease-out; }
.scene .pet.sad { animation: shake 0.4s; }
.scene .foe { margin-left: auto; transition: filter 0.2s; }
.scene .foe.hit { animation: hit 0.45s; }
.scene .foe.gone { animation: vanish 0.9s forwards; }
.bubble {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 2; background: #fff; border: 3px solid var(--line);
  border-radius: 8px; padding: 6px 12px; font-weight: 800; white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  animation: pop 0.25s ease-out;
}
.gain { position: absolute; z-index: 3; font-weight: 900; color: #0e7490; text-shadow: 1px 1px 0 #fff; animation: rise 1s forwards; left: 30%; bottom: 40%; }
.hp { position: absolute; top: 8px; right: 10px; width: min(48%, 260px); z-index: 2; }
.hp .label { font-weight: 800; font-size: 0.85rem; color: #fff; text-shadow: 1px 1px 0 #000; text-align: right; margin-bottom: 2px; }
@keyframes jump { 0% { transform: translateY(0); } 40% { transform: translateY(-26px) rotate(-4deg); } 100% { transform: translateY(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes hit { 0% { transform: translateX(0); filter: brightness(2.2); } 50% { transform: translateX(10px); } 100% { transform: translateX(0); filter: none; } }
@keyframes vanish { to { transform: scale(0.2) rotate(20deg); opacity: 0; filter: brightness(3); } }
@keyframes pop { from { transform: translateX(-50%) scale(0.6); } to { transform: translateX(-50%) scale(1); } }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }

.qcard {
  background: var(--paper); border: 3px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 14px 16px; text-align: center;
}
.qstory { font-size: clamp(1.05rem, 3.6vw, 1.3rem); font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.qtext { font-family: var(--num); font-weight: 900; font-size: clamp(2.6rem, 11vw, 4.4rem); line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.qtext .eq { color: var(--ink-soft); }
.answer {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; min-height: 1.15em; margin-left: 0.15em;
  padding: 0 0.2em; border-bottom: 6px solid var(--line); color: #1d4ed8;
}
.answer.empty::after { content: "?"; color: #b9b3a3; }
.answer.ok { color: var(--ok); border-color: var(--ok); }
.answer.ko { color: var(--ko); border-color: var(--ko); animation: shake 0.35s; }
.qhint { font-size: 0.95rem; color: var(--ink-soft); margin-top: 6px; font-weight: 600; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  min-height: clamp(54px, 8.5vh, 74px); font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 900; border: 3px solid var(--line); border-radius: 6px;
  background: #fff; box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.12), 0 3px 0 rgba(0, 0, 0, 0.2); cursor: pointer; touch-action: manipulation;
  font-variant-numeric: tabular-nums;
}
.key:active { transform: translateY(2px); box-shadow: inset 2px 3px 0 rgba(0, 0, 0, 0.15); }
.key.del { background: #ffe4e1; }
.key.go { background: var(--grass); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choices .key { font-size: clamp(1.8rem, 7vw, 2.4rem); min-height: 72px; }
.choices .key.right { background: #c8f2c0; }
.choices .key.wrong { background: #ffd2cc; }

.feedback {
  background: #fff7e0; border: 3px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: var(--shadow);
  animation: fadein 0.2s;
}
.feedback .big { font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 900; font-variant-numeric: tabular-nums; }
.feedback .tip { font-weight: 700; margin: 8px 0; line-height: 1.45; }

/* Quadrillage de cubes pour visualiser a × b */
.arr { display: inline-grid; gap: 3px; padding: 8px; background: rgba(0, 0, 0, 0.05); border-radius: 6px; margin: 6px auto; }
.arr i { width: clamp(12px, 3vw, 18px); aspect-ratio: 1; display: block; background: var(--c, #f2b632); border: 2px solid rgba(0, 0, 0, 0.35); border-radius: 2px; }
.arr i.alt { --c: #f7d57a; }
.arr-cap { font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }

@media (min-width: 900px) {
  .play { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .play-top { grid-column: 1 / -1; }
  .play .left { display: flex; flex-direction: column; gap: 12px; }
  .scene { min-height: 300px; }
  .scene img { height: clamp(130px, 26vh, 230px); }
  .qtext { font-size: clamp(2.4rem, 4.4vw, 3.8rem); white-space: nowrap; }
  .island-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}
@media (max-height: 700px) and (max-width: 899px) {
  .scene { min-height: 110px; }
  .scene img { height: 90px; }
  .qtext { font-size: 2.4rem; }
  .key { min-height: 48px; }
}

/* ---------------- Dialogues ---------------- */
.dlg { position: relative; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
.dlg .bg { position: fixed; inset: 0; display: grid; place-items: center; z-index: -1; }
.dlg .bg img { width: min(70vw, 520px); opacity: 0.95; animation: float 6s ease-in-out infinite; }
.dlg .skip { position: fixed; top: 12px; right: 12px; z-index: 3; }
.dlg .speaker { height: clamp(110px, 24vh, 220px); align-self: flex-start; margin-bottom: -6px; animation: bob 2.6s ease-in-out infinite; position: relative; z-index: 2; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.15)); }
.dlg .speaker.right { align-self: flex-end; }
.textbox { position: relative; z-index: 2; background: rgba(253, 250, 242, 0.97); border: 4px solid var(--line); border-radius: 8px; padding: 16px 18px 14px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3); cursor: pointer; min-height: 120px; }
.textbox .nm { position: absolute; top: -18px; left: 14px; background: var(--gold); color: #fff; border: 3px solid var(--line); border-radius: 5px; padding: 2px 10px; font-weight: 900; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
.textbox .tx { font-size: clamp(1.1rem, 3.8vw, 1.35rem); font-weight: 600; line-height: 1.45; }
.textbox .more { text-align: right; font-weight: 900; animation: pulse 0.6s infinite alternate; }
.tipcard { position: relative; z-index: 2; background: #fff; border: 3px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); text-align: center; animation: fadein 0.3s; }
.tipcard h3 { color: #b45309; font-size: 1.1rem; }
.tipcard .ln { font-family: var(--num); font-weight: 900; font-size: clamp(1.2rem, 4.4vw, 1.6rem); font-variant-numeric: tabular-nums; }

/* ---------------- Vestiaire ---------------- */
.wardrobe { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.wardrobe .preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wardrobe .preview img { height: clamp(170px, 32vh, 300px); animation: bob 2.6s ease-in-out infinite; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
@media (min-width: 700px) { .tabs { flex-wrap: wrap; overflow: visible; } }
.chip {
  flex: none; padding: 8px 12px; border: 2px solid var(--line); border-radius: 999px; background: #fff; font-weight: 800; cursor: pointer; white-space: nowrap; min-height: 42px;
}
.chip.on { background: var(--blue); color: #fff; }
.opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); margin-top: 8px; }
.opt {
  position: relative; border: 3px solid var(--line); border-radius: 6px; background: #fff; padding: 10px 6px; min-height: 56px; cursor: pointer;
  font-weight: 800; font-size: 0.92rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.opt.on { outline: 4px solid var(--gold); }
.opt.swatch { min-height: 56px; }
.opt.swatch i { display: block; width: 100%; height: 32px; border-radius: 3px; border: 2px solid rgba(0, 0, 0, 0.3); }
.opt .price { font-size: 0.8rem; color: #0e7490; font-weight: 900; }
.opt.locked { background: #eceae4; }
.opt.locked::after { content: "🔒"; position: absolute; top: 2px; right: 4px; font-size: 0.85rem; }
@media (min-width: 900px) {
  .wardrobe { grid-template-columns: 320px minmax(0, 1fr); }
  .wardrobe .preview { position: sticky; top: 80px; align-self: start; }
}

/* ---------------- Choix du Cubimal ---------------- */
.pets { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .pets { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pets .card img { height: 110px; }
.pets .type { font-size: 0.8rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; color: #fff; border: 2px solid var(--line); }

/* ---------------- Carte des cristaux ---------------- */
.gridwrap { overflow-x: auto; }
table.mgrid { border-collapse: separate; border-spacing: 3px; margin: 0 auto; }
table.mgrid th { font-weight: 900; font-size: clamp(0.8rem, 2.6vw, 1rem); width: clamp(28px, 8.5vw, 52px); height: clamp(28px, 8.5vw, 44px); }
table.mgrid th.op { color: var(--ink-soft); }
table.mgrid td {
  width: clamp(28px, 8.5vw, 52px); height: clamp(28px, 8.5vw, 44px); text-align: center; font-weight: 900; font-size: clamp(0.72rem, 2.6vw, 1rem);
  border: 2px solid rgba(0, 0, 0, 0.4); border-radius: 4px; color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-top: 10px; font-size: 0.88rem; font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(0, 0, 0, 0.4); border-radius: 3px; }

/* ---------------- Badges ---------------- */
.badges { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge { background: #fff; border: 3px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; }
.badge .ic { font-size: 2.2rem; }
.badge.off { opacity: 0.45; filter: grayscale(1); }
.badge b { display: block; }

/* ---------------- Résultats ---------------- */
.stars { font-size: 2.4rem; letter-spacing: 6px; }
.levelups { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------------- Fenêtres ---------------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 18, 28, 0.55); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fadein 0.15s; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; }
.modal.wide { width: min(900px, 100%); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 12px 0 16px; }
.pindots i { width: 20px; height: 20px; border: 3px solid var(--line); border-radius: 4px; background: #fff; }
.pindots i.on { background: var(--blue); }

#toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); }
.toast { background: #1f2330; color: #fff; border: 3px solid #000; border-radius: 6px; padding: 10px 14px; font-weight: 700; box-shadow: var(--shadow); animation: fadein 0.2s; }
.toast.ok { background: #2f7d40; }
.toast.ko { background: #a3322a; }

/* ---------------- Espace parent ---------------- */
body.parent { background: #f4f5f8; }
body.parent .sky { display: none; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 14px; }
.kpi { background: #fff; border: 2px solid #d5d9e2; border-radius: 8px; padding: 10px 12px; }
.kpi .v { font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: #fff; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid #e3e6ec; text-align: left; white-space: nowrap; }
table.data th { background: #eef0f5; font-weight: 800; position: sticky; top: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #f6f8ff; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; border: 1.5px solid currentColor; }
.tag.ok { color: #1f7a35; }
.tag.ko { color: #b3261e; }
.tag.hidden-t { color: #6b7280; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 12px; font-weight: 800; cursor: pointer; min-height: 42px; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button.on { background: var(--blue); color: #fff; }

/* Quand la hauteur d'une image est fixée par le contexte, la largeur suit. */
.hero img.vox, .isle img.vox, .card img.vox, .topbar .who img.vox, .pill img.vox, .scene img.vox,
.dlg .speaker, .wardrobe .preview img.vox, .isle .here, .island-head img.isl { width: auto; }
.island-head img.isl { max-width: 100%; }
img.vox.panel-pet { height: 84px; width: auto; }
img.vox.big-pet { height: clamp(150px, 30vh, 260px); width: auto; }
img.vox.mid-pet { height: clamp(100px, 18vh, 160px); width: auto; }

/* ---------------- Vue 3D rotative ---------------- */
.tt { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tt-canvas {
  display: block; border-radius: 12px; cursor: grab; touch-action: none;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.9), rgba(190, 228, 255, 0.55) 70%);
  border: 3px solid var(--line); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.06);
}
.tt-ctrl { display: flex; align-items: center; gap: 8px; }
.tt-hint { font-size: 0.85rem; font-weight: 800; color: var(--ink-soft); }
.tt-name { font-weight: 900; font-size: 1.2rem; }
.pet-pick { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 700px) { .pet-pick { grid-template-columns: auto minmax(0, 1fr); } }

/* Cabine d'essayage */
.trybar {
  width: 100%; background: #fff7e0; border: 3px solid var(--gold); border-radius: 8px; padding: 10px 12px;
  animation: fadein 0.2s; text-align: left;
}
.trybar .trytitle { margin-bottom: 8px; }
.opts.thumbs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.opt.thumb { padding: 6px 4px 8px; min-height: 120px; justify-content: flex-start; }
.thumb-slot { display: flex; align-items: flex-end; justify-content: center; height: 78px; width: 100%; }
.thumb-slot img.thumb-img { height: 74px; width: auto; }
.opt .olabel { line-height: 1.15; }
.opt .dot { display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.35); }
.opt.trying { outline: 4px dashed var(--gold); outline-offset: -2px; background: #fff7e0; }

/* Avancement des badges */
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.badge.off .bprog { filter: none; }
.bprog { width: 100%; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.bprog .bar { flex: 1; height: 10px; }
.badge.off:has(.bprog) { opacity: 0.75; }

/* ---------------- Le gardien éclate ---------------- */
.fx-canvas { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.scene .foe.dying { animation: dying 0.75s steps(12) forwards; }
@keyframes dying {
  0% { transform: translate(0, 0); filter: brightness(1); }
  20% { transform: translate(-6px, 2px) rotate(-2deg); filter: brightness(1.8) hue-rotate(40deg); }
  40% { transform: translate(5px, -3px) rotate(2deg); filter: brightness(2.4); }
  60% { transform: translate(-4px, 3px) scale(1.06); filter: brightness(3) saturate(0.4); }
  80% { transform: translate(6px, -2px) scale(1.1); filter: brightness(4) saturate(0); }
  100% { transform: scale(1.14); filter: brightness(6) saturate(0); }
}
.scene.quake { animation: quake 0.12s linear infinite; }
@keyframes quake { 0% { transform: translate(0, 0); } 25% { transform: translate(3px, -2px); } 50% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, 3px); } 100% { transform: translate(0, 0); } }

/* ---------------- Annonce du gardien ---------------- */
body.shake #app { animation: quake 0.1s linear 7; }
.boss-alert {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; text-align: center; color: #fff; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #6e1ea0, #12061e 70%);
  animation: ba-in 0.35s ease-out;
}
.ba-stage, .ba-text, .ba-actions { position: relative; z-index: 2; }
.ba-band { z-index: 3; }
.boss-alert.ba-out { animation: ba-out 0.25s ease-in forwards; }
@keyframes ba-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ba-out { to { opacity: 0; transform: scale(1.05); } }
.boss-alert::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 5px);
  animation: ba-flash 0.5s steps(2) 4;
}
@keyframes ba-flash { 0% { background-color: rgba(255, 40, 60, 0.35); } 100% { background-color: transparent; } }
.ba-band { position: absolute; top: 9%; left: 0; right: 0; background: #e2574c; border-top: 4px solid #000; border-bottom: 4px solid #000; transform: rotate(-3deg); overflow: hidden; white-space: nowrap; }
.ba-band span { display: inline-block; padding: 6px 0; font-weight: 900; letter-spacing: 3px; font-size: clamp(0.95rem, 3.5vw, 1.3rem); animation: ba-scroll 6s linear infinite; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4); }
@keyframes ba-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ba-stage { position: relative; display: grid; place-items: center; margin-top: 40px; }
.ba-glow { position: absolute; width: 140%; aspect-ratio: 1; border-radius: 50%; animation: pulse 0.6s ease-in-out infinite alternate; }
.ba-boss { position: relative; height: clamp(170px, 34vh, 300px); width: auto !important; animation: ba-rise 1.1s cubic-bezier(0.2, 1.6, 0.4, 1) both, ba-glitch 2.4s steps(1) 1.1s infinite; }
@keyframes ba-rise { 0% { transform: translateY(120%) scale(0.3); opacity: 0; } 60% { opacity: 1; } 100% { transform: translateY(0) scale(1); } }
@keyframes ba-glitch {
  0%, 86%, 100% { transform: none; filter: none; }
  88% { transform: translate(-8px, 0) skewX(10deg); filter: hue-rotate(90deg) brightness(1.4); }
  90% { transform: translate(6px, 0) skewX(-8deg); filter: drop-shadow(4px 0 0 #ff3df2) drop-shadow(-4px 0 0 #36f1ff); }
  92% { transform: translate(-3px, 2px); filter: none; }
}
.ba-text h2 { font-size: clamp(1.5rem, 6vw, 2.4rem); text-shadow: 3px 3px 0 #000; margin: 0 0 6px; animation: ba-pop 0.4s 0.9s both; }
.ba-text p { max-width: 520px; margin: 0 auto; font-weight: 600; animation: ba-pop 0.4s 1.2s both; }
@keyframes ba-pop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
.ba-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; opacity: 0; transform: translateY(10px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.ba-actions.show { opacity: 1; transform: none; pointer-events: auto; }
.ba-cubes { position: absolute; inset: 0; pointer-events: none; }
.ba-cubes i { position: absolute; bottom: -30px; aspect-ratio: 1; border: 2px solid rgba(0, 0, 0, 0.5); animation-name: ba-float; animation-timing-function: linear; animation-iteration-count: infinite; opacity: 0.8; }
@keyframes ba-float { from { transform: translateY(0) rotate(0); } to { transform: translateY(-110vh) rotate(360deg); } }
.btn.boss-ready { animation: ready 0.9s ease-in-out infinite alternate; }
@keyframes ready { from { box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.25), inset 3px 3px 0 rgba(255, 255, 255, 0.35), 0 0 0 0 rgba(226, 87, 76, 0.6); } to { box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.25), inset 3px 3px 0 rgba(255, 255, 255, 0.35), 0 0 0 10px rgba(226, 87, 76, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .sky i { display: none; }
}
