:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-2: #f78166;
  --danger: #f85149;
  --ok: #3fb950;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; }
body { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

#sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}
#sidebar header { margin-bottom: 16px; }
#sidebar h1 { margin: 0 0 4px; font-size: 18px; }
#sidebar .meta { font-size: 12px; color: var(--text-dim); }
#sidebar h3 { font-size: 11px; text-transform: uppercase; color: var(--text-dim); letter-spacing: 0.05em; margin: 18px 0 8px; }
#sidebar section { margin-bottom: 4px; }
#sidebar input[type="search"], #sidebar select {
  width: 100%; padding: 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
#sidebar label { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; cursor: pointer; }
#sidebar label input { margin: 0; }
#sidebar .checks.scroll { max-height: 220px; overflow-y: auto; padding-right: 4px; }
#sidebar footer button {
  margin-top: 16px; width: 100%; padding: 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
#sidebar footer button:hover { background: var(--border); }

main { padding: 16px 20px 80px; }
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
#count { font-size: 13px; color: var(--text-dim); }
#count b { color: var(--text); font-size: 16px; }
#warning { font-size: 11px; color: var(--accent-2); }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex; flex-direction: column;
  font-size: 13px;
}
.card .media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}
.card .media img, .card .media video {
  width: 100%; height: 100%; object-fit: cover;
  background: #000;
}
.card .media .play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; background: rgba(0,0,0,0.55); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: white; font-size: 20px;
  pointer-events: none;
}
.card .media .badges {
  position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; flex-wrap: wrap;
}
.card .media .badge {
  background: rgba(0,0,0,0.7); color: white; font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.card .media .badge.days { background: var(--accent); }
.card .media .badge.days.hot { background: var(--ok); }
.card .media .badge.days.cold { background: var(--surface-2); color: var(--text-dim); }
.card .media .badge.format { background: var(--accent-2); }

.card .page {
  display: flex; gap: 8px; padding: 10px 12px 0; align-items: center;
}
.card .page .pic {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); flex-shrink: 0; object-fit: cover;
}
.card .page .info { min-width: 0; flex: 1; }
.card .page .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .page .cat { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .page .likes { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

.card .body {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.4;
  max-height: 6em;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.card .body.expanded { max-height: none; }
.card .body.collapsed::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 1.8em;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}

.card .title { padding: 4px 12px; font-weight: 600; font-size: 12px; }
.card .link-desc { padding: 0 12px 6px; font-size: 11px; color: var(--text-dim); }

.card .cta {
  margin: 0 12px 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
  border: 1px solid var(--border);
}
.card .cta .label { color: var(--text-dim); font-size: 11px; }
.card .cta .val { color: var(--accent); font-weight: 600; }
.card .cta a.linkout { color: var(--accent); text-decoration: none; font-size: 11px; }

.card .verticals { padding: 0 12px 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.card .verticals .tag {
  background: var(--surface-2); color: var(--text-dim);
  padding: 2px 8px; border-radius: 12px; font-size: 10px; cursor: pointer;
}
.card .verticals .tag:hover { background: var(--accent); color: white; }

.card .meta-row {
  padding: 8px 12px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-dim);
}
.card .meta-row a { color: var(--accent); text-decoration: none; }
.card .meta-row a:hover { text-decoration: underline; }
.card.inactive { opacity: 0.55; }

#loader {
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
  cursor: pointer;
}
#loader:hover { color: var(--text); }

/* responsive */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  #sidebar { position: relative; height: auto; max-height: 50vh; }
}
