:root{
  --bg:#0b1220;
  --panel:#0f1a2f;
  --card:#0f203a;
  --stroke:rgba(255,255,255,.08);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --primary:#2f7df6;
  --danger:#ff4d4d;
  --radius:16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --max:1100px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue";
}

*{box-sizing:border-box}
html{ height:100%; background: var(--bg); }

body{
  margin:0;
  font-family:var(--font);
  color:var(--text);

  /* en vez de height:100% */
  min-height: 100vh;
  min-height: 100dvh;              /* mejor en móviles modernos */
  min-height: -webkit-fill-available; /* iOS */

  background: radial-gradient(1200px 800px at 20% 0%, rgba(47,125,246,.16), transparent 60%),
              radial-gradient(900px 700px at 90% 10%, rgba(100,255,218,.08), transparent 55%),
              var(--bg);

  background-repeat: no-repeat;
  background-attachment: fixed;     /* ayuda mucho en desktop */
  overflow-x: hidden;
}


.topbar{
  position:sticky; top:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid var(--stroke);
  background: rgba(11,18,32,.72);
  backdrop-filter: blur(10px);
}

.brand{display:flex;align-items:center;gap:12px}
.logo{
  width:42px;height:42px;border-radius:12px;
  display:grid;place-items:center;
  background: linear-gradient(180deg, rgba(47,125,246,.35), rgba(47,125,246,.10));
  border:1px solid rgba(47,125,246,.35);
  box-shadow: var(--shadow);
  font-weight:800;
}
.title{font-weight:800;letter-spacing:.2px}
.subtitle{font-size:12px;color:var(--muted);margin-top:2px}

.tabs{display:flex;gap:8px;flex-wrap:wrap}
.tab{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:10px 12px;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
  font-size:13px;
}
.tab.active{
  border-color: rgba(47,125,246,.55);
  background: rgba(47,125,246,.18);
}

.container{
  max-width:var(--max);
  margin: 18px auto;
  padding: 0 16px 40px;
}

.panel{display:none;gap:16px}
.panel.active{display:grid;grid-template-columns: 1fr; gap:16px}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

h2,h3{margin:0 0 10px}
p{margin:8px 0}
.muted{color:var(--muted)}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
  margin-top: 12px;
}
@media (max-width:720px){
  .grid{grid-template-columns:1fr}
}

.field span{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.field input{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background: rgba(15,26,47,.55);
  color:var(--text);
  outline:none;
}
.field input:focus{
  border-color: rgba(47,125,246,.6);
  box-shadow: 0 0 0 3px rgba(47,125,246,.18);
}

.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 14px;
}

.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
}
.btn.primary{
  border-color: rgba(47,125,246,.6);
  background: rgba(47,125,246,.18);
}
.btn.danger{
  border-color: rgba(255,77,77,.55);
  background: rgba(255,77,77,.14);
}

.results{
  display:grid;
  gap:10px;
  margin-top: 10px;
}
.item{
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,.18);
}
.item .top{
  display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;
}
.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  color:var(--muted);
}
.kv{
  margin-top:10px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px;
}
@media (max-width:720px){
  .kv{grid-template-columns:1fr}
}
.kv div{
  font-size:13px;
  color: var(--muted);
}
.kv b{color:var(--text)}

.cameraWrap{
  border:1px dashed rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  border-radius: 14px;
  overflow:hidden;
  margin-top: 12px;
  aspect-ratio: 16/10;
  display:grid;
  place-items:center;
}
video{
  width:100%;
  height:100%;
  object-fit:cover;
}
.hide{display:none}
.hint{margin-top:10px;color:var(--muted)}
.footer{
  border-top:1px solid var(--stroke);
  padding:12px 16px;
  color:var(--muted);
  text-align:center;
}
code{
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 8px;
  border:1px solid var(--stroke);
}
.container{
  max-width:var(--max);
  margin: 18px auto;
  padding: 0 16px 40px;
  min-height: calc(100dvh - 120px);
}
