:root {
  --bg: #0b0b0f;
  --bg-elevated: #16161c;
  --bg-elevated-2: #1e1e26;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --text: #f2f2f2;
  --text-dim: #9a9aa5;
  --border: #262630;
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #1a0a0d 0%, var(--bg) 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

/* Top navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: linear-gradient(to bottom, rgba(11,11,15,0.97), rgba(11,11,15,0.75) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.logo {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.5px;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}
.logo span { color: #fff; }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; border-bottom-color: var(--accent); }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 32px 80px;
}

h1.page-title { font-size: 24px; margin: 12px 0 24px; font-weight: 700; letter-spacing: -0.3px; }

/* Poster-style grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  margin-bottom: 10px;
}

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
  color: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.card:hover {
  transform: scale(1.06);
  box-shadow: 0 16px 34px rgba(0,0,0,0.65);
  z-index: 5;
}
.card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  color: rgba(255,255,255,0.9);
  opacity: 0;
  transition: opacity .2s ease;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.card:hover .card-play { opacity: 1; }
.card-info {
  position: relative;
  z-index: 1;
  padding: 12px 12px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0) 90%);
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-meta { font-size: 11px; color: rgba(255,255,255,0.72); margin-top: 4px; }
.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  z-index: 2;
}
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 3;
}
.card:hover .card-actions { opacity: 1; }
.card-actions button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-actions button:hover { background: var(--accent); }

.card-grad-0 { background: linear-gradient(150deg, #6d1b2f 0%, #1b1b3a 100%); }
.card-grad-1 { background: linear-gradient(150deg, #4a1b5e 0%, #16161c 100%); }
.card-grad-2 { background: linear-gradient(150deg, #7a3a0e 0%, #1b1b1b 100%); }
.card-grad-3 { background: linear-gradient(150deg, #0e4a4a 0%, #16161c 100%); }
.card-grad-4 { background: linear-gradient(150deg, #5e1b3a 0%, #16161c 100%); }
.card-grad-5 { background: linear-gradient(150deg, #1b3a5e 0%, #16161c 100%); }
.card-grad-6 { background: linear-gradient(150deg, #3a5e1b 0%, #16161c 100%); }
.card-grad-7 { background: linear-gradient(150deg, #5e4a1b 0%, #16161c 100%); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, transform .08s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-secondary { background: var(--bg-elevated-2); color: #fff; }
.btn-secondary:hover { background: #292933; }
.btn-block { width: 100%; }

/* Panels / cards for forms */
.panel {
  max-width: 900px;
  margin: 0 auto 30px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  border: 1px solid var(--border);
}
.panel h2 { font-size: 15px; margin: 0 0 16px; font-weight: 700; letter-spacing: 0.2px; }
.panel h3 { font-size: 13px; margin: 0 0 10px; color: var(--text-dim); font-weight: 600; }
.panel label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }

input[type=text], input[type=password] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: #fff;
  font-size: 14px;
  margin-bottom: 14px;
}
input[type=text]:focus, input[type=password]:focus { outline: none; border-color: var(--accent); }
input[type=file] { width: 100%; color: var(--text-dim); font-size: 13px; margin-bottom: 14px; }

.progress-wrap { margin-top: 14px; display: none; }
.progress-bar { width: 100%; height: 7px; background: #2a2a32; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #ff5b60); transition: width .2s ease; }
.progress-label { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.field-error { color: #ff6b6b; font-size: 12px; margin-top: 10px; display: none; }

.empty { color: var(--text-dim); text-align: center; margin: 60px 0; font-size: 14px; }

/* Series manage list */
.episode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.episode-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.episode-controls { display: flex; gap: 5px; flex-shrink: 0; }
.episode-controls button {
  background: var(--bg-elevated-2);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.episode-controls button:hover { background: #2c2c36; }
