/* vaisaflipar: pegatinas sobre un prado pastel. Móvil en vertical primero. */

:root {
  --tinta: #1d1d1f;
  --tinta-suave: #4a5260;
  --papel: #ffffff;
  --cielo: #bfe3ff;
  --rosa: #ffd6e8;
  --amarillo: #ffd400;
  --amarillo-oscuro: #f2c200;
  --linea: rgba(29, 29, 31, 0.12);
  --sombra-dura: 0 5px 0 var(--tinta);
  --radio: 22px;
  --fuente: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --margen: 16px;
  --abajo: max(16px, env(safe-area-inset-bottom));
  --arriba: max(12px, env(safe-area-inset-top));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--cielo);
  color: var(--tinta);
  font-family: var(--fuente);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.mundo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* --- Barra de arriba --- */

.barra {
  position: fixed;
  top: var(--arriba);
  left: var(--margen);
  right: var(--margen);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.logo {
  pointer-events: auto;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--tinta);
  text-decoration: none;
  background: var(--papel);
  padding: 6px 14px 7px;
  border-radius: 999px;
  border: 2.5px solid var(--tinta);
  box-shadow: 0 3px 0 var(--tinta);
}
.logo span { color: #ff4f8b; }
.aqui {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 12px;
  border-radius: 999px;
}
.aqui i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: latido 1.8s infinite;
}
@keyframes latido {
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* --- Cargando --- */

.cargando {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: linear-gradient(160deg, var(--cielo), var(--rosa));
  font-weight: 800;
  font-size: 18px;
  transition: opacity 0.5s;
  z-index: 5;
}
.cargando.fuera { opacity: 0; pointer-events: none; }
.bote {
  width: 64px;
  height: 64px;
  border-radius: 50% 50% 46% 46%;
  background: #ffd166;
  border: 4px solid var(--tinta);
  animation: bote 0.6s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}
@keyframes bote {
  from { transform: translateY(0) scale(1.12, 0.86); }
  to { transform: translateY(-40px) scale(0.95, 1.05); }
}

/* --- Botones --- */

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 3px solid var(--tinta);
  background: var(--papel);
  color: var(--tinta);
  box-shadow: 0 4px 0 var(--tinta);
  font-weight: 800;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  user-select: none;
}
.boton:active { transform: translateY(4px); box-shadow: 0 0 0 var(--tinta); }
.boton:disabled, .boton.apagado { opacity: 0.45; pointer-events: none; }
.boton.grande {
  width: 100%;
  min-height: 62px;
  font-size: 21px;
  background: var(--amarillo);
  box-shadow: var(--sombra-dura);
}
.enlace {
  background: none;
  border: 0;
  padding: 10px;
  font-weight: 700;
  color: var(--tinta-suave);
  text-decoration: underline;
  cursor: pointer;
}
.cerrar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid var(--tinta);
  background: var(--papel);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  flex: none;
}

/* --- Pie: la llamada principal --- */

.pie {
  position: fixed;
  left: var(--margen);
  right: var(--margen);
  bottom: var(--abajo);
  max-width: 440px;
  margin: 0 auto;
  text-align: center;
}
.pie .boton.grande { animation: llamada 2.4s infinite; }
@keyframes llamada {
  0%, 82%, 100% { transform: scale(1); }
  88% { transform: scale(1.05) rotate(-1deg); }
  94% { transform: scale(1.03) rotate(1deg); }
}
.pista {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--tinta-suave);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* --- Tarjeta de una criatura --- */

.tarjeta {
  position: fixed;
  left: var(--margen);
  right: var(--margen);
  bottom: calc(var(--abajo) + 104px);
  max-width: 440px;
  margin: 0 auto;
  background: var(--papel);
  border: 3px solid var(--tinta);
  border-radius: var(--radio);
  box-shadow: var(--sombra-dura);
  padding: 16px 18px 10px;
  animation: subir 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.tarjeta .cerrar { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; font-size: 14px; }
.tarjeta h2 { margin: 0 44px 4px 0; font-size: 24px; font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; }
.tarjeta p { margin: 0 0 10px; color: var(--tinta-suave); font-weight: 600; line-height: 1.35; }
.tarjeta .boton { min-height: 42px; font-size: 15px; padding: 0 16px; }

/* --- Hojas (dibujar, compartir) --- */

.hoja {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 100%;
  overflow-y: auto;
  max-width: 520px;
  margin: 0 auto;
  background: var(--papel);
  border: 3px solid var(--tinta);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  padding: 16px var(--margen) var(--abajo);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: subir 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
  z-index: 3;
}
@keyframes subir { from { transform: translateY(40%); opacity: 0; } }
.hoja-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hoja h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -0.01em; }
.hoja-texto { margin: -6px 0 0; color: var(--tinta-suave); font-weight: 600; }

.dibujo { top: var(--arriba); border-radius: 28px 28px 0 0; }
.lienzo-caja { display: grid; place-items: center; }
.lienzo {
  width: min(100%, 52vh);
  aspect-ratio: 1;
  border-radius: 18px;
  border: 3px dashed var(--linea);
  touch-action: none;
  cursor: crosshair;
  background: #fff;
}
.herramientas { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.colores { display: flex; gap: 7px; flex-wrap: wrap; }
.color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--tinta);
  background: var(--c);
  cursor: pointer;
  padding: 0;
}
.color[aria-checked="true"] { box-shadow: 0 0 0 3px var(--papel), 0 0 0 5.5px var(--tinta); }
.acciones { display: flex; gap: 6px; }
.herr {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 2.5px solid var(--tinta);
  background: var(--papel);
  font-size: 20px;
  cursor: pointer;
}
.herr[aria-pressed="true"] { background: var(--amarillo); }
.cuerpo-fila { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; color: var(--tinta-suave); }
.cuerpo-fila .color { width: 28px; height: 28px; }
.nombre {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 2.5px solid var(--tinta);
  padding: 0 14px;
  font-size: 17px;
  font-weight: 700;
  background: #fafafa;
}
.nombre:focus { outline: 3px solid var(--amarillo); }

.lista { gap: 12px; }
.fila { display: flex; gap: 10px; align-items: center; }
.fila .boton { flex: 1; }
.aviso { margin: 0; font-size: 13px; font-weight: 600; color: var(--tinta-suave); }

.aviso-flotante {
  position: fixed;
  top: calc(var(--arriba) + 56px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--tinta);
  color: var(--papel);
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 10;
  text-align: center;
}

.sin-js { position: fixed; inset: auto 16px 16px; background: #fff; padding: 16px; border-radius: 16px; font-weight: 700; }

@media (min-width: 720px) {
  .hoja { bottom: 24px; border-bottom: 3px solid var(--tinta); border-radius: 28px; max-height: calc(100% - 48px); }
  .dibujo { top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .pie .boton.grande, .bote, .aqui i { animation: none; }
}
