/* Home Monitor — matches the fluidentity.cc dark glass palette. */
:root {
  --bg: #05070d;
  --fg: #e8ecf4;
  --muted: #8b94a7;
  --line: rgba(255, 255, 255, .09);
  --card: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  --ac: #67e8f9;
  --danger: #f87171;
  --ok: #34d399;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Ambient glow, consistent with the launcher page. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(103,232,249,.10), transparent 60%),
    radial-gradient(800px 500px at 95% 10%, rgba(139,92,246,.08), transparent 60%);
}

h1, h2 { font-weight: 600; letter-spacing: -.01em; }

/* ---------- lock screen ---------- */
.lock-body { display: grid; place-items: center; padding: 24px; }

.lock {
  width: min(400px, 100%);
  margin: clamp(24px, 10vh, 96px) auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px 24px;
  backdrop-filter: blur(12px);
  text-align: center;
}

.lock-badge {
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--ac);
  background: rgba(103,232,249,.10);
  border: 1px solid rgba(103,232,249,.22);
}
.lock-badge svg { width: 26px; height: 26px; }

.lock h1 { margin: 0 0 6px; font-size: 22px; }
.sub { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }

.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

input[type=password] {
  width: 100%; padding: 11px 13px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg); font-size: 15px;
}
input[type=password]:focus {
  outline: none;
  border-color: rgba(103,232,249,.55);
  box-shadow: 0 0 0 3px rgba(103,232,249,.12);
}

.remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); text-align: left; margin-bottom: 18px;
}
.remember input { accent-color: var(--ac); }

button {
  font: inherit; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); transition: border-color .15s, background .15s;
}
button:disabled { opacity: .45; cursor: not-allowed; }

.primary {
  width: 100%; padding: 11px 16px;
  background: rgba(103,232,249,.14);
  border-color: rgba(103,232,249,.35);
  color: var(--ac); font-weight: 600;
}
.primary:hover:not(:disabled) { background: rgba(103,232,249,.22); }

.error {
  background: rgba(248,113,113,.10);
  border: 1px solid rgba(248,113,113,.30);
  color: #fca5a5;
  border-radius: 10px; padding: 9px 12px; font-size: 13px; margin: 0 0 16px;
}

.foot { margin: 18px 0 0; font-size: 11.5px; color: rgba(139,148,167,.7); }

/* ---------- viewer ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 32px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.bar h1 { margin: 0; font-size: 17px; }
.bar-right { display: flex; align-items: center; gap: 12px; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); flex: none;
}
.dot[data-state=live] {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52,211,153,.55);
  animation: pulse 2s infinite;
}
.dot[data-state=starting] { background: var(--ac); animation: pulse 1.2s infinite; }
.dot[data-state=error]    { background: var(--danger); }

@keyframes pulse {
  70%  { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

.state { font-size: 12.5px; color: var(--muted); }

.ghost-btn {
  padding: 7px 13px; font-size: 13px;
  background: rgba(255,255,255,.04);
  color: var(--fg); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px;
  display: inline-block;
}
.ghost-btn:hover:not(:disabled) { border-color: rgba(255,255,255,.22); }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 22px;
  padding: 22px clamp(16px, 4vw, 32px) 40px;
  align-items: start;
}

.video-wrap {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }

.overlay {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  background: rgba(5,7,13,.82);
  backdrop-filter: blur(3px);
  text-align: center; padding: 20px;
  font-size: 13.5px; color: var(--muted);
}
.overlay[hidden] { display: none; }
.overlay .primary { width: auto; padding: 9px 20px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.14);
  border-top-color: var(--ac);
  animation: spin .8s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; flex-wrap: wrap;
}
.controls .primary { width: auto; padding: 8px 18px; }
.controls button { padding: 8px 14px; font-size: 13px; }
.latency { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  backdrop-filter: blur(12px);
}
.side h2 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
           letter-spacing: .08em; color: var(--muted); }
.side h2 + .stats { margin-bottom: 20px; }

.stats { margin: 0; }
.stats > div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.045);
}
.stats > div:last-child { border-bottom: 0; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }

.note { font-size: 12px; color: rgba(139,148,167,.85); margin: 4px 0 0; }
.err {
  margin: 12px 0 0; font-size: 12px; color: #fca5a5;
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 8px; padding: 8px 10px;
  word-break: break-word;
}
.err[hidden] { display: none; }

@media (max-width: 820px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .latency { margin-left: 0; width: 100%; }
}
