:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2733; --muted: #6b7684; --line: #e3e6ea;
  --accent: #2c3e50; --accent-soft: #e6ebf0; --ok: #1e8e5a; --ko: #c0392b;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --card: #1a2129; --text: #e7ebef; --muted: #9aa5b1; --line: #2a333d; --accent: #8fb3d6; --accent-soft: #24303c; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

/* Bandeau : une seule ligne, largeur de l'écran */
.bar { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); padding-top: var(--safe-top); }
.bar-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; }
.dd { flex: 1 1 0; min-width: 0; height: 40px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd .caret { flex: none; font-size: 11px; color: var(--muted); }
.dd[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--card); }
.dd[aria-current="true"] .caret { color: inherit; }
.dd-lang { flex: 0 0 auto; }
.icon-btn { flex: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; }
.icon-btn svg { width: 24px; height: 24px; }

.install { display: flex; gap: 8px; align-items: center; margin: 12px 16px 0; padding: 10px 12px; background: var(--accent-soft); border-radius: 10px; font-size: 14px; }
.link { border: 0; background: none; min-width: 44px; min-height: 44px; }

.context { margin: 12px 16px 0; font-size: 13px; color: var(--muted); min-height: 18px; }
.list { list-style: none; margin: 0; padding: 8px 12px calc(24px + var(--safe-bottom)); display: grid; gap: 10px; }
.card { background: var(--card); border-radius: 12px; overflow: hidden; transition: opacity .2s, transform .2s; }
.card.gone { opacity: 0; transform: translateX(40px); }
.card a { display: flex; gap: 12px; padding: 12px 12px 4px; color: inherit; text-decoration: none; }
.card .txt { flex: 1; min-width: 0; }
.meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title { font-weight: 600; margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { flex: none; width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: var(--accent-soft); }
.foot { display: flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 4px 4px 12px; }
.tags { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act { min-width: 44px; height: 44px; border: 0; background: none; border-radius: 22px; display: grid; place-items: center; color: var(--muted); }
.act svg { width: 22px; height: 22px; }
.act.keep:active, .act.keep:hover { color: var(--ok); }
.act.drop:active, .act.drop:hover { color: var(--ko); }

.skel { height: 120px; border-radius: 12px; background: linear-gradient(90deg, var(--card) 25%, var(--accent-soft) 50%, var(--card) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.state { text-align: center; color: var(--muted); padding: 32px 24px; }
#sentinel { height: 1px; }

/* Panneaux plein écran sur mobile, centrés sur grand écran */
.panel { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: var(--card); color: var(--text); flex-direction: column; }
.panel[open] { display: flex; }
.panel::backdrop { background: rgb(0 0 0 / .4); }
@media (min-width: 700px) { .panel { width: 480px; height: auto; max-height: 85vh; margin: auto; border-radius: 16px; } }
.panel-head { display: flex; align-items: center; gap: 4px; padding: calc(4px + var(--safe-top)) 8px 4px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 18px; margin: 0; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.panel-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); }
.options { list-style: none; margin: 0; padding: 0 0 var(--safe-bottom); overflow-y: auto; flex: 1; }
.options button { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.options button span { flex: 1; }
.options button small { display: block; color: var(--muted); font-size: 13px; }
.options button[aria-selected="true"] { font-weight: 600; }
.options button[aria-selected="true"]::after { content: "✓"; color: var(--accent); font-weight: 700; }
.options .group { padding: 16px 16px 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.hint { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--card); }
h3 { font-size: 13px; color: var(--muted); font-weight: 400; margin: 8px 0; }
.links { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.links a, .links button { display: flex; align-items: center; min-height: 52px; padding: 0 16px; text-decoration: none; border: 0; background: none; width: 100%; text-align: left; }
.links li + li { border-top: 1px solid var(--line); }
.links a::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 20px; }
.panel-foot button, .state button { flex: 1; min-height: 48px; border-radius: 10px; border: 0; padding: 0 16px; }
.primary { background: var(--accent); color: var(--card); font-weight: 600; }
.secondary { background: var(--accent-soft); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--safe-bottom)); background: #1d2733; color: #fff; padding: 12px 16px; border-radius: 10px; text-align: center; z-index: 3; }
@media (prefers-reduced-motion: reduce) { .card, .skel { transition: none; animation: none; } }

/* Mes sources */
.src-add { display: flex; gap: 8px; margin-bottom: 12px; }
.src-add input, .src-filter { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; }
.src-add button { min-height: 44px; border-radius: 10px; border: 0; padding: 0 16px; }
.src-filter { width: 100%; margin-bottom: 8px; }
.src-list { list-style: none; margin: 0; padding: 0; }
.src-list li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.src-list .src { flex: 1; min-width: 0; display: block; padding: 10px 0; border: 0; background: none; text-align: left; }
.src-list .src b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-list .src small { display: block; color: var(--muted); font-size: 13px; }
.src-list .nb { font-weight: 600; color: var(--accent); }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--accent-soft); }
.bars { list-style: none; margin: 0 0 20px; padding: 0; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-bottom: 8px; font-size: 14px; }
.bars i { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--accent); }
