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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222534;
  --border: #2e3146;
  --accent: #5b7fff;
  --accent-hover: #7b97ff;
  --text: #e2e8f0;
  --muted: #8892a4;
  --radius: 10px;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.site-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.tagline { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* ── Search ── */
.search-section { padding: 32px 0 24px; }
.search-box {
  display: flex;
  gap: 10px;
}
.search-box input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--muted); }
.search-box button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  transition: background 0.2s;
  white-space: nowrap;
}
.search-box button:hover { background: var(--accent-hover); }

/* ── Results meta ── */
.results-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Message result card ── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.result-card:hover { border-color: var(--accent); }
.result-card .channel-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.result-card .channel-name a {
  color: inherit;
  text-decoration: none;
}
.result-card .channel-name a:hover { text-decoration: underline; }
.result-card .msg-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.result-card .msg-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Channel grid (top/trending) ── */
.trending-section { padding: 16px 0 32px; }
.trending-section h2 {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s, background 0.2s;
}
.channel-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
.channel-card .ch-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-card .ch-username {
  color: var(--accent);
  font-size: 0.8rem;
  margin-bottom: 6px;
}
.channel-card .ch-about {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.channel-card .ch-members {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 8px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 24px 0;
  flex-wrap: wrap;
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 6px 14px;
  transition: all 0.2s;
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Loader ── */
.loader {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 0.9rem;
}

/* ── Empty ── */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 0.95rem;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 16px 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}
.site-footer a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }

/* ── Download CTA (homepage hero) ── */
.download-cta {
  margin: 20px 0 4px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #1f2742 0%, #29325a 100%);
  border: 1px solid #3a447a;
  border-radius: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 6px 20px rgba(91, 127, 255, 0.18);
}
.download-cta-text { flex: 1 1 280px; min-width: 0; }
.download-cta-tag {
  display: inline-block;
  padding: 2px 9px;
  background: rgba(91, 127, 255, 0.18);
  color: var(--accent-hover);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.download-cta-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.3;
}
.download-cta-pitch {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.5;
}
.download-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.download-cta-btn {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: var(--radius);
  transition: background 0.15s;
  white-space: nowrap;
}
.download-cta-btn:hover { background: var(--accent-hover); }
.download-cta-copy {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.download-cta-copy:hover { border-color: var(--accent); color: var(--accent-hover); }
.download-cta-copy.copied { border-color: #2ecc71; color: #2ecc71; }
.download-cta-more {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0 4px;
}
.download-cta-more:hover { color: var(--accent-hover); }

/* ── Download page ── */
.download-page { padding-top: 28px; padding-bottom: 40px; }
.download-hero {
  padding: 28px;
  background: linear-gradient(135deg, #172031 0%, #223055 64%, #172031 100%);
  border: 1px solid #3a447a;
  border-radius: 18px;
  box-shadow: 0 10px 34px rgba(91, 127, 255, 0.18);
}
.download-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.45rem);
  line-height: 1.18;
  margin: 6px 0 10px;
  letter-spacing: -0.03em;
}
.download-hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 20px;
}
.download-page-actions { justify-content: flex-start; }
.download-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.download-card,
.download-install {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.download-card h2,
.download-install h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}
.download-card p,
.download-install li,
.download-note {
  color: var(--muted);
  font-size: 0.9rem;
}
.download-card a { color: var(--accent-hover); text-decoration: none; }
.download-card a:hover { text-decoration: underline; }
.download-install ol { padding-left: 20px; }
.download-install li { margin: 7px 0; }
.download-install code {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}
.download-note { margin-top: 12px; }

@media (max-width: 600px) {
  .search-box { flex-direction: column; }
  .search-box button { width: 100%; }
  .channel-grid { grid-template-columns: 1fr; }
  .download-cta { flex-direction: column; align-items: stretch; padding: 16px; }
  .download-cta-actions { flex-direction: column; align-items: stretch; }
  .download-cta-actions > * { width: 100%; text-align: center; }
  .download-hero { padding: 20px; }
  .download-card-grid { grid-template-columns: 1fr; }
}
