:root {
  --bg: #0a0b14;
  --bg-elev: #13152270;
  --card: #161827;
  --card-hover: #1d2034;
  --border: #262a40;
  --text: #e7e9f3;
  --muted: #8a8fa8;
  --accent: #6c8cff;
  --accent-2: #b06cff;
  --live: #ff3b5c;
  --ok: #34d399;
  --radius: 14px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1b1d3a 0%, transparent 55%),
    radial-gradient(900px 500px at 0% 0%, #241640 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #9db0ff; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- Top nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: #0a0b14cc;
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  font-weight: 800; font-size: 20px; letter-spacing: 0.3px;
  display: flex; align-items: center; gap: 9px; color: var(--text);
}
.brand .star {
  width: 22px; height: 22px; display: inline-block;
  background: conic-gradient(from 45deg, var(--accent), var(--accent-2), var(--accent));
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.brand b { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-spacer { flex: 1; }
.nav a.navlink { color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a.navlink:hover { color: var(--text); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: 0.15s; text-decoration: none;
}
.btn:hover { background: var(--card-hover); color: var(--text); }
.btn-primary {
  border: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: #ff8095; border-color: #5a2230; background: #1f1217; }

/* ---- Hero ---- */
.hero { padding: 56px 0 30px; }
.hero h1 { font-size: 42px; margin: 0 0 10px; line-height: 1.1; }
.hero p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0; }
.hero .cta { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Section heads ---- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 34px 0 18px; }
.section-head h2 { font-size: 22px; margin: 0; }
.pill {
  font-size: 12px; font-weight: 700; color: var(--live);
  border: 1px solid #4a1f2b; background: #1f1117; padding: 3px 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 #ff3b5c80; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #ff3b5c80; } 70% { box-shadow: 0 0 0 8px #ff3b5c00; } 100% { box-shadow: 0 0 0 0 #ff3b5c00; } }

/* ---- Channel grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: 0.15s; display: block; color: var(--text);
}
.card:hover { background: var(--card-hover); transform: translateY(-3px); border-color: #34406b; }
.thumb {
  aspect-ratio: 16 / 9; position: relative;
  background: linear-gradient(135deg, #1a1d33, #251a3d);
  display: flex; align-items: center; justify-content: center;
}
.thumb .glyph { font-size: 40px; opacity: 0.5; }
.thumb .live-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--live); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 6px; letter-spacing: 0.5px;
}
.card-body { padding: 13px 14px 15px; }
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 3px; }
.card-user { color: var(--muted); font-size: 13px; }

.empty {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; color: var(--muted);
}

/* ---- Auth + forms ---- */
.auth-wrap { max-width: 400px; margin: 60px auto; }
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.panel h1 { margin: 0 0 6px; font-size: 24px; }
.panel .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: #0f1120; color: var(--text);
  font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.form-actions { margin-top: 20px; }
.form-actions .btn { width: 100%; }
.msg { margin-top: 14px; font-size: 14px; padding: 10px 12px; border-radius: 9px; display: none; }
.msg.err { display: block; background: #2a1119; color: #ff9aab; border: 1px solid #5a2230; }
.msg.ok { display: block; background: #102420; color: #7ee7c0; border: 1px solid #1f5a45; }
.switch-line { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ---- Dashboard ---- */
.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } .hero h1 { font-size: 32px; } }
.kv { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.code-field {
  display: flex; align-items: center; gap: 8px;
  background: #0f1120; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.code-field input { border: none; background: transparent; padding: 0; flex: 1; font-family: inherit; color: var(--text); }
.muted { color: var(--muted); }
.steps { counter-reset: step; padding: 0; list-style: none; margin: 8px 0 0; }
.steps li { position: relative; padding: 0 0 16px 38px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -2px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--card-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--accent);
}
.status-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; }
.status-line.on .dot { background: var(--live); }
.status-line.off .dot { background: var(--muted); }

/* ---- Watch page ---- */
.watch-wrap { padding: 24px 0 60px; }
.player {
  position: relative;
  width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
}
.player video { width: 100%; height: 100%; display: block; background: #000; }
.unmute-btn {
  position: absolute; bottom: 54px; left: 14px; z-index: 5;
  background: #000000cc; color: #fff; border: 1px solid #ffffff33;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
  cursor: pointer; backdrop-filter: blur(4px);
}
.unmute-btn:hover { background: #000000ee; }
.watch-meta { display: flex; align-items: center; gap: 14px; margin: 18px 2px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #fff;
}
.offline-card {
  width: 100%; aspect-ratio: 16/9; background: #0e1020; border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--muted);
}
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0; border-top: 1px solid var(--border); margin-top: 40px; }
