/* DEMO FRAMES — visor web (ámbar sobre oscuro) */

:root {
  --bg: #0b0d12;
  --panel: rgba(18, 24, 36, 0.82);
  --panel-border: rgba(240, 160, 75, 0.25);
  --text: #e8e6e3;
  --muted: #9aa3b2;
  --accent: #f0a04b;
  --brand: #d37f0f;
  --danger: #ff5f56;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 700px at 50% 18%, #16202e 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overflow: hidden;
}

/* ---------- barra superior ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: linear-gradient(180deg, rgba(11, 13, 18, 0.92), rgba(11, 13, 18, 0.55) 80%, transparent);
}

.brand { display: flex; align-items: center; gap: 0.7rem; }

.brand-mark {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd9a3, var(--brand) 65%);
  box-shadow: 0 0 18px 2px rgba(211, 127, 15, 0.55);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.brand-text p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.capture-group { display: flex; gap: 0.5rem; }

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.06s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: wait; }

.btn.primary {
  background: linear-gradient(135deg, #ffb45e, var(--brand));
  color: #1a1207;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 22px rgba(211, 127, 15, 0.35);
}

.btn.toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(240, 160, 75, 0.35) inset;
}

#btn-live.active { color: #ff8f7a; }

/* ---------- visor ---------- */

main { position: fixed; inset: 0; }

#viewer, #viewer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  min-width: 250px;
}

.volume { display: flex; align-items: baseline; gap: 0.45rem; }

#volume-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #ffe0b3, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: opacity 0.2s;
}

.volume small { color: var(--muted); font-size: 0.8rem; }

.status { margin: 0; font-size: 0.85rem; }
.meta { margin: 0; font-size: 0.72rem; color: var(--muted); min-height: 1em; }
.meta.gen { color: var(--accent); font-variant-numeric: tabular-nums; }

#spark { margin-top: 0.2rem; border-radius: 8px; background: rgba(255,255,255,0.03); }

.cams { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

.cams figure { margin: 0; position: relative; }

.cams img {
  display: block;
  width: 108px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: #0009;
  opacity: 0;
  transition: opacity 0.4s;
}

.cams img.loaded { opacity: 1; }

.cams figcaption {
  position: absolute;
  bottom: 4px; left: 6px;
  font-size: 0.62rem;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* ---------- panel de ajustes ---------- */

.settings {
  position: absolute;
  right: 1rem;
  top: 4.6rem;
  z-index: 6;
  width: 270px;
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.settings h2 { margin: 0; font-size: 0.95rem; }

.settings label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }

.settings label span { display: flex; justify-content: space-between; }
.settings output { color: var(--accent); font-weight: 700; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
}

.settings .hint { margin: 0; font-size: 0.66rem; color: var(--muted); line-height: 1.4; }

/* ---------- modal de calibración ---------- */

.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, 0.6);
  backdrop-filter: blur(4px);
}

/* `display:flex` above would defeat the hidden attribute: restore it
   explicitly so the modal stays closed until the button opens it. */
.modal[hidden] { display: none; }

.settings[hidden] { display: none; }

.modal-card {
  max-width: 400px;
  margin: 1rem;
  padding: 1.2rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.modal-card h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.modal-card p { margin: 0.4rem 0; font-size: 0.85rem; line-height: 1.5; }
.modal-card .hint { color: var(--muted); font-size: 0.72rem; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* ---------- toast ---------- */

.toast {
  position: absolute;
  top: 4.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(255, 95, 86, 0.15);
  border: 1px solid rgba(255, 95, 86, 0.55);
  color: #ffd7d4;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
  animation: pop 0.2s ease;
}

@keyframes pop {
  from { transform: translateX(-50%) translateY(-6px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---------- móvil ---------- */

@media (max-width: 720px) {
  .brand-text p { display: none; }
  .hud { left: 0.6rem; bottom: 0.6rem; min-width: 200px; padding: 0.7rem 0.9rem; }
  #volume-value { font-size: 1.6rem; }
  .cams img { width: 78px; }
  .settings { right: 0.6rem; width: calc(100vw - 1.2rem); }
}
