:root {
  --bg: #0f0f0f;
  --surface: #1f1f1f;
  --surface-2: #272727;
  --text: #f1f1f1;
  --text-dim: #aaa;
  --accent: #ff0000;
  --border: #303030;
  --chip-bg: #272727;
  --chip-active: #f1f1f1;
  --chip-active-text: #0f0f0f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: Roboto, "Segoe UI", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
  height: 56px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-center { flex: 1; max-width: 720px; margin: 0 24px; }
.icon-btn {
  background: none; border: none; color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; }
.logo-mark { color: var(--accent); font-size: 22px; }
.logo-text { letter-spacing: -0.5px; }
.logo-img {
  height: 32px; width: auto; display: block;
  /* lift the logo a touch off the dark bg for legibility */
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.3));
}

.search { display: flex; width: 100%; }
.search input {
  flex: 1; background: #121212; color: var(--text);
  border: 1px solid var(--border); border-right: none;
  padding: 0 16px; height: 40px; border-radius: 20px 0 0 20px; font-size: 16px;
}
.search input:focus { outline: none; border-color: #1c62b9; }
.search button {
  width: 64px; height: 40px; border-radius: 0 20px 20px 0;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  cursor: pointer;
}
.search button:hover { background: #383838; }
.search svg { width: 22px; height: 22px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f39c12, #e74c3c);
  color: #fff; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center;
}
.avatar.small { width: 32px; height: 32px; font-size: 14px; }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 240px; padding: 12px 8px; border-right: 1px solid transparent;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; }
.sidebar h4 { color: var(--text); font-size: 14px; padding: 8px 12px; margin: 8px 0 4px; }
.sidebar hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px; border-radius: 10px; color: var(--text); font-size: 14px;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--surface-2); font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.ch-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-block; }

