/* ══════════════════════════════════════════
   UI LAYOUT — Stats, Buttons, Shop
   ══════════════════════════════════════════ */

/* ── Main layout ── */
.game {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--ui-bg);
  color: var(--ui-text);
  overflow-x: hidden;
  overflow-y: auto;
}

/* Hide controls when shop is open inline */
.game.shop-open .pet-btn,
.game.shop-open .breed-btn,
.game.shop-open .stats,
.game.shop-open .actions,
.game.shop-open .shop-toggle-btn,
.game.shop-open .combo-counter {
  display: none;
}

/* Lock the page scroll while shop is open — only the shop itself scrolls */
.game.shop-open {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ── Top bar ── */
.top-bar {
  width: var(--scene-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-text-dim);
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar__xp {
  font-size: 18px;
  color: hsl(45, 100%, 70%);
  text-shadow: 0 0 10px hsla(45, 100%, 60%, 0.3);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s ease;
}

.top-bar__xp.xp-bump {
  animation: xp-bump 0.3s ease-out;
}

.top-bar__xp-icon {
  font-size: 20px;
  animation: xp-pulse 2s ease-in-out infinite;
}

@keyframes xp-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes xp-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.top-bar__day {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-bar__level {
  background: var(--ui-surface);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--ui-border);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Hide the pill entirely when there's nothing to show (early game). */
.top-bar__level:has(.top-bar__generation:empty):has(.top-bar__ascension:empty) {
  display: none;
}

.top-bar__personality {
  font-size: 11px;
  font-weight: 700;
  color: hsl(280, 70%, 80%);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.top-bar__personality:empty {
  display: none;
}

/* Scene-anchored stage + personality pill (top-left of playground). */
.scene-info {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 22;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: hsla(230, 30%, 14%, 0.78);
  border: 1px solid hsla(280, 60%, 60%, 0.35);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ui-text-dim);
  max-width: 50%;
  box-shadow: 0 4px 12px hsla(0, 0%, 0%, 0.35);
}

.scene-info:empty,
.scene-info:has(> .top-bar__stage:empty):has(> .top-bar__personality:empty) {
  display: none;
}

.scene-info .top-bar__stage {
  text-transform: lowercase;
  white-space: nowrap;
}

/* ── Scene wrapper (holds the pet-card) ── */
.scene-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 8px;
}

/* ── Evolution progress bar ── */
.evo-bar {
  width: var(--scene-width);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 16px;
}

.evo-bar__label {
  font-size: 10px;
  font-weight: 700;
  color: hsl(280, 70%, 70%);
  white-space: nowrap;
  min-width: 70px;
}

.evo-bar__track {
  flex: 1;
  height: 10px;
  background: hsla(0, 0%, 100%, 0.08);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid hsla(0, 0%, 100%, 0.06);
}

.evo-bar__fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, hsl(280, 60%, 50%), hsl(320, 80%, 60%));
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.evo-bar__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, hsla(0, 0%, 100%, 0.25) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: bar-shimmer 3s ease-in-out infinite;
}

.evo-bar__xp {
  font-size: 10px;
  color: var(--ui-text-dim);
  white-space: nowrap;
  min-width: 55px;
  text-align: right;
}

/* Evolution approaching — excited pulse */
.evo-bar--close .evo-bar__fill {
  animation: evo-close-pulse 0.8s ease-in-out infinite;
}

.evo-bar--close .evo-bar__label {
  animation: evo-label-pulse 0.8s ease-in-out infinite;
}

@keyframes evo-close-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}

@keyframes evo-label-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Personality stat indicators */
.stat.personality-down .stat__icon::after {
  content: '↓';
  font-size: 9px;
  color: hsl(0, 70%, 60%);
  position: relative;
  top: -2px;
  margin-left: -2px;
}
.stat.personality-up .stat__icon::after {
  content: '↑';
  font-size: 9px;
  color: hsl(120, 60%, 55%);
  position: relative;
  top: -2px;
  margin-left: -2px;
}

.evo-bar--max .evo-bar__fill {
  background: linear-gradient(90deg, hsl(45, 100%, 50%), hsl(320, 80%, 60%), hsl(280, 80%, 60%));
  background-size: 200% 100%;
  animation: evo-max-shimmer 3s linear infinite;
}

@keyframes evo-max-shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ── Stat bars (each is a button — tap to perform the action) ── */
.stats {
  width: var(--scene-width);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  padding: 4px 16px;
}

.stat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 8px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  color: var(--ui-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.stat__bar-container {
  min-width: 0;
}

.stat:hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px hsla(0, 0%, 0%, 0.25);
}

.stat:active {
  transform: translateY(1px) scale(0.985);
}

.stat:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Read-only stat (e.g. happiness, since petting handles that interaction) */
.stat--readonly {
  cursor: default;
}

.stat--readonly:hover {
  background: var(--ui-surface);
  border-color: var(--ui-border);
  transform: none;
  box-shadow: none;
}

.stat--readonly:active {
  transform: none;
}

.stat__icon {
  font-size: 20px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px hsla(0, 0%, 0%, 0.4));
}

.stat__bar-container {
  flex: 1;
  height: 22px;
  background: hsla(0, 0%, 0%, 0.25);
  border-radius: 11px;
  overflow: hidden;
  position: relative;
  border: 1px solid hsla(0, 0%, 100%, 0.08);
}

.stat__bar {
  height: 100%;
  border-radius: 11px 0 0 11px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

/* Holographic sheen on stat bars */
.stat__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    hsla(0, 0%, 100%, 0.2) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: bar-shimmer 3s ease-in-out infinite;
}

