/* ===========================================================================
   SyncNews — original stylesheet. Dense, single-page news grid.
   Theme via [data-theme] on <html>; density via [data-density] on <body>.
   =========================================================================== */
:root {
  --accent: #e11d48;
  --col-width: 248px;     /* used when columns = auto */
  --col-count: auto;      /* overridden by JS for fixed column counts */
  --row-gap: 14px;
  --fs-base: 14px;
  --fs-item: 13.5px;
}

html[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --bg-elev2: #fafbfc;
  --text: #14181f;
  --text-soft: #5b6472;
  --text-faint: #8a93a3;
  --border: #e4e7ec;
  --border-strong: #d2d7df;
  --link: #1d3a8a;
  --link-visited: #6b3fa0;
  --hover: #eef1f6;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --trending-bg: #fff;
}
html[data-theme="dark"] {
  --bg: #0c0f14;
  --bg-elev: #151a22;
  --bg-elev2: #1b212b;
  --text: #e8ecf2;
  --text-soft: #a3adbd;
  --text-faint: #6c7689;
  --border: #232a35;
  --border-strong: #313a48;
  --link: #9ec1ff;
  --link-visited: #c4a8ff;
  --hover: #1e2530;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --trending-bg: #151a22;
}

* { box-sizing: border-box; }
/* `.drawer{display:flex}` etc. would otherwise beat the UA [hidden] rule. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
/* Never scroll horizontally: lock the page (and the sticky header) to the viewport
   width on narrow / mobile screens, so it can't be dragged left to reveal empty
   space on the right. `clip` (not `hidden`) keeps position:sticky on .topbar working. */
html { overflow-x: clip; }
body { overflow-x: clip; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

.skip {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 8px 12px; z-index: 1000; border-radius: 0 0 6px 0;
}
.skip:focus { left: 0; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.bar-inner {
  display: flex; align-items: center; gap: 14px;
  max-width: 1840px; margin: 0 auto; padding: 9px 16px;
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; border-radius: 7px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.brand-rank { color: var(--accent); }

.search {
  display: flex; align-items: center; gap: 7px; flex: 1; max-width: 460px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-radius: 9px; padding: 0 11px; height: 38px; color: var(--text-faint);
}
.search:focus-within { border-color: var(--accent); color: var(--text-soft); }
.search input {
  border: 0; outline: 0; background: transparent; color: var(--text);
  width: 100%; font-size: 14px;
}
.bar-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.iconbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-elev2); color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 9px;
  height: 38px; padding: 0 12px; font-size: 13px; font-weight: 600;
  transition: background .12s, border-color .12s, color .12s;
}
.iconbtn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.iconbtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.iconbtn.primary:hover { filter: brightness(1.07); color: #fff; }
.iconbtn .updated { font-size: 11.5px; font-weight: 500; color: var(--text-faint); }
.iconbtn.primary .updated { color: rgba(255,255,255,.85); }

/* sun/moon swap */
.ico-moon { display: none; }
html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: inline; }

/* ---------------- Category filter bar ---------------- */
.catbar {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin;
  max-width: 1840px; margin: 0 auto; padding: 8px 16px;
  border-top: 1px solid var(--border);
}
.catchip {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--bg-elev2);
  color: var(--text-soft); border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.catchip:hover { background: var(--hover); color: var(--text); }
/* active chip: solid category color behind white text (was white-on-white). */
.catchip.active { background: var(--chip, var(--accent)); color: #fff; border-color: transparent; }
.catchip.active:hover { color: #fff; filter: brightness(1.05); }
.catchip.active .dot { background: #fff !important; }
.catchip .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align: middle; }

/* ---------------- Main ---------------- */
#main { max-width: 1840px; margin: 0 auto; padding: 14px 16px 40px; }

/* ---------------- Trending strip ---------------- */
.trending {
  background: var(--trending-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.trending-head {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: 9px; display: flex; align-items: center; gap: 5px;
}
.trending-head .bolt { font-size: 13px; }
.trending-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr);
  gap: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 3px;
}
.tcard {
  display: flex; gap: 9px; align-items: flex-start; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px;
  background: var(--bg-elev2);
}
.tcard:hover { border-color: var(--border-strong); background: var(--hover); }
.tcard .thumb {
  width: 52px; height: 52px; border-radius: 7px; object-fit: cover; flex-shrink: 0;
  background: var(--hover);
}
.tcard .tc-body { min-width: 0; }
.tcard .rank {
  font-size: 11px; font-weight: 800; color: var(--accent);
}
.tcard .tc-title {
  font-size: 13px; font-weight: 650; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tcard:hover .tc-title { text-decoration: underline; }
.tcard .tc-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.tcard .spread { color: var(--accent); font-weight: 700; }

/* ---------------- The grid (equal-height rows + ⚡ divider bars) ---------------- */
.board {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 5), minmax(0, 1fr));
  gap: var(--row-gap) 14px;
  align-items: stretch; /* every card in a row is the same height */
}
.box {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* full-width ⚡ Trending band of photo news cards after each row of cards */
.rowband {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  padding: 9px 12px;
  box-shadow: var(--shadow);
}
.rb-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.rb-head .bolt { font-size: 12px; }
.rb-cards {
  display: grid;
  grid-template-columns: repeat(var(--band-cols, 4), minmax(0, 1fr));
  gap: 9px;
}
.tb-card {
  display: flex; gap: 9px; align-items: flex-start; min-width: 0;
  border-radius: 8px; padding: 4px;
}
.tb-card:hover { background: var(--hover); text-decoration: none; }
.tb-thumb {
  width: 84px; height: 60px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
  background: var(--hover);
}
.tb-thumb.tb-ph {
  background: linear-gradient(135deg, var(--hover), var(--bg-elev2));
  position: relative;
}
.tb-thumb.tb-ph::after {
  content: "⚡"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--accent); opacity: .35; font-size: 18px;
}
.tb-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tb-title {
  font-size: 12.5px; font-weight: 650; color: var(--text); line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tb-card:hover .tb-title { text-decoration: underline; }
.tb-meta { font-size: 11px; color: var(--text-faint); }
.tb-spread { color: var(--accent); font-weight: 700; margin-left: 5px; white-space: nowrap; }
/* first card in each band is the lead: bigger photo, spans two columns on wide grids */
.tb-card.lead { grid-column: span 2; }
.tb-card.lead .tb-thumb { width: 124px; height: 78px; }
.tb-card.lead .tb-title { font-size: 14px; -webkit-line-clamp: 3; }
@media (max-width: 720px) {
  .tb-card.lead { grid-column: span 1; }
  .tb-card.lead .tb-thumb { width: 84px; height: 60px; }
}

/* ⚡ Trending rail — horizontal scroller directly under the Synchronized hero */
.trendrail {
  margin: 0 0 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 11px 13px 12px;
  box-shadow: var(--shadow);
}
.tr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tr-head .bolt { color: var(--accent); }
.tr-title {
  font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.tr-sub { font-size: 12px; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-nav { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
.tr-arrow {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-elev2); color: var(--text); font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.tr-arrow:hover { background: var(--hover); border-color: var(--accent); }
.tr-arrow:disabled { opacity: .35; cursor: default; }
.tr-track {
  display: flex; gap: 11px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity; scroll-behavior: smooth;
  padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.tr-track::-webkit-scrollbar { height: 7px; }
.tr-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.tr-card {
  flex: 0 0 auto; width: 216px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 7px;
  border-radius: 9px; padding: 6px; background: var(--bg-elev2);
  border: 1px solid transparent; transition: border-color .15s, background .15s;
}
.tr-card:hover { background: var(--hover); border-color: var(--border); text-decoration: none; }
.tr-thumb-l {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 7px; object-fit: cover;
  background: var(--hover); flex-shrink: 0;
}
.tr-thumb-l.tb-ph { background: linear-gradient(135deg, var(--hover), var(--bg-elev)); position: relative; }
.tr-thumb-l.tb-ph::after {
  content: "⚡"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--accent); opacity: .35; font-size: 26px;
}
.tr-rank {
  position: absolute; top: 6px; left: 6px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.tr-thumb-wrap { position: relative; }
.tr-card-title {
  font-size: 12.5px; font-weight: 650; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tr-card:hover .tr-card-title { text-decoration: underline; }
.tr-card-meta { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; margin-top: auto; }
.tr-card-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .tr-card { width: 168px; }
}
.box-head {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 11px; border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--bx, var(--accent));
}
.box-head .bh-title {
  font-size: 13.5px; font-weight: 800; color: var(--text); letter-spacing: -.01em;
}
.box-head .bh-title:hover { color: var(--accent); text-decoration: none; }
.box-head .bh-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #fff; background: var(--bx, var(--accent)); border-radius: 4px; padding: 1px 5px;
}
.box-head .bh-flag { font-size: 12px; margin-left: auto; opacity: .85; }
.box-head .bh-pin { font-size: 11px; opacity: .8; }
.box-head.pinned { border-left-width: 4px; }

/* engagement nudge: "Reading Sports? Add ESPN to your board." */
.suggest-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 13px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 10px; font-size: 13px; color: var(--text);
}
.suggest-bar .sg-ico { font-size: 15px; }
.suggest-bar .sg-txt { flex: 1; min-width: 180px; }
.suggest-bar .sg-txt b { font-weight: 800; }
.suggest-bar .sg-add {
  flex: 0 0 auto; cursor: pointer; font-weight: 700; font-size: 12.5px;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px; padding: 5px 12px;
}
.suggest-bar .sg-add:hover { filter: brightness(1.08); }
.suggest-bar .sg-x {
  flex: 0 0 auto; cursor: pointer; border: 0; background: none; color: var(--text-faint);
  font-size: 14px; padding: 4px 6px; border-radius: 6px;
}
.suggest-bar .sg-x:hover { background: var(--hover); color: var(--text); }

/* pinned-sources manager (Customize ▸ Sources) */
.pinned-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pinned-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 4px 3px 10px;
}
.pinned-chip .pin-x {
  border: 0; background: none; color: var(--text-faint); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 5px; border-radius: 50%;
}
.pinned-chip .pin-x:hover { background: var(--hover); color: var(--accent); }
.box-list { list-style: none; margin: 0; padding: 4px 0; }
.box-list li { padding: 0; }
.headline {
  display: block; padding: 5px 11px; border-bottom: 1px solid transparent;
  color: var(--link); font-size: var(--fs-item); line-height: 1.34;
}
.headline:hover { background: var(--hover); text-decoration: none; }
.headline .h-title {
  font-weight: 550;
  /* clamp long headlines to 3 lines so cards stay uniform (no runaway overflow) */
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* hover popup: the FULL text of a clamped (truncated) card headline */
.nr-tip {
  position: fixed; z-index: 2000; max-width: 380px;
  background: rgba(18, 22, 29, .97); color: #fff;
  border: 1px solid rgba(255, 255, 255, .10);
  padding: 8px 11px; border-radius: 8px;
  font-size: 13px; line-height: 1.4; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .32);
  pointer-events: none; opacity: 0; transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
}
.nr-tip.show { opacity: 1; transform: translateY(0); }
.headline:visited .h-title { color: var(--link-visited); }
.headline .h-meta {
  display: flex; gap: 7px; align-items: center; margin-top: 2px;
  font-size: 11px; color: var(--text-faint);
}
.headline .h-src { font-weight: 600; color: var(--text-soft); }
.headline .h-time { white-space: nowrap; }
.headline .h-spread {
  color: var(--accent); font-weight: 700; white-space: nowrap;
}
.box-more {
  display: block; text-align: center; padding: 6px; font-size: 11.5px;
  color: var(--text-soft); font-weight: 600; border-top: 1px solid var(--border);
  background: var(--bg-elev2);
  margin-top: auto; /* pin to the bottom of the equal-height cell */
}
.box-more:hover { background: var(--hover); color: var(--accent); text-decoration: none; }
.box-x {
  margin-left: 6px; border: 0; background: transparent; color: var(--text-faint);
  font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 5px;
}
.box-x:hover { background: var(--hover); color: var(--accent); }
/* bump-to-top: promote an outlet to the first card */
.box-top {
  border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 1px 4px; border-radius: 5px;
}
.box-top:hover { background: var(--accent); color: #fff; }

/* density: compact tightens + drops the wordier meta, but KEEPS the timestamp */
body[data-density="compact"] { --fs-item: 12.5px; --row-gap: 10px; }
body[data-density="compact"] .headline { padding: 3px 10px; }
body[data-density="compact"] .headline .h-src,
body[data-density="compact"] .headline .h-spread { display: none; }
body[data-density="compact"] .headline .h-meta { margin-top: 1px; }
body[data-density="compact"] .box-head { padding: 6px 10px; }
body[data-density="comfy"] { --fs-item: 14.5px; --row-gap: 16px; }
body[data-density="comfy"] .headline { padding: 7px 12px; }

/* the small "Nh ago" timestamp is shown on every headline, always */
.headline .h-time { color: var(--text-faint); }

/* ---------------- Search results ---------------- */
.searchresults {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.sr-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700;
}
.sr-list { max-height: 60vh; overflow-y: auto; }
.sr-item { display: block; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.sr-item:hover { background: var(--hover); text-decoration: none; }
.sr-item .sr-t { font-weight: 600; color: var(--link); }
.sr-item .sr-m { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
/* synchronized-story search hits (open the cross-source pop-up) + section dividers */
.sr-sec { padding: 9px 14px 3px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
button.sr-item { width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--border); cursor: pointer; font: inherit; color: inherit; box-sizing: border-box; }
.sr-item .sr-badge { font-weight: 600; color: var(--link); }
.textbtn { background: none; border: 0; color: var(--text-soft); font-weight: 600; font-size: 12.5px; }
.textbtn:hover { color: var(--accent); }

/* ---------------- Footer ---------------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-elev); margin-top: 20px; }
.foot-inner {
  max-width: 1840px; margin: 0 auto; padding: 16px; display: flex; gap: 16px;
  align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-faint);
}
.foot-brand { font-weight: 800; color: var(--text); }
.foot-free { color: var(--text-soft); }

/* ---------------- Drawer ---------------- */
.scrim { position: fixed; inset: 0; background: rgba(8,12,18,.45); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 420px; max-width: 94vw;
  background: var(--bg-elev); border-left: 1px solid var(--border); z-index: 100;
  display: flex; flex-direction: column; box-shadow: -8px 0 28px rgba(8,12,18,.18);
  animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-tabs { display: flex; gap: 2px; padding: 8px 10px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab {
  border: 0; background: transparent; color: var(--text-soft); font-weight: 650;
  padding: 7px 11px; border-radius: 8px; font-size: 12.5px; white-space: nowrap;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.saved-note { font-size: 11.5px; color: var(--text-faint); }

/* form controls in drawer */
.field { margin-bottom: 18px; }
.field > label.flabel { display: block; font-weight: 700; font-size: 13px; margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin: -3px 0 8px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.segmented button {
  border: 0; background: var(--bg-elev2); color: var(--text-soft);
  padding: 7px 13px; font-size: 12.5px; font-weight: 600; border-right: 1px solid var(--border);
}
.segmented button:last-child { border-right: 0; }
.segmented button.on { background: var(--accent); color: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.swatch.on { border-color: var(--text); transform: scale(1.12); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .15s;
}
.slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .15s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.chiplist { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-elev2); color: var(--text-soft);
  border-radius: 999px; padding: 6px 11px; font-size: 12.5px; font-weight: 600;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.srcsearch {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 11px; background: var(--bg-elev2); color: var(--text); margin-bottom: 10px;
}
.srcgroup { margin-bottom: 14px; }
.srcgroup h4 {
  margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); display: flex; justify-content: space-between;
}
.srcrow {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
}
.srcrow:hover { background: var(--hover); }
.srcrow .sname { font-size: 13px; }
.srcrow .smeta { font-size: 11px; color: var(--text-faint); }
.btn {
  border: 1px solid var(--border-strong); background: var(--bg-elev2); color: var(--text);
  border-radius: 9px; padding: 8px 13px; font-weight: 650; font-size: 13px;
}
.btn:hover { background: var(--hover); }
.btn.ghost { color: var(--text-soft); }
.btn.solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.solid:hover { filter: brightness(1.07); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.addfeed { display: flex; gap: 8px; margin-bottom: 6px; }
.addfeed input {
  flex: 1; height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 11px;
  background: var(--bg-elev2); color: var(--text);
}
.feed-status { font-size: 12px; margin: 4px 0 12px; min-height: 16px; }
.feed-status.ok { color: #16a34a; }
.feed-status.err { color: #dc2626; }
.myfeed {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 7px;
  background: var(--bg-elev2);
}
.section-order { list-style: none; margin: 0; padding: 0; }
.section-order li {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev2);
  cursor: grab; user-select: none;
}
.section-order li.dragging { opacity: .5; border-style: dashed; }
.section-order li.drop-target { border-color: var(--accent); }
.section-order .grip { color: var(--text-faint); font-size: 14px; }
.section-order .so-name { flex: 1; font-size: 13px; font-weight: 600; }
.section-order .so-dot { width: 9px; height: 9px; border-radius: 50%; }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg-elev); padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,.3);
}

.board-empty { text-align: center; color: var(--text-faint); padding: 60px 20px; font-size: 14px; }
.hide-sm { }
@media (max-width: 720px) {
  .hide-sm { display: none; }
  .search { max-width: none; min-width: 0; }
  .search input { min-width: 0; }
  .brand-name { display: none; }
  /* Keep every action button (incl. the primary Customize) inside the viewport:
     drop the "updated …" timestamp label and tighten spacing so the bar fits. */
  .bar-inner { gap: 9px; padding: 9px 12px; }
  .bar-actions { gap: 5px; }
  .iconbtn { padding: 0 9px; }
  .iconbtn .updated { display: none; }
}

/* ===========================================================================
   Synchronized top stories + cluster modal (merged cross-source summary)
   =========================================================================== */
.sync-sub { font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: none; letter-spacing: 0; margin-left: 2px; }
.sync-mode { font-size: 10.5px; font-weight: 700; color: var(--text-faint); text-transform: none; letter-spacing: 0; margin-left: 6px; }

.tcard.sync { cursor: pointer; text-align: left; font: inherit; width: 100%; }
.tcard.sync .rank { display: flex; align-items: center; gap: 6px; }
.sync-badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .02em;
  color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 7px;
}
.tc-single { font-size: 10px; font-weight: 700; color: var(--text-faint); }

/* modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(8,12,18,.55); z-index: 110; backdrop-filter: blur(2px); }
.modal {
  position: fixed; z-index: 120; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 760px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(8,12,18,.45); animation: modalin .16s ease;
}
@keyframes modalin { from { transform: translate(-50%, -47%); opacity: .5; } to { transform: translate(-50%, -50%); opacity: 1; } }
.modal-head {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.cm-headtext { min-width: 0; }
.cm-eyebrow { font-size: 11.5px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; }
.modal-head .iconbtn { flex-shrink: 0; }
.modal-body { padding: 16px 18px 20px; overflow-y: auto; }

.cm-loading { color: var(--text-soft); font-size: 14px; padding: 28px 4px; display: flex; align-items: center; gap: 10px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cm-note { font-size: 12px; color: var(--text-soft); background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; margin-bottom: 14px; }
.cm-summary { font-size: 15px; line-height: 1.6; color: var(--text); }
.cm-summary p { margin: 0 0 12px; }
.cm-summary .cref { color: var(--accent); font-weight: 800; cursor: pointer; font-size: 11px; vertical-align: super; padding: 0 1px; }
.cm-summary .cref:hover { text-decoration: underline; }

.cm-section-h { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 20px 0 8px; }
.cm-refs { margin: 0; padding-left: 22px; }
.cm-refs li { margin-bottom: 6px; font-size: 13.5px; }
.cm-refs li.ref-flash { background: var(--hover); border-radius: 5px; }
.cm-refs .ref-src { font-weight: 700; color: var(--text-soft); }
.cm-coverage { list-style: none; margin: 0; padding: 0; }
.cm-coverage li { border-bottom: 1px solid var(--border); }
.cm-coverage a { display: flex; gap: 9px; align-items: baseline; padding: 7px 4px; }
.cm-coverage a:hover { background: var(--hover); text-decoration: none; border-radius: 6px; }
.cm-coverage .cv-src { font-weight: 700; color: var(--text-soft); font-size: 12px; flex-shrink: 0; min-width: 110px; }
.cm-coverage .cv-title { flex: 1; color: var(--link); font-size: 13.5px; }
.cm-coverage .cv-time { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
@media (max-width: 560px) {
  .cm-coverage .cv-src { min-width: 0; display: block; }
  .cm-coverage a { flex-direction: column; gap: 2px; }
}
.spinner.sm { width: 12px; height: 12px; border-width: 2px; vertical-align: middle; margin-right: 4px; }
