:root {
  --bg: #ffffff; --surface: #ffffff; --text: #18181b; --muted: #71717a; --line: #e4e4e7; --chip: #f4f4f5;
  --accent: #e5484d; --accent-soft: #fdecec; --hot-1: #f59e0b; --hot-2: #e5484d;
  --gold: #f5b301; --silver: #a1a1aa; --bronze: #c2703d;
  --yt: #ff0033; --hn: #ff6600; --rd: #ff4500; --good: #16a34a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.09);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c; --surface: #141416; --text: #f4f4f5; --muted: #a1a1aa; --line: #27272a; --chip: #1f1f23;
    --accent: #ff6369; --accent-soft: #2a1416; --good: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lift: 0 8px 28px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 36px 16px 96px; }

/* ---------- header ---------- */
h1 { margin: 0; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
h1::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); margin-right: 12px; vertical-align: 6px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); animation: beacon 2.4s ease-out infinite; }
h1 span { color: var(--accent); }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 12px transparent; } }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sub-open { font: inherit; font-size: 14px; font-weight: 650; border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--surface); color: var(--accent); border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s; }
.sub-open:hover { background: var(--accent); color: #fff; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 17px; }

/* ---------- controls ---------- */
.bar { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.tabs { display: flex; background: var(--chip); border-radius: 12px; padding: 4px; }
.tabs button { font: inherit; font-size: 14px; border: 0; background: none; color: var(--muted);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: var(--shadow); }
#q { flex: 1 1 220px; min-width: 0; }
input, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: transparent; }
button[type=submit], .btn { font: inherit; font-size: 14px; font-weight: 650; border: 0; border-radius: 10px;
  padding: 8px 14px; background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; }
button[type=submit]:hover { filter: brightness(1.06); }
button[type=submit]:disabled { opacity: .5; cursor: default; }

.labels, .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.labels { margin-top: 12px; }
.label { font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 2px 10px; cursor: pointer; transition: color .15s, border-color .15s; }
.label:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.label.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- cards ---------- */
.list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.card { position: relative; display: grid; grid-template-columns: 44px 44px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px 14px 12px;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  animation: rise .45s ease both; animation-delay: calc(var(--i) * 40ms); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
@keyframes rise { from { opacity: .6; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card, h1::before { animation: none; } .card:hover { transform: none; } }

.rank { font-weight: 800; font-size: 15px; color: var(--muted); text-align: center; padding-top: 10px; font-variant-numeric: tabular-nums; }
.avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--chip); object-fit: cover; }
.main { min-width: 0; }
.title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.name { font-weight: 700; font-size: 17px; text-decoration: none; word-break: break-word; letter-spacing: -.01em; }
.name:hover { color: var(--accent); }
.owner { color: var(--muted); font-weight: 500; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.new { background: var(--accent); color: #fff; letter-spacing: .03em; text-transform: uppercase; }
.badge.multi { background: color-mix(in srgb, var(--hot-1) 16%, transparent); color: color-mix(in srgb, var(--hot-1) 70%, var(--text)); }
.desc { margin: 4px 0 0; font-size: 15px; }

.quote { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 10px 10px 0; font-size: 14px; }
.quote p { margin: 0; font-style: italic; }
.quote cite { display: block; margin-top: 2px; font-style: normal; font-size: 12px; color: var(--muted); }
.quote cite::before { content: "— "; }
.quote cite a { text-decoration: none; } .quote cite a:hover { text-decoration: underline; }

.heat { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.heat-bar { flex: 1; max-width: 220px; height: 6px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.heat-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hot-1), var(--hot-2)); }
.heat-label { font-size: 12px; font-weight: 650; color: var(--hot-2); }

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.stars { font-weight: 650; color: var(--text); }
.lang { display: inline-flex; align-items: center; gap: 5px; }
.lang i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.src { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-size: 12.5px;
  padding: 2px 9px 2px 3px; border-radius: 999px; background: var(--chip); color: var(--text); }
.src b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 999px;
  color: #fff; font-size: 10px; }
.src.youtube b { background: var(--yt); } .src.hackernews b { background: var(--hn); } .src.reddit b { background: var(--rd); }
.src.community b { background: var(--good); }
.src:hover { filter: brightness(.95); }
.tags { margin-top: 10px; }
.tags .label { font-size: 12px; padding: 1px 8px; }

/* Newest: day headers (timeline) and the infinite-scroll sentinel */
.day { position: sticky; top: 52px; z-index: 2; list-style: none; padding: 6px 0 2px; pointer-events: none; }
.day span { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; }
body:not(:has(#subbar:not([hidden]))) .day { top: 8px; }
.more { display: block; margin: 16px auto 0; font: inherit; font-size: 14px; color: var(--muted); background: none;
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 18px; cursor: pointer; }

/* podium: the top three */
.card.podium { border-width: 1.5px; }
.card.podium .rank { font-size: 26px; padding-top: 2px; }
.card.podium .name { font-size: 19px; }
.card.p1 { border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 9%, var(--surface)), var(--surface) 55%); }
.card.p2 { border-color: color-mix(in srgb, var(--silver) 55%, var(--line)); }
.card.p3 { border-color: color-mix(in srgb, var(--bronze) 45%, var(--line)); }

/* inline subscribe card */
.cta { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 18px; border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); animation: rise .45s ease both; }
.cta-icon { font-size: 34px; line-height: 1; }
.cta h3 { margin: 0; font-size: 17px; }
.cta p { margin: 4px 0 10px; color: var(--muted); font-size: 14px; }
.cta .subscribe { display: flex; flex-wrap: wrap; gap: 8px; }
.cta .subscribe input[type=email] { flex: 1 1 160px; min-width: 0; width: 0; }

/* ---------- sticky subscribe bar ---------- */
.subbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.subbar-in { max-width: 760px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
/* padding gives the pulsing dot's ring room inside the clipped (ellipsis) box */
.subbar-text { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 12px 0 12px 14px; margin: -12px 0 -12px -14px; }
.subbar-text .pulse { display: inline-block; margin-right: 8px; vertical-align: 1px; }
.subbar .subscribe { display: flex; gap: 6px; }
.subbar input[type=email] { width: 200px; padding: 6px 10px; }
.subbar button[type=submit] { padding: 6px 12px; }
.subbar-msg { max-width: 760px; margin: 0 auto; padding: 0 16px 8px; font-size: 13px; }
.subbar-msg:empty { display: none; }
.subbar-text b { white-space: nowrap; }
@media (max-width: 900px) { .hide-sm { display: none; } }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; animation: beacon 2.4s ease-out infinite; }

/* ---------- misc ---------- */
.formmsg { margin: 6px 0 0; font-size: 13px; }
.subbar .subbar-msg { max-width: 760px; margin: -2px auto 0; padding: 0 16px 8px; font-size: 13px; text-align: center; }
.formmsg:empty { display: none; }
.ok { color: var(--good); } .err { color: var(--accent); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--text); }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.meta { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }
.meta:empty { display: none; }

