:root {
  --bg: #030617;
  --bg-accent: #060923;
  --surface: rgba(15, 18, 38, 0.92);
  --surface-soft: rgba(19, 23, 52, 0.88);
  --surface-strong: rgba(30, 36, 74, 0.95);
  --text: #f7f8ff;
  --muted: #9ca6cf;
  --muted-strong: #c5c9e8;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #7c5dff;
  --accent-soft: rgba(124, 93, 255, 0.2);
  --accent-2: #44ffd2;
  --accent-3: #3dd8f4;
  --danger: #ff5f8f;
  --success: #3fe3a2;
  --warn: #ffd76b;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 25px 80px rgba(3, 10, 30, 0.65);
  --shadow-soft: 0 15px 60px rgba(5, 10, 30, 0.4);
  --gradient: linear-gradient(120deg, #8f41ff 0%, #6d9dff 35%, #3dd8f4 70%, #44ffd2 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(48, 76, 255, 0.2), transparent 45%),
              radial-gradient(circle at 20% 20%, rgba(68, 255, 210, 0.18), transparent 35%),
              linear-gradient(140deg, #040615, #05070f 45%, #040718);
  color: var(--text);
  font-family: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 70% 20%, rgba(141, 88, 255, 0.15), transparent 40%);
  opacity: 0.7;
  z-index: -2;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 45%),
              radial-gradient(circle at 85% 20%, rgba(68, 255, 210, 0.08), transparent 35%);
  opacity: 0.25;
  z-index: -1;
}

main {
  flex: 1;
  padding: 32px 0 48px;
}

.frame {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

a {
  color: var(--accent-3);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--accent-2);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(24px);
  background: rgba(3, 6, 23, 0.82);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 25px 45px rgba(3, 6, 23, 0.65);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-chip {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #05070f;
  box-shadow: var(--shadow-soft);
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted-strong);
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.nav a {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.nav a:hover {
  border-color: var(--border);
  color: var(--text);
}

.nav .btn {
  padding: 10px 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  color: #0b1024;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(182, 207, 255, 0.9), rgba(125, 222, 255, 0.9));
  box-shadow: 0 18px 45px rgba(115, 160, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not([disabled]) {
  transform: translateY(-2px);
  border-color: rgba(125, 222, 255, 0.9);
  box-shadow: 0 25px 55px rgba(125, 222, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(140, 180, 255, 0.2);
}

.btn.secondary:hover:not([disabled]) {
  border-color: rgba(125, 222, 255, 0.9);
  color: var(--accent-3);
  box-shadow: 0 18px 40px rgba(125, 222, 255, 0.35);
}

.btn.ghost {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  color: var(--muted-strong);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.copy-btn {
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  min-width: 170px;
}

.btn.copy-btn[data-state="success"] {
  color: var(--success);
  border-color: rgba(63, 227, 162, 0.5);
}

.btn.copy-btn[data-state="error"] {
  color: var(--danger);
  border-color: rgba(255, 95, 143, 0.5);
}

.hero {
  padding: 24px 0 48px;
  display: grid;
  gap: 32px;
}

.hero .eyebrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--accent-2);
}

.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.1;
  margin: 0;
}

.hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero .stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 28px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 40px 0 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.card-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.camera-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.card,
.data-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card .header,
.data-panel .header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.card .header .title,
.data-panel .header .title {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.card .body,
.data-panel .body {
  padding: 20px 22px;
}

.table-body {
  padding: 0;
  overflow: auto;
}

.card .footer,
.data-panel .footer {
  padding: 16px 22px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.player {
  position: relative;
  background: #000;
}

.stream-card video {
  border-bottom: none;
  border-radius: 0;
}

.stream-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stream-controls .btn {
  flex: 1;
  min-width: 120px;
}

video {
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--border);
}

.status {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
}

.status.connected {
  background: rgba(63, 227, 162, 0.15);
  color: var(--success);
  border-color: rgba(63, 227, 162, 0.45);
}

.status.disconnected {
  background: rgba(255, 95, 143, 0.15);
  color: var(--danger);
  border-color: rgba(255, 95, 143, 0.4);
}

.kv {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.state {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.table th {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pill.ok {
  color: var(--success);
  border-color: rgba(63, 227, 162, 0.4);
}

.pill.warn {
  color: var(--warn);
  border-color: rgba(255, 215, 107, 0.55);
}

.url {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--muted-strong);
}

.notice {
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  margin-top: 20px;
}

.profile-card {
  display: grid;
  gap: 18px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 13px;
}

.login-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

form.styled {
  display: grid;
  gap: 12px;
}

.form-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.form-control input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.section-blend {
  margin-top: 40px;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.lead {
  font-size: 18px;
  color: var(--muted-strong);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(3, 6, 23, 0.82);
  backdrop-filter: blur(24px);
  padding: 24px 0;
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.loading,
.empty-state {
  padding: 28px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 720px) {
  .header-row { flex-direction: column; align-items: flex-start; }
  .hero { padding-top: 8px; }
  .section-heading { flex-direction: column; gap: 8px; align-items: flex-start; }
  .nav { justify-content: flex-start; }
  .hero-actions { width: 100%; }
  .btn { width: 100%; }
}
