/* ============================================================
   PARA EMILY · estilos generales (mobile-first)
   ============================================================ */
:root {
  --bg1: #fdf4f9;
  --bg2: #f6e9f7;
  --bg3: #ffeae2;
  --pink: #f3a8ca;         /* rosa pastel */
  --pink-deep: #e186ac;    /* acento (dusty rose) */
  --rose: #ffc6dd;
  --rose-soft: #ffe2ee;
  --lilac: #dcc9f6;
  --lilac-deep: #bda4ec;
  --peach: #ffd7c4;
  --mint: #c2e9d3;
  --wine: #b16f88;         /* cera rosa-vino pastel */
  --wine-2: #9a5a72;
  --ink: #7d5a6e;          /* malva apagado (texto) */
  --ink-soft: #ab8aa0;
  --cream: #fffaf6;
  --card: rgba(255, 255, 255, 0.68);
  --serif: "Playfair Display", Georgia, serif;
  --script: "Dancing Script", cursive;
  --sans: "Quicksand", system-ui, -apple-system, sans-serif;
  --tab-h: 62px;
  --tab-gap-b: 14px;
  --shadow: 0 12px 30px rgba(190, 130, 165, 0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}
body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg1), var(--bg2) 52%, #efe4fb);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================ APP / VIEWS ============================ */
.app {
  position: relative;
  flex: 1;
  overflow: hidden;
}
.view {
  position: absolute;
  inset: 0;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .38s ease, transform .38s ease, visibility .38s;
}
.view.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.view--inicio { padding: 0; overflow: hidden; }

/* títulos de sección */
.section-title {
  font-family: var(--script);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--pink-deep);
  text-align: center;
  line-height: 1;
  margin-top: 6px;
}
.section-hint {
  text-align: center;
  color: var(--ink-soft);
  font-size: .92rem;
  margin: 6px 0 18px;
}

/* ============================ HERO (INICIO) ============================ */
.hero-text {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 6vh);
  left: 0; right: 0;
  text-align: center;
  z-index: 9;
  pointer-events: none;
  padding: 0 20px;
}
.hero-text__hi {
  font-family: var(--sans);
  color: var(--ink-soft);
  letter-spacing: 3px;
  text-transform: lowercase;
  font-size: 1rem;
  opacity: .95;
}
.hero-text__name {
  font-family: var(--script);
  font-size: 4.4rem;
  font-weight: 700;
  color: #d0729c;
  line-height: 1;
  text-shadow: 0 2px 22px rgba(255, 255, 255, 0.85), 0 2px 8px rgba(255, 175, 205, 0.7);
}
.hero-text__sub {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: .98rem;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.6);
}

/* ============================ TABBAR (flotante) ============================ */
.tabbar {
  display: flex;
  align-items: stretch;
  height: var(--tab-h);
  margin: 0 16px calc(var(--tab-gap-b) + env(safe-area-inset-bottom));
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 14px 34px rgba(190, 100, 150, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  z-index: 40;
}
.tab {
  position: relative;
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s, transform .2s;
}
.tab__ico {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  opacity: .75;
  transition: transform .25s, opacity .25s;
}
.tab__ico .ic { width: 100%; height: 100%; position: relative; z-index: 1; }
.tab__ico::before {
  content: "";
  position: absolute;
  inset: -8px -14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(243, 166, 203, .28), rgba(195, 167, 238, .28));
  opacity: 0;
  transform: scale(.7);
  transition: opacity .25s, transform .25s;
}
.tab.is-active { color: var(--pink-deep); }
.tab.is-active .tab__ico { transform: translateY(-1px); opacity: 1; }
.tab.is-active .tab__ico::before { opacity: 1; transform: scale(1); }
.tab:active .tab__ico { transform: scale(.9); }

