:root {
  --bg: #f1f3f4;
  --surface: #ffffff;
  --text: #202124;
  --text2: #5f6368;
  --line: #dadce0;
  --blue: #1a73e8;
  --red: #d93025;
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Roboto", "Helvetica Neue", Arial, system-ui, sans-serif;
  overscroll-behavior-y: contain;
}

/* --- top bar ------------------------------------------------------------- */
#topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--line);
}
#topbar .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px; max-width: 700px; margin: 0 auto;
}
#topbar h1 {
  font-size: 22px; margin: 0 0 0 6px; font-weight: 500; letter-spacing: -.2px; flex: 1;
}
#topbar h1::first-letter { color: var(--blue); }
#hamburger {
  background: transparent; color: var(--text); border: none;
  width: 40px; height: 40px; font-size: 22px; flex: 0 0 auto;
}
#hamburger:active { background: #e8eaed; border-radius: 50%; }

/* --- category browser (Pushover-style drawer) -------------------------- */
#menu-backdrop { position: fixed; inset: 0; background: rgba(32,33,36,.45); z-index: 15; transition: opacity .15s; }
.menu {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 16;
  width: 88%; max-width: 560px;
  background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: 4px 0 32px rgba(60,64,67,.28);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
  transition: transform .2s ease, opacity .2s ease;
}
.menu.hidden { transform: translateX(-100%); }       /* slide-in drawer */
.menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; font-size: 13px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .6px;
  position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 1;
}
.arch-switch { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  color: var(--text2); text-transform: none; letter-spacing: 0; }
.arch-switch input { width: 18px; height: 18px; accent-color: var(--blue); }

