:root {
  --noche: #14110e;
  --papel: #f3ecdf;
  --tinta: #1a1612;
  --amarillo: #ffd60a;
  --suave: #b9b1a6;
  --linea: rgba(255, 255, 255, 0.16);
  --f-titulo: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --f-texto: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --alto-top: 60px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--noche) url("img/fondo.webp") center / cover fixed; color: #fff; font-family: var(--f-texto); font-size: 1rem; line-height: 1.5; overflow-x: clip; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }
.sin-js { position: fixed; inset: auto 0 0 0; padding: 16px; background: #fff; color: #000; text-align: center; z-index: 50; }

.mesa { position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 46%, rgba(20, 17, 14, 0.12) 0%, rgba(20, 17, 14, 0.72) 100%); }

/* ---------- Barra superior ---------- */
.top { height: var(--alto-top); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(14px, 2.4vw, 32px); }
.volver, .top-wa { font-size: 0.875rem; font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.volver:hover { text-decoration: underline; }
.top-wa { border: 1.5px solid #fff; border-radius: 999px; padding: 0 18px; transition: background 0.2s, color 0.2s; }
.top-wa:hover { background: #fff; color: #000; }
.marca { font: 400 1.6rem/1 var(--f-titulo); letter-spacing: 0.06em; text-align: center; }
.marca span { font: 500 0.7rem/1 var(--f-texto); letter-spacing: 0.22em; text-transform: uppercase; color: var(--suave); margin-left: 8px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 26px; border-radius: 999px; border: 1.5px solid transparent; font: 700 0.95rem/1 var(--f-texto); text-decoration: none; cursor: pointer; text-align: center; transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease); }
.btn:active { transform: scale(0.97); }
.btn-amarillo { background: var(--amarillo); color: #111; }
.btn-amarillo:hover { background: #fff; }
.btn-negro { background: #111; color: #fff; }
.btn-negro:hover { background: #333; }
.btn-claro { background: #fff; color: #111; }
.btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* ---------- Escena ---------- */
.zona-caja { grid-area: caja; }
.bandejas { grid-area: ings; }
.ticket { grid-area: ticket; }
.escena { display: grid; grid-template-areas: "ings caja ticket"; grid-template-columns: minmax(210px, 262px) minmax(0, 1fr) minmax(280px, 340px); gap: clamp(12px, 2vw, 28px); padding: 0 clamp(14px, 2.4vw, 32px) 24px; height: calc(100svh - var(--alto-top)); min-height: 560px; }
.zona-caja { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; gap: 6px; }
.caja { position: relative; width: min(100%, calc(100svh - var(--alto-top) - 28px)); min-width: 0; aspect-ratio: 1; --d: 0.7; }
.caja > img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: none; height: auto; opacity: 0; transition: opacity 0.5s var(--ease), transform 0.8s var(--ease); pointer-events: none; user-select: none; filter: drop-shadow(0 28px 34px rgba(0, 0, 0, 0.5)); }
.c-cerrada { width: 92%; }
.c-tapa { width: 103.8%; }
.c-bandeja { width: 89.4%; }
.caja[data-estado="cerrada"] .c-cerrada { opacity: 1; }
.caja[data-estado="abriendo"] .c-tapa, .caja[data-estado="cerrando"] .c-tapa { opacity: 1; transform: translate(-50%, -51%) scale(1.01); }
.caja[data-estado="abierta"] .c-bandeja { opacity: 1; }
.caja[data-estado="cerrada"] { cursor: pointer; }
.caja[data-estado="cerrada"]:hover .c-cerrada { transform: translate(-50%, -51%) scale(1.012); }

.pizza { position: absolute; left: 50%; top: 50%; width: calc(var(--d) * 100%); aspect-ratio: 1; transform: translate(-50%, -50%) scale(0.88); opacity: 0; transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), width 0.55s var(--ease); pointer-events: none; }
.caja[data-estado="abierta"] .pizza { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.p-base { width: 100%; height: auto; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4)); }
.capas { position: absolute; inset: 0; }
.pizza.sobre::after { content: ""; position: absolute; inset: 4%; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.9), 0 0 38px rgba(255, 214, 10, 0.5); }
.pieza { position: absolute; max-width: none; height: auto; transform: translate(-50%, -50%) rotate(var(--rot)); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); animation: cae 0.55s var(--ease) both; animation-delay: var(--ret, 0ms); pointer-events: none; }
.pieza.sale { animation: none; opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot)) scale(0.6); transition: opacity 0.25s, transform 0.25s; }
@keyframes cae { from { opacity: 0; transform: translate(-50%, calc(-50% - 46px)) rotate(calc(var(--rot) + 28deg)) scale(1.4); } 60% { opacity: 1; } to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); } }

