/* =========================================================
   Flux 闁?RSS Aggregate
   Design: Emil Kowalski craft + liquid glass materials
   ========================================================= */

:root {
  --bg-0: #07090f;
  --bg-1: #0c1018;
  --text: #eef2ff;
  --text-2: rgba(238, 242, 255, 0.72);
  --text-3: rgba(238, 242, 255, 0.45);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.13);
  /* Glass fills stay thin — edge/specular carry the material (Emil) */
  --glass: rgba(255, 255, 255, 0.018);
  --glass-strong: rgba(255, 255, 255, 0.036);
  --glass-inset: rgba(255, 255, 255, 0.022);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --glass-edge-soft: rgba(255, 255, 255, 0.08);
  --glass-specular: rgba(255, 255, 255, 0.22);
  --accent: #8bdbff;
  --accent-2: #b39cff;
  --accent-soft: rgba(139, 219, 255, 0.14);
  --danger: #ff7b8a;
  --success: #6ee7b7;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  /* Spacing scale — 4px base (unseen consistency compounds) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --shell-pad: 12px;
  --shell-gap: 12px;
  --panel-pad-x: 16px;
  --control-h: 36px;
  --control-h-lg: 40px;
  --measure: 38rem;
  --list-min: 280px;
  --reader-pad-x: 24px;
  --toolbar-h: 40px;
  --vrow: 88px; /* virtual list estimated row height */
  /* Edge light > fill. Outer drop is soft so glass doesn't feel heavy. */
  --shadow-glass:
    inset 0 1px 0 var(--glass-specular),
    inset 0 -0.5px 0 rgba(255, 255, 255, 0.03),
    0 1px 0 rgba(255, 255, 255, 0.025),
    0 10px 28px rgba(0, 0, 0, 0.18);
  --shadow-float: 0 20px 48px rgba(0, 0, 0, 0.48);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Inter", "NSimSun", "新宋体", "SimSun", "Songti SC", "STSong", serif;
  --sidebar-w: 268px;
  --topbar-h: 60px;
  --reader-w: min(520px, 44vw);
  --blur: 16px;
  --blur-nested: 6px;
  --blur-panel: 10px;
  --saturate: 118%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  line-height: 1.5;
  font-feature-settings: "ss01" on, "cv11" on;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Ambient liquid backdrop · quiet field (Emil restraint) ----------
   Decorative only. Gradients do the mood work; orbs are almost still.
   Frequency: always-on chrome → motion must be invisible, not a show.
   ------------------------------------------------------------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* Static depth field carries 90% of atmosphere */
  background:
    radial-gradient(980px 620px at 8% -6%, rgba(125, 211, 252, 0.055), transparent 64%),
    radial-gradient(880px 560px at 94% 2%, rgba(167, 139, 250, 0.045), transparent 62%),
    radial-gradient(740px 480px at 50% 110%, rgba(56, 189, 248, 0.028), transparent 62%),
    linear-gradient(180deg, #07090f 0%, #090d16 52%, #07090f 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  /* Extra-soft wash — large blur, low chroma, low opacity */
  filter: blur(100px);
  opacity: 0.12;
  /* will-change only while animating; dropped when paused */
  will-change: transform;
  /* Near-still drift: long period, tiny travel */
  animation: float 72s var(--ease-in-out) infinite alternate;
}

.orb-a {
  width: 520px;
  height: 520px;
  left: -140px;
  top: 2%;
  background: radial-gradient(
    circle at 32% 32%,
    rgba(125, 211, 252, 0.22),
    rgba(56, 120, 210, 0.07) 50%,
    transparent 74%
  );
  animation-duration: 78s;
  animation-delay: -18s;
}

.orb-b {
  width: 580px;
  height: 580px;
  right: -180px;
  top: -100px;
  background: radial-gradient(
    circle at 42% 38%,
    rgba(180, 160, 250, 0.18),
    rgba(110, 70, 200, 0.06) 52%,
    transparent 74%
  );
  animation-duration: 90s;
  animation-delay: -36s;
  opacity: 0.1;
}