@keyframes bar-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.stat__bar--hunger {
  background: linear-gradient(90deg, hsl(25, 80%, 45%), var(--hunger-color));
}
.stat__bar--happiness {
  background: linear-gradient(90deg, hsl(340, 75%, 50%), var(--happiness-color));
}
.stat__bar--energy {
  background: linear-gradient(90deg, hsl(210, 75%, 50%), var(--energy-color));
}
.stat__bar--hygiene {
  background: linear-gradient(90deg, hsl(160, 60%, 40%), var(--hygiene-color));
}

/* Action verb overlaid on the bar — clear "what tapping does" affordance */
.stat__verb {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: hsla(0, 0%, 100%, 0.85);
  text-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.6);
  pointer-events: none;
  transition: opacity 0.2s ease;
  opacity: 0.7;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* German words like "SCHLAFEN" / "ZÜCHTEN" need a hair more breathing room */
:root[lang="de"] .stat__verb,
:root[lang="nl"] .stat__verb,
:root[lang="pl"] .stat__verb {
  font-size: 10px;
  letter-spacing: 0.1px;
}
.stat:hover .stat__verb {
  opacity: 1;
}

/* Low stat — pulsing border to grab attention */
.stat__bar-container.low {
  animation: stat-warn 1s ease-in-out infinite;
}
.stat__bar-container.low .stat__verb {
  opacity: 1;
}

@keyframes stat-warn {
  0%, 100% { border-color: hsla(0, 70%, 50%, 0.3); }
  50% { border-color: hsla(0, 70%, 50%, 0.8); }
}

/* Stat badge — feed count / tier stars (mirrors action-btn__badge) */
.stat__badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: hsl(45, 90%, 55%);
  color: hsl(230, 30%, 15%);
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.4);
  pointer-events: none;
}
.stat__badge--tier {
  background: hsl(280, 70%, 55%);
  color: #fff;
  letter-spacing: -1px;
}
.stat__badge:empty {
  display: none;
}

/* Feed depleted — out of food */
.stat.depleted .stat__badge {
  background: hsl(0, 70%, 50%);
  color: #fff;
  animation: badge-warn 1s ease-in-out infinite;
}
.stat.depleted .stat__icon {
  filter: grayscale(0.5);
}

/* Locked stat-buttons (mirrors .action-btn.locked) */
.stat.locked {
  opacity: 0.25;
  pointer-events: none;
  filter: grayscale(1);
}
.stat.locked::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: hsla(0, 0%, 0%, 0.35);
  border-radius: inherit;
}

.stat.unlocking {
  opacity: 1;
  pointer-events: auto;
  filter: none;
  animation: action-unlock 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.stat.unlocking::after {
  animation: lock-fade 0.4s ease-out forwards;
}

/* ── Action buttons ── */
.actions {
  width: var(--scene-width);
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 6px 8px;
  justify-content: center;
}

/* Secondary actions (heal/scold) — only shown row, more compact + horizontal.
   Locked entries collapse entirely so we don't reserve dead space until the
   action is actually available. */
.actions--secondary {
  gap: 8px;
  padding: 2px 16px;
}
.actions--secondary .action-btn {
  flex-direction: row;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  min-height: 30px;
}
.actions--secondary .action-btn__icon {
  font-size: 16px;
}
/* Locked OR situationally-disabled (e.g. Heal when the pet isn't sick)
   collapse so we don't reserve a strip of dim, untappable real estate. */
.actions--secondary .action-btn.locked,
.actions--secondary .action-btn:disabled {
  display: none;
}
.actions--secondary:not(:has(.action-btn:not(.locked):not(:disabled))) {
  display: none;
}

/* Heal button — blinks when the pet is sick so the player can't miss it.
   The button is only displayed when sick (it has display:none otherwise),
   so the animation is effectively gated on the sick state. */
.actions--secondary .action-btn[data-action="heal"]:not(.locked):not(:disabled) {
  animation: heal-urgent 1s ease-in-out infinite;
  background: hsl(0, 60%, 25%);
  border-color: hsl(0, 80%, 55%);
  color: hsl(0, 100%, 92%);
}

.actions--secondary .action-btn[data-action="heal"]:not(.locked):not(:disabled) .action-btn__icon {
  animation: heal-icon-bounce 1s ease-in-out infinite;
}

@keyframes heal-urgent {
  0%, 100% {
    box-shadow: 0 0 0 0 hsla(0, 100%, 55%, 0.6);
    background: hsl(0, 60%, 25%);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 16px 4px hsla(0, 100%, 55%, 0.85), 0 0 28px 6px hsla(0, 100%, 50%, 0.4);
    background: hsl(0, 75%, 45%);
    transform: scale(1.04);
  }
}

@keyframes heal-icon-bounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.18) rotate(-6deg); }
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 2px;
  background: var(--ui-surface);
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  font-size: 9px;
  color: var(--ui-text);
  transition: all 0.15s ease;
  min-width: 0;
  min-height: 44px;
  flex: 1 1 0;
  text-align: center;
  overflow: hidden;
}

.action-btn:hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-accent);
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(1px) scale(0.97);
}

.action-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Corner badge (feed count / upgrade tier stars) */
.action-btn {
  position: relative;
}

.action-btn__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: hsl(45, 90%, 55%);
  color: hsl(230, 30%, 15%);
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.4);
  pointer-events: none;
}

