:root {
  --bg: #0f1115;
  --bg-card: #181b21;
  --bg-elev: #1f232b;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-dim: #9aa0aa;
  --accent: #4f7cff;
  --accent-hover: #6a91ff;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 17, 21, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.search {
  flex: 1;
  display: flex;
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.search input {
  flex: 1;
  background: var(--bg-card);
  border: none;
  outline: none;
  color: var(--text);
  padding: 10px 16px;
  font-size: 14px;
}
.search-btn {
  background: var(--bg-elev);
  border: none;
  color: var(--text-dim);
  padding: 0 16px;
  cursor: pointer;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.btn-ghost, .btn-primary, .btn-social {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-elev); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.full { width: 100%; padding: 11px; margin-top: 4px; }

.categories {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  overflow-x: auto;
  max-width: 1400px;
  margin: 0 auto;
}
.cat {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-card);
  white-space: nowrap;
  border: 1px solid transparent;
}
.cat:hover { color: var(--text); border-color: var(--border); }
.cat.active { background: var(--accent); color: #fff; }

/* ---------- Grid ---------- */
.grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

.video-card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  transition: transform .15s ease;
}
.video-card:hover { transform: translateY(-2px); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb::after {
  content: "▶";
  font-size: 30px;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.35);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.75);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-meta { padding: 10px 12px 14px; }
.video-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 26px 24px;
  animation: pop .15s ease;
}
@keyframes pop {
  from { transform: scale(.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: #fff; }

.modal-form h2 {
  margin: 0 0 4px;
  font-size: 19px;
}
.modal-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-dim);
}
.modal-form.hidden { display: none; }

.modal-form label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.modal-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.modal-form input:focus { border-color: var(--accent); }

.forgot {
  display: block;
  text-align: right;
  font-size: 12.5px;
  color: var(--accent);
  margin: -6px 0 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--text-dim);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-social {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-social:hover { background: #262b34; }
