/* World hub + scenic backgrounds */

.sky {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  background:
    radial-gradient(ellipse 80% 50% at 70% 15%, rgba(255, 220, 140, 0.55), transparent 55%),
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(255, 255, 255, 0.35), transparent 50%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-bot) 72%, #d8efc0 100%);
  overflow: hidden;
}

.sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  filter: blur(0.5px);
  box-shadow:
    28px 8px 0 -4px rgba(255, 255, 255, 0.7),
    52px 4px 0 -8px rgba(255, 255, 255, 0.65),
    18px -10px 0 -6px rgba(255, 255, 255, 0.55);
  animation: drift linear infinite;
  opacity: 0.85;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(120vw); }
}

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  z-index: var(--z-world);
  background:
    radial-gradient(ellipse 50% 30% at 50% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
    linear-gradient(180deg, var(--grass) 0%, var(--grass-deep) 55%, #2f6b3a 100%);
  border-radius: 50% 50% 0 0 / 18% 18% 0 0;
  box-shadow: inset 0 12px 24px rgba(255, 255, 255, 0.18);
}

.ground::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.12) 0 2px, transparent 3px),
    radial-gradient(circle at 60% 50%, rgba(0, 0, 0, 0.06) 0 3px, transparent 4px),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0 2px, transparent 3px);
  background-size: 80px 40px, 100px 50px, 70px 35px;
  opacity: 0.7;
  border-radius: inherit;
}

.hill {
  position: absolute;
  bottom: 28%;
  width: 55%;
  height: 22%;
  border-radius: 50%;
  background: linear-gradient(180deg, #7dca6a, #4a9a48);
  z-index: calc(var(--z-world) - 1);
  filter: saturate(1.05);
}

.hill-left { left: -12%; }
.hill-right { right: -10%; bottom: 32%; width: 48%; background: linear-gradient(180deg, #8fd47a, #5aad55); }

.tree {
  position: absolute;
  bottom: 34%;
  z-index: var(--z-world);
  width: 48px;
  height: 72px;
}

.tree .trunk {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 10px;
  height: 28px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7a4a2a, #a86a3a 50%, #6a3a1a);
  border-radius: 3px;
}

.tree .canopy {
  position: absolute;
  bottom: 18px;
  left: 50%;
  width: 46px;
  height: 46px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 40% 35%, #9be87a, #3f9a3a 70%);
  border-radius: 50% 50% 45% 45%;
  box-shadow:
    -14px 8px 0 -6px #4aaa40,
    14px 10px 0 -8px #58b848,
    0 -8px 0 -4px #6ecf58;
}

/* —— Hub layout —— */
.hub-layout {
  position: relative;
  z-index: var(--z-ui);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-6);
  display: grid;
  gap: var(--s-5);
}

.hub-layout.hub-world-first {
  grid-template-columns: 1fr;
  align-content: start;
  min-height: calc(100dvh - var(--nav-h) - 100px);
  padding-top: var(--s-4);
}

/* Wooden trail sign — not frosted dashboard */
.hub-trail-sign {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  max-width: min(520px, 92vw);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #8a5a28, #5a3410);
  border: 2px solid rgba(255, 220, 140, 0.35);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #fff4d8;
}

.trail-sign-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.trail-stats {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.trail-stats > i {
  display: block;
  width: 42px;
  height: 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.trail-stats > i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 50%);
  border-radius: inherit;
}

.ts-h::after { background: linear-gradient(90deg, #f0a060, var(--coral)); }
.ts-j::after { background: linear-gradient(90deg, #7be0a0, var(--teal)); }
.ts-e::after { background: linear-gradient(90deg, #9ec8ff, #5b8def); }

/* Diegetic trail posts planted in the meadow — not 2×2 app launcher */
.trail-posts {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  max-width: 760px;
  margin-top: 12px;
  padding: 8px 4px 24px;
}

@media (min-width: 900px) {
  .trail-posts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 920px;
  }
}

.trail-post {
  position: relative;
  display: grid;
  gap: 0;
  justify-items: center;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring);
}

.trail-post:hover { transform: translateY(-4px); }

.trail-post .post-plate {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 14px;
  background-size: cover !important;
  background-position: center !important;
  border: 3px solid #5a3410;
  box-shadow:
    0 12px 24px rgba(26, 21, 32, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.trail-post .post-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(26, 21, 32, 0.55));
}

.trail-post .post-label {
  margin-top: -18px;
  position: relative;
  z-index: 2;
  padding: 6px 12px 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, #8a5a28, #5a3410);
  border: 2px solid rgba(255, 220, 140, 0.35);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  color: #fff4d8;
  text-align: center;
  min-width: 70%;
}

.trail-post .post-label strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.trail-post .post-label small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.88;
  font-weight: 600;
}

.trail-post::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 22px;
  background: linear-gradient(180deg, #6a3e14, #3a2008);
  border-radius: 2px;
  z-index: 0;
}

@media (min-width: 900px) {
  .hub-layout:not(.hub-world-first) {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: start;
    padding-top: var(--s-6);
  }
}

.hero-card {
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(232, 168, 56, 0.25), transparent 70%);
  pointer-events: none;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal-deep);
  background: rgba(42, 157, 143, 0.12);
  border: 1px solid rgba(42, 157, 143, 0.22);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  margin-bottom: var(--s-3);
}

.hero-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--s-3);
  text-wrap: balance;
}

.hero-card p {
  color: var(--ink-soft);
  max-width: 42ch;
  margin-bottom: var(--s-4);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.world-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}

.map-tile {
  position: relative;
  min-height: 110px;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-align: left;
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 28px var(--shadow);
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast);
}

