:root {
  color-scheme: light;

  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1c1d22;
  --ink-soft: #6b6f76;
  --line: #ecebe6;
  --accent: #2f8f6b;
  --accent-soft: #e8f3ee;
  --accent-active: #266f53;
  --accent-disabled: #9ec9b9;
  --faint: #b0b4bb;
  --danger: #c0392b;
  --danger-ink: #a13f2e;
  --danger-bg: #fdf2f0;
  --media-bg: #dfe3e6;
  --press: #eee;
  --player-bg: #11131a;
  --player-ink: #9aa0a8;
  --switch-off: #d8d6cf;
  --btn-strong-bg: #1c1d22;
  --btn-strong-ink: #ffffff;
  --btn-strong-active: #3a3c44;
  --toast-action: #6fd3ab; /* bright mint — the Undo action on the dark toast pill (TASK-016) */

  --radius-card: 18px;
  --radius-btn: 11px;
}

/* Dark theme — applied via <html data-theme="dark">, which an inline <head>
   script sets before first paint from the stored choice or the OS preference.
   The setup-page toggle overrides it. Same variables, dark values. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #131419;
  --surface: #1c1e25;
  --ink: #e8e9ec;
  --ink-soft: #9498a1;
  --line: #2a2d36;
  --accent: #3fa37d;
  --accent-soft: #1b2f27;
  --accent-active: #4fb98f;
  --accent-disabled: #2f5346;
  --faint: #6b7079;
  --danger: #e06b5c;
  --danger-ink: #e59486;
  --danger-bg: #2a1a17;
  --media-bg: #23262e;
  --press: #262932;
  --player-bg: #0c0d12;
  --player-ink: #8b909a;
  --switch-off: #3a3d47;
  --btn-strong-bg: #e8e9ec;
  --btn-strong-ink: #131419;
  --btn-strong-active: #cfd2d8;
  --toast-action: #196049; /* deep green — Undo action on the light toast pill in dark mode (TASK-016) */
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain; /* our pull-to-refresh replaces the browser's */
}

/* ── Views ── */
.view { min-height: 100dvh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ── Setup ── */
/* Fixed-height app-shell: header + CTA stay pinned, only the channel list scrolls. (TASK-045) */
#view-setup { height: 100dvh; overflow: hidden; }

.setup-wrap {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 56px 24px 24px;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.setup-head { flex: 0 0 auto; }

/* The only scroll region in setup. min-height:0 lets it shrink and scroll inside the flex column. */
.setup-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.setup-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.setup-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }

.setup-sub {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 22px;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.add-form input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}

.add-form input:focus { border-color: var(--accent); }
.add-form input::placeholder { color: var(--faint); }

.add-form button {
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.add-form button:active { background: var(--accent-active); }
.add-form button:disabled { background: var(--accent-disabled); cursor: default; }

.add-hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 0 4px;
}
.add-hint b { color: var(--ink); font-weight: 600; }

.add-error {
  font-size: 13px;
  color: var(--danger);
  padding: 2px 4px;
}

.channel-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

/* TASK-032: shown when the active source tab has no channels/accounts yet. */
.channel-list-empty {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 8px 2px;
}

.channel-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
}

