/* ── Layout del kiosko ──────────────────────────────────────────────────── */
.kiosk-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(4, 9, 22, 0.5);
  backdrop-filter: blur(8px);
}
#conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; box-shadow: 0 0 8px var(--warn); }
#conn.live .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok-glow); }
#conn.down .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger-glow); }

.kiosk-stage {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px;
  padding: 22px 28px; align-items: stretch;
  height: calc(100vh - 79px);
}
@media (max-width: 960px) { .kiosk-stage { grid-template-columns: 1fr; height: auto; } }

/* ── Vídeo ──────────────────────────────────────────────────────────────── */
.video-card { padding: 14px; display: flex; flex-direction: column; }
.video-wrap {
  position: relative; flex: 1; border-radius: 14px; overflow: hidden;
  background: #02060f; min-height: 360px;
  border: 1px solid var(--border);
}
#preview { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.4s; }
#preview.ready { opacity: 1; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.video-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.video-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 6px 4px; }

.scanline {
  position: absolute; left: 0; right: 0; height: 3px; top: 0;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 16px var(--cyan); opacity: 0;
}
.scanning .scanline { opacity: 0.9; animation: scan 2.4s ease-in-out infinite; }
@keyframes scan { 0% { top: 2%; } 50% { top: 96%; } 100% { top: 2%; } }

/* ── Panel de veredicto ─────────────────────────────────────────────────── */
.verdict-card {
  position: relative; overflow: hidden;
  padding: 30px 26px; display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: border-color 0.4s, box-shadow 0.4s;
}
.verdict-halo { position: absolute; top: -120px; left: 50%; transform: translateX(-50%); width: 360px; height: 360px; border-radius: 50%; filter: blur(70px); opacity: 0.35; transition: background 0.5s; }
.verdict-icon { font-size: 56px; margin-bottom: 10px; transition: 0.3s; z-index: 1; }
.verdict-title { font-size: 26px; font-weight: 800; letter-spacing: 0.5px; z-index: 1; }
.verdict-sub { color: var(--text-dim); margin-top: 6px; font-size: 14px; z-index: 1; min-height: 20px; }

.state-idle .verdict-halo { background: var(--blue); }
.state-scanning { border-color: rgba(34, 211, 238, 0.4); }
.state-scanning .verdict-halo { background: var(--cyan); }
.state-scanning .verdict-icon { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); opacity: 0.7; } }
.state-granted { border-color: var(--ok-glow); box-shadow: 0 0 50px rgba(40, 224, 160, 0.25), var(--shadow); }
.state-granted .verdict-halo { background: var(--ok); opacity: 0.45; }
.state-granted .verdict-icon { color: var(--ok); text-shadow: 0 0 24px var(--ok-glow); }
.state-granted .verdict-title { color: var(--ok); }
.state-denied { border-color: var(--danger-glow); box-shadow: 0 0 50px rgba(255, 84, 112, 0.2), var(--shadow); }
.state-denied .verdict-halo { background: var(--danger); opacity: 0.4; }
.state-denied .verdict-icon { color: var(--danger); text-shadow: 0 0 24px var(--danger-glow); }
.state-denied .verdict-title { color: var(--danger); }

/* ── Identidad ──────────────────────────────────────────────────────────── */
.identity { display: flex; align-items: center; gap: 16px; margin: 22px 0 6px; width: 100%; z-index: 1; }
.avatar {
  width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 6px 20px rgba(47, 107, 255, 0.4);
}
.identity-info { text-align: left; }
.identity-name { font-size: 20px; font-weight: 700; }
.identity-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* ── Scores ─────────────────────────────────────────────────────────────── */
.scores { width: 100%; display: flex; flex-direction: column; gap: 16px; margin-top: 22px; z-index: 1; }
.score .spread { margin-bottom: 7px; font-size: 14px; }
.score .thresh { font-size: 11px; margin-top: 5px; }
.verdict-foot { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; z-index: 1; }

/* ── Modales ────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 5, 14, 0.78); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { width: 100%; max-width: 420px; padding: 28px; }
.modal h3 { font-size: 17px; }

/* ── Puerta de vidrio corrediza en vivo (estado físico) ─────────────────── */
.door-live {
  display: flex; align-items: center; gap: 16px;
  margin-top: 18px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(4, 10, 24, 0.5);
}
.door-visual { width: 168px; height: 124px; flex: 0 0 auto; perspective: 700px; }
.door-frame {
  position: relative; width: 100%; height: 100%;
  border: 2px solid var(--border-strong); border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(130% 90% at 50% 100%, rgba(18,38,76,.55), rgba(6,12,28,.96));
  box-shadow: inset 0 0 26px rgba(0,0,0,.6), 0 10px 26px rgba(0,0,0,.45);
  transition: border-color .5s ease, box-shadow .5s ease;
}
/* Luz que se revela detrás de las hojas al abrir */
.door-frame::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease;
  background: linear-gradient(180deg, rgba(40,224,160,0) 0%, rgba(40,224,160,.20) 55%, rgba(40,224,160,.5) 100%);
}
.door-visual.state-open .door-frame::before,
.door-visual.state-opening .door-frame::before { opacity: 1; }
/* Riel / umbral inferior */
.door-frame::after {
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 4px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(150,200,255,.55), transparent);
}
.door-leaf {
  position: absolute; top: 0; height: 100%; width: 50%;
  background:
    linear-gradient(115deg, rgba(150,210,255,.10) 0%, rgba(150,210,255,.36) 45%,
                    rgba(120,180,255,.12) 60%, rgba(150,210,255,.30) 100%);
  border: 1px solid rgba(165,212,255,.5);
  box-shadow: inset 0 0 18px rgba(120,180,255,.20);
  backdrop-filter: blur(3px);
  transition: transform .8s cubic-bezier(.45,.02,.15,1);
  z-index: 1;
}
/* Destello diagonal del vidrio */
.door-leaf::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 28%; width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  transform: skewX(-12deg);
}
.door-leaf.leaf-left { left: 0; border-radius: 8px 0 0 8px; }
.door-leaf.leaf-right { right: 0; border-radius: 0 8px 8px 0; }
.door-seam {
  position: absolute; top: 6%; bottom: 6%; left: 50%; width: 2px; z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(170,215,255,.75), transparent);
  transform: translateX(-1px); transition: opacity .4s ease;
}
/* Estados: las hojas corren hacia los lados */
.door-visual.state-opening .leaf-left,
.door-visual.state-open .leaf-left { transform: translateX(-99%); }
.door-visual.state-opening .leaf-right,
.door-visual.state-open .leaf-right { transform: translateX(99%); }
.door-visual.state-open .door-seam,
.door-visual.state-opening .door-seam { opacity: 0; }
.door-visual.state-open .door-frame,
.door-visual.state-opening .door-frame { border-color: var(--ok); box-shadow: inset 0 0 28px var(--ok-glow), 0 0 28px var(--ok-glow); }
.door-visual.state-closing .door-frame { border-color: var(--warn); box-shadow: inset 0 0 22px rgba(255,193,77,.3), 0 0 18px rgba(255,193,77,.3); }

.door-info { flex: 1; min-width: 0; }
.door-state { font-size: 17px; font-weight: 800; letter-spacing: .3px; }
.door-sub { font-size: 12px; margin-top: 2px; }
.door-countbar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 10px; }
.door-countbar > i { display: block; height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--ok), var(--cyan)); transition: width .25s linear; }
.door-live.is-open .door-state { color: var(--ok); }
.door-live.is-closing .door-state { color: var(--warn); }
