/* ===== Le compagnon de Noël (pingouin) ===== */
.pet { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 30; will-change: transform; }
.pet-body {
  --k: 1; --dir: 1;
  position: absolute; left: -34px; bottom: 0; width: 68px; height: 83px;
  transform: scale(var(--k)); transform-origin: 50% 100%;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .35));
}
.pet-body:active { cursor: grabbing; }
.pet-svg { width: 100%; height: 100%; display: block; overflow: visible; transform-origin: 50% 100%; animation: pet-breathe 2.6s ease-in-out infinite; }
.pet-svg * { transform-box: fill-box; }
.p-acc, .p-shut, .p-brow { display: none; }
.w-bonnet .p-bonnet, .w-echarpe .p-echarpe, .w-noeud .p-noeud, .w-etoile .p-etoile, .w-lunettes .p-lunettes { display: block; }
.p-eyes { transform-origin: center; animation: pet-blink 4.2s infinite; }
.p-wing { transform-origin: 50% 10%; }
.p-etoile { transform-origin: center; animation: pet-twinkle 1.6s ease-in-out infinite; }

.pet.walk .pet-svg { animation: pet-waddle .36s ease-in-out infinite alternate; }
.pet.walk .p-foot.l { animation: pet-step .36s ease-in-out infinite alternate; }
.pet.walk .p-foot.r { animation: pet-step .36s ease-in-out infinite alternate-reverse; }
.pet.air .p-wing.l { animation: pet-flap-l .16s linear infinite alternate; }
.pet.air .p-wing.r { animation: pet-flap-r .16s linear infinite alternate; }
.pet.eat .p-beak { transform-origin: 50% 0; animation: pet-munch .22s linear infinite alternate; }
.pet.eat .pet-svg { animation: pet-peck .44s ease-in-out infinite alternate; }
.pet.sad .p-brow { display: block; }
.pet.sad .pet-svg { animation-duration: 4s; }
.pet.sleep .p-eyes { display: none; }
.pet.sleep .p-shut { display: block; }
.pet.sleep .pet-svg { animation: pet-snore 3.4s ease-in-out infinite; }
.pet-body.hop { animation: pet-hop .5s ease-out; }

.pet-zzz, .pet-bang { position: absolute; left: 62%; top: -12px; font-size: 20px; display: none; pointer-events: none; }
.pet.sleep .pet-zzz { display: block; animation: pet-zzz 2.4s ease-in-out infinite; }
.pet.alert .pet-bang { display: block; left: 34%; top: -26px; font-size: 24px; animation: pet-bang .5s ease-in-out infinite alternate; }

@keyframes pet-breathe { 50% { transform: scaleY(1.035) scaleX(.985); } }
@keyframes pet-snore { 50% { transform: scaleY(.95) scaleX(1.04); } }
@keyframes pet-waddle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes pet-step { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes pet-flap-l { from { transform: rotate(10deg); } to { transform: rotate(75deg); } }
@keyframes pet-flap-r { from { transform: rotate(-10deg); } to { transform: rotate(-75deg); } }
@keyframes pet-munch { to { transform: scaleY(1.5); } }
@keyframes pet-peck { to { transform: rotate(9deg) translateY(2px); } }
@keyframes pet-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes pet-twinkle { 50% { transform: scale(1.18) rotate(8deg); } }
@keyframes pet-hop { 0% { transform: scale(var(--k)) translateY(0); } 35% { transform: scale(calc(var(--k) * .96), calc(var(--k) * 1.06)) translateY(-22px); } 70% { transform: scale(calc(var(--k) * 1.06), calc(var(--k) * .92)); } 100% { transform: scale(var(--k)); } }
@keyframes pet-zzz { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(14px, -26px) scale(1.1); opacity: 0; } }
@keyframes pet-bang { to { transform: translateY(-7px) scale(1.15); } }

/* bulle */
.pet-bubble {
  position: fixed; left: 0; top: 0; z-index: 31; max-width: 220px; padding: 8px 12px;
  background: var(--cream); color: var(--ink); border: 2px solid var(--gold); border-radius: 16px;
  font: 700 14px/1.3 var(--body); text-align: center; pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3); opacity: 0; transition: opacity .25s;
}
.pet-bubble.on { opacity: 1; }
.pet-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px;
  background: var(--cream); border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(45deg);
}