.map-tile:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 36px var(--shadow-deep);
}

.map-tile:active {
  transform: scale(0.99);
}

.map-tile .tile-ico {
  font-size: 1.6rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.map-tile strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.map-tile small {
  opacity: 0.92;
  font-size: 0.72rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: block;
  margin-top: 2px;
}

.tile-den {
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25), transparent 40%),
    linear-gradient(145deg, #5b8def, #2f4f9a 60%, #1e3466);
}
.tile-hatch {
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 220, 140, 0.35), transparent 45%),
    linear-gradient(145deg, #f0a060, #d45a4a 55%, #8a2f3a);
}
.tile-bazaar {
  background:
    radial-gradient(circle at 70% 70%, rgba(255, 240, 180, 0.3), transparent 40%),
    linear-gradient(145deg, #3ecf9a, #1a8a6e 55%, #0f5244);
}
.tile-spark {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 45%),
    linear-gradient(145deg, #c07bff, #6b3fd4 55%, #3a1f80);
}

/* —— Stats strip —— */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.stat-chip {
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.stat-chip label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(26, 21, 32, 0.1);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  width: 0%;
  transition: width var(--t-slow) var(--ease-out);
}

.bar.hunger > i { background: linear-gradient(90deg, #f0a060, var(--coral)); }
.bar.happy > i { background: linear-gradient(90deg, #7be0a0, var(--teal)); }
.bar.energy > i { background: linear-gradient(90deg, #9ec8ff, #5b8def); }

/* —— Den —— */
.den-stage {
  position: relative;
  min-height: calc(100dvh - var(--nav-h) - 72px);
}

.den-ui {
  position: relative;
  z-index: var(--z-ui);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-4);
  display: grid;
  gap: var(--s-4);
  pointer-events: none;
}

.den-ui.den-ui-care-only {
  min-height: calc(100dvh - var(--nav-h) - 72px);
  align-content: end;
  justify-items: end;
}

.den-ui .care-dock {
  pointer-events: auto;
  max-width: min(340px, 100%);
}

@media (min-width: 900px) {
  .den-ui.den-ui-care-only {
    min-height: calc(100dvh - var(--nav-h) - 100px);
    padding-bottom: var(--s-6);
  }
}

/* Pet stage spans the painted room so we can seat on the rug (lower-left of den plate) */
.pet-stage {
  position: absolute;
  inset: 0;
  z-index: var(--z-pet);
  pointer-events: none;
  min-height: 0;
}

/*
 * Composite onto painted rug (lower-left of den.jpg).
 * --seat-y pushes feet into the rug plane (art has transparent pad under paws).
 * No translateY bob — only scale breathe from feet (transform-origin bottom).
 */
.pet-stage .pet-canvas-wrap {
  --seat-y: 28px;
  position: absolute;
  left: 17%;
  bottom: 7%;
  width: min(248px, 31vw);
  height: min(248px, 31vw);
  z-index: 3;
  pointer-events: auto;
  animation: petBreathePlanted 2.8s ease-in-out infinite;
  transform: translateY(var(--seat-y));
  transform-origin: 50% 100%;
  filter: none;
}

.pet-stage .pet-canvas-wrap .pet-art {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: end center;
  filter: none !important;
}

.pet-stage .pet-canvas-wrap .pet-art img {
  width: 108%;
  max-width: none;
  height: 108%;
  margin-bottom: -6%;
  object-fit: contain;
  object-position: center bottom;
  filter: none !important;
}

/* Hard contact ellipse under paws — readable on the rug */
.pet-stage .pet-shadow {
  position: absolute;
  left: 20.5%;
  bottom: calc(7% + 6px);
  width: min(132px, 22vw);
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 75% 60% at 50% 45%,
      rgba(18, 10, 6, 0.62) 0%,
      rgba(18, 10, 6, 0.32) 40%,
      rgba(18, 10, 6, 0.08) 68%,
      transparent 78%);
  filter: blur(0.6px);
  z-index: 2;
  animation: shadowPulsePlanted 2.8s ease-in-out infinite;
  transform-origin: center;
  pointer-events: none;
}

.pet-stage .pet-floor-mark {
  position: absolute;
  left: 19%;
  bottom: calc(7% + 4px);
  width: min(148px, 24vw);
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(90, 55, 25, 0.2), transparent 72%);
  z-index: 1;
  pointer-events: none;
}

@keyframes petBreathePlanted {
  0%, 100% { transform: translateY(var(--seat-y, 28px)) scale(1, 1) rotate(-0.3deg); }
  50% { transform: translateY(var(--seat-y, 28px)) scale(1.012, 0.988) rotate(0.3deg); }
}

@keyframes shadowPulsePlanted {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(0.93); opacity: 0.82; }
}

@media (max-width: 899px) {
  .pet-stage .pet-canvas-wrap {
    --seat-y: 18px;
    left: 50%;
    bottom: 20%;
    width: min(220px, 54vw);
    height: min(220px, 54vw);
    animation: petBreathePlantedMobile 2.8s ease-in-out infinite;
  }
  .pet-stage .pet-shadow {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(20% + 4px);
    width: min(130px, 40vw);
  }
  .pet-stage .pet-floor-mark {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(20% + 2px);
  }
  @keyframes petBreathePlantedMobile {
    0%, 100% { transform: translateX(-50%) translateY(var(--seat-y, 18px)) scale(1, 1); }
    50% { transform: translateX(-50%) translateY(var(--seat-y, 18px)) scale(1.012, 0.988); }
  }
  .pet-stage .pet-canvas-wrap.react-feed,
  .pet-stage .pet-canvas-wrap.react-play,
  .pet-stage .pet-canvas-wrap.react-rest,
  .pet-stage .pet-canvas-wrap.react-pet {
    /* keep centered while reacting */
  }
}

.species-preview .pet-art img,
.species-preview img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.species-preview .pet-art {
  width: 120px;
  height: 120px;
}

.pet-shadow {
  position: absolute;
  bottom: 18%;
  width: 140px;
  height: 28px;
  background: radial-gradient(ellipse, rgba(26, 21, 32, 0.28), transparent 70%);
  filter: blur(2px);
  animation: shadowPulse 2.4s ease-in-out infinite;
}

@keyframes shadowPulse {
  0%, 100% { transform: scaleX(1); opacity: 0.9; }
  50% { transform: scaleX(0.88); opacity: 0.65; }
}

.pet-canvas-wrap {
  width: min(320px, 78vw);
  height: min(320px, 78vw);
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 18px 24px rgba(26, 21, 32, 0.2));
  animation: petBob 2.4s ease-in-out infinite;
  transform-origin: 50% 80%;
  cursor: grab;
  touch-action: none;
}

.pet-canvas-wrap:active { cursor: grabbing; }
.pet-canvas-wrap.react-feed { animation: petFeed 0.55s var(--ease-spring); }
.pet-canvas-wrap.react-play { animation: petPlay 0.65s var(--ease-spring); }
.pet-canvas-wrap.react-rest { animation: petRest 0.9s ease-in-out; }
.pet-canvas-wrap.react-pet { animation: petSquee 0.5s var(--ease-spring); }

@keyframes petBob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}

@keyframes petFeed {
  0% { transform: scale(1); }
  30% { transform: scale(1.08) translateY(-8px); }
  55% { transform: scale(0.96) rotate(-4deg); }
  100% { transform: scale(1); }
}

@keyframes petPlay {
  0% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-28px) rotate(-8deg) scale(1.05); }
  50% { transform: translateY(-4px) rotate(8deg); }
  75% { transform: translateY(-20px) rotate(-4deg); }
  100% { transform: translateY(0) rotate(0); }
}

