* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0b1530; color: #e8eefc; font-family: "Segoe UI", system-ui, Roboto, sans-serif; overflow: hidden; user-select: none; }
.oculto { display: none !important; }
.pantalla { height: 100%; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }

#vincular { align-items: center; justify-content: center; }
.caja { background: #13204a; border-radius: 18px; padding: 32px; width: min(420px, 92vw); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.logo { font-size: 46px; }
.caja input { width: 100%; font-size: 34px; text-align: center; letter-spacing: 8px; padding: 12px; border-radius: 12px; border: 2px solid #2c4185; background: #0b1530; color: #fff; margin: 12px 0; }
.btn { background: var(--primario); color: #fff; border: none; padding: 14px 26px; border-radius: 12px; font-size: 18px; font-weight: 600; width: 100%; }
.btn.secundario { background: transparent; border: 1px solid #3b4f8f; margin-top: 12px; }
.error { color: #fca5a5; min-height: 20px; }

header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: rgba(255, 255, 255, .03); border-bottom: 1px solid rgba(255, 255, 255, .06); }
:root { --primario: #1d4ed8; }
.marca-k { display: flex; gap: 12px; align-items: center; }
.logo { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 10px; padding: 4px; }
.empresa { font-weight: 700; font-size: 20px; }
.sitio { color: #8ea2d8; font-size: 14px; }
.estado { display: flex; gap: 8px; align-items: center; font-size: 14px; color: #a8b8e6; }
.punto { width: 11px; height: 11px; border-radius: 50%; background: #22c55e; display: inline-block; }
.punto.fuera { background: #ef4444; }
#pendientes { background: #b45309; color: #fff; border-radius: 99px; padding: 2px 9px; font-size: 12px; }
#pendientes:empty { display: none; }

.cuerpo { flex: 1; display: grid; grid-template-columns: 1fr 1.25fr; gap: 24px; padding: 24px; min-height: 0; }
.izq { display: flex; flex-direction: column; justify-content: center; }
.hora { font-size: clamp(64px, 11vw, 150px); font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -2px; }
.fecha { font-size: clamp(18px, 2.2vw, 26px); color: #9fb0de; margin: 8px 0 26px; }
.modos { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.modo { background: #13204a; color: #c7d3f5; border: 2px solid #22336b; border-radius: 12px; padding: 12px 16px; font-size: 16px; }
.modo.activo { background: var(--primario); border-color: #60a5fa; color: #fff; }
.alternos { display: flex; gap: 10px; flex-wrap: wrap; }
.alterno { background: transparent; color: #c7d3f5; border: 1px dashed #3b4f8f; border-radius: 12px; padding: 12px 18px; font-size: 16px; }

.der { display: flex; align-items: center; justify-content: center; min-height: 0; }
.visor { position: relative; width: 100%; max-height: 100%; aspect-ratio: 4 / 3; border-radius: 24px; overflow: hidden; background: #000; box-shadow: 0 0 0 4px #1e2f66; }
.visor video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.guia { position: absolute; left: 50%; top: 46%; width: 42%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border: 4px dashed rgba(255, 255, 255, .45); border-radius: 50%; transition: border-color .2s; }
.guia.detectado { border-style: solid; border-color: #60a5fa; }
.guia.reto { border-style: solid; border-color: #facc15; animation: pulso 1s infinite; }
@keyframes pulso { 50% { transform: translate(-50%, -50%) scale(1.03); } }
.instruccion { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px; text-align: center; font-size: clamp(18px, 2.4vw, 28px); font-weight: 600; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }

.resultado { position: fixed; inset: 0; background: rgba(5, 10, 25, .82); display: grid; place-items: center; z-index: 20; }
.tarjeta-res { background: #fff; color: #0f172a; border-radius: 24px; padding: 36px 48px; text-align: center; min-width: min(480px, 90vw); animation: entra .25s ease-out; }
@keyframes entra { from { transform: scale(.9); opacity: 0; } }
.tarjeta-res .icono { width: 84px; height: 84px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 48px; display: grid; place-items: center; margin: 0 auto 12px; }
.tarjeta-res.error .icono { background: #dc2626; }
.tarjeta-res.pendiente .icono { background: #d97706; }
.tarjeta-res .nombre { font-size: 28px; font-weight: 700; }
.tarjeta-res .tipo { font-size: 22px; color: #1d4ed8; margin-top: 6px; }
.tarjeta-res.error .tipo { color: #dc2626; }
.tarjeta-res .hora-res { font-size: 52px; font-weight: 300; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tarjeta-res .msg { color: #475569; margin-top: 6px; font-size: 16px; }

.modal { position: fixed; inset: 0; background: rgba(5, 10, 25, .85); display: grid; place-items: center; z-index: 30; }
.valor { font-size: 40px; letter-spacing: 10px; min-height: 56px; margin: 6px 0 14px; }
.teclas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.teclas button { background: #1b2b5c; color: #fff; border: none; border-radius: 14px; padding: 18px 0; font-size: 28px; }
.teclas button.ok { background: #16a34a; }

@media (max-width: 820px), (orientation: portrait) {
    .cuerpo { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 12px; padding: 14px; }
    .izq { align-items: center; text-align: center; }
    .modos, .alternos { justify-content: center; }
    .fecha { margin-bottom: 12px; }
    .modo, .alterno { padding: 10px 12px; font-size: 14px; }
}
