:root {
  --bg: #0b0b0f;
  --bg-elev: #16161d;
  --bg-card: #1c1c25;
  --line: #2a2a35;
  --text: #f2f2f5;
  --muted: #9a9aa8;
  --accent: #e50914;
  --accent-hover: #ff1e28;
  --ok: #3ddc84;
  --warn: #ffb020;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ------------------------------- header ---------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 4vw;
  background: linear-gradient(180deg, rgba(11, 11, 15, .96), rgba(11, 11, 15, .75) 70%, transparent);
  backdrop-filter: blur(8px);
}

.logo {
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -.5px;
  color: var(--accent);
}

.nav-links { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-spacer { flex: 1; }

.nav-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}

/* --------------------------------- hero ----------------------------------- */

.hero {
  position: relative;
  min-height: 56vh;
  display: flex;
  align-items: flex-end;
  padding: 0 4vw 48px;
  background-size: cover;
  background-position: center;
  margin-top: -72px;
  padding-top: 120px;
}

.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11,11,15,.95) 0%, rgba(11,11,15,.65) 45%, rgba(11,11,15,.2) 100%),
              linear-gradient(0deg, var(--bg) 2%, transparent 45%);
}

.hero-inner { position: relative; z-index: 1; max-width: 620px; }
.hero h1 { font-size: clamp(28px, 5vw, 52px); margin: 0 0 12px; line-height: 1.05; }
.hero p { color: #d5d5dd; line-height: 1.55; margin: 0 0 22px; }
.hero-meta { color: var(--muted); font-size: 14px; margin-bottom: 10px; }

/* --------------------------------- rows ----------------------------------- */

.row { padding: 0 4vw; margin-bottom: 38px; }
.row h2 { font-size: 20px; margin: 0 0 14px; }

.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 170px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.row-scroll::-webkit-scrollbar { height: 8px; }
.row-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  border: 1px solid transparent;
}
.card:hover { transform: translateY(-4px) scale(1.03); box-shadow: var(--shadow); border-color: var(--line); }

.card-img {
  aspect-ratio: 2 / 3;
  background: linear-gradient(145deg, #24242f, #14141b);
  background-size: cover;
  background-position: center;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 30px;
}
.card-body { padding: 10px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--line);
  color: var(--muted);
}
.badge.admin { background: rgba(229,9,20,.15); color: #ff6b72; }
.badge.ban { background: rgba(255,176,32,.15); color: var(--warn); }
.badge.ok { background: rgba(61,220,132,.13); color: var(--ok); }

/* -------------------------------- buttons --------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: #22222c; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: #ff7a80; border-color: rgba(229,9,20,.4); }
.btn-danger:hover { background: rgba(229,9,20,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --------------------------------- forms ---------------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(229,9,20,.18), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(22,22,29,.92);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 26px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #101018;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4a4a5c;
}
textarea { resize: vertical; min-height: 74px; }

.msg {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.msg.show { display: block; }
.msg.error { background: rgba(229,9,20,.12); color: #ff8e93; border: 1px solid rgba(229,9,20,.3); }
.msg.success { background: rgba(61,220,132,.1); color: var(--ok); border: 1px solid rgba(61,220,132,.3); }

.switch-line { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.switch-line a { color: var(--text); text-decoration: underline; }

/* --------------------------------- admin ---------------------------------- */

.admin-wrap { padding: 0 4vw 60px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  padding: 11px 18px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  background: none; border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 780px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--bg-elev); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input { max-width: 280px; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.show { display: grid; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 18px; font-size: 19px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.credential-box {
  background: #0d0d14;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  margin: 12px 0;
  color: var(--ok);
}

.log-list { font-size: 13px; }
.log-list li { padding: 9px 0; border-bottom: 1px solid var(--line); list-style: none; color: var(--muted); }
.log-list b { color: var(--text); }
.log-list ul { padding: 0; margin: 0; }

/* --------------------------------- watch ---------------------------------- */

.player-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 4vw 60px; }
.player {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.player iframe, .player video { width: 100%; height: 100%; border: 0; display: block; }
.player-meta { margin-top: 22px; }
.player-meta h1 { margin: 0 0 8px; font-size: 27px; }

.empty { color: var(--muted); padding: 50px 4vw; text-align: center; }

@media (max-width: 620px) {
  .nav { gap: 14px; padding: 12px 4vw; }
  .nav-links { display: none; }
  .row-scroll { grid-auto-columns: 132px; }
  .hero { min-height: 48vh; }
}