.orb-c {
  width: 460px;
  height: 460px;
  left: 36%;
  bottom: -180px;
  background: radial-gradient(
    circle at 50% 40%,
    rgba(90, 200, 230, 0.14),
    rgba(20, 130, 180, 0.05) 52%,
    transparent 74%
  );
  animation-duration: 84s;
  animation-delay: -48s;
  opacity: 0.09;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.012;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Barely-there drift — if you notice it, it's too loud */
@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(5px, -4px, 0) scale(1.01); }
}

/* Battery/perf: freeze orbs when tab hidden or reduced-motion */
.ambient.is-paused .orb {
  animation-play-state: paused;
  will-change: auto;
}

/* ---------- Liquid glass · Emil craft ----------
   Restraint over spectacle. Unseen edge details compound.
   Blur ≤ 20px (Safari). Specific props, ease-out, short.
   Hierarchy: shell glass → nested inset → quiet panel.
   Transparency: thin fill; specular + hairline define the surface.
   ------------------------------------------------ */
.glass {
  /* Near-clear liquid — ambient reads through; not milky frost */
  background:
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.055) 0%,
      rgba(255, 255, 255, 0.014) 38%,
      rgba(255, 255, 255, 0.006) 100%
    ),
    var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 1px solid var(--glass-edge-soft);
  box-shadow: var(--shadow-glass);
  position: relative;
  isolation: isolate;
  /* Interruptible chrome feedback — never keyframes on shells */
  transition:
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

/* Top catch-light — one quiet specular defines glass when fill is thin */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.2) 0%,
      rgba(255, 255, 255, 0.06) 10%,
      rgba(255, 255, 255, 0.015) 26%,
      transparent 46%
    );
  opacity: 0.85;
  z-index: 1;
}

/* Inner hairline + soft bottom rim — users barely notice */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  z-index: 1;
}

.glass > * {
  position: relative;
  z-index: 2;
}

/* Shell hover skipped — large chrome is hovered constantly; no motion tax */

/* Nested controls share the same glass language at lower cost */
.glass-inset {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035) 0%,
      rgba(255, 255, 255, 0.008) 100%
    ),
    var(--glass-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.12);
  /* Nested blur stays light; never stack 40px+ on controls */
  backdrop-filter: blur(var(--blur-nested)) saturate(112%);
  -webkit-backdrop-filter: blur(var(--blur-nested)) saturate(112%);
  transition:
    border-color 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out),
    background-color 150ms var(--ease-out);
}

.glass-inset:focus-within {
  border-color: rgba(139, 219, 255, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 3px rgba(139, 219, 255, 0.1);
}

/* ---------- App shell ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  height: 100svh;
  gap: var(--shell-gap);
  padding: var(--shell-pad);
  padding-top: max(var(--shell-pad), env(safe-area-inset-top));
  padding-right: max(var(--shell-pad), env(safe-area-inset-right));
  padding-bottom: max(var(--shell-pad), env(safe-area-inset-bottom));
  padding-left: max(var(--shell-pad), env(safe-area-inset-left));
  isolation: isolate;
  min-width: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--panel-pad-x) var(--space-2);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.12);
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-close {
  display: none;
}

.sidebar-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-2) 0;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: var(--space-2) var(--space-3) var(--space-2);
  flex-shrink: 0;
}

.feed-nav {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 0 var(--space-1) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.feed-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 11px;
  text-align: left;
  color: var(--text-2);
  transition:
    background-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.feed-item:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .feed-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
  }
}

.feed-item.is-active {
  background: transparent; /* wash via ::before (motion system) */
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(139, 219, 255, 0.18);
}

.feed-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(139, 219, 255, 0.5);
}

.feed-dot.all {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.feed-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feed-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-count {
  font-size: 0.75rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 1.5em;
  text-align: right;
}

.feed-remove {
  opacity: 0;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition:
    opacity 140ms var(--ease-out),
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    transform 140ms var(--ease-out);
  flex-shrink: 0;
}

/* Hover-only reveal; touch always sees control (no sticky hover) */
.feed-item:focus-within .feed-remove {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .feed-item:hover .feed-remove {
    opacity: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .feed-remove {
    opacity: 0.85;
  }
}

@media (hover: hover) and (pointer: fine) {
  .feed-remove:hover {
    background: rgba(255, 123, 138, 0.15);
    color: var(--danger);
  }
}

.feed-remove:active {
  transform: scale(0.97);
}

.sidebar-foot {
  padding: var(--space-3) var(--space-3) max(var(--space-3), env(safe-area-inset-bottom));
  display: grid;
  gap: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.12));
}

