* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fe3ff; font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif; color: #1b2a38; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Écran titre */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: linear-gradient(#9fe3ff00, #9fe3ff66); }
.card { width: min(520px, 100%); background: rgba(255,255,255,.93); border-radius: 30px; padding: 18px 24px 22px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 0 rgba(27,42,56,.18); }
.rainbow { width: 56%; margin: 0 auto -8px; display: block; }
.rainbow path { fill: none; stroke-width: 12; stroke-linecap: round; }
.logo { margin: 0; text-align: center; line-height: 1; display: flex; flex-direction: column; gap: 6px; }
.logo span { font-size: clamp(30px, 7vw, 44px); font-weight: 700;
  background: linear-gradient(90deg, #ff4d4d, #ff9a3c, #ffd93d, #4cd964, #4aa8ff, #a66bff); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1px rgba(27,42,56,.25); }
.logo small { font-size: 20px; font-weight: 600; color: #56697a; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 17px; }
.field input { font: inherit; font-size: 20px; padding: 10px 14px; border-radius: 14px; border: 3px solid #b4d9cf; background: #f4fbf9; color: #1b2a38; }
.field input:focus { outline: none; border-color: #2c8fd6; }
.lab { font-weight: 600; font-size: 17px; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px #b4d9cf; padding: 0; }
.colors button.on { box-shadow: 0 0 0 4px #1b2a38; }
.mcolbox { display: flex; flex-direction: column; gap: 4px; }
.mirrorbody .mcolbox { margin-top: 12px; }
.eggnote { margin: 0; font-size: 13px; color: #5a6b78; text-align: center; }
/* « J'ai déjà un personnage » / « Nouveau joueur » */
.modes { display: flex; gap: 8px; }
.modes button { flex: 1; padding: 10px 8px; border: 3px solid #cfe3dc; border-radius: 14px; background: #fff; font: inherit; font-weight: 700; color: #2b3a46; cursor: pointer; }
.modes button.on { border-color: #4aa8ff; background: #e8f4ff; }
.backnote { margin: 0; font-size: 14px; color: #3d5566; text-align: center; }
#form.back .newonly, #form:not(.back) .backonly { display: none !important; }
.mascots button.locked { opacity: .55; filter: grayscale(.6); cursor: not-allowed; }
.mascots button.locked::after { content: '🥚'; position: absolute; left: 4px; top: 2px; font-size: 16px; }
.eggchip { position: absolute; top: 140px; left: 76px; border: 0; border-radius: 999px; padding: 4px 12px 4px 8px; font: inherit; font-size: 15px; font-weight: 700;
  background: rgba(255,255,255,.92); box-shadow: 0 3px 0 rgba(27,42,56,.2); display: flex; align-items: center; gap: 6px; }
.eggchip .bar { width: 70px; height: 9px; border-radius: 9px; background: #e3eef3; overflow: hidden; }
.eggchip .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #ff70c8); }
.eggchip.wobble { animation: wobble .5s; }
@keyframes wobble { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.hatchcard header { background: repeating-linear-gradient(90deg, #ffd23f 0 40px, #fff 40px 80px); }
.hatchbody { padding: 16px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.hatchpet { font-size: 96px; line-height: 1; }
.hatchpet.shake { animation: shake .25s 6; }
.hatchpet.pop { animation: pop .5s; }
@keyframes shake { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.hatchsay { margin: 0; font-size: 22px; font-weight: 700; }
.hatchbtns { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pets .it .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px #b4d9cf; }
body.phone.emotes-open .emotes { top: 136px !important; }
body.phone .faces { top: 190px !important; }
.lookbox { display: flex; flex-direction: column; gap: 10px; }
.bagbtn.mirrorbtn { top: 124px; }
.mirrorcard header { background: repeating-linear-gradient(90deg, #ff70c8 0 40px, #fff 40px 80px); }
.mirrorbody { padding: 10px 18px; overflow: auto; }
.mirrorbody #preview { width: 170px; height: 222px; }
.mirrorfoot { padding: 0 18px 16px; display: flex; justify-content: center; }
.mirrorfoot .play { padding: 10px 30px; font-size: 24px; }
.faces { position: absolute; bottom: 78px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 92vw;
  background: rgba(255,255,255,.9); border-radius: 22px; padding: 8px; box-shadow: 0 4px 0 rgba(27,42,56,.2); }
.faces button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff4c7; font-size: 28px; padding: 0; cursor: pointer; }
.faces button:active { transform: scale(.9); }
.emotes button.facebtn { background: #fff4c7; }
.genres { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.genres button { font: inherit; font-size: 20px; font-weight: 600; padding: 8px; border-radius: 18px; border: 3px solid #b4d9cf; background: #f4fbf9; cursor: pointer; }
.genres button .e { font-size: 30px; vertical-align: middle; margin-right: 6px; }
.genres button.on { border-color: #ff6b1a; background: #fff4c7; box-shadow: 0 4px 0 #ff6b1a; }
.perso { display: flex; gap: 12px; align-items: flex-start; }
#preview { width: 130px; height: 170px; flex: 0 0 auto; border-radius: 18px; background: linear-gradient(#bfefff, #e9fbff); }
.persochoices { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.lab2 { font-weight: 600; font-size: 14px; color: #5a6b78; margin-top: 2px; }
.colors.small { gap: 6px; }
.colors.small button { width: 30px; height: 30px; border-width: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button { font: inherit; font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 2px solid #b4d9cf; background: #fff; cursor: pointer; }
.chips button.on { border-color: #ff6b1a; background: #fff4c7; }
.mascots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 420px) { .mascots { grid-template-columns: repeat(3, 1fr); } }
.mascots button { position: relative; }
.mascots .by { position: absolute; top: 3px; right: 4px; display: flex; gap: 2px; }
.mascots .by i { font-style: normal; font-size: 10px; font-weight: 700; color: #fff; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; }
.mascots .by .m { background: #3a86ff; } .mascots .by .e2 { background: #ff70c8; }
.mascots button { background: #f4fbf9; border: 3px solid #b4d9cf; border-radius: 18px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; font-size: 15px; }
.mascots button .e { font-size: 32px; line-height: 1.1; }
.mascots button { font-size: 13px !important; padding: 8px 2px 6px !important; text-align: center; }
.mascots button.on { border-color: #ff6b1a; background: #fff4c7; box-shadow: 0 4px 0 #ff6b1a; }
.field .hint { font-weight: 500; font-size: 13px; color: #5a6b78; }
.lab small { display: block; font-weight: 500; font-size: 13px; color: #5a6b78; }
.code { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.codeslots { display: flex; gap: 10px; }
.codeslots span { width: 54px; height: 54px; border-radius: 14px; border: 3px dashed #b4d9cf; display: grid; place-items: center; font-size: 32px; background: #f4fbf9; }
.codeslots span.full { border-style: solid; border-color: #ff6b1a; background: #fff4c7; }
.codeslots button { border: 0; background: none; font-size: 26px; cursor: pointer; }
.codepad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; width: 100%; }
.codepad button { font-size: 24px; padding: 6px 0; border-radius: 12px; border: 2px solid #b4d9cf; background: #fff; cursor: pointer; }
.codepad button:active { transform: scale(.92); }
.titlemsg { margin: 0; padding: 8px 12px; border-radius: 12px; background: #ffe1e1; color: #a01e1e; font-weight: 600; text-align: center; }
@media (max-width: 420px) { .codepad { grid-template-columns: repeat(5, 1fr); } }
.play { margin-top: 6px; font-size: 28px; font-weight: 700; padding: 12px; border-radius: 999px; border: 0; color: #fff; background: #ff6b1a; box-shadow: 0 6px 0 #b8480b; }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8480b; }
.season { margin: 0; text-align: center; color: #56697a; font-weight: 600; }

/* Pendant la partie */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.score { position: absolute; top: 12px; left: 12px; display: flex; gap: 10px; }
.hearts { position: absolute; top: 72px; left: 76px; font-size: 22px; letter-spacing: 2px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.hearts.hurt { animation: hurt .4s; }
@keyframes hurt { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.score span { background: rgba(255,255,255,.9); border-radius: 999px; padding: 6px 16px; font-size: 22px; font-weight: 600; }
.minimap { position: absolute; top: 12px; right: 12px; width: 150px; height: 150px; border-radius: 22px; border: 4px solid rgba(255,255,255,.92); box-shadow: 0 4px 0 rgba(27,42,56,.2); cursor: pointer; background: #4aa8ff; }
.guide { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 8px 18px; font: inherit; font-size: 19px; font-weight: 700; color: #1b2a38;
  background: #ffe066; box-shadow: 0 4px 0 #d19a00; white-space: nowrap; cursor: pointer; }
.guide small { font-weight: 500; opacity: .7; margin-left: 6px; }
.mapcard header { background: repeating-linear-gradient(90deg, #4aa8ff 0 40px, #fff 40px 80px); }
.mapbody { display: flex; gap: 14px; padding: 12px 18px 18px; align-items: flex-start; overflow: auto; }
#bigcanvas { width: min(420px, 100%); aspect-ratio: 1; border-radius: 18px; cursor: crosshair; flex: 0 0 auto; }
.dests { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px; }
.dests button { font: inherit; font-size: 18px; font-weight: 600; text-align: left; padding: 10px 14px; border-radius: 16px; border: 3px solid #b4d9cf; background: #fff; cursor: pointer; }
.dests button:hover { border-color: #ff6b1a; background: #fff4c7; }
@media (max-width: 640px) { .mapbody { flex-direction: column; align-items: stretch; } #bigcanvas { width: 100%; } .dests { flex-direction: row; flex-wrap: wrap; } }
.online { position: absolute; top: 176px; right: 12px; background: rgba(255,255,255,.88); border-radius: 18px; padding: 8px 14px; font-size: 15px; max-width: 46vw; }
.online ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.online li { display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.zone { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-size: clamp(30px, 6vw, 52px); font-weight: 700; color: #fff;
  text-shadow: 0 3px 0 rgba(27,42,56,.5), 0 0 18px rgba(27,42,56,.35); opacity: 0; transition: opacity .5s; pointer-events: none !important; white-space: nowrap; }
.zone.show { opacity: 1; }
.toast { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); background: rgba(27,42,56,.85); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 19px; font-weight: 600; opacity: 0; transition: opacity .3s; pointer-events: none !important; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; }
.emotes { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.emotes button { width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 28px; box-shadow: 0 4px 0 rgba(27,42,56,.2); padding: 0; }
.emotes button:active { transform: translateY(3px); }
.help { position: absolute; bottom: 80px; left: 12px; font-size: 13px; color: #1b2a38; background: rgba(255,255,255,.75); border-radius: 12px; padding: 4px 10px; max-width: 44vw; }
.joy, .jumpbtn { display: none; }
@media (pointer: coarse) {
  .help, .helpbtn { display: none; }
  .joy { display: block; position: absolute; left: 22px; bottom: 90px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.35); border: 3px solid rgba(255,255,255,.8); touch-action: none; }
  .joy .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255,255,255,.95); }
  .jumpbtn { display: block; position: absolute; right: 26px; bottom: 100px; width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 40px; touch-action: none; }
}

/* Le sac et la boutique du marchand */
.bagbtn { position: absolute; top: 62px; left: 12px; width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 28px; box-shadow: 0 4px 0 rgba(27,42,56,.2); padding: 0; }
.shopbtn { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); font-size: 24px; font-weight: 700; padding: 12px 26px; border-radius: 999px; border: 0;
  color: #fff; background: #ff5a5f; box-shadow: 0 6px 0 #b83b40; animation: bounce 1s ease-in-out infinite; white-space: nowrap; }
@keyframes bounce { 50% { transform: translateX(-50%) translateY(-6px); } }
.shop { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(27,42,56,.35); }
.shopcard { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #fffaf0; border-radius: 28px; box-shadow: 0 12px 0 rgba(27,42,56,.25); overflow: hidden; }
.shopcard header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: repeating-linear-gradient(90deg, #ff5a5f 0 40px, #fff 40px 80px); }
.shopcard h2 { margin: 0; flex: 1; font-size: 26px; background: #fff; border-radius: 999px; padding: 4px 16px; justify-self: start; width: fit-content; }
.purse { background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 20px; font-weight: 600; white-space: nowrap; }
.close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #1b2a38; color: #fff; font-size: 20px; flex: 0 0 auto; }
.say { margin: 10px 18px 0; font-size: 18px; font-weight: 600; color: #56697a; min-height: 1.4em; }
.shoplist { overflow-y: auto; padding: 8px 18px 18px; }
.shoplist h3 { margin: 12px 0 8px; font-size: 19px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.it { background: #fff; border: 3px solid #f0e2c4; border-radius: 20px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.it.worn { border-color: #2ec4b6; background: #eafffb; }
.it .e { font-size: 44px; line-height: 1.1; }
.it .n { font-weight: 600; font-size: 16px; }
.it .i { font-size: 13px; color: #56697a; }
.it .price { font-weight: 700; font-size: 18px; }
.it button { width: 100%; margin-top: 4px; font-size: 17px; font-weight: 700; padding: 8px; border-radius: 999px; border: 0; color: #fff; background: #ff9f1c; box-shadow: 0 4px 0 #b86f0a; }
.it button.wear { background: #3a86ff; box-shadow: 0 4px 0 #1f5bb8; }
.it button.off { background: #8d8f99; box-shadow: 0 4px 0 #5d5f69; }
.it button:disabled { background: #d9d3c4; box-shadow: none; color: #7a7466; cursor: default; }
.it button:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.empty { font-size: 18px; color: #56697a; }
@media (max-width: 520px) { .shopcard h2 { font-size: 20px; } .items { grid-template-columns: repeat(2, 1fr); } }

/* Les rayons de la boutique */
.shoptabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px 0; }
.shoptabs button { border: 3px solid #f0e2c4; background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 17px; font-weight: 600; }
.shoptabs button.on { border-color: #ff9f1c; background: #fff4c7; box-shadow: 0 3px 0 #ff9f1c; }

/* La barre d'objets et la palette de blocs */
.tools { position: absolute; right: 12px; bottom: 14px; display: flex; flex-direction: column-reverse; gap: 6px; }
.tools button, .palette button { position: relative; width: 54px; height: 54px; border-radius: 16px; border: 3px solid transparent; background: rgba(255,255,255,.9); font-size: 28px; padding: 0; box-shadow: 0 4px 0 rgba(27,42,56,.2); }
.tools button.on, .palette button.on { border-color: #ff9f1c; background: #fff4c7; }
.tools small, .palette small { position: absolute; right: 2px; bottom: 0; font-size: 13px; font-weight: 700; background: #1b2a38; color: #fff; border-radius: 999px; padding: 0 5px; line-height: 1.4; }
.palette { position: absolute; right: 78px; bottom: 150px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: min(460px, 60vw); }
.palette .none { background: rgba(255,255,255,.9); border-radius: 14px; padding: 8px 12px; font-weight: 600; align-self: center; }
.shopbtn.claim { background: #2ec4b6; box-shadow: 0 6px 0 #1a8a80; }

/* La tarte à la crème en pleine figure */
.splat { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s;
  background: radial-gradient(circle at 30% 35%, #fffdf5 0 9%, transparent 9.5%), radial-gradient(circle at 62% 30%, #fffdf5 0 12%, transparent 12.5%),
    radial-gradient(circle at 48% 60%, #fffdf5 0 14%, transparent 14.5%), radial-gradient(circle at 75% 68%, #fffdf5 0 7%, transparent 7.5%),
    radial-gradient(circle at 22% 72%, #fffdf5 0 6%, transparent 6.5%); }
.splat.show { opacity: .92; transition: opacity .1s; }
@media (pointer: coarse) {
  .tools { bottom: 200px; right: 16px; }
  .palette { bottom: 76px; right: 50%; transform: translateX(50%); justify-content: center; max-width: 70vw; }
}

/* ----- Téléphone ----- */
.emotebtn, .fullbtn, .rotate { display: none; }
.fullbtn { position: absolute; top: 12px; right: 124px; width: 44px; height: 44px; border-radius: 14px; border: 0; background: rgba(255,255,255,.9); font-size: 24px; padding: 0; box-shadow: 0 4px 0 rgba(27,42,56,.2); }
body.phone .fullbtn:not([hidden]) { display: block; }
.rotate { position: fixed; inset: 0; z-index: 20; place-items: center; background: rgba(27,42,56,.75); padding: 24px; }
.rotatecard { background: #fffaf0; border-radius: 28px; padding: 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 320px; }
.rotatecard p { margin: 0; font-size: 20px; }
.phoneicon { font-size: 64px; animation: turn 2s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.rotateok { font: inherit; font-weight: 600; font-size: 16px; border: 0; background: none; color: #56697a; text-decoration: underline; }
@media (orientation: portrait) { body.phone.playing:not(.portrait-ok) .rotate { display: grid; } }

/* Téléphone : boutons plus compacts, émojis rangés derrière un bouton */
body.phone .help { display: none; }
body.phone .emotebtn { display: block; top: 186px; font-size: 26px; }
body.phone .emotes { display: none; }
body.phone.emotes-open .emotes { display: flex; bottom: auto; top: 104px; left: 76px; transform: none; flex-wrap: wrap; max-width: calc(100vw - 200px); gap: 6px; }
body.phone .emotes button { width: 46px; height: 46px; font-size: 24px; }
body.phone .faces { bottom: auto; top: 160px; left: 76px; transform: none; max-width: calc(100vw - 200px); }
body.phone .faces button { width: 44px; height: 44px; font-size: 24px; }
body.phone .minimap { width: 104px; height: 104px; border-radius: 16px; }
body.phone .online { top: 124px; font-size: 12px; padding: 5px 9px; }
body.phone .online { cursor: pointer; }
body.phone .online ul { display: none; max-height: 40vh; overflow: auto; }
body.phone .online.open ul { display: flex; }
body.phone .hearts { font-size: 18px; letter-spacing: 0; }
body.phone .guide { top: auto; bottom: 10px; font-size: 15px; padding: 6px 12px; }
body.phone .shopbtn { font-size: 18px; padding: 9px 18px; bottom: auto; top: 14px; }
body.phone .toast { max-width: 60vw; white-space: normal; text-align: center; font-size: 15px; padding: 8px 14px; }
body.phone .zone { font-size: 30px; }
body.phone .shop { padding: 6px; }
body.phone .shopcard header { padding: 8px 12px; }
body.phone .shopcard h2 { font-size: 19px; }
body.phone .say { font-size: 15px; margin: 6px 12px 0; }
@media (orientation: landscape) and (max-height: 520px) {
  body.phone .joy { left: 14px; bottom: 14px; width: 112px; height: 112px; }
  body.phone .jumpbtn { right: 14px; bottom: 16px; width: 72px; height: 72px; font-size: 34px; }
  body.phone .tools { right: 96px; bottom: 14px; flex-direction: row-reverse; }
  body.phone .tools button, body.phone .palette button { width: 48px; height: 48px; font-size: 24px; }
  body.phone .palette { right: 96px; bottom: 72px; transform: none; max-width: 60vw; }
  body.phone .toast { bottom: 130px; }
  body.phone .mapbody { flex-direction: row; }
  body.phone #bigcanvas { width: min(240px, 60vh); }
  body.phone .dests { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  body.phone .dests button { font-size: 14px; padding: 6px 8px; }
  body.phone .say { display: none; }
}

/* Petit écran (téléphone tenu en hauteur) : une carte plus petite pour laisser la place aux cœurs */
@media (max-width: 480px) {
  .minimap { width: 104px; height: 104px; border-radius: 16px; }
  .online { top: 124px; font-size: 13px; padding: 6px 10px; }
  .hearts { font-size: 18px; letter-spacing: 0; }
  .toast { bottom: 236px; max-width: 86vw; white-space: normal; text-align: center; }
}

/* Le miroir : choisir sa mascotte */
.mirrorpets h3 { margin: 12px 0 6px; font-size: 16px; }
.mpets { display: flex; flex-wrap: wrap; gap: 6px; }
.mpet { border: 2px solid #b4d9cf; background: #fff; border-radius: 12px; padding: 4px 10px; font: inherit; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.mpet .e { font-size: 22px; }
.mpet.on { border-color: #ff70c8; background: #ffe6f5; font-weight: 700; }

/* Le gorille géant : sa barre de vie */
.bossbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: min(340px, 42vw); background: rgba(40, 24, 48, .82); color: #fff;
  border-radius: 14px; padding: 6px 12px 8px; font-weight: 700; text-align: center; font-size: 15px; white-space: nowrap; box-shadow: 0 4px 0 rgba(27,42,56,.25); }
.bossbar .bar { height: 12px; border-radius: 8px; background: #4a3b55; overflow: hidden; margin-top: 4px; }
.bossbar .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a5f, #ffd23f); transition: width .25s; }

/* Monter sur sa mascotte, et l'âge des mascottes dans le sac */
.bagbtn.ridebtn { top: 186px; }
.bagbtn.ridebtn.on { background: #ffd23f; }
body.phone .bagbtn.ridebtn { top: 248px; }
.pets .grow { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; flex-wrap: wrap; }
.xpbar { width: 60px; height: 8px; border-radius: 8px; background: #e3eef3; overflow: hidden; display: inline-block; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #5cc96b); }
.xpn { color: #56697a; }

/* Le bouton « ? » qui montre ou cache les commandes */
.helpbtn { align-self: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font: 700 22px Fredoka, sans-serif; color: #1b2a38; box-shadow: 0 3px 0 rgba(27,42,56,.2); cursor: pointer; padding: 0; }
.helpbtn.on { background: #ffd23f; }
.help[hidden] { display: none; }
body.phone .helpbtn { display: none; }

/* Les onglets des îles, sur la grande carte */
.maptabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 8px; }
.maptabs button { font: inherit; font-size: 14px; font-weight: 700; padding: 5px 10px; border-radius: 999px; border: 3px solid #b4d9cf; background: #fff; cursor: pointer; }
.maptabs button.on { border-color: #4aa8ff; background: #e3f2ff; }
.dests .say { font-size: 15px; }
body.phone .maptabs button { font-size: 12px; padding: 3px 7px; }

/* Visiter une maison (grande carte) */
.dests .vh { margin: 8px 0 0; font-size: 16px; }

/* Les énigmes des trésors */
.quizcard { max-width: 620px; }
.quizcard header { background: repeating-linear-gradient(90deg, #a66bff 0 40px, #fff 40px 80px); }
.quizbody { padding: 12px 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.quizq { white-space: pre-line; font-size: clamp(20px, 3.4vw, 28px); font-weight: 700; line-height: 1.35; margin: 0; }
.quizchoices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; width: 100%; }
.quizchoices button.long { font-size: clamp(15px, 2.2vw, 20px); overflow-wrap: anywhere; hyphens: auto; }
.quizchoices button { font: inherit; font-size: clamp(20px, 3.4vw, 30px); font-weight: 700; min-height: 64px; border-radius: 18px; border: 4px solid #b4d9cf; background: #fff; cursor: pointer; padding: 6px; }
.quizchoices button small { display: block; font-size: 12px; color: #56697a; font-weight: 600; }
.quizchoices button:hover { border-color: #a66bff; background: #f3ecff; }
.quizchoices button.good { border-color: #22a565; background: #dff7e8; }
.quizchoices button.bad { border-color: #ff5a5f; background: #ffe3e4; }
.quizmsg { font-weight: 700; font-size: 20px; min-height: 1.4em; margin: 0; }
#age { font: inherit; font-size: 17px; padding: 8px 10px; border-radius: 12px; border: 3px solid #b4d9cf; background: #fff; }
@media (max-width: 560px) { .quizchoices { grid-template-columns: repeat(3, 1fr); } }

/* Parler aux copains */
.bagbtn.chatbtn { top: 248px; }
body.phone .bagbtn.chatbtn { top: 310px; }
.chatlog { position: absolute; left: 12px; bottom: 140px; display: flex; flex-direction: column; gap: 4px; max-width: min(420px, 60vw); pointer-events: none; }
.chatlog div { background: rgba(255,255,255,.9); border-radius: 12px; padding: 4px 10px; font-size: 15px; font-weight: 600; box-shadow: 0 2px 0 rgba(27,42,56,.15); transition: opacity 1s; }
.chatlog b { margin-right: 4px; }
.chatlog .old { opacity: 0; }
.chatbox { position: absolute; left: 76px; top: 62px; width: min(440px, calc(100vw - 100px)); background: #fffdf5; border-radius: 20px; box-shadow: 0 6px 0 rgba(27,42,56,.2); padding: 10px 12px 12px; z-index: 5; }
.chathead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chathead b { flex: 1; font-size: 17px; }
.chathead button { border: 0; background: #e3eef3; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; cursor: pointer; }
.chathead button.on { background: #ffd23f; }
.phrases { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 46vh; overflow: auto; }
.phrases button { font: inherit; font-size: 15px; font-weight: 600; text-align: left; padding: 7px 10px; border-radius: 12px; border: 2px solid #b4d9cf; background: #fff; cursor: pointer; }
.phrases button:hover { border-color: #4aa8ff; background: #e3f2ff; }
.chatform { display: flex; gap: 6px; margin-top: 8px; }
.chatform input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 8px 10px; border-radius: 12px; border: 3px solid #b4d9cf; }
.chatform button { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 0 14px; background: #ff6b1a; color: #fff; cursor: pointer; }

/* L'âge, dans la création du personnage */
.agefield { margin: 4px 0 8px; }
.agefield .hint { font-weight: 500; }
.mirrorbody .agefield { display: none; }   /* l'âge se choisit seulement à la création du joueur */

/* Les quêtes du royaume */
.questchip { position: absolute; top: 104px; left: 76px; max-width: min(360px, 52vw); border: 0; border-radius: 999px; padding: 5px 14px 5px 10px; font: inherit; font-size: 15px; font-weight: 700;
  background: rgba(255,248,220,.95); color: #1b2a38; box-shadow: 0 3px 0 rgba(27,42,56,.2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.questchip.done { background: #ffd23f; animation: wobble .6s 2; }
.questchip .n { color: #2276c9; margin-left: 4px; }
.shopbtn.talk { background: #a66bff; box-shadow: 0 6px 0 #6b3fbf; }
.questbox { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  background: #fffdf5; border: 4px solid #ffd23f; border-radius: 24px; box-shadow: 0 8px 0 rgba(27,42,56,.25); padding: 14px 16px 16px; z-index: 6; }
.qhead { display: flex; align-items: center; gap: 10px; }
.qwho { font-size: 44px; line-height: 1; }
.qhead b { flex: 1; font-size: 22px; }
.qhead button { border: 0; background: #e3eef3; border-radius: 50%; width: 36px; height: 36px; font-size: 16px; cursor: pointer; }
.qtalk { font-size: 18px; font-weight: 600; background: #fff; border: 2px solid #f1e2b0; border-radius: 16px; padding: 10px 12px; margin: 10px 0; position: relative; }
.qgoal { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.qgoal .line { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.qgoal .bar { height: 14px; border-radius: 10px; background: #e3eef3; overflow: hidden; }
.qgoal .bar i { display: block; height: 100%; background: linear-gradient(90deg, #5cc96b, #ffd23f); }
.qgoal .gift { color: #5a6b78; font-size: 15px; }
.qbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qbtns button { flex: 1 1 160px; font: inherit; font-size: 17px; font-weight: 700; border: 0; border-radius: 999px; padding: 10px 14px; cursor: pointer; background: #e3eef3; color: #1b2a38; }
.qbtns button.main { background: #ff6b1a; color: #fff; box-shadow: 0 4px 0 #c24c0c; }
.qrank { margin: 10px 0 0; font-size: 14px; color: #5a6b78; text-align: center; font-weight: 700; }
body.phone .questchip { font-size: 13px; top: 96px; }

/* La musique : on peut la couper (le bouton reste visible sur téléphone) */
.musicbtn { align-self: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 20px; box-shadow: 0 3px 0 rgba(27,42,56,.2); cursor: pointer; padding: 0; position: relative; }
.musicbtn.off { opacity: .55; }
.musicbtn.off::after { content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 3px; background: #ff5a5f; transform: rotate(-35deg); border-radius: 2px; }
body.phone .musicbtn { width: 34px; height: 34px; font-size: 16px; }

/* Les escaliers infinis */
.floorchip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(40, 30, 60, .85); color: #fff; border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.towerbox .qbtns button { flex: 1 1 120px; }
body.phone .floorchip { top: auto; bottom: 10px; font-size: 13px; }

/* Les personnages qui parlent */
.shopbtn.npcbtn { background: #2ec4b6; box-shadow: 0 6px 0 #1a8a80; }
/* Sous la mer : la réserve d'air */
.airchip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(20, 60, 100, .8); color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.airchip .bar { width: 160px; height: 12px; border-radius: 8px; background: rgba(255,255,255,.25); overflow: hidden; }
.airchip .bar i { display: block; height: 100%; background: linear-gradient(90deg, #7fe3ff, #ffffff); transition: width .3s; }
.airchip.low .bar i { background: #ff5a5f; }
body.phone .airchip { top: auto; bottom: 10px; }

/* Installer le jeu comme une application */
.installbtn { display: block; margin: 10px auto 0; font: inherit; font-weight: 700; font-size: 15px; border: 2px solid #4aa8ff; background: #e3f2ff; color: #1b2a38; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.installios { margin: 10px 0 0; font-size: 13px; color: #56697a; text-align: center; }

/* récolter le décor */
.shopbtn.harvbtn { background: #7a9a3a; box-shadow: 0 6px 0 #56701f; }
.shopbtn.balloonbtn { background: #ff70c8; box-shadow: 0 6px 0 #c94c98; }
.shopbtn.labbtn { background: #a66bff; box-shadow: 0 6px 0 #7446c4; }
.labings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.labings button { font: inherit; font-weight: 700; font-size: 13px; border: 3px solid #e3d6ff; background: #faf7ff; border-radius: 14px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.labings button .e { font-size: 26px; }
.labings button.on { border-color: #a66bff; background: #efe5ff; }
.labpick { font-size: 24px; align-self: center; margin-right: auto; }
@media (max-width: 520px) { .labings { grid-template-columns: repeat(2, 1fr); } }
.chatform .chatmic { background: #2ec4b6; padding: 0 12px; font-size: 20px; }
.chatform .chatmic.on { background: #ff5a5f; animation: micpulse 0.9s ease-in-out infinite; }
@keyframes micpulse { 50% { transform: scale(1.12); } }
.shopbtn.carbtn { background: #4aa8ff; box-shadow: 0 6px 0 #2a78c4; }
/* le bouton choisi à la manette dans une fenêtre */
.padfocus { outline: 4px solid #ff6b1a !important; outline-offset: 2px; }

/* Téléphone en paysage (écran bas) : la colonne de gauche toucherait la manette ronde.
   Les boutons sont un peu plus petits, et 💬 et 🐎 passent à droite, sous les joueurs, au-dessus du bouton de saut.
   (à la fin du fichier, pour passer devant les autres règles) */
@media (orientation: landscape) and (max-height: 520px) {
  body.phone .bagbtn { width: 46px; height: 46px; font-size: 24px; }
  body.phone .bagbtn.mirrorbtn { top: 112px; }
  body.phone .bagbtn.emotebtn { top: 162px; }
  body.phone .bagbtn.chatbtn { left: auto; right: 14px; top: 162px; }
  body.phone .bagbtn.ridebtn { left: auto; right: 64px; top: 162px; }
}

/* L'île des inventeurs : le chrono du parcours et la petite fenêtre (lâcher d'œuf, atelier) */
.chrono { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: rgba(27, 42, 56, .85); color: #ffd23f;
  font: 700 22px 'Fredoka', sans-serif; padding: 6px 16px; border-radius: 14px; pointer-events: none; }
.invbtns { flex-wrap: wrap; }
.invbtns button { flex: 1 1 45%; }