/* Content */
.content { flex: 1; padding: 16px 24px; overflow: hidden; }
.chips {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px;
  position: sticky; top: 56px; background: var(--bg); z-index: 10;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  background: var(--chip-bg); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 14px;
  white-space: nowrap; cursor: pointer; border: none;
}
.chip:hover { background: #383838; }
.chip.active { background: var(--chip-active); color: var(--chip-active-text); }

.grid {
  display: grid; gap: 16px 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin-top: 12px;
}
.card { cursor: pointer; }
.thumb {
  width: 100%; aspect-ratio: 16/9; border-radius: 12px;
  object-fit: cover; background: #222; display: block;
  position: relative;
}
.thumb-wrap { position: relative; }
.duration {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.85); color: #fff;
  font-size: 12px; padding: 2px 4px; border-radius: 4px; font-weight: 500;
}
.card-meta { display: flex; gap: 12px; padding: 12px 4px 0; }
.card-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.card-text h3 {
  margin: 0 0 4px; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-text .ch { color: var(--text-dim); font-size: 12px; margin-bottom: 2px; }
.card-text .stats { color: var(--text-dim); font-size: 12px; }

/* Watch page */
.watch-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px; padding: 24px; max-width: 1800px; margin: 0 auto;
}
.player-wrap {
  width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: 12px; overflow: hidden;
}
#player { width: 100%; height: 100%; display: block; }
.video-title { font-size: 20px; margin: 12px 0 8px; }
.video-meta { display: flex; flex-direction: column; gap: 12px; }
.channel-row { display: flex; align-items: center; gap: 12px; }
.ch-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #3498db, #9b59b6);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}
.channel-info { flex: 1; }
.channel-name { font-weight: 600; }
.channel-subs { font-size: 12px; color: var(--text-dim); }
.subscribe-btn {
  background: var(--text); color: var(--bg); border: none;
  padding: 10px 16px; border-radius: 20px; font-weight: 600; cursor: pointer;
}
.subscribe-btn.subscribed {
  background: var(--surface-2); color: var(--text);
}
.subscribe-btn.subscribed:hover { background: #383838; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn {
  background: var(--surface-2); color: var(--text); border: none;
  padding: 8px 14px; border-radius: 18px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.action-btn:hover { background: #383838; }
.like-group { display: flex; background: var(--surface-2); border-radius: 18px; }
.like-group .action-btn { background: transparent; border-radius: 18px; }
.like-group .action-btn + .action-btn { border-left: 1px solid #404040; }

.description {
  background: var(--surface-2); border-radius: 12px;
  padding: 12px; margin-top: 12px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap;
}
.comments { margin-top: 24px; }
.comments h3 { margin: 0 0 16px; font-size: 16px; }
.comment-input-row { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.comment-input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); padding: 8px 0; font-size: 14px;
}
.comment-input:focus { outline: none; border-bottom-color: var(--text); }
.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment .body { font-size: 14px; }
.comment .head { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.comment .head b { color: var(--text); margin-right: 6px; font-size: 13px; }

/* Watch sidebar */
.watch-side { display: flex; flex-direction: column; gap: 8px; }
.side-card {
  display: grid; grid-template-columns: 168px 1fr; gap: 8px; cursor: pointer;
}
.side-card .thumb { aspect-ratio: 16/9; border-radius: 8px; }
.side-card h4 {
  margin: 0 0 4px; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side-card .ch, .side-card .stats { color: var(--text-dim); font-size: 12px; }

/* Auth + upload pages */
.signin-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #3ea6ff; color: #3ea6ff;
  padding: 8px 12px; border-radius: 18px; font-weight: 500; font-size: 14px;
}
.signin-btn:hover { background: rgba(62,166,255,0.1); }

.auth-page {
  max-width: 420px; margin: 60px auto; padding: 32px;
  background: var(--surface); border-radius: 12px;
}
.auth-page h1 { margin: 0 0 8px; font-size: 24px; }
.auth-page p.sub { margin: 0 0 24px; color: var(--text-dim); font-size: 14px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; background: var(--surface-2); border: none; color: var(--text);
  padding: 10px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.auth-tab.active { background: var(--text); color: var(--bg); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { font-size: 13px; color: var(--text-dim); }
.auth-form input, .auth-form textarea, .auth-form select {
  width: 100%; background: #121212; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.auth-form input:focus, .auth-form textarea:focus, .auth-form select:focus {
  outline: none; border-color: #3ea6ff;
}
.auth-form button[type="submit"] {
  background: #3ea6ff; color: var(--bg); border: none;
  padding: 12px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
  margin-top: 8px;
}
.auth-form button[type="submit"]:hover { background: #2196f3; }
.auth-form button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-error {
  background: rgba(255, 0, 0, 0.1); color: #ff6b6b;
  padding: 10px; border-radius: 8px; font-size: 13px; margin-top: 8px;
}
.auth-page .demo-note {
  margin-top: 16px; padding: 10px; background: var(--surface-2);
  border-radius: 8px; font-size: 12px; color: var(--text-dim); line-height: 1.5;
}
.upload-progress {
  width: 100%; height: 6px; background: var(--surface-2);
  border-radius: 3px; overflow: hidden; margin-top: 8px;
}
.upload-progress > div {
  height: 100%; background: #3ea6ff; width: 0%; transition: width 0.2s;
}

@media (max-width: 1100px) {
  .watch-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
@media (max-width: 700px) {
  .topbar-center { margin: 0 8px; }
  .content { padding: 12px; }
}

/* ---------- RMTL Cinema ---------- */
.cinema-hero {
  margin: -8px 0 20px;
  padding: 28px 24px;
  background: linear-gradient(135deg, #2c1414, #1a0d0d 60%, #0f0f0f);
  border-radius: 14px;
  border: 1px solid #3a1c1c;
}
.cinema-hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  background: linear-gradient(90deg, #ffb86b, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.cinema-hero p { margin: 0; color: var(--text-dim); font-size: 14px; }

.cinema-card { display: flex; flex-direction: column; }
.cinema-card .cinema-cta {
  margin-top: 10px;
  background: linear-gradient(90deg, #ff6b6b, #ffb86b);
  color: #0f0f0f;
  border: none;
  padding: 10px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.cinema-card .cinema-cta:hover { filter: brightness(1.08); }

.price-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(255, 107, 107, 0.95);
  color: #fff; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  font-size: 12px;
}
.own-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(46, 204, 113, 0.95);
  color: #0f0f0f; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  font-size: 12px;
}

/* Paywall on watch page */
.paywall-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  z-index: 5;
}
.paywall-card {
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 360px;
  text-align: center;
  backdrop-filter: blur(6px);
}
.paywall-badge {
  display: inline-block;
  background: linear-gradient(90deg, #ff6b6b, #ffb86b);
  color: #0f0f0f;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}
.paywall-card h2 { margin: 0 0 6px; font-size: 20px; }
.paywall-card p  { margin: 0 0 16px; color: var(--text-dim); font-size: 14px; }
.paywall-price {
  font-size: 32px; font-weight: 700; margin-bottom: 16px;
  background: linear-gradient(90deg, #ffb86b, #ff6b6b);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.paywall-buy {
  width: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffb86b);
  color: #0f0f0f;
  border: none;
  padding: 12px 18px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.paywall-buy:hover { filter: brightness(1.08); }
.paywall-buy:disabled { opacity: 0.6; cursor: not-allowed; }
.paywall-note { margin-top: 10px; font-size: 12px; color: var(--text-dim); }

/* The .player-wrap needs relative positioning so the overlay can absolute-fill */
.player-wrap { position: relative; }