/* ---------- Main ---------- */
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--shell-gap);
}

.topbar {
  border-radius: var(--radius-lg);
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  padding: 8px var(--panel-pad-x);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.page-title-wrap {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.032em;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-sub {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42ch;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
  min-width: 0;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 12px;
  border-radius: 12px;
  width: clamp(168px, 22vw, 260px);
  transition: box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.search:focus-within {
  border-color: rgba(139, 219, 255, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(139, 219, 255, 0.12);
}

.search-icon {
  color: var(--text-3);
  flex-shrink: 0;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

.search input::placeholder {
  color: var(--text-3);
}

.search-kbd {
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--text-3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 6px;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.04);
}

.seg {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 12px;
  gap: 2px;
  height: var(--control-h);
  box-sizing: border-box;
}

.seg-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-3);
  transition:
    background-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.seg-btn:active {
  transform: scale(0.97);
}

.seg-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

@media (hover: hover) and (pointer: fine) {
  .seg-btn:not(.is-active):hover {
    color: var(--text-2);
  }
}

/* ---------- Content ---------- */
.content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  /* No layout transition — only transform/opacity on .reader (Emil) */
}

.content.has-reader {
  grid-template-columns: minmax(var(--list-min), 1fr) var(--reader-w);
  gap: var(--shell-gap);
}

.feed-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  position: relative;
  isolation: isolate;
  /* One step quieter than shell glass — content stage, not chrome */
  background:
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.032) 0%,
      rgba(255, 255, 255, 0.008) 100%
    ),
    rgba(255, 255, 255, 0.012);
  backdrop-filter: blur(var(--blur-panel)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur-panel)) saturate(var(--saturate));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -0.5px 0 rgba(255, 255, 255, 0.02),
    0 8px 24px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  transition:
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

/* Soft top specular on content panels — matches shell language quietly */
.feed-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.02) 14%,
    transparent 36%
  );
  z-index: 0;
}

.feed-panel > * {
  position: relative;
  z-index: 1;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--toolbar-h);
  padding: 6px var(--panel-pad-x);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.status-line {
  font-size: 0.78rem;
  color: var(--text-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-btn {
  font-size: 0.78rem;
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.text-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .text-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
  }
}

.article-list {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 8px var(--space-5);
  display: block;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  scroll-padding-top: var(--space-2);
  scroll-padding-bottom: var(--space-4);
  contain: layout style paint;
}

.vlist-spacer-top,
.vlist-spacer-bottom {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
  /* Avoid layout thrash when spacer heights jump */
  contain: strict;
}

.vlist-window {
  display: flex;
  flex-direction: column;
  gap: 3px;
  contain: layout style;
}

.vlist-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.9rem;
}

.article-list .article-card {
  min-height: calc(var(--vrow, 88px) - 2px);
  max-height: calc(var(--vrow, 88px) - 2px);
  overflow: hidden;
  box-sizing: border-box;
}

/* Article card — glass chip
   Default: visible (no entrance). Stagger only under .is-animating. */
.article-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition:
    background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    transform 140ms var(--ease-out),
    opacity 150ms var(--ease-out);
  margin-bottom: 0;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-card:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .article-card:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.06);
  }
}

.article-card.is-active {
  /* Selected chip: thin glass + accent wash, not a solid block */
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%),
    rgba(139, 219, 255, 0.05);
  border-color: rgba(139, 219, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-card.is-read {
  opacity: 0.68;
}

.article-card.is-read .article-title {
  color: var(--text-2);
  font-weight: 500;
}

.article-card.is-read.is-active,
.article-card.is-read:hover {
  opacity: 1;
}

.article-main {
  min-width: 0;
}

.article-source {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-3);
  margin-bottom: 5px;
}

.source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.article-title {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}

.article-snippet {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.article-time {
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.unread-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 219, 255, 0.12);
}

.star-mark {
  color: #fbbf24;
  opacity: 0.9;
}

/* Empty / loading */
.feed-panel:has(#emptyState:not([hidden])) {
  justify-content: center;
  min-height: 100%;
}

