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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222536;
  --accent: #4f8ef7;
  --accent-dim: #2a4a8a;
  --text: #e2e4ef;
  --text-muted: #7a7f9a;
  --green: #3ecf8e;
  --red: #e05a5a;
  --radius: 8px;
  --gap: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────── */
header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--surface2);
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.separator { opacity: 0.4; }

.refresh-btn {
  background: var(--surface2);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 3px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.refresh-btn:hover { background: var(--accent-dim); color: #fff; }

/* ── Filter nav ──────────────────────────────── */
.filters {
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--surface2);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.filter-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--surface2);
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Grid ────────────────────────────────────── */
main {
  padding: 16px 20px 40px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.card:hover { border-color: #3a3f5c; }
.card--no-data { opacity: 0.45; }

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 1px solid #2a2d3e;
}

.ch-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}
.ch-num--unknown { color: var(--text-muted); }

.ch-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-cat-badge {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Card body ───────────────────────────────── */
.card-body {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-body--empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 48px;
}

.prog-time {
  font-size: 11px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.prog-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.rating {
  font-size: 10px;
  background: var(--red);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

.prog-genre {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prog-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 2px;
}

/* ── No results ──────────────────────────────── */
.no-results {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 15px;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  .channel-grid { grid-template-columns: 1fr; }
  header { flex-direction: column; gap: 8px; }
}
