:root {
  --tinta: #1f2a5a;
  --tinta-suave: #5260a0;
  --papel: #fffaf8;
  --boton: #ff3d9a;
  --boton-hover: #d61f78;
  --oro: #ffd24a;
  --azul: #3d7dff;
  --azul-claro: #7ec8ff;
  --morado: #7b3cff;
  --rosa: #ff5bb5;
  --ceramica: #f7fbff;
  --fondo-a: #eef4ff;
  --fondo-b: #d9c7ff;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Fredoka, "Segoe UI", sans-serif;
  color: var(--tinta);
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% 12%, #ffffff 0%, transparent 46%),
    radial-gradient(ellipse at 18% 86%, rgba(61, 125, 255, 0.22) 0%, transparent 34%),
    radial-gradient(ellipse at 86% 78%, rgba(255, 61, 154, 0.16) 0%, transparent 30%),
    linear-gradient(180deg, var(--fondo-a) 0%, var(--fondo-b) 100%);
}

.escenario {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding:
    max(28px, env(safe-area-inset-top))
    20px
    max(32px, env(safe-area-inset-bottom));
  text-align: center;
}

.ojo {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--boton);
}

.nombre {
  margin: 0;
  font-family: "Baloo 2", Fredoka, sans-serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 6.6vw, 2.55rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--tinta);
}

.nombre--logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2px 0 4px;
  max-width: min(72vw, 280px);
}

.nombre--logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(64px, 16vw, 96px);
  object-fit: contain;
}

.escena {
  position: relative;
  width: min(92vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
}

.retrete {
  position: relative;
  z-index: 2;
  width: min(88vw, 360px);
  aspect-ratio: 400 / 400;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  overflow: visible;
  perspective: 900px;
  animation: flotar 3.6s ease-in-out infinite;
}

.retrete:focus-visible {
  outline: 3px solid var(--boton);
  outline-offset: 8px;
  border-radius: 48px;
}

.retrete:disabled {
  cursor: default;
  opacity: 1;
}

.mandala {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 122%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 8deg,
    rgba(61, 125, 255, 0.18) 0deg 4deg,
    transparent 4deg 14deg
  );
  -webkit-mask-image: radial-gradient(
    circle,
    transparent 0%,
    transparent 18%,
    #000 38%,
    transparent 72%
  );
  mask-image: radial-gradient(
    circle,
    transparent 0%,
    transparent 18%,
    #000 38%,
    transparent 72%
  );
  pointer-events: none;
}

.escena-svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sombra {
  fill: rgba(31, 42, 90, 0.18);
}

