@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: radial-gradient(circle at 20% 20%, #1a2a4a, #0b1224 40%, #080c1a 80%);
  --surface: rgba(255, 255, 255, 0.04);
  --card: rgba(255, 255, 255, 0.06);
  --muted: #9fb0c7;
  --text: #e8edf5;
  --accent: #66e3ff;
  --accent-2: #f7b733;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 50px rgba(4, 6, 19, 0.6);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --transition: all 200ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 18px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 10;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.brand-mark {
  padding: 6px 10px;
  background: var(--accent);
  color: #031727;
  border-radius: 999px;
  font-size: 0.9rem;
}

.brand-name {
  color: var(--text);
}

.topbar-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  transition: var(--transition);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-icon {
  padding: 8px 10px;
}

.btn-small {
  padding: 8px 10px;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(120deg, #66e3ff, #7cf8c6);
  color: #041021;
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(102, 227, 255, 0.3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.refresh-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-refresh {
  width: 16px;
  height: 16px;
  display: inline-block;
  fill: currentColor;
}

.refresh-status {
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1em;
}

.refresh-status[data-variant='success'] {
  color: #7cf8c6;
}

.refresh-status[data-variant='error'] {
  color: #f7b733;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 6px;
}

.lede {
  color: #cdd9ec;
  margin: 8px 0 18px;
}

.hero {
  margin-top: 26px;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  align-items: center;
  box-shadow: var(--shadow);
}

.hero__text h1 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 2.7vw, 2.4rem);
  line-height: 1.2;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.hero__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-date-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  font-size: 0.95rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.hero__card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: radial-gradient(circle at 20% 30%, rgba(102, 227, 255, 0.25), rgba(255, 255, 255, 0.02) 55%), rgba(255, 255, 255, 0.03);
  min-height: 160px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.hero__card-title {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.network-grid {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.network-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.network-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.network-card img {
  width: 120px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.network-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tag {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.feed-section {
  margin-top: 30px;
}

.feed-list {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.feed-list--single {
  grid-template-columns: 1fr;
}

[data-feed-sentinel] {
  height: 64px;
  width: 100%;
  grid-column: 1 / -1;
}

.feed-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.feed-list--single .feed-card {
  grid-template-columns: minmax(240px, 1.2fr) minmax(260px, 1fr);
  grid-template-areas:
    "meta media"
    "title media"
    "desc media"
    "footer media";
  align-items: start;
  column-gap: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.feed-list--single .feed-card__meta { grid-area: meta; }
.feed-list--single .feed-card__title { grid-area: title; }
.feed-list--single .feed-card__desc { grid-area: desc; }
.feed-list--single .feed-card__media {
  grid-area: media;
  align-self: stretch;
  border: none;
  background: transparent;
}
.feed-list--single .feed-card__footer { grid-area: footer; justify-content: flex-start; }
.feed-list--single [data-action="toggle-watched"] { display: none; }
.feed-list--single .pill-date {
  display: none;
  padding: 6px 10px;
  font-size: 0.95rem;
}

.feed-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.feed-card__title {
  margin: 0;
  font-size: 1.15rem;
}

.feed-card__desc {
  color: #dbe5f6;
}

.feed-card__media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #040814;
}

.feed-card__media video {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.feed-card__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.feed-card--watched {
  opacity: 0.7;
  position: relative;
}

.pill-watched {
  background: rgba(102, 227, 255, 0.15);
  color: #9be8ff;
}

.pill-network {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
}

.source-link {
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid transparent;
}

.source-link:hover {
  border-bottom-color: var(--accent);
}

.description p {
  margin: 0 0 8px;
}

input[type='search'],
.search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

input[type='search']::placeholder {
  color: var(--muted);
}

input[type='search']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 227, 255, 0.15);
}

.hero--compact {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 16, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.modal-overlay > div {
  background: rgba(12, 14, 26, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 14px;
  width: min(900px, 100%);
}

#videoPlayer {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.modal-close {
  margin-top: 10px;
  width: 100%;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  flex-wrap: wrap;
}

.filter-bar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .topbar {
    position: static;
  }

  .hero {
    padding: 22px;
  }

  .hero__header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .feed-list {
    grid-template-columns: 1fr;
  }

   /* Stack the hero single feed card vertically on mobile */
  .feed-list--single .feed-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "title"
      "desc"
      "media"
      "footer";
  }

  .hero-date-pill {
    display: none;
  }

  .feed-list--single .pill-date {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 18px 14px 60px;
  }

  .btn,
  .chip {
    width: 100%;
    justify-content: center;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
  }

  .brand {
    white-space: nowrap;
  }

  .topbar-links {
    width: auto;
    flex: 1;
    justify-content: flex-end;
    gap: 6px;
  }

  .topbar .btn,
  .topbar .chip {
    width: auto;
    padding: 6px 10px;
    font-size: 0.9rem;
    white-space: nowrap;
  }
}