/* accessoires qui volent */
.pet-prop { position: fixed; left: 0; top: 0; z-index: 33; pointer-events: none; font-size: 26px; line-height: 1; }
.pet-ball { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #cfe2f5); box-shadow: 0 0 6px rgba(255, 255, 255, .8); z-index: 31; }
.pet-ball.big { width: 20px; height: 20px; }
.pet-flake { color: #fff; font-size: 22px; text-shadow: 0 0 6px #9cc8f5; }
.pet-heart { z-index: 31; font-size: 20px; animation: pet-heart .9s ease-out forwards; }
@keyframes pet-heart { from { transform: translateY(0) scale(.6); opacity: 1; } to { transform: translateY(-46px) scale(1.25); opacity: 0; } }

/* pastille + panneau de soins */
.pet-hud {
  position: fixed; right: 14px; bottom: 14px; z-index: 32; display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; border: 2px solid var(--gold); background: var(--cream); color: var(--ink);
  font: 800 14px var(--body); cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.pet-hud > span:first-child { font-size: 20px; }
.pet-hud.alert::after { content: "❗"; position: absolute; top: -10px; right: -4px; font-size: 18px; animation: pet-bang .5s ease-in-out infinite alternate; }
.pet-mini { display: grid; gap: 2px; width: 44px; }
.pet-mini i { display: block; height: 4px; border-radius: 3px; background: var(--green); transition: width .4s; }
.pet-mini i.low, .pet-bar i.low { background: var(--red); }

.pet-panel {
  position: fixed; right: 14px; bottom: 64px; z-index: 32; width: min(300px, calc(100vw - 28px));
  max-height: calc(100vh - 90px); overflow: auto;
  padding: 14px; border-radius: 18px; border: 2px solid var(--gold); background: var(--cream); color: var(--ink);
  font: 600 14px/1.35 var(--body); box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
.pet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pet-head b { font: 700 24px var(--title); color: var(--red); }
.pet-head span { font-size: 12px; color: #7a6652; }
.pet-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin: 5px 0; }
.pet-bar { height: 10px; border-radius: 6px; background: #ecdcc0; overflow: hidden; }
.pet-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); transition: width .4s; }
.pet-todo { margin: 10px 0; font-size: 13px; }
.pet-todo span { margin-right: 8px; white-space: nowrap; }
.pet-todo span.ok { color: var(--green); }
.pet-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.pet-panel .btn { font-size: 14px; padding: 8px 6px; }
.pet-panel .btn.wide { width: 100%; margin-bottom: 8px; }

/* paquet surprise posé dans la neige */
.pet-gift {
  position: fixed; left: 50%; bottom: 4px; z-index: 30; border: 0; background: none; padding: 0;
  font-size: 54px; line-height: 1; cursor: pointer; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .4));
  transform-origin: 50% 100%; animation: pet-drop .7s cubic-bezier(.3, 1.4, .5, 1) backwards, pet-wiggle 1.5s ease-in-out .7s infinite;
}
@keyframes pet-drop { from { transform: translateY(-80vh); } }
@keyframes pet-wiggle { 0%, 55%, 100% { transform: rotate(0); } 62% { transform: rotate(-12deg); } 70% { transform: rotate(11deg); } 78% { transform: rotate(-8deg); } 86% { transform: rotate(5deg); } }

/* fenêtres : adoption, aventure, carnet */
.pet-modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: safe center; padding: 14px; background: rgba(8, 23, 48, .72); overflow: auto; }
.pet-box {
  position: relative; width: min(440px, 100%); padding: 22px 22px 20px; border-radius: 22px; text-align: center;
  background: var(--cream); color: var(--ink); border: 3px solid var(--gold); box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  font: 600 15px/1.45 var(--body); animation: pet-pop .35s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes pet-pop { from { transform: scale(.8); opacity: 0; } }
.pet-box h3 { font: 700 30px/1.1 var(--title); color: var(--red); margin: 2px 0 10px; }
.pet-box h4 { font: 800 13px var(--body); text-transform: uppercase; letter-spacing: .08em; color: #9b7a52; margin: 16px 0 8px; }
.pet-box p { margin: 8px 0; }
.pet-kicker { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--green); margin: 0; }
.pet-small { font-size: 13px; color: #7a6652; }
.pet-gain { font-weight: 800; color: var(--green); background: #e6f3ea; border-radius: 12px; padding: 8px 10px; }
.pet-big { font-size: 54px; line-height: 1.1; }
.pet-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 18px; color: #9b7a52; cursor: pointer; padding: 6px; }
.pet-choices { display: grid; gap: 10px; margin-top: 14px; }
.pet-pack { --amp: 6deg; border: 0; background: none; font-size: 96px; line-height: 1.1; cursor: pointer; transform-origin: 50% 90%; animation: pet-wiggle 1.5s ease-in-out infinite; }
.pet-pack.shake { animation: pet-shake .45s ease-in-out; }
@keyframes pet-shake { 20% { transform: rotate(calc(var(--amp) * -1)) scale(1.08); } 45% { transform: rotate(var(--amp)) scale(1.12); } 70% { transform: rotate(calc(var(--amp) * -.6)); } }
.pet-baby { width: 120px; margin: 4px auto 0; animation: pet-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.pet-baby .pet-svg { height: auto; }
.pet-name { display: block; width: 200px; margin: 6px auto 14px; padding: 9px 12px; border-radius: 12px; border: 2px solid var(--gold); background: #fff; font: 800 18px var(--body); text-align: center; color: var(--ink); }
.pet-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pet-item { display: grid; gap: 2px; justify-items: center; padding: 8px 6px; border-radius: 12px; border: 2px solid #ecdcc0; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.pet-item span { font-size: 26px; }
.pet-item small { font-size: 11px; line-height: 1.2; color: #7a6652; }
.pet-item.on { border-color: var(--green); background: #e6f3ea; }
.pet-item:disabled { cursor: default; opacity: 1; }
.pet-log { list-style: none; padding: 0; margin: 0; text-align: left; font-size: 13px; }
.pet-log li { padding: 4px 0; border-bottom: 1px dashed #ecdcc0; }

@media (prefers-reduced-motion: reduce) {
  .pet-svg, .p-eyes, .p-etoile, .pet-gift, .pet-pack { animation: none !important; }
}

/* ===== Compagnon : évolution, quête, mini-jeu ===== */
.p-tuft, .p-smile, .p-nuit { display: none; }
.pet-body.st-0 .p-body { fill: #7f8a9c; }
.pet-body.st-0 .p-wing { fill: #6c7789; }
.pet-body.st-0 .p-tuft { display: block; }
.pet.happy .p-smile { display: block; }
.w-givre .p-givre { display: block; }
.pet.sleep .p-nuit { display: block; }
.pet.sleep .p-bonnet, .pet.sleep .p-etoile, .pet.sleep .p-givre { display: none; }
.pet-body.legend { filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .35)) drop-shadow(0 0 8px rgba(120, 255, 220, .8)); animation: pet-legend 3s ease-in-out infinite alternate; }
@keyframes pet-legend { to { filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .35)) drop-shadow(0 0 12px rgba(180, 130, 255, .85)); } }
.pet-trait { font-weight: 800; color: #8a5a00; background: #fff3d1; border-radius: 12px; padding: 6px 10px; }
.pet-traits .pet-row { grid-template-columns: 130px 1fr; }
.pet-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 8px; }
.pet-map span { display: grid; place-items: center; height: 44px; border-radius: 8px; background: #efe3cb; color: #b39b74; font: 800 20px var(--body); border: 2px dashed #d9c39c; }
.pet-map span.on { background: #f7e9c4; border: 2px solid #c9a35c; color: inherit; font-size: 24px; transform: rotate(-2deg); }
.pet-map span.on:nth-child(even) { transform: rotate(2deg); }
.pet-log li.pet-locked { color: #b39b74; }
.pet-drop { z-index: 33; font-size: 30px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)); }
.pet-score { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 34; padding: 8px 18px; border-radius: 999px; background: var(--cream); color: var(--ink); border: 3px solid var(--gold); font: 800 20px var(--body); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.pet-stormfx { position: fixed; inset: 0; z-index: 28; pointer-events: none; background: rgba(235, 244, 255, .35);
  background-image: radial-gradient(circle, #fff 1.6px, transparent 2px), radial-gradient(circle, #fff 1.1px, transparent 1.5px);
  background-size: 60px 60px, 37px 37px; animation: pet-storm .6s linear infinite, pet-fadeio 25s ease-in-out forwards; }
@keyframes pet-storm { to { background-position: -120px 60px, -74px 37px; } }
@keyframes pet-fadeio { 0% { opacity: 0; } 10%, 85% { opacity: 1; } 100% { opacity: 0; } }
.pet-aurora { position: fixed; left: -10%; right: -10%; top: 0; height: 65vh; z-index: 2; pointer-events: none; opacity: 0; filter: blur(28px);
  background: radial-gradient(ellipse 40% 60% at 25% 20%, rgba(80, 255, 170, .55), transparent 70%), radial-gradient(ellipse 35% 55% at 60% 15%, rgba(150, 100, 255, .5), transparent 70%), radial-gradient(ellipse 30% 50% at 85% 25%, rgba(60, 220, 255, .45), transparent 70%);
  animation: pet-aurora-in 4s ease-out forwards, pet-aurora-sway 9s ease-in-out infinite alternate; }
@keyframes pet-aurora-in { to { opacity: 1; } }
@keyframes pet-aurora-sway { from { transform: translateX(-3%) skewX(-4deg); } to { transform: translateX(3%) skewX(4deg); } }
