:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1b1d20;
  --muted: #6a6f76;
  --line: #e4dfd6;
  --accent: #d9480f;
  --accent-text: #ffffff;
  --ok: #2b8a3e;
  --bad: #c92a2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1f2226;
    --text: #eef0f2;
    --muted: #9aa1a9;
    --line: #2d3136;
    --accent: #ff8a50;
    --accent-text: #1b1d20;
    --ok: #69db7c;
    --bad: #ff8787;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top)) 0 0;
  border-bottom: 1px solid var(--line);
}
.top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 16px;
  max-width: 720px;
  margin: 0 auto;
}
.date {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font: 800 30px/1.1 "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  letter-spacing: -.01em;
}
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.icon-btn:active { background: var(--line); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  max-width: 720px;
  margin: 0 auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.tab[aria-selected="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 0;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 8px;
}
.section-title h2 {
  margin: 0;
  font: 700 20px/1.2 "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}
.section-title button {
  border: 0;
  background: none;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.greeting { margin: 16px 0 0; color: var(--muted); font-size: 15px; }

.card {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.card:active { opacity: .7; }
.card-body { flex: 1; min-width: 0; }
.card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.card p {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta { font-size: 12px; color: var(--muted); }
.meta b { color: var(--accent); font-weight: 700; }
.thumb {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--line);
}

.empty {
  margin: 48px 0;
  text-align: center;
  color: var(--muted);
}
.skeleton {
  height: 96px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: var(--surface);
  opacity: .6;
  animation: pulse 1.2s ease-in-out infinite alternate;
}
@keyframes pulse { to { opacity: .25; } }

/* Réglages */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, .4);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  max-width: 720px;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  -webkit-overflow-scrolling: touch;
}
.sheet[hidden], .sheet-backdrop[hidden], [hidden] { display: none !important; }
.sheet-head {
  position: sticky;
  top: -8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -16px;
  padding: 8px 8px 4px 16px;
  background: var(--bg);
}
.sheet h2 { margin: 0; font: 700 22px/1.2 "Iowan Old Style", Georgia, serif; }
.sheet h3 {
  margin: 22px 0 8px;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.install-help {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
}
.install-help ol { margin: 6px 0 0; padding-left: 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; }

.topic-list, .rss-list, .source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
}
.topic-list li, .rss-list li, .source-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.topic-list li:last-child, .rss-list li:last-child, .source-list li:last-child { border-bottom: 0; }
.topic-list label { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 32px; }
.topic-list input { width: 22px; height: 22px; accent-color: var(--accent); }
.rss-list span, .source-list span.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rss-list button, .rss-list a {
  flex: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  font-size: 13px;
  font-weight: 600;
}
.source-list { font-size: 14px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.source-list small { color: var(--muted); flex: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
}
