:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e6ea;
  --text: #1c1e21;
  --muted: #68727d;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* padding-left dégagé : le bouton "retour au hub" (hub-back-btn) est
     position:fixed en haut à gauche (left = safe-area-inset-left, largeur
     ≈26px) ; on décale le logo (h1) vers la droite pour qu'il ne soit jamais
     recouvert : inset + 26px de bouton + ≈24px de respiration. */
  padding: 14px 20px 14px calc(env(safe-area-inset-left, 0px) + 50px);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { margin: 0; font-size: 20px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

main { max-width: 720px; margin: 0 auto; padding: 18px 16px 40px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 10px; font-size: 15px; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #eef1f5; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(0.96); }
.btn.ghost { background: transparent; }
.btn.filter.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 6px 0; }

.muted { color: var(--muted); }
.centered { text-align: center; }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.add-block { display: flex; gap: 8px; margin-bottom: 10px; }
.add-block input { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; margin-top: 10px; }

#login-card label { display: block; font-size: 13px; margin: 10px 0 4px; }
.error, #li-error { color: #c0392b; font-size: 13px; margin: 6px 0; }

#artist-results { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.candidate {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.candidate:hover { background: #eef1f5; }

#sources-list { list-style: none; margin: 10px 0 0; padding: 0; }
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-top: 1px solid var(--border);
}
.source-row:first-child { border-top: none; }
.source-ic { font-size: 14px; }
.source-txt { flex: 1; display: flex; flex-direction: column; }
.source-name { font-size: 14px; }
.source-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-del {
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 13px; padding: 4px;
}
.source-del:hover { color: #c0392b; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 4px 0 12px;
}
.filters { display: flex; gap: 6px; }

#refresh-progress .bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 8px;
}
#refresh-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; }
.refresh-line { font-size: 13px; padding: 2px 0; }
.refresh-line.ok { color: #1e7d4f; }
.refresh-line.err { color: #c0392b; }
.refresh-line.done { font-weight: 600; }

#feed { display: flex; flex-direction: column; gap: 12px; }
.card {
  display: flex;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-decoration: none;
  color: inherit;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.media { flex: none; border-radius: 6px; overflow: hidden; background: #eef1f5; }
.media.wide { width: 180px; aspect-ratio: 16 / 9; }
.media.square { width: 120px; aspect-ratio: 1; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.badge {
  align-self: flex-start;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.badge.video { background: #e8eefb; color: #2452a8; }
.badge.music { background: #fdeee3; color: #a85c23; }
.card .title { font-size: 15px; font-weight: 600; }
.card .meta { display: flex; gap: 8px; font-size: 12px; margin-top: 2px; }
.card .summary { font-size: 13px; margin: 6px 0 0; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

@media (max-width: 520px) {
  .card { flex-direction: column; }
  .media.wide, .media.square { width: 100%; }
}