:root {
  --bg: #0d0e12;
  --surface: #16181e;
  --surface-2: #1f222a;
  --surface-3: #2a2e38;
  --line: rgba(255, 255, 255, .09);
  --text: #eef0f4;
  --muted: #9aa1ae;
  --accent: #f4b740;
  --on-accent: #1d1503;
  --accent-soft: rgba(244, 183, 64, .16);
  --good: #4cc38a;
  --good-soft: rgba(76, 195, 138, .15);
  --bad: #f2555a;
  --bad-soft: rgba(242, 85, 90, .15);
  --warn: #f5d90a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --dock-h: 62px;
  --gutter: 16px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #eeeeea;
  --surface-3: #e0e0da;
  --line: rgba(0, 0, 0, .1);
  --text: #1b1c20;
  --muted: #62676f;
  --accent: #b97a06;
  --on-accent: #ffffff;
  --accent-soft: rgba(185, 122, 6, .14);
  --good: #17805a;
  --good-soft: rgba(23, 128, 90, .12);
  --bad: #c92a2f;
  --bad-soft: rgba(201, 42, 47, .1);
  --warn: #8a6d00;
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f4f4f1;
    --surface: #ffffff;
    --surface-2: #eeeeea;
    --surface-3: #e0e0da;
    --line: rgba(0, 0, 0, .1);
    --text: #1b1c20;
    --muted: #62676f;
    --accent: #b97a06;
    --on-accent: #ffffff;
    --accent-soft: rgba(185, 122, 6, .14);
    --good: #17805a;
    --good-soft: rgba(23, 128, 90, .12);
    --bad: #c92a2f;
    --bad-soft: rgba(201, 42, 47, .1);
    --warn: #8a6d00;
    --shadow: 0 10px 30px rgba(0, 0, 0, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; }
body { font-size: 1rem; }
/* grands écrans : tout ce qui est en rem grandit avec la résolution (1080p, 2K, 4K) */
@media (min-width: 1800px) { html { font-size: 16px; } }
@media (min-width: 2400px) { html { font-size: 18px; } }
@media (min-width: 3200px) { html { font-size: 21px; } }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.stack.tight { gap: 8px; }
.link { color: var(--accent); font-size: .88rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* iPhone : un champ sous 16 px fait zoomer la page à la saisie, et elle reste zoomée */
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=range], input[type=file] { width: auto; padding: 0; border: 0; background: none; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 20px; height: 20px; flex: none; }
textarea { resize: vertical; }

/* connexion */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); }
.login-box { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 22px; display: grid; gap: 14px; text-align: center; }
.login-logo { margin: 0 auto; }
.login-box h1 { font-size: 1.5rem; }
.login-box label { display: grid; gap: 6px; text-align: left; font-size: .9rem; color: var(--muted); }
.form-error { color: var(--bad); min-height: 1.4em; }

/* boutons */
.btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 14px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 500;
  white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); background: var(--surface-2); }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.on-bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 6px 11px; font-size: .86rem; border-radius: 9px; }
.btn.sm:has(> .icon:only-child) { width: 36px; padding: 0; }
.btn.icon { width: 44px; padding: 0; }

/* coquille */
.shell { min-height: 100dvh; }
.rail { display: none; }
.stage { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; min-height: 54px;
  padding: calc(env(safe-area-inset-top) + 6px) var(--gutter) 6px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); }
