/* 🐉 Mazlíček (mazlicek.js): scéna s obrázkem, ❓ dokud ho dítě nemá, vajíčko pod lampičkou, pelíšek a plyšáci */
.pet-scene { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 220px; margin: 4px 0 10px; padding: 14px; border-radius: 22px; background: radial-gradient(ellipse at 50% 85%, color-mix(in srgb, #9be27a 30%, var(--card)) 0 45%, transparent 70%); }
.pet-img { max-width: min(320px, 80%); max-height: 300px; animation: pop .5s ease; }
.pet-title { margin: 6px 0; text-align: center; font-size: 1.3rem; }
.pet-lead { margin: 8px 0; text-align: center; font-size: 1.05rem; }
.pet-when { margin: 6px 0; text-align: center; font: 800 1.1rem var(--font-head); }
.pet-note { text-align: center; }

/* ❓ ještě ho nemá: šedý otazník */
.pet-unknown { background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--muted) 18%, var(--card)) 0 40%, transparent 65%); }
.pet-question { width: 170px; height: 200px; display: grid; place-items: center; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; background: color-mix(in srgb, var(--muted) 25%, var(--card)); color: color-mix(in srgb, var(--muted) 80%, var(--card)); font: 800 6rem var(--font-head); filter: grayscale(1); }