@keyframes petRest {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(0.94) translateY(6px); filter: brightness(0.92); }
}

@keyframes petSquee {
  0% { transform: scale(1); }
  40% { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1); }
}

/* Diegetic wood/parchment furniture — not full-bleed SaaS frost */
.diegetic-panel {
  position: relative;
  background:
    linear-gradient(165deg, rgba(255, 246, 230, 0.82), rgba(232, 210, 170, 0.78)),
    repeating-linear-gradient(
      90deg,
      rgba(140, 90, 40, 0.04) 0 1px,
      transparent 1px 7px
    );
  border: 2px solid rgba(120, 72, 28, 0.38);
  border-radius: 18px;
  box-shadow:
    0 14px 32px rgba(26, 21, 32, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(90, 50, 20, 0.08);
  backdrop-filter: blur(4px) saturate(1.05);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
}

.diegetic-panel.panel-compact {
  background: linear-gradient(165deg, rgba(255, 248, 239, 0.72), rgba(239, 220, 185, 0.62));
  border-width: 1.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.parchment-chip {
  background: rgba(255, 250, 235, 0.7) !important;
  border: 1px solid rgba(140, 90, 40, 0.18) !important;
}

.care-dock {
  position: relative;
  padding: var(--s-4);
  display: grid;
  gap: var(--s-3);
  max-width: 340px;
  margin-left: auto;
  align-self: end;
  /* wooden care table */
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.92), rgba(220, 185, 130, 0.88)),
    repeating-linear-gradient(
      90deg,
      rgba(100, 60, 20, 0.06) 0 2px,
      transparent 2px 9px
    ) !important;
  border: 3px solid rgba(90, 52, 18, 0.45) !important;
  border-radius: 14px 14px 10px 10px !important;
  box-shadow:
    0 18px 36px rgba(26, 21, 32, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -6px 12px rgba(90, 50, 20, 0.12) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.care-dock-rail {
  position: absolute;
  top: -8px;
  left: 10%;
  right: 10%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #6a3e14, #c49a58 35%, #e8c878 50%, #c49a58 65%, #6a3e14);
  box-shadow: 0 3px 6px rgba(26, 21, 32, 0.28);
}

.care-btn {
  background: linear-gradient(180deg, #6a4020, #4a2a10) !important;
  border: 1.5px solid rgba(255, 220, 140, 0.28) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 6px rgba(26, 21, 32, 0.2);
  color: #fff4d8 !important;
}

.care-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #8a5a28, #5a3410) !important;
  transform: translateY(-2px);
}

.care-dock .stat-chip.parchment-chip {
  background: rgba(40, 24, 12, 0.35) !important;
  border: 1px solid rgba(255, 220, 140, 0.22) !important;
}

.care-dock .stat-chip label {
  color: #ffe9a8 !important;
}

.care-dock .pet-nameplate h2 {
  color: #fff8ef;
}

.care-dock .care-hint {
  color: rgba(255, 244, 216, 0.75) !important;
}

.care-dock {
  background:
    linear-gradient(180deg, #7a4a20, #4a2a10) !important;
  border: 3px solid rgba(255, 220, 140, 0.28) !important;
  color: #fff4d8;
}

.care-hint {
  text-align: center;
  font-size: 0.75rem;
}

.care-table.care-dock {
  border-radius: 10px !important;
}

.care-legs {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -14px;
  height: 14px;
  background:
    linear-gradient(90deg,
      #6a3e14 0 12px, transparent 12px 28%,
      #6a3e14 28% calc(28% + 12px), transparent calc(28% + 12px) 72%,
      #6a3e14 72% calc(72% + 12px), transparent calc(72% + 12px) 100%);
  opacity: 0.85;
  pointer-events: none;
}

.care-btn .care-svg {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}

.care-btn .care-svg svg {
  width: 26px;
  height: 26px;
}

.bar {
  height: 12px !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.bar > i {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.care-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}

.care-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-weight: 800;
  font-size: 0.82rem;
  transition: transform var(--t-fast) var(--ease-spring), background var(--t-fast);
}

.care-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.75);
  transform: translateY(-2px);
}

.care-btn .emoji { font-size: 1.4rem; }

.pet-nameplate {
  text-align: center;
  margin-bottom: var(--s-2);
}

.pet-nameplate h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.pet-nameplate .species {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--teal-deep);
  background: rgba(42, 157, 143, 0.12);
  padding: 2px 10px;
  border-radius: var(--r-pill);
}

/* particles */
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-fx);
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, var(--gold));
  animation: sparkle 900ms var(--ease-out) forwards;
  box-shadow: 0 0 10px rgba(232, 168, 56, 0.8);
}

