:root {
  --tinta: #3c2415;
  --tinta-suave: #8a6240;
  --papel: #fffaf3;
  --boton: #8f3d2e;
  --boton-hover: #742f23;
  --fondo-a: #f8efe4;
  --fondo-b: #ead7be;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--tinta);
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% 18%, #fff8ee 0%, transparent 52%),
    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.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tinta-suave);
}

.nombre {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: clamp(1.7rem, 6vw, 2.15rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

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

.papel {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: min(48%, 176px);
  visibility: hidden;
  margin: 0;
  padding: 12px 14px;
  background: #fffdf8;
  color: var(--tinta);
  border-radius: 2px;
  box-shadow: 0 8px 16px rgba(80, 40, 16, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scaleX(0.08);
}

.frase {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.3;
}

.crac {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 6%;
  font-family: Fraunces, Georgia, serif;
  font-style: italic;
  font-weight: 560;
  font-size: clamp(2.2rem, 9vw, 2.9rem);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  color: var(--boton);
  text-shadow: 0 2px 0 rgba(255, 250, 243, 0.9);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-8deg) scale(0.4);
}

.galleta {
  position: relative;
  z-index: 2;
  width: min(84vw, 360px);
  aspect-ratio: 364 / 326;
  margin-top: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  overflow: visible;
  animation: flotar 3.4s ease-in-out infinite;
}

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

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

.entera,
.mitad {
  position: absolute;
  inset: 0;
}

.entera {
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 14px 8px rgba(106, 59, 22, 0.22));
}

.mitad {
  z-index: 2;
  opacity: 0;
  transition:
    transform 0.7s cubic-bezier(0.22, 0.8, 0.2, 1),
    opacity 0.2s ease;
}

.mitad-izq {
  transform-origin: 22% 78%;
}

.mitad-der {
  transform-origin: 78% 78%;
}

.mitad img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 14px 8px rgba(106, 59, 22, 0.22));
}

.rota .entera {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.12s ease,
    visibility 0s linear 0.12s;
}

.ayuda {
  margin: 4px 0 0;
  min-height: 1.5em;
  font-size: 1rem;
  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: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 560;
  line-height: 1.25;
}

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

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: 1px solid #e8eaed;
  border-radius: 14px;
  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: #d2e3fc;
  color: #202124;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(60, 64, 67, 0.12),
    0 8px 18px rgba(66, 133, 244, 0.14);
}

a.boton-google:focus-visible {
  outline: 2px solid #4285f4;
  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);
}

.rota .papel {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-1.5deg) scaleX(1);
  transition:
    opacity 0.35s ease 0.18s,
    transform 0.55s cubic-bezier(0.22, 0.8, 0.2, 1) 0.12s,
    visibility 0s linear 0.12s;
}

.rota .crac {
  animation: estallar 4s ease forwards;
}

.rota .mitad {
  opacity: 1;
}

.rota .mitad-izq {
  transform: translate(-78px, 18px) rotate(-16deg);
}

.rota .mitad-der {
  transform: translate(82px, 20px) rotate(18deg);
}

.rota .galleta {
  animation: none;
}

.rota .ayuda {
  opacity: 0;
}

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

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

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

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

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

  .mitad,
  .papel,
  .crac,
  .ayuda,
  .resena,
  .resena-hueco {
    transition: none;
  }

  .rota .crac {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
}
