:root { --noche:#0F3D25; --titular:#124A28; --verde:#1E6A3A; --hoja:#2C8A4B; --lima:#8FC85A; --lima-clara:#B8E06A; --menta:#D6F0C8; --sol:#FFD84A; --tinta:#16301F; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tinta); background: linear-gradient(160deg, var(--lima-clara), var(--lima) 45%, var(--hoja)); }
body.oscuro { color: #fff; background: linear-gradient(160deg, var(--noche), var(--verde) 60%, var(--hoja)); }
main { flex: 1; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px 8px; }
section { width: min(100%, 520px); text-align: center; }
[hidden] { display: none !important; }
.simbolos { position: absolute; width: 0; height: 0; }

h1 { margin: 0; font-size: clamp(2.05rem, 9.6vw, 3.4rem); line-height: 1.03; font-weight: 900; color: var(--titular); text-wrap: balance; }
h2 { margin: 0; font-weight: 900; line-height: 1.12; text-wrap: balance; }
.frasco { display: block; width: 100%; }

/* El mismo fondo del iPad: color vivo, granos que caen y cubos flotando. */
.fondo { position: fixed; inset: 0; z-index: -1; opacity: 0; transition: opacity .8s ease; }
.fondo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#fondo-color { filter: blur(18px); transform: scale(1.12); }
body.claro .fondo { opacity: 1; }
body.claro { color: var(--tinta); }

#cuenta h1 { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; column-gap: .24em; min-height: 3.9em; padding: 0 2px; }
.palabra { display: inline-block; white-space: nowrap; }
.letra { display: inline-block; }
/* La última frase se agranda y cambia de color, con la misma sombra del letrero del iPad. */
h1.final { color: #fff; }
h1.final .palabra { font-size: 1.2em; text-shadow: 0 .04em 0 var(--titular), 0 .09em 0 var(--titular), 0 .12em .22em rgb(15 61 37 / .55); }

.tira { width: min(50%, 240px); margin: 14px auto 18px; padding: 12px 14px 7px; border-radius: 8px; background: #fff; box-shadow: 0 12px 24px rgb(15 61 37 / .28); }
.ean { position: relative; height: 84px; overflow: hidden; }
.ean svg { display: block; width: 100%; height: 100%; fill: #111; }
.digitos { display: flex; justify-content: space-between; margin: 2px 0 0; padding: 0 1px; font: 700 .72rem/1.1 ui-monospace, Menlo, monospace; letter-spacing: .24em; color: #111; }
.barrido { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #E5352B; box-shadow: 0 0 9px 2px rgb(229 53 43 / .75); animation: cruza 2.8s ease-in-out infinite alternate; }
@keyframes cruza { to { left: calc(100% - 2px); } }

/* El reloj del iPad. */
.reloj { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.reloj div { display: grid; align-content: center; justify-items: center; gap: 3px; aspect-ratio: 1; border-radius: 14%; color: #fff; background: var(--verde); box-shadow: 0 8px 16px rgb(15 61 37 / .35); }
.reloj b { font-size: clamp(1.9rem, 10vw, 3.3rem); line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.reloj span { font-size: clamp(.68rem, 3vw, .95rem); font-weight: 800; }
.fecha { margin: 18px 0 0; font-weight: 800; font-size: 1rem; color: var(--titular); }
.fecha::first-letter { text-transform: uppercase; }

.vivo { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 5px 13px 5px 10px; border-radius: 999px; font-size: .86rem; font-weight: 800; color: #fff; background: rgb(255 255 255 / .14); }
.vivo::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--sol); animation: pulso 1.5s ease-in-out infinite; }
@keyframes pulso { 50% { opacity: .35; transform: scale(.75); } }

/* El mismo visor del monitor: marco vertical, barras guía y láser. */
.visor { position: relative; width: min(72vw, 330px); aspect-ratio: 560 / 660; margin: 16px auto 18px; border: 6px solid #fff; border-radius: 26px; overflow: hidden; background: radial-gradient(circle at 50% 40%, var(--verde), var(--noche)); box-shadow: 0 18px 34px rgb(0 0 0 / .32); }
.marco { position: absolute; top: 10%; bottom: 10%; left: 50%; width: 47.5%; transform: translateX(-50%); box-shadow: 0 0 0 200px rgb(15 61 37 / .5); border-radius: 12px; }
.marco svg { position: absolute; inset: 16% 20%; width: 60%; height: 68%; fill: #fff; animation: respira 2.8s ease-in-out infinite; }
.marco i { position: absolute; width: 26%; height: 16%; border: 5px solid var(--lima-clara); }
.marco i:nth-of-type(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.marco i:nth-of-type(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.marco i:nth-of-type(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.marco i:nth-of-type(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.laser { position: absolute; top: 3%; bottom: 3%; left: 5%; width: 4px; border-radius: 2px; background: #fff; box-shadow: 0 0 16px 3px var(--lima-clara); animation: barre 2.6s ease-in-out infinite alternate; }
@keyframes barre { to { left: calc(95% - 4px); } }
@keyframes respira { 0%, 100% { opacity: .2; } 50% { opacity: .36; } }
.estado { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--menta); }

/* La secuencia del monitor, en el celular. */
.cabecera { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.barra { flex: 1; display: flex; gap: 4px; }
.barra span { flex: 1; height: 5px; border-radius: 3px; overflow: hidden; background: rgb(255 255 255 / .2); }
.barra i { display: block; height: 100%; width: 0; background: var(--sol); }
.fase { min-height: 62dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; animation: entra .6s ease-out both; }
@keyframes entra { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fase h2 { font-size: clamp(1.7rem, 8vw, 2.5rem); }
.nombre { margin: 0; font-size: 1.08rem; font-weight: 700; color: var(--menta); line-height: 1.25; }
.pie { margin: 0; font-size: .86rem; color: var(--menta); line-height: 1.3; }
.marca-ok { width: 128px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.marca-ok circle { stroke: var(--lima-clara); stroke-width: 7; stroke-dasharray: 327; stroke-dashoffset: 327; transform: rotate(-90deg); transform-origin: center; animation: traza .8s ease-out .1s forwards; }
.marca-ok path { stroke: var(--sol); stroke-width: 10; stroke-dasharray: 90; stroke-dashoffset: 90; animation: traza .4s ease-out .75s forwards; }
@keyframes traza { to { stroke-dashoffset: 0; } }
#frasco-directo { height: min(40dvh, 360px); }
.enorme { margin: 0; font-size: clamp(3.8rem, 20vw, 6rem); line-height: .96; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; }
.enorme small { display: block; font-size: 1.5rem; color: var(--sol); margin-top: 4px; }
.enorme.sol { color: var(--sol); }
.iconos { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8px; min-height: 36dvh; width: 100%; }
.iconos svg { fill: currentColor; animation: cae .55s cubic-bezier(.3, 1.5, .5, 1) both; }
.iconos svg.t-cuchara { color: #fff; }
.iconos svg.t-taza { color: var(--menta); }
.iconos svg.t-dona { color: var(--sol); }
.iconos svg.t-cubo { color: #fff; }
@keyframes cae { from { opacity: 0; transform: translateY(-46px) scale(.6); } to { opacity: 1; transform: none; } }
#d-comparacion { color: var(--sol); }
.medidor { width: 100%; height: 20px; border-radius: 10px; overflow: hidden; background: rgb(255 255 255 / .18); }
.medidor i { display: block; height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, var(--lima-clara), var(--sol)); }
.medidor.claro { height: 12px; background: rgb(30 106 58 / .14); }
.discreto { margin-top: 6px; padding: 8px 16px; font-size: .95rem; color: #fff; background: rgb(255 255 255 / .13); }

/* El ticket sale de una ranura, como si lo imprimiera el stand. */
#resultado .vivo { margin-bottom: 12px; color: var(--tinta); background: rgb(255 255 255 / .72); }
#resultado .vivo::before { background: var(--hoja); }
.ranura { height: 12px; margin: 0 -6px; border-radius: 7px; background: #0A2C1A; box-shadow: inset 0 3px 5px rgb(0 0 0 / .6); position: relative; z-index: 1; }
.salida { clip-path: inset(0 -30px -44px -30px); margin-top: -5px; }
.imprimiendo .ticket { animation: imprime 2.1s cubic-bezier(.2, .7, .25, 1) both; }
.imprimiendo .acciones { animation: entra .5s ease-out 1.8s both; }
@keyframes imprime { from { transform: translateY(-101%); } to { transform: none; } }
.ticket { background: #fff; color: var(--tinta); text-align: left; overflow: hidden; box-shadow: 0 18px 34px rgb(0 0 0 / .32); }
.ticket > * { margin: 0; padding: 0 20px; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-right: 14px; }
.encabezado p, .encabezado h2 { margin: 0; }
#t-figura { flex: none; height: 268px; width: auto; margin-top: 12px; filter: drop-shadow(0 6px 8px rgb(15 61 37 / .3)); }
.imprimiendo #t-figura { animation: asoma .8s cubic-bezier(.3, 1.4, .5, 1) 1.6s both; }
@keyframes asoma { from { opacity: 0; transform: translateY(26px) scale(.86); } to { opacity: 1; transform: none; } }
.marca { padding-top: 18px; color: var(--verde); font-weight: 800; }
.ticket h2 { padding-top: 5px; font-size: 1.24rem; line-height: 1.2; font-weight: 800; }
.cifra { padding-top: 8px; font-size: 3.7rem; font-weight: 900; line-height: 1; color: var(--verde); }
.cifra small { display: block; margin-top: 2px; font-size: 1.1rem; color: var(--tinta); font-weight: 800; }
.ticket ul { list-style: none; padding-top: 12px; padding-bottom: 2px; display: grid; gap: 9px; font-weight: 800; line-height: 1.22; }
.ticket li { display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; align-items: center; }
.ticket li svg { width: 30px; height: 30px; fill: var(--hoja); grid-row: span 2; }
.ticket li small { display: block; font-weight: 500; opacity: .8; }
#t-porcien, .sello, #t-nota { padding-top: 9px; line-height: 1.3; }
#t-bloque-referencia { padding-top: 12px; }
.referencia { margin: 7px 0 0; font-weight: 800; line-height: 1.28; }
.sello { font-weight: 700; }
.fuente { padding-top: 9px; padding-bottom: 13px; font-size: .84rem; color: var(--verde); line-height: 1.3; }
.banda { padding: 11px 20px; background: var(--verde); color: #fff; text-align: center; font-weight: 800; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
button { font: inherit; font-weight: 800; font-size: 1.04rem; border: 0; border-radius: 999px; padding: 15px 10px; background: var(--sol); color: var(--tinta); cursor: pointer; }
button.secundario { background: rgb(255 255 255 / .92); }
button.discreto { font-size: .95rem; padding: 8px 18px; color: #fff; background: rgb(255 255 255 / .13); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
footer { padding: 8px 16px max(12px, env(safe-area-inset-bottom)); text-align: center; font-size: .8rem; font-weight: 600; }
footer p { margin: 0 0 10px; }
.creditos { display: flex; justify-content: center; align-items: center; gap: 30px; font-size: .74rem; line-height: 1.2; font-weight: 700; }
.creditos > div { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.creditos > div:first-child:not([hidden]) { max-width: 60%; }
.placa { display: block; padding: 5px 9px; border-radius: 8px; background: #fff; box-shadow: 0 3px 8px rgb(15 61 37 / .22); }
.placa img { display: block; width: auto; height: 34px; }
.placa.oscura { padding: 0; overflow: hidden; background: #070515; transition: transform .15s ease; }
.placa.oscura img { height: 30px; }
.placa.oscura:hover { transform: translateY(-1px); }
.placa.oscura:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* El cierre del obturador, igual que en el monitor. */
#iris { position: fixed; left: 50%; top: 50%; width: 0; height: 0; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; box-shadow: 0 0 0 200vmax var(--noche); z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .marca-ok circle, .marca-ok path { stroke-dashoffset: 0; }
  .laser { left: 50%; }
  .barrido { display: none; }
}