@keyframes sparkle {
  0% { opacity: 1; transform: translate(0, 0) scale(0.4); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2); }
}

/* —— Hatchery ritual stage —— */
.hatch-layout {
  position: relative;
  z-index: var(--z-ui);
  max-width: 980px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) var(--s-6);
  display: grid;
  gap: var(--s-4);
}

.hatch-layout.hatch-ritual {
  grid-template-columns: 1fr;
}

.hatch-layout.hatch-stack {
  max-width: 880px;
  min-height: 0;
  align-content: start;
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
}

.hatch-ceremony-full {
  width: 100%;
  text-align: center;
  padding: var(--s-3) var(--s-4) var(--s-4) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.nest-stage-hero {
  margin: 0 auto 4px;
  width: min(280px, 72vw) !important;
  height: 200px !important;
}

.nest-stage-hero .nest-bowl {
  width: 200px;
  height: 160px;
}

.nest-stage-hero .ritual-egg {
  width: 72px;
  height: 92px;
  bottom: 40px;
}

.nest-stage-hero .egg-preview {
  width: 70px;
  height: 70px;
  bottom: 58px;
}

.ceremony-title {
  font-size: clamp(1.15rem, 2.8vw, 1.45rem) !important;
  margin: 4px 0 !important;
}

.hatch-species-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px auto 0;
  max-width: 640px;
}

@media (max-width: 640px) {
  .hatch-species-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}

.species-egg-choice {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px 10px;
  border-radius: 50% 50% 16px 16px / 40% 40% 16px 16px;
  border: 2px solid rgba(196, 122, 18, 0.35);
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.55), transparent 45%),
    linear-gradient(165deg, rgba(255, 244, 210, 0.55), rgba(220, 180, 110, 0.4));
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring), border-color var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 8px 16px rgba(26, 21, 32, 0.14);
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.species-egg-choice:hover { transform: translateY(-3px); }

.species-egg-choice.selected {
  border-color: var(--gold);
  box-shadow: var(--glow-gold), 0 10px 22px rgba(26, 21, 32, 0.2);
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.7), transparent 45%),
    linear-gradient(165deg, rgba(255, 236, 170, 0.85), rgba(232, 168, 56, 0.45));
}

.species-egg-art {
  width: 72px;
  height: 72px;
}

.species-egg-art .pet-art,
.species-egg-art img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.mini-egg {
  width: 64px;
  height: 78px;
  border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 14px rgba(26, 21, 32, 0.25), inset 0 -6px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.mini-egg.egg-glowkit {
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), transparent 40%),
    linear-gradient(165deg, #fff4d8, #f0a060 48%, #d47830);
}
.mini-egg.egg-mote {
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.85), transparent 40%),
    linear-gradient(165deg, #f4f8ff, #c8dcff 50%, #9eb8e8);
}
.mini-egg.egg-shellune {
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), transparent 40%),
    linear-gradient(165deg, #e8fff6, #8fd4c0 50%, #4a9a88);
}
.mini-egg.egg-bristlewing {
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7), transparent 40%),
    linear-gradient(165deg, #efe6ff, #9a88c8 50%, #5a4880);
}