.feed-panel:has(#emptyState:not([hidden])) .list-toolbar,
.feed-panel:has(#emptyState:not([hidden])) .article-list {
  display: none;
}

.empty[hidden] {
  display: none !important;
}

.empty {
  margin: auto;
  max-width: 22rem;
  width: calc(100% - 40px);
  text-align: center;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  align-self: center;
}

.empty-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01)),
    rgba(139, 219, 255, 0.1);
  border: 1px solid rgba(139, 219, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.empty h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.empty p {
  margin: 0 0 20px;
  color: var(--text-3);
  font-size: 0.9rem;
}

.loading-state {
  /* default hidden — author display must not override [hidden] */
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-height: 120px;
  padding: 28px 16px;
  color: var(--text-3);
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.loading-state:not([hidden]) {
  display: flex;
}

.loading-state[hidden] {
  display: none !important;
}

.spinner,
.btn-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.55s linear infinite;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Reader ---------- */
.reader {
  --reader-font: 1rem;
  --reader-line: 1.75;
  border-radius: var(--radius-xl);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: right center;
  position: relative;
}

.reader-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  z-index: 3;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.03);
}

.reader-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 0 1px 1px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left center;
  /* scroll is continuous — keep transition tiny, not springy */
  transition: width 80ms linear;
  will-change: width;
}

.reader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--toolbar-h);
  height: var(--toolbar-h);
  padding: 0 8px 0 6px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  position: relative;
  z-index: 2;
}

.reader-bar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.reader-pos {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  letter-spacing: 0.01em;
  white-space: nowrap;
  padding: 0 4px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.reader-type {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border-radius: 10px;
  padding: 2px;
  margin-right: 2px;
  gap: 0;
}

.type-btn {
  min-width: 30px;
  height: 28px;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-2);
  transition:
    background-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.type-btn:active {
  transform: scale(0.97);
}

.type-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }
}

.reader-body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-5) var(--reader-pad-x) var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  scroll-padding-top: var(--space-4);
  scroll-behavior: auto; /* keyboard/list nav is high-frequency — no smooth scroll */
}

.reader-meta {
  font-size: 0.78rem;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  margin: 0 auto 10px;
  max-width: var(--measure);
  width: 100%;
}

.reader-title {
  margin: 0 auto 10px;
  font-size: clamp(1.22rem, 1.5vw, 1.48rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.28;
  max-width: var(--measure);
  width: 100%;
  text-wrap: balance;
}

.reader-stats {
  margin: 0 auto 18px;
  max-width: var(--measure);
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.01em;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.reader-stats .stat-sep {
  opacity: 0.45;
}

.prose {
  font-size: var(--reader-font, 1rem);
  line-height: var(--reader-line, 1.75);
  color: var(--text-2);
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.prose p {
  margin: 0 0 1em;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: from-font;
}

.prose a:hover {
  color: #b8ebff;
}

.prose img {
  border-radius: 12px;
  margin: 14px auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 100%;
  height: auto;
}

.prose figure {
  margin: 1.1em 0;
}

.prose figcaption {
  margin-top: 6px;
  font-size: 0.82em;
  color: var(--text-3);
  text-align: center;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 1.45em 0 0.5em;
  font-weight: 650;
}

.prose h1 { font-size: 1.28em; }
.prose h2 { font-size: 1.16em; }
.prose h3 { font-size: 1.06em; }

.prose pre,
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.prose code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.prose blockquote {
  margin: 1em 0;
  padding: 4px 0 4px 14px;
  border-left: 2px solid rgba(139, 219, 255, 0.4);
  color: var(--text-3);
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
  margin: 0 0 1em;
}

.prose li {
  margin: 0.28em 0;
}

.prose li > ul,
.prose li > ol {
  margin: 0.2em 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1.6em 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92em;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 10px;
  text-align: left;
}

.prose th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 600;
}

.star-btn-on {
  color: #fbbf24 !important;
}

/* Reader bottom nav — occasional, spatial continuity */
.reader-nav {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

.reader-nav-btn {
  min-width: 0;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.015);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 140ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.reader-nav-btn.is-next {
  text-align: right;
  align-items: flex-end;
}

.reader-nav-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.reader-nav-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .reader-nav-btn:hover:not(:disabled) {
    background:
      linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
      rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }
}

.reader-nav-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.reader-nav-title {
  font-size: 0.82rem;
  font-weight: 560;
  line-height: 1.3;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

/* Empty body hint inside reader */
.reader-empty-hint {
  margin: 0 auto;
  max-width: var(--measure);
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--text-3);
  font-size: 0.9rem;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.02);
}

.reader-empty-hint a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* ---------- Buttons / icons ---------- */
.icon-btn {
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text-2);
  border: 1px solid transparent;
  transition:
    background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 140ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.icon-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h-lg);
  padding: 0 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition:
    transform 150ms var(--ease-out),
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    filter 160ms var(--ease-out),
    opacity 160ms var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  color: #061018;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 45%),
    linear-gradient(135deg, #9be4ff 0%, #8bdbff 40%, #a78bfa 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 6px 18px rgba(125, 211, 252, 0.18);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    filter: brightness(1.05);
  }
}

