:root {
  --bg: #0a0a12;
  --bg2: #12121f;
  --panel: #18182a;
  --line: #2a2a44;
  --text: #e8e8f5;
  --muted: #8a8aa8;
  --purple: #8b5cf6;
  --purple2: #a78bfa;
  --red: #ef4444;
  --glow: 0 0 30px rgba(139, 92, 246, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -200px, #1c143a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--purple2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }

/* Nav */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(10,10,18,0.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: 1px; }
.brand span { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 8px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 14px; }
.inline { display: inline; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; cursor: pointer;
  font-weight: 600; transition: .15s; text-decoration: none;
}
.btn:hover { border-color: var(--purple); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--purple), #6d28d9); border: none; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: #5a2230; color: #ff8a8a; }
.btn.danger:hover { border-color: var(--red); }
.btn.full { width: 100%; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* Login */
.login-card {
  max-width: 380px; margin: 8vh auto 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 36px 30px;
  box-shadow: var(--glow); text-align: center;
}
.login-logo { font-size: 30px; color: var(--purple2); letter-spacing: 4px; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-card input, .panel input, .panel textarea {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 15px;
}
input:focus, textarea:focus { outline: none; border-color: var(--purple); }
.error { background: #3a1520; border: 1px solid #5a2230; color: #ff9a9a; padding: 10px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.notice { background: #14253a; border: 1px solid #244a6a; color: #9ad0ff; padding: 10px 14px; border-radius: 10px; margin-bottom: 18px; }

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; }

/* Video grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: .15s; }
.card:hover { border-color: var(--purple); transform: translateY(-3px); text-decoration: none; }
.thumb {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: var(--purple2);
  background: linear-gradient(135deg, #1a1330, #241a40);
}
.card-body { padding: 12px 14px; }
.card-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.card-meta { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }

/* Watch */
.back { display: inline-block; margin-bottom: 14px; }
.watch-title { margin: 0 0 14px; }
.player { background: #000; border-radius: 14px; overflow: hidden; box-shadow: var(--glow); }
.player video { width: 100%; display: block; max-height: 75vh; }
.desc { color: var(--text); margin: 16px 0 6px; white-space: pre-wrap; }

/* Admin */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 22px; }
.panel h3 { margin: 0 0 14px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.row input { flex: 1; min-width: 140px; margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.tag { background: var(--purple); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px; margin-left: 6px; }
.hidden { display: none; }
.progress { height: 10px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
#progressBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--purple2)); transition: width .2s; }

/* Storage meter */
.storage-bar { height: 14px; background: var(--bg2); border-radius: 8px; overflow: hidden; margin: 4px 0 12px; }
.storage-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--purple2)); transition: width .3s; }
.storage-stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