.cat-list { padding: 0 0 24px; }
.cat-row {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 12px 16px; background: transparent; border: none; border-bottom: 1px solid #eef0f2;
  text-align: left; cursor: pointer;
}
.cat-row:active { background: #f1f3f4; }
.cat-row.active { background: #e8f0fe; }
.cat-all { border-bottom: 6px solid #f1f3f4; }

.cat-ic-wrap {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, white);
}
.cat-ic { width: 24px; height: 24px; display: block; }

.cat-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cat-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cat-name { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cat-time { flex: 0 0 auto; font-size: 12px; color: var(--text2); font-weight: 500; }
.cat-blurb {
  font-size: 13px; line-height: 1.34; color: var(--text2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-height: 2.7em;
}
.cat-counts { flex: 0 0 auto; align-self: center; display: flex; align-items: center; gap: 5px; }
.cat-count {
  flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.cat-count.total  { background: #eceef1; color: #80868b; }   /* grey: all messages */
.cat-count.unread { background: #cfd4da; color: #3c4043; }   /* darker grey: unarchived */

/* --- blue expandable summary ------------------------------------------- */
.summary-x { margin: 2px 0 10px; }
.summary-x > summary { color: var(--blue); font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; }
.summary-x > summary::-webkit-details-marker { display: none; }
.summary-x > summary::before { content: "▸ "; }
.summary-x[open] > summary::before { content: "▾ "; }
.summary-x p { color: #1a4fa0; font-size: 14px; line-height: 1.55; margin: 9px 0 0; }
.actions { display: flex; align-items: center; }
.actions button {
  background: transparent; color: var(--text2);
  border: none; border-radius: 50%; width: 32px; height: 34px; flex: 0 0 auto;
  font-size: 15px; margin-left: 1px; line-height: 1; padding: 0;
}
.actions button:active { background: #e8eaed; }
#markall-btn { font-size: 12px; font-weight: 800; letter-spacing: -2px; color: var(--blue); }
.sortbtn.active, #saved-btn.active { background: #e8f0fe; box-shadow: inset 0 0 0 1.5px #d2e3fc; }
#topbar h1 { min-width: 0; }   /* let the title shrink so 6 action icons fit */

/* --- tabs --------------------------------------------------------------- */
#tabs {
  display: flex; gap: 6px; padding: 4px 12px 8px; overflow-x: auto;
  scrollbar-width: none; max-width: 700px; margin: 0 auto;
}
#tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: transparent; color: var(--text2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 15px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.tab.active { background: #e8f0fe; color: var(--blue); border-color: #d2e3fc; }
.tab.archive { color: var(--text2); }

/* --- list & cards (Pushover-style: borderless rows, full-width dividers) -- */
#list { padding: 0; display: flex; flex-direction: column;
        max-width: 700px; margin: 0 auto; background: var(--surface); }

.card {
  position: relative; touch-action: pan-y;
  background: var(--surface);
  border: none; border-radius: 0; box-shadow: none;
  border-bottom: 1px solid var(--line);     /* full-width grey divider between stories */
  padding: 16px 16px;
  overflow: hidden;
  transition: transform .22s ease, opacity .22s ease, height .22s ease, padding .22s ease, margin .22s ease;
}
.card.urgent { background: #fff8f7; }        /* subtle tint instead of a side border */
.card.removing { opacity: 0; height: 0 !important; padding: 0 16px; margin: 0; border-bottom: 0; }
.card.swiping { transition: none; user-select: none; cursor: grabbing; }
/* drag-left affordance: red trailing edge + "Archive" hint */
.card.will-archive { box-shadow: inset -4px 0 0 var(--red); }
.card.will-archive::after {
  content: "Archive"; position: absolute; top: 14px; right: 14px;
  color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .3px;
}

.src { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.src-name { font-weight: 600; color: var(--text); }
.src-meta { color: var(--text2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert { color: var(--red); font-weight: 700; font-size: 11px; letter-spacing: .3px; }
.sig {
  font-size: 11px; font-weight: 700; color: var(--text2);
  background: #f1f3f4; border-radius: 6px; padding: 2px 7px; flex: 0 0 auto;
}
.sig-landmark { background: #fce8e6; color: #c5221f; }
.sig-major { background: #feefc3; color: #b06000; }
.sig-significant { background: #fff7e0; color: #8a6d00; }

.card h2 { font-size: 18px; line-height: 1.3; margin: 0 0 8px; font-weight: 500; color: var(--text); }
.card h2 .title-link { color: var(--blue); text-decoration: none; }
.card h2 .title-link:active { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chip { font-size: 11px; color: var(--text2); background: #f1f3f4; border-radius: 999px; padding: 3px 9px; }
.chip b { color: var(--blue); font-weight: 700; }

.teaser { color: #3c4043; margin: 0 0 10px; font-size: 15px; }

/* structured detail blocks (the important ones: packages + benchmarks) */
.block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; background: #fafafa; }
.block-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text2); margin-bottom: 6px; }
.block ul { margin: 0; padding-left: 18px; }
.block li { margin: 2px 0; }
.pkgs { border-left: 3px solid var(--red); }
.pkgs li { font-family: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #3c4043; }
.bench { border-left: 3px solid var(--blue); }
.bench li { font-size: 14px; color: #3c4043; }

.why summary { color: var(--blue); font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: "▸ "; }
.why[open] summary::before { content: "▾ "; }
.why p { color: #3c4043; font-size: 14px; margin: 8px 0 0; }
.why .full { color: var(--text2); }

/* Summary + Why it matters + delivery time on one line */
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 4px 0 10px; }
.meta-row .summary-x, .meta-row .why { margin: 0; }
.meta-row .delivered { margin-left: auto; font-size: 12px; color: var(--text2); white-space: nowrap; }
/* an expanded toggle drops its content to its own full-width line below */
.meta-row details[open] { flex-basis: 100%; order: 3; }

.adj {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; min-width: 34px; height: 29px; font-size: 13px; font-weight: 600;
  padding: 0 6px;
}
.adj:active { background: #e8eaed; }

/* one-line action row: Ask Claude · −5 · +5 · Save · Mark read */
.foot { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; margin-top: 12px; }
.ask {
  background: #e8f0fe; color: var(--blue); border: none; border-radius: 999px;
  padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; white-space: nowrap; flex: 0 0 auto;
}
.ask:active { background: #d2e3fc; }
.donebtn { flex: 0 0 auto; background: transparent; color: var(--text2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.donebtn:active { background: #e8eaed; }
.savebtn { flex: 0 0 auto; background: transparent; color: var(--text2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.savebtn::before { content: "☆"; margin-right: 3px; }
.savebtn.on { background: #e8f0fe; color: var(--blue); border-color: #d2e3fc; }
.savebtn.on::before { content: "★"; }
.savebtn:active { background: #e8eaed; }
.foot .adj { margin: 0; }

.empty { text-align: center; color: var(--text2); padding: 70px 24px; font-size: 15px; }

/* twice-daily 12-hour brief */
.digest {
  background: var(--surface); border-bottom: 1px solid var(--line); border-left: 4px solid var(--blue);
  padding: 16px;
}
.digest-foot { margin-top: 12px; }
.digest-done { background: transparent; color: var(--text2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; }
.digest-done:active { background: #e8eaed; }
/* expandable full summary (collapsed concise version is shown by default) */
.digest-full { margin: 4px 0 0; }
.digest-full > summary { color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; list-style: none; }
.digest-full > summary::-webkit-details-marker { display: none; }
.digest-full > summary::before { content: "▸ "; }
.digest-full[open] > summary::before { content: "▾ "; }
/* weekly deep-tech brief: distinct purple accent */
.digest-weekly { border-left-color: #7c3aed; }
.digest-weekly .digest-h { color: #7c3aed; }
/* Fable 5 prediction-markets brief: amber accent */
.digest-fable { border-left-color: #d97706; }
.digest-fable .digest-h { color: #b45309; }
.digest.removing { opacity: 0; height: 0 !important; padding: 0 16px; margin: 0; overflow: hidden;
  border-bottom: 0; transition: opacity .22s ease, height .22s ease, padding .22s ease, margin .22s ease; }
.digest-h {
  font-size: 13px; font-weight: 700; color: var(--blue); text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline;
}
.digest-h span { font-weight: 400; color: var(--text2); text-transform: none; letter-spacing: 0; font-size: 11px; }
.digest p { margin: 0 0 9px; font-size: 14px; color: #3c4043; line-height: 1.5; }
.digest p:last-child { margin-bottom: 0; }

/* --- leaderboard table (tabular message cards, e.g. daily LLM top-5) ----- */
table.lb {
  width: 100%; border-collapse: collapse; margin: 10px 0 4px;
  font-size: 13px; line-height: 1.3;
}
table.lb th, table.lb td {
  padding: 5px 8px; text-align: left; border-bottom: 1px solid #eef0f2;
  white-space: nowrap;
}
table.lb th {
  font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid var(--line);
}
table.lb td.num, table.lb th.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
table.lb td:first-child { font-weight: 600; color: var(--text); white-space: normal; }
table.lb tbody tr:nth-child(odd) { background: #f7f8f9; }
table.lb tbody tr:last-child td { border-bottom: none; }

/* --- toast -------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #202124; color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.3);
  transition: opacity .25s; z-index: 20;
}
.hidden { opacity: 0; pointer-events: none; }