.btn-ghost {
  color: var(--text-2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }
}

/* ---------- Modal ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.modal-root[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.22);
  backdrop-filter: blur(12px) saturate(114%);
  -webkit-backdrop-filter: blur(12px) saturate(114%);
  /* enter/exit via interruptible transitions in motion system */
}

.modal {
  position: relative;
  width: min(400px, 100%);
  border-radius: var(--radius-xl);
  padding: 4px;
  /* modals stay transform-origin: center (Emil exception) */
  transform-origin: center;
  box-shadow: var(--shadow-float), var(--shadow-glass);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 4px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.modal-form {
  padding: 4px 12px 12px;
  display: grid;
  gap: var(--space-3);
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}

.muted {
  color: var(--text-3);
  font-weight: 400;
}

.field-control {
  border-radius: 12px;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  transition: box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.field-control:focus-within {
  border-color: rgba(139, 219, 255, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(139, 219, 255, 0.12);
}

.field-control input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.92rem;
}

.field-control input::placeholder {
  color: var(--text-3);
}

.preset-row {
  display: grid;
  gap: 8px;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-2);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 140ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.preset-chip:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .preset-chip:hover {
    background: rgba(139, 219, 255, 0.12);
    border-color: rgba(139, 219, 255, 0.25);
    color: var(--text);
  }
}

.modal-error {
  font-size: 0.84rem;
  color: var(--danger);
  background: rgba(255, 123, 138, 0.1);
  border: 1px solid rgba(255, 123, 138, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 4px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(360px, calc(100% - 32px));
}

.toast {
  pointer-events: auto;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 0.86rem;
  color: var(--text);
  /* Floating glass chip — thin fill, edge defines it */
  background:
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.06) 0%,
      rgba(255, 255, 255, 0.015) 100%
    ),
    rgba(8, 12, 20, 0.22);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -0.5px 0 rgba(255, 255, 255, 0.02),
    0 16px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(10px);
  opacity: 0;
  transition:
    transform 240ms var(--ease-out),
    opacity 240ms var(--ease-out);
}

.toast.is-in {
  transform: translateY(0);
  opacity: 1;
}

.toast.is-out {
  transform: translateY(6px);
  opacity: 0;
  transition-duration: 160ms; /* exit faster than enter */
}

/* ---------- Responsive ---------- */
#sidebarOpen {
  display: none;
}

/* Ultra-wide: give list more air, keep reader measure calm */
@media (min-width: 1400px) {
  :root {
    --sidebar-w: 280px;
    --reader-w: min(560px, 40vw);
    --reader-pad-x: 28px;
    --shell-pad: 14px;
    --shell-gap: 14px;
  }
}

/* Wide: reader + list coexist; medium: reader takes stage */
@media (max-width: 1100px) {
  :root {
    --reader-w: min(460px, 44vw);
    --sidebar-w: 248px;
    --list-min: 240px;
    --reader-pad-x: 20px;
  }

  .search {
    width: clamp(148px, 20vw, 220px);
  }
}

@media (max-width: 960px) {
  .content.has-reader {
    grid-template-columns: minmax(0, 1fr);
  }

  .content.has-reader .feed-panel {
    display: none;
  }

  .reader {
    --reader-w: 100%;
  }

  .reader-body {
    --reader-pad-x: 22px;
  }

  .search {
    width: min(200px, 36vw);
  }
}