.action-btn__badge--tier {
  background: hsl(280, 70%, 55%);
  color: #fff;
  letter-spacing: -1px;
}

/* Feed depleted — out of food */
.action-btn.depleted .action-btn__badge {
  background: hsl(0, 70%, 50%);
  color: #fff;
  animation: badge-warn 1s ease-in-out infinite;
}

.action-btn.depleted .action-btn__icon {
  filter: grayscale(0.5);
}

@keyframes badge-warn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Locked action buttons ── */
.action-btn.locked {
  opacity: 0.2;
  pointer-events: none;
  position: relative;
  filter: grayscale(1);
}

.action-btn.locked::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: hsla(0, 0%, 0%, 0.3);
  border-radius: inherit;
}

/* Unlock animation */
.action-btn.unlocking {
  opacity: 1;
  pointer-events: auto;
  filter: none;
  animation: action-unlock 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.action-btn.unlocking::after {
  animation: lock-fade 0.4s ease-out forwards;
}

@keyframes action-unlock {
  0% { transform: scale(0.8); box-shadow: 0 0 0 0 var(--ui-accent-glow); }
  50% { transform: scale(1.15); box-shadow: 0 0 20px 5px var(--ui-accent-glow); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

@keyframes lock-fade {
  0% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

.action-btn__icon {
  font-size: 14px;
  line-height: 1;
}

.action-btn__label {
  font-weight: 600;
  line-height: 1.05;
  width: 100%;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-hyphens: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.actions--secondary .action-btn__label {
  -webkit-line-clamp: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Big Pet button ── */
.pet-btn {
  --power-fill: 0;
  width: var(--scene-width);
  height: 42px;
  flex-shrink: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--ui-surface) 0%, var(--ui-surface-hover) 100%);
  border: 2px solid var(--ui-border);
  border-radius: 16px;
  color: var(--ui-text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease, box-shadow 0.4s ease;
  position: relative;
  overflow: hidden;
}

.pet-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--ui-accent-glow), transparent 70%);
  opacity: calc(0.08 + var(--power-fill) * 0.0025);
  animation: pet-btn-glow 2s ease-in-out infinite;
}

.pet-btn:hover {
  border-color: var(--ui-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px hsla(175, 80%, 50%, 0.2);
}

.pet-btn:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: none;
}

.pet-btn.sleeping,
.pet-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
  pointer-events: none;
}

.pet-btn.sleeping .pet-btn__icon,
.pet-btn:disabled .pet-btn__icon {
  animation: none;
}

.pet-btn__icon {
  font-size: 24px;
  animation: xp-pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 calc(2px + var(--power-fill) * 0.08px) hsla(45, 100%, 60%, 0.6));
}

