:root {
  --bg: #0b0d14;
  --bg-soft: #11141f;
  --card: #161a27;
  --card-hover: #1c2133;
  --border: #262c40;
  --text: #e9ebf3;
  --text-dim: #8b91a7;
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --live: #ff3b5c;
  --green: #22c98a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(124,92,255,0.14), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(255,92,138,0.10), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* ---------- Nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(17,20,31,0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.3px;
}
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
}
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text-dim); font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.nav-user { color: var(--text-dim); font-size: 0.9rem; }
.nav-user em { color: var(--accent); font-style: normal; }
.inline-form { display: inline; }

/* ---------- Layout ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.page-header h1 { margin: 0 0 6px; font-size: 1.7rem; }
.page-header p { margin: 0; color: var(--text-dim); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { background: var(--card-hover); border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b3df0);
  border: none;
  color: #fff;
  box-shadow: 0 6px 18px rgba(124,92,255,0.35);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { border-color: #4a2030; color: #ff8fa3; }
.btn-danger:hover { background: rgba(255,60,92,0.12); border-color: var(--live); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

/* ---------- Cards / Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }

.stream-card { display: flex; flex-direction: column; gap: 12px; }
.stream-card .thumb {
  height: 130px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1b2035, #10131e);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  position: relative;
  overflow: hidden;
}
.stream-card .thumb.live { background: linear-gradient(135deg, #2a1030, #1b0f22); color: #fff; }
.stream-name { font-weight: 700; font-size: 1.05rem; }
.stream-owner { color: var(--text-dim); font-size: 0.82rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-live { background: rgba(255,59,92,0.15); color: var(--live); }
.badge-offline { background: rgba(139,145,167,0.15); color: var(--text-dim); }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255,59,92,0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,59,92,0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255,59,92,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,92,0); }
}

/* ---------- Forms ---------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
}
label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input[type=text], input[type=password], select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 16px;
  outline: none;
  transition: border-color .15s ease;
}
input:focus, select:focus { border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { margin: 0; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: calc(100vh - 70px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-dim); font-size: 0.88rem; margin-bottom: 24px; }
.error-msg {
  background: rgba(255,59,92,0.12);
  border: 1px solid rgba(255,59,92,0.3);
  color: #ff8fa3;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: rgba(255,255,255,0.02); }
code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--accent);
}

/* ---------- Section ---------- */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 40px 0 14px;
  display: flex; align-items: center; gap: 10px;
}

/* ---------- Watch page ---------- */
.player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
video { width: 100%; display: block; aspect-ratio: 16/9; background: #000; }
.offline-note {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}

.select-wrap { max-width: 340px; margin-bottom: 24px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; overflow-x: auto; white-space: nowrap; }

.error-page {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  color: var(--text-dim);
}