/* Compact desktop: topbar may wrap actions under title */
@media (max-width: 900px) and (min-width: 781px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .seg {
    flex-shrink: 0;
  }
}

@media (max-width: 780px) {
  :root {
    --shell-pad: 8px;
    --shell-gap: 8px;
    --panel-pad-x: 12px;
    --topbar-h: 52px;
    --reader-pad-x: 16px;
  }

  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top)) auto max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    width: min(300px, calc(100vw - 16px));
    z-index: 40;
    transform: translateX(calc(-100% - 24px));
    transition: transform 280ms var(--ease-drawer);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: grid;
  }

  #sidebarOpen {
    display: grid;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 10px;
    min-height: var(--topbar-h);
    row-gap: 8px;
  }

  .topbar-actions {
    gap: 8px;
    width: 100%;
    justify-content: stretch;
  }

  .search {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .search-kbd {
    display: none;
  }

  /* Filters remain reachable — compact on second row with search */
  .seg {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .page-sub {
    display: none;
  }

  .list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--toolbar-h);
  padding: 6px var(--panel-pad-x);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
}

  .article-card {
    padding: 10px 10px;
  }

  .reader-body {
    padding: var(--space-4) var(--reader-pad-x) var(--space-3);
  }

  .reader-nav {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .reader-nav-btn,
  .reader-nav-btn.is-next {
    text-align: left;
    align-items: flex-start;
  }

  .reader-pos {
    display: none;
  }

  .article-list {
    padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
  }

  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(4, 6, 12, 0.45);
    backdrop-filter: blur(4px);
  }
}

/* Very narrow: full-width search under title */
@media (max-width: 520px) {
  :root {
    --reader-pad-x: 14px;
    --panel-pad-x: 12px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .search {
    width: 100%;
  }

  .seg {
    width: 100%;
    justify-content: stretch;
  }

  .seg-btn {
    flex: 1;
  }

  .list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--toolbar-h);
  padding: 6px var(--panel-pad-x);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
}

  .text-btn {
    padding: 6px 8px;
  }
}

/* =========================================================
   Layout polish · Emil craft
   - 4px spacing scale; shared toolbar/control heights
   - Reader measure centered; no layout transitions
   - overscroll-behavior contain on scroll regions
   - Safe-area aware pads; list min-width when split
   ========================================================= */

/* =========================================================
   Motion system · Emil Kowalski craft
   - UI ≤ 300ms, strong ease-out
   - Never animate high-frequency keyboard actions
   - Exit faster than enter; scale from ≥0.95 not 0
   - Prefer transitions (interruptible) over keyframes
   ========================================================= */

/* Shell first paint — rare/onboarding delight */
.app.is-booting .sidebar,
.app.is-booting .topbar,
.app.is-booting .feed-panel {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
}

.app.is-ready .sidebar,
.app.is-ready .topbar,
.app.is-ready .feed-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 280ms var(--ease-out),
    transform 280ms var(--ease-out);
}

.app.is-ready .topbar {
  transition-delay: 40ms;
}

.app.is-ready .feed-panel {
  transition-delay: 70ms;
}

/* Pressable family — feedback purpose */
.btn,
.icon-btn,
.seg-btn,
.feed-item,
.article-card,
.text-btn,
.preset-chip,
.type-btn,
.reader-nav-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Brand mark subtle life (decorative, low frequency view) */
.brand-mark {
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .brand:hover .brand-mark {
    transform: scale(1.03) rotate(-1.5deg);
  }
}

/* Primary button: press blur trick (Emil) for state polish */
.btn-primary {
  transition:
    transform 150ms var(--ease-out),
    filter 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    opacity 160ms var(--ease-out);
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.98) blur(0.4px);
}

/* Refresh icon spin while loading — state indication */
#refreshAll svg {
  transition: transform 200ms var(--ease-out);
}

#refreshAll.is-loading svg {
  animation: spin 0.55s linear infinite;
}

/* Page title swap — prevent jarring text change */
.page-title,
.page-sub {
  transition:
    opacity 140ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.page-title-wrap.is-swapping .page-title,
.page-title-wrap.is-swapping .page-sub {
  opacity: 0;
  transform: translateY(3px);
}

/* Segmented control — sliding pill (state indication) */
.seg {
  position: relative;
}

.seg-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.08);
  transition:
    transform 180ms var(--ease-out),
    width 180ms var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.seg-btn {
  position: relative;
  z-index: 1;
  background: transparent !important;
  box-shadow: none !important;
}