.fin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(86%, 440px); display: grid; justify-items: center; gap: 10px; text-align: center; z-index: 3; padding: 26px 22px 24px; background: rgba(20, 17, 14, 0.86); backdrop-filter: blur(6px); border-radius: 20px; box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5); }
.fin[hidden] { display: none; }
.fin-t { font: 400 clamp(2rem, 5vw, 3.2rem)/1 var(--f-titulo); letter-spacing: 0.04em; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8); }
.fin-d { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
.caja[data-estado="cerrada"] .c-cerrada.sin-fin { opacity: 1; }

.btn[hidden] { display: none; }
.empezar { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); z-index: 4; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4); }
.empezar:active { transform: translateX(-50%) scale(0.97); }
.bandejas h1 { font: 400 clamp(2.2rem, 3.2vw, 3rem)/0.95 var(--f-titulo); letter-spacing: 0.05em; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7); }
.intro-p { color: #e9e1d5; font-size: 0.875rem; line-height: 1.4; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }

/* ---------- Ingredientes ---------- */
.bandejas { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-top: 6px; }
.bandejas h2 { font: 500 0.72rem/1 var(--f-texto); letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); margin-top: 4px; }
.ings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; min-height: 0; overflow-y: auto; padding-right: 2px; }
.ing { position: relative; width: 100%; aspect-ratio: 1 / 0.82; border-radius: 16px; border: 1px solid var(--linea); background: rgba(20, 17, 14, 0.62); backdrop-filter: blur(6px); cursor: grab; padding: 0; overflow: hidden; display: block; text-align: left; transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s; touch-action: manipulation; }
.ing:hover:not(:disabled) { transform: translateY(-3px); border-color: rgba(255, 214, 10, 0.7); background: rgba(20, 17, 14, 0.8); }
.ing:disabled { opacity: 0.45; cursor: not-allowed; }
.ing-fotos { position: absolute; inset: 0 0 34px 0; }
.ing-fotos img { position: absolute; max-width: none; height: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); pointer-events: none; }
.ing-n { position: absolute; left: 10px; bottom: 21px; font-size: 0.8125rem; font-weight: 700; line-height: 1.1; }
.ing-p { position: absolute; left: 10px; bottom: 6px; font: 500 0.72rem/1 var(--f-mono); color: var(--amarillo); }
.ing-c { position: absolute; right: 8px; top: 8px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--amarillo); color: #111; font: 700 0.8rem/24px var(--f-texto); text-align: center; transform: scale(0); transition: transform 0.25s var(--ease); }
.ing[data-n="0"] .ing-c { transform: scale(0); }
.ing:not([data-n="0"]) .ing-c { transform: scale(1); }
.ing.tope { animation: sacude 0.35s; }
@keyframes sacude { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.hint { font-size: 0.8125rem; color: var(--suave); }
.fantasma { position: fixed; z-index: 100; pointer-events: none; max-width: none; height: auto; transform: translate(-50%, -50%) rotate(8deg) scale(1.1); filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.55)); }

/* ---------- Ticket ---------- */
.ticket { position: relative; align-self: stretch; min-height: 0; max-height: 100%; overflow: hidden; background: var(--papel); color: var(--tinta); padding: 18px 18px 26px; font-family: var(--f-mono); font-size: 0.8125rem; border-radius: 4px 4px 0 0; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.8); display: flex; flex-direction: column; gap: 12px; }
.ticket > * { flex-shrink: 0; }
.ticket > .t-lineas { flex-shrink: 1; }
.t-cab { text-align: center; border-bottom: 2px dashed rgba(26, 22, 18, 0.35); padding-bottom: 12px; }
.t-marca { font: 400 1.6rem/0.95 var(--f-titulo); letter-spacing: 0.06em; }
.t-marca span { font: 500 0.66rem/1 var(--f-mono); letter-spacing: 0.24em; text-transform: uppercase; }
.t-demo { margin-top: 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.7; }
.t-et { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.7; margin-bottom: 6px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 40px; border-radius: 8px; border: 1.5px solid var(--tinta); background: transparent; font: 500 0.8rem var(--f-mono); cursor: pointer; transition: background 0.2s, color 0.2s; }
.seg button[aria-checked="true"] { background: var(--tinta); color: var(--papel); }
.seg button:focus-visible { outline-color: #b88400; }
.t-lineas { display: grid; gap: 6px; align-content: start; min-height: 64px; flex: 1 1 0; overflow-y: auto; padding-right: 2px; }
.t-lineas li { display: flex; align-items: center; gap: 8px; animation: entra 0.3s var(--ease); }
@keyframes entra { from { opacity: 0; transform: translateX(14px); } }
.t-lineas .nom { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.t-lineas .pre { white-space: nowrap; }
.t-lineas .base .nom { font-weight: 500; }
.t-lineas .vacio { opacity: 0.55; font-style: italic; display: block; }
.mm { width: 28px; height: 28px; border-radius: 6px; border: 1.5px solid var(--tinta); background: transparent; font: 500 1rem/1 var(--f-mono); cursor: pointer; display: grid; place-items: center; padding: 0; }
.mm:hover:not(:disabled) { background: var(--tinta); color: var(--papel); }
.mm:disabled { opacity: 0.3; cursor: not-allowed; }
.t-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px dashed rgba(26, 22, 18, 0.35); padding-top: 12px; font-size: 0.9rem; }
.t-total b { font: 400 2.2rem/1 var(--f-titulo); letter-spacing: 0.04em; }
.t-cta { width: 100%; font-family: var(--f-texto); }
.t-nota { font-size: 0.72rem; opacity: 0.65; text-align: center; line-height: 1.35; }
.t-nota#nota-cta { opacity: 0.85; font-weight: 500; }
.barras { height: 34px; margin-top: 4px; background: repeating-linear-gradient(90deg, var(--tinta) 0 2px, transparent 2px 4px, var(--tinta) 4px 5px, transparent 5px 9px, var(--tinta) 9px 12px, transparent 12px 14px); opacity: 0.85; }
.ticket::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: linear-gradient(135deg, var(--noche) 5px, transparent 0) 0 0 / 14px 10px repeat-x, linear-gradient(225deg, var(--noche) 5px, transparent 0) 0 0 / 14px 10px repeat-x; opacity: 0.0; }