/* ---------- propose popup ---------- */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 10; font: inherit; font-size: 14px; font-weight: 650;
  border: 0; border-radius: 999px; padding: 11px 18px; background: var(--text); color: var(--bg); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.popup { position: fixed; right: 20px; bottom: 20px; z-index: 11; width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.22); }
.popup-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.popup h2 { margin: 0; font-size: 16px; }
.popup form { display: grid; gap: 10px; }
.popup label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.popup textarea { resize: vertical; }
.count { margin-left: auto; font-size: 12px; }

/* ---------- admin page helpers ---------- */
.ghost { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 7px 12px; cursor: pointer; text-decoration: none; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .wrap { padding-top: 24px; }
  h1 { font-size: 28px; }
  .hide-sm { display: none; }
  .subbar-in { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .subbar-text { flex-basis: calc(100% - 32px); order: 0; white-space: normal; }
  .subbar #subbar-close { order: 1; }
  .subbar .subscribe { order: 2; flex-basis: 100%; min-width: 0; }
  .subbar input[type=email] { flex: 1 1 0; width: 0; min-width: 0; }
  .card { grid-template-columns: 36px 1fr; padding: 14px; }
  .card .rank { grid-row: 1; padding-top: 6px; }
  .card .avatar { width: 36px; height: 36px; border-radius: 10px; grid-row: 1; grid-column: 1; display: none; }
  .card.podium .rank { font-size: 22px; }
  .cta { grid-template-columns: 1fr; }
  .cta-icon { display: none; }
  .fab, .popup { right: 16px; bottom: 16px; }
}

/* ---------- links on cards / header ---------- */
a.stars.gh { text-decoration: none; }
a.stars.gh .gh-arrow { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 2px; }
a.stars.gh:hover .gh-arrow { color: var(--accent); }
.toplinks { margin: 10px 0 0; display: flex; gap: 14px; font-size: 14px; }
.toplinks a { text-decoration: none; font-weight: 600; }
.toplinks a:hover { color: var(--accent); }

/* ---------- server-rendered pages (repo, weekly) ---------- */
.detail-wrap { padding-top: 24px; }
.crumbs { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.brand-link { font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; display: inline-flex; align-items: center; }
.brand-link span { color: var(--accent); }
.brand-link .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 9px; }
.crumb-links { display: flex; gap: 16px; font-size: 14px; }
.crumb-links a { text-decoration: none; color: var(--muted); font-weight: 600; }
.crumb-links a:hover { color: var(--accent); }
.detail h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.2; word-break: break-word; }
.detail h2 { margin: 28px 0 10px; font-size: 18px; }
.detail .lead { color: var(--muted); font-size: 17px; margin: 8px 0 0; }
.kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.detail-head { display: flex; gap: 16px; align-items: center; }
.avatar.big { width: 64px; height: 64px; border-radius: 16px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge.hot { background: var(--accent); color: #fff; text-decoration: none; text-transform: none; letter-spacing: 0; }
.badge.muted-badge { background: var(--chip); color: var(--muted); font-weight: 600; }
.detail-desc { font-size: 18px; margin: 16px 0 0; }
.cta-row { margin: 16px 0 0; }
a.btn { display: inline-block; text-decoration: none; }
.mentions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mention { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mention-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.mention-head .muted { color: var(--muted); }
.mention-title { display: block; margin-top: 6px; font-weight: 650; text-decoration: none; }
.mention-title:hover { color: var(--accent); }
.mention .said { margin: 6px 0 0; font-style: italic; color: var(--text); }
.verdict { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.verdict.recommended { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.verdict.critical { background: var(--accent-soft); color: var(--accent); }
.thanks { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.thanks a { color: var(--text); font-weight: 600; }
.featured-box { margin-top: 28px; padding: 16px 18px; border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 14px; }
.featured-box h2 { margin-top: 0; }
.snippet { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.snippet code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 12px/1.5 ui-monospace, Menlo, monospace;
  background: var(--chip); border-radius: 8px; padding: 8px 10px; }
.copy { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.credits { margin-top: 28px; }
.credits ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.credits a { text-decoration: none; }
.week-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: 14px; font-weight: 600; }
.week-nav a { text-decoration: none; }
.week-nav a:hover { color: var(--accent); }
.mini-sub { margin-top: 36px; padding: 16px 18px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); border: 1px solid var(--line); }
.mini-sub .subscribe { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mini-sub input[type=email] { flex: 1 1 200px; min-width: 0; width: 0; }
@media (max-width: 640px) { .detail h1 { font-size: 22px; } .snippet { flex-direction: column; } .copy { padding: 6px 12px; } }

.detail h1::before, .credits h1::before { display: none; }