.channel-list-item .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.channel-list-item .info { flex: 1; min-width: 0; }
.channel-list-item .ch-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-list-item .ch-rule { font-size: 12px; color: var(--accent); margin-top: 2px; }
.channel-list-item .ch-rule-none { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.btn-remove {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.btn-remove:hover { color: var(--danger); }

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

.btn-edit {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: flex;
}
.btn-edit svg { width: 16px; height: 16px; }
.btn-edit:hover { color: var(--ink); }

/* ── Inline filter editor (expanded channel row) ── */
.channel-list-item.editing {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-color: var(--accent);
  overflow: hidden;
}

.ch-edit-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.ch-editing-label { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.btn-edit-close {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.btn-edit-close:hover { color: var(--ink); }

.ch-edit-body { padding: 14px; }

.ch-edit-actions { display: flex; gap: 8px; margin-top: 12px; }

.btn-edit-save {
  flex: 1;
  padding: 11px 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-edit-save:active { background: var(--accent-active); }

.btn-edit-cancel {
  padding: 11px 18px;
  background: none;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-edit-cancel:active { background: var(--press); }

.btn-go {
  flex: 0 0 auto;
  margin-top: 12px;
  width: 100%;
  padding: 15px;
  background: var(--btn-strong-bg);
  color: var(--btn-strong-ink);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-go:active { background: var(--btn-strong-active); }

/* ── Account / sign-in (TASK-025) ── one block, three states, at the foot of setup ── */
.acct-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.acct-title { font-size: 14px; font-weight: 600; }
.acct-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; margin: -4px 0 0; }
.acct-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 10px; padding: 11px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink);
  font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.acct-google:hover { background: var(--bg); }
.acct-google:active { background: var(--press); }
.acct-google svg { flex: 0 0 auto; }
.acct-or {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 2px; color: var(--faint); font-size: 12px;
}
.acct-or::before, .acct-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.acct-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.acct-input {
  width: 100%;
  padding: 12px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.acct-input:focus { border-color: var(--accent); }
.acct-input::placeholder { color: var(--faint); }

.acct-btn {
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.acct-btn:active { background: var(--accent-active); }
.acct-btn:disabled { background: var(--accent-disabled); cursor: default; }

.acct-msg { font-size: 12.5px; color: var(--danger-ink); margin: 0; }

/* link-sent */
.acct-sent-panel {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 12px 13px;
}
.acct-sent-panel svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.acct-sent-h { font-size: 13.5px; font-weight: 600; color: var(--accent-active); }
.acct-sent-p { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.45; }
.acct-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* signed-in */
.acct-who { display: flex; align-items: center; gap: 11px; }
.acct-avatar {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.acct-email { font-size: 14px; font-weight: 600; word-break: break-all; }
.acct-sync { font-size: 12px; color: var(--accent); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.acct-sync svg { width: 13px; height: 13px; }
.acct-btn-quiet {
  padding: 11px;
  background: transparent;
  color: var(--danger-ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.acct-btn-quiet:active { background: var(--danger-bg); }

/* ── App bar ── */
.appbar {
  padding: env(safe-area-inset-top, 16px) 20px 14px;
  padding-top: max(env(safe-area-inset-top, 0px), 16px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 8px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }

.appbar-sub {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.count { font-weight: 600; color: var(--ink); }

/* Right side of the feed sub-header: the "N new" count + the Mark-all-done action. (TASK-016) */
.sub-right { display: flex; align-items: baseline; gap: 14px; }
.btn-mark-all {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  padding: 0;
}
.btn-mark-all:active { color: var(--accent-active); }

/* ── Toast (TASK-016) ── reusable pill with one optional action; floats above the bottom nav. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 60; /* above the bottom nav (50) */
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  background: var(--btn-strong-bg);
  color: var(--btn-strong-ink);
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-action {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--toast-action);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px;
}

/* ── Feed load error ── */
.feed-error {
  max-width: 600px;
  width: calc(100% - 32px);
  margin: 12px auto 0;
  padding: 10px 16px;
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: 13px;
  line-height: 1.4;
  border-radius: 10px;
}

/* Informational skip-note (TASK-040) — softer than .feed-error: no alarm color, just muted text. */
.feed-note {
  max-width: 600px;
  width: calc(100% - 32px);
  margin: 12px auto 0;
  padding: 8px 16px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
}

/* ── Loading ── */
.loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Feed ── */
.feed {
  flex: 1;
  padding: 14px 16px 40px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px;
  margin-bottom: 14px;
  transition: opacity .3s ease, transform .3s ease;
}

.card.removing {
  opacity: 0;
  transform: translateX(40px) scale(.97);
  pointer-events: none;
}

.chan {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}

.avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chan-name { font-size: 13.5px; font-weight: 600; }
.chan-meta { font-size: 12px; color: var(--ink-soft); }

/* "New" badge: videos that arrived since the last feed load. Red dot + pill,
   top-right of the card header; margin-left:auto pushes it to the right. */
.new-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--danger-bg);
  color: var(--danger-ink);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.new-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}
/* ── Media / player ── */
.media {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 11px;
  position: relative;
  background: var(--media-bg);
  cursor: pointer;
}

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--media-bg);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn svg { width: 18px; height: 18px; margin-left: 2px; }

/* Playing state */
.media.playing .thumb { display: none; }

.player-wrap {
  display: none;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--player-bg);
}

.media.playing .player-wrap { display: block; }

.player-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}


/* ── Title + actions ── */
.video-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 12px;
}

/* Substack card body (TASK-022): the article headline links out; the subtitle is muted. */
.substack-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 5px;
}
.substack-title:hover { text-decoration: underline; }
.substack-sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-bottom: 12px;
}
.substack-link, .substack-link:hover { color: #ff6719; } /* Substack brand orange (overrides .tweet-x) */

/* Post cover image (TASK-058): a banner below the subtitle on the collapsed card, hidden on
   expand (the full article leads with the same image). Styled to match .tweet-media. */
.substack-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--media-bg);
  margin-bottom: 12px;
}
.substack-cover[hidden] { display: none; } /* display:block above would otherwise override [hidden] */

/* In-app reader (TASK-059): one preview paragraph, then "…read more" expands the full post. */
.substack-reader { margin-bottom: 12px; }
.substack-preview {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 8px;
}
.substack-more {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #ff6719; /* Substack brand orange */
  cursor: pointer;
}
.substack-more:hover { text-decoration: underline; }
.substack-more:disabled { opacity: 0.6; cursor: default; text-decoration: none; }

/* The expanded article. Sanitised server-side (api/_sanitize.js) to this small tag vocabulary. */
.substack-body { font-size: 14.5px; line-height: 1.62; color: var(--ink); }
.substack-body p { margin: 0 0 13px; }
.substack-body h1, .substack-body h2, .substack-body h3,
.substack-body h4, .substack-body h5, .substack-body h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 20px 0 8px;
}
.substack-body h1 { font-size: 19px; }
.substack-body h2 { font-size: 17px; }
.substack-body h3, .substack-body h4 { font-size: 15px; }
.substack-body a { color: var(--accent); text-decoration: underline; }
.substack-body img { max-width: 100%; height: auto; display: block; border-radius: 6px; }
.substack-body figure { margin: 14px 0; }
.substack-body figcaption {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 5px;
}
.substack-body blockquote {
  margin: 14px 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
}
.substack-body ul, .substack-body ol { margin: 0 0 13px; padding-left: 22px; }
.substack-body li { margin: 4px 0; }
.substack-body hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.substack-body pre {
  overflow-x: auto;
  background: var(--accent-soft);
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0 0 13px;
}
.substack-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.substack-readout {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.substack-readout-link a { color: #ff6719; font-weight: 600; text-decoration: none; }
.substack-readout-link a:hover { text-decoration: underline; }

.actions { display: flex; gap: 9px; align-items: center; }

.btn-done {
  flex: 1;
  border: none;
  border-radius: var(--radius-btn);
  padding: 11px 0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  transition: background .15s;
}

.btn-done:active { background: var(--accent-active); }

.btn-done svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Archive ("save for later") — secondary action beside the primary Done (TASK-008) */
.btn-archive {
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--ink-soft);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-archive:active { background: var(--press); color: var(--ink); }
.btn-archive svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Bottom nav — Feed / Archive (TASK-008). Fixed to the bottom on the feed-side views. */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.nav-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s;
}
.nav-tab svg { width: 22px; height: 22px; }
.nav-tab.is-active { color: var(--accent); }

/* Archive empty state (TASK-008) */
.archive-empty { text-align: center; padding: 60px 28px; color: var(--ink-soft); }
.archive-empty h2 { font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.archive-empty p { font-size: 14px; line-height: 1.5; }

/* Caught-up → Archive nudge link (TASK-008) */
.archive-nudge {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  margin-bottom: 4px;
}

/* ── Caught-up ── */
.caughtup {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 36px 60px;
}

.seal {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.seal svg { width: 44px; height: 44px; }

.caughtup h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
  margin-bottom: 10px;
}

.caughtup p {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 260px;
}

.btn-manage {
  margin-top: 32px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-manage:active { background: var(--press); }

/* ── Feed app bar manage button ── */
.btn-feed-manage {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 26px;
  font-weight: 500;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.btn-feed-manage:active { color: var(--ink); }

/* ── Confirm card (resolve → confirm before add) ── */
.add-confirm { margin-bottom: 28px; }

.confirm-label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.confirm-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 13px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.confirm-card .avatar {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.confirm-info { flex: 1; min-width: 0; }
.confirm-name { font-size: 14px; font-weight: 600; }
.confirm-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.confirm-actions { display: flex; gap: 8px; }

.btn-confirm-add {
  flex: 1;
  padding: 11px 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-confirm-add:active { background: var(--accent-active); }

.btn-confirm-cancel {
  padding: 11px 18px;
  background: none;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-confirm-cancel:active { background: var(--press); }

/* ── Alternatives (pick a different search match) ── */
.btn-show-alternatives {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  margin-bottom: 10px;
}

.confirm-alternatives {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.alt-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.alt-item:active { background: var(--bg); }
.alt-item:hover { border-color: var(--accent); }

.alt-item .avatar { width: 34px; height: 34px; font-size: 14px; }

.alt-info { flex: 1; min-width: 0; }
.alt-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alt-note { font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }

.alt-added { cursor: default; opacity: .55; }
.alt-added:hover { border-color: var(--line); }

/* Keyword filter now lives in the confirm step (pick channel, then filter) */
.confirm-keyword { margin-bottom: 14px; }

/* Keyword filter chips input (TASK-044) — used in the add flow (#keyword-chips) and the
   inline channel editor (.ch-edit-chips). Reads like the text inputs above, but wraps pills. */
.chips-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--surface);
  cursor: text;
  transition: border-color .15s;
  margin-bottom: 8px;
}
.chips-input:focus-within { border-color: var(--accent); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 5px 4px 11px;
}
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.chip-remove:hover, .chip-remove:active { background: var(--accent); color: #fff; }

.chips-text {
  flex: 1;
  min-width: 90px;
  width: auto;
  border: none;
  outline: none;
  background: transparent;
  padding: 5px 3px;
  font-size: 15px;
  color: var(--ink);
}
.chips-text::placeholder { color: var(--faint); }

/* ── Embed fallback ── */
.embed-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--player-bg);
  gap: 14px;
  padding: 20px;
  border-radius: 12px;
}

.embed-note {
  color: var(--player-ink);
  font-size: 13px;
  text-align: center;
}

.btn-yt-link {
  display: inline-block;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 18px;
  border: 1.5px solid var(--accent);
  border-radius: 9px;
}

.btn-yt-link:active { background: var(--accent-soft); }

/* ── Theme toggle (top-right of setup) ── */
.theme-toggle {
  position: absolute;
  top: 54px;
  right: 24px;
  display: flex;
  background: var(--line);
  border-radius: 999px;
  padding: 3px;
}
.theme-opt {
  width: 30px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}
.theme-opt svg { width: 15px; height: 15px; }
.theme-opt.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ── Source toggle (YouTube | X, inside the add form) — segmented control ── */
.source-toggle {
  display: flex;
  background: var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 10px;
}
.source-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.source-opt svg { width: 15px; height: 15px; }
.source-opt.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ── Preference row (Shorts) ── */
.pref-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 15px;
  margin-bottom: 28px;
}
.pref-text { flex: 1; min-width: 0; }
.pref-title { font-size: 14px; font-weight: 600; }
.pref-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.45;
}

/* ── Switch ── */
.switch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: var(--switch-off);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background .15s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: left .15s;
}
.switch.is-on { background: var(--accent); }
.switch.is-on .switch-knob { left: 20px; }

/* ── Pull-to-refresh ── */
/* Everything below the appbar (#feed-body) stretches down as you pull (JS sets a
   translateY on it); the appbar stays pinned, and the spinner sits in the gap
   that opens just below it. #ptr lives at body level — outside the transformed
   #feed-body — so its position stays independent of the pull; JS offsets it down
   by the appbar height. `.snapping` animates the spring-back and the hold-open. */
.feed-body { flex: 1; display: flex; flex-direction: column; padding-bottom: 76px; } /* clear the fixed bottom nav (TASK-008) */
#feed-body.snapping { transition: transform .3s ease; }

.ptr {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 30;
  width: 32px;
  height: 32px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -40px);
}
.ptr.snapping { transition: transform .3s ease, opacity .3s ease; }

/* 12-spoke throbber: rounded bars fading around a ring. Rebuilt in CSS (not the
   stock image) so it stays crisp at any size and themes light/dark. */
.ptr i {
  position: absolute;
  left: 50%;
  top: 0;
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--ink-soft);
  transform-origin: center 16px;
  animation: ptr-fade 1s linear infinite;
}
.ptr i:nth-child(1)  { transform: rotate(0deg);   animation-delay: -.9167s; }
.ptr i:nth-child(2)  { transform: rotate(30deg);  animation-delay: -.8333s; }
.ptr i:nth-child(3)  { transform: rotate(60deg);  animation-delay: -.75s; }
.ptr i:nth-child(4)  { transform: rotate(90deg);  animation-delay: -.6667s; }
.ptr i:nth-child(5)  { transform: rotate(120deg); animation-delay: -.5833s; }
.ptr i:nth-child(6)  { transform: rotate(150deg); animation-delay: -.5s; }
.ptr i:nth-child(7)  { transform: rotate(180deg); animation-delay: -.4167s; }
.ptr i:nth-child(8)  { transform: rotate(210deg); animation-delay: -.3333s; }
.ptr i:nth-child(9)  { transform: rotate(240deg); animation-delay: -.25s; }
.ptr i:nth-child(10) { transform: rotate(270deg); animation-delay: -.1667s; }
.ptr i:nth-child(11) { transform: rotate(300deg); animation-delay: -.0833s; }
.ptr i:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; }
@keyframes ptr-fade { 0% { opacity: 1; } 100% { opacity: .15; } }

/* ── Tweet card (TASK-020) ──
   Reuses the .card shell + .chan header from the video card. The body inverts:
   the post text is the hero; media is optional and secondary. No new tokens. */

/* Display name over "@handle · 2h" in the header's flexible column */
.tweet-id { display: flex; flex-direction: column; min-width: 0; }
.tweet-id .chan-name { line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tweet-id .chan-meta { margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Subtle "view on X" escape hatch — outline glyph, not a CTA. Sits last in the
   header. A New/keyword pill (margin-left:auto) pushes the right cluster over and
   the 9px header gap spaces them; alone, the logo takes the auto-margin itself. */
.tweet-x { margin-left: auto; flex-shrink: 0; display: flex; color: var(--faint); text-decoration: none; padding: 2px; line-height: 0; transition: color .15s; }
.tweet-x:hover { color: var(--ink-soft); }
.tweet-x svg { width: 16px; height: 16px; }
.new-badge ~ .tweet-x { margin-left: 0; }

/* The post text — read-only, wraps freely, never truncated */
.tweet-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}
.tweet-text:last-child { margin-bottom: 0; }
.tweet-text a { color: var(--accent); text-decoration: none; }

/* Media below the text. Aspect ratio is clamped to [4/5, 2/1] inline per image (TASK-037), so
   portrait shows ~whole and one image can't dominate; hairline keeps it crisp in light. */
.tweet-media { border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: var(--media-bg); border: 1px solid var(--line); }
.tweet-media img { display: block; width: 100%; object-fit: cover; } /* aspect-ratio set inline */
.tweet-video { display: block; width: 100%; object-fit: cover; background: var(--media-bg); } /* aspect-ratio inline (TASK-038) */

/* Swipeable carousel for 2–4 photos (TASK-037): one scroll-snap row; a peek + dots signal more. */
.tweet-media-carousel {
  display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x mandatory;
  border-radius: 12px; background: var(--media-bg); border: 1px solid var(--line);
  margin-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tweet-media-carousel::-webkit-scrollbar { display: none; }
.tweet-slide { flex: 0 0 92%; min-width: 0; height: 100%; object-fit: cover; scroll-snap-align: start; display: block; }
.tweet-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.tweet-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .2s; }
.tweet-dot.active { background: var(--accent); }

/* Quoted (referenced) tweet — a compact read-only card under the author's text/media; the whole
   box links out to the quoted tweet on X. Text-only (quoted media isn't fetched). (TASK-034) */
.tweet-quoted {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s;
}
.tweet-quoted:last-child { margin-bottom: 0; }
.tweet-quoted:hover { border-color: var(--ink-soft); }
.quoted-head { font-size: 13px; margin-bottom: 3px; overflow-wrap: anywhere; }
.quoted-name { font-weight: 600; color: var(--ink); }
.quoted-handle { color: var(--ink-soft); }
.quoted-text {
  font-size: 14px; line-height: 1.45; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
