:root {
  --bg: #101822;
  --bg-soft: #15202b;
  --bg-card: #1a2431;
  --text: #f3f6fa;
  --text-soft: #9ca8b7;
  --text-muted: #6b7684;
  --accent: #2b7cee;
  --shadow: 0 20px 50px rgba(5, 11, 18, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(43, 124, 238, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 153, 0, 0.08), transparent 20%),
    var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(16, 24, 34, 0.86);
  backdrop-filter: blur(16px);
  overflow-x: auto;
  flex-wrap: nowrap;
}

.topbar::-webkit-scrollbar {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand-lockup h1 {
  text-decoration: none;
  color: var(--text);
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.site-links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
}

.search-shell {
  position: relative;
  flex: 1 1 320px;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  border: 2px solid var(--text-muted);
  border-radius: 999px;
  opacity: 0.9;
  pointer-events: none;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: var(--text-muted);
  transform: rotate(45deg);
  transform-origin: center;
}

.search-input {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px 12px 44px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.content-shell {
  padding: 8px 16px 24px;
}

.topbar-inline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.source-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.source-switcher-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.source-switcher-select,
.source-switcher-select {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}

.source-switcher-select {
  min-width: 128px;
  padding: 8px 12px;
}

.chip-row {
  display: flex;
  gap: 10px;
  overflow: hidden;
  padding: 0;
  min-width: 0;
  white-space: nowrap;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}

.chip.is-active {
  background: #f3f6fa;
  color: #111827;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.video-tile {
  min-width: 0;
}

.video-link {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.media-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.video-thumb-media,
.media-fallback {
  width: 100%;
  height: 100%;
}

.video-thumb-media {
  display: block;
  object-fit: cover;
}

.video-thumb-image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.media-fallback {
  background:
    radial-gradient(circle at top right, rgba(43, 124, 238, 0.2), transparent 30%),
    linear-gradient(135deg, #1f2937, #111827);
}

.duration-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 6px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.video-tooltip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(7, 12, 18, 0.92);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.video-link:hover .video-tooltip,
.video-link:focus-visible .video-tooltip,
.video-link:focus-within .video-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  grid-column: 1 / -1;
  border-radius: 18px;
  padding: 32px 24px;
  background: rgba(255, 255, 255, 0.04);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 8px;
  color: var(--text-soft);
}

.pagination {
  display: flex;
  justify-content: flex-start;
  flex: 0 0 auto;
  gap: 8px;
  margin-top: 0;
  white-space: nowrap;
}

.pagination-link {
  min-width: 40px;
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}

.pagination-link-icon {
  min-width: 34px;
  padding-right: 10px;
  padding-left: 10px;
  font-size: 1rem;
  line-height: 1;
}

.pagination-link.is-active {
  background: var(--accent);
  color: #fff;
}

.pagination-link.is-disabled {
  opacity: 0.35;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 700;
}

@media (min-width: 700px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .video-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .video-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .content-shell {
    padding-right: 8px;
    padding-left: 8px;
  }
}