:root {
  --bg: #0e1116;
  --panel: #171c24;
  --line: #262d38;
  --accent: #3b82f6;
  --text: #e6e9ee;
  --muted: #8b94a3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.hidden { display: none !important; }

/* Login */
.login {
  height: 100%;
  display: grid;
  place-items: center;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { font-size: 18px; margin: 0 0 8px; }
.login-card input {
  background: #0e131a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.login-card button, .mode {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}
.error { color: #f87171; font-size: 13px; min-height: 16px; }

/* App layout */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.cameras, .modes { display: flex; gap: 8px; }
.cameras button, .mode {
  background: #0e131a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}
.cameras button.active, .mode.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.status { margin-left: auto; color: var(--muted); font-size: 13px; }

.stage {
  position: relative;
  flex: 1;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}
#video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.preview {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}
.badge {
  position: absolute;
  top: 12px; left: 12px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: .04em;
}

/* Timeline */
.timeline-wrap {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 14px 16px;
}
.clock { text-align: center; font-variant-numeric: tabular-nums; font-size: 15px; padding-bottom: 8px; }
.timeline {
  position: relative;
  height: 44px;
  background: linear-gradient(180deg, #11161d, #0c1015);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
}
.playhead {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(59,130,246,.4);
  pointer-events: none;
}
.range {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
