/* ————————————————————————————————————————————
   Hyprfeed · electric editorial
   Inter everywhere; volt yellow spent only on the
   bolt, unread markers and active states.
   ———————————————————————————————————————————— */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable-Italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --volt: #FFD60A;
  --volt-ink: #171300;          /* text on volt */
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 59px;             /* 12px padding + 34px controls + 1px rule */
  --shadow-1: 0 1px 2px rgb(20 20 10 / .04), 0 4px 16px rgb(20 20 10 / .05);
  --shadow-2: 0 2px 6px rgb(20 20 10 / .07), 0 14px 34px rgb(20 20 10 / .10);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F6F3;
  --panel: #EFEFEA;
  --surface: #FFFFFF;
  --field: #F3F3EF;
  --ink: #191917;
  --muted: #6F6F68;
  --faint: #A3A39B;
  --line: #E4E4DD;
  --line-strong: #D4D4CC;
  --wash: rgb(255 214 10 / .17);
  --scrim: rgb(25 25 20 / .40);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --volt: #F7DF1E;
  --bg: #101013;
  --panel: #0B0B0E;
  --surface: #17171B;
  --field: #101014;
  --ink: #ECECE7;
  --muted: #8F8F8A;
  --faint: #63635E;
  --line: #26262B;
  --line-strong: #34343A;
  --wash: rgb(247 223 30 / .10);
  --scrim: rgb(0 0 0 / .55);
  --shadow-1: 0 1px 2px rgb(0 0 0 / .35), 0 6px 20px rgb(0 0 0 / .30);
  --shadow-2: 0 2px 8px rgb(0 0 0 / .45), 0 18px 44px rgb(0 0 0 / .45);
}

* { box-sizing: border-box; }
html { height: 100%; scrollbar-gutter: stable; }  /* reserve the gutter so locking scroll doesn't shift the layout */
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--volt); color: var(--volt-ink); }
h1, h2, h3, h4, p, ul { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; border-radius: 4px; }

/* ————— Icons & brand ————— */
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bolt { fill: var(--volt); stroke: none; width: 22px; height: 22px; filter: drop-shadow(0 1px 6px rgb(255 214 10 / .35)); }
.bolt--xl { width: 56px; height: 56px; }
.wordmark {
  font-size: 19px; font-weight: 800; letter-spacing: -0.03em;
}
.brand { display: inline-flex; align-items: center; gap: 9px; }

/* ————— Buttons & fields ————— */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  color: var(--muted); transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--wash); color: var(--ink); }
.iconbtn--sm { width: 28px; height: 28px; }
.iconbtn--sm svg { width: 17px; height: 17px; }
.iconbtn--danger:hover { background: rgb(220 70 60 / .12); color: #D0453C; }
.iconbtn.is-busy svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-weight: 650; font-size: 14px; letter-spacing: -0.006em;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.btn--primary { background: var(--volt); color: var(--volt-ink); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgb(255 214 10 / .35); }
.btn--primary:active { transform: none; }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--muted); }
.btn--ghost:hover { border-color: var(--faint); color: var(--ink); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; transform: none !important; box-shadow: none !important; }

.field { display: block; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.field input {
  width: 100%; padding: 10px 12px;
  font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px var(--wash); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--volt); width: 15px; height: 15px; }
.hint { font-size: 13px; color: var(--muted); }
.form-error { font-size: 13.5px; color: #D0453C; font-weight: 550; }
.stack { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.stack .field { width: 100%; }
.inline-form { display: contents; }

/* ————— Shell layout ————— */
.shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  overflow: hidden;
}
/* Head and foot are pinned; only the library in between scrolls. */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; flex: none; padding: 0 8px 16px; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar-close { display: none; }

.nav-primary { display: flex; flex-direction: column; gap: 2px; }
.navitem {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background .15s, color .15s;
}
.navitem svg { width: 18px; height: 18px; }
.navitem:hover { color: var(--ink); background: var(--wash); }
.navitem.is-active { color: var(--ink); font-weight: 650; background: var(--wash); box-shadow: inset 3px 0 0 var(--volt); }
.navitem .count { margin-left: auto; }

.sidebar-label {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 0 6px; padding: 0 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}
.feed-list { list-style: none; margin: 0; padding: 0; }
.feeditem {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--muted);
  transition: background .15s, color .15s;
}
.feeditem:hover { color: var(--ink); background: var(--wash); }
.feeditem.is-active { color: var(--ink); font-weight: 600; background: var(--wash); box-shadow: inset 3px 0 0 var(--volt); }
.feeditem-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.feed-list-empty { padding: 10px; font-size: 13px; color: var(--faint); }
.favicon { width: 17px; height: 17px; border-radius: 4px; flex: none; }
.favicon.is-broken { opacity: 0; }
.count {
  font-size: 11px; font-weight: 650; color: var(--faint);
  min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 99px;
}
.count--volt { background: var(--volt); color: var(--volt-ink); }