/* ============================ BOTONES ============================ */
.btn {
  border: none;
  border-radius: 999px;
  padding: 13px 24px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #f3a6cb, #c3a7ee);
  box-shadow: 0 8px 18px rgba(205, 140, 185, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn:active { transform: scale(.95); box-shadow: 0 4px 10px rgba(205, 140, 185, 0.3); }
.btn--ghost {
  background: #fff;
  color: var(--pink-deep);
  box-shadow: inset 0 0 0 2px var(--rose-soft), 0 6px 14px rgba(210, 140, 180, 0.14);
}
.btn--big { padding: 16px 30px; font-size: 1.08rem; width: 100%; max-width: 340px; }
.btn__ico { display: inline-flex; width: 19px; height: 19px; }
.btn__ico .ic { width: 100%; height: 100%; }

/* ============================ CARTA ============================ */
.carta-wrap {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60vh;
}

/* --- sobre cerrado --- */
.sobre {
  position: relative;
  width: min(80vw, 330px);
  aspect-ratio: 7 / 5;
  margin-top: 12px;
  border-radius: 12px;
  cursor: pointer;
  overflow: visible;
  transition: opacity .5s ease, transform .5s ease, max-height .6s ease .3s, margin .6s ease .3s;
  filter: drop-shadow(0 16px 26px rgba(160, 40, 90, 0.35));
}
.sobre__papel {
  position: absolute; inset: 0;
  border-radius: 12px;
  background:
    linear-gradient(160deg, #ffe4f0, #ffc9e0 55%, #ffb6d5);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.sobre__papel::after {
  /* solapas inferiores en V */
  content: "";
  position: absolute; inset: 0;
  border-radius: 12px;
  background:
    linear-gradient(to bottom right, transparent 49.5%, rgba(255,255,255,.22) 50%),
    linear-gradient(to bottom left, transparent 49.5%, rgba(160,40,90,.10) 50%);
}
.sobre__flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 62%;
  background: linear-gradient(160deg, #ffd0e6, #ff9ec8);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 8px rgba(160, 40, 90, 0.12);
  transform-origin: top center;
  transition: transform .6s ease;
  z-index: 3;
}

/* --- sello de cera --- */
.wax {
  position: absolute;
  top: 50%; left: 50%;
  width: 33%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 5;
  filter: drop-shadow(0 4px 5px rgba(70, 10, 30, 0.5));
}
.wax__half {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background:
    radial-gradient(circle at 40% 32%, rgba(255,255,255,0.4), transparent 45%),
    radial-gradient(circle at 60% 70%, var(--wine-2), var(--wine));
  transition: transform .1s;
}
.wax__half--l { left: 0;  border-radius: 50% 6% 6% 50% / 50% 6% 6% 50%; }
.wax__half--r { right: 0; border-radius: 6% 50% 50% 6% / 6% 50% 50% 6%; }
/* borde ondulado del lacre */
.wax::before {
  content: "";
  position: absolute; inset: -6%;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--wine) 0deg 12deg, var(--wine-2) 12deg 24deg);
  z-index: -1;
  opacity: .9;
}
.wax__emblem {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--serif);
  font-weight: 600;
  color: #ffd7c9;
  font-size: 1.05rem;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
  z-index: 2;
  transition: opacity .3s, transform .3s;
}
.wax__emblem i { color: #ff9ab0; font-style: normal; font-size: .8em; }

/* pista pulso */
.sobre::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 33%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(124, 29, 58, 0.5);
  animation: seal-pulse 2.2s ease-out infinite;
  z-index: 1;
  pointer-events: none;
}
@keyframes seal-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 130, 175, 0.55); }
  70%  { box-shadow: 0 0 0 22px rgba(255, 130, 175, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 130, 175, 0); }
}

/* rotura del sello */
.wax.is-broken .wax__emblem { opacity: 0; transform: scale(.5); }
.wax.is-broken .wax__half--l { animation: shard-l .8s cubic-bezier(.3,.6,.4,1) forwards; }
.wax.is-broken .wax__half--r { animation: shard-r .8s cubic-bezier(.3,.6,.4,1) forwards; }
.wax.is-broken::before { animation: shard-fade .8s forwards; }
@keyframes shard-l { to { transform: translate(-40px, 60px) rotate(-70deg); opacity: 0; } }
@keyframes shard-r { to { transform: translate(40px, 60px) rotate(70deg); opacity: 0; } }
@keyframes shard-fade { to { opacity: 0; transform: scale(1.3); } }

.wax-shards { position: absolute; top: 50%; left: 50%; z-index: 6; pointer-events: none; }
.wax-shards i {
  position: absolute;
  width: 7px; height: 7px;
  background: var(--wine);
  border-radius: 40%;
}

