:root {
  --bg: #0d1117;
  --bg2: #11161d;
  --card: #161c25;
  --line: #232c3a;
  --fg: #e6edf3;
  --muted: #8b98a9;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 20px;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; color: var(--accent); }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.2px; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12px; color: var(--muted); }

.btn {
  background: var(--accent-dim); color: #fff; border: 0;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600;
}
.btn:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 13px; }

.tabs {
  display: flex; gap: 4px; padding: 10px 20px 0;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  overflow-x: auto; position: sticky; top: 69px; z-index: 19;
}
.tab {
  background: transparent; border: 0; color: var(--muted);
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.view { padding: 20px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1; }

.foot {
  padding: 16px 20px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--line); text-align: center;
}

h2.section { font-size: 17px; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
h2.section:first-child { margin-top: 0; }
h2.section .count { color: var(--muted); font-weight: 400; font-size: 13px; }

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

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card:hover { border-color: #33405a; }
.card .cover { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--bg2); }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.card h3 a { color: var(--fg); }
.card h3 a:hover { color: var(--accent); }
.card .desc { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px; color: var(--accent); background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.25); border-radius: 20px; padding: 2px 9px;
}
.meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.meta img.avatar { width: 22px; height: 22px; border-radius: 50%; }
.meta .stat { white-space: nowrap; }

.trend-card { cursor: pointer; }
.trend-card .body { gap: 10px; }
.trend-card h3 { font-size: 16px; }
.scorebar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.scorebar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.trend-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.trend-stats b { color: var(--fg); }

.detail-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.detail-head h2 { margin: 0 0 8px; font-size: 21px; }
.detail-head p { margin: 0 0 10px; color: var(--muted); }
.qlist { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.qlist li { margin-bottom: 4px; }

.subtabs { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.subtab {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.subtab.active { color: #fff; background: var(--accent-dim); border-color: var(--accent-dim); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 220px; background: var(--card); border: 1px solid var(--line);
  color: var(--fg); padding: 9px 14px; border-radius: 8px; font-size: 14px;
}
.search:focus { outline: none; border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 8px 6px 14px; font-size: 14px;
  cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--accent); }
.chip.on { border-color: var(--accent); background: rgba(88,166,255,0.12); }
.chip button {
  background: var(--line); border: 0; color: var(--fg); border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1;
}
.chip button:hover { background: var(--bad); }
.addrow { display: flex; gap: 8px; margin-bottom: 18px; max-width: 420px; }

.skel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 120px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.errbox {
  background: rgba(248,81,73,0.08); border: 1px solid rgba(248,81,73,0.4);
  color: #ffa198; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; font-size: 14px;
}
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.more-row { text-align: center; margin: 18px 0 6px; }

video.post { width: 100%; max-height: 320px; background: #000; display: block; }
.thumblink { position: relative; display: block; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.thumblink .thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumblink .playbadge {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 52px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.7);
  pointer-events: none;
}
.thumblink:hover .thumb { opacity: 0.85; }
.podrow {
  display: flex; gap: 14px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.podrow img { width: 64px; height: 64px; border-radius: 8px; }
.podrow .t { font-weight: 600; }
.podrow .p { color: var(--muted); font-size: 13px; }

.backlink { display: inline-block; margin-bottom: 12px; cursor: pointer; }

.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.linklike:hover { text-decoration: underline; }

.cardhead { display: flex; gap: 8px; align-items: flex-start; }
.cardhead h3 { flex: 1; margin: 0; font-size: 16px; line-height: 1.4; }
.cardhead h3 a { color: var(--fg); }
.cardhead h3 a:hover { color: var(--accent); }
.savebtn {
  flex: none; background: rgba(0,0,0,0.45); color: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 8px; cursor: pointer; font-size: 15px; line-height: 1.4;
}
.savebtn:hover { border-color: var(--accent); }
.savebtn[aria-pressed="true"] { background: var(--accent-dim); border-color: var(--accent-dim); }

.modal-back {
  position: fixed; inset: 0; z-index: 50; padding: 16px;
  background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center;
}
.modal-back[hidden] { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; max-width: 440px; width: 100%;
}
.modal h2 { margin: 0 0 10px; font-size: 18px; }
.modal .muted { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.modal .muted.small { font-size: 12.5px; }
.modal .search { width: 100%; margin: 6px 0 4px; }
.keyrow { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.auth-status { min-height: 20px; font-size: 13.5px; color: var(--muted); margin: 4px 0; }
#authBtn.connected { border-color: var(--good); color: var(--good); }

@media (max-width: 640px) {
  .view { padding: 14px; }
  .tabs { top: 67px; }
  .grid { grid-template-columns: 1fr; }
}