.mini-egg-face {
  width: 48px;
  height: 48px;
  opacity: 0.92;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.mini-egg-face .pet-art,
.mini-egg-face img {
  width: 48px !important;
  height: 48px !important;
  object-fit: contain;
}

.species-egg-choice strong {
  font-size: 0.88rem;
  font-weight: 900;
}

.species-egg-choice span {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal-deep);
}

.hatch-name-row {
  margin: 10px auto 0;
  max-width: 520px;
  padding: 10px 14px;
  display: grid;
  gap: 8px;
  text-align: left;
  background:
    linear-gradient(180deg, #8a5a28, #5a3410) !important;
  border: 2px solid rgba(255, 220, 140, 0.35) !important;
  color: #fff4d8;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.hatch-name-row label {
  color: #ffe9a8 !important;
}

.hatch-name-row input {
  background: rgba(255, 248, 230, 0.92) !important;
  color: var(--ink) !important;
}

@media (min-width: 640px) {
  .hatch-name-row {
    grid-template-columns: 1.2fr auto;
    align-items: end;
  }
  .hatch-name-row .hatch-actions {
    margin-top: 0;
  }
}

@media (min-width: 900px) {
  .hatch-layout.hatch-ritual:not(.hatch-stack) {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
    min-height: calc(100dvh - var(--nav-h) - 100px);
  }
}

.hatch-ceremony {
  position: relative;
  display: grid;
  place-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  min-height: 320px;
  background:
    linear-gradient(165deg, rgba(255, 248, 230, 0.28), rgba(255, 255, 255, 0.08));
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 20px 50px rgba(26, 21, 32, 0.12);
}

.nest-stage {
  position: relative;
  width: min(360px, 90vw);
  height: 300px;
  display: grid;
  place-items: end center;
  isolation: isolate;
}

.nest-glow {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 220, 120, 0.55), rgba(255, 180, 80, 0.12) 50%, transparent 70%);
  filter: blur(2px);
  animation: nestPulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes nestPulse {
  0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}

.nest-bowl {
  position: relative;
  width: 240px;
  height: 200px;
  z-index: 2;
  display: grid;
  place-items: center;
}

.nest-straw {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 70px;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(ellipse at 50% 30%, #d4a24a, transparent 60%),
    linear-gradient(180deg, #c48a38, #8a5520 70%, #6a3e14);
  box-shadow:
    inset 0 10px 16px rgba(255, 230, 160, 0.35),
    0 10px 20px rgba(26, 21, 32, 0.25);
  z-index: 1;
}

.nest-straw::before,
.nest-straw::after {
  content: "";
  position: absolute;
  bottom: 22px;
  width: 70px;
  height: 28px;
  border-radius: 40% 60% 50% 50%;
  background: linear-gradient(145deg, #e0b060, #a86a28);
  opacity: 0.85;
}
.nest-straw::before { left: 10px; transform: rotate(-18deg); }
.nest-straw::after { right: 10px; transform: rotate(18deg); }

.nest-base {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(26, 21, 32, 0.35), transparent 70%);
  filter: blur(2px);
  z-index: 0;
}

.ritual-egg {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 118px;
  border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), transparent 40%),
    linear-gradient(165deg, #fff4d8, #f0c878 45%, #d4a040);
  box-shadow:
    0 12px 24px rgba(26, 21, 32, 0.28),
    inset 0 -8px 16px rgba(160, 100, 20, 0.2);
  z-index: 3;
  animation: eggRock 3.2s ease-in-out infinite;
}

.ritual-egg.egg-mote {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.85), transparent 40%),
    linear-gradient(165deg, #f4f8ff, #c8dcff 50%, #9eb8e8);
}
.ritual-egg.egg-shellune {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), transparent 40%),
    linear-gradient(165deg, #e8fff6, #8fd4c0 50%, #4a9a88);
}
.ritual-egg.egg-bristlewing {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7), transparent 40%),
    linear-gradient(165deg, #efe6ff, #9a88c8 50%, #5a4880);
}
.ritual-egg.egg-glowkit {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.8), transparent 40%),
    linear-gradient(165deg, #fff4d8, #f0a060 48%, #d47830);
}

.egg-shine {
  position: absolute;
  top: 18%;
  left: 22%;
  width: 28%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(1px);
}

.egg-crack {
  position: absolute;
  inset: 28% 38% 30% 40%;
  border-left: 2px solid rgba(120, 70, 20, 0.25);
  border-right: 1px solid rgba(120, 70, 20, 0.15);
  transform: rotate(8deg);
  opacity: 0.7;
}

@keyframes eggRock {
  0%, 100% { transform: translateX(-50%) rotate(-2deg); }
  50% { transform: translateX(-50%) rotate(3deg); }
}