.seg-btn.is-active {
  background: transparent !important;
}

/* Feed active indicator — soft wash, interruptible */
.feed-item {
  position: relative;
}

.feed-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(139, 219, 255, 0.09), rgba(167, 139, 250, 0.035));
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
  z-index: 0;
  pointer-events: none;
}

.feed-item.is-active::before {
  opacity: 1;
  transform: scale(1);
}

.feed-item > * {
  position: relative;
  z-index: 1;
}

/* Article list reflow — short stagger only when .is-animating */
.article-list.is-animating .article-card {
  opacity: 0;
  transform: translateY(8px);
  animation: cardIn 240ms var(--ease-out) forwards;
}

.article-list.is-animating .article-card:nth-child(1) { animation-delay: 0ms; }
.article-list.is-animating .article-card:nth-child(2) { animation-delay: 30ms; }
.article-list.is-animating .article-card:nth-child(3) { animation-delay: 60ms; }
.article-list.is-animating .article-card:nth-child(4) { animation-delay: 90ms; }
.article-list.is-animating .article-card:nth-child(5) { animation-delay: 120ms; }
.article-list.is-animating .article-card:nth-child(6) { animation-delay: 150ms; }
.article-list.is-animating .article-card:nth-child(7) { animation-delay: 180ms; }
.article-list.is-animating .article-card:nth-child(8) { animation-delay: 210ms; }
.article-list.is-animating .article-card:nth-child(n+9) { animation-delay: 240ms; }

.article-list:not(.is-animating) .article-card {
  opacity: 1;
  transform: none;
  animation: none;
}

/* Reader: interruptible open/close via transitions */
.reader {
  opacity: 0;
  transform: translateX(12px) scale(0.978);
  pointer-events: none;
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out);
  display: flex !important; /* keep in flow for transition; size gated by grid */
}

.content:not(.has-reader) .reader {
  position: absolute;
  width: var(--reader-w);
  right: 0;
  top: 0;
  bottom: 0;
  visibility: hidden;
}

.content.has-reader .reader {
  position: relative;
  width: auto;
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  animation: none;
}

.content.is-reader-closing .reader {
  opacity: 0;
  transform: translateX(10px) scale(0.98);
  transition-duration: 150ms; /* exit faster than enter */
}

.reader-body .reader-title,
.reader-body .reader-meta,
.reader-body .reader-stats,
.reader-body .reader-content {
  opacity: 0;
  transform: translateY(6px);
}

/* First open only — delight once; skip on high-frequency article hopping */
.content.has-reader:not(.is-reader-closing):not(.is-reader-instant) .reader-title {
  animation: fadeUp 220ms var(--ease-out) 30ms forwards;
}

.content.has-reader:not(.is-reader-closing):not(.is-reader-instant) .reader-meta {
  animation: fadeUp 200ms var(--ease-out) 0ms forwards;
}

.content.has-reader:not(.is-reader-closing):not(.is-reader-instant) .reader-stats {
  animation: fadeUp 210ms var(--ease-out) 25ms forwards;
}

.content.has-reader:not(.is-reader-closing):not(.is-reader-instant) .reader-content {
  animation: fadeUp 240ms var(--ease-out) 55ms forwards;
}

/* Instant path: keyboard j/k and in-panel hops — no delayed content fade */
.content.has-reader.is-reader-instant .reader-title,
.content.has-reader.is-reader-instant .reader-meta,
.content.has-reader.is-reader-instant .reader-stats,
.content.has-reader.is-reader-instant .reader-content {
  opacity: 1;
  transform: none;
  animation: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Star morph feedback */
#starBtn {
  transition:
    transform 150ms var(--ease-out),
    color 160ms var(--ease-out),
    background-color 150ms var(--ease-out);
}

#starBtn.is-pop {
  animation: starPop 280ms var(--ease-out);
}

#starBtn.star-btn-on svg {
  fill: currentColor;
  stroke: currentColor;
}

@keyframes starPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Modal: enter ease-out, exit faster; scale ≥ 0.95 */
.modal-root {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out);
}

