/* LARFeed - light, editorial theme. Desktop site / mobile app-like feed. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #141b26;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #1d4ed8;
  --brand-dark: #1638a6;
  --accent: #d92d20;
  --ok: #067647;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
img, video { max-width: 100%; }

.boot { padding: 32px; color: var(--muted); }

/* ---------------- shell ---------------- */
.shell { height: 100%; min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark {
  width: 62px; height: 52px; border-radius: 0;
  background: transparent; color: inherit;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  letter-spacing: -.02em; overflow: visible;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.brand-tag { color: var(--muted); font-size: 12px; border-left: 1px solid var(--line); padding-left: 10px; margin-left: 4px; }
.spacer { flex: 1 1 auto; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 700;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.top-action {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 9px; padding: 7px 12px; font-size: 13px; font-weight: 700;
}
.top-action:hover { border-color: #cbd2dc; color: var(--ink); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: grid; place-items: center;
  font-size: 17px;
}
.icon-btn:hover { color: var(--ink); border-color: #cbd2dc; }

/* ---------------- feed: desktop grid ---------------- */
.feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 22px;
  align-content: start;
  padding: 26px clamp(16px, 4vw, 48px) 48px;
  scroll-behavior: smooth;
}
.feed-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow .18s, transform .18s;
}
.feed-card:hover { box-shadow: 0 4px 10px rgba(16,24,40,.07), 0 16px 36px rgba(16,24,40,.08); transform: translateY(-2px); }

.category-chip {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eff4ff;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef1f5 0%, #f8fafc 55%, #e8edf3 100%);
  border: 1px solid var(--line);
  position: relative;
  display: grid;
  place-items: center;
}
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media video { object-fit: contain; background: #0f172a; }
.media-glyph {
  font-size: 28px; font-weight: 800; letter-spacing: -.04em;
  color: #98a2b3; user-select: none;
}
.media-badge {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(20,27,38,.78); color: #fff;
  border-radius: 6px; padding: 4px 8px; font-size: 10px; font-weight: 700;
  max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.headline {
  margin: 0; font-size: 21px; line-height: 1.28; font-weight: 750; letter-spacing: -.025em;
  color: var(--ink); cursor: pointer;
}
.headline:hover { color: var(--brand); }
.summary { margin: 0; font-size: 14.5px; line-height: 1.65; color: #344054; }
.meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 10px;
}
.meta .dot { color: #cbd2dc; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.action {
  flex: 1 1 auto; min-width: 96px;
  border: 1px solid var(--line); background: var(--surface); color: #344054;
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .15s, background .15s, color .15s;
}
.action:hover { border-color: #c7d0dc; background: var(--surface-2); }
.action.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.action.primary:hover { background: var(--brand-dark); }
.action.negative:hover { border-color: #fecdca; color: var(--danger); background: #fffbfa; }

.sentinel { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 12px; font-size: 13px; }
.empty, .error-state {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 64px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.empty h2, .error-state h2 { color: var(--ink); margin: 0 0 8px; }

/* ---------------- pages ---------------- */
.page {
  flex: 1; overflow-y: auto; width: min(960px, 100%); margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 56px;
}
.page h1 { font-size: 26px; letter-spacing: -.03em; margin: 0 0 6px; }
.page .subtitle { color: var(--muted); margin: 0 0 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 24px 0 10px; font-weight: 800; }
.field { display: flex; gap: 8px; margin-bottom: 12px; }
.field input, .field select {
  flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; outline: none;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.list { display: flex; flex-direction: column; gap: 8px; }
.chip-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 14px;
}
.chip-row .label { font-weight: 650; font-size: 14px; }
.chip-row small { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
.mini-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: 7px 11px; font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.mini-btn:hover { border-color: #cbd2dc; color: var(--ink); }
.mini-btn.add { color: var(--ok); }
.mini-btn.remove { color: var(--danger); }
.didyoumean {
  background: #fffaeb; border: 1px solid #fedf89; color: #93370d;
  border-radius: 9px; padding: 10px 12px; margin: 10px 0; font-size: 13px;
}
.didyoumean + .chip-row { margin-top: 10px; }

/* Personalization page: useful topic controls for signed-in and guest readers. */
.personalization-page { max-width: 760px; }
.personalization-heading { margin-bottom: 22px; }
.page-eyebrow { display: block; margin-bottom: 7px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.personalization-heading h1 { margin-bottom: 6px; }
.personalization-heading .subtitle { margin: 0; }
.topic-picker {
  padding: 18px; margin-bottom: 26px; border: 1px solid var(--line);
  border-radius: 16px; background: #fff; box-shadow: 0 8px 22px rgba(16, 24, 40, .05);
}
.topic-picker-title { display: flex; justify-content: space-between; margin-bottom: 13px; }
.topic-picker-title strong, .topic-picker-title span { display: block; }
.topic-picker-title strong { color: var(--ink); font-size: 15px; }
.topic-picker-title span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.topic-search-row {
  display: flex; align-items: center; gap: 9px; min-height: 50px; padding: 4px 5px 4px 13px;
  border: 1px solid #d8deea; border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.topic-search-row:focus-within { border-color: #617ef1; box-shadow: 0 0 0 3px rgba(36, 79, 226, .11); }
.topic-search-icon { width: 19px; height: 19px; flex: 0 0 auto; color: #7b8495; stroke: currentColor; stroke-width: 1.8; }
.topic-search-row input { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; }
.topic-search-row input::placeholder { color: #8a93a3; }
.topic-search-add, .topic-result-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0;
  border: 0; border-radius: 9px; background: #244fe2; color: #fff;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1;
  cursor: pointer; flex: 0 0 40px; transition: background .15s, transform .15s;
}
.topic-search-add:hover, .topic-result-add:hover { background: #1c43ca; }
.topic-search-add:active, .topic-result-add:active { transform: scale(.96); }
.topic-search-add:focus-visible, .topic-result-add:focus-visible { outline: 3px solid rgba(36, 79, 226, .25); outline-offset: 2px; }
.topic-search-add svg, .topic-result-add svg { display: block; width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
#suggestions:empty { display: none; }
.topic-suggestion {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; padding: 12px 13px; border: 1px solid #e1e6f0;
  border-radius: 12px; background: #fbfcff;
}
.topic-suggestion-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.topic-suggestion-label { color: #667085; font-size: 9px; font-weight: 800; letter-spacing: .09em; }
.topic-suggestion-copy strong { overflow: hidden; color: #1d2939; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.topic-suggestion-copy small { color: #7b8495; font-size: 11px; }
.quick-topics { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-topics.is-hidden { display: none; }
.quick-topics-label { width: 100%; color: #667085; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.quick-topic { padding: 7px 10px; border: 1px solid #e1e6f0; border-radius: 999px; background: #f8faff; color: #344054; font: inherit; font-size: 12px; cursor: pointer; }
.quick-topic:hover { border-color: #aabaff; background: #eff4ff; color: var(--brand); }
.preference-section { margin: 0 0 22px; }
.preference-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.preference-heading h2 { margin: 0; color: var(--ink); font-size: 16px; }
.preference-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.preference-count { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 999px; background: #eff4ff; color: var(--brand); font-size: 12px; font-weight: 750; }
.empty-interest { display: flex; flex-direction: column; gap: 4px; padding: 17px; border: 1px dashed #d0d5dd; border-radius: 12px; background: #fafbfc; }
.empty-interest strong { color: #344054; font-size: 13px; }
.empty-interest span { color: var(--muted); font-size: 12px; }
.preference-more { margin-top: 8px; border-top: 1px solid var(--line); }
.preference-more summary { padding: 15px 0; color: #475467; font-size: 13px; font-weight: 700; cursor: pointer; }
.preference-more .preference-section { padding-top: 6px; }
.interest-login-sheet { max-width: 380px; text-align: center; box-sizing: border-box; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.interest-login-mark { display: grid; place-items: center; overflow: visible; width: 104px; height: 86px; margin: 0 auto 14px; border-radius: 0; background: transparent; }
.interest-login-mark img, .guest-reminder-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.interest-login-sheet h3 { margin-bottom: 8px; }
.interest-login-sheet p { margin: 0 0 18px; color: #667085; font-size: 14px; line-height: 1.55; }
.interest-login-sheet .interest-login-continue { width: 100%; min-height: 46px; }
.interest-login-sheet .interest-login-cancel { width: 100%; min-height: 42px; margin-top: 8px; }
.guest-reminder-sheet { max-width: 390px; text-align: center; }
.guest-reminder-sheet { box-sizing: border-box; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.guest-reminder-icon { display: grid; place-items: center; overflow: visible; width: 104px; height: 86px; margin: 0 auto 14px; border-radius: 0; background: transparent; }
.guest-reminder-sheet h3 { margin-bottom: 8px; }
.guest-reminder-sheet p { margin: 0 0 18px; color: #667085; font-size: 14px; line-height: 1.55; }
.guest-reminder-sheet .guest-reminder-signin, .guest-reminder-sheet .guest-reminder-dismiss { width: 100%; min-height: 44px; }
.guest-reminder-sheet .guest-reminder-dismiss { margin-top: 8px; }
.app-download-end {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 270px; width: 100%; padding: 48px 24px;
  border: 0; border-radius: 0;
  background: #f7f9fc;
  text-align: center;
}
.app-download-end h2 { margin: 0 0 12px; color: var(--ink); font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.035em; }
.app-download-end p { max-width: 520px; margin: 0 auto 22px; color: var(--muted); line-height: 1.55; }
.app-download-badges { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; }
.app-store-badge { display: inline-flex; align-items: center; transition: opacity .15s, transform .15s; }
.app-store-badge:hover { opacity: .9; transform: translateY(-1px); }
.app-store-badge img { display: block; width: auto; height: auto; object-fit: contain; }
.app-store-badge img.google-play-badge { width: 180px; max-width: min(44vw, 180px); }
.app-store-badge img.apple-store-badge { width: 160px; max-width: min(44vw, 160px); }
.app-store-badge.unavailable { cursor: default; }
.app-download-status { margin-top: 14px; color: #98a2b3; font-size: 12px; }
.app-back-top { margin-top: 16px; padding: 8px 12px; border: 0; background: transparent; color: var(--brand); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.app-back-top:hover { text-decoration: underline; }
@media (max-width: 767px) {
  .sheet-backdrop.guest-reminder-backdrop {
    place-items: end center !important;
    padding: max(12px, var(--safe-top)) 12px max(12px, var(--safe-bottom)) !important;
    overflow-y: auto;
  }
  .guest-reminder-backdrop .guest-reminder-sheet {
    width: min(100%, 420px) !important;
    max-height: calc(100dvh - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)) - 24px);
    padding: 20px 18px !important;
    border-radius: 18px !important;
  }
  .guest-reminder-sheet .guest-reminder-signin,
  .guest-reminder-sheet .guest-reminder-dismiss {
    min-height: 48px !important;
    height: auto !important;
    padding: 12px 16px !important;
  }
  .sheet-backdrop.interest-login-backdrop {
    place-items: end center !important;
    padding: max(12px, var(--safe-top)) 12px max(12px, var(--safe-bottom)) !important;
    overflow-y: auto;
  }
  .interest-login-backdrop .interest-login-sheet {
    width: min(100%, 420px) !important;
    max-height: calc(100dvh - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)) - 24px);
    padding: 20px 18px !important;
    border-radius: 18px !important;
  }
  .interest-login-sheet .interest-login-continue,
  .interest-login-sheet .interest-login-cancel {
    min-height: 48px !important;
    height: auto !important;
  }
  .app-download-end {
    min-height: calc(100dvh - var(--header-h) - 58px - var(--safe-top) - var(--safe-bottom));
    padding: 36px 18px; border-radius: 0; scroll-snap-align: start;
  }
  .app-download-badges { gap: 9px; }
}
@media (max-width: 767px) {
  .personalization-page { padding-top: 22px; }
  .personalization-heading { margin-bottom: 18px; }
  .topic-picker { padding: 15px; border-radius: 14px; }
}

/* ---------------- modal / toast ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 50;
  display: grid; place-items: center; padding: 20px;
}
.sheet {
  width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; box-shadow: 0 24px 60px rgba(16,24,40,.22);
}
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.sheet .action { width: 100%; margin-top: 8px; }
.sheet .secondary-note { color: var(--muted); font-size: 12px; margin-top: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #101828; color: #fff; border-radius: 8px; padding: 10px 16px;
  font-size: 13px; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* ---------------- mobile: full-screen app-like feed ---------------- */
@media (max-width: 767px) {
  :root { --header-h: 56px; }
  .topbar { gap: 10px; padding: 0 14px; }
  .brand-name { font-size: 16px; }
  .brand-tag { display: none; }
  .tabs { gap: 2px; padding: 2px; }
  .tab { padding: 6px 10px; font-size: 12px; }
  .top-action { display: none; }

  .feed {
    display: block;
    padding: 0;
    scroll-snap-type: y mandatory;
  }
  .feed-card {
    min-height: calc(100dvh - var(--header-h) - var(--safe-top) - var(--safe-bottom));
    scroll-snap-align: start;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 16px 18px;
    gap: 10px;
  }
  .feed-card:hover { transform: none; box-shadow: none; }
  .media { aspect-ratio: 16 / 10; border-radius: 12px; }
  .headline { font-size: clamp(22px, 6vw, 28px); line-height: 1.22; }
  .summary { font-size: 16px; line-height: 1.62; color: #344054; }
  .meta { font-size: 12px; padding-bottom: 6px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .action { min-width: 0; padding: 12px 8px; font-size: 12.5px; }
  .sentinel { padding: 18px; }
  .empty, .error-state { margin: 16px; padding: 40px 20px; }

  .page { padding: 20px 16px 40px; }
  .page h1 { font-size: 22px; }
  .panel { padding: 16px; }
  .sheet-backdrop { place-items: end center; padding: 0; }
  .sheet { border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + var(--safe-bottom)); width: 100%; }
  .toast { bottom: calc(18px + var(--safe-bottom)); max-width: calc(100% - 32px); text-align: center; }
}

/* ---------- scrolling fixes ---------- */
.feed { scroll-behavior: auto; -webkit-overflow-scrolling: touch; }
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 8px; }

/* ---------- wireframe screens ---------- */
.onboarding, .interests-setup {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 24px calc(32px + var(--safe-bottom));
  background: var(--surface);
}
.onboarding-art {
  width: 168px; height: 168px; border-radius: 28px; background: #eff4ff;
  display: grid; place-items: center; margin-bottom: 28px;
}
.onboarding-art svg { width: 96px; height: 96px; }
.onboarding h1 { font-size: 28px; letter-spacing: -.035em; margin: 0 0 12px; }
.onboarding p { color: var(--muted); max-width: 380px; margin: 0 0 28px; }
.dots { display: flex; gap: 8px; margin-bottom: 28px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #d0d5dd; display: block; }
.dots i.active { background: var(--brand); width: 20px; border-radius: 999px; }
.primary-btn {
  border: 0; background: var(--brand); color: #fff; border-radius: 12px;
  padding: 14px 28px; font-weight: 750; font-size: 15px; box-shadow: 0 8px 20px rgba(29,78,216,.22);
}
.primary-btn:hover { background: var(--brand-dark); }

.interests-setup { justify-content: flex-start; padding-top: 28px; }
.interests-setup h1 { font-size: 24px; margin: 0 0 6px; }
.interests-setup p { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.onboarding-step {
  display: flex; align-items: center; justify-content: space-between;
  width: min(100%, 640px); margin: 0 0 24px; color: #667085;
  font-size: 11px; font-weight: 750; letter-spacing: .09em;
}
.step-progress { display: flex; gap: 6px; }
.step-progress i { width: 7px; height: 7px; border-radius: 50%; background: #d0d5dd; }
.step-progress i.done, .step-progress i.active { background: var(--brand); }
.step-progress i.active { box-shadow: 0 0 0 3px #e8edff; }
.interests-setup > h1, .interests-setup > p { width: min(100%, 640px); text-align: left; }
.interest-selection-status {
  display: flex; justify-content: space-between; gap: 12px;
  width: min(100%, 640px); margin: -10px 0 12px;
  color: #667085; font-size: 12px;
}
.interest-selection-status span:first-child { color: var(--brand); font-weight: 700; }
.interest-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  width: min(100%, 640px); margin-bottom: 20px;
}
.interest-tile {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 104px; font-size: 13px; font-weight: 700; position: relative; transition: all .15s;
  cursor: pointer;
}
.interest-tile:hover { border-color: #aabaff; background: #f8faff; }
.interest-tile:focus-visible { outline: 3px solid rgba(36, 79, 226, .25); outline-offset: 2px; }
.interest-tile svg { width: 26px; height: 26px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.interest-tile.selected { border-color: var(--brand); background: #eff4ff; color: var(--brand); }
.interest-tile.selected svg { stroke: var(--brand); }
.interest-tile.selected { box-shadow: inset 0 0 0 1px var(--brand); }
.interest-tile .tick {
  position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); color: #fff; display: none; place-items: center; font-size: 11px;
}
.interest-tile.selected .tick { display: grid; }
.interest-setup-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: min(100%, 640px); color: #667085; font-size: 12px;
}
.interest-setup-footer .primary-btn { min-width: 148px; }

.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + var(--safe-bottom));
  justify-content: space-around;
}
.bottom-nav button {
  border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 700;
  min-width: 60px;
}
.bottom-nav button svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bottom-nav button.active { color: var(--brand); }

.detail-header { display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px,4vw,48px); background: var(--surface); border-bottom: 1px solid var(--line); }
.detail-header .icon-btn { flex: 0 0 auto; }
.detail-wrap { flex: 1; overflow-y: auto; padding: 20px clamp(16px,4vw,48px); }
.detail-hero { width: min(100%, 820px); margin: 0 auto 20px; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #eef1f5; display: grid; place-items: center; position: relative; }
.detail-hero img, .detail-hero iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.detail-body { width: min(100%, 720px); margin: 0 auto; }
.detail-body .category-chip { margin-bottom: 12px; }
.detail-body h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.2; letter-spacing: -.035em; margin: 0 0 14px; }
.detail-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.detail-summary { font-size: 17px; line-height: 1.75; color: #344054; }
.detail-read { margin-top: 28px; width: 100%; padding: 15px; font-size: 15px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.search-bar input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: none; }
.search-bar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }

@media (max-width: 767px) {
  .feed { height: calc(100dvh - var(--header-h) - var(--safe-top) - var(--safe-bottom)); scroll-snap-stop: always; }
  .bottom-nav { display: flex; }
  .shell { padding-bottom: 58px; }
  .feed-card { min-height: calc(100dvh - var(--header-h) - 58px - var(--safe-top) - var(--safe-bottom)); }
  .interest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .interest-tile { padding: 12px 4px; font-size: 11px; }
  .onboarding-step { margin-bottom: 20px; }
  .interests-setup > h1 { font-size: 25px; }
  .interest-setup-footer { align-items: stretch; flex-direction: column-reverse; text-align: center; gap: 12px; }
  .interest-setup-footer .primary-btn { width: 100%; min-height: 48px; }
  .detail-header { padding: 10px 14px; }
  .detail-wrap { padding: 14px 16px 80px; }
  .detail-hero { border-radius: 12px; }
  .detail-body h1 { font-size: 26px; }
  .detail-summary { font-size: 16px; }
}

/* ---------- compact editorial cards ---------- */
.action svg, .icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: 0 0 auto; }
.icon-btn svg { width: 18px; height: 18px; }

.feed { grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; padding: 20px clamp(14px, 3vw, 40px) 40px; }
.feed-card { padding: 12px; gap: 9px; border-radius: 13px; }
.feed-card .media { aspect-ratio: 16 / 8.5; border-radius: 9px; }
.feed-card .media .media-glyph { font-size: 20px; }
.feed-card .headline {
  font-size: 17px; line-height: 1.3; font-weight: 750;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-card .summary {
  font-size: 13px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-card .meta { font-size: 11px; padding-top: 8px; }
.feed-card .actions { gap: 6px; }
.feed-card .action { min-width: 0; padding: 8px 6px; font-size: 11px; border-radius: 8px; gap: 4px; }
.feed-card .action svg { width: 14px; height: 14px; }
.category-chip { font-size: 10px; padding: 3px 8px; }
.media-badge { font-size: 9px; padding: 3px 6px; }

@media (max-width: 767px) {
  .feed-card { padding: 12px 14px 14px; gap: 8px; }
  .feed-card .media { aspect-ratio: 16 / 8.5; max-height: 210px; border-radius: 10px; }
  .feed-card .headline { font-size: 21px; -webkit-line-clamp: 3; }
  .feed-card .summary { font-size: 14.5px; -webkit-line-clamp: 4; line-height: 1.55; }
  .feed-card .actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .feed-card .action { flex-direction: column; padding: 8px 2px; font-size: 10px; min-height: 50px; }
  .feed-card .action svg { width: 17px; height: 17px; }
}

@media (min-width: 1600px) {
  .feed { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.new-stories-pill {
  position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 25; background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 9px 16px; font-size: 12px; font-weight: 750; box-shadow: 0 8px 24px rgba(29,78,216,.28);
}

/* ---------- final editorial redesign ---------- */
:root { --header-h: 54px; }

html, body { overscroll-behavior-y: auto; }
.shell { height: 100dvh; }

.topbar { height: var(--header-h); flex-basis: var(--header-h); padding: 0 12px; gap: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.brand-name { font-size: 16px; }
.brand-tag { display: none; }
.tabs { padding: 2px; gap: 2px; }
.tab { padding: 6px 11px; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; }

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  padding: 18px;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.feed-card {
  min-height: 0 !important;
  scroll-snap-align: none;
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.feed-card:hover { transform: none; }

.media-frame {
  display: block; position: relative; width: 100%;
  aspect-ratio: 16 / 9; overflow: hidden;
  background: #eef1f5; border: 0; border-radius: 0;
}
.media-frame img, .media-frame iframe {
  width: 100%; height: 100%; object-fit: cover; border: 0; display: block;
}
.image-media.image-failed::before {
  content: attr(data-initials); position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #98a2b3;
  background: #eef1f5;
}
.placeholder-media .media-glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: #98a2b3;
}
.source-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: #fff; color: #101828; border-radius: 6px; padding: 5px 7px;
  font-size: 10px; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(16,24,40,.16);
}
.category-chip {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  background: rgba(255,255,255,.95); color: var(--brand); border-radius: 6px;
  padding: 5px 8px; font-size: 10px; text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(16,24,40,.12);
}
.media-badge {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  background: rgba(16,24,40,.72); color: #fff; border-radius: 6px;
  padding: 4px 7px; font-size: 9px; max-width: 52%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.headline {
  padding: 14px 14px 0; font-size: 18px; line-height: 1.3;
  letter-spacing: -.02em; -webkit-line-clamp: 3;
}
.summary {
  padding: 8px 14px 0; font-size: 13.5px; line-height: 1.58;
  color: #475467; -webkit-line-clamp: 3;
}
.meta { padding: 10px 14px; border: 0; font-size: 11px; color: var(--muted); }

/* Contextual story actions - compact, inline, clearly separate from bottom navigation. */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 12px 16px 10px; border: 0; margin-top: 0;
  justify-content: flex-start;
}
.tool-btn {
  flex: 0 0 auto; min-width: 0; min-height: 34px;
  border: 1px solid var(--line); background: #ffffff;
  color: #475467; border-radius: 8px;
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 5px; padding: 6px 9px;
  font-size: 11px; font-weight: 650;
}
.tool-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tool-btn:hover { background: #f8fafc; color: var(--ink); border-color: #cbd2dc; }
.tool-btn:active { transform: scale(.96); }
.tool-btn.active { color: var(--brand); background: #eff4ff; border-color: #c7d7fe; }
.tool-btn.negative.active { color: var(--danger); background: #fffbfa; border-color: #fecdca; }

.sentinel { grid-column: 1 / -1; }

@media (min-width: 768px) {
  .top-action { display: inline-flex; }
}

@media (max-width: 767px) {
  body { padding-bottom: 0; }
  .shell { padding-bottom: calc(58px + var(--safe-bottom)); height: 100dvh; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-name { font-size: 15px; }
  .tabs { margin-left: auto; }
  .tab { padding: 6px 9px; font-size: 11.5px; }
  .icon-btn { width: 32px; height: 32px; }

  .feed { display: block; padding: 0 0 10px; gap: 0; scroll-snap-type: none; }
  .feed-card {
    margin: 0 0 8px; border: 0; border-radius: 0; box-shadow: none;
    border-left: 0; border-right: 0;
  }
  .media-frame { aspect-ratio: 4 / 3; max-height: 260px; }
  .headline { font-size: 20px; line-height: 1.28; -webkit-line-clamp: 3; padding: 14px 16px 0; }
  .summary { font-size: 14.5px; line-height: 1.62; -webkit-line-clamp: 4; padding: 8px 16px 0; }
  .meta { padding: 10px 16px; }
  .toolbar { padding: 12px 16px 10px; gap: 6px; }
  .tool-btn { min-height: 34px; font-size: 11px; padding: 6px 9px; }
  .bottom-nav { padding-bottom: calc(6px + var(--safe-bottom)); }
}

/* ---------- one-story-at-a-time snap feed ---------- */
.feed {
  display: block !important;
  padding: 0 !important;
  gap: 0 !important;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.feed-card {
  height: calc(100dvh - var(--header-h) - 58px - var(--safe-top) - var(--safe-bottom)) !important;
  min-height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.media-frame {
  flex: 1 1 auto;
  min-height: 150px;
  aspect-ratio: auto !important;
  max-height: none !important;
}
.media-frame img, .media-frame iframe { height: 100%; object-fit: cover; }
.headline { padding: 14px 16px 0; font-size: clamp(19px, 5.4vw, 24px); line-height: 1.26; -webkit-line-clamp: 3; }
.summary { padding: 8px 16px 0; font-size: clamp(14px, 3.9vw, 16px); line-height: 1.62; -webkit-line-clamp: 4; }
.meta { padding: 10px 16px; }
.toolbar { padding: 12px 16px 6px; flex: 0 0 auto; }
.sentinel { height: 1px; padding: 0; }

@media (min-width: 768px) {
  .feed-card {
    width: min(100%, 760px);
    margin: 0 auto !important;
    height: calc(100dvh - var(--header-h) - 40px) !important;
    border-left: 1px solid var(--line) !important;
    border-right: 1px solid var(--line) !important;
  }
  .toolbar { padding-bottom: 10px; }
}

.seen-label {
  margin-left: auto; background: #f2f4f7; color: #667085; border-radius: 5px;
  padding: 2px 6px; font-size: 10px; font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  /* Keep the editorial light theme deliberately; do not auto-invert. */
}

/* =========================================================
   DESKTOP EDITORIAL LISTING + ARTICLE (final correction)
   Scoped to min-width:768px only. Mobile is untouched.
   ========================================================= */
@media (min-width: 768px) {
  :root { --header-h: 64px; }

  html, body { background: #ffffff; }
  .shell { position: relative; padding-bottom: 0 !important; height: auto; min-height: 100dvh; }

  .topbar {
    height: var(--header-h);
    flex-basis: var(--header-h);
    padding: 0 clamp(24px, 4vw, 56px);
    background: #ffffff;
    border-bottom: 1px solid #e9edf2;
  }
  .topbar .tabs,
  .topbar .icon-btn,
  .topbar .top-action,
  .topbar .brand-tag { display: none !important; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
  .brand-name { font-size: 18px; letter-spacing: -.02em; }

  /* Desktop feed: genuine editorial listing grid. */
  .feed {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px 28px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 36px clamp(24px, 4vw, 56px) 64px !important;
    height: auto !important;
    align-content: start;
    scroll-snap-type: none !important;
    background: #ffffff;
  }
  .feed-card {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0 20px !important;
    border: 0 !important;
    border-bottom: 1px solid #e9edf2 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column;
    gap: 0;
    scroll-snap-align: none !important;
  }
  .media-frame {
    flex: 0 0 auto !important;
    aspect-ratio: 16 / 9 !important;
    max-height: none !important;
    min-height: 0 !important;
    border-radius: 8px;
    background: #f2f4f7;
  }
  .media-frame img, .media-frame iframe { width: 100%; height: 100%; object-fit: cover; }
  .source-badge { top: 12px; left: 12px; padding: 5px 8px; font-size: 10px; }
  .category-chip { left: 12px; bottom: 12px; font-size: 10px; padding: 5px 8px; }
  .media-badge { right: 12px; bottom: 12px; font-size: 9px; }

  .headline {
    padding: 16px 0 0 !important;
    font-size: 22px !important;
    line-height: 1.3 !important;
    letter-spacing: -.025em;
    -webkit-line-clamp: 2;
    color: #101828;
  }
  .summary {
    padding: 10px 0 0 !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    -webkit-line-clamp: 3;
    color: #475467;
  }
  .meta {
    padding: 12px 0 0 !important;
    border: 0 !important;
    font-size: 12px;
    color: #667085;
  }
  .seen-label { font-size: 10px; padding: 2px 7px; }

  .toolbar {
    justify-content: flex-start !important;
    gap: 14px !important;
    padding: 12px 0 0 !important;
    border: 0 !important;
    margin-top: auto !important;
  }
  .toolbar .tool-btn:not([data-action="share"]) { display: none !important; }
  .toolbar .tool-btn[data-action="share"] {
    flex: 0 0 auto;
    flex-direction: row;
    min-height: 36px;
    padding: 0 12px;
    gap: 7px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    color: #344054;
    font-size: 12px;
  }
  .toolbar .tool-btn[data-action="share"]:hover { background: #f8fafc; color: #101828; }
  .toolbar .tool-btn[data-action="share"] svg { width: 16px; height: 16px; }
  .toolbar .tool-btn[data-action="share"] span { font-size: 12px; }

  .new-stories-pill { top: calc(var(--header-h) + 14px); }
  .sentinel { height: 1px; padding: 0; grid-column: 1 / -1; }

  /* Desktop article: share lives in the main header row, no empty second row. */
  .detail-header {
    position: absolute !important;
    top: 0;
    right: clamp(24px, 4vw, 56px);
    height: var(--header-h);
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    z-index: 30;
  }
  .detail-header .icon-btn:not([data-action="share"]) { display: none !important; }
  .detail-header .icon-btn[data-action="share"] {
    width: auto;
    height: 38px;
    margin: 0;
    padding: 0 14px;
    display: inline-flex;
    flex-direction: row;
    gap: 8px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    color: #344054;
    background: #ffffff;
  }
  .detail-header .icon-btn[data-action="share"]::after {
    content: "Share";
    font-size: 12px;
    font-weight: 650;
  }
  .detail-header .icon-btn[data-action="share"] svg { width: 16px; height: 16px; }

  .detail-wrap {
    max-width: 960px !important;
    width: 100%;
    margin: 0 auto !important;
    padding: 28px clamp(24px, 4vw, 56px) 64px !important;
    background: #ffffff !important;
    overflow: visible !important;
  }
  .detail-hero {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    aspect-ratio: 16 / 9 !important;
    max-height: none !important;
    border-radius: 8px !important;
  }
  .detail-body {
    width: 100% !important;
    max-width: none !important;
    padding-top: 28px !important;
  }
  .detail-body .category-chip {
    position: static;
    display: inline-block;
    background: #eff4ff;
    color: var(--brand);
    box-shadow: none;
    margin: 0 0 16px;
  }
  .detail-body h1 {
    font-size: clamp(32px, 3vw, 44px) !important;
    line-height: 1.16 !important;
    letter-spacing: -.035em;
    color: #101828;
  }
  .detail-meta { font-size: 13px; gap: 18px; margin-bottom: 28px; color: #667085; }
  .detail-summary { font-size: 18px; line-height: 1.8; color: #344054; }
  .detail-read { margin-top: 28px; max-width: none; display: inline-flex; }
  .detail-body .actions { display: none !important; }
}

/* =========================================================
   DESKTOP-ONLY EDITORIAL REDESIGN
   All rules below are inside min-width:768px.
   Mobile (<768px) is intentionally untouched.
   ========================================================= */
@media (min-width: 768px) {
  :root { --header-h: 64px; }

  html, body { background: #ffffff; }

  /* Minimal desktop header: logo only. */
  .topbar {
    height: var(--header-h);
    flex-basis: var(--header-h);
    padding: 0 32px;
    background: #ffffff;
    border-bottom: 1px solid #e9edf2;
  }
  .topbar .tabs,
  .topbar .icon-btn,
  .topbar .top-action,
  .topbar .brand-tag { display: none !important; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
  .brand-name { font-size: 18px; letter-spacing: -.02em; }

  .shell { padding-bottom: 0 !important; height: 100dvh; }
  .bottom-nav { display: none !important; }

  /* Centered editorial story column. */
  .feed {
    display: block !important;
    padding: 0 !important;
    background: #ffffff;
    scroll-snap-type: y mandatory;
  }
  .feed-card {
    width: min(100%, 900px) !important;
    margin: 0 auto !important;
    height: calc(100dvh - var(--header-h)) !important;
    padding: 28px 40px 24px !important;
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff;
    gap: 0;
    justify-content: flex-start;
  }
  .media-frame {
    flex: 1 1 auto !important;
    aspect-ratio: auto !important;
    max-height: none !important;
    min-height: 220px;
    border-radius: 12px;
    background: #f2f4f7;
  }
  .media-frame img, .media-frame iframe { width: 100%; height: 100%; object-fit: cover; }
  .placeholder-media .media-glyph,
  .image-media.image-failed::before { font-size: 44px; }
  .source-badge { top: 14px; left: 14px; padding: 6px 9px; font-size: 11px; background: rgba(255,255,255,.96); }
  .category-chip { left: 14px; bottom: 14px; padding: 6px 10px; font-size: 11px; }
  .media-badge { right: 14px; bottom: 14px; font-size: 10px; }

  .headline {
    padding: 24px 0 0 !important;
    font-size: clamp(28px, 2.6vw, 40px) !important;
    line-height: 1.18 !important;
    letter-spacing: -.035em;
    -webkit-line-clamp: 2;
    color: #101828;
  }
  .summary {
    padding: 16px 0 0 !important;
    font-size: 17px !important;
    line-height: 1.75 !important;
    -webkit-line-clamp: 4;
    color: #475467;
    max-width: 760px;
  }
  .meta {
    padding: 18px 0 !important;
    border-top: 1px solid #eef1f5 !important;
    border-bottom: 1px solid #eef1f5 !important;
    font-size: 13px;
    color: #667085;
  }
  .seen-label { font-size: 11px; padding: 3px 8px; }

  /* Desktop toolbar: Share only. */
  .toolbar {
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 16px 0 0 !important;
    border: 0 !important;
    margin-top: 0 !important;
  }
  .toolbar .tool-btn:not([data-action="share"]) { display: none !important; }
  .toolbar .tool-btn[data-action="share"] {
    flex: 0 0 auto;
    flex-direction: row;
    min-height: 42px;
    padding: 0 18px;
    gap: 8px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    color: #344054;
    font-size: 13px;
  }
  .toolbar .tool-btn[data-action="share"]:hover { background: #f8fafc; color: #101828; }
  .toolbar .tool-btn[data-action="share"] svg { width: 17px; height: 17px; }
  .toolbar .tool-btn[data-action="share"] span { font-size: 13px; }

  .new-stories-pill { top: calc(var(--header-h) + 16px); }
  .sentinel { height: 1px; padding: 0; }

  /* Desktop article detail: editorial reading layout. */
  .detail-header {
    margin: 0 !important;
    padding: 14px 40px !important;
    height: auto;
    background: #ffffff;
    border-bottom: 1px solid #eef1f5;
  }
  .detail-header .icon-btn:not([data-action="share"]) { display: none !important; }
  .detail-header .icon-btn[data-action="share"] {
    width: auto;
    height: 42px;
    margin-left: auto;
    padding: 0 16px;
    display: inline-flex;
    flex-direction: row;
    gap: 8px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    color: #344054;
  }
  .detail-header .icon-btn[data-action="share"]::after {
    content: "Share";
    font-size: 13px;
    font-weight: 650;
  }
  .detail-header .icon-btn[data-action="share"] svg { width: 17px; height: 17px; }

  .detail-wrap { padding: 0 40px 40px !important; background: #ffffff; }
  .detail-hero {
    width: min(100%, 900px) !important;
    margin: 24px auto 0 !important;
    aspect-ratio: 16 / 9 !important;
    max-height: 58vh;
    border-radius: 12px;
  }
  .detail-body { width: min(100%, 760px) !important; padding-top: 30px; }
  .detail-body .category-chip {
    position: static;
    display: inline-block;
    background: #eff4ff;
    color: var(--brand);
    box-shadow: none;
    margin-bottom: 16px;
  }
  .detail-body h1 {
    font-size: clamp(30px, 2.8vw, 44px) !important;
    line-height: 1.16 !important;
    letter-spacing: -.035em;
    color: #101828;
  }
  .detail-meta { font-size: 13px; gap: 18px; margin-bottom: 28px; color: #667085; }
  .detail-summary { font-size: 18px; line-height: 1.8; color: #344054; }
  .detail-read { max-width: 280px; }
  .detail-body .actions { display: none !important; }
}

/* Desktop headline must never be clipped. Mobile rules remain untouched. */
@media (min-width: 768px) {
  .feed-card .headline {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    white-space: normal !important;
  }
}

/* Desktop-only brand spelling, copyright footer and content clearance. */
@media (min-width: 768px) {
  :root { --desktop-footer-h: 38px; }

  body { padding-bottom: var(--desktop-footer-h); }

  body::after {
    content: "Product of Larxius Technologies LLP  ·  © 2026 Larxius Technologies LLP. All rights reserved.";
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--desktop-footer-h);
    display: flex; align-items: center; justify-content: center;
    background: #ffffff;
    border-top: 1px solid var(--line);
    color: #667085;
    font-size: 11px;
    letter-spacing: .01em;
    z-index: 60;
  }

  .brand-name { font-size: 0 !important; }
  .brand-name::after {
    content: "LarFeed";
    font-size: 18px;
    letter-spacing: -.02em;
  }

  .feed-card { height: calc(100dvh - var(--header-h) - var(--desktop-footer-h)) !important; }
  .detail-wrap { padding-bottom: 90px !important; }
}

/* ---------- complete summary + direct publisher action ---------- */
.feed-card .summary {
  display: block !important;
  -webkit-line-clamp: unset !important;
  overflow: visible !important;
  white-space: normal !important;
}
.feed-card {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.feed-card .summary { padding-bottom: 2px; }

.read-story {
  flex: 0 0 auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 16px 0;
  padding: 9px 13px;
  min-height: 38px;
  border: 1px solid #c7d7fe;
  border-radius: 9px;
  background: #eff4ff;
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 750;
}
.read-story:hover { background: #e4ecff; }
.read-story:active { transform: scale(.98); }

@media (min-width: 768px) {
  .read-story { display: none !important; }
}

@media (max-width: 767px) {
  .media-frame { flex: 0 0 auto !important; aspect-ratio: 4 / 3 !important; max-height: none !important; min-height: 0 !important; }
  .feed-card { padding-bottom: 10px; }
  .headline { cursor: default !important; }
  .headline:hover { color: var(--ink) !important; }
  .media { cursor: default !important; }
}

/* ---------- server-side search results ---------- */
.search-status { font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.suggest-chip {
  border: 0; background: #eff4ff; color: var(--brand); border-radius: 6px;
  padding: 2px 7px; font-weight: 750; font-size: 12px; cursor: pointer;
}
.search-result {
  display: flex; gap: 12px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.search-result > img {
  width: 92px; height: 72px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: #f2f4f7;
}
.search-result-body { flex: 1; min-width: 0; }
.search-result-meta { font-size: 11px; color: var(--muted); }
.search-result h3 { font-size: 15px; line-height: 1.32; margin: 4px 0 5px; }
.search-result p {
  font-size: 13px; line-height: 1.5; color: #475467; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-read { margin: 8px 0 0; padding: 6px 10px; min-height: 30px; font-size: 11px; }

/* FINAL DESKTOP-ONLY FEED REPAIR - later than all previous desktop blocks. */
@media (min-width: 768px) {
  html, body { overflow-y: auto; }
  body { padding-bottom: var(--desktop-footer-h); }

  .shell {
    height: 100dvh;
    min-height: 100dvh;
    padding-bottom: 0 !important;
  }

  .feed {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 32px clamp(24px, 4vw, 56px) 56px !important;
    height: auto !important;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-snap-type: none !important;
    background: #ffffff !important;
  }

  .feed-card {
    width: auto !important;
    height: auto !important;
    min-height: fit-content !important;
    margin: 0 !important;
    padding: 0 0 18px !important;
    border: 0 !important;
    border-bottom: 1px solid #e9edf2 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column;
    scroll-snap-align: none !important;
    overflow: visible !important;
  }

  .media-frame {
    flex: 0 0 auto !important;
    aspect-ratio: 16 / 9 !important;
    max-height: none !important;
    min-height: 0 !important;
    width: 100%;
    border-radius: 8px;
    background: #f2f4f7;
    overflow: hidden;
  }
  .media-frame img, .media-frame iframe {
    width: 100%; height: 100%; object-fit: cover; display: block;
  }

  .headline {
    padding: 14px 0 0 !important;
    font-size: clamp(21px, 1.9vw, 28px) !important;
    line-height: 1.25 !important;
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
  }
  .summary {
    padding: 10px 0 0 !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
  }
  .meta { padding: 12px 0 0 !important; border: 0 !important; font-size: 12px; }
  .toolbar { padding: 12px 0 0 !important; margin-top: 0 !important; border: 0 !important; }
  .read-story { display: none !important; }
}

/* DESKTOP FEED FINAL REPAIR - three-column editorial grid, no overlap. */
@media (min-width: 768px) {
  html, body { overflow-y: auto; }
  body { padding-bottom: 0; }

  body::after {
    position: static;
    display: block;
    height: auto;
    padding: 14px 32px;
    text-align: center;
    border-top: 1px solid var(--line);
    background: #ffffff;
  }

  .shell { height: auto !important; min-height: 100dvh; padding-bottom: 0 !important; }

  .feed {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: max-content !important;
    align-content: start !important;
    gap: 28px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 32px 48px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
    background: #ffffff !important;
  }

  .feed-card {
    position: relative !important;
    align-self: start !important;
    height: max-content !important;
    min-height: max-content !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    scroll-snap-align: none !important;
  }

  .media-frame {
    position: relative !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 0 !important;
    background: #f2f4f7 !important;
    overflow: hidden !important;
  }
  .media-frame img, .media-frame iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }

  .source-badge {
    position: absolute !important;
    top: 10px !important; left: 10px !important;
    right: auto !important; bottom: auto !important;
    max-width: calc(100% - 20px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 3 !important;
  }
  .category-chip {
    position: absolute !important;
    left: 10px !important; bottom: 10px !important;
    right: auto !important; top: auto !important;
    max-width: calc(100% - 20px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 3 !important;
  }
  .media-badge {
    position: absolute !important;
    right: 10px !important; bottom: 10px !important;
    left: auto !important; top: auto !important;
    max-width: 52% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 3 !important;
  }

  .headline {
    position: static !important;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    padding: 16px 16px 0 !important;
    font-size: 22px !important;
    line-height: 1.3 !important;
  }
  .summary {
    position: static !important;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    padding: 10px 16px 0 !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
  }
  .meta { padding: 12px 16px !important; border: 0 !important; font-size: 12px; }
  .toolbar { padding: 10px 16px 16px !important; margin-top: auto !important; border: 0 !important; }
  .read-story { display: none !important; }
}

/* FINAL DESKTOP LAYOUT - one editorial article per row, normal page scrolling. */
@media (min-width: 768px) {
  html, body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: visible !important;
    overscroll-behavior-y: auto;
  }
  body { padding-bottom: 0 !important; }

  body::after {
    position: static !important;
    display: block !important;
    height: auto !important;
    padding: 14px 32px !important;
    border-top: 1px solid var(--line);
    background: #ffffff;
    text-align: center;
  }

  .shell { height: auto !important; min-height: 100dvh; padding-bottom: 0 !important; }

  .feed {
    display: block !important;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 32px 56px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
    background: #ffffff !important;
  }

  .feed-card {
    display: grid !important;
    grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
    grid-template-areas:
      "media headline"
      "media summary"
      "media read"
      "media meta"
      "media toolbar";
    grid-template-rows: auto 1fr auto auto auto;
    column-gap: 28px;
    row-gap: 0;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0 24px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    overflow: visible !important;
    transform: none !important;
    scroll-snap-align: none !important;
  }

  .media-frame {
    grid-area: media;
    display: grid !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 300px;
    aspect-ratio: auto !important;
    max-height: none !important;
    border-radius: 12px !important;
    background: #f2f4f7 !important;
    overflow: hidden !important;
    align-self: stretch;
  }
  .media-frame > * { grid-area: 1 / 1; }
  .media-frame img, .media-frame iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }

  .source-badge {
    position: static !important;
    align-self: start; justify-self: start;
    margin: 12px; max-width: calc(100% - 24px) !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
  }
  .category-chip {
    position: static !important;
    align-self: end; justify-self: start;
    margin: 12px; max-width: calc(100% - 24px) !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
  }
  .media-badge {
    position: static !important;
    align-self: end; justify-self: end;
    margin: 12px; max-width: 52% !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
  }

  .headline {
    grid-area: headline;
    position: static !important;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    margin: 0; padding: 0 !important;
    font-size: clamp(26px, 2.2vw, 34px) !important;
    line-height: 1.18 !important;
    letter-spacing: -.03em;
    color: var(--ink);
    cursor: pointer;
  }
  .summary {
    grid-area: summary;
    position: static !important;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    margin: 12px 0 0; padding: 0 !important;
    font-size: 16px !important;
    line-height: 1.7 !important;
    color: #475467;
    cursor: pointer;
  }
  .read-story { grid-area: read; display: none !important; }
  .meta {
    grid-area: meta;
    margin: 16px 0 0; padding: 0 !important;
    border: 0 !important; font-size: 13px; color: var(--muted);
  }
  .toolbar {
    grid-area: toolbar;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin: 14px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .tool-btn[data-action="share"] {
    flex: 0 0 auto;
    flex-direction: row;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    min-height: 38px;
  }
  .headline:hover { color: var(--brand) !important; }
  .media-frame { cursor: pointer; }

  /* Desktop: proper image/text gap and Share + Read More side by side. */
  .feed-card { column-gap: clamp(28px, 3vw, 48px) !important; }
  .toolbar .tool-btn.read-btn { display: inline-flex !important; }
  .tool-btn[data-action="share"], .tool-btn.read-btn {
    flex: 0 0 auto;
    flex-direction: row;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }
  .tool-btn.read-btn { color: var(--brand); border-color: #c7d7fe; }
}

/* Mobile feed polish: hide the scrollbar, contain media, and prevent headline clipping. */
@media (max-width: 767px) {
  body { min-height: 100dvh; overflow: hidden; }
  #app {
    display: flex; flex-direction: column;
    width: 100%; height: calc(100dvh - var(--safe-top)); min-height: 0;
    background: #fff;
  }
  .shell {
    display: flex !important; flex-direction: column !important;
    height: 100% !important; min-height: 0 !important;
  }
  .feed {
    flex: 1 1 0% !important; height: auto !important; min-height: 0 !important;
    overflow-x: hidden !important; overflow-y: auto !important;
    touch-action: pan-y; overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .feed-card { height: 100% !important; }
  .onboarding, .interests-setup {
    flex: 1 1 auto !important; width: 100%; min-height: 100%;
    overflow-y: auto; overscroll-behavior-y: contain;
    background: #fff !important;
  }
  .interests-setup {
    justify-content: center !important;
    padding-top: max(28px, var(--safe-top)) !important;
    padding-bottom: calc(32px + var(--safe-bottom)) !important;
  }
  html, body, .shell, .feed, .feed-card { scrollbar-width: none !important; }
  html::-webkit-scrollbar, body::-webkit-scrollbar, .shell::-webkit-scrollbar,
  .feed::-webkit-scrollbar, .feed-card::-webkit-scrollbar {
    display: none !important; width: 0 !important; height: 0 !important;
  }
  .feed { width: 100% !important; }
  .feed-card {
    min-width: 0 !important; width: 100% !important;
    overflow: hidden !important;
    padding: 0 0 calc(10px + var(--safe-bottom)) !important;
  }
  .media-frame {
    flex: 1 1 auto !important; aspect-ratio: auto !important;
    min-height: 160px !important; max-height: 40dvh !important;
    width: 100% !important; margin-left: 0 !important; margin-right: 0 !important;
    overflow: hidden !important; background: #eef1f5 !important;
  }
  .media-frame img, .media-frame video {
    width: 100% !important; height: 100% !important;
    object-fit: cover !important; object-position: center center !important;
  }
  .headline {
    display: -webkit-box !important; -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important; overflow: hidden !important;
  }
  .summary {
    display: -webkit-box !important; -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 4 !important; overflow: hidden !important;
    line-height: 1.5 !important;
  }
  .toolbar { flex: 0 0 auto !important; margin-bottom: 0 !important; padding-bottom: 8px !important; }
  .headline {
    height: auto !important; max-height: none !important;
    line-height: 1.35 !important; padding-bottom: 3px !important;
  }
}

/* Consistent separation between desktop article content and row dividers. */
@media (min-width: 768px) {
  .feed-card {
    column-gap: clamp(36px, 4vw, 56px) !important;
    padding-top: 16px !important;
    padding-bottom: 32px !important;
    margin-bottom: 12px !important;
  }
}
@media (max-width: 767px) {
  .read-story {
    min-height: 42px !important; margin: 12px 16px 0 !important;
    padding: 8px 12px !important; border: 1px solid #c7d7fe !important;
    border-radius: 8px !important; background: #fff !important;
    color: #1d4ed8 !important; box-shadow: none !important;
    display: inline-flex !important; align-items: center !important;
    justify-content: center !important; gap: 7px !important;
    font-size: 13px !important; font-weight: 750 !important;
  }
  .read-story svg {
    width: 15px !important; height: 15px !important; flex: 0 0 auto;
    stroke: currentColor !important; fill: none !important; stroke-width: 1.8 !important;
    transform: translateY(1px);
  }
  .read-story span { margin: 0; font-size: inherit; }
  .read-story:hover, .read-story:active { background: #eff4ff !important; transform: none; }

  /* Search results only: align Read Full Story under the result content. */
  .search-result .read-story.search-read {
    margin: 10px 0 0 !important;
    justify-content: flex-start !important;
    align-self: flex-start !important;
    width: max-content !important;
    max-width: 100% !important;
  }
}


/* Social sign-in options (account page and the personalized-feed prompt). */
.signin-options { display: grid; gap: 9px; margin: 14px 0 10px; }
.signin-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-weight: 650; cursor: pointer;
}
.signin-btn:hover, .signin-btn:active { background: var(--surface-2); }
.provider-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%; color: #fff; font-size: 13px; font-weight: 800;
}
.provider-mark.google { background: #ea4335; }
.provider-mark.microsoft { background: #00a4ef; }
.provider-mark.github { background: #111827; font-size: 10px; }
.provider-mark.facebook { background: #1877f2; }
.auth-divider {
  text-align: center; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 10px;
}
.signin-card .category-chip { margin-bottom: 10px; }
.signin-card .signin-options { margin-top: 16px; }
.signin-card .read-story { margin-top: 4px; }

/* Account access: focused email/password form with a single Google option. */
.auth-page {
  box-sizing: border-box;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(28px, 7vh, 72px) 20px 40px;
  background: #f7f8fc;
}
.auth-card {
  box-sizing: border-box;
  width: min(100%, 440px);
  padding: 32px;
  border: 1px solid #e3e7ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .08);
}
.auth-brand-mark {
  display: grid; place-items: center;
  width: 88px; height: 74px; margin-bottom: 20px;
  overflow: visible; border-radius: 0; background: transparent;
}
.auth-brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 767px) {
  .brand-mark { width: 52px !important; height: 46px !important; }
  .auth-brand-mark { width: 78px; height: 66px; }
}
.auth-card h1 { margin: 0; font-size: 26px; line-height: 1.25; color: var(--ink); }
.auth-subtitle { margin: 8px 0 22px; color: var(--muted); line-height: 1.55; }
.auth-mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin: 0 0 16px; border-radius: 11px; background: #f1f3f8;
}
.auth-mode {
  min-height: 40px; border: 0; border-radius: 8px; background: transparent;
  color: #667085; font: inherit; font-weight: 650; cursor: pointer;
}
.auth-mode.active { background: #fff; color: #244fe2; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
.signin-options { margin: 0; }
.signin-btn.google-signin { min-height: 48px; border-radius: 9px; }
.google-g { width: 19px; height: 19px; flex: 0 0 auto; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: #e6e9ef; }
.auth-form { display: grid; gap: 9px; }
.auth-form label { margin-top: 3px; color: #344054; font-size: 13px; font-weight: 650; }
.auth-form input {
  box-sizing: border-box; width: 100%; min-height: 46px; padding: 11px 13px;
  border: 1px solid #d0d5dd; border-radius: 9px; background: #fff; color: var(--ink);
  font: inherit; outline: none;
}
.auth-form input:focus { border-color: #5275f4; box-shadow: 0 0 0 3px rgba(36, 79, 226, .12); }
.auth-password-hint { margin-top: -3px; color: var(--muted); font-size: 12px; }
.auth-error { padding: 10px 12px; border-radius: 9px; font-size: 13px; line-height: 1.45; }
.auth-error.is-loading { background: #eff4ff; color: #244fe2; }
.auth-error.is-error { border: 1px solid #fecdca; background: #fef3f2; color: #b42318; }
.auth-submit:disabled { cursor: wait; opacity: .78; }
.auth-submit.is-cooldown:disabled { cursor: not-allowed; opacity: .52; filter: blur(.35px); box-shadow: none; }
.auth-submit {
  width: 100%; min-height: 46px; margin-top: 8px; padding: 10px 16px;
  border: 0; border-radius: 9px; background: #244fe2; color: #fff;
  font: inherit; font-weight: 700; cursor: pointer;
}
.auth-submit:hover { background: #1c43ca; }
.onboarding-account {
  box-sizing: border-box;
  display: flex; flex: 1 1 auto; align-items: center; justify-content: center;
  width: 100%; min-height: 100dvh; padding: 28px 16px;
  overflow-y: auto; background: #f7f8fc;
}
.onboarding-account .auth-card { margin: auto; }
.onboarding-skip {
  display: block; margin: 16px auto 0; padding: 8px 12px;
  border: 0; background: transparent; color: #667085;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.onboarding-skip:hover { color: #244fe2; }
@media (max-width: 767px) {
  .auth-page { place-items: start center; padding: 24px 16px; }
  .auth-card { padding: 24px 20px; border-radius: 15px; box-shadow: 0 8px 24px rgba(16, 24, 40, .07); }
  .onboarding-account { align-items: flex-start; padding: 20px 16px; }
}

/* Mobile story headlines must remain fully readable, including longer titles. */
@media (max-width: 767px) {
  .feed-card {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  .feed-card .headline,
  .headline {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
    line-height: 1.32 !important;
    padding-bottom: 5px !important;
    overflow-wrap: anywhere;
  }
}

/* Signed-in account and saved-story library. */
.account-page, .saved-page {
  box-sizing: border-box;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: clamp(26px, 5vh, 52px) 24px 48px;
}
.account-page { display: flex; flex-direction: column; gap: 18px; }
.account-heading h1, .saved-page-heading h1 { margin: 5px 0 6px; color: var(--ink); font-size: 28px; line-height: 1.2; }
.account-heading p, .saved-page-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.account-eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.account-profile-card {
  display: flex; align-items: center; gap: 15px; min-width: 0; padding: 18px;
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
  box-shadow: 0 5px 18px rgba(16, 24, 40, .04);
}
.account-avatar {
  display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 50%; background: #eef2ff; color: var(--brand); font-size: 21px; font-weight: 750;
}
.account-profile-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.account-profile-copy strong { color: var(--ink); overflow-wrap: anywhere; }
.account-profile-copy small { color: var(--muted); line-height: 1.4; }
.account-profile-status { display: flex; align-items: center; gap: 6px; color: #16834a; font-size: 12px; font-weight: 650; }
.account-profile-status i { width: 7px; height: 7px; border-radius: 50%; background: #22a565; }
.account-menu { display: grid; gap: 10px; }
.account-menu-item {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 72px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 13px; background: #fff; color: inherit; text-align: left; cursor: pointer;
}
.account-menu-item:hover { border-color: #bdcaff; background: #fbfcff; }
.account-menu-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; background: #f1f4ff; color: var(--brand); }
.account-menu-icon svg { width: 20px; height: 20px; }
.account-menu-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.account-menu-copy strong { color: var(--ink); font-size: 14px; }
.account-menu-copy small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.account-menu-arrow { color: #8a94a6; font-size: 25px; line-height: 1; }
.account-signout { align-self: flex-start; min-height: 42px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #475467; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.account-signout:hover { border-color: #f1b4b4; color: #b42318; background: #fffafa; }
.saved-page { width: min(100%, 900px); }
.saved-page-heading { margin-bottom: 22px; }
.saved-story-list { display: grid; gap: 12px; }
.saved-story { display: flex; gap: 16px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.saved-story-thumb { width: 150px; min-width: 150px; height: 112px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: #f1f3f7; color: var(--muted); }
.saved-story-thumb img { width: 100%; height: 100%; object-fit: cover; }
.saved-story-copy { min-width: 0; flex: 1; }
.saved-story-category { color: var(--brand); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.saved-story h2 { margin: 5px 0; color: var(--ink); font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.saved-story-meta { color: var(--muted); font-size: 12px; }
.saved-story-copy > p { margin: 7px 0 10px; color: #586477; font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.saved-story-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.saved-read-button, .saved-remove-button, .saved-browse-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #344054; font: inherit; font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.saved-read-button { border-color: #c7d2fe; color: var(--brand); }
.saved-read-button:hover { background: #f8faff; border-color: #9bb0ff; }
.saved-read-button svg, .saved-remove-button svg { display: block; width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.saved-remove-button { color: #596579; }
.saved-remove-button:hover { border-color: #f1b4b4; color: #b42318; background: #fffafa; }
.saved-empty { display: grid; justify-items: center; gap: 9px; padding: 42px 20px; border: 1px dashed #cfd5e2; border-radius: 15px; background: #fff; text-align: center; }
.saved-empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #f1f4ff; color: var(--brand); }
.saved-empty-icon svg { width: 22px; height: 22px; }
.saved-empty strong { color: var(--ink); font-size: 17px; }
.saved-empty p { margin: 0 0 5px; color: var(--muted); font-size: 13px; }
.saved-sync-note { margin: 0; padding: 10px 12px; border: 1px solid #f2d6a0; border-radius: 9px; background: #fffaeb; color: #7a4b10; font-size: 12px; line-height: 1.45; }
.saved-browse-button { background: var(--brand); border-color: var(--brand); color: #fff; padding-inline: 15px; }
.notifications-page { max-width: 760px; }
.notifications-heading { margin-bottom: 22px; }
.notifications-heading h1 { margin: 5px 0 6px; color: var(--ink); font-size: 28px; line-height: 1.2; }
.notifications-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.notification-list { display: grid; gap: 10px; }
.notification-item { padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.notification-item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.notification-item-top span { color: var(--brand); font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.notification-item h2 { margin: 7px 0 5px; color: var(--ink); font-size: 16px; line-height: 1.35; }
.notification-item p { margin: 0 0 11px; color: #586477; font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notification-read { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 11px; border: 1px solid #c7d2fe; border-radius: 9px; background: #fff; color: var(--brand); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.notification-read svg { display: block; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.notification-empty { display: grid; justify-items: center; gap: 9px; padding: 40px 20px; border: 1px dashed #cfd5e2; border-radius: 15px; background: #fff; text-align: center; }
.notification-empty strong { color: var(--ink); font-size: 17px; }
.notification-empty p { margin: 0 0 5px; color: var(--muted); font-size: 13px; }
@media (max-width: 767px) {
  .account-page, .saved-page { padding: 24px 16px 32px; }
  .account-heading h1, .saved-page-heading h1 { font-size: 25px; }
  .notifications-heading h1 { font-size: 25px; }
  .notification-item { padding: 13px; }
  .account-profile-card { padding: 15px; }
  .saved-story { gap: 11px; padding: 11px; }
  .saved-story-thumb { width: 88px; min-width: 88px; height: 82px; }
  .saved-story h2 { font-size: 15px; line-height: 1.32; }
  .saved-story-copy > p { font-size: 12px; }
  .saved-read-button, .saved-remove-button { min-height: 40px; padding: 7px 10px; gap: 6px; font-size: 12px; }
  .saved-read-button svg, .saved-remove-button svg { width: 16px; height: 16px; }
}