.egg-preview {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 88px;
  z-index: 4;
  opacity: 0.22;
  filter: blur(0.4px);
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.ceremony-copy {
  text-align: center;
  max-width: 36ch;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.ceremony-title {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem) !important;
  margin: 8px 0 !important;
  font-family: var(--font-display);
  font-weight: 900;
}

.ceremony-blurb { margin-bottom: 8px; }

.chosen-line {
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: rgba(255, 248, 239, 0.55);
  border: 1px solid rgba(196, 122, 18, 0.22);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  display: inline-block;
}

.hatch-picker-panel {
  padding: var(--s-5);
  display: grid;
  gap: var(--s-3);
  align-content: start;
}

.picker-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.hatch-species-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.species-pill {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid rgba(120, 72, 28, 0.16);
  background: rgba(255, 252, 245, 0.75);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring), border-color var(--t-fast), box-shadow var(--t-fast);
}

.species-pill:hover { transform: translateY(-2px); }

.species-pill.selected {
  border-color: var(--gold);
  box-shadow: var(--glow-gold), 0 8px 20px rgba(26, 21, 32, 0.14);
  background: rgba(255, 248, 220, 0.92);
}

.species-pill-art {
  width: 64px;
  height: 64px;
}

.species-pill-art .pet-art,
.species-pill-art img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.species-pill-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.species-pill-meta strong {
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.species-pill-meta span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal-deep);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hatch-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-2);
}

/* legacy species-card kept for safety */
.hatch-grid {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

@media (min-width: 720px) {
  .hatch-grid { grid-template-columns: repeat(2, 1fr); }
}

.species-card {
  padding: var(--s-4);
  text-align: left;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--s-3);
  align-items: center;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast);
  border: 2px solid transparent;
  background: linear-gradient(165deg, rgba(255, 248, 239, 0.95), rgba(255, 255, 255, 0.75));
}

.species-card:hover {
  transform: translateY(-2px);
}

.species-card.selected {
  border-color: var(--gold);
  box-shadow: var(--glow-gold), 0 12px 32px var(--shadow);
}

.species-preview {
  width: 120px;
  height: 120px;
}

.species-card h3 {
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.species-card p {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 4px 0 10px;
}

.name-field {
  display: grid;
  gap: 6px;
  margin-top: var(--s-2);
}

.name-field label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.name-field input {
  min-height: 48px;
  border-radius: var(--r-md);
  border: 1px solid rgba(26, 21, 32, 0.12);
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

/* —— Bazaar —— */
.bazaar-night-bg {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  background: url("../assets/env/bazaar-night.jpg") center / cover no-repeat;
}

.bazaar-night-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 21, 32, 0.35), rgba(26, 21, 32, 0.15) 40%, rgba(26, 21, 32, 0.45));
  pointer-events: none;
}

.spark-field-bg {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  background: url("../assets/env/spark-field.jpg") center / cover no-repeat;
}

.spark-field-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(15, 10, 40, 0.45) 100%);
  pointer-events: none;
}

.bazaar-layout {
  position: relative;
  z-index: var(--z-ui);
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) var(--s-6);
  display: grid;
  gap: var(--s-4);
}

.bazaar-header {
  padding: var(--s-4) var(--s-5);
  max-width: 520px;
}

.bazaar-header .panel-title {
  font-size: 1.45rem;
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-weight: 900;
}

.bazaar-open-air {
  max-width: 1040px;
}

.bazaar-sign {
  display: flex;
  justify-content: flex-start;
}

.bazaar-sign-board {
  padding: 12px 18px;
  border-radius: 8px 8px 14px 14px;
  background:
    linear-gradient(180deg, #6a3e14, #8a5520 40%, #5a3210);
  color: #fff4d8;
  border: 2px solid rgba(255, 220, 140, 0.35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  max-width: 360px;
}

.bazaar-sign-board .hero-kicker {
  background: rgba(255, 220, 120, 0.18);
  color: #ffe9a8;
  border-color: rgba(255, 220, 140, 0.3);
}

.bazaar-sign-board h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.35rem;
  margin: 4px 0;
  color: #fff8ef;
}

.bazaar-sign-board p {
  font-size: 0.85rem;
  opacity: 0.88;
  margin: 0;
}

.market-stall-table {
  position: relative;
  margin-top: 12px;
  padding: 8px 10px 18px;
  display: grid;
  gap: 0;
}

.shelf-plank {
  height: 18px;
  margin: 0 2%;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #d4a24a 0%, #a86a28 45%, #6a3e14 100%);
  box-shadow:
    0 6px 0 #3a2008,
    0 10px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 230, 160, 0.35);
  position: relative;
  z-index: 2;
}

.shelf-plank::before {
  content: "";
  position: absolute;
  inset: 4px 8%;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 18px,
    rgba(60, 30, 10, 0.12) 18px 20px
  );
  pointer-events: none;
}

.shop-grid.open-stall.shelf-row {
  position: relative;
  z-index: 3;
  margin: -6px 0 4px;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px 12px;
  align-items: end;
}

.shop-item.ware-on-shelf {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 4px 0 !important;
  gap: 0 !important;
  position: relative;
  display: grid;
  justify-items: center;
}

.ware-on-shelf .item-ico.painted-sku {
  width: 132px !important;
  height: 132px !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.45));
}