.modal-root[hidden] {
  display: grid !important; /* allow exit animation before hide */
  opacity: 0;
  pointer-events: none;
}

.modal-root.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
  animation: none;
}

.modal-root.is-open .modal-backdrop {
  opacity: 1;
}

.modal-root.is-closing .modal-backdrop {
  opacity: 0;
  transition-duration: 140ms;
}

.modal {
  opacity: 0;
  transform: scale(0.97) translateY(6px);
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out);
  animation: none;
}

.modal-root.is-open .modal {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.modal-root.is-closing .modal {
  opacity: 0;
  transform: scale(0.97) translateY(6px);
  transition-duration: 150ms; /* exit faster */
}

/* Empty state enter */
.empty {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 280ms var(--ease-out),
    transform 280ms var(--ease-out);
}

.empty.is-shown {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Status line soft crossfade */
.status-line {
  transition: opacity 120ms var(--ease-out);
}

.status-line.is-flash {
  opacity: 0.4;
}

/* Mobile sidebar drawer — ease-drawer, exit same spatial dir */
.sidebar {
  transition:
    transform 280ms var(--ease-drawer),
    opacity 220ms var(--ease-out);
}

/* Toast: enter from bottom (spatial consistency with exit) */
.toast.is-in,
.toast.is-out {
  transform: translateY(6px);
  opacity: 0;
  transition-duration: 160ms; /* exit faster than enter */
}

/* Filter/search is high-frequency — never blur/scale the list (Emil) */
.article-list.is-filtering {
  filter: none;
  opacity: 1;
  transform: none;
  transition: none;
}

/* Focus ring polish */
:focus-visible {
  outline: 2px solid rgba(139, 219, 255, 0.55);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion — fewer & gentler, not zero (Emil).
   Keep short opacity/color for open-state comprehension.
   Kill decorative movement & transforms; do NOT force opacity on
   open/closed surfaces (reader/modal/toast still need state opacity). */
@media (prefers-reduced-motion: reduce) {
  .orb {
    animation: none !important;
    transform: none !important;
    opacity: 0.07 !important;
    will-change: auto !important;
  }

  .ambient {
    /* static depth only when reduced motion */
  }

  /* Shell first-paint: snap visible */
  .app.is-booting .sidebar,
  .app.is-booting .topbar,
  .app.is-booting .feed-panel,
  .app.is-ready .sidebar,
  .app.is-ready .topbar,
  .app.is-ready .feed-panel {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Decorative / feedback motion off */
  .brand-mark,
  #refreshAll.is-loading svg,
  #starBtn.is-pop,
  .article-list.is-animating .article-card,
  .page-title-wrap.is-swapping .page-title,
  .page-title-wrap.is-swapping .page-sub {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    filter: none !important;
  }

  .article-list.is-animating .article-card {
    opacity: 1 !important;
  }

  .page-title-wrap.is-swapping .page-title,
  .page-title-wrap.is-swapping .page-sub {
    opacity: 1 !important;
  }

  /* Filtering mask: no blur/scale tax */
  .article-list.is-filtering {
    filter: none !important;
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }

  /* Open/close surfaces: drop movement, keep instant opacity snap */
  .reader,
  .modal,
  .modal-backdrop,
  .modal-root,
  .empty,
  .toast,
  .seg-pill {
    transition: none !important;
    animation: none !important;
  }

  .reader,
  .modal {
    transform: none !important;
  }

  .content:not(.has-reader) .reader {
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .content.has-reader .reader {
    opacity: 1 !important;
  }

  .content.has-reader.is-reader-instant .reader-title,
  .content.has-reader.is-reader-instant .reader-meta,
  .content.has-reader.is-reader-instant .reader-stats,
  .content.has-reader.is-reader-instant .reader-content {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .reader-progress-bar {
    transition: none !important;
  }

  .empty:not(.is-shown) {
    opacity: 0 !important;
  }

  .empty.is-shown {
    opacity: 1 !important;
    transform: none !important;
  }
}


/* =========================================================
   Polish pass · Emil craft 2026-07
   - No blur tax on high-frequency title/status/filter
   - Instant reader hops for keyboard / in-panel nav
   - Faster spinner (perceived load speed)
   - Tighter list density + quieter unread/read hierarchy
   ========================================================= */