/* solapa abriéndose y sobre que se colapsa */
#view-carta.is-open .sobre {
  opacity: 0;
  transform: scale(.86) translateY(-10px);
  pointer-events: none;
  max-height: 0;
  margin: 0;
  overflow: hidden;
}
#view-carta.is-open .sobre__flap { transform: rotateX(-165deg); }

/* --- carta desplegada --- */
.carta {
  width: 100%;
  max-width: 400px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .8s ease, opacity .6s ease .2s;
}
#view-carta.is-open .carta {
  max-height: 220vh;
  opacity: 1;
}
.carta__papel {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(190,120,150,.05) 0 27px, transparent 27px 28px),
    linear-gradient(160deg, #fffaf3, #fff2e6 70%, #ffe9d8);
  border-radius: 8px;
  padding: 26px 22px 20px;
  box-shadow: var(--shadow), inset 0 0 40px rgba(210, 150, 120, 0.12);
  border: 1px solid rgba(210, 150, 120, 0.3);
  transform-origin: top center;
  animation: carta-unfold .9s ease .15s backwards;
}
#view-carta.is-open .carta__papel { animation-play-state: running; }
@keyframes carta-unfold {
  0%   { transform: scaleY(.2) rotateX(28deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.carta__papel::before {
  /* borde deckle sutil */
  content: "";
  position: absolute; inset: 6px;
  border: 1px dashed rgba(200, 130, 100, 0.35);
  border-radius: 5px;
  pointer-events: none;
}
.carta__texto {
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.75;
  color: #5c3324;
  white-space: pre-wrap;
  min-height: 40px;
}
.carta__texto .firma {
  display: block;
  margin-top: 12px;
  font-family: var(--script);
  font-size: 1.7rem;
  color: var(--wine);
  text-align: right;
}
.carta__acciones {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* loader carta */
.carta__loader { display: none; text-align: center; padding: 14px 0; color: var(--ink-soft); }
.carta__loader.is-on { display: block; }
.carta__loader span {
  display: inline-block;
  width: 9px; height: 9px; margin: 0 3px;
  border-radius: 50%;
  background: var(--pink);
  animation: dot 1s infinite ease-in-out;
}
.carta__loader span:nth-child(2) { animation-delay: .15s; }
.carta__loader span:nth-child(3) { animation-delay: .3s; }
.carta__loader p { margin-top: 8px; font-family: var(--script); font-size: 1.25rem; }
@keyframes dot { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-7px); opacity: 1; } }

/* ============================ MICHI ============================ */
.michi-wrap {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.michi-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}
.racha {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fff, #ffe9f3);
  padding: 8px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,150,195,.4);
}
.racha__fuego { font-size: 1.6rem; animation: flame 1.4s ease-in-out infinite; }
@keyframes flame { 0%,100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.14) rotate(3deg); } }
.racha__num { font-family: var(--script); font-size: 2.1rem; font-weight: 700; color: var(--pink-deep); line-height: 1; }
.racha__label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.michi-name { font-family: var(--script); font-size: 1.7rem; color: var(--pink-deep); margin-top: 6px; }
.racha__record { font-size: .78rem; color: var(--ink-soft); }

.michi-stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 6px 0 2px;
}
.michi-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: visible; }
.michi {
  width: min(60vw, 250px);
  cursor: pointer;
  user-select: none;
}
.michi .cat { width: 100%; height: auto; display: block; overflow: visible; }

/* animaciones idle del gato */
.cat__body, .cat__head { transform-box: fill-box; }
.michi { animation: michi-breathe 3.4s ease-in-out infinite; transform-origin: bottom center; }
@keyframes michi-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-4px) scale(1.012); }
}
.cat__tail { transform-box: fill-box; transform-origin: 8% 92%; animation: tail-wag 2.6s ease-in-out infinite; }
@keyframes tail-wag {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(10deg); }
}
.cat__eye { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
@keyframes blink {
  0%, 90%, 100% { transform: scaleY(1); }
  93%, 95%      { transform: scaleY(.08); }
}
.cat__ear--r { transform-box: fill-box; transform-origin: bottom center; animation: ear-twitch 6s ease-in-out infinite; }
@keyframes ear-twitch { 0%,88%,100% { transform: rotate(0); } 92% { transform: rotate(-9deg); } 96% { transform: rotate(3deg); } }
.cat__lid { display: none; }
.cat__eye-happy { opacity: 0; }

/* estado feliz (durante reacciones) */
.michi.is-happy .cat__eye { opacity: 0; }
.michi.is-happy .cat__eye-happy { opacity: 1; }
.michi.is-happy .cat__cheek { opacity: 1; }
.cat__cheek { transition: opacity .3s; }

/* rebote de reacción */
.michi.react { animation: michi-bounce .6s ease; }
@keyframes michi-bounce {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-16px) scale(1.06, .96); }
  55% { transform: translateY(2px) scale(.97, 1.03); }
  100% { transform: translateY(0) scale(1); }
}
.michi.wiggle { animation: michi-wiggle .6s ease; }
@keyframes michi-wiggle {
  0%,100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); }
}