.topbar h1 { flex: 1; min-width: 0; font-size: 1.3rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar #back { margin-left: -10px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
main { padding: 6px var(--gutter) calc(var(--dock-h) + env(safe-area-inset-bottom) + 24px); overflow-wrap: anywhere; outline: none; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; height: calc(var(--dock-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.dock-link { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: 0; color: var(--muted); font-size: .7rem; }
.dock-link.on { color: var(--accent); }
.badge { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 1px 6px; }
.dock-link .badge { position: absolute; top: 5px; left: calc(50% + 6px); }

@media (min-width: 900px) {
  :root { --gutter: 28px; }
  .shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; padding: 18px 12px;
    background: var(--surface); border-right: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-weight: 700; font-size: 1.1rem; }
  .brand > span:first-child { display: inline-flex; }
  .rail-nav { display: grid; gap: 2px; }
  .rail-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
  .rail-link:hover { background: var(--surface-2); color: var(--text); }
  .rail-link.on { background: var(--accent-soft); color: var(--accent); }
  .rail-link .badge { margin-left: auto; }
  .dock { display: none; }
  main { padding-bottom: 40px; max-width: 160rem; margin-inline: auto; }
  .topbar { min-height: 64px; padding-inline: max(var(--gutter), calc((100% - 160rem) / 2 + var(--gutter))); }
}

/* fenêtre */
.sheet { width: min(520px, 100vw); max-width: 100vw; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text); overflow: auto; overflow-wrap: anywhere; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet-head { padding: 10px var(--gutter) 6px; display: grid; gap: 6px; }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: 0 auto 6px; }
.sheet-head h2 { font-size: 1.15rem; }
.sheet-body { padding: 10px var(--gutter) calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet-body .btn { white-space: normal; }
.more-list { padding: 6px 10px calc(14px + env(safe-area-inset-bottom)); display: grid; }
.more-row { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-radius: var(--radius-sm); }
.more-row:hover { background: var(--surface-2); }
.more-row strong, .more-row small { display: block; }
.choice-list { padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.choice { display: grid; grid-template-columns: 1fr auto; text-align: left; padding: 10px 12px; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-sm); }
.choice small { grid-column: 1; }
.choice .icon { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--accent); }
.choice.on { border-color: var(--accent); }
.field { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.field-line { display: flex; justify-content: space-between; gap: 12px; }
.field-line output { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--muted); }

/* messages */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 20; width: min(440px, calc(100vw - 2 * var(--gutter))); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--text); color: var(--bg);
  border-radius: 12px; padding: 11px 14px; font-size: .9rem; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.toast.error { background: var(--bad); color: #fff; }
.toast-action { background: none; border: 0; color: inherit; font-weight: 700; padding: 2px 4px; text-decoration: underline; flex: none; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--warn); }
.notice.critical { border-color: var(--bad); }
.notice .icon { color: var(--warn); margin-top: 1px; }
.notice.critical .icon { color: var(--bad); }
.notice strong { display: block; font-size: .9rem; font-weight: 600; }
.notice small { color: var(--muted); }

/* sections, surfaces */
.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title { font-size: 1rem; font-weight: 650; margin-bottom: 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.panel h3 { font-size: .95rem; }
.intro { color: var(--muted); font-size: .9rem; margin: 10px 0; max-width: 70ch; }
.columns { display: grid; gap: 0 28px; }
.col-main, .col-side { min-width: 0; }
@media (min-width: 1100px) {
  .columns { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); align-items: start; }
  .columns.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; display: grid; gap: 8px; justify-items: center; }
.empty-title { color: var(--text); font-weight: 600; }
.empty-actions { margin-top: 8px; display: flex; gap: 8px; }
.skeleton { height: 96px; border-radius: var(--radius); background: var(--surface); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .btn { transition: none; } }

/* puces, onglets, barres d'outils */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .88rem; }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.chip-count { font-size: .76rem; opacity: .75; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); max-width: 100%; }
.seg button { border: 0; background: none; color: var(--muted); padding: 8px 12px; font-size: .86rem; min-height: 36px; white-space: nowrap; }
.seg button.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.filters .chips { min-width: 0; max-width: 100%; }
.subnav { margin-bottom: 12px; }
.subnav .seg { display: flex; }
.subnav .seg button { flex: 1; }
@media (min-width: 700px) { .subnav .seg { display: inline-flex; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; align-items: center; }
.toolbar input { flex: 1 1 160px; }
.toolbar select { flex: 0 1 150px; }
.toolbar > div:empty { display: none; }
.toolbar > div { min-width: 0; max-width: 100%; }
.bulkbar { position: sticky; top: 58px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 12px;
  background: var(--surface-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.bulkbar > span { flex: 1; min-width: 120px; font-size: .9rem; }

/* tags et score */
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: .74rem; border-radius: 6px; padding: 2px 7px; background: var(--surface-2); color: var(--muted); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.good { background: var(--good-soft); color: var(--good); }
.score { display: inline-block; padding: 2px 7px; border-radius: 7px; font-size: .78rem; font-weight: 700; background: rgba(13, 14, 18, .82); color: #eef0f4; font-variant-numeric: tabular-nums; }
.score.high { background: var(--accent); color: var(--on-accent); }
.score.low { color: #b6bcc8; }

/* jaquettes */
.poster { display: block; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.poster.thumb { width: 48px; flex: none; border-radius: 7px; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
/* à la souris, un bandeau à faire glisser n'est pas pratique : tout est visible d'un coup */
@media (min-width: 900px) {
  .strip { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); grid-auto-columns: auto;
    gap: 16px 12px; overflow: visible; margin: 0; padding: 0; }
  .tile .poster { transition: transform .15s, box-shadow .15s; }
  a.tile:hover .poster, button.tile:hover .poster { transform: translateY(-3px); box-shadow: var(--shadow); }
  a.tile:hover .tile-title { color: var(--accent); }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) { .tile .poster { transition: none; } }
.tile { position: relative; display: grid; gap: 6px; align-content: start; background: none; border: 0; padding: 0; text-align: left; scroll-snap-align: start; min-width: 0; }
.tile > .score { position: absolute; top: 6px; left: 6px; }
.tile-title { font-size: .82rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-sub { font-size: .74rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px 12px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* lignes */
.row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.row.off { opacity: .55; }
.row-title { font-weight: 600; font-size: .92rem; }
.row-sub { font-size: .8rem; color: var(--muted); }
.row-sub.bad { color: var(--bad); }
.bar { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s; }
.bar.good > span { background: var(--good); }
.bar.bad > span { background: var(--bad); }
.bar.idle > span { background: var(--muted); }
.plain { display: grid; gap: 4px; font-size: .88rem; }
.weight { font-weight: 700; font-size: .88rem; color: var(--good); }
.weight.neg { color: var(--bad); }

/* accueil */
.home, .home-top, .home-main, .home-side, .home-trackers { min-width: 0; }
.home-top > .stack { margin-bottom: 12px; }
.home-trackers:empty { display: none; }
.tracker-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .home-main .strip { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); } }
@media (min-width: 760px) { .tracker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
  .home { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 28px; align-items: start;
    grid-template-areas: "top top" "main side" "trackers trackers"; }
  .home-top { grid-area: top; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px 16px; align-items: stretch; }
  .home-top > .toto-hello { margin: 0; }
  .home-top > .stack { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  .home-top > .kpis { margin: 0; grid-column: 2; grid-row: 1; }
  .home-main { grid-area: main; }
  .home-side { grid-area: side; }
  .home-trackers { grid-area: trackers; }
}
/* 1080p large et au-delà : trois colonnes, tout tient sans descendre */
@media (min-width: 1800px) {
  :root { --gutter: 36px; }
  .shell { grid-template-columns: 15rem minmax(0, 1fr); }
  .home { grid-template-columns: minmax(0, 1fr) clamp(380px, 24vw, 40rem) clamp(320px, 18vw, 30rem);
    grid-template-areas: "top top top" "main trackers side"; }
  .home-top { grid-template-columns: clamp(320px, 18vw, 30rem) minmax(0, 1fr); }
  .home-trackers .tracker-grid { grid-template-columns: minmax(0, 1fr); }
  .home-main .strip { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
  .columns { grid-template-columns: minmax(0, 1.9fr) minmax(24rem, 1fr); }
  .columns.even { max-width: 110rem; }
  .wide-list { grid-template-columns: repeat(auto-fill, minmax(34rem, 1fr)); align-items: start; }
  .grid, .rj-list { grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr)); }
  .portrait { grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
  .strip { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
  .hero:not(.plain) { padding-top: 13rem; }
  .hero-inner { grid-template-columns: 13rem minmax(0, 1fr); }
  .hero-text h2 { font-size: 2.6rem; }
  .card-top { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .rj { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .poster.thumb { width: 3.6rem; }
  .sheet { width: min(36rem, 100vw); }
}
.toto-hello { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; overflow-x: clip; overflow-clip-margin: 12px; }   /* le rebond de la bulle ne doit pas élargir la page */
.toto-bubble { position: relative; flex: 1; min-width: 0; display: grid; gap: 1px; padding: 9px 13px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; font-size: .9rem; color: var(--muted); }
.toto-bubble { transform-origin: left center; transition: opacity .25s ease, transform .5s cubic-bezier(.2, 1.9, .45, 1); }
.toto-bubble.away { opacity: 0; transform: translateX(-18px) scale(.5); transition: opacity .3s ease-in, transform .3s ease-in; }
@media (prefers-reduced-motion: reduce) { .toto-bubble, .toto-bubble.away { transform: none; } }
.toto-bubble strong { color: var(--text); font-size: 1rem; }
.toto-bubble span { min-height: 2.7em; }      /* deux lignes réservées : la page ne saute pas quand la phrase change */
@media (min-width: 700px) { .toto-bubble span { min-height: 0; } }
.toto-bubble::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; margin-top: -5px; transform: rotate(45deg);
  background: var(--surface); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Toto, la mascotte */
.toto { flex: none; display: block; overflow: visible; cursor: pointer; }
.toto-metal { fill: #f4b740; }
.toto-dark { fill: #c98f22; }
.toto-face { fill: #14161c; }
.toto-eye { fill: #6ff5d2; }
.toto-mouth, .toto-line { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.toto-mouth { stroke: #6ff5d2; }
.toto-line { stroke: #c98f22; }
.toto-bulb { fill: #ff6b6b; }
.toto-button { fill: #14161c; }
.toto-bob, .toto-antenna, .toto-arm, .toto-eyes, .toto-bulb { transform-box: fill-box; }
.toto-bob { transform-origin: center bottom; animation: toto-bob 3.2s ease-in-out infinite; }
.toto-antenna { transform-origin: center bottom; animation: toto-wiggle 2.6s ease-in-out infinite; }
.toto-bulb { transform-origin: center; animation: toto-glow 1.6s ease-in-out infinite; }
.toto-eyes { transform-origin: center; animation: toto-blink 4.5s linear infinite; }
.toto-arm { transform-origin: left center; animation: toto-wave 5s ease-in-out infinite; }
.toto.hop { animation: toto-hop .55s cubic-bezier(.3, 1.5, .6, 1); }
.toto.sleep .toto-eyes { animation: none; transform: scaleY(.12); }
.toto.sleep .toto-bob { animation-duration: 5s; }
.toto.sleep .toto-arm, .toto.sleep .toto-antenna { animation: none; }
.toto.sleep .toto-bulb { animation-duration: 4s; opacity: .45; }
@keyframes toto-bob { 50% { transform: translateY(-2.5px) rotate(-1.5deg); } }
@keyframes toto-wiggle { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes toto-glow { 50% { opacity: .45; transform: scale(.82); } }
@keyframes toto-blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes toto-wave { 0%, 55%, 100% { transform: rotate(0); } 62%, 76% { transform: rotate(-38deg); } 69%, 83% { transform: rotate(-12deg); } }
@keyframes toto-hop { 40% { transform: translateY(-14px) rotate(-6deg); } 70% { transform: translateY(0) scale(1.08, .92); } }
@media (prefers-reduced-motion: reduce) {
  .toto-bob, .toto-antenna, .toto-bulb, .toto-eyes, .toto-arm, .toto.hop { animation: none; }
}
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: grid; gap: 1px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.kpi:hover { border-color: var(--surface-3); }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .86rem; }
.kpi-sub { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tracker.warn { border-color: var(--warn); }
.tracker-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tracker-head > div:first-child { min-width: 0; }
.tracker-head h3 { font-size: 1.02rem; }
.tracker-ratio { display: grid; justify-items: end; flex: none; }
.tracker-ratio strong { font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tracker-margin { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .88rem; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: .86rem; }
.facts dt { color: var(--muted); }
.facts dd { text-align: right; font-variant-numeric: tabular-nums; }
.funnel { gap: 8px; }
.funnel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; font-size: .88rem; }
.funnel-row .bar { grid-column: 1 / -1; margin-top: 3px; height: 4px; }
.funnel-row strong { font-variant-numeric: tabular-nums; }
a.funnel-row:hover .funnel-label { color: var(--accent); }

/* cartes */
.grid { display: grid; gap: 12px; align-items: start; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; min-width: 0; }
.card.highlight { border-color: var(--accent); }
.card.selected { background: var(--accent-soft); }
.card-top { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
.card-poster { position: relative; }
.card-poster .score { position: absolute; top: 5px; left: 5px; }
.card-body { display: grid; gap: 5px; align-content: start; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-head h3 { font-size: 1rem; line-height: 1.25; min-width: 0; }
.card-head time { font-size: .74rem; flex: none; }
.why { font-size: .8rem; color: var(--accent); }
.overview { color: var(--muted); font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.overview.open { -webkit-line-clamp: unset; line-clamp: unset; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .btn.primary { flex: 1 1 100%; }
.card-actions .btn:not(.primary):not(.quiet) { flex: 1 1 0; }
.select-row { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.versions { display: grid; gap: 6px; }
.version { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.version.done { opacity: .7; }
.version.warn { opacity: .75; }
.version-main { font-size: .88rem; font-weight: 600; }
.version-sub { font-size: .78rem; color: var(--muted); }
.version-warn { font-size: .78rem; color: var(--warn); }
.version-name { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.version-name { display: block; text-decoration: underline dotted; text-underline-offset: 2px; }
.tracker-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.version-state { color: var(--good); flex: none; }
.version-buttons { display: flex; gap: 6px; flex: none; }
.versions-group { font-size: .86rem; margin: 6px 0 4px; }
.seeds.good { color: var(--good); font-weight: 600; }
.seeds.none { color: var(--bad); }
.more-versions summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer;
  padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .88rem; }
.more-versions summary::-webkit-details-marker { display: none; }
.more-versions[open] summary .icon { transform: rotate(180deg); }
.more-versions .versions { margin-top: 6px; }

/* tri rapide et entraînement */
.deck { max-width: 460px; margin: 0 auto; display: grid; gap: 12px; }
.deck-count { text-align: center; font-size: .88rem; }
.deck-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.deck-poster { position: relative; }
.deck-poster .poster { border-radius: 0; aspect-ratio: 16 / 13; }
.deck-poster img { object-position: top; }
.deck-poster .score { position: absolute; top: 10px; left: 10px; font-size: .9rem; }
.deck-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.deck-body h2 { font-size: 1.15rem; line-height: 1.25; }
.deck-actions { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }

/* écartées */
.rj-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .rj-list { grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); } }
.rj { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.rj-poster { position: relative; }
.rj-poster .score { position: absolute; top: 4px; left: 4px; font-size: .7rem; padding: 1px 5px; }
.rj-body { display: grid; gap: 3px; align-content: start; min-width: 0; }
.rj-body h3 { font-size: .95rem; line-height: 1.25; }
.rj-reason { font-size: .82rem; }
.rj-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* recherche et fiche */
.searchbox { display: flex; gap: 8px; }
.searchbox input { flex: 1; }
.searchbox .btn { width: 46px; padding: 0; flex: none; }
.search-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin: 10px 0 16px; }
.hero { position: relative; margin: -6px calc(-1 * var(--gutter)) 0; padding: 72px var(--gutter) 14px; background-size: cover; background-position: center 20%; }
.hero.plain { padding-top: 10px; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 35%, transparent), var(--bg) 92%); }
.hero-inner { position: relative; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; align-items: end; }
.hero-poster { box-shadow: var(--shadow); }
.hero-text { display: grid; gap: 4px; min-width: 0; }
.hero-text h2 { font-size: 1.45rem; line-height: 1.15; letter-spacing: -.01em; }
.hero-facts { font-size: .88rem; }
@media (min-width: 900px) {
  .hero:not(.plain) { padding-top: 150px; }
  .hero { border-radius: 0 0 var(--radius) var(--radius); }
  .hero-inner { grid-template-columns: 170px minmax(0, 1fr); gap: 22px; }
  .hero-text h2 { font-size: 2.1rem; }
}
.title-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.title-actions .btn.primary { flex: 1 1 100%; }
.title-actions .btn:not(.primary) { flex: 1 1 auto; }
.title-watch { display: contents; }
.title-opinion { display: flex; gap: 8px; flex: 1 1 100%; }
.title-opinion .btn { flex: 1; }
@media (min-width: 700px) {
  .title-actions .btn.primary, .title-actions .btn:not(.primary) { flex: 0 0 auto; }
  .title-opinion { flex: 0 0 auto; margin-left: auto; }
}
.tagline { font-style: italic; color: var(--muted); margin-top: 12px; }
.synopsis { margin: 10px 0 6px; max-width: 72ch; }
.score-line { display: flex; gap: 10px; align-items: center; }
.score-line .score { font-size: 1.1rem; padding: 3px 9px; background: var(--surface-3); color: var(--text); flex: none; }
.score-line .score.high { background: var(--accent); color: var(--on-accent); }
.factors { display: grid; gap: 2px; }
.factor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; text-align: left; background: none; border: 0; padding: 6px 4px; border-radius: 8px; }
.factor:hover { background: var(--surface-2); }
.factor-name { font-size: .88rem; }
.factor-bar { grid-column: 1 / -1; height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.factor-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.factor.neg .factor-bar > span { background: var(--bad); }
.person { display: grid; gap: 5px; justify-items: center; text-align: center; scroll-snap-align: start; min-width: 0; }
.person-photo { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.person-photo img { width: 100%; height: 100%; object-fit: cover; }

/* torrents */
.speedbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.speedbar + div + div:not(:empty) { margin-top: 8px; }
.speed { flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: pre; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.tor { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tor-line { display: flex; align-items: center; }
.tor-check { margin-left: 12px; }
.tor-main { flex: 1; min-width: 0; display: grid; gap: 3px; width: 100%; border: 0; background: none; text-align: left; padding: 10px 12px; }
.tor-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tor.open .tor-name { white-space: normal; }
.tor-state { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--muted); }
.tor-sub { font-size: .76rem; color: var(--muted); }
.tor-line > .btn { margin-right: 8px; flex: none; }
a.tor-main { color: inherit; }
.tor-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tor-head { display: grid; gap: 6px; margin-bottom: 12px; }
.tor-title { font-weight: 600; overflow-wrap: anywhere; }
.tor-head .tor-actions { margin-top: 6px; }
.gap-bottom { margin-bottom: 10px; }
.wide-facts { padding: 4px 0; }
.wide-facts dd { overflow-wrap: anywhere; min-width: 0; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row .grow { min-width: 0; display: grid; gap: 3px; }
.file-row select { flex: 0 0 9.5rem; padding: 7px 8px; min-width: 0; }
.file-name { font-size: .88rem; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .file-row { flex-wrap: wrap; }
  .file-row .grow { flex-basis: 100%; }
  .file-row select { flex: 1 1 100%; }
}
.share-row { flex-wrap: wrap; }
.share-row .grow { flex: 1 1 100%; }
.share-row select { flex: 1 1 9rem; min-width: 0; padding: 7px 8px; }
.number[hidden] { display: none; }
.tag-row { display: grid; gap: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag.removable { border: 0; cursor: pointer; }
.path { overflow-wrap: anywhere; }
.log-box { max-height: 26rem; overflow-y: auto; display: grid; gap: 6px; font-size: .8rem; }
.log-line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; overflow-wrap: anywhere; }
.log-line time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-line.warn span { color: var(--warn); }
.log-line.bad span { color: var(--bad); }
.small-note.bad, small.bad { color: var(--bad); }
.setting input[type="time"] { width: 6.5rem; padding: 7px 8px; }

/* goûts */
.sources-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .86rem; color: var(--muted); }
.sources-line strong { color: var(--text); }
.portrait { display: grid; gap: 12px; }
@media (min-width: 900px) { .portrait { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (min-width: 1300px) { .portrait { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pl { display: grid; gap: 1px; }
.pl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 8px; align-items: center; width: 100%; background: none; border: 0; text-align: left; padding: 6px 4px; border-radius: 8px; font-size: .88rem; }
button.pl-row:hover { background: var(--surface-2); }
.pl-bar { grid-column: 1 / -1; grid-row: 2; height: 4px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.pl-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.pl-share { color: var(--muted); font-size: .8rem; }
.thresholds { max-width: 640px; }
.histo { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); align-items: end; gap: 2px; height: 130px; }
.histo-col { height: 100%; display: flex; align-items: flex-end; }
.histo-col > span { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--surface-3); }
.histo-col.mid > span { background: var(--muted); }
.histo-col.high > span { background: var(--accent); }
.histo-axis { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); }
.histo-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .84rem; color: var(--muted); }
.legend strong { color: var(--text); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--surface-3); }
.legend i.mid { background: var(--muted); }
.legend i.high { background: var(--accent); }
.train-intro { max-width: 520px; margin: 0 auto; text-align: center; justify-items: center; padding: 24px; }

/* réglages */
.settings { gap: 0; padding: 4px 14px; }
.setting { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting strong { display: block; font-weight: 600; font-size: .92rem; }
.setting small { display: block; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); pointer-events: none; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.number { display: flex; align-items: center; gap: 6px; flex: none; }
.number input { width: 72px; text-align: right; padding: 7px 8px; }
.channel-row { flex-wrap: wrap; }
.channel-row .grow { flex: 1 1 14rem; min-width: 0; }
.channel-row select { flex: 0 1 13rem; min-width: 0; padding: 7px 8px; }
.dimmed { opacity: .55; }
.gap-top { margin-top: 10px; }
.small-note { font-size: .82rem; margin-top: 8px; }
.settings-shell { display: grid; gap: 20px; }
.settings-nav { display: grid; gap: 2px; align-content: start; }
.settings-link { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: var(--radius-sm); color: inherit; }
.settings-link:hover, .settings-link.on { background: var(--surface-2); }
.settings-link .grow { min-width: 0; }
.settings-link strong, .settings-link small { display: block; }
.settings-link strong { font-weight: 600; font-size: .95rem; }
.settings-link small.attention { color: var(--bad); }
.settings-link .go { display: flex; color: var(--muted); }
.settings-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; }
.settings-main { min-width: 0; }
.setting-link { color: inherit; }
.narrow { max-width: 44rem; }
@media (max-width: 999px) {
  .settings-shell.has-section .settings-nav { display: none; }
  .settings-shell:not(.has-section) .settings-main { display: none; }
  .settings-link.on { background: none; }
}
@media (min-width: 1000px) {
  .settings-shell { grid-template-columns: 250px minmax(0, 1fr); align-items: start; gap: 28px; }
  .settings-nav { position: sticky; top: 16px; margin-top: 24px; }
  .settings-back, .settings-link .go { display: none; }
}
@media (min-width: 1000px) and (max-width: 1399px) {
  .settings-main .columns.even { grid-template-columns: minmax(0, 1fr); }
}
.cat-picker { display: grid; gap: 12px; }
.cat-group { border: 0; padding: 0; margin: 0; display: grid; gap: 2px; min-width: 0; }
.cat-group legend { padding: 0 0 4px; font-weight: 600; color: var(--text); }
.cat-row { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--text); overflow-wrap: anywhere; }
.cat-row input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.cat-row input:disabled + span { color: var(--muted); }
.cat-all { font-weight: 600; }
.compare-list { display: grid; gap: 8px; padding: 11px 0; }
.compare-row { display: grid; gap: 2px; font-size: .86rem; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .channel-row .grow { flex-basis: calc(100% - 60px); }
  .channel-row select { flex: 1 1 100%; order: 3; }
}
.dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.dot.ok { background: var(--good-soft); color: var(--good); }
.dot.bad { background: var(--bad-soft); color: var(--bad); }