/* 🥚 vajíčko pod lampičkou – světlo jemně dýchá, po půlce času se vajíčko klepe */
/* (lampa.webp a vejce-na-lampe.webp jsou stejně velké – vajíčko leží přesně přes lampičku) */
.pet-egg-img { position: relative; z-index: 1; width: min(300px, 85%); }
.pet-egg-img img { display: block; width: 100%; height: auto; }
.pet-egg-img .pet-egg-egg { position: absolute; inset: 0; transform-origin: 71% 98%; }
.pet-lamp-glow { position: absolute; left: 50%; bottom: 10%; width: 60%; height: 70%; transform: translateX(-30%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 214, 102, .55), transparent 65%); animation: pet-glow 3s ease-in-out infinite; }
.pet-egg.wobble .pet-egg-egg { animation: pet-wobble 1.6s ease-in-out infinite; }
/* před klepáním vajíčko pomalu „dýchá“ (celé se trochu zvětší a zmenší, spodek stojí na místě) */
.pet-egg:not(.wobble) .pet-egg-egg { animation: pet-egg-breathe 3s ease-in-out infinite; }
@keyframes pet-egg-breathe { 50% { transform: scale(1.05); } }
@keyframes pet-glow { 50% { opacity: .55; transform: translateX(-30%) scale(1.06); } }
@keyframes pet-wobble { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-2.5deg); } 80% { transform: rotate(2.5deg); } 90% { transform: rotate(-1.5deg); } }
.pet-fact { margin: 10px 0; padding: 12px 16px; border: 2px dashed #f6c445; border-radius: 16px; background: color-mix(in srgb, #fff4cf 70%, var(--card)); color: var(--text); }
.pet-fact-text { margin: 0 0 8px; }
.pet-fact-next { padding: 6px 14px; border-radius: 999px; font-size: .88rem; }
html.dark .pet-fact { background: #3d3214; }

/* 🐣 vylíhnutí a jméno */
.pet-hatch .pet-img { animation: pet-hatch .9s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pet-hatch { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.pet-name-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0; }
.pet-name-form input { min-width: 220px; }

/* 🌱 růst */
.pet-grow-fill { background: linear-gradient(90deg, #8fd36b, #3fa34d); }

/* 🛏️ pelíšek a 🧸 plyšáci */
.pet-bed { margin: 18px 0 8px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, #1f2a6b 14%, var(--card)), var(--card)); text-align: center; }
.pet-bed h3, .pet-shop-title { margin: 0 0 8px; font-size: 1.1rem; text-align: left; }
.pet-sleep { max-width: min(300px, 80%); max-height: 240px; }
.pet-plush-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pet-plush { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border: 3px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.pet-plush img { width: 72px; height: 72px; object-fit: contain; }
.pet-plush:not(.owned) img { filter: saturate(.55); opacity: .8; }
.pet-plush-name { font-weight: 800; font-size: .85rem; }
.pet-plush-tag { font-size: .78rem; color: var(--muted); }
.pet-plush.owned { border-color: #8fd36b; }
.pet-plush.in-bed { border-color: #3fa34d; background: color-mix(in srgb, #8fd36b 22%, var(--card)); }
.pet-plush:focus-visible { outline: 3px solid var(--primary); }

/* 😴 spící mazlíček (mazlicek.js petSleeper / petZzz): pomalu dýchá (zvedá se od spodku) a nad hlavou stoupají z z Z */
.pet-sleeper { position: relative; display: inline-block; max-width: 100%; animation: pet-breathe 3.6s ease-in-out infinite; transform-origin: 50% 100%; }
.pet-sleeper .pet-img, .pet-sleeper .pet-sleep { display: block; margin: 0 auto; }
.pet-scene .pet-sleeper { max-width: min(320px, 80%); }
.pet-scene .pet-sleeper .pet-img { max-width: 100%; }
.pet-bed .pet-sleeper { max-width: min(300px, 80%); }
.pet-bed .pet-sleeper .pet-sleep { max-width: 100%; }
@keyframes pet-breathe { 50% { transform: scale(1.015, 1.035); } }
.pet-zzz { position: absolute; right: 16%; top: 16%; font: 800 1.7rem var(--font-head); color: #5163e0; text-shadow: 0 0 4px #fff, 0 0 8px #fff; opacity: 0; pointer-events: none; animation: pet-zzz 3.6s ease-out infinite; }
.pet-zzz:nth-of-type(2) { animation-delay: 1.2s; font-size: 2.1rem; }
.pet-zzz:nth-of-type(3) { animation-delay: 2.4s; font-size: 2.6rem; }
@keyframes pet-zzz {
  0% { opacity: 0; transform: translate(0, 0) rotate(-10deg) scale(.6); }
  15%, 65% { opacity: 1; }
  100% { opacity: 0; transform: translate(34px, -60px) rotate(12deg) scale(1.15); }
}
html.dark .pet-zzz, .pet-night .pet-zzz { color: #dfe4ff; text-shadow: 0 0 6px #4b5aa8; }
/* malý mazlíček u Matyho: menší písmenka, dýchá celý obrázek */
.stage-pet .pet-zzz { right: 6%; top: 14%; font-size: 1rem; }
.stage-pet .pet-zzz:nth-of-type(2) { font-size: 1.2rem; }
.stage-pet .pet-zzz:nth-of-type(3) { font-size: 1.45rem; }
.stage-pet.sleeping img { animation: pet-breathe 3.6s ease-in-out infinite; transform-origin: 50% 100%; }

/* 🌙 noc: mazlíček spí – tmavší nebe s hvězdičkami */
.pet-scene.pet-night { background: radial-gradient(circle at 20% 25%, #fff8 0 2px, transparent 3px), radial-gradient(circle at 75% 18%, #fff8 0 2px, transparent 3px), radial-gradient(circle at 60% 40%, #fff6 0 1.5px, transparent 2.5px), linear-gradient(180deg, #24306b, #4b5aa8 70%, color-mix(in srgb, #4b5aa8 40%, var(--card))); }

/* 🏞️ pozadí za mazlíčkem (obrázek přes celou scénu; mazlíček stojí na volné ploše dole uprostřed) */
.pet-scene.pet-has-bg { min-height: clamp(240px, 42vw, 380px); background-size: cover; background-position: center 70%; overflow: hidden; }
.pet-scene.pet-has-bg .pet-img { filter: drop-shadow(0 10px 14px rgba(20, 30, 60, .35)); }
/* 🛏️ pelíšek: spící mazlíček na nočním pelíšku pod hvězdami (text pod ním v bílém) */
.pet-bed.pet-bed-night { background: var(--pet-bed-bg) center 75% / cover; color: #fff; }
.pet-bed.pet-bed-night h3, .pet-bed.pet-bed-night .muted { color: #fff; text-shadow: 0 1px 4px rgba(10, 15, 40, .8); }
.pet-bg-shop { margin: 18px 0 8px; }
.pet-bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pet-bg { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 6px 8px; border: 3px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.pet-bg-pic { width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; background: radial-gradient(ellipse at 50% 85%, color-mix(in srgb, #9be27a 45%, var(--card)) 0 45%, color-mix(in srgb, #9be27a 12%, var(--card)) 75%); background-size: cover; background-position: center; }
.pet-bg:not(.owned) .pet-bg-pic { filter: saturate(.6); opacity: .85; }
.pet-bg.owned { border-color: #8fd36b; }
.pet-bg.in-use { border-color: #3fa34d; background: color-mix(in srgb, #8fd36b 22%, var(--card)); }
.pet-bg:focus-visible { outline: 3px solid var(--primary); }

/* 🧪 náhled podob a denní doby (jen na testu) – vodorovné přepínače nad mazlíčkem */
.pet-test-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -4px 0 10px; }
.pet-test-label { font: 700 .85rem var(--font-head); color: var(--muted); }
.pet-test-switch { flex-direction: row; }

/* 🐉 mazlíček ve scéně u Matyho / Terezky (mazlicek.js renderStagePet) – na počítači vpravo dole u kruhu */
.stage-pet { position: absolute; z-index: 2; right: 0; bottom: -6px; width: clamp(92px, 9vw, 132px); height: clamp(92px, 9vw, 132px); padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stage-pet img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 10px rgba(40, 50, 110, .2)); transition: transform .2s ease; }
.stage-pet:hover img, .stage-pet:focus-visible img { transform: scale(1.08) rotate(-3deg); }
.stage-pet:focus-visible { outline: 3px solid var(--primary); border-radius: 16px; }
.stage-pet.pet-none img { filter: grayscale(1) opacity(.55); }
.stage-pet.pet-none::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; padding-top: 12%; font: 800 2.6rem var(--font-head); color: #1f2a4d; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
html.dark .stage-pet.pet-none::after { color: #fff; text-shadow: 0 0 4px #1f2a4d, 0 0 8px #1f2a4d; }
.stage-pet .stage-pet-egg { position: absolute; inset: 0; }
/* klepající se vajíčko by se při najetí myší rozjelo s lampičkou – lampička zůstane stát */
.stage-pet.pet-egg-small.wobble:hover img, .stage-pet.pet-egg-small.wobble:focus-visible img { transform: none; }
.stage-pet.pet-egg-small.wobble .stage-pet-egg { animation: pet-wobble 1.6s ease-in-out infinite; transform-origin: 71% 98%; }
.stage-pet:not(.sleeping):not(.pet-none):not(.pet-egg-small) img { animation: stage-pet-bob 3.2s ease-in-out infinite; }
@keyframes stage-pet-bob { 50% { transform: translateY(-4px); } }
/* tablet a telefon: v jednom řádku Maty / Terezka – bublina – mazlíček (bublina se zúží sama, scéna se neprodlouží,
   takže štítek „🏠 Vítej“ ukotvený ke spodku scény zůstane u kruhu s postavou) */
@media (max-width: 900px) {
  .stage-pet { position: relative; right: auto; bottom: auto; flex: none; align-self: flex-end; width: 76px; height: 76px; margin-left: -4px; }
}
@media (max-width: 640px) {
  .stage-pet { width: 60px; height: 60px; }
}

/* 💬 mazlíček se občas ozve (mazlicek.js petSay): malá bublina nad ním, ocásek dolů k němu */
.pet-say {
  position: absolute; z-index: 4; right: 2px; bottom: calc(100% + 6px); width: max-content; max-width: 170px;
  padding: 5px 10px; border: 2px solid #3fa34d; border-radius: 14px; background: var(--card); color: var(--text);
  font: 700 .85rem/1.2 var(--font-head); text-align: left; box-shadow: 0 4px 12px rgba(40, 50, 110, .15);
  animation: pet-say-in .3s ease-out;
}
.pet-say::after { content: ''; position: absolute; right: 22px; bottom: -8px; border-style: solid; border-width: 8px 7px 0 7px; border-color: #3fa34d transparent transparent; }
.pet-say.pet-say-action { cursor: pointer; border-color: var(--primary); }
.pet-say.pet-say-action::after { border-top-color: var(--primary); }
.pet-say.pet-say-out { opacity: 0; transform: translateY(-4px); transition: opacity .35s ease, transform .35s ease; }
@keyframes pet-say-in { from { opacity: 0; transform: translateY(6px) scale(.9); } }
@media (max-width: 640px) {
  .pet-say { max-width: 130px; font-size: .75rem; padding: 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-pet img, .pet-say { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .pet-lamp-glow, .pet-egg .pet-egg-egg, .pet-hatch .pet-img, .pet-img, .pet-sleeper { animation: none; }
  .pet-zzz { animation: none; opacity: .8; }
  .pet-zzz:nth-of-type(2) { transform: translate(14px, -22px); }
  .pet-zzz:nth-of-type(3) { transform: translate(28px, -44px); }
}
