/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg: #0a0b0d;
  --bg-elevated: #121417;
  --bg-card: #181b20;
  --border: #24272d;
  --border-hover: #f5a623;

  --text-primary: #edeef0;
  --text-secondary: #8a8f98;
  --text-tertiary: #565b63;

  --accent: #f5a623;
  --accent-soft: rgba(245, 166, 35, 0.12);
  --live: #3ddc97;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(245, 166, 35, 0.06), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(61, 220, 151, 0.05), transparent 40%);
  min-height: 100vh;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 28px;
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px rgba(245, 166, 35, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}

.brand__text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand__text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.search {
  flex: 1;
  max-width: 440px;
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

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

.search input:hover {
  border-color: #3a3f47;
}

.search input:focus-visible {
  border-color: var(--accent);
  background: var(--bg-card);
}

.search__clear {
  position: absolute;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search__clear:hover {
  color: var(--text-primary);
  background: #23262c;
}

.topbar__count {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
}

#channelCount {
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
}

.count__label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   GRID + CARDS
   ============================================================ */
main {
  padding: 28px;
}

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

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.card:hover,
.card:focus-visible {
  border-color: var(--border-hover);
  background: #1c1f25;
  transform: translateY(-1px);
}

.card:hover .card__icon,
.card:focus-visible .card__icon {
  color: var(--accent);
  transform: translateX(2px);
}

.card:active {
  transform: translateY(0);
}

.card__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  min-width: 24px;
}

.card__live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  flex-shrink: 0;
  box-shadow: 0 0 6px 1px rgba(61, 220, 151, 0.6);
  animation: pulse 2.4s ease-in-out infinite;
}

.card__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color 0.15s ease, transform 0.15s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 60px 20px;
}

.empty span {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
  }
  .topbar__brand {
    order: 1;
  }
  .topbar__count {
    order: 2;
    margin-left: 0;
  }
  .search {
    order: 3;
    max-width: none;
    width: 100%;
  }
  main {
    padding: 16px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .brand__dot,
  .card__live {
    animation: none;
  }
  .card {
    transition: none;
  }
}