.ware-on-shelf .item-ico.painted-sku img {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.shelf-shadow {
  width: 70%;
  height: 12px;
  margin-top: -8px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.45), transparent 70%);
  filter: blur(2px);
  z-index: 0;
}

.price-tag {
  margin-top: 6px;
  padding: 5px 8px 6px;
  min-width: 110px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #6a4020, #4a2a10);
  border: 1px solid rgba(255, 220, 140, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 3px;
  justify-items: center;
  text-align: center;
  color: #fff4d8;
}

.price-tag strong {
  color: #fff8ef !important;
}

.price-tag .price {
  color: #ffe08a !important;
}

.price-tag strong {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.price-tag .price {
  font-size: 0.85rem;
}

.buy-chip {
  min-height: 32px !important;
  padding: 0 14px !important;
  font-size: 0.8rem !important;
}

/* legacy counter styles retained if present */
.market-counter { display: none; }

.hub-pet-float {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: min(180px, 22vw);
  z-index: calc(var(--z-ui) + 1);
  filter: none;
  animation: petBobHub 2.8s ease-in-out infinite;
  pointer-events: none;
}

.hub-pet-shadow {
  position: absolute;
  left: 50%;
  bottom: -4%;
  transform: translateX(-50%);
  width: 62%;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(26, 21, 32, 0.4), transparent 70%);
  filter: blur(2px);
  z-index: 0;
}

.hub-pet-float .pet-art {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 10px rgba(26, 21, 32, 0.22));
}

@keyframes petBobHub {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

/* Hatchery meadow soft-focus so nest is the hero */
.hatch-soft-veil {
  position: absolute;
  inset: 0;
  z-index: calc(var(--z-bg) + 1);
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 50% at 28% 42%, rgba(255, 248, 220, 0.35), transparent 65%),
    linear-gradient(180deg, rgba(26, 21, 32, 0.12), transparent 30%, rgba(26, 21, 32, 0.18) 100%);
}

.nest-platform {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 280px;
  height: 120px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 236, 190, 0.75), rgba(196, 140, 70, 0.35) 55%, transparent 72%);
  box-shadow: 0 12px 28px rgba(26, 21, 32, 0.18);
  z-index: 0;
}

@media (max-width: 899px) {
  .hub-pet-float { display: none; }
}

.map-tile.illustrated {
  background-size: cover !important;
  background-position: center !important;
  min-height: 128px;
}

.map-tile.illustrated::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 21, 32, 0.15), rgba(26, 21, 32, 0.55));
  border-radius: inherit;
}

.map-tile.illustrated > * {
  position: relative;
  z-index: 1;
}

.tile-den.illustrated { background-image: url("../assets/env/den.jpg"); }
.tile-hatch.illustrated { background-image: linear-gradient(145deg, rgba(240,160,96,0.55), rgba(138,47,58,0.55)), url("../assets/env/meadow.jpg"); }
.tile-bazaar.illustrated { background-image: url("../assets/env/bazaar-night.jpg"); }
.tile-spark.illustrated { background-image: url("../assets/env/spark-field.jpg"); }

.shop-grid {
  display: grid;
  gap: var(--s-3);
  margin-top: 0;
}

@media (min-width: 640px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .shop-grid { grid-template-columns: repeat(3, 1fr); }
}

.shop-item {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-2);
  justify-items: center;
  text-align: center;
}

.shop-item.stall-card {
  background:
    linear-gradient(165deg, rgba(255, 248, 239, 0.88), rgba(240, 220, 180, 0.78));
  border: 2px solid rgba(120, 72, 28, 0.32);
}

.shop-item .item-ico {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 #fff;
}

.shop-item .item-ico.painted-sku {
  width: 104px;
  height: 104px;
  border-radius: 22px;
  padding: 8px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.95), transparent 55%),
    linear-gradient(145deg, #fffaf0, #efe0c4);
  border: 2px solid rgba(196, 122, 18, 0.28);
  box-shadow:
    inset 0 1px 0 #fff,
    0 8px 18px rgba(26, 21, 32, 0.16);
  overflow: hidden;
}

.shop-item .item-ico.painted-sku img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(26, 21, 32, 0.18));
}

.item-ico.painted-sku.sm {
  width: 48px !important;
  height: 48px !important;
  border-radius: 12px !important;
  padding: 2px !important;
}

.item-ico.painted-sku.sm img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-item h3 {
  font-weight: 900;
  letter-spacing: -0.01em;
}

.shop-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold-deep);
}

/* —— Inventory —— */
.inv-layout {
  position: relative;
  z-index: var(--z-ui);
  max-width: 800px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4);
}

.inv-list {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.inv-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--s-3);
  align-items: center;
  padding: 12px 14px;
}

.inv-row .qty {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.empty-state {
  padding: var(--s-6);
  text-align: center;
}

.empty-state h3 {
  font-weight: 900;
  margin-bottom: 6px;
}

/* —— Mini-game —— */
.spark-layout {
  position: relative;
  z-index: var(--z-ui);
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-4);
}

.spark-board {
  position: relative;
  height: min(58vh, 480px);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: rgba(12, 8, 35, 0.32);
  border: 2px solid rgba(255, 220, 140, 0.35);
  box-shadow:
    0 20px 50px var(--shadow-deep),
    inset 0 0 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
  touch-action: none;
  cursor: crosshair;
}

