:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #7c5cff;
  --accent2: #22c55e;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --icon: rgba(255, 255, 255, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(124, 92, 255, 0.22), transparent 60%),
              radial-gradient(900px 500px at 80% 0%, rgba(34, 197, 94, 0.18), transparent 55%),
              var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

a { color: inherit; text-decoration: none; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 16, 32, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px 0;
}
.topbar-social {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  margin-left: auto;
}
.topbar-social .social-links {
  justify-content: flex-end;
}
.topbar-social .social-link {
  padding: 5px 8px;
}
.topbar-social .social-link-text {
  display: none;
}
@media (min-width: 1100px) {
  .topbar-social .social-link-text {
    display: inline;
  }
}
.brand {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.brand a {
  color: inherit;
  text-decoration: none;
}
.brand a:hover {
  color: var(--accent);
}
.catalog-top {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 360px);
  grid-template-areas:
    "title search"
    "meta meta";
  gap: 14px 16px;
  align-items: center;
  margin: 22px 0 14px;
}
.catalog-header {
  grid-area: title;
  display: flex;
  align-items: center;
  min-width: 0;
}
.catalog-header .catalog-title {
  margin: 0;
  min-width: 0;
  font-size: 22px;
}
.catalog-search {
  grid-area: search;
  min-width: 0;
  width: 100%;
}
@media (max-width: 980px) {
  .catalog-top {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "search"
      "meta";
    align-items: stretch;
  }
}
.catalog-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  outline: none;
}
.catalog-search-input::placeholder { color: var(--muted); }
.catalog-search-input:focus {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.catalog-search-empty {
  margin: 8px 0 0;
  text-align: center;
}
.catalog-search-empty[hidden] { display: none !important; }
.nav {
  margin-left: auto;
  display: flex;
  gap: 14px;
}
.nav a {
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
}
.nav a:hover {
  background: var(--panel);
  color: var(--text);
}

h1 { font-size: 28px; }
h2 { font-size: 18px; margin: 0 0 10px; }
.muted { color: var(--muted); }
span.icon { color: var(--icon); }

.build-status {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 16px;
  background: rgba(124, 92, 255, 0.12);
}
.build-status[hidden] { display: none !important; }
.build-status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.build-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: build-spin 0.8s linear infinite;
}
@keyframes build-spin {
  to { transform: rotate(360deg); }
}
.build-progress {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.build-progress[hidden] { display: none !important; }
.build-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.build-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.95), rgba(34, 197, 94, 0.85));
  transition: width 0.35s ease;
}
.build-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.build-result {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.build-result[hidden] { display: none !important; }
.build-result--success {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}
.build-result--error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
}
.build-result a { text-decoration: underline; }

.btn, .btn-primary, button.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--panel2); transform: translateY(-1px); }
.btn-primary, button.btn-primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(34, 197, 94, 0.75));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
}
.btn-primary:hover, button.btn-primary:hover { transform: translateY(-1px); }

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 780px) {
  .cards { grid-template-columns: 1fr; }
}
.card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}
pre {
  margin: 10px 0 0;
  padding: 12px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.meta {
  display: grid;
  grid-area: meta;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  margin-bottom: 0;
}
.meta-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.meta-toggle {
  display: none;
  width: 36px;
  height: 36px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .08s ease;
}
.meta-toggle:hover {
  background: rgba(124, 92, 255, 0.16);
  border-color: rgba(124, 92, 255, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}
.meta-toggle-icon {
  display: block;
  transition: transform .2s ease;
}
.meta.is-expanded .meta-toggle-icon {
  transform: rotate(180deg);
}
.meta-toggle[hidden] { display: none !important; }
@media (max-width: 980px) {
  .meta {
    --meta-collapsed-height: 108px;
    --meta-fade-color: rgba(11, 16, 32, 0.92);
  }
  .meta.is-collapsible .meta-toggle {
    display: flex;
  }
  .meta.is-collapsible:not(.is-expanded) .meta-body {
    max-height: var(--meta-collapsed-height);
    overflow: hidden;
    position: relative;
  }
  .meta.is-collapsible:not(.is-expanded) .meta-body::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    background: linear-gradient(180deg, transparent, var(--meta-fade-color));
    pointer-events: none;
  }
  .meta.is-collapsible.is-expanded .meta-body {
    max-height: none;
    overflow: visible;
  }
}
.meta-row { display: flex; gap: 0.5em; align-items: center; flex-wrap: wrap; }
.label { color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .08s ease;
}
.chip:hover {
  background: rgba(124, 92, 255, 0.16);
  border-color: rgba(124, 92, 255, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}
a.chip { text-decoration: none; }
.chip.is-active {
  background: rgba(124, 92, 255, 0.22);
  border-color: rgba(124, 92, 255, 0.45);
  color: var(--text);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 0;
  line-height: 1;
}
.chip.is-active .badge {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px rgba(124, 92, 255, 0.5);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
}

.video-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.video-card[hidden] { display: none !important; }
.video-card.is-unavailable { opacity: 0.75; }
.thumb-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.thumb-link:hover .thumb { opacity: 0.92; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: rgba(0, 0, 0, 0.25); transition: opacity 0.15s ease; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.video-card .body { padding: 12px 12px 14px; display: grid; gap: 8px; }
.title { font-size: 15px; margin: 0; line-height: 1.3; }
.sub {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
.sub-date,
.sub-meta,
.sub-duration,
.sub-likes,
.sub-comments {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sub-meta {
  gap: 10px;
  margin-left: auto;
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 980px) {
  .playlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .playlist-grid { grid-template-columns: 1fr; }
}
.playlist-card {
  display: grid;
  grid-template-columns: 20px 140px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
}
.playlist-card:hover { background: var(--panel2); }
.playlist-card input { width: 18px; height: 18px; }
.playlist-card .thumb { width: 140px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; }
.playlist-card .body { display: grid; gap: 6px; }
.playlist-card .body .title { font-weight: 600; font-size: 14px; }
.playlist-card .body .sub { color: var(--muted); font-size: 13px; }
.footer-actions { position: sticky; bottom: 0; padding: 14px 0 10px; background: linear-gradient(180deg, transparent, rgba(11,16,32,0.92)); }

.footer {
  margin-top: 32px;
  padding: 20px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
.footer .container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-copy {
  font-weight: 600;
  color: var(--text);
}
.footer-author { color: var(--accent); }
.footer-author:hover { text-decoration: underline; }
.footer-about { max-width: 60ch; line-height: 1.5; }
.footer-updated {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}
.social-link:hover {
  background: var(--panel2);
  border-color: rgba(124, 92, 255, 0.35);
}
.social-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
  object-position: center;
}
.social-link-text { font-size: 13px; }
