:root {
    --azul: #1E40AF;
    --verde: #10B981;
    --ambar: #F59E0B;
    --rojo: #EF4444;
    --fondo: #0F172A;
    --texto: #F8FAFC;
}

* { box-sizing: border-box; }

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

body {
    font-family: Inter, "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--fondo);
    color: var(--texto);
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

#app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 10px solid transparent;
    transition: border-color .25s;
}

#app[data-estado="escaneo"] { border-color: var(--ambar); }
#app[data-estado="exito"] { border-color: var(--verde); }
#app[data-estado="error"] { border-color: var(--rojo); }

section { width: 100%; max-width: 560px; text-align: center; }

#reloj { font-size: clamp(2.5rem, 9vw, 4.5rem); font-weight: 700; font-variant-numeric: tabular-nums; }
#fecha { font-size: 1.25rem; opacity: .8; text-transform: capitalize; margin-bottom: 12px; }

#visor {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 60vh;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
}

#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

#ovalo {
    position: absolute;
    inset: 8% 18%;
    border: 4px solid rgba(248, 250, 252, .85);
    border-radius: 50%;
    animation: pulso 2.4s ease-in-out infinite;
}

#app[data-estado="escaneo"] #ovalo { border-color: var(--ambar); animation-duration: 1s; }
#app[data-estado="exito"] #ovalo { border-color: var(--verde); animation: none; }
#app[data-estado="error"] #ovalo { border-color: var(--rojo); animation: none; }

@keyframes pulso { 50% { transform: scale(1.03); opacity: .6; } }

@media (prefers-reduced-motion: reduce) { #ovalo { animation: none !important; } }

#resultado {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 16px;
    background: rgba(15, 23, 42, .85);
    display: none;
}

#app[data-estado="exito"] #resultado, #app[data-estado="error"] #resultado { display: block; }

#resultado-titulo { font-size: 1.75rem; font-weight: 700; }
#resultado-detalle { font-size: 1.25rem; margin-top: 4px; }
#app[data-estado="exito"] #resultado-titulo { color: var(--verde); }
#app[data-estado="error"] #resultado-titulo { color: var(--rojo); }

button {
    min-height: 56px;
    min-width: 56px;
    margin-top: 16px;
    padding: 12px 32px;
    border: 0;
    border-radius: 12px;
    background: var(--azul);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
}

button:disabled { opacity: .5; cursor: not-allowed; }
#marcar { width: 100%; }
button.enlace { background: none; font-size: .9rem; opacity: .6; text-decoration: underline; min-height: 48px; }

#estado { font-size: 1.1rem; min-height: 1.5em; margin: 12px 0 0; }

form { text-align: left; }
label { display: block; margin: 16px 0 6px; font-weight: 600; }
input { width: 100%; min-height: 56px; padding: 8px 14px; border-radius: 10px; border: 1px solid #94A3B8; font-size: 1.1rem; }
.mensaje-error { color: var(--rojo); min-height: 1.5em; }
