/* Styles de l'appli, repris du prototype (design/prototype.html), source de vérité du rendu. */
/* Layout : appli mobile d'abord. Tab bar flottante en bas (couche fonctionnelle),
   qui devient une barre latérale au-delà de 960px. La couleur vermillon (encre de hanko)
   est réservée à l'action principale, à l'onglet actif et au sceau 推. */
* { box-sizing: border-box; }
html { height: 100%; accent-color: var(--shu); scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
body {
  margin: 0; min-height: 100%; background: var(--paper); color: var(--ink);
  font: 17px/1.45 var(--font-body); overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; margin: 0; }
p, li { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
:where(button, select, input:not([type="checkbox"], [type="radio"]), nav a, .row-link) { min-block-size: var(--target); min-inline-size: var(--target); }
:focus-visible { outline: 3px solid var(--shu); outline-offset: 2px; border-radius: 6px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Coquille ---------- */
.app { min-height: 100%; }
main {
  --gutter: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding: var(--top) var(--gutter) calc(110px + env(safe-area-inset-bottom, 0px));
  max-width: 980px; margin: 0 auto; overflow-x: clip;
}
.view-head { display: grid; gap: 2px; margin-bottom: 20px; }
.view-head h1 { font: 900 2.1rem/1.1 var(--font-display); letter-spacing: -0.01em; }
.view-head h1:focus { outline: none; }
.view-head p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }
.section { margin-block: 28px; display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font: 700 1.2rem/1.2 var(--font-display); }
.section-head span { color: var(--ink-2); font-size: 0.88rem; }

/* Tab bar flottante, matériau translucide uniquement ici */
.tabbar {
  position: fixed; z-index: 10; left: 50%; translate: -50% 0;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100% - 24px));
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  border-radius: 30px; padding: 6px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.14);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .tabbar { background: var(--surface); } }
@media (prefers-reduced-transparency: reduce) { .tabbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (prefers-contrast: more) { .tabbar { background: var(--surface); border-color: var(--ink); } }
.tabbar .brand { display: none; }
.tabbar ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a {
  display: grid; justify-items: center; gap: 1px; padding: 6px 2px 5px; border-radius: 22px;
  color: var(--ink-2); text-decoration: none; font-size: 0.68rem; font-weight: 600; min-block-size: 50px;
}
.tabbar a svg { width: 25px; height: 25px; fill: currentColor; }
.tabbar a[aria-current="page"] { color: var(--shu); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.badge { position: relative; }
.badge[data-count]::after {
  content: attr(data-count); position: absolute; top: -4px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: #E5352B; color: #fff; font-size: 0.66rem; line-height: 17px; text-align: center; font-weight: 700;
}

@media (min-width: 960px) {
  .tabbar {
    left: 0; translate: none; top: 0; bottom: 0; width: 248px; border-radius: 0; border-width: 0 1px 0 0;
    box-shadow: none; padding: 28px 14px; background: var(--surface);
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font: 900 1.5rem var(--font-display); }
  .tabbar ul { grid-template-columns: 1fr; gap: 2px; }
  .tabbar a { grid-auto-flow: column; justify-content: start; gap: 12px; font-size: 1rem; padding: 9px 12px; border-radius: 10px; min-block-size: 44px; }
  .tabbar a svg { width: 22px; height: 22px; }
  main { margin-left: 248px; max-width: none; --gutter: clamp(24px, 4vw, 56px); --top: 32px; padding-bottom: 48px; }
  main > :not(.bleed) { max-width: 920px; }
  main > .bleed > * { max-width: 920px; }
}

/* ---------- Sceau 推 (élément signature) ---------- */
.seal {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  border: 2.5px solid var(--shu); color: var(--shu); rotate: -8deg;
  font: 900 1.25rem/1 var(--font-display);
  background: color-mix(in srgb, var(--shu) 6%, transparent);
}
.seal.lg { width: 76px; height: 76px; font-size: 2.6rem; border-width: 4px; border-radius: 16px; }

/* ---------- Affiches (provisoires : les vraies viennent d'AniList) ---------- */
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; flex: none;
  background: linear-gradient(155deg, var(--c1, #6B6B75), var(--c2, #B9B9C2));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}
.cover .glyph { position: absolute; inset: 6% 0 auto; text-align: center; font: 900 clamp(2rem, 40cqi, 5rem)/1 var(--font-display); color: rgb(255 255 255 / 0.85); mix-blend-mode: soft-light; }
.cover .cap {
  position: absolute; inset: auto 0 0; padding: 30% 8% 8%; color: #fff; font: 700 0.78rem/1.15 var(--font-display);
  background: linear-gradient(transparent, rgb(0 0 0 / 0.72));
}
.cover { container-type: inline-size; }
.cover.sm { width: 52px; } .cover.sm .cap { display: none; }
.cover.md { width: 92px; }

/* ---------- Cartes reco ---------- */
.reco-rail { display: grid; grid-auto-flow: column; grid-auto-columns: min(86%, 380px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
@media (min-width: 960px) { .reco-rail { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); overflow: visible; margin: 0; padding: 0; } }
.reco {
  scroll-snap-align: start; container-type: inline-size; position: relative;
  background: var(--surface); border-radius: var(--radius); padding: 14px; border: 1px solid var(--line);
  display: grid; grid-template-columns: 92px 1fr; gap: 6px 14px; align-content: start;
}
.reco > .cover { grid-row: 1 / span 3; }
.reco header { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.86rem; padding-right: 40px; }
.reco h3 { font: 700 1.08rem/1.25 var(--font-display); }
.reco h3 a { color: inherit; text-decoration: none; }
.reco h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.reco:has(h3 a:focus-visible) { outline: 3px solid var(--shu); outline-offset: 2px; }
.reco h3 a:focus-visible { outline: none; }
.reco blockquote { margin: 0; font-size: 0.93rem; color: var(--ink); }
.reco blockquote::before { content: "« "; } .reco blockquote::after { content: " »"; }
.reco footer { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.reco footer button { position: relative; z-index: 1; }
.reco .seal { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; font-size: 1.05rem; }
.reco .state { font-size: 0.8rem; font-weight: 700; color: var(--shu); }

.avatar {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--av, #888); color: #fff; font: 700 0.7rem var(--font-body);
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer;
  padding: 0 16px; min-block-size: max(var(--target), 40px); border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); text-decoration: none;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.btn.primary { background: var(--shu); color: var(--on-shu); }
.btn.primary:hover { background: color-mix(in srgb, var(--shu) 88%, var(--ink)); }
.btn.tinted { background: var(--shu-tint); color: var(--shu); }
.btn.sm { min-block-size: var(--target); padding: 0 12px; font-size: 0.86rem; }
.btn.danger { color: #B42318; }
@media (prefers-color-scheme: dark) { .btn.danger { color: #FF6B60; } }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

.dice {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px;
  background: var(--shu-tint); color: var(--ink); border: 0; border-radius: var(--radius); cursor: pointer;
}
.dice strong { display: block; font: 700 1.05rem var(--font-display); color: var(--shu); }
.dice span { font-size: 0.88rem; color: var(--ink-2); }
.dice .seal { flex: none; }

/* ---------- Listes groupées (style réglages) ---------- */
.group { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.group > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-block-size: 52px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--ink-2); font-size: 0.85rem; }
.row-link { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; padding: 0; }
.chev { color: var(--ink-2); flex: none; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; width: 3.2em; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Segmented control */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: color-mix(in srgb, var(--ink) 7%, transparent); overflow-x: auto; }
.seg label { flex: 1 0 auto; display: grid; place-items: center; padding: 6px 12px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer; white-space: nowrap; min-block-size: var(--target); color: var(--ink-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.14); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--shu); outline-offset: 1px; }

/* Progression */
.progress { display: grid; gap: 4px; }
.bar { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.plus { width: 44px; height: 44px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); font-weight: 700; cursor: pointer; flex: none; }

/* Interrupteurs */
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: color-mix(in srgb, var(--ink) 18%, transparent); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 0.25); transition: translate 0.2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { translate: 20px 0; }

/* Grille d'affiches */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.tile { color: inherit; text-decoration: none; display: grid; gap: 6px; }
.tile .cover { width: 100%; }
.tile span { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.tile:hover .cover { outline: 2px solid var(--shu); outline-offset: 2px; }

/* ---------- Fiche anime ---------- */
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--shu); text-decoration: none; font-weight: 600; margin-bottom: 12px; background: none; border: 0; padding: 0; cursor: pointer; }
.hero { container-type: inline-size; }
.hero-in { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: end; }
@container (min-width: 560px) { .hero-in { grid-template-columns: 200px 1fr; gap: 28px; } }
.hero h1 { font: 900 clamp(1.7rem, 6cqi, 2.6rem)/1.08 var(--font-display); }
.hero h1:focus { outline: none; }
.hero .jp { color: var(--ink-2); font-family: var(--font-display); margin: 4px 0 8px; }
.hero .meta { color: var(--ink-2); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.select { appearance: none; padding: 0 36px 0 16px; border-radius: 999px; border: 0; min-block-size: max(var(--target), 40px); font-weight: 600; font-size: 0.95rem;
  background: color-mix(in srgb, var(--ink) 7%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center; }
.source { font-size: 0.78rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.synopsis { margin: 0; max-width: 62ch; }
.provider { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 0.92rem; }
.provider i { width: 26px; height: 26px; border-radius: 7px; background: var(--pc); display: grid; place-items: center; color: #fff; font-style: normal; font-size: 0.75rem; font-weight: 800; }

/* ---------- Admin ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.off { color: var(--ink-2); background: color-mix(in srgb, var(--ink) 8%, transparent); }
code { font: 600 0.84rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
[popover].menu {
  margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18); min-width: 230px;
  position-area: block-end span-inline-start; position-try-fallbacks: flip-block;
}
[popover].menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
[popover].menu button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }

/* ---------- Dialogs (feuilles) ---------- */
dialog {
  border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, 100%);
  border-radius: 20px; max-height: min(88dvh, 760px);
}
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgb(0 0 0 / 0.42); overflow: hidden; overscroll-behavior: contain; }
@media (max-width: 600px) {
  dialog:modal { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-bar::before { content: ""; position: absolute; top: 5px; left: 50%; translate: -50% 0; width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 20%, transparent); }
.sheet-bar h2 { font: 700 1rem var(--font-display); text-align: center; }
.sheet-bar .end { justify-self: end; } .sheet-bar .start { justify-self: start; }
.sheet-body { padding: 18px 16px 22px; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.input { border: 1px solid var(--line); background: var(--paper); border-radius: 11px; padding: 10px 12px; min-block-size: 44px; width: 100%; }
textarea.input { min-block-size: 90px; resize: vertical; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pick label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; font-weight: 600; font-size: 0.92rem; min-block-size: 48px; }
.pick label:has(:checked) { border-color: var(--shu); }
.pick input { margin: 0 0 0 auto; width: 20px; height: 20px; }
.hint { font-size: 0.85rem; color: var(--ink-2); margin: 0; }

/* Tirage au hasard */
.draw { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; padding: 14px; background: var(--paper); border-radius: var(--radius); }
.draw h3 { font: 700 1.2rem/1.2 var(--font-display); }
.draw p { margin: 4px 0 0; font-size: 0.88rem; color: var(--ink-2); }

/* Toast + sceau tamponné */
#toast { margin: 0; inset: auto 0 calc(96px + env(safe-area-inset-bottom, 0px)); margin-inline: auto; border: 0; padding: 12px 18px 12px 12px; border-radius: 16px; background: var(--ink); color: var(--paper); display: none; align-items: center; gap: 12px; max-width: min(420px, calc(100% - 32px)); box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); font-weight: 600; font-size: 0.94rem; }
#toast:popover-open { display: flex; }
#toast .seal { color: var(--shu); border-color: var(--shu); background: var(--paper); }
@media (min-width: 960px) { #toast { inset-block-end: 28px; } }
@media (prefers-reduced-motion: no-preference) {
  #toast:popover-open .seal.stamp { animation: stamp 0.42s cubic-bezier(.2,.9,.3,1.3) both; }
  @keyframes stamp { from { scale: 1.9; opacity: 0; rotate: -24deg; } to { scale: 1; opacity: 1; rotate: -8deg; } }
}

.empty { text-align: center; color: var(--ink-2); padding: 28px 12px; }
footer.credits { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.78rem; display: grid; gap: 4px; }
footer.credits a { color: inherit; }


/* ---------- Barre latérale (≥ 960px) ---------- */
.side-amb, .side-extra, .tabbar .ind, .tabbar .brand small, .tabbar .count { display: none; }
@media (min-width: 960px) {
  .tabbar { display: flex; flex-direction: column; overflow: hidden auto; isolation: isolate; scrollbar-width: thin;
    background: color-mix(in srgb, var(--surface) 82%, var(--paper)); border-right: 1px solid var(--line); }
  .side-amb { display: block; position: absolute; inset: 0 0 auto; height: 280px; z-index: -1; pointer-events: none;
    background: radial-gradient(70% 80% at 20% 10%, var(--c1, #888), transparent 70%), radial-gradient(70% 80% at 95% 25%, var(--c2, #aaa), transparent 70%);
    filter: blur(30px) saturate(1.2); opacity: 0.45; -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent);
    transition: opacity 0.6s; }
  .side-amb::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--ink) 12%, transparent) 0.8px, transparent 1.2px); background-size: 6px 6px; }
  .tabbar .brand { align-items: center; gap: 12px; }
  .tabbar .brand > span:last-child { display: grid; line-height: 1; }
  .tabbar .brand small { display: block; font: 600 0.7rem var(--font-body); color: var(--ink-2); letter-spacing: 0.02em; margin-top: 4px; }
  .main-nav { position: relative; }
  .tabbar .ind { display: block; position: absolute; left: 0; right: 0; top: 0; height: 44px; border-radius: 10px; z-index: -1;
    background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 14px -6px rgb(0 0 0 / 0.18); border: 1px solid var(--line);
    translate: 0 var(--y, 0); opacity: var(--o, 0); transition: translate 0.32s cubic-bezier(.3,.8,.3,1), opacity 0.2s; }
  .tabbar .ind::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--shu); }
  .tabbar a[aria-current="page"] { background: none; color: var(--ink); }
  .tabbar a[aria-current="page"] svg { color: var(--shu); }
  .tabbar a:not([aria-current="page"]):hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
  .tabbar .count { display: inline-grid; place-items: center; margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--shu); color: var(--on-shu); font-size: 0.72rem; font-weight: 800; }
  .tabbar .badge[data-count]::after { display: none; }
  .side-extra { display: grid; gap: 22px; margin-top: 26px; padding-inline: 4px; }
  .side-extra h2 { font: 700 0.7rem var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); padding: 0 8px 6px; }
  .side-extra ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .side-extra a, .me a { justify-items: stretch; justify-content: stretch; grid-auto-flow: row; text-align: left; color: var(--ink); }
  .side-extra a { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; color: inherit; text-decoration: none; font-size: 0.86rem; font-weight: 600; min-block-size: 44px; }
  .side-extra a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .cover.xs { width: 30px; border-radius: 6px; }
  .cover.xs .glyph { font-size: 1rem; inset: 14% 0 auto; } .cover.xs .cap, .cover.xs .tag { display: none; }
  .cover.xs::before { background-size: 3px 3px; }
  .side-extra .mini { display: grid; gap: 4px; min-width: 0; }
  .side-extra .mini span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-extra .mini .bar { height: 3px; }
  .side-extra .mini small { color: var(--ink-2); font-weight: 500; font-size: 0.74rem; }
  .side-extra .air { color: var(--shu); font-weight: 700; }
  .me { margin-top: auto; padding-top: 18px; }
  .me a { display: grid; grid-template-columns: auto 1fr auto; font-size: 1rem; min-block-size: 0; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; }
  .me a:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
  .me .who { display: grid; line-height: 1.2; min-width: 0; }
  .me .who b { font-size: 0.92rem; } .me .who small { color: var(--ink-2); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .me .cover.xs { width: 30px; border-radius: 6px; }
}
@media (min-width: 960px) and (prefers-reduced-motion: reduce) { .tabbar .ind { transition: none; } }
@media (min-width: 960px) and (prefers-reduced-transparency: reduce) { .side-amb { filter: none; opacity: 0.18; } }

/* =========================================================
   v2 : la couleur vit dans le contenu (affiches, halos), la trame
   de manga (screentone) sert de matière, le sceau 推 marque ton oshi.
   ========================================================= */
.cover { isolation: isolate; }
.cover::before { /* trame de points façon manga, qui s'efface vers le haut */
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: radial-gradient(rgb(0 0 0 / 0.32) 0.9px, transparent 1.3px);
  background-size: 5px 5px;
  -webkit-mask-image: linear-gradient(200deg, transparent 35%, #000 85%); mask-image: linear-gradient(200deg, transparent 35%, #000 85%);
  mix-blend-mode: multiply;
}
.cover::after { /* reflet + filet intérieur, comme un papier glacé */
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  background: linear-gradient(118deg, transparent 38%, rgb(255 255 255 / 0.16) 39% 44%, transparent 45%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12), inset 0 -1px 0 rgb(0 0 0 / 0.25);
}
.cover .glyph { z-index: 1; mix-blend-mode: normal; color: rgb(255 255 255 / 0.9); text-shadow: 0 2px 0 rgb(0 0 0 / 0.15); font-size: clamp(1.6rem, 52cqi, 6rem); inset: 9% 0 auto; }
.cover .cap { z-index: 1; }
.cover .tag { position: absolute; z-index: 1; top: 7%; left: 8%; font: 700 0.56rem/1 var(--font-body); letter-spacing: 0.12em; color: rgb(255 255 255 / 0.85); writing-mode: vertical-rl; }
.cover.sm .tag, .cover.sm .glyph { font-size: 1.6rem; } .cover.sm .tag { display: none; }
.cover .prog { position: absolute; z-index: 3; inset: auto 6px 6px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 0.3); overflow: hidden; }
.cover .prog i { display: block; height: 100%; background: #fff; }
.cover.lift { box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.45), 0 4px 10px rgb(0 0 0 / 0.12); }
.cover .seal-on { position: absolute; z-index: 3; right: 8%; bottom: 22%; width: 34%; aspect-ratio: 1; height: auto; font-size: clamp(0.9rem, 18cqi, 2.2rem); border-width: clamp(2px, 1.6cqi, 4px); background: rgb(255 255 255 / 0.9); color: #C2301A; border-color: #C2301A; }

/* Pleine largeur + halo coloré tiré de l'affiche */
.bleed { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.bleed-top { margin-top: calc(-1 * var(--top)); padding-top: var(--top); }
.ambient { position: relative; isolation: isolate; --amb: 0.55; }
.ambient::before {
  content: ""; position: absolute; inset: 0 0 -40px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 70% at 18% 35%, var(--c1), transparent 72%),
    radial-gradient(55% 70% at 85% 15%, var(--c2), transparent 72%),
    radial-gradient(80% 60% at 50% 80%, var(--c1), transparent 75%);
  filter: blur(36px) saturate(1.25); opacity: var(--amb);
  -webkit-mask-image: linear-gradient(#000 45%, transparent); mask-image: linear-gradient(#000 45%, transparent);
}
.ambient::after { /* trame très légère dans le halo */
  content: ""; position: absolute; inset: 0 0 -40px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 0.8px, transparent 1.2px); background-size: 6px 6px;
  -webkit-mask-image: linear-gradient(160deg, #000, transparent 60%); mask-image: linear-gradient(160deg, #000, transparent 60%);
}
.ambient { --ink-2: color-mix(in srgb, var(--ink) 80%, transparent); }
@media (prefers-reduced-transparency: reduce) { .ambient::before { filter: none; opacity: 0.25; } }

.eyebrow { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }

/* Accueil : reco à la une */
.feature { padding-bottom: 8px; }
.feature-card { position: relative; display: grid; grid-template-columns: 128px 1fr; gap: 18px; align-items: end; margin-top: 14px; container-type: inline-size; }
@media (min-width: 640px) { .feature-card { grid-template-columns: 176px 1fr; gap: 28px; } }
.feature-card h2 { font: 900 clamp(1.45rem, 5vw, 2.2rem)/1.08 var(--font-display); }
.feature-card h2 a { color: inherit; text-decoration: none; }
.feature-card h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.feature-card .jp { margin: 4px 0 0; color: var(--ink-2); font: 500 0.9rem var(--font-display); }
.quote { margin: 14px 0 0; font: 700 1.05rem/1.4 var(--font-display); position: relative; padding-left: 14px; border-left: 3px solid var(--shu); }
.quote cite { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 600 0.85rem var(--font-body); color: var(--ink-2); font-style: normal; }
.feature-card .actions { margin-top: 16px; }
.feature-card > .seal { position: absolute; top: -6px; right: 0; }
@media (max-width: 480px) { .feature-card { grid-template-columns: 1fr; } .feature-card .cover { width: 46%; } .feature-card > .seal { top: 4px; } }

/* Étagères horizontales */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 118px; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding-block: 4px 10px; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.shelf > * { scroll-snap-align: start; }
.shelf a { color: inherit; text-decoration: none; display: grid; gap: 6px; align-content: start; }
.shelf .cover { width: 100%; transition: translate 0.2s; }
.shelf a:hover .cover { translate: 0 -3px; }
.shelf .t { font-weight: 650; font-size: 0.88rem; line-height: 1.2; }
.shelf .s { font-size: 0.78rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.shelf .s .avatar { width: 18px; height: 18px; font-size: 0.55rem; }

/* Rangée « je sais pas quoi regarder » */
.dice { background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.dice::after { content: "?"; position: absolute; right: 18px; top: 50%; translate: 0 -50%; font: 900 3.4rem var(--font-display); color: color-mix(in srgb, var(--shu) 14%, transparent); }

/* Timeline des épisodes */
.tl { display: grid; gap: 0; }
.tl .day { font: 700 0.78rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding: 14px 0 6px; }
.tl .ep { display: grid; grid-template-columns: 3.4em 52px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.tl .ep .time { font: 900 1.05rem var(--font-display); width: auto; }

/* Profil : en-tête + top */
.prof { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding-bottom: 10px; }
.prof h1 { font: 900 2rem/1.1 var(--font-display); }
.prof h1:focus { outline: none; }
.prof p { margin: 2px 0 0; color: var(--ink-2); font-size: 0.9rem; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.top1 { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: end; color: inherit; text-decoration: none; }
@media (min-width: 640px) { .top1 { grid-template-columns: 200px 1fr; } }
.rank { font: 900 1.5rem/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 1.4em; text-align: right; }
.top1 .rank { font-size: clamp(4rem, 16vw, 6.5rem); color: var(--ink); text-align: left; line-height: 0.85; letter-spacing: -0.04em; }
.top1 h3 { font: 900 clamp(1.3rem, 4.5vw, 1.9rem)/1.1 var(--font-display); margin-top: 6px; }
.top1 .eyebrow { color: var(--shu); }
.top23 { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 14px; }
.top23 a { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: end; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.top23 .rank { font-size: 2.4rem; color: var(--ink); text-align: left; }
.top23 .cover { grid-column: 1 / -1; width: 100%; aspect-ratio: 16 / 10; }
.top23 .cover .cap { display: none; } .top23 .cover .glyph { font-size: 3rem; inset: 18% 0 auto; }
.top23 h3 { font: 700 0.98rem/1.2 var(--font-display); justify-self: start; text-align: left; padding-bottom: 4px; }
.toprest { list-style: none; margin: 0; padding: 0; }
.toprest a, .toprest .edit-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.toprest .title { font-weight: 650; }
.edit-row { padding-inline: 12px !important; background: var(--surface); }
.edit-row[draggable="true"] { cursor: grab; }
.edit-row.dragging { opacity: 0.4; }
.edit-row.over { box-shadow: inset 0 3px 0 var(--shu); }
.edit-row .grow { flex: 1; min-width: 0; }
.edit-row .handle { color: var(--ink-2); font-size: 1.1rem; letter-spacing: -3px; padding-right: 4px; }
.edit-row .ctl { display: flex; gap: 4px; }
.edit-row .ctl button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); cursor: pointer; font-size: 1rem; }
.edit-row .ctl button:disabled { opacity: 0.3; cursor: default; }
@media (pointer: coarse) { .edit-row .ctl button { width: 44px; height: 44px; } }
#top-edit { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#top-edit > li:first-child { border-top: 0; }

/* Semaine (saison) */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week label { display: grid; justify-items: center; gap: 2px; padding: 8px 0; border-radius: 12px; cursor: pointer; color: var(--ink-2); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.week label b { font: 900 1.2rem var(--font-display); color: var(--ink); text-transform: none; letter-spacing: 0; }
.week input { position: absolute; opacity: 0; pointer-events: none; }
.week label:has(input:checked) { background: var(--ink); color: var(--paper); }
.week label:has(input:checked) b { color: var(--paper); }
.week label:has(input:focus-visible) { outline: 3px solid var(--shu); outline-offset: 2px; }
.week label .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--shu); }
.week label .dot.none { background: transparent; }

/* Fiche : en-tête pleine largeur */
.hero.bleed { padding-bottom: 6px; }
.hero .cover.lift { width: 100%; }

::view-transition-old(cover-hero), ::view-transition-new(cover-hero) { height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .switch, .switch::after { transition: none; }
}

/* ---------- Ajouts de production : remplacent les attributs style du prototype (CSP) ---------- */
.section.tight { gap: 0; }
.tl .ep .title { display: block; font-weight: 650; }
.tl .ep .sub { color: var(--ink-2); font-size: 0.85rem; }
.seal.md { width: 44px; height: 44px; font-size: 1.4rem; }
.avatar.md { width: 34px; height: 34px; }
.center { text-align: center; }
/* La carte profil n'existe que dans la barre latérale. */
@media (max-width: 959px) { .tabbar .me { display: none; } }

/* ---------- Comptes (L1) ---------- */
.auth { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 24px; padding: 32px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; display: grid; gap: 16px; }
.auth-card > .seal { justify-self: center; margin-bottom: 4px; }
.auth-card h1 { font: 900 1.8rem/1.15 var(--font-display); text-align: center; }
.auth-card p { margin: 0; }
.auth footer.credits { margin-top: 0; width: min(420px, 100%); }
.stack { display: grid; gap: 14px; }
.btn.block { width: 100%; }
.notice { margin: 0; padding: 10px 14px; border-radius: 11px; font-weight: 600; font-size: 0.92rem; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.notice.err { color: var(--shu); background: var(--shu-tint); }
fieldset.field { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
fieldset.field > legend { font-size: 0.86rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 6px; }
.row.invite { align-items: flex-start; flex-wrap: wrap; }
.row.invite .grow { display: grid; gap: 3px; min-width: 200px; }
.row .line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.off .title { color: var(--ink-2); }
.row .actions, .menu .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 0; }
.actions form { display: contents; }
[popover].menu form { margin: 0; }
[popover].menu button.danger { color: #B42318; }
@media (prefers-color-scheme: dark) { [popover].menu button.danger { color: #FF6B60; } }
[popover].menu.confirm { padding: 14px; max-width: min(340px, calc(100vw - 32px)); }
[popover].menu.confirm p { margin: 0 0 12px; }
[popover].menu.confirm .actions { justify-content: flex-end; }
[popover].menu.confirm .actions button { display: inline-grid; width: auto; place-items: center; padding: 0 12px; }
.shown { padding: 16px; border-radius: var(--radius); border: 2px solid var(--shu); background: var(--surface); }
.shown h2 { font: 700 1.05rem var(--font-display); }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font: 600 0.84rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.auth-card a:not(.btn) { color: var(--shu); font-weight: 600; }

/* ---------- Catalogue (L2) ---------- */
/* Vraies affiches : image sous la trame (opacité divisée par deux) et le reflet. */
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.cover.has-img::before { z-index: 1; opacity: 0.5; }
.synopsis + .synopsis { margin-top: 0.8em; }
.provider img { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.provider small { color: var(--ink-2); font-weight: 500; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.related .tile small { color: var(--ink-2); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.search-form { display: flex; gap: 8px; }
.search-form .input { flex: 1; }
.notice.warn { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.source a { color: inherit; }

/* ---------- Liste et top (L3) ---------- */
.js [data-nojs] { display: none; }
.row .progress { min-width: 0; }
.row form { margin: 0; }
.top-edit { list-style: none; margin: 0; padding: 0; }
.top-edit .edit-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.top-edit .title { flex: 1; min-width: 0; font-weight: 600; }
.top-edit .ctl { display: flex; gap: 4px; }
.top-edit .ctl form { display: contents; }
.top-edit .ctl button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); font-weight: 700; cursor: pointer; }
.top-edit .ctl button:disabled { opacity: 0.35; cursor: default; }
.settings-form { display: grid; gap: 12px; }
.settings-form .row-end { display: flex; justify-content: flex-end; }

/* Fiche : l'affiche, agrandie et floutée, en fond de l'en-tête (sous le halo). */
.hero-bg { position: absolute; inset: 0 0 -40px; z-index: -2; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.35); filter: blur(42px) saturate(1.3); opacity: 0.5; }
@media (prefers-color-scheme: dark) { .hero-bg img { opacity: 0.42; } }
@media (prefers-reduced-transparency: reduce) { .hero-bg { display: none; } }
.seg a { flex: 1 0 auto; display: grid; place-items: center; padding: 6px 12px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; white-space: nowrap; min-block-size: var(--target); color: var(--ink-2); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.14); }
.top1 .jp { margin: 4px 0 0; color: var(--ink-2); font-family: var(--font-display); }
main > .bleed > .hero-bg { max-width: none; }

/* ---------- Recos (L4) ---------- */
html:not(.js) .js-only { display: none; }
.dice-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.feature-card .actions form { display: contents; }
.draw p { display: flex; align-items: center; gap: 6px; }
.draw .avatar { width: 20px; height: 20px; font-size: 0.6rem; }
.reco-seal { font-family: var(--font-display); font-weight: 900; }

/* ---------- Saison et notifications (L5) ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .week { flex: 1; }
.week-nav .icon-btn { font-size: 1.4rem; font-weight: 700; flex: none; }
.week a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: 0.78rem; font-weight: 600; min-block-size: var(--target); }
.week a b { font: 700 1.05rem var(--font-display); color: var(--ink); }
.week a[aria-current="date"] { background: var(--ink); color: var(--paper); }
.week a[aria-current="date"] b { color: var(--paper); }
.row .time { font: 900 1.05rem var(--font-display); font-variant-numeric: tabular-nums; min-width: 3.2em; }
.stack-link { display: grid; gap: 2px; }
.row.unread .title { font-weight: 700; }
.row-link .grow { display: grid; gap: 2px; min-width: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-block-size: 52px; cursor: pointer; }
.switch-row .grow { display: grid; gap: 2px; }
.week a .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--shu); }
.week a .dot.none { background: transparent; }
.week a[aria-current="date"] .dot { background: var(--paper); }
.week a[aria-current="date"] .dot.none { background: transparent; }
.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bell { position: relative; flex: none; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--shu); color: var(--on-shu); font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; }

/* ---------- Appli et push (L7) ---------- */
.push-box { margin-top: 12px; }
.install-row .grow { display: grid; gap: 2px; }

/* ---------- Finitions (L8) ---------- */
/* Transitions de vue entre les pages (DESIGN.md § 10) : fondu, et l'affiche cliquée devient
   l'affiche de la fiche. Rien sous prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .vt-hero .cover { view-transition-name: cover-hero; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
  ::view-transition-group(cover-hero) { animation-duration: 0.32s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
}
:focus-visible { outline: 3px solid var(--shu); outline-offset: 2px; }

/* Streaming links and season catalogue */
a.provider { color: inherit; text-decoration: none; }
a.provider:hover { border-color: var(--shu); }
.provider .ext { color: var(--ink-2); font-size: 0.8rem; }
.btn.watch { text-decoration: none; }
.season-views { margin-block-end: 12px; }
.season-pick { margin-block-end: 16px; max-inline-size: 420px; }
.season-grid .tile small { color: var(--ink-2); font-size: 0.78rem; line-height: 1.2; }
.season-grid .tile.mine small { color: var(--shu); font-weight: 650; }