.spark-board-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(8, 4, 28, 0.45) 100%);
}

.spark-board-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  max-width: 28ch;
  text-align: center;
  color: rgba(255, 248, 239, 0.88);
  font-weight: 800;
  font-size: 0.95rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: rgba(26, 21, 32, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.spark-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.spark-leave {
  color: var(--cream) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.spark-help {
  color: rgba(255, 248, 239, 0.8) !important;
  margin-top: 12px;
}

.spark-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-3);
  color: var(--cream);
  font-weight: 800;
}

.spark-hud .pill {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(26, 21, 32, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-variant-numeric: tabular-nums;
}

.spark-orb {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe08a 35%, var(--gold) 70%, var(--gold-deep));
  box-shadow: 0 0 20px rgba(255, 220, 100, 0.85), 0 0 40px rgba(192, 123, 255, 0.4);
  animation: orbPulse 0.8s ease-in-out infinite;
  will-change: transform;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.spark-orb.caught {
  animation: orbCatch 0.35s var(--ease-out) forwards;
}

@keyframes orbCatch {
  to { opacity: 0; transform: scale(1.8); }
}

.den-room-bg {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  background:
    linear-gradient(180deg, rgba(26, 21, 32, 0.08), transparent 30%),
    url("../assets/env/den.jpg") center / cover no-repeat;
  transform: scale(1.02);
}

.den-room-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 42% 62%, transparent 40%, rgba(26, 21, 32, 0.18) 100%),
    linear-gradient(90deg, rgba(245, 232, 200, 0.12), transparent 30%, transparent 70%, rgba(26, 21, 32, 0.1));
  pointer-events: none;
}

.hub-meadow-bg {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  background:
    linear-gradient(180deg, rgba(126, 200, 232, 0.15), transparent 40%),
    url("../assets/env/meadow.jpg") center top / cover no-repeat;
}

.hub-meadow-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 21, 32, 0.22) 0%, transparent 18%, transparent 70%, rgba(26, 21, 32, 0.25) 100%);
  pointer-events: none;
}

/* Illustrated pet art */
.pet-art {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.pet-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 14px 18px rgba(26, 21, 32, 0.22));
}

.pet-blink-lid {
  position: absolute;
  top: 34%;
  left: 50%;
  width: 42%;
  height: 8%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.12));
  border-radius: 50%;
  pointer-events: none;
}

.mood-hearts {
  position: absolute;
  top: 8%;
  right: 12%;
  color: var(--coral);
  font-size: 1.4rem;
  animation: floatHeart 1s var(--ease-out) infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.mood-zzz {
  position: absolute;
  top: 10%;
  right: 14%;
  font-weight: 900;
  color: var(--ink-soft);
  opacity: 0.55;
  letter-spacing: 0.1em;
  animation: floatZ 1.6s ease-in-out infinite;
}

@keyframes floatHeart {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(-8px); opacity: 1; }
}

@keyframes floatZ {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(4px, -6px); }
}

/* Shop item art (legacy SVG glyphs — painted-sku preferred) */
.item-ico.svg-ico {
  font-size: 0;
  width: 64px !important;
  height: 64px !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.9), transparent 50%),
    linear-gradient(145deg, #fff8ef, #f0e0c8);
  box-shadow:
    inset 0 1px 0 #fff,
    0 4px 12px rgba(26, 21, 32, 0.12);
}

.item-ico svg {
  width: 40px;
  height: 40px;
}

.spark-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.4), transparent);
  background-size: 100% 100%;
  opacity: 0.55;
  pointer-events: none;
  animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.55; }
  to { opacity: 0.95; }
}

.spark-orb {
  width: 48px !important;
  height: 48px !important;
  margin: -24px 0 0 -24px !important;
  background:
    radial-gradient(circle at 35% 30%, #fff 0%, #ffe08a 28%, var(--gold) 62%, var(--gold-deep) 100%) !important;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.85),
    0 0 0 6px rgba(232, 168, 56, 0.45),
    0 0 20px rgba(255, 230, 120, 1),
    0 0 40px rgba(255, 180, 80, 0.55) !important;
  border: 2px solid #fff;
  z-index: 2;
}

.spark-orb::before {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  animation: none;
}

.spark-orb::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  animation: orbRing 1.2s ease-out infinite;
}

@keyframes orbRing {
  0% { transform: scale(0.7); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Non-catchable ambient field lights — clearly dimmer/softer than ringed orbs */
.spark-ambient {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 180, 0.35), transparent 70%);
  box-shadow: none;
  border: none;
  pointer-events: none;
  z-index: 0;
  animation: ambientTwinkle 2.4s ease-in-out infinite;
  opacity: 0.45;
}

@keyframes ambientTwinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 0.55; transform: scale(1.15); }
}

.spark-open-field {
  max-width: 960px;
}

.spark-board.spark-board-open {
  height: min(66vh, 540px) !important;
  border-radius: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  /* full field — board is just the hit plane */
}

.spark-hud-float .pill {
  background: rgba(20, 12, 40, 0.55) !important;
  border: 1px solid rgba(255, 220, 140, 0.28) !important;
}