.cisterna > rect {
  fill: url(#ceramica);
  stroke: #8eadd8;
  stroke-width: 2.6;
}

.cisterna-tapa {
  fill: #eef4ff;
  stroke: none;
}

.cenefa,
.cenefa-tapa {
  fill: none;
  stroke: var(--oro);
  stroke-width: 3.5;
  stroke-linecap: round;
}

.medallon,
.joya-oro {
  fill: none;
  stroke: var(--oro);
  stroke-width: 2.4;
}

.joya {
  fill: var(--rosa);
  stroke: #ffe27a;
  stroke-width: 1.5;
}

.tirador rect,
.tirador circle {
  fill: var(--oro);
  stroke: #e0a820;
  stroke-width: 1;
}

.agua {
  fill: #8fd6ff;
}

.agua-brillo {
  fill: #f3fffd;
  opacity: 0.8;
}

.chispa {
  fill: var(--oro);
  opacity: 0.85;
}

.taza,
.pedestal,
.base {
  fill: url(#ceramica);
  stroke: #8eadd8;
  stroke-width: 2.6;
}

.brillo-taza {
  fill: none;
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 6;
  stroke-linecap: round;
}

.asiento ellipse {
  fill: none;
  stroke: #eef4ff;
  stroke-width: 16;
}

.tapa ellipse {
  fill: url(#ceramica);
  stroke: var(--oro);
  stroke-width: 3.5;
}

.tapa .brillo-tapa {
  fill: #fff;
  stroke: none;
  opacity: 0.55;
}

.genio {
  opacity: 0;
  transform: translateY(64px);
}

.humo {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: translateY(12px) scale(0.8);
}

.asiento,
.tapa {
  transform-box: fill-box;
  transform-origin: 50% 0%;
  transform: rotateX(0deg);
}

.tapa-alzada {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: translateY(28px);
}

.tapa-alzada rect {
  fill: url(#ceramica);
  stroke: var(--oro);
  stroke-width: 3.5;
}

.dibujo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.dibujo-abierto {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.abierto .dibujo-cerrado {
  opacity: 0;
  transition: opacity 0.16s ease;
}

.abierto .dibujo-abierto {
  opacity: 1;
  transition: opacity 0.16s ease;
}

.papel {
  position: absolute;
  z-index: 5;
  left: -16%;
  right: auto;
  top: 2%;
  width: min(44%, 162px);
  visibility: hidden;
  margin: 0;
  padding: 9px 11px 10px;
  background: #fff;
  color: var(--tinta);
  border: 3px solid #1f2a5a;
  border-radius: 18px;
  box-shadow: 3px 4px 0 rgba(31, 42, 90, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.15);
  transform-origin: 100% 40%;
}

.papel::before,
.papel::after {
  content: "";
  position: absolute;
  box-sizing: content-box;
}

.papel::before {
  right: -14px;
  top: 34px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-right: 3px solid #1f2a5a;
  border-bottom: 3px solid #1f2a5a;
  border-radius: 0 0 3px 0;
  transform: rotate(-45deg);
}

.papel::after {
  right: -2px;
  top: 32px;
  width: 12px;
  height: 26px;
  background: #fff;
  border: 0;
}

.frase {
  margin: 0;
  font-family: Fredoka, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.25;
}

.puf {
  position: absolute;
  z-index: 6;
  left: 80%;
  top: 2%;
  font-family: "Baloo 2", Fredoka, sans-serif;
  font-weight: 800;
  font-size: clamp(2.3rem, 9vw, 3rem);
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  color: var(--boton);
  text-shadow:
    0 2px 0 #fff,
    0 6px 14px rgba(255, 61, 154, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-8deg) scale(0.4);
}

.ayuda {
  margin: 4px 0 0;
  min-height: 1.5em;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--tinta-suave);
  transition: opacity 0.25s ease;
}

.resena-hueco {
  display: grid;
  grid-template-rows: 0fr;
  width: min(92vw, 360px);
}

.resena {
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}

.resena h2 {
  margin: 8px 0 6px;
  font-family: "Baloo 2", Fredoka, sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.2;
}

.resena p {
  margin: 0;
  color: var(--tinta-suave);
  font-size: 0.98rem;
  line-height: 1.4;
}

.resena-gracias {
  margin-top: 10px;
  color: var(--tinta);
  font-family: "Baloo 2", Fredoka, sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
}

a.boton-google,
a.boton-google:link,
a.boton-google:visited {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  margin-top: 18px;
  padding: 10px 14px;
  border: 2px solid var(--tinta-suave);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  color: #202124;
  font-family: Roboto, Arial, Helvetica, sans-serif;
  text-align: left;
  text-decoration: none;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.12),
    0 4px 12px rgba(60, 64, 67, 0.08);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

a.boton-google .boton-google__marca {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e8eaed;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

a.boton-google .boton-google__marca svg {
  display: block;
  width: 22px;
  height: 22px;
}

a.boton-google .boton-google__cuerpo {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

a.boton-google .boton-google__estrellas {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

a.boton-google .boton-google__estrellas svg {
  width: 13px;
  height: 13px;
  fill: #fbbc04;
}

a.boton-google .boton-google__texto {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  color: #202124;
  text-decoration: none;
  white-space: nowrap;
}

a.boton-google:hover,
a.boton-google:focus-visible {
  background: #fff;
  border-color: var(--tinta);
  color: #202124;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(60, 64, 67, 0.12),
    0 8px 18px rgba(61, 125, 255, 0.18);
}

a.boton-google:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 3px;
}

a.boton-google:active {
  transform: translateY(0);
  background: #f8f9fa;
  color: #202124;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.compartir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--tinta);
  font: 600 0.98rem Fredoka, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.compartir svg {
  display: block;
  width: 18px;
  height: 18px;
}

.compartir:hover,
.compartir:focus-visible {
  color: var(--boton);
  transform: translateY(-1px);
}

.compartir:focus-visible {
  outline: 2px solid var(--boton);
  outline-offset: 3px;
  border-radius: 8px;
}

.compartir:active {
  transform: translateY(0);
}

.compartir:disabled {
  cursor: default;
  opacity: 0.6;
}

.abierto .genio {
  opacity: 1;
  transform: translateY(-28px);
  transition:
    transform 0.9s cubic-bezier(0.22, 0.8, 0.2, 1) 0.16s,
    opacity 0.35s ease 0.12s;
}

.abierto .humo {
  opacity: 1;
  transform: translateY(-8px) scale(1);
  transition:
    transform 0.8s ease 0.28s,
    opacity 0.45s ease 0.28s;
}

.abierto .asiento {
  opacity: 0;
  transform: rotateX(68deg);
  transition:
    transform 0.55s cubic-bezier(0.22, 0.8, 0.2, 1),
    opacity 0.3s ease 0.15s;
}

.abierto .tapa {
  opacity: 0;
  transform: rotateX(82deg);
  transition:
    transform 0.55s cubic-bezier(0.22, 0.8, 0.2, 1),
    opacity 0.35s ease 0.2s;
}

.abierto .tapa-alzada {
  opacity: 1;
  transform: translateY(0);
  transition:
    transform 0.65s cubic-bezier(0.22, 0.8, 0.2, 1) 0.05s,
    opacity 0.35s ease 0.08s;
}

.abierto .papel {
  visibility: visible;
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 0.25s ease 0.35s,
    transform 0.45s cubic-bezier(0.22, 0.9, 0.24, 1.2) 0.32s,
    visibility 0s linear 0.32s;
}

.abierto .puf {
  animation: estallar 4s ease forwards;
}

.abierto .chispas .chispa {
  animation: chispear 1.4s ease-out forwards;
}

.abierto .ayuda {
  opacity: 0;
}

.abierto .resena-hueco {
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s ease 0.45s;
}

.abierto .resena {
  visibility: visible;
  opacity: 1;
  transition:
    opacity 0.45s ease 0.7s,
    visibility 0s linear 0.7s;
}

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

@keyframes estallar {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-14deg) scale(0.35);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -56%) rotate(-6deg) scale(1.1);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-8deg) scale(1);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-8deg) scale(1);
  }
  100% {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -70%) rotate(-8deg) scale(0.92);
  }
}

@keyframes chispear {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  35% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .retrete {
    animation: none;
  }

  .genio,
  .humo,
  .asiento,
  .tapa,
  .tapa-alzada,
  .papel,
  .puf,
  .ayuda,
  .resena,
  .resena-hueco {
    transition: none;
  }

  .abierto .puf,
  .abierto .chispas .chispa {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
}

/* Clon fuera de pantalla: misma escena abierta, sin la animación a medias. */
.escenario.captura {
  position: fixed;
  left: -10000px;
  top: 0;
  box-sizing: content-box;
  width: 100vw;
  min-height: 0;
  height: auto;
  justify-content: flex-start;
  overflow: visible;
  padding: 28px 20px 36px;
  background:
    radial-gradient(ellipse at 50% 12%, #ffffff 0%, transparent 46%),
    radial-gradient(ellipse at 18% 86%, rgba(61, 125, 255, 0.22) 0%, transparent 34%),
    radial-gradient(ellipse at 86% 78%, rgba(255, 61, 154, 0.16) 0%, transparent 30%),
    linear-gradient(180deg, var(--fondo-a) 0%, var(--fondo-b) 100%);
  pointer-events: none;
}

.captura,
.captura * {
  transition: none !important;
  animation: none !important;
}

.captura .puf {
  opacity: 0 !important;
  visibility: hidden !important;
}

