/* ===========================================================================
 * estilos.css — La cocina de La Esquina Azul (juego para niños)
 * Identidad del sitio: azul #1f3a93 + verde #16a34a, system-ui, mobile-first.
 * ======================================================================== */

:root {
  --azul: #1f3a93;
  --azul-osc: #16296b;
  --azul-claro: #e9eefb;
  --verde: #16a34a;
  --verde-osc: #0f7a37;
  --amarillo: #f6c333;
  --bg: #f4f6fb;
  --card: #ffffff;
  --txt: #1f2430;
  --muted: #6b7280;
  --linea: #e5e7eb;
  --sombra: 0 6px 18px rgba(31, 58, 147, 0.12);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, #eaf0ff 0, var(--bg) 55%);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Juego para niños: que no se seleccione texto al arrastrar. */
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

.juego {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
}

/* ---- Encabezado --------------------------------------------------------- */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 10px;
}
.top h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--azul);
  line-height: 1.1;
}
.top h1 small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.top .espacio { flex: 1; }

.contador {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--verde);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--sombra);
}

.btn-icono {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--sombra);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.btn-icono:active { transform: scale(0.92); }

/* ---- Tarjeta del pedido ------------------------------------------------- */
.pedido {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--sombra);
  padding: 12px 14px;
  text-align: center;
}
.pedido .globo {
  font-size: 17px;
  font-weight: 800;
  color: var(--azul-osc);
  margin: 0 0 8px;
}
.pedido .globo b { color: var(--verde-osc); }
.checklist {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.check {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--azul-claro);
  display: grid;
  place-items: center;
  transition: transform 0.2s, background 0.2s;
}
.check svg { width: 40px; height: 40px; opacity: 0.55; }
.check .tilde {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  opacity: 0;
  transform: scale(0.3);
  transition: transform 0.25s, opacity 0.25s;
}
.check.listo { background: #dcf5e4; }
.check.listo svg { opacity: 0; }
.check.listo .tilde { opacity: 1; transform: scale(1); }

/* ---- Zona del plato ----------------------------------------------------- */
.mesa {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  min-height: 220px;
  margin: 6px 0;
}
.plato-zona {
  position: relative;
  width: 230px;
  height: 230px;
  display: grid;
  place-items: end center;
  border-radius: 50%;
  transition: transform 0.15s;
}
.plato-zona.resalta { transform: scale(1.05); }
.plato-zona .plato-img {
  position: absolute;
  bottom: 6px;
  width: 200px;
  pointer-events: none;
}
.pila {
  /* Línea de apoyo: la comida se apila desde acá (sobre el plato) hacia arriba.
     Cada capa se ancla por su CENTRO (translate 50%), porque los SVG vienen
     centrados en un viewBox cuadrado. */
  position: absolute;
  bottom: 56px;
  left: 50%;
  width: 140px;
  height: 0;
  transform: translateX(-50%);
  pointer-events: none;
}
.capa {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 136px;
  transform: translate(-50%, 50%);
  animation: plop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.capa svg { width: 100%; display: block; }
@keyframes plop {
  0%   { transform: translate(-50%, 50%) translateY(-26px) scale(0.6); opacity: 0; }
  70%  { transform: translate(-50%, 50%) translateY(2px) scale(1.06); opacity: 1; }
  100% { transform: translate(-50%, 50%) scale(1); opacity: 1; }
}

/* ---- Bandeja de ingredientes ------------------------------------------- */
.bandeja {
  background: var(--card);
  border-radius: 18px 18px 14px 14px;
  box-shadow: var(--sombra);
  padding: 12px;
}
.bandeja .titulo {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  margin: 0 0 8px;
}
.ingredientes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 10px;
}
.ing {
  position: relative;
  background: var(--azul-claro);
  border: 0;
  border-radius: 14px;
  padding: 6px 4px 4px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  touch-action: none; /* el puntero lo maneja el juego (drag propio) */
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.ing:active { cursor: grabbing; }
.ing svg { width: 56px; height: 56px; pointer-events: none; }
.ing .nom { font-size: 11px; font-weight: 700; color: var(--azul-osc); }
.ing.pulso { animation: pulso 1.3s ease-in-out infinite; }
@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
  50%      { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.25); background: #e4f6ea; }
}
.ing.no { animation: sacudir 0.4s; }
@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-4deg); }
  40% { transform: translateX(7px) rotate(4deg); }
  60% { transform: translateX(-5px) rotate(-3deg); }
  80% { transform: translateX(5px) rotate(3deg); }
}
.ing.usado {
  opacity: 0.35;
  pointer-events: none;
  background: #eef0f4;
}
.ing.usado::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  color: var(--verde);
  font-weight: 900;
}

/* ---- Fantasma que sigue al dedo/mouse ---------------------------------- */
.fantasma {
  position: fixed;
  z-index: 50;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.25));
  transform: scale(1.1);
}
.fantasma svg { width: 100%; height: 100%; }

/* ---- Pista suave -------------------------------------------------------- */
.pista {
  position: fixed;
  left: 50%;
  bottom: 50%;
  transform: translate(-50%, 0);
  background: var(--azul-osc);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--sombra);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s;
  z-index: 40;
}
.pista.ver { opacity: 1; transform: translate(-50%, -12px); }

/* ---- Festejo ------------------------------------------------------------ */
.festejo {
  position: fixed;
  inset: 0;
  background: rgba(31, 58, 147, 0.4);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.festejo.ver { opacity: 1; pointer-events: auto; }
.festejo .tarjeta {
  background: var(--card);
  border-radius: 24px;
  padding: 24px 28px 28px;
  text-align: center;
  width: min(86vw, 340px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.festejo.ver .tarjeta { transform: scale(1); }
.festejo .plato-final { width: 150px; margin: 0 auto 6px; }
.festejo h2 { margin: 2px 0 6px; font-size: 26px; color: var(--verde-osc); }
.festejo p { margin: 0 0 14px; color: var(--muted); font-weight: 600; }
.estrellas { font-size: 32px; letter-spacing: 4px; margin-bottom: 14px; }
.estrellas .on { filter: none; }
.estrellas .off { opacity: 0.25; }
.btn-grande {
  border: 0;
  border-radius: 16px;
  background: var(--verde);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  padding: 14px 22px;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--verde-osc);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn-grande:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--verde-osc); }

/* ---- Confeti ------------------------------------------------------------ */
.confeti {
  position: fixed;
  top: -20px;
  width: 11px;
  height: 14px;
  border-radius: 3px;
  z-index: 55;
  pointer-events: none;
  animation: caer linear forwards;
}
@keyframes caer {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

@media (min-width: 600px) {
  .top h1 { font-size: 22px; }
  .plato-zona { width: 260px; height: 260px; }
  .ing svg { width: 62px; height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