/* fx flotantes */
.fx-item {
  position: absolute;
  left: 50%;
  bottom: 40%;
  width: 34px;
  height: 34px;
  pointer-events: none;
  animation: fx-float 1.3s ease-out forwards;
}
.fx-item svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 3px rgba(200,120,160,.3)); }
@keyframes fx-float {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -120px) scale(1.2); }
}

/* barras de stats */
.michi-stats {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 6px;
}
.stat__top { display: flex; justify-content: space-between; font-size: .84rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.bar {
  height: 12px;
  background: #ffe0ee;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(180,60,110,.18);
}
.bar__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width .5s ease;
}
.bar__fill--food { background: linear-gradient(90deg, #ffb14e, #ff7eb0); }
.bar__fill--love { background: linear-gradient(90deg, #ff7eb0, #ff4f8f); }

/* acciones */
.michi-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  margin-top: 10px;
}
.act {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: 12px 4px;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: .8rem;
  color: var(--pink-deep);
  cursor: pointer;
  transition: transform .15s;
}
.act:active { transform: scale(.93); }
.act__ico { font-size: 1.7rem; }
.act:disabled { opacity: .45; }
.michi-tip {
  text-align: center;
  font-size: .82rem;
  color: var(--ink-soft);
  margin-top: 14px;
  max-width: 320px;
}

/* ============================ FONDO ============================ */
.fondo-wrap {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fondo-sel {
  display: flex;
  gap: 6px;
  background: #fff;
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.fondo-sel__opt {
  border: none;
  background: transparent;
  padding: 8px 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: .88rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.fondo-sel__opt.is-active {
  background: linear-gradient(135deg, #f3a6cb, #c3a7ee);
  color: #fff;
  box-shadow: 0 4px 10px rgba(205, 140, 185, .35);
}

.fondo-preview {
  width: min(58vw, 240px);
  aspect-ratio: 1206 / 2622;
  border-radius: 34px;
  overflow: hidden;
  position: relative;
  border: 6px solid #2a1420;
  box-shadow: var(--shadow), 0 0 0 2px rgba(255,255,255,.2) inset;
  margin: 8px 0 22px;
  background: #ffd6e8;
}
.fondo-preview::before {
  /* isla dinámica */
  content: "";
  position: absolute;
  top: 10px; left: 50%;
  width: 30%; height: 14px;
  transform: translateX(-50%);
  background: #14060d;
  border-radius: 999px;
  z-index: 3;
}
.fondo-preview svg, .fondo-preview img, .fondo-preview video { width: 100%; height: 100%; display: block; object-fit: cover; }
.fondo-help { font-size: .8rem; color: var(--ink-soft); text-align: center; margin-top: 14px; max-width: 300px; }
/* ============================ VISOR ============================ */
.visor {
  position: fixed;
  inset: 0;
  background: rgba(30, 6, 18, 0.92);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.visor.is-on { display: flex; }
.visor img {
  max-width: 82%;
  max-height: 74vh;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.visor__hint { color: #ffd9ec; font-size: .9rem; text-align: center; }
.visor__close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  right: 18px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ============================ HELPERS ============================ */
.preload .view--inicio { opacity: 1; visibility: visible; transform: none; }

@media (min-width: 620px) {
  .hero-text__name { font-size: 5rem; }
}

/* ============================================================
   ÍCONOS SVG + COMPONENTES NUEVOS
   ============================================================ */
.ic { width: 100%; height: 100%; display: block; }

/* chip cartas guardadas */
.chip-guardadas {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto 14px;
  border: none;
  cursor: pointer;
  background: #fff;
  color: var(--pink-deep);
  padding: 7px 15px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: .82rem;
  box-shadow: 0 6px 14px rgba(210, 140, 180, .16);
  transition: transform .15s;
}
.chip-guardadas:active { transform: scale(.95); }
.chip-guardadas__ico { display: inline-flex; width: 16px; height: 16px; }
.chip-guardadas b {
  background: var(--rose-soft);
  color: var(--pink-deep);
  border-radius: 999px;
  padding: 0 7px;
  min-width: 20px;
  text-align: center;
}

/* michi header extra */
.michi-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.michi-sub b { color: var(--pink-deep); }
.michi-sub__dot { opacity: .5; }
.nivel {
  background: #fff;
  padding: 3px 11px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(210, 140, 180, .14);
  font-weight: 600;
}
.racha__fuego {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  color: #f2955f;
  animation: flame 1.4s ease-in-out infinite;
}

/* íconos en stats y acciones */
.stat__name { display: inline-flex; align-items: center; gap: 6px; }
.stat__ico { display: inline-flex; width: 17px; height: 17px; }
.michi-stats .stat:nth-child(1) .stat__ico { color: #efa25c; }
.michi-stats .stat:nth-child(2) .stat__ico { color: #ee81a9; }
.michi-stats .stat:nth-child(3) .stat__ico { color: #b298e6; }
.bar__fill--energy { background: linear-gradient(90deg, #cbb6f2, #f3a8cd); }
.act__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  color: var(--pink-deep);
  font-size: 0;
}

/* ============================ ESTADOS DE ÁNIMO DEL GATO ============================ */
.cat__brow, .cat__mouth-sad, .cat__tear, .cat__zzz { opacity: 0; transition: opacity .35s; }
.cat__tear { transform-box: fill-box; }

.michi.is-sad .cat__brow { opacity: 1; }
.michi.is-sad .cat__mouth-sad { opacity: 1; }
.michi.is-sad .cat__mouth { opacity: 0; }
.michi.is-sad .cat__tear { opacity: .9; animation: tear-drop 2.4s ease-in infinite; }
.michi.is-sad .cat__eye { animation: none; transform: scaleY(.55) translateY(4px); transform-origin: center; }
.michi.is-sad .cat__cheek { opacity: .35; }

.michi.is-sleepy .cat__eye { opacity: 0; }
.michi.is-sleepy .cat__eye-happy { opacity: 1; }
.michi.is-sleepy .cat__zzz { opacity: 1; animation: zzz 3.2s ease-in-out infinite; }

@keyframes tear-drop {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: .9; }
  100% { transform: translateY(30px); opacity: 0; }
}
@keyframes zzz {
  0%, 100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* ============================ MANITO QUE ACARICIA ============================ */
.pet-hand {
  position: absolute;
  top: 6%;
  left: 50%;
  width: 74px;
  height: 74px;
  margin-left: -37px;
  z-index: 7;
  pointer-events: none;
  color: #f4b3cd;
  filter: drop-shadow(0 5px 6px rgba(180, 120, 150, .38));
}
.pet-hand svg { width: 100%; height: 100%; }
.michi.petting .cat__head {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  animation: head-nuzzle 1.7s ease-in-out;
}
@keyframes head-nuzzle {
  0%, 100% { transform: rotate(0) translateY(0); }
  20% { transform: rotate(-3.5deg) translateY(1px); }
  60% { transform: rotate(3.5deg) translateY(1px); }
}

/* ============================ HISTORIAL (hoja inferior) ============================ */
.hist {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(70, 40, 60, 0.42);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
}
.hist.is-on { display: flex; }
.hist__panel {
  width: 100%;
  max-height: 82vh;
  background: linear-gradient(180deg, #fff6fb, #ffeef6);
  border-radius: 26px 26px 0 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(180, 110, 150, .3);
  display: flex;
  flex-direction: column;
  animation: sheet-up .35s ease;
  transition: transform .3s cubic-bezier(.2,.7,.3,1);
}
@keyframes sheet-up { 0% { transform: translateY(100%); } }
.hist__grabber {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: rgba(177, 111, 136, .32);
  margin: 4px auto 10px;
  flex-shrink: 0;
}
.hist__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hist__head h3 { font-family: var(--script); font-size: 1.7rem; color: var(--pink-deep); }
.hist__close {
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: #fff; color: var(--ink-soft);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.hist__close .ic { width: 20px; height: 20px; }
.hist__list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.hist__item {
  text-align: left;
  border: none;
  cursor: pointer;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 6px 16px rgba(190, 130, 165, .14);
  border-left: 4px solid var(--pink);
  transition: transform .12s;
}
.hist__item:active { transform: scale(.98); }
.hist__item h4 { font-family: var(--serif); font-size: .92rem; color: var(--wine); margin-bottom: 4px; font-weight: 600; }
.hist__item p {
  font-size: .85rem; color: var(--ink-soft); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hist__empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; font-size: .9rem; line-height: 1.6; }

/* ============================ TOAST ============================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--tab-gap-b) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(18px);
  background: rgba(70, 40, 60, .92);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .cat__tail, .cat__eye, .cat__ear--r, .racha__fuego, .michi { animation: none !important; }
}

/* ============================ HERO VIDEO + CARGA PROGRESIVA ============================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app,
.tabbar {
  transition: opacity .38s ease;
}

body.preload .app,
body.preload .tabbar {
  opacity: 0;
  pointer-events: none;
}

.app-skeleton {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
  background: #f4dce9;
  opacity: 1;
  visibility: visible;
  transition: opacity .45s ease, visibility .45s ease;
}

.app-skeleton::before {
  content: "";
  position: absolute;
  inset: 0 0 calc(var(--tab-h) + var(--tab-gap-b) + env(safe-area-inset-bottom)) 0;
  background: #f4dce9 url("../assets/hero-tulips-poster.jpg") center center / cover no-repeat;
}

body:not(.preload) .app-skeleton {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-skeleton__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(250, 241, 255, .3), transparent 34%),
    linear-gradient(0deg, rgba(255, 240, 248, .46), transparent 32%);
}

.app-skeleton__title {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 7vh);
  left: 50%;
  width: min(58vw, 220px);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 10px;
}

.app-skeleton__title span,
.app-skeleton__title strong,
.app-skeleton__tabs i,
.fondo-preview:empty::before {
  background: linear-gradient(105deg, rgba(255,255,255,.36) 20%, rgba(255,255,255,.82) 42%, rgba(255,255,255,.36) 64%);
  background-size: 230% 100%;
  animation: emily-skeleton 1.35s ease-in-out infinite;
  box-shadow: 0 8px 24px rgba(183, 114, 155, .12);
}

.app-skeleton__title span {
  width: 44%;
  height: 10px;
  border-radius: 999px;
}

.app-skeleton__title strong {
  width: 88%;
  height: clamp(44px, 8vh, 64px);
  border-radius: 999px;
}

.app-skeleton__tabs {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  height: var(--tab-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.app-skeleton__tabs i {
  display: block;
  width: 70%;
  height: 30px;
  margin: auto;
  border-radius: 13px;
}

@keyframes emily-skeleton {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.view {
  contain: layout paint;
}

.view--inicio {
  position: fixed;
  inset: 0;
  z-index: 10;
  isolation: isolate;
  background: #f4dce9 url("../assets/hero-tulips-poster.jpg") center center / cover no-repeat;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #f4dce9 url("../assets/hero-tulips-poster.jpg") center center / cover no-repeat;
}

.hero-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  transform: scale(1.002);
  transition: opacity .65s ease;
}

.hero-video.is-ready {
  opacity: 1;
}

.hero-media__veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 246, 252, .18), transparent 34%),
    linear-gradient(0deg, rgba(255, 232, 241, .16), transparent 30%);
}

.hero-text {
  z-index: 2;
}

.fondo-preview:empty {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,.38);
}

.fondo-preview:empty::before {
  content: "";
  position: absolute;
  inset: 0;
}

@media (prefers-reduced-motion: reduce) {
  .app-skeleton__title span,
  .app-skeleton__title strong,
  .app-skeleton__tabs i,
  .fondo-preview:empty::before {
    animation: none;
  }

  .hero-video {
    display: none;
  }
}