.sidebar-group { margin-top: 2px; }
.grouphead {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700; color: var(--muted);
  transition: background .15s, color .15s;
}
.grouphead:hover { color: var(--ink); background: var(--wash); }
.grouphead .chev { width: 14px; height: 14px; flex: none; transition: transform .15s; }
.sidebar-group.is-collapsed .chev { transform: rotate(-90deg); }
.sidebar-group.is-collapsed .feed-list { display: none; }
.grouphead-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.feed-list--group .feeditem { padding-left: 28px; }

.sidebar-foot {
  display: flex; align-items: center; gap: 4px; flex: none;
  padding: 12px 6px 0; border-top: 1px solid var(--line);
}
.user {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
  text-align: left; padding: 4px 6px; margin: -4px 0 -4px -6px;
  border-radius: var(--radius-sm); transition: background .15s;
}
.user:hover { background: var(--wash); }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-email { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 700;
}
.user-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); backdrop-filter: blur(2px); }

/* ————— Topbar ————— */
.content { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px clamp(16px, 3.5vw, 36px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-menu { display: none; }
.context-title { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-link { display: inline-flex; align-items: center; gap: 6px; }
.context-link svg { width: 14px; height: 14px; color: var(--faint); opacity: 0; transition: opacity .15s; flex: none; }
.context-link:hover { text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2.5px; text-underline-offset: 4px; }
.context-link:hover svg { opacity: 1; }
.kicker a[href]:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* ————— Filter menu (narrow the current shelf or feed) ————— */
.filtermenu { position: relative; }
.filterbtn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--muted);
  font-size: 13px; font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.filterbtn svg { width: 16px; height: 16px; }
.filterbtn .chev { width: 13px; height: 13px; transition: transform .15s; }
.filterbtn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--wash); }
.filtermenu.is-open .filterbtn { color: var(--ink); border-color: var(--volt); background: var(--wash); }
.filtermenu.is-open .filterbtn .chev { transform: rotate(180deg); }
.filterpop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  animation: modal-in .16s cubic-bezier(.2, .9, .3, 1.1) both;
}
.filterpop[hidden] { display: none; }
.filterpop-head {
  padding: 6px 10px 8px; font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filteropt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 550; color: var(--muted);
  transition: background .12s, color .12s;
}
.filteropt svg { width: 17px; height: 17px; flex: none; }
.filteropt span { flex: 1; }
.filteropt .tick { width: 15px; height: 15px; opacity: 0; color: var(--ink); }
.filteropt:hover { background: var(--wash); color: var(--ink); }
.filteropt.is-active { color: var(--ink); font-weight: 700; }
.filteropt.is-active .tick { opacity: 1; }

.title-chip {
  display: inline-block; margin-left: 9px; padding: 2px 9px;
  border-radius: 99px; background: var(--wash);
  border: 1px solid color-mix(in srgb, var(--volt) 45%, transparent);
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  color: var(--muted); vertical-align: 2px;
}

.viewswitch {
  display: flex; gap: 2px; padding: 3px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.viewswitch-btn {
  display: grid; place-items: center; width: 32px; height: 28px;
  border-radius: 7px; color: var(--faint); transition: background .15s, color .15s;
}
.viewswitch-btn svg { width: 17px; height: 17px; stroke-width: 1.6; }
.viewswitch-btn:hover { color: var(--ink); }
.viewswitch-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

/* ————— Entries: shared ————— */
.news-periods { padding: 18px clamp(16px, 3.5vw, 36px) 0; }
.news-period-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.news-period-chip {
  display: inline-flex; align-items: center; padding: 7px 12px;
  max-width: 100%; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 12px; font-weight: 600;
}
.news-period-chip:hover { border-color: var(--line-strong); }
.news-period-chip.is-active { background: var(--volt); border-color: var(--volt); color: var(--volt-ink); }
.news-period-label { margin-top: 12px; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.news-period-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.news-period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; }
.news-period-form label { font-size: 12px; color: var(--muted); }
.news-period-form input {
  min-width: 0; max-width: 100%; width: 155px; padding: 6px 8px;
  font: inherit; font-size: 12px; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.news-period-form input[type="datetime-local"] { width: 195px; }
.news-period-disabled { opacity: .45; cursor: default; }
.news-period-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.news-period-foot a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.entries { padding: clamp(18px, 3vw, 34px) clamp(16px, 3.5vw, 36px) 60px; }
.story { cursor: pointer; }

.kicker {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.kicker-feed { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kicker-feed, .row-feed { display: inline-flex; align-items: center; min-width: 0; }
.source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-count { flex: none; margin-left: 4px; }
.kicker-sep { color: var(--faint); }
.kicker time { color: var(--faint); font-weight: 600; letter-spacing: .05em; flex: none; }
#entries-root:not([data-period="all"]) .kicker { flex-wrap: wrap; row-gap: 4px; }
#entries-root:not([data-period="all"]) .kicker time {
  flex-basis: 100%; letter-spacing: normal; text-transform: none; color: var(--muted);
}

.unread-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--volt); flex: none; box-shadow: 0 0 6px rgb(255 214 10 / .55); }
.is-read .unread-dot { display: none; }
/* List rows are a grid: keep the dot's cell so columns don't shift when read. */
.row.is-read .unread-dot { display: block; visibility: hidden; }
.is-read .story-title, .is-read .row-title { color: color-mix(in srgb, var(--ink) 55%, var(--bg)); }

.starbtn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.starbtn svg { width: 16px; height: 16px; }
.story:hover .starbtn, .story:focus-within .starbtn, .starbtn.is-starred { opacity: 1; }
.starbtn:hover { color: var(--ink); background: var(--surface); }
.starbtn.is-starred { color: var(--volt-ink); background: var(--volt); }
.starbtn.is-starred svg { fill: currentColor; }
@media (hover: none) { .starbtn { opacity: 1; } }

.thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--panel);
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.story:hover .thumb img:not(.thumb-bg) { transform: scale(1.035); }
.thumb--empty img { display: none; }
/* YouTube thumbnails ship letterboxed (4:3 with baked black bars): show the
   image uncropped over a blurred, zoomed copy of itself instead of bars. */
.thumb--blur .thumb-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  /* Zoom well past any baked-in pillarbox bars so the blur samples real
     content — blurred black bars would otherwise still read as black. */
  transform: scale(2.2);
  filter: blur(24px) saturate(1.3) brightness(.9);
}
.thumb--blur img:not(.thumb-bg) {
  position: relative; z-index: 1; display: block;
  height: 100%; width: auto; aspect-ratio: 9 / 16; margin: 0 auto;
  object-fit: cover;   /* crops baked side bars out of 4:3 Shorts files */
}
/* Regular YouTube videos fill the frame (cover). Their feed thumbnails are
   often 4:3 hqdefaults with baked-in letterbox bars — JS marks those
   .thumb--crop and this zoom crops the bars away. Shorts use the blurred
   backdrop above instead (server-side .thumb--blur via the /shorts/ URL). */
.thumb--yt.thumb--crop img { transform: scale(1.13); }
.story:hover .thumb--yt.thumb--crop img { transform: scale(1.17); }
.thumb-letter {
  display: none;
  position: absolute; inset: 0;
  place-items: center;
  font-size: 64px; font-weight: 850; letter-spacing: -0.04em;
  color: var(--volt); opacity: .85;
  transform: rotate(-6deg);
  user-select: none;
}
.thumb--empty .thumb-letter { display: grid; }
.thumb--empty { background: linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--volt) 7%, var(--panel))); }

/* ————— Magazine stories: one markup, three sizes ————— */
/* The variant class (.hero / .breaker / .card) is positional, so the layout
   can re-heal when a story is skipped — see relayoutMagazine() in the JS. */
.story.hero, .story.breaker, .story.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.story.card { display: flex; flex-direction: column; border-radius: var(--radius); }
.story.hero, .story.breaker {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  border-radius: calc(var(--radius) + 4px);
}
.story.breaker { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
.story.card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.story.hero:hover, .story.breaker:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }

.story.hero .thumb { order: 2; aspect-ratio: auto; min-height: 300px; height: 100%; }
.story.breaker .thumb { order: 2; aspect-ratio: auto; min-height: 240px; height: 100%; }

.story-body {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  gap: 8px; padding: 14px 16px 16px; flex: 1;
}
.story.hero .story-body, .story.breaker .story-body { order: 1; justify-content: center; flex: none; }
.story.hero .story-body { gap: 14px; padding: clamp(22px, 3.5vw, 44px); }
.story.breaker .story-body { gap: 11px; padding: clamp(20px, 3vw, 38px); }

/* Actions sit in the kicker row so they never collide with the title or dek —
   important on touch, where they're always visible. */
.story-body .starbtn { top: 8px; right: 10px; background: none; backdrop-filter: none; }
.story-body .hidebtn { top: 8px; right: 44px; }
.story-body .kicker { padding-right: 72px; }
.story.hero .story-body .starbtn, .story.breaker .story-body .starbtn { top: 14px; right: 14px; }
.story.hero .story-body .hidebtn, .story.breaker .story-body .hidebtn { top: 14px; right: 52px; }

.story-title { font-size: 16.5px; font-weight: 680; letter-spacing: -0.016em; line-height: 1.3; }
.story.hero .story-title {
  font-size: clamp(25px, 3.1vw, 40px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; text-wrap: balance;
}
.story.breaker .story-title {
  font-size: clamp(21px, 2.4vw, 30px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.14; text-wrap: balance;
}
.story.hero:hover .story-title, .story.breaker:hover .story-title {
  text-decoration: underline; text-decoration-color: var(--volt);
  text-decoration-thickness: 3px; text-underline-offset: 5px;
}
.story-dek {
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.story.hero .story-dek { font-size: 15.5px; line-height: 1.6; max-width: 52ch; -webkit-line-clamp: 4; }
.story.breaker .story-dek { font-size: 14.5px; line-height: 1.6; max-width: 58ch; -webkit-line-clamp: 2; }
.story-meta { font-size: 12.5px; color: var(--faint); font-weight: 550; display: flex; gap: 7px; }
.story.card .story-meta { margin-top: auto; padding-top: 8px; }
.grid--cards .story-title { font-size: 15px; font-weight: 650; }

/* ————— Grids ————— */
.grid--magazine { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.grid--cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.story.is-hidden { display: none !important; }
/* Swipe-to-hide: the card tracks the finger with no easing, then springs
   back or slides out on release. */
.story.is-swiping { transition: none !important; }
.story.swipe-return { transition: transform .25s ease, opacity .25s ease !important; }
.story.swipe-out { transition: transform .22s ease-in, opacity .22s ease-in !important; }
/* Collapse runs while the slide-out is still finishing, so it must carry
   the transform/opacity transitions along. */
.swipe-pill {
  position: fixed; z-index: 95;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-2); pointer-events: none;
  opacity: 0; transform: translate(0, -50%);
  /* No transform/opacity transition at rest: the off-screen start position
     must SNAP into place, or the entry animation retargets mid-flight and
     the pill just pops in. */
  transition: background .12s, color .12s, border-color .12s;
}
.swipe-pill.from-left { transform: translate(-170%, -50%); }
.swipe-pill.from-right { transform: translate(170%, -50%); }
.swipe-pill.is-showing,
.swipe-pill.is-leaving {
  transition: transform .24s cubic-bezier(.2, .8, .3, 1), opacity .2s ease,
              background .12s, color .12s, border-color .12s;
}
.swipe-pill.is-showing { transform: translate(0, -50%); opacity: 1; }
.swipe-pill.is-leaving { transform: translate(0, calc(-50% + 18px)); opacity: 0; }
.swipe-pill svg { width: 16px; height: 16px; }
.swipe-pill.is-armed {
  background: var(--volt); border-color: var(--volt); color: var(--volt-ink);
}
.story.swipe-collapse {
  transition: transform .22s ease-in, opacity .22s ease-in,
              height .16s ease, padding .16s ease !important;
}

/* ————— List view ————— */
.grid--list { border-top: 1px solid var(--line); }
.row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 10px 17px minmax(90px, 150px) minmax(0, auto) minmax(0, 1fr) max-content 30px 30px;
  padding: 11px 6px; border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.row:hover { background: var(--surface); }
.row .unread-dot { justify-self: center; }
.row-feed {
  font-size: 12px; font-weight: 650; letter-spacing: .02em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-title { font-size: 14.5px; font-weight: 620; letter-spacing: -0.011em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dek { font-size: 13px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { font-size: 12px; color: var(--faint); font-weight: 550; white-space: nowrap; }
.row .starbtn { position: static; opacity: 0; background: none; }
.row:hover .starbtn, .row .starbtn.is-starred { opacity: 1; }

/* ————— Empty states & pager ————— */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 12vh 20px;
}
.empty-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.empty-text { color: var(--muted); max-width: 42ch; }
.empty--onboard .bolt--xl { margin-bottom: 6px; animation: bolt-in .5s ease both; }
.empty .btn { margin-top: 10px; }
@keyframes bolt-in { from { transform: translateY(8px) scale(.85); opacity: 0; } }

.pager { display: flex; justify-content: center; padding: 30px 0 10px; }
/* Infinite scroll on: the row keeps its place in the flow (the observer needs
   something to watch) but reads as a loading state, not a button. */
.pager-auto { display: none; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; font-weight: 600; }
.pager-spin { width: 15px; height: 15px; animation: spin 1s linear infinite; }
#entries-root[data-infinite="1"] .pager .btn { display: none; }
#entries-root[data-infinite="1"] .pager-auto { display: inline-flex; }
.pager-end {
  text-align: center; padding: 34px 0 12px;
  color: var(--faint); font-size: 13px; font-weight: 600;
}
.pager-end::before {
  content: ""; display: block; width: 26px; height: 2px; border-radius: 2px;
  background: var(--volt); margin: 0 auto 14px;
}

/* ————— Modals ————— */
.modal, .reader { border: 0; padding: 0; background: var(--surface); color: var(--ink); }
.modal {
  width: min(430px, calc(100vw - 32px));
  border-radius: 18px; box-shadow: var(--shadow-2);
  border: 1px solid var(--line);
}
.modal::backdrop, .reader::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
/* Every dialog here is a modal, and each leaves viewport around it — the
   reader's gutters, the backdrop around a modal or the palette. A wheel over
   that space would scroll the feed behind, so freeze the page while any
   dialog is up: overflow: hidden keeps the root's scroll offset, so the list
   is right where it was when the dialog closes. */
html:has(dialog[open]) { overflow: hidden; }
.modal[open] { animation: modal-in .22s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes modal-in { from { transform: translateY(14px) scale(.97); opacity: 0; } }
/* One continuous upward pass: the reader rises in from below the fold and
   keeps going out through the top, handing the eye off to the toast that
   lands under the topbar. .is-closing is set in JS, which delays
   dialog.close() by the same 300ms. */
.reader[open] { animation: reader-in .3s cubic-bezier(.16, .8, .3, 1) both; }
.reader.is-closing { animation: reader-out .3s cubic-bezier(.5, 0, .75, .2) both; }
.reader[open]::backdrop { animation: scrim-in .3s ease both; }
.reader.is-closing::backdrop { animation: scrim-out .3s ease both; }
@keyframes reader-in { from { transform: translateY(100%); } }
@keyframes reader-out { to { transform: translateY(-100%); } }
@keyframes scrim-in { from { opacity: 0; } }
@keyframes scrim-out { to { opacity: 0; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.modal-head h3 { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; }
.modal-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 20px; }

/* ————— Settings ————— */
/* A section rail on the left, the active pane on the right. Fixed height:
   switching sections must not resize the modal — panes scroll inside. */
.modal--settings { width: min(900px, calc(100vw - 32px)); overflow: hidden; }
#settings-modal[open] { display: flex; height: min(80vh, 760px); }
.settings { display: flex; flex: 1; min-width: 0; min-height: 0; }

.settings-nav {
  display: flex; flex-direction: column; flex: none; width: 216px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 12px;
}
.settings-nav-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 34px; padding: 0 10px 14px;
}
.settings-nav-head h3 { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; }
.settings-links { display: flex; flex-direction: column; gap: 2px; }
.settings-link { width: 100%; text-align: left; }
.settings-link-chev { display: none; }

.settings-main { display: flex; flex-direction: column; flex: 1; min-width: 0; container-type: inline-size; }
.settings-main-head {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 18px 20px 14px 28px;
}
.settings-main-head h3 { flex: 1; min-width: 0; font-size: 17px; font-weight: 750; letter-spacing: -0.02em; }
.settings-back { display: none; margin-left: -8px; }
.tabpane { display: none; }
.tabpane.is-active {
  display: block; flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 4px 28px 26px;
}

@media (max-width: 700px) {
  /* Phones: settings takes over the whole screen and drills in — the section
     list first, then one pane at a time with a back button. */
  #settings-modal[open] {
    width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh;
    margin: 0; border: 0; border-radius: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .settings-nav { width: 100%; border-right: 0; padding: 14px 12px; }
  .settings-nav-head { padding: 0 6px 12px 10px; }
  /* The list is its own screen here, so no section reads as "current". */
  .settings-link, .settings-link.is-active {
    padding: 12px 10px; font-size: 15px; font-weight: 550;
    color: var(--ink); background: none; box-shadow: none;
  }
  .settings-link-chev { display: block; margin-left: auto; width: 16px; height: 16px; color: var(--faint); }
  .settings[data-view="nav"] .settings-main,
  .settings[data-view="pane"] .settings-nav { display: none; }
  .settings[data-view="pane"] .settings-main { animation: settings-push .24s cubic-bezier(.2, .9, .3, 1) both; }
  .settings-main-head { padding: 14px 12px 10px; }
  .settings-back { display: inline-flex; margin-left: 0; }
  .tabpane.is-active { padding: 4px 20px 22px; }
}
@keyframes settings-push { from { transform: translateX(24px); opacity: 0; } }
.setting-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.setting-row { margin-top: 18px; }

.theme-picker { display: flex; gap: 10px; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.theme-opt input:checked + .theme-chip { border-color: var(--volt); color: var(--ink); background: var(--wash); }
.theme-opt input:focus-visible + .theme-chip { outline: 2px solid var(--volt); outline-offset: 2px; }
.theme-chip-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-strong); }
.theme-chip--system .theme-chip-dot { background: linear-gradient(90deg, #FFF 50%, #17171B 50%); }
.theme-chip--light .theme-chip-dot { background: #FFF; }
.theme-chip--dark .theme-chip-dot { background: #17171B; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.sortrow { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.setting-label--flush { margin-bottom: 0; }
.sortbtns { display: flex; gap: 6px; }
.btn--xs { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.feedadd { display: flex; gap: 8px; margin-top: 10px; }
.feedadd input {
  flex: 1; padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.feedadd input:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px var(--wash); }
.feedadd + .form-error { margin-top: 8px; }
.opml-row { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.grip { display: grid; place-items: center; width: 18px; color: var(--faint); cursor: grab; flex: none; }
.grip svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.manage-item.is-dragging { opacity: .45; }
.manage-item.is-drag-hidden { display: none; }
.manage-group-wrap { list-style: none; margin-top: 10px; }
.manage-group-wrap.is-dragging { opacity: .45; }
.manage-sublist { list-style: none; margin: 0; padding: 0; }
.manage-sublist:not(:has(.manage-item))::after {
  content: attr(data-empty-label);
  display: block; padding: 8px 0 8px 30px;
  font-size: 12.5px; color: var(--faint);
}
.manage-group { background: var(--field); border-radius: var(--radius-sm); border-bottom: 0 !important; padding-left: 8px; padding-right: 8px; }
.manage-group .manage-title { font-weight: 700; }
.manage-group.is-drop-target {
  outline: 2px dashed var(--volt); outline-offset: -2px; background: var(--wash);
}
.group-folder { width: 17px; height: 17px; color: var(--muted); flex: none; }
/* Nested feeds: indented with a tree rail so membership is unmistakable. */
.manage-item--in-group {
  margin-left: 14px; padding-left: 14px;
  border-left: 2px solid var(--line-strong);
}
.manage-item[draggable] { user-select: none; }
.manage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.manage-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.manage-item:last-child { border-bottom: 0; }
.manage-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.manage-title { font-size: 14px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-url, .manage-err { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-err { color: #D0453C; }
.account-meta { margin-top: 20px; }
.about-line { margin-top: 6px; font-size: 12px; }
.about-line a { text-decoration: underline; text-underline-offset: 2px; }
.chip {
  display: inline-block; padding: 1px 7px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--volt); color: var(--volt-ink); vertical-align: 1px;
}
.chip--muted { background: var(--field); color: var(--muted); border: 1px solid var(--line); }
.admin-stats { margin: 10px 0 18px; }
.inst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.inst-grid + .hint { margin-top: 8px; }
.adduser { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: center; margin-bottom: 14px; }
.adduser input[type="text"] {
  padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.adduser-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field--narrow { max-width: 320px; }
.setting-label--spaced { margin-top: 22px; }
.adduser input[type="email"], .adduser input[type="password"] {
  padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.adduser input:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px var(--wash); }
.adduser .check { font-size: 13.5px; }
.adduser .btn { justify-self: end; padding: 8px 16px; }
.adduser + .form-error { margin-bottom: 12px; }
@media (max-width: 700px) {
  /* Phones: admin fields stack instead of sitting side by side. */
  .inst-grid, .adduser { grid-template-columns: 1fr; }
}
.manage-item .avatar { width: 30px; height: 30px; font-size: 13px; }

/* ————— About tab ————— */
.about-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(180px, 220px) 1fr; gap: 22px;
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
}
.about-hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .14; z-index: 0; pointer-events: none; filter: saturate(.7);
}
html[data-theme="dark"] .about-hero-bg { opacity: .2; filter: saturate(.55); }
.about-hero > :not(.about-hero-bg) { position: relative; z-index: 1; min-width: 0; }
.about-brand { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.bolt--about { width: 42px; height: 42px; margin-bottom: 8px; }
.about-name { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.about-version { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.about-tagline { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.about-credit, .about-license { font-size: 12px; color: var(--muted); }
.about-credit { margin-top: 10px; }
.about-credit a, .about-license a {
  font-weight: 600; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 2px;
}
.hyprlab-credit {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: -3px;
}
.hyprlab-credit img { width: 16px; height: 16px; border-radius: 4px; }
.about-stack { display: flex; flex-direction: column; gap: 10px; }
.about-stack-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.tech-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.tech-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  transition: border-color .15s, transform .15s, background .15s;
}
.tech-tile:hover { border-color: var(--volt); transform: translateY(-2px); background: var(--surface); }
.tech-icon {
  width: 26px; height: 26px; background-color: var(--ink);
  -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center;
  mask-size: contain; mask-repeat: no-repeat; mask-position: center;
}
.tech-tile-name { font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; line-height: 1.2; }
/* Light mode: the animated hero gradient sits behind this section, so greys
   lose contrast — full black for readability, in this section only. */
html[data-theme="light"] .about-stack-label,
html[data-theme="light"] .tech-tile-name { color: #000; }

.about-details { border-top: 1px solid var(--line); margin-top: 16px; }
.about-summary {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 0; cursor: pointer; list-style: none;
}
.about-summary::-webkit-details-marker { display: none; }
.about-summary h4 { font-size: 14px; font-weight: 750; letter-spacing: -0.01em; flex: 1; }
.about-summary span { font-size: 12px; color: var(--faint); flex: 1; }
.about-summary::after {
  content: ""; width: 7px; height: 7px; flex: none; align-self: center;
  border-right: 1.8px solid var(--faint); border-bottom: 1.8px solid var(--faint);
  transform: rotate(-45deg); transition: transform .15s;
}
.about-details[open] > .about-summary::after { transform: rotate(45deg); }
.about-summary:hover h4 { text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.release-list { list-style: none; margin: 0; padding: 0 0 14px; display: flex; flex-direction: column; gap: 12px; }
.release-list > li { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 14px; }
.rel-version { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.rel-meta { font-size: 12px; color: var(--faint); font-weight: 550; }
.rel-body { font-size: 13px; line-height: 1.55; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.rel-body pre { overflow-x: auto; }
.rel-body p { margin: 0 0 8px; }
.rel-body p:last-child { margin-bottom: 0; }
.rel-body h3, .rel-body h4 {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink); margin: 12px 0 4px;
}
.rel-body ul { margin: 0 0 8px; padding-left: 1.25em; }
.rel-body li { margin: 3px 0; }
.rel-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--volt); text-underline-offset: 2px; }
.rel-body strong { color: var(--ink); }
.rel-body code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--field); padding: 1px 4px; border-radius: 4px; }

@container (max-width: 520px) {
  .about-hero { grid-template-columns: 1fr; gap: 16px; }
  .about-brand { align-items: center; text-align: center; }
}

/* ————— Search palette ————— */
.searchpill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); background: var(--panel);
  transition: border-color .15s, color .15s, background .15s;
}
.searchpill svg { width: 17px; height: 17px; }
.searchpill kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  color: var(--faint); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; background: var(--surface); white-space: nowrap;
}
.searchpill:hover { color: var(--ink); border-color: var(--line-strong); background: var(--wash); }
@media (max-width: 700px) {
  .searchpill kbd { display: none; }
  /* Filter stays reachable on phones; the label collapses to the icon. */
  .filterbtn-label, .filterbtn .chev { display: none; }
  .filterbtn { padding: 0 8px; }
}

.palette {
  border: 1px solid var(--line); border-radius: 16px; padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 32px));
  margin: 10vh auto auto; box-shadow: var(--shadow-2);
}
.palette::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.palette[open] { animation: modal-in .18s cubic-bezier(.2, .9, .3, 1.1) both; }
.palette-inputrow {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
}
.palette-inputrow svg { color: var(--faint); width: 19px; height: 19px; }
.palette-inputrow input {
  flex: 1; border: 0; outline: none; background: none;
  font: inherit; font-size: 16px; color: var(--ink);
}
.palette-inputrow input::placeholder { color: var(--faint); }
.palette-inputrow kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  color: var(--faint); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 6px; text-transform: uppercase;
}
.palette-results {
  border-top: 1px solid var(--line);
  max-height: min(420px, 55vh); overflow-y: auto; overscroll-behavior: contain; padding: 8px;
}
.palette-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); padding: 8px 10px 4px;
}
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.palette-item .favicon { width: 16px; height: 16px; }
.palette-item-title {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.palette-item.is-read .palette-item-title { color: var(--muted); font-weight: 450; }
.palette-item-title mark {
  background: var(--wash); color: inherit; font-weight: 700;
  border-radius: 3px; padding: 0 1px;
}
.palette-item-meta { font-size: 11.5px; color: var(--faint); font-weight: 550; flex: none; }
.palette-item.is-active { background: var(--wash); box-shadow: inset 3px 0 0 var(--volt); }
.palette-empty { padding: 18px 12px 14px; text-align: center; font-size: 13.5px; color: var(--muted); }

/* ————— Reader ————— */
.reader {
  width: min(840px, calc(100vw - 48px)); height: auto; max-height: calc(100dvh - 48px);
  margin: auto; border-radius: 18px; overflow-y: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.reader-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.reader-bar-actions { display: flex; gap: 4px; }
.reader-article { max-width: 660px; margin: 0 auto; padding: clamp(22px, 4vw, 36px) 20px 32px; }
.reader-article .kicker { margin-bottom: 14px; }
.reader-article .kicker::before {
  content: ""; width: 14px; height: 4px; border-radius: 2px; background: var(--volt); display: inline-block;
}
.reader-title {
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1.1;
  text-wrap: balance; margin-bottom: 12px;
}
.reader-meta { font-size: 13px; color: var(--faint); font-weight: 550; margin-bottom: 22px; }
.reader-hero { margin: 0 0 26px; }
.video-embed {
  aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--radius); overflow: hidden; background: #000;
}
.video-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.reader-hero:empty { display: none; }
.reader-hero img { width: 100%; max-height: 440px; object-fit: cover; border-radius: var(--radius); }
#reader-star.is-starred { color: var(--volt-ink); background: var(--volt); }
#reader-star.is-starred svg { fill: currentColor; }
#reader-read.is-read { color: var(--volt-ink); background: var(--volt); }
#reader-copy { position: relative; }
#reader-copy.show-tip::after {
  content: attr(data-copied);
  position: absolute; top: calc(100% + 8px); left: 50%;
  background: var(--ink); color: var(--bg);
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  padding: 4px 9px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 10;
  animation: tip-in .15s ease both;
}
@keyframes tip-in {
  from { opacity: 0; transform: translate(-50%, -4px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.prose { font-size: 16.5px; line-height: 1.72; }
.prose p { margin: 0 0 1.15em; }
.prose a { text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { background: var(--wash); }
.prose img { border-radius: var(--radius-sm); margin: 8px 0; height: auto; }
.prose h3, .prose h4 { font-weight: 750; letter-spacing: -0.02em; margin: 1.6em 0 .5em; line-height: 1.25; }
.prose h3 { font-size: 21px; }
.prose h4 { font-size: 17.5px; }
.prose blockquote {
  margin: 1.2em 0; padding: 2px 0 2px 18px;
  border-left: 3px solid var(--volt);
  color: var(--muted); font-style: italic;
}
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.15em; }
.prose li { margin-bottom: .35em; }
.prose pre {
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.55;
}
.prose code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; background: var(--field); padding: 1px 5px; border-radius: 5px; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.prose figure { margin: 1.2em 0; }
.prose figcaption { font-size: 13px; color: var(--faint); margin-top: 6px; }
.reader-foot { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }

/* ————— Pull to refresh (touch) ————— */
html { overscroll-behavior-y: contain; }  /* keep the browser's native PTR out of the way */
.ptr {
  position: fixed; top: -56px; left: 50%; margin-left: -22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); box-shadow: var(--shadow-2);
  transition: transform .25s ease; will-change: transform;
}
.ptr.is-dragging { transition: none; }
.ptr.is-armed { background: var(--volt); border-color: var(--volt); color: var(--volt-ink); }
.ptr.is-refreshing svg { animation: spin .8s linear infinite; }

/* ————— Toast ————— */
/* Toasts sit just under the topbar: the reader leaves through the top, so
   that's where the eye already is when the message lands. */
.toast {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 12px); transform: translateX(-50%);
  z-index: 100;
  background: var(--ink); color: var(--bg);
  font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 99px; box-shadow: var(--shadow-2);
  animation: toast-in .25s ease both;
}
@keyframes toast-in { from { transform: translate(-50%, -10px); opacity: 0; } }
.toast.is-leaving { animation: toast-out .25s ease forwards; }
@keyframes toast-out { to { transform: translate(-50%, -16px); opacity: 0; } }
.toast-action {
  margin-left: 12px; color: var(--volt); font-weight: 750; font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ————— Auth pages ————— */
.auth-body { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth-wrap { width: 100%; display: grid; place-items: center; }
.auth-card {
  width: min(400px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-1);
  padding: clamp(26px, 5vw, 40px);
}
.auth-mark { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 26px; text-align: center; }
.auth-mark .bolt { width: 42px; height: 42px; margin-bottom: 4px; }
.auth-mark .wordmark { font-size: 26px; }
.auth-tag { font-size: 14px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .cf-turnstile { display: flex; justify-content: center; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { font-weight: 650; color: var(--ink); text-decoration: underline; text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.flash {
  font-size: 13.5px; font-weight: 550;
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.flash--error { background: rgb(220 70 60 / .1); color: #C4443B; border: 1px solid rgb(220 70 60 / .25); }
.flash--info { background: var(--wash); color: var(--ink); border: 1px solid color-mix(in srgb, var(--volt) 40%, transparent); }

/* ————— Setup wizard ————— */
.wizard { width: min(460px, 100%); }
.wizard .auth-mark { margin-bottom: 14px; }
.wiz-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.wiz-dot {
  width: 22px; height: 4px; border-radius: 99px;
  background: var(--line); transition: background .25s;
}
.wiz-dot.is-active { background: var(--volt); }
.wiz-step { display: none; }
.wiz-step.is-active { display: block; animation: wiz-in .25s ease both; }
@keyframes wiz-in { from { opacity: 0; transform: translateX(10px); } }
.wiz-title { font-size: 20px; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 8px; }
.wiz-text { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 16px; }
.wiz-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.wiz-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.wiz-list li::before {
  content: ""; width: 7px; height: 7px; border-radius: 2px; flex: none;
  background: var(--volt); box-shadow: 0 0 6px rgb(255 214 10 / .5);
}
.wiz-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; }
.wiz-nav .btn--primary:only-child { width: 100%; }
.wiz-nav .btn--primary:not(:only-child) { flex: 1; }
.wizard .auth-form { gap: 13px; display: flex; flex-direction: column; }
.wiz-addrow { display: flex; gap: 8px; }
.wiz-addrow input {
  flex: 1; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.wiz-addrow input:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px var(--wash); }
.wiz-scrape { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.wiz-scrape[hidden] { display: none; }
.wiz-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wiz-chip {
  padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 99px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.wiz-chip:hover { border-color: var(--volt); color: var(--ink); background: var(--wash); }
.wiz-chip[disabled] { opacity: .45; cursor: default; }
.wiz-added { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiz-added li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 550; color: var(--ink);
}
.wiz-added li::before {
  content: ""; width: 12px; height: 7px; flex: none;
  border-left: 2px solid var(--volt); border-bottom: 2px solid var(--volt);
  transform: rotate(-45deg) translateY(-2px);
}
.wizard .form-error { margin-top: 12px; }

/* ————— Responsive ————— */
@media (max-width: 1060px) {
  .row { grid-template-columns: 10px 17px minmax(0, 1fr) max-content 30px 30px; }
  .row-feed, .row-dek { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: min(300px, 84vw);
    transform: translateX(-104%);
    transition: transform .25s ease;
    box-shadow: none;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-2); }
  .sidebar-close { display: inline-flex; }
  .topbar-menu { display: inline-flex; }
  .story.hero, .story.breaker { grid-template-columns: 1fr; }
  .story.hero .thumb, .story.breaker .thumb { order: 1; min-height: 0; aspect-ratio: 16 / 9; }
  .story.hero .story-body, .story.breaker .story-body { order: 2; }
}
@media (max-width: 680px) {
  .reader {
    height: 100dvh; max-height: 100dvh; border-radius: 0;
    /* Full-bleed article on phones: the dialog's UA max-width would
       otherwise inset it ~2em from the viewport edges. */
    width: 100vw; max-width: 100vw;
    margin: 0; border: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (max-width: 560px) {
  .context-title { font-size: 15.5px; }
  .viewswitch { display: none; } /* view lives in settings on phones */
  .entries { padding-inline: 14px; }
  .grid--magazine, .grid--cards { grid-template-columns: 1fr; }
  .theme-picker { flex-direction: column; }
}

/* ————— Motion & scrollbars ————— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