.pet-btn__amount {
  font-size: 13px;
  font-weight: 800;
  color: hsl(45, 100%, 70%);
  text-shadow: 0 0 6px hsla(45, 100%, 60%, 0.35);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Visual power gauge — bottom edge of the pet button. Width grows with click power. */
.pet-btn__power {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: calc(var(--power-fill) * 1%);
  max-width: 100%;
  background: linear-gradient(90deg,
    hsl(45, 100%, 55%) 0%,
    hsl(35, 100%, 60%) 60%,
    hsl(20, 100%, 65%) 100%);
  box-shadow: 0 0 10px hsla(45, 100%, 55%, 0.6);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.pet-btn__next-unlock {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 9px;
  font-weight: 700;
  color: hsl(280, 70%, 78%);
  background: hsla(280, 40%, 15%, 0.55);
  border: 1px solid hsla(280, 60%, 50%, 0.4);
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 0.2px;
  pointer-events: none;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-btn__next-unlock:empty {
  display: none;
}

@keyframes pet-btn-glow {
  0%, 100% { opacity: calc(0.08 + var(--power-fill) * 0.0025); }
  50%      { opacity: calc(0.15 + var(--power-fill) * 0.0035); }
}

/* Pet button switches into "Evolve!" mode when an evolution is ready. */
.pet-btn.is-evolve {
  --hold-progress: 0;
  background: linear-gradient(135deg, hsl(280, 60%, 22%) 0%, hsl(200, 60%, 28%) 100%);
  border-color: hsl(280, 90%, 70%);
  color: hsl(280, 100%, 90%);
  animation: pet-btn-evolve-pulse 1.6s ease-in-out infinite;
}

.pet-btn.is-evolve .pet-btn__icon {
  animation: pet-btn-evolve-spin 3s linear infinite;
  filter: drop-shadow(0 0 8px hsla(280, 100%, 70%, 0.7));
}

.pet-btn.is-evolve .pet-btn__amount {
  color: hsl(280, 100%, 88%);
  text-shadow: 0 0 6px hsla(280, 100%, 70%, 0.5);
}

@keyframes pet-btn-evolve-pulse {
  0%, 100% { box-shadow: 0 0 12px hsla(280, 90%, 60%, 0.35); }
  50%      { box-shadow: 0 0 28px hsla(280, 90%, 70%, 0.7); }
}

@keyframes pet-btn-evolve-spin {
  0%   { transform: rotate(0deg);   }
  100% { transform: rotate(360deg); }
}

/* Hold-to-confirm fill (used by both pet evolve mode and breed). */
.pet-btn__hold-fill,
.breed-btn__hold-fill {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(90deg,
    hsla(280, 100%, 65%, 0.55) 0%,
    hsla(200, 100%, 65%, 0.55) 100%);
  transform-origin: left center;
  transform: scaleX(var(--hold-progress, 0));
  transition: transform 0.08s linear;
  opacity: 0;
  z-index: 1;
}

.pet-btn.is-evolve .pet-btn__hold-fill,
.breed-btn .breed-btn__hold-fill {
  opacity: 1;
}

.breed-btn__hold-fill {
  background: linear-gradient(90deg,
    hsla(340, 100%, 65%, 0.55) 0%,
    hsla(10, 100%, 65%, 0.55) 100%);
}

.pet-btn.holding,
.breed-btn.holding {
  transform: scale(0.985);
}

.pet-btn.hold-confirmed,
.breed-btn.hold-confirmed {
  animation: hold-confirmed-flash 0.6s ease-out;
}

@keyframes hold-confirmed-flash {
  0%   { box-shadow: 0 0 0   hsla(0, 0%, 100%, 0); }
  40%  { box-shadow: 0 0 32px hsla(0, 0%, 100%, 0.85); }
  100% { box-shadow: 0 0 0   hsla(0, 0%, 100%, 0); }
}

/* Keep the foreground children above the hold fill overlay. */
.pet-btn__icon,
.pet-btn__label,
.pet-btn__amount,
.pet-btn__next-unlock,
.breed-btn__icon,
.breed-btn__label,
.breed-btn__desc {
  position: relative;
  z-index: 2;
}

/* ── XP/money block, overlaid on top of the shop button ── */
.shop-xp {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
  line-height: 1.1;
}

.shop-xp .top-bar__xp {
  font-size: 18px;
}

/* ── Shop toggle button ── */
.shop-toggle-btn {
  width: var(--scene-width);
  min-height: 52px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 12px;
  background: linear-gradient(135deg, hsl(45, 60%, 18%) 0%, hsl(35, 50%, 22%) 100%);
  border: 2px solid hsl(45, 70%, 40%);
  border-radius: 14px;
  color: hsl(45, 100%, 75%);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shop-toggle-btn__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shop-toggle-btn:hover {
  border-color: hsl(45, 100%, 55%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px hsla(45, 100%, 50%, 0.2);
}

.shop-toggle-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* Pet is sleeping — gently pulse the shop button so players notice they
   can spend time tweaking upgrades while the pet rests. */
.shop-toggle-btn.sleeping-glow {
  border-color: hsl(220, 80%, 65%);
  animation: shop-sleep-glow 2.4s ease-in-out infinite;
}

@keyframes shop-sleep-glow {
  0%, 100% {
    box-shadow:
      0 0 10px hsla(220, 100%, 65%, 0.25),
      0 0 0 hsla(220, 100%, 75%, 0);
  }
  50% {
    box-shadow:
      0 0 22px hsla(220, 100%, 70%, 0.55),
      0 0 6px hsla(220, 100%, 80%, 0.35);
  }
}

/* Shop locked: keep the XP overlay visible, hide the shop CTA. */
.shop-toggle-btn.locked {
  cursor: default;
  pointer-events: none;
  background: none;
  border-color: transparent;
  box-shadow: none;
  min-height: 0;
}

.shop-toggle-btn.locked .shop-toggle-btn__row {
  display: none;
}

.shop-toggle-btn.hidden {
  display: none;
}

.shop-toggle-btn__icon {
  font-size: 20px;
}

/* ── Shop overlay (inline, replaces controls) ── */
.shop-overlay {
  display: none;
  width: var(--scene-width);
  flex: 1;
  min-height: 0;
  background: hsl(230, 22%, 16%);
  border: 1px solid hsl(45, 70%, 40%);
  border-radius: 14px;
  padding: 10px 16px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.shop-overlay.locked {
  display: none;
}

.shop-overlay.open {
  display: block;
}

.game.shop-open .shop-overlay {
  padding-bottom: 60px;
}

/* Native AdMob banner sits at BOTTOM_CENTER of the WebView. Reserve a gutter
   below the shop so the banner has its own centered space and never overlaps
   shop content. Only applies when the banner is actually visible. */
:root {
  --ads-banner-height: 64px;
}

body.ads-banner-visible .game.shop-open {
  height: calc(100dvh - var(--ads-banner-height));
}

body.ads-banner-visible .game.shop-open .shop-overlay {
  margin-bottom: var(--ads-banner-height);
  padding-bottom: 16px;
}

.shop-overlay__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  position: sticky;
  top: -10px;
  padding-top: 10px;
  padding-bottom: 6px;
  background: hsl(230, 22%, 16%);
  z-index: 10;
}

.shop-overlay__xp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 800;
  color: hsl(45, 100%, 75%);
  text-shadow: 0 0 8px hsla(45, 100%, 60%, 0.3);
  white-space: nowrap;
}

.shop-overlay__xp-icon {
  font-size: 16px;
  animation: xp-pulse 2s ease-in-out infinite;
}

.shop-overlay__xps {
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-text-dim);
}

.shop-overlay__xps:empty {
  display: none;
}

.shop-overlay__close {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 14px;
  border-radius: 10px;
  transition: all 0.15s ease;
  line-height: 1;
  flex-shrink: 0;
}

/* Sleep indicator — full-width row below the header when pet is sleeping */
.shop-overlay__sleep-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: hsl(220, 80%, 75%);
  background: hsla(220, 60%, 30%, 0.35);
  border: 1px solid hsla(220, 70%, 60%, 0.4);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}

.shop-overlay.pet-sleeping .shop-overlay__sleep-indicator {
  display: flex;
}

.shop-overlay__sleep-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-overlay__sleep-zzz {
  animation: shop-sleep-bob 1.6s ease-in-out infinite;
}

@keyframes shop-sleep-bob {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-2px); opacity: 1; }
}

.shop-overlay__sleep-bar {
  flex: 1;
  min-width: 60px;
  max-width: 140px;
  height: 6px;
  background: hsla(220, 60%, 15%, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid hsla(220, 70%, 60%, 0.3);
}

.shop-overlay__sleep-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, hsl(220, 80%, 60%), hsl(200, 90%, 70%));
  transition: width 0.3s ease;
}

.shop-overlay__sleep-pct {
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

.shop-overlay__close:hover {
  color: var(--ui-text);
  background: var(--ui-surface-hover);
}

/* ── Shop backdrop (hidden, kept for compat) ── */
.shop-backdrop {
  display: none;
}

/* ── Shop grid ── */
.shop-overlay .shop__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
}

/* Type-cluster headers span the full width of the grid. */
.shop__section-header {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ui-text-dim);
  padding: 6px 4px 2px;
  border-bottom: 1px dashed hsla(0, 0%, 100%, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}

.shop__section-header:first-child {
  padding-top: 2px;
}

.shop__section-header__icon {
  font-size: 14px;
}

.shop-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  row-gap: 1px;
  padding: 6px 8px;
  background: var(--ui-surface);
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.shop-item:hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsla(0, 0%, 0%, 0.3);
}

.shop-item:active {
  transform: translateY(0) scale(0.98);
}

.shop-item:disabled,
.shop-item.too-expensive {
  opacity: 0.4;
  pointer-events: none;
}

.shop-item__icon {
  grid-row: 1 / span 2;
  font-size: 20px;
  flex-shrink: 0;
  align-self: center;
}