/* ---------- Venta ---------- */
.venta { background: var(--amarillo); color: #111; padding: clamp(40px, 7vw, 80px) clamp(16px, 4vw, 48px); }
.venta-in { max-width: 920px; margin: 0 auto; display: grid; gap: 14px; justify-items: start; }
.venta h2 { font: 400 clamp(2.2rem, 6vw, 4.2rem)/0.95 var(--f-titulo); letter-spacing: 0.03em; max-width: 18ch; }
.venta p { max-width: 36rem; font-size: 1.05rem; }

.barra-movil { display: none; }

/* ---------- Computadores de pantalla baja (por ejemplo 1366×650): todo debe verse sin desplazarse ---------- */
@media (min-width: 1280px) and (max-height: 760px) {
  .bandejas { gap: 7px; }
  .bandejas h1 { font-size: 2.1rem; }
  .intro-p { font-size: 0.8125rem; }
  .hint { display: none; }
  .ing { aspect-ratio: 1 / 0.7; }
  .ing-n { bottom: 19px; font-size: 0.78rem; }
  .ticket { padding: 12px 16px 16px; gap: 8px; }
  .t-cab { padding-bottom: 8px; }
  .t-marca { font-size: 1.35rem; }
  .barras { display: none; }
  .t-nota { font-size: 0.68rem; }
  .t-total b { font-size: 1.9rem; }
  .seg button { min-height: 34px; }
  .t-cta { min-height: 44px; }
}

/* ---------- Pantallas medianas: la caja arriba, los ingredientes en fila debajo y el ticket a un lado ---------- */
@media (min-width: 900px) and (max-width: 1279px) {
  .escena { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "caja ticket" "ings ticket"; grid-template-rows: minmax(0, 1fr) auto; height: auto; min-height: calc(100svh - var(--alto-top)); }
  .caja { width: min(100%, 560px); }
  .ings { display: flex; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
  .ings li { flex: 0 0 124px; }
}

/* ---------- Celular ---------- */
@media (max-width: 899px) {
  .escena { display: flex; flex-direction: column; height: auto; min-height: 0; padding-bottom: 96px; gap: 14px; }
  .zona-caja, .bandejas, .ticket { grid-area: auto; }
  .t-lineas { flex: 0 0 auto; overflow: visible; min-height: 0; }
  .ticket { overflow: visible; }
  .zona-caja { width: 100%; }
  .caja { width: min(100%, 520px); }
  .bandejas { padding-top: 0; }
  .ings { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 2px 2px 8px; gap: 8px; }
  .ings li { flex: 0 0 132px; scroll-snap-align: start; }
  .ing { aspect-ratio: 1 / 0.95; }
  .ticket { width: 100%; align-self: stretch; max-height: none; overflow: visible; }
  .marca span { display: none; }
  .barra-movil { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(14px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right)); background: rgba(20, 17, 14, 0.94); backdrop-filter: blur(10px); border-top: 1px solid var(--linea); transform: translateY(110%); transition: transform 0.4s var(--ease); }
  body.empezado .barra-movil { transform: none; }
  .barra-movil p { font-size: 0.8rem; color: var(--suave); }
  .barra-movil b { font: 400 1.8rem/1 var(--f-titulo); letter-spacing: 0.04em; color: #fff; margin-left: 6px; }
}
@media (max-width: 420px) {
  .top-wa { padding: 0 12px; font-size: 0.8rem; }
  .marca { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  .caja img, .pizza, .pieza, .ing, .barra-movil { transition-duration: 0.01ms !important; }
  .pieza { animation: none !important; }
  .t-lineas li { animation: none; }
}
