/* ==========================================================================
   castle.css — solid premium top bar (both paths) + fairy-tale castle chrome
   (cream · lilac · gold · plum), living Smoczek, pantry kitchen, royal bathroom.
   Loaded after style.css + mascot.css.
   ========================================================================== */

/* —— Solid top bar (shared layout) —— */
.topbar.topbar--solid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  padding: .38rem .6rem .42rem;
  padding-top: max(.38rem, env(safe-area-inset-top, 0px));
  margin: 0 0 .3rem;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  border-radius: 0 0 18px 18px;
  font-weight: 800;
  background: #FFF6E6;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.topbar--solid .tb-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  padding: 0; border-radius: 14px;
  cursor: pointer; touch-action: manipulation;
  position: relative;
  transition: transform .12s ease, box-shadow .12s ease;
}
.topbar--solid .tb-btn:active { transform: translateY(2px); }
.topbar--solid .tb-btn svg { display: block; pointer-events: none; }
.tb-center {
  min-width: 0;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: .15rem .75rem;
}
.tb-pet {
  font-size: 1.08rem; line-height: 1.05;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.tb-right { display: flex; align-items: center; gap: .4rem; }
.tb-meters { display: flex; align-items: center; gap: .5rem; }
.tb-meter { display: flex; align-items: center; gap: .22rem; }
.tb-meter-ico { width: 24px; height: 24px; display: grid; place-items: center; flex-shrink: 0; }
.tb-meter-ico img, .tb-meter-ico svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.tb-meter-track {
  width: clamp(30px, 7vw, 70px); height: 10px;
  border-radius: 999px; overflow: hidden; position: relative;
}
.tb-meter-fill {
  display: block; height: 100%; border-radius: inherit;
  transition: width .45s ease;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45);
}
.tb-meter.ok .tb-meter-fill { background: linear-gradient(180deg, #9BDA6A, #6AAE3A); }
.tb-meter.mid .tb-meter-fill { background: linear-gradient(180deg, #FFD36A, #E9A52A); }
.tb-meter.low .tb-meter-fill { background: linear-gradient(180deg, #F58AA6, #D9476E); }
.tb-meter.low .tb-meter-ico { animation: tbMeterBeg 1.6s ease-in-out infinite; }
@keyframes tbMeterBeg { 0%,100% { transform: none; } 50% { transform: translateY(-2px) scale(1.08); } }

.tb-stars {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .12rem .62rem .12rem .16rem;
  border-radius: 999px;
  font-size: 1.05rem; font-weight: 800; line-height: 1;
  flex-shrink: 0;
}
.tb-coin { width: 28px; height: 28px; display: block; }
.tb-coin svg { width: 100%; height: 100%; display: block; }
.tb-stars-n { min-width: 1ch; text-align: center; }

/* parent gear — clearly a settings button, opens only after a 3 s hold */
.topbar--solid .tb-parent-hotspot {
  width: 40px; height: 40px; border-radius: 50%;
  opacity: 1; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.tb-parent-hotspot .hold-ring {
  position: absolute; inset: -4px;
  width: calc(100% + 8px); height: calc(100% + 8px);
  transform: rotate(-90deg);
  pointer-events: none; overflow: visible;
}
.tb-parent-hotspot .hold-ring circle {
  stroke-dasharray: 100; stroke-dashoffset: 100;
  opacity: 0;
}
.tb-parent-hotspot.holding .hold-ring circle {
  opacity: 1;
  animation: tbHold 3s linear forwards;
}
.tb-parent-hotspot.holding > svg:last-child { animation: tbGearSpin 3s linear forwards; }
@keyframes tbHold { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes tbGearSpin { to { transform: rotate(180deg); } }
.tb-parent-hotspot.nudge { animation: tbNudge .45s ease; }
@keyframes tbNudge { 0%,100% { transform: none; } 25% { transform: rotate(-14deg); } 60% { transform: rotate(10deg); } }
.tb-parent-spacer { width: 40px; height: 40px; display: block; }

/* —— castle top bar: cream + gold, plum text —— */
body.world-zamek .topbar--solid,
body.world-menu .topbar--solid {
  background: linear-gradient(180deg, #FFF9EC 0%, #F6E6CC 100%);
  border-bottom: 3px solid #C99A3C;
  box-shadow:
    0 3px 0 #8E6420,
    0 9px 18px rgba(74, 31, 92, .2),
    inset 0 1px 0 #fff,
    inset 0 -5px 0 -2px rgba(201, 154, 60, .28);
  color: #4A1F5C;
}
body.world-zamek .topbar--solid::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,154,60,.65) 12%, rgba(201,154,60,.65) 88%, transparent);
  pointer-events: none;
}
body.world-zamek .topbar--solid .tb-btn {
  background: linear-gradient(180deg, #9A5CCC 0%, #6B2E8A 60%, #521E6C 100%);
  border: 2px solid #E9C46A;
  box-shadow: 0 3px 0 #3A1248, 0 5px 10px rgba(58, 18, 72, .28), inset 0 1px 0 rgba(255,255,255,.35);
}
body.world-zamek .topbar--solid .tb-btn:active { box-shadow: 0 1px 0 #3A1248, inset 0 1px 0 rgba(255,255,255,.3); }
body.world-zamek .tb-pet { color: #4A1F5C; text-shadow: 0 1px 0 #fff; letter-spacing: .01em; }
body.world-zamek .tb-meter-track {
  background: linear-gradient(180deg, #E3D2B0, #EFE2C6);
  box-shadow: inset 0 1px 2px rgba(90, 50, 20, .35), 0 0 0 1.5px #C99A3C, 0 1px 0 1.5px #fff;
}
body.world-zamek .tb-meter-ico img { filter: drop-shadow(0 1px 1px rgba(90, 50, 20, .35)); }
body.world-zamek .tb-stars {
  background: linear-gradient(180deg, #FFF4D2 0%, #F7DC92 100%);
  box-shadow: inset 0 0 0 2px #C99A3C, inset 0 2px 0 2px rgba(255,255,255,.6), 0 2px 0 #8E6420;
  color: #4A1F5C;
}
body.world-zamek .tb-parent-hotspot .hold-ring circle { stroke: #F6CB52; filter: drop-shadow(0 0 2px #C99A3C); }

/* —— track top bar analog: white-blue + racing blue —— */
body.world-trasa .topbar--solid {
  background: linear-gradient(180deg, #F7FBFF 0%, #E4EFFF 100%);
  border-bottom: 3px solid #2A7AE8;
  box-shadow: 0 3px 0 #164E9E, 0 9px 18px rgba(20, 50, 110, .18), inset 0 1px 0 #fff;
  color: #16305C;
}
body.world-trasa .topbar--solid .tb-btn {
  background: linear-gradient(180deg, #5FB0FF 0%, #1E6FD4 100%);
  border: 2px solid #fff;
  box-shadow: 0 3px 0 #124A96, 0 5px 10px rgba(20, 60, 130, .25), inset 0 1px 0 rgba(255,255,255,.4);
}
body.world-trasa .tb-pet { color: #16305C; }
body.world-trasa .tb-meter-track {
  background: #D6E4F8;
  box-shadow: inset 0 1px 2px rgba(20, 40, 90, .3), 0 0 0 1.5px #2A7AE8;
}
body.world-trasa .tb-stars {
  background: #fff;
  box-shadow: inset 0 0 0 2px #2A7AE8, 0 2px 0 #164E9E;
  color: #16305C;
}
body.world-trasa .tb-parent-hotspot .hold-ring circle { stroke: #FFB020; }

@media (orientation: landscape) {
  .topbar.topbar--solid { padding: .28rem .55rem .32rem; margin-bottom: .2rem; }
  .topbar--solid .tb-btn { width: 40px; height: 40px; }
  .topbar--solid .tb-parent-hotspot { width: 36px; height: 36px; }
  .tb-parent-spacer { width: 36px; height: 36px; }
}
@media (max-width: 520px) {
  .topbar.topbar--solid { gap: .35rem; padding-left: .45rem; padding-right: .45rem; }
  .topbar--care .tb-center { flex-direction: column; gap: .12rem; }
  .topbar--care .tb-pet { font-size: .92rem; }
  .tb-meters { gap: .3rem; }
  .tb-meter-ico { width: 20px; height: 20px; }
  .tb-meter-track { width: clamp(22px, 6.5vw, 40px); height: 8px; }
  .tb-stars { font-size: .95rem; padding-right: .45rem; }
  .tb-coin { width: 24px; height: 24px; }
}
/* care meters now live in the top bar */
.hub-screen .care-meters, .kitchen-screen .care-meters, .bathroom-screen .care-meters { display: none !important; }

/* ==========================================================================
   Castle hub — carved parchment plaques with painted icons
   ========================================================================== */
body.world-zamek .hub-btn.castle-btn {
  position: relative;
  border: 3px solid #C99A3C;
  border-radius: 18px 18px 22px 22px;
  color: #4A1F5C;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
  background: linear-gradient(180deg, #FFFBF1 0%, #F3E2BF 100%);
  box-shadow:
    0 5px 0 #8E6420,
    0 10px 16px rgba(74, 31, 92, .24),
    inset 0 0 0 2px #FFF6DE,
    inset 0 -8px 12px rgba(201, 154, 60, .2);
  padding: .3rem .4rem .38rem;
  gap: .08rem;
}
body.world-zamek .hub-btn.castle-btn::before {
  /* gold studs on the plaque corners */
  content: ""; position: absolute; inset: 5px; pointer-events: none; border-radius: 13px;
  background:
    radial-gradient(circle at 0 0, #F6CB52 0 2.5px, transparent 3px) 0 0 / 100% 100% no-repeat,
    radial-gradient(circle at 100% 0, #F6CB52 0 2.5px, transparent 3px) 0 0 / 100% 100% no-repeat,
    radial-gradient(circle at 0 100%, #F6CB52 0 2.5px, transparent 3px) 0 0 / 100% 100% no-repeat,
    radial-gradient(circle at 100% 100%, #F6CB52 0 2.5px, transparent 3px) 0 0 / 100% 100% no-repeat;
}
body.world-zamek .hub-btn.castle-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #8E6420, 0 4px 8px rgba(74,31,92,.2), inset 0 0 0 2px #FFF6DE;
}
.castle-btn-art { width: 46px; height: 46px; display: block; position: relative; flex: 0 0 auto; }
.castle-btn-art img {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important;
  object-fit: contain; display: block;
  filter: drop-shadow(0 2px 1px rgba(90, 50, 20, .35));
  pointer-events: none;
}
.castle-btn-lab { font-size: .98rem; font-weight: 800; line-height: 1.05; }
body.world-zamek .castle-btn--rose { background: linear-gradient(180deg, #FFF7F3 0%, #F6D9D2 100%); }
body.world-zamek .castle-btn--gold { background: linear-gradient(180deg, #FFFCEB 0%, #F5DF9F 100%); }
body.world-zamek .castle-btn--sky { background: linear-gradient(180deg, #F7FCFF 0%, #D8E8F2 100%); }
body.world-zamek .castle-btn--lilac { background: linear-gradient(180deg, #FCF7FF 0%, #E5D5F3 100%); }
body.world-zamek .hub-btn.castle-btn--royal {
  background: linear-gradient(180deg, #A465D6 0%, #6B2E8A 58%, #521E6C 100%);
  border-color: #E9C46A;
  color: #FFF3D6;
  text-shadow: 0 2px 0 rgba(40, 10, 50, .45);
  box-shadow:
    0 5px 0 #3A1248,
    0 10px 18px rgba(58, 18, 72, .32),
    inset 0 0 0 2px rgba(255, 231, 160, .45),
    inset 0 2px 0 rgba(255,255,255,.3);
  flex-direction: row; gap: .35rem;
  padding: .3rem .8rem .34rem .5rem;
}
body.world-zamek .hub-btn.castle-btn--royal .castle-btn-lab { font-size: 1.12rem; }
body.world-zamek .hub-btn.castle-btn--royal .castle-btn-art { width: 40px; height: 40px; }

/* pet name — plum ribbon plaque with gold edge */
body.world-zamek .hub-pet-name,
body.world-zamek .kitchen-pet-zone .hub-pet-name,
body.world-zamek .bathroom-pet-zone .hub-pet-name {
  background: linear-gradient(180deg, #8E4FC0 0%, #5A2370 100%);
  border: 2px solid #E9C46A;
  border-radius: 10px;
  color: #FFF3D6;
  text-shadow: 0 1px 0 rgba(40,10,50,.5);
  box-shadow: 0 3px 0 #3A1248, 0 6px 10px rgba(58,18,72,.25), inset 0 1px 0 rgba(255,255,255,.3);
  padding: .08rem .9rem .12rem;
  letter-spacing: .02em;
  position: relative; z-index: 3;
}
/* hint pills — parchment */
body.world-zamek .hub-hint,
body.world-zamek .kitchen-hint,
body.world-zamek .bathroom-hint {
  background: linear-gradient(180deg, #FFF9EC, #F4E4C6);
  border: 2px solid #C99A3C;
  color: #4A1F5C;
  font-weight: 700;
  box-shadow: 0 2px 0 #8E6420, 0 6px 12px rgba(74,31,92,.15);
  border-radius: 12px;
  opacity: 1;
}

/* ==========================================================================
   Living Smoczek — layered sprite (wing · body · eyelids)
   ========================================================================== */
.pet-sprite {
  position: relative;
  display: inline-block;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: 50% 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 0;
  z-index: 2;
}
.pet-rig {
  position: relative; display: block;
  transform-origin: 50% 96%;
  animation: petBreathe 3.3s ease-in-out infinite;
  filter: drop-shadow(0 6px 6px rgba(60, 25, 70, .18));
}
.pet-sprite .pet-body {
  display: block; position: relative; z-index: 2;
  animation: none !important;
  filter: none !important;
  pointer-events: none;
  max-width: none;
}
.pet-wing {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
  transform-origin: 73% 46%;
  animation: petWing 2.8s ease-in-out infinite;
}
.pet-lid {
  position: absolute; z-index: 3; pointer-events: none;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(180deg, #A6DD4E 0%, #8BD03C 60%, #7CC633 100%);
  box-shadow: inset 0 -2px 0 #24501A;
  transform: scaleY(0); transform-origin: 50% 0;
  animation: petBlink 4.7s ease-in-out infinite;
}
.pet-lid--l { left: 21%; top: 29.3%; width: 12.2%; height: 13.9%; }
.pet-lid--r { left: 46.4%; top: 30.3%; width: 15.4%; height: 15.1%; animation-delay: .03s; }
@keyframes petBreathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(.992, 1.03); }
}
@keyframes petWing {
  0%, 62%, 100% { transform: rotate(0deg); }
  72% { transform: rotate(-7deg); }
  80% { transform: rotate(1deg); }
  88% { transform: rotate(-5deg); }
}
@keyframes petBlink {
  0%, 88%, 100% { transform: scaleY(0); }
  91%, 93.5% { transform: scaleY(1); }
  96% { transform: scaleY(0); }
}
.pet-sprite.is-hop { animation: petHop .7s cubic-bezier(.3,.8,.4,1); }
.pet-sprite.is-giggle { animation: petGiggle .7s ease; }
.pet-sprite.is-giggle .pet-lid { animation: petSquint .7s ease; }
.pet-sprite.is-munch { animation: petMunch .9s ease; }
.pet-sprite.is-munch .pet-lid { animation: petSquint .9s ease; }
.pet-sprite.is-wash-happy { animation: petHop .7s cubic-bezier(.3,.8,.4,1), petShine .9s ease; }
.pet-sprite.is-scrubbing { animation: petScrub .34s ease-in-out infinite; }
.pet-sprite.is-scrubbing .pet-lid { animation: none; transform: scaleY(.55); }
.pet-sprite.is-drop-target .pet-rig { filter: drop-shadow(0 0 8px rgba(255, 220, 110, .95)) drop-shadow(0 6px 6px rgba(60,25,70,.18)); }
.pet-sprite.is-drop-target { animation: petOpenWide .5s ease-in-out infinite alternate; }
@keyframes petHop {
  0% { transform: translateY(0) scale(1, 1); }
  18% { transform: translateY(0) scale(1.07, .9); }
  45% { transform: translateY(-9%) scale(.96, 1.05); }
  72% { transform: translateY(0) scale(1.05, .94); }
  86% { transform: translateY(0) scale(.98, 1.02); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes petGiggle {
  0% { transform: scale(1, 1); }
  14% { transform: translateY(0) scale(1.06, .92); }
  32% { transform: translateY(-6%) scale(.97, 1.04); }
  48% { transform: translateY(0) scale(1.05, .94); }
  64% { transform: translateY(-3%) scale(.98, 1.02); }
  80% { transform: translateY(0) scale(1.03, .97); }
  100% { transform: scale(1, 1); }
}
@keyframes petMunch {
  0%, 100% { transform: scale(1, 1); }
  12%, 42%, 72% { transform: scale(1.06, .93); }
  27%, 57%, 87% { transform: scale(.98, 1.03); }
}
@keyframes petScrub {
  0%, 100% { transform: scale(1.035, .965); }
  50% { transform: scale(.975, 1.03); }
}
@keyframes petOpenWide { from { transform: scale(1); } to { transform: scale(1.04, 1.02); } }
@keyframes petSquint { 0%, 100% { transform: scaleY(0); } 20%, 80% { transform: scaleY(.62); } }
@keyframes petShine { 0%, 100% { filter: none; } 40% { filter: brightness(1.14) saturate(1.1); } }

/* castle hub pet — no mascot.js wobble / tilt */
body.world-zamek .hub-pet { pointer-events: auto; }
body.world-zamek .hub-pet.mascot-live { animation: none !important; }

/* castle FX: painted hearts, gold sparkles, crumbs, soap bubbles — no emoji */
.castle-fx {
  position: absolute; z-index: 6; pointer-events: none;
  width: 24px; height: 24px; margin: -12px 0 0 -12px;
  line-height: 0;
  animation: castleFxRise 1.15s ease-out both;
}
.castle-fx svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(90,40,20,.3)); }
.castle-fx--star { animation-name: castleFxTwinkle; }
.castle-fx--crumb {
  width: 7px; height: 7px; margin: -3px 0 0 -3px; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,.18);
  animation: castleCrumb .8s cubic-bezier(.3,.6,.6,1) both;
}
.castle-fx--bubble {
  width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 16%, rgba(255,255,255,.4) 28%, rgba(200,232,255,.35) 62%, rgba(190,160,255,.55) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.95), 0 1px 2px rgba(80,60,140,.2);
  animation: castleBubble 1.1s ease-out both;
}
@keyframes castleFxRise {
  0% { opacity: 0; transform: translate(0, 10px) scale(calc(var(--s, 1) * .5)); }
  22% { opacity: 1; transform: translate(calc(var(--dx) * .3), 0) scale(calc(var(--s, 1) * 1.12)); }
  100% { opacity: 0; transform: translate(var(--dx), -64px) scale(calc(var(--s, 1) * .85)); }
}
@keyframes castleFxTwinkle {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  30% { opacity: 1; transform: scale(calc(var(--s, 1) * 1.2)) rotate(30deg); }
  100% { opacity: 0; transform: translate(var(--dx), -30px) scale(calc(var(--s, 1) * .4)) rotate(90deg); }
}
@keyframes castleCrumb {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), 46px) rotate(220deg); }
}
@keyframes castleBubble {
  0% { opacity: 0; transform: scale(calc(var(--s, 1) * .3)); }
  25% { opacity: 1; transform: scale(var(--s, 1)); }
  100% { opacity: 0; transform: translate(var(--dx), -54px) scale(calc(var(--s, 1) * 1.15)); }
}

/* ==========================================================================
   Castle back button — plain painted gold arrow, no shield/box (v14)
   ========================================================================== */
.castle-back {
  appearance: none; border: 0; background: none; padding: .35rem .55rem .2rem;
  min-width: 72px; min-height: 72px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0;
  cursor: pointer; font-family: var(--font);
  justify-self: center; align-self: end;
  margin: 0 auto .1rem;
  touch-action: manipulation;
  transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.castle-back:active { transform: translateY(3px) scale(.95); }
.castle-back-arrow {
  width: 60px; height: 48px; display: block; line-height: 0;
  filter: drop-shadow(0 2px 0 rgba(58, 18, 72, .45)) drop-shadow(0 6px 7px rgba(58, 18, 72, .28));
  transition: transform .18s cubic-bezier(.3,1.6,.5,1);
}
.castle-back-arrow svg { width: 100%; height: 100%; display: block; overflow: visible; }
.castle-back:hover .castle-back-arrow { transform: translateX(-3px); }
.castle-back-lab {
  font-size: .78rem; font-weight: 800; color: #4A1F5C; line-height: 1;
  letter-spacing: .03em;
  background: none; border: 0; box-shadow: none; padding: 0; margin-top: -1px;
  text-shadow: 0 0 2px #FFF8EA, 0 0 4px #FFF8EA, 0 1px 0 #FFF8EA, 0 0 7px rgba(255, 248, 234, .9);
}

/* ==========================================================================
   Kitchen — castle pantry (spiżarnia) with a swinging door
   ========================================================================== */
body.world-zamek .kitchen-stage {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) auto;
  align-items: end;
}
.pantry {
  --ph: min(56vh, 420px);
  position: relative;
  width: min(100%, calc(var(--ph) * .5085));
  aspect-ratio: 539 / 1060;
  justify-self: center; align-self: end;
  perspective: 1100px;
  margin-bottom: .2rem;
  z-index: 3;
}
.pantry-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none; user-select: none;
  filter: drop-shadow(0 8px 10px rgba(60, 25, 70, .28));
}
.pantry-inside { position: absolute; inset: 0; z-index: 2; }
.pantry-fruit {
  position: absolute; width: 28%; height: 16%;
  padding: 0; border: 0; background: none;
  cursor: grab; touch-action: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; pointer-events: none;
  transform: translateY(8%) scale(.7);
  transition: opacity .2s ease, transform .3s ease;
}
.pantry[data-open="true"] .pantry-fruit {
  opacity: 1; pointer-events: auto; transform: none;
  transition: opacity .3s ease calc(.32s + var(--d, 0s)), transform .45s cubic-bezier(.3,1.6,.5,1) calc(.32s + var(--d, 0s));
}
.pantry-fruit img {
  width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%;
  display: block; pointer-events: none; user-select: none;
  filter: drop-shadow(0 3px 2px rgba(60, 30, 20, .4));
  transform-origin: 50% 100%;
}
.pantry-fruit:active img { transform: scale(.94); }
.pantry-fruit.is-selected img {
  filter: drop-shadow(0 0 5px #FFE27A) drop-shadow(0 0 2px #C99A3C) drop-shadow(0 3px 2px rgba(60,30,20,.4));
  animation: fruitBob .9s ease-in-out infinite;
}
.pantry-fruit.is-lifted img { opacity: .3; }
@keyframes fruitBob { 0%,100% { transform: translateY(0) scale(1.04); } 50% { transform: translateY(-8%) scale(1.1); } }
.pantry-door {
  position: absolute; left: 14.3%; top: 11.9%; width: 71.7%; height: 80%;
  padding: 0; border: 0; background: none;
  z-index: 3; cursor: pointer;
  transform-origin: 0 50%;
  transform: rotateY(0deg);
  transition: transform .75s cubic-bezier(.36, 1.22, .45, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pantry-door img {
  width: 100%; height: 100%; display: block; object-fit: fill;
  pointer-events: none; user-select: none;
  filter: drop-shadow(2px 3px 3px rgba(60, 25, 40, .35));
}
.pantry[data-open="false"] .pantry-door { animation: doorInvite 3.2s ease-in-out 1s infinite; }
.pantry[data-open="true"] .pantry-door { transform: rotateY(-106deg); }
.pantry.no-anim .pantry-door, .pantry.no-anim .pantry-fruit { transition: none !important; }
@keyframes doorInvite {
  0%, 78%, 100% { transform: rotateY(0deg); }
  84% { transform: rotateY(-11deg); }
  90% { transform: rotateY(-2deg); }
  95% { transform: rotateY(-6deg); }
}
.pantry-tag {
  position: absolute; left: 50%; bottom: -3%;
  transform: translateX(-50%);
  z-index: 4; pointer-events: none; white-space: nowrap;
  font-size: .82rem; font-weight: 800; line-height: 1.1;
  color: #FFF3D6; text-shadow: 0 1px 0 rgba(40,10,50,.5);
  background: linear-gradient(180deg, #8E4FC0, #5A2370);
  border: 2px solid #E9C46A; border-radius: 8px;
  padding: .06rem .6rem .1rem;
  box-shadow: 0 2px 0 #3A1248, 0 4px 8px rgba(58,18,72,.25);
}
body.world-zamek .kitchen-pet-zone { position: relative; background: transparent !important; box-shadow: none !important; }
.castle-ghost,
.kitchen-drag-ghost.castle-ghost,
.bathroom-drag-ghost.castle-ghost {
  position: fixed; z-index: 9999;
  width: 78px; height: 78px; object-fit: contain;
  margin: 0; padding: 0;
  border: 0 !important; background: none !important; box-shadow: none !important; border-radius: 0 !important;
  transform: translate(-50%, -50%) scale(1.05);
  pointer-events: none; user-select: none;
  filter: drop-shadow(0 10px 8px rgba(60, 25, 70, .3));
  transition: transform .12s ease;
}
.castle-ghost.is-over { transform: translate(-50%, -50%) scale(1.2) rotate(-6deg); }
.castle-ghost.is-eaten {
  transition: left .28s ease-in, top .28s ease-in, transform .3s ease-in, opacity .3s ease-in;
  transform: translate(-50%, -50%) scale(.2);
  opacity: 0;
}
.castle-ghost--sponge { width: 86px; height: 70px; }
.castle-ghost--sponge.is-over { transform: translate(-50%, -50%) scale(1.12) rotate(-10deg); }
.castle-ghost--sponge.is-soapy { filter: drop-shadow(0 0 6px rgba(255,255,255,.95)) drop-shadow(0 8px 8px rgba(60,25,70,.3)); }

@media (orientation: landscape) {
  .pantry { --ph: min(70vh, 420px); }
  body.world-zamek .kitchen-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .8fr); align-items: end; }
}
@media (orientation: portrait) {
  .pantry { --ph: min(42vh, 380px); }
}
@media (orientation: landscape) and (max-height: 420px) {
  .pantry { --ph: min(74vh, 300px); }
  .pantry-tag { font-size: .72rem; }
}

/* ==========================================================================
   Bathroom — royal soap + sponge in a gilded dish, scrub only on Smoczek
   ========================================================================== */
body.world-zamek .bathroom-stage { grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr) minmax(0, .8fr); }
body.world-zamek .bathroom-tools { gap: .75rem; justify-content: center; align-self: center; }
body.world-zamek .castle-tool {
  background: none !important; border: 0 !important; box-shadow: none !important;
  padding: 0 !important; min-height: 0 !important; max-width: none !important; width: auto !important;
  display: flex; flex-direction: column; align-items: center; gap: .12rem;
  -webkit-tap-highlight-color: transparent;
}
.castle-tool-art { position: relative; width: 84px; height: 72px; display: grid; place-items: center; line-height: 0; }
.castle-tool-art img { display: block; pointer-events: none; user-select: none; }
.bathroom-soap .castle-tool-art img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 3px rgba(60, 30, 60, .3));
  transition: transform .18s ease, filter .18s ease;
}
.bathroom-soap.is-active .castle-tool-art img {
  filter: drop-shadow(0 0 7px rgba(255, 226, 122, .95)) drop-shadow(0 0 2px #C99A3C) drop-shadow(0 4px 3px rgba(60,30,60,.3));
  animation: fruitBob 1.1s ease-in-out infinite;
}
.castle-tool-art--dish { width: 104px; height: 82px; }
.castle-tool-art--dish .castle-dish {
  position: absolute; left: 0; bottom: 0; width: 100%; height: auto;
  filter: drop-shadow(0 4px 3px rgba(60, 30, 40, .3));
}
.castle-tool-art--dish .castle-sponge {
  position: absolute; left: 18%; bottom: 26%; width: 64%; height: auto;
  filter: drop-shadow(0 2px 2px rgba(80, 50, 10, .3));
  transition: opacity .15s ease, transform .2s ease;
}
.bathroom-sponge { cursor: grab; touch-action: none; }
.bathroom-sponge:hover .castle-sponge { transform: translateY(-3px) rotate(-3deg); }
.bathroom-sponge.is-lifted .castle-sponge { opacity: .25; }
.bathroom-sponge.is-soapy .castle-sponge { filter: drop-shadow(0 0 6px rgba(255,255,255,.95)) drop-shadow(0 0 3px rgba(190,160,255,.8)); }
.bathroom-sponge.is-soapy .castle-tool-art--dish::after {
  content: ""; position: absolute; left: 22%; right: 22%; top: 2%; height: 30%; pointer-events: none;
  background:
    radial-gradient(circle at 20% 70%, #fff 0 4px, transparent 5px),
    radial-gradient(circle at 45% 40%, #fff 0 6px, transparent 7px),
    radial-gradient(circle at 70% 65%, #fff 0 5px, transparent 6px),
    radial-gradient(circle at 88% 30%, rgba(255,255,255,.9) 0 3px, transparent 4px);
  filter: drop-shadow(0 0 1px rgba(150,130,220,.8));
}
.castle-tool-tag {
  font-size: .85rem; font-weight: 800; color: #4A1F5C; line-height: 1.1;
  background: linear-gradient(180deg, #FFF9EC, #F4E4C6);
  border: 2px solid #C99A3C; border-radius: 8px;
  padding: .04rem .55rem .08rem;
  box-shadow: 0 2px 0 #8E6420;
}
body.world-zamek .bathroom-pet-zone,
body.world-zamek .bathroom-pet-zone.is-scrubbing { background: transparent !important; box-shadow: none !important; }
.pet-lather { position: absolute; inset: 0; z-index: 5; pointer-events: none; line-height: 0; }
.lather-bubble {
  position: absolute;
  width: calc(15px * var(--s, 1)); height: calc(15px * var(--s, 1));
  margin: calc(-7.5px * var(--s, 1)) 0 0 calc(-7.5px * var(--s, 1));
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 18%, rgba(255,255,255,.75) 30%, rgba(225,240,255,.6) 62%, rgba(200,180,255,.7) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.95), 0 1px 2px rgba(80,60,140,.18);
  animation: latherIn .25s ease-out both;
}
.lather-bubble.is-pop { animation: latherPop .45s ease-in both; }
@keyframes latherIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes latherPop { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.35); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
body.world-zamek .bathroom-scrubbar {
  height: 12px;
  background: linear-gradient(180deg, #E3D2B0, #EFE2C6);
  border: 2px solid #C99A3C;
  box-shadow: inset 0 1px 2px rgba(90,50,20,.35), 0 2px 0 #8E6420;
}
body.world-zamek .bathroom-scrubbar-fill {
  background: linear-gradient(90deg, #CFA2F0, #F6CB52);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45);
}
@media (orientation: landscape) and (max-height: 420px) {
  .castle-tool-art { width: 70px; height: 58px; }
  .castle-tool-art--dish { width: 86px; height: 66px; }
  .castle-tool-tag, .castle-back-lab { font-size: .74rem; }
  .castle-back-arrow { width: 52px; height: 42px; }
  .castle-back { min-height: 62px; }
}

/* ==========================================================================
   Castle toast + parent gate
   ========================================================================== */
body.world-zamek #toast {
  background: linear-gradient(180deg, #FFF9EC 0%, #F3E0BC 100%);
  border: 3px solid #C99A3C;
  border-radius: 18px;
  color: #4A1F5C;
  font-size: 1.7rem; font-weight: 800;
  text-shadow: 0 1px 0 #fff;
  box-shadow: 0 0 0 3px #FFF6DE, 0 0 0 5px #8E6420, 0 16px 34px rgba(58, 18, 72, .32);
  padding: .6rem 1.2rem .65rem 3rem;
  position: fixed;
}
body.world-zamek #toast::before {
  content: ""; position: absolute; left: .7rem; top: 50%; width: 1.8rem; height: 1.8rem; margin-top: -.9rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='s' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23FFF2B8'/%3E%3Cstop offset='.55' stop-color='%23F2C24E'/%3E%3Cstop offset='1' stop-color='%23C98A1E'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M16 2.5l4.1 8.4 9.2 1.3-6.7 6.5 1.6 9.2L16 23.6l-8.2 4.3 1.6-9.2-6.7-6.5 9.2-1.3z' fill='url(%23s)' stroke='%238E6420' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.world-zamek .parent-gate-overlay { background: rgba(46, 16, 58, .62); }
body.world-zamek .parent-gate-card,
body.world-menu .parent-gate-card {
  background: linear-gradient(180deg, #FFFBF1 0%, #F4E4C6 100%);
  border: 3px solid #C99A3C;
  border-radius: 22px;
  box-shadow: inset 0 0 0 3px #FFF6DE, inset 0 0 0 5px rgba(201,154,60,.45), 0 5px 0 #8E6420, 0 22px 50px rgba(30, 10, 50, .4);
  padding-top: 2.1rem;
  position: relative; overflow: visible;
}
.pg-crest {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -55%);
  line-height: 0; filter: drop-shadow(0 3px 2px rgba(60,25,10,.35));
}
body.world-trasa .pg-crest {
  background: linear-gradient(180deg, #5FB0FF, #1E6FD4); border: 3px solid #fff; border-radius: 50%; padding: .45rem;
}
body.world-trasa .parent-gate-card { padding-top: 2.1rem; position: relative; overflow: visible; }
body.world-zamek .parent-gate-card h2 { color: #4A1F5C; }
body.world-zamek .parent-gate-card p { color: #7A5A44; }
body.world-zamek .parent-gate-card .q-main span { color: #5A2370; text-shadow: 0 1px 0 #fff; }
body.world-zamek .parent-gate-card .q-main .slot { color: #C98A1E; }
body.world-zamek .parent-gate-card input {
  border: 3px solid #C99A3C; background: #FFFDF6; color: #4A1F5C;
  box-shadow: inset 0 2px 3px rgba(90,50,20,.18);
}
body.world-zamek .parent-gate-card .btn.pg-ok {
  background: linear-gradient(180deg, #A465D6 0%, #6B2E8A 58%, #521E6C 100%);
  border: 2px solid #E9C46A; color: #FFF3D6;
  box-shadow: 0 4px 0 #3A1248, 0 8px 14px rgba(58,18,72,.3);
  text-shadow: 0 1px 0 rgba(40,10,50,.5);
}
body.world-zamek .parent-gate-card .btn.pg-cancel {
  background: linear-gradient(180deg, #FFF9EC, #F1DDB8);
  border: 2px solid #C99A3C; color: #4A1F5C;
  box-shadow: 0 4px 0 #8E6420;
  text-shadow: none;
}

/* hub: the solid top bar is taller than the old glass one — keep the stage on-screen */
@media (orientation: landscape) and (max-height: 420px) {
  .hub-stage { min-height: calc(100dvh - 76px) !important; max-height: calc(100dvh - 76px) !important; }
  body.world-zamek .castle-btn-art { width: 40px; height: 40px; }
  body.world-zamek .hub-btn.castle-btn--royal .castle-btn-art { width: 34px; height: 34px; }
}

/* back button: shield only, no box behind */
.castle-back, .castle-back.kitchen-back, .castle-back.bathroom-back {
  background: none !important; border: 0 !important; box-shadow: none !important;
  max-width: none; border-radius: 0;
}