.shop-item__info {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.shop-item__name {
  font-size: 11px;
  font-weight: 700;
  display: flex;
  gap: 3px;
  align-items: baseline;
  min-width: 0;
}

.shop-item__name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.shop-item__count {
  flex-shrink: 0;
  color: hsl(45, 90%, 65%);
  font-weight: 600;
}

.shop-item__desc {
  font-size: 9px;
  color: var(--ui-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-item__cost {
  grid-column: 2;
  grid-row: 2;
  font-size: 10px;
  font-weight: 700;
  color: hsl(45, 100%, 65%);
  flex-shrink: 0;
  white-space: nowrap;
  justify-self: end;
}

/* ── Scene companions (bought auto-generators) ── */
.companions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.companion {
  position: absolute;
  font-size: 22px;
  filter: drop-shadow(0 2px 3px hsla(0, 0%, 0%, 0.3));
  transition: font-size 0.5s ease;
}

/* While dropping — rotation handled by JS physics */
.companion--dropping {
  /* JS sets transform: rotate() directly */
}

/* Once settled — gentle idle bob preserving settle rotation */
.companion--settled {
  animation: companion-idle 3s ease-in-out infinite;
}

@keyframes companion-idle {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -4px; }
}

/* ── XP per second display ── */
.xps-display {
  font-size: 11px;
  color: var(--ui-text-dim);
  margin-top: -2px;
}

/* ── Click efficiency display ── */
.efficiency-display {
  font-size: 10px;
  color: hsl(45, 80%, 55%);
  font-weight: 600;
  min-height: 14px;
}

.efficiency-display.low {
  color: hsl(0, 70%, 55%);
  animation: eff-warn 1.5s ease-in-out infinite;
}

.efficiency-display.bonus {
  color: hsl(120, 60%, 55%);
}

@keyframes eff-warn {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Config (settings) button ── */
.config-btn {
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s, transform 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.config-btn:hover {
  background: var(--ui-surface-hover);
  opacity: 0.9;
  transform: rotate(30deg);
}

/* ── Privacy options button (shown when GDPR consent state is set) ── */
.privacy-btn {
  font-size: 16px;
  padding: 4px;
  border-radius: 8px;
  transition: opacity 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.privacy-btn:hover {
  opacity: 0.7;
}

/* ── Language picker ── */
.lang-picker {
  font-size: 11px;
  padding: 3px 4px;
  border-radius: 6px;
  background: var(--ui-surface);
  color: var(--ui-text-dim);
  border: 1px solid var(--ui-border);
  cursor: pointer;
  margin-right: 6px;
  appearance: none;
  -webkit-appearance: none;
}

.lang-picker:hover {
  color: var(--ui-text);
}

/* ── One-time upgrade items already owned ── */
.shop-item.owned {
  opacity: 0.55;
  pointer-events: none;
  border-color: hsl(120, 50%, 45%);
}

.shop-item.owned .shop-item__cost {
  color: hsl(120, 60%, 65%);
}

/* ── Shop tier-locked items ── */
.shop-item.tier-locked {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(1) blur(1px);
}

.shop-item.tier-locked .shop-item__icon { visibility: hidden; }
.shop-item.tier-locked .shop-item__icon::after { content: '?'; visibility: visible; font-size: 20px; }
.shop-item.tier-locked .shop-item__name { color: var(--ui-text-dim); }
.shop-item.tier-locked .shop-item__desc { visibility: hidden; }
.shop-item.tier-locked .shop-item__cost { visibility: hidden; }

/* ── Notice banner (system / meta messages, not pet reactions) ── */
.notice-banner {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: hsla(230, 30%, 14%, 0.92);
  border: 1px solid hsla(220, 70%, 60%, 0.45);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: hsl(220, 70%, 85%);
  white-space: nowrap;
  max-width: calc(var(--scene-width) - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  z-index: 25;
  box-shadow: 0 4px 12px hsla(0, 0%, 0%, 0.35);
}

.notice-banner.visible {
  animation: notice-slide 3.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes notice-slide {
  0%   { opacity: 0; transform: translateX(-50%) translateY(24px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  85%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(24px); }
}

.notice-banner__icon {
  font-size: 13px;
}

/* ── Milestone banner ── */
.milestone-banner {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  max-width: calc(var(--scene-width) - 32px);
  background: linear-gradient(135deg, hsl(45, 80%, 15%) 0%, hsl(35, 60%, 20%) 100%);
  border: 2px solid hsl(45, 100%, 55%);
  border-radius: 12px;
  box-shadow:
    0 4px 20px hsla(45, 100%, 50%, 0.3),
    0 0 40px hsla(45, 100%, 60%, 0.15);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateX(120%);
  transition: none;
}

.milestone-banner.visible {
  animation: milestone-slide 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes milestone-slide {
  0%   { transform: translateX(120%); opacity: 0; }
  12%  { transform: translateX(0);     opacity: 1; }
  80%  { transform: translateX(0);     opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.milestone-banner__icon {
  font-size: 24px;
  animation: milestone-spin 0.6s ease-out;
}

@keyframes milestone-spin {
  0% { transform: rotate(0deg) scale(0.5); }
  60% { transform: rotate(380deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

.milestone-banner__content {
  min-width: 0;
}

.milestone-banner__label {
  font-size: 13px;
  font-weight: 800;
  color: hsl(45, 100%, 75%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-banner__desc {
  font-size: 10px;
  color: var(--ui-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-banner__reward {
  font-size: 11px;
  font-weight: 700;
  color: hsl(45, 100%, 65%);
}

/* ── Ascension button ── */
/* (ascend button removed — breeding replaces ascension) */

/* ── Ascension count in top bar ── */
.top-bar__ascension {
  font-size: 10px;
  color: hsl(280, 80%, 70%);
}

.top-bar__ascension:empty {
  display: none;
}

/* ── Generation badge in top bar ── */
.top-bar__generation {
  font-size: 10px;
  color: hsl(340, 80%, 70%);
}

.top-bar__generation:empty {
  display: none;
}

/* ══════════════════════════════════════════
   BREED BUTTON
   ══════════════════════════════════════════ */
.breed-btn {
  width: var(--scene-width);
  height: 52px;
  margin: 4px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, hsl(340, 60%, 20%) 0%, hsl(10, 50%, 25%) 100%);
  border: 2px solid hsl(340, 80%, 60%);
  border-radius: 14px;
  color: hsl(340, 100%, 85%);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.breed-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, hsla(340, 80%, 60%, 0.15) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: breed-shimmer 2.5s linear infinite;
}

@keyframes breed-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.breed-btn:hover {
  border-color: hsl(340, 100%, 70%);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px hsla(340, 80%, 50%, 0.4);
}

.breed-btn:active {
  transform: translateY(1px) scale(0.98);
}

.breed-btn__icon {
  font-size: 22px;
}

.breed-btn__desc {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
}

/* ══════════════════════════════════════════
   BREED ENCOUNTER ANIMATION
   ══════════════════════════════════════════ */

/* Partner pet (cloned into scene during breed animation) */
.breed-partner {
  pointer-events: none;
  z-index: 5;
}

.breed-partner .pet-body {
  transform: scaleX(-1); /* face the other direction */
}

/* During breed: slide the original pet left, partner slides in from right.
   !important needed to override the .pet.stage-* transform rules. */
.pet.breed-slide-left {
  animation: breed-slide-left 0.8s ease-out forwards !important;
}

.breed-partner.breed-slide-right {
  animation: breed-slide-right 0.8s ease-out forwards !important;
}

@keyframes breed-slide-left {
  0%   { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-120%) translateY(0); }
}

@keyframes breed-slide-right {
  0%   { opacity: 0; transform: translateX(80%) translateY(0) scale(0.3); }
  40%  { opacity: 1; transform: translateX(30%) translateY(0) scale(1); }
  100% { opacity: 1; transform: translateX(20%) translateY(0); }
}

/* Hop toward each other */
.pet.breed-hop {
  animation: breed-hop-left 0.5s ease-in-out 3 !important;
}

.breed-partner.breed-hop {
  animation: breed-hop-right 0.5s ease-in-out 3 !important;
}

@keyframes breed-hop-left {
  0%, 100% { transform: translateX(-120%) translateY(0); }
  50%      { transform: translateX(-100%) translateY(-15px); }
}

@keyframes breed-hop-right {
  0%, 100% { transform: translateX(20%) translateY(0); }
  50%      { transform: translateX(0%) translateY(-15px); }
}

/* Hearts container */
.breed-hearts {
  position: absolute;
  left: 50%;
  bottom: 45%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

.breed-heart {
  position: absolute;
  font-size: 20px;
  opacity: 0;
  animation: breed-heart-rise 1.2s ease-out forwards;
}

@keyframes breed-heart-rise {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  20%  { opacity: 1; transform: translateY(-8px) scale(1); }
  80%  { opacity: 1; transform: translateY(-40px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-55px) scale(0.8); }
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-height: 700px) {
  :root {
    --scene-height: min(380px, 48vh);
  }
  .stats { padding: 4px 16px; gap: 4px 14px; }
  .actions { padding: 4px 16px; }
}

@media (max-height: 550px) {
  :root {
    --scene-height: min(300px, 42vh);
  }
}

@media (max-width: 480px) {
  :root {
    --scene-height: min(340px, 42vh);
  }

  .game {
    padding-bottom: 0;
  }

  .pet-btn {
    height: 40px;
    font-size: 16px;
  }

  .shop-toggle-btn {
    min-height: 46px;
    font-size: 14px;
  }

  /* Keep two compact columns even on narrow screens. */
  .shop__grid {
    gap: 6px;
  }

  .shop-item {
    padding: 6px 8px;
    gap: 6px;
  }

  .shop-item__icon {
    font-size: 18px;
  }

  .shop-item__name { font-size: 10px; }
  .shop-item__desc { font-size: 9px; }
  .shop-item__cost { font-size: 10px; }
}

/* ══════════════════════════════════════════
   EVOLUTION HISTORY (top-bar button + modal)
   ══════════════════════════════════════════ */
.evo-history-btn {
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.evo-history-btn:hover {
  background: var(--ui-surface-hover);
  opacity: 0.9;
}

.evo-history-overlay {
  position: fixed;
  inset: 0;
  background: hsla(230, 30%, 8%, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.evo-history-overlay.open {
  display: flex;
  animation: evo-history-fade 0.18s ease-out;
}

@keyframes evo-history-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.evo-history-modal {
  width: min(360px, 100%);
  max-height: 80vh;
  background: hsl(230, 22%, 16%);
  border: 1px solid hsl(280, 50%, 45%);
  border-radius: 16px;
  padding: 14px 16px 16px;
  box-shadow: 0 12px 40px hsla(0, 0%, 0%, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.evo-history-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.evo-history-modal__title {
  font-size: 14px;
  font-weight: 800;
  color: hsl(280, 70%, 80%);
  letter-spacing: 0.3px;
}

.evo-history-modal__close {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  font-size: 18px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}

.evo-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evo-history-item {
  display: grid;
  grid-template-columns: 22px 28px 1fr auto;
  grid-template-areas:
    "idx icon name xp"
    ".   muts muts muts";
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  background: hsla(230, 18%, 22%, 0.7);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ui-text);
}

.evo-history-item__index { grid-area: idx; }
.evo-history-item__icon  { grid-area: icon; }
.evo-history-item__name  { grid-area: name; }
.evo-history-item__xp    { grid-area: xp; }

.evo-history-item__muts {
  grid-area: muts;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
}

.evo-history-item__mut {
  font-size: 14px;
  line-height: 1;
  background: hsla(180, 40%, 30%, 0.5);
  border: 1px solid hsla(180, 50%, 50%, 0.25);
  border-radius: 6px;
  padding: 3px 5px;
  filter: drop-shadow(0 1px 1px hsla(0, 0%, 0%, 0.4));
}

.evo-history-item__index {
  font-size: 11px;
  font-weight: 700;
  color: var(--ui-text-dim);
  text-align: center;
}

.evo-history-item__icon {
  font-size: 22px;
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 1px 2px hsla(0, 0%, 0%, 0.45));
}

.evo-history-item__name {
  font-weight: 800;
  font-size: 14px;
  text-transform: capitalize;
  color: hsl(45, 100%, 88%);
  letter-spacing: 0.2px;
}

.evo-history-item__xp {
  font-size: 10px;
  color: hsl(280, 60%, 75%);
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.evo-history-item.current {
  border-color: hsl(280, 70%, 60%);
  background: hsla(280, 50%, 25%, 0.4);
  box-shadow: 0 0 12px hsla(280, 70%, 50%, 0.25);
}

.evo-history-item.current .evo-history-item__name {
  color: hsl(280, 80%, 85%);
}

.evo-history-item.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.evo-history-item.locked .evo-history-item__name::after {
  content: ' 🔒';
  font-size: 10px;
}

/* Scene-anchored next-evo pill (replaces the inline pending-mutations bar). */
.pending-mutations--scene {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 22;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding: 6px 8px;
  background: hsla(230, 30%, 14%, 0.78);
  border: 1px solid hsla(180, 60%, 55%, 0.4);
  border-radius: 10px;
  max-width: 45%;
  box-shadow: 0 4px 12px hsla(0, 0%, 0%, 0.35);
}

.pending-mutations--scene:empty {
  display: none;
}

.pending-mutations--scene .pending-label {
  font-size: 10px;
  color: hsl(180, 60%, 75%);
  letter-spacing: 0.2px;
}

.pending-mutations--scene .pending-mutation-icon {
  font-size: 14px;
}

/* ══════════════════════════════════════════
   CONFIG MODAL (settings menu)
   ══════════════════════════════════════════ */
.config-overlay {
  position: fixed;
  inset: 0;
  background: hsla(230, 30%, 8%, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.config-overlay.open {
  display: flex;
  animation: evo-history-fade 0.18s ease-out;
}

.config-modal {
  width: min(360px, 100%);
  background: hsl(230, 22%, 16%);
  border: 1px solid hsl(280, 50%, 45%);
  border-radius: 16px;
  padding: 14px 16px 16px;
  box-shadow: 0 12px 40px hsla(0, 0%, 0%, 0.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.config-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.config-modal__title {
  font-size: 14px;
  font-weight: 800;
  color: hsl(280, 70%, 80%);
  letter-spacing: 0.3px;
}

.config-modal__close {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  font-size: 18px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}

.config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: hsla(230, 18%, 22%, 0.7);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
}

.config-row__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-text);
}

.config-row__icon {
  font-size: 16px;
  line-height: 1;
}

.config-row--danger {
  border-color: hsla(0, 60%, 55%, 0.45);
  background: hsla(0, 40%, 22%, 0.45);
}

.config-row--danger .config-row__label {
  color: hsl(10, 80%, 80%);
}

.config-toggle {
  position: relative;
  background: hsl(230, 18%, 12%);
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  border-radius: 999px;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  width: 84px;
  user-select: none;
}

.config-toggle__on,
.config-toggle__off {
  flex: 1;
  text-align: center;
  padding: 4px 6px;
  border-radius: 999px;
  transition: background 0.18s, color 0.18s;
  color: var(--ui-text-dim);
}

.config-toggle[aria-pressed="true"] .config-toggle__on {
  background: hsl(140, 55%, 40%);
  color: hsl(0, 0%, 100%);
}

.config-toggle[aria-pressed="false"] .config-toggle__off {
  background: hsl(0, 55%, 45%);
  color: hsl(0, 0%, 100%);
}

.config-lang-picker {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 8px;
  background: hsl(230, 18%, 12%);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  margin-right: 0;
}

.config-lang-picker:hover {
  color: var(--ui-text);
}

.config-danger-btn {
  background: hsl(0, 60%, 38%);
  border: 1px solid hsl(0, 70%, 55%);
  color: hsl(0, 0%, 100%);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.config-danger-btn:hover {
  background: hsl(0, 65%, 45%);
}

.config-danger-btn:active {
  transform: scale(0.97);
}

/* ══════════════════════════════════════════
   RESET CONFIRMATION (big-fat-warning) MODAL
   ══════════════════════════════════════════ */
.reset-confirm-overlay {
  position: fixed;
  inset: 0;
  background: hsla(0, 60%, 5%, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 16px;
  backdrop-filter: blur(6px);
}

.reset-confirm-overlay.open {
  display: flex;
  animation: evo-history-fade 0.2s ease-out;
}

.reset-confirm-modal {
  width: min(360px, 100%);
  background: hsl(0, 30%, 14%);
  border: 2px solid hsl(0, 75%, 55%);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 0 0 4px hsla(0, 80%, 50%, 0.18), 0 16px 50px hsla(0, 0%, 0%, 0.7);
  text-align: center;
  animation: reset-shake 0.45s ease-out;
}

@keyframes reset-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.reset-confirm-modal__icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px hsla(40, 100%, 60%, 0.7));
  animation: reset-pulse 1.4s ease-in-out infinite;
}

@keyframes reset-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

.reset-confirm-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: hsl(0, 90%, 80%);
  letter-spacing: 0.4px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.reset-confirm-modal__desc {
  font-size: 13px;
  color: hsl(20, 50%, 88%);
  line-height: 1.45;
  margin-bottom: 18px;
}

.reset-confirm-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.reset-confirm-modal__cancel,
.reset-confirm-modal__confirm {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--ui-border);
  transition: background 0.15s, transform 0.1s;
}

.reset-confirm-modal__cancel {
  background: hsl(230, 18%, 24%);
  color: var(--ui-text);
}

.reset-confirm-modal__cancel:hover {
  background: hsl(230, 18%, 30%);
}

.reset-confirm-modal__confirm {
  background: hsl(0, 70%, 42%);
  border-color: hsl(0, 80%, 60%);
  color: hsl(0, 0%, 100%);
}

.reset-confirm-modal__confirm:hover {
  background: hsl(0, 75%, 50%);
}

.reset-confirm-modal__cancel:active,
.reset-confirm-modal__confirm:active {
  transform: scale(0.97);
}

/* ══════════════════════════════════════════
   DEATH OVERLAY — persistent state while pet.isDead
   ══════════════════════════════════════════ */
.death-overlay {
  position: fixed;
  inset: 0;
  background: hsla(230, 40%, 4%, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  /* Below the reset-confirm modal (z-index 250) so the confirmation can
     stack above it when the player taps Start over. */
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(6px);
}

.death-overlay.open {
  display: flex;
  animation: evo-history-fade 0.4s ease-out;
}

.death-modal {
  width: min(360px, 100%);
  background: hsl(230, 25%, 12%);
  border: 2px solid hsl(230, 30%, 35%);
  border-radius: 16px;
  padding: 26px 20px 20px;
  box-shadow: 0 0 0 4px hsla(230, 40%, 30%, 0.25), 0 16px 50px hsla(0, 0%, 0%, 0.7);
  text-align: center;
}

.death-modal__icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 16px hsla(0, 80%, 55%, 0.5));
  animation: death-icon-float 3.2s ease-in-out infinite;
}

@keyframes death-icon-float {
  0%, 100% { transform: translateY(0); opacity: 0.95; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

.death-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: hsl(220, 35%, 88%);
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.death-modal__desc {
  font-size: 13px;
  color: hsl(220, 20%, 78%);
  line-height: 1.5;
  margin-bottom: 20px;
  font-style: italic;
}

.death-modal__actions {
  display: flex;
  justify-content: center;
}

.death-modal__start-over {
  flex: 0 1 auto;
  min-width: 160px;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid hsl(150, 50%, 50%);
  background: hsl(150, 55%, 35%);
  color: hsl(0, 0%, 100%);
  transition: background 0.15s, transform 0.1s;
}

.death-modal__start-over:hover {
  background: hsl(150, 60%, 42%);
}

.death-modal__start-over:active {
  transform: scale(0.97);
}
