:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #eef2f6;
  --text: #111827;
  --muted: #526071;
  --border: #d8e0e8;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --high-bg: #dcfce7;
  --high-fg: #14532d;
  --mod-bg: #fef3c7;
  --mod-fg: #78350f;
  --low-bg: #ffedd5;
  --low-fg: #9a3412;
  --hoax-bg: #fee2e2;
  --hoax-fg: #991b1b;
  --font-scale: 16px;
}

html[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #182026;
  --surface-alt: #222d36;
  --text: #e6edf3;
  --muted: #93a4b5;
  --border: #2f3e4b;
  --accent: #14b8a6;
  --accent-text: #042f2e;
  --high-bg: #133929;
  --high-fg: #86efac;
  --mod-bg: #3f2e0d;
  --mod-fg: #fde68a;
  --low-bg: #45230e;
  --low-fg: #fdba74;
  --hoax-bg: #4c1414;
  --hoax-fg: #fca5a5;
}

html[data-theme="paper"] {
  --bg: #efe6d1;
  --surface: #f7f1e1;
  --surface-alt: #eae0c8;
  --text: #2b2116;
  --muted: #665643;
  --border: #d4c5a5;
  --accent: #7c4a1d;
  --accent-text: #fdf9f0;
  --high-bg: #dce8d0;
  --high-fg: #26421d;
  --mod-bg: #efe0b8;
  --mod-fg: #66460b;
  --low-bg: #f1d4be;
  --low-fg: #7c3214;
  --hoax-bg: #efd0cc;
  --hoax-fg: #7e1f1a;
}

html[data-font="small"] { --font-scale: 14px; }
html[data-font="medium"] { --font-scale: 16px; }
html[data-font="large"] { --font-scale: 18px; }
html[data-font="xlarge"] { --font-scale: 21px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-scale);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

html[data-theme="paper"] body {
  font-family: Georgia, "Times New Roman", serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88em; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon { border-radius: 7px; }
.brand-title { margin: 0; font-size: 1.2rem; line-height: 1.1; }

.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
}

.topbar-actions, .row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabs-scroll {
  display: flex;
  flex: 1;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.tab-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.88em;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.42rem 0.78rem;
  border-radius: 8px;
  font-size: 0.88em;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--surface-alt); }
.btn-sm { padding: 0.28rem 0.58rem; font-size: 0.82em; }
.btn-primary, .btn-accent {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover, .btn-accent:hover { opacity: 0.92; }
.btn-danger {
  background: var(--hoax-bg);
  color: var(--hoax-fg);
  border-color: var(--hoax-fg);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.9rem;
}

.feed-meta-bar, .section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.article-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.source-line {
  font-size: 0.82em;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.source-name { font-weight: 700; color: var(--text); }

.article-title-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  color: var(--text);
  font: inherit;
  font-size: 1.12em;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.article-title-btn:hover { text-decoration: underline; }
.article-subtitle { margin: 0; color: var(--muted); font-size: 0.93em; }

.article-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: 999px;
  padding: 0.24rem 0.68rem;
  font-size: 0.8em;
  font-weight: 700;
  cursor: pointer;
}

.verify-high { background: var(--high-bg); color: var(--high-fg); }
.verify-moderate { background: var(--mod-bg); color: var(--mod-fg); }
.verify-low { background: var(--low-bg); color: var(--low-fg); }
.verify-hoax_or_satire { background: var(--hoax-bg); color: var(--hoax-fg); }

.verify-breakdown {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.7rem 0.85rem;
  font-size: 0.86em;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.factor-row {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.factor-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.factor-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.factor-fill {
  height: 100%;
  background: var(--accent);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0 2rem;
}

.alert {
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  font-size: 0.9em;
}

.alert-warn { background: var(--mod-bg); color: var(--mod-fg); }
.alert-danger { background: var(--hoax-bg); color: var(--hoax-fg); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.modal-card {
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1rem 1.2rem 1.6rem;
  overflow-y: auto;
}

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reader-mode .reader-content {
  max-width: 66ch;
  margin: 0 auto;
  font-size: 1.06em;
  line-height: 1.75;
}

.reader-title { margin: 0.65rem 0 0.35rem; line-height: 1.25; }
.reader-meta { margin-bottom: 0.85rem; }

.reader-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 0.9rem;
  border-left: 4px solid var(--accent);
  background: var(--surface-alt);
}

.settings-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.settings-section:last-child { border-bottom: none; margin-bottom: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
  margin: 0.5rem 0;
}

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.88em;
  font-weight: 600;
}

.input, .select-sm {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.select-sm { width: auto; padding: 0.25rem 0.45rem; font-size: 0.86em; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0;
  font-size: 0.9em;
  cursor: pointer;
}

.sub-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  margin: 0.65rem 0;
}

.sub-panel h4 { margin: 0 0 0.5rem; }

.lang-picker-wrap { margin: 0.6rem 0; }
.lang-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.88em;
  font-weight: 600;
}

.lang-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85em;
  cursor: pointer;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.55rem 0;
}

.sources-list {
  max-height: 280px;
  overflow-y: auto;
}

.manage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.88em;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
  margin-left: 0.3rem;
}

@media (max-width: 600px) {
  .topbar { padding: 0.55rem 0.7rem; }
  .container { padding: 0.6rem; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; border-radius: 0; }
}
.search-panel {
  margin-top: 0;
  margin-bottom: 0.9rem;
}

.search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.search-panel-head h4 {
  margin: 0;
}