/* КАРАМБА films — тёмный «пиратский» стиль: почти чёрный фон, пергамент, потёртое золото */
@font-face {
  font-family: "Manrope"; src: url("/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
:root {
  --bg: #0b0a09; --bg2: #110f0c; --card: #15120f; --card2: #1b1712; --line: #2e271e; --line2: #3d3326;
  --text: #e4d6bb; --parch: #d9c8a9; --muted: #a6957a; --faint: #6f634f;
  --gold: #b8924a; --gold2: #d6b46e; --gold-dim: #7d6332;
  --ok: #9fb26c; --warn: #d39a45; --bad: #b4513f; --bad2: #8e3b2d; --info: #8fa8b3;
  --bar-bg: #262017; --shadow: 0 1px 0 rgba(217,200,169,.04) inset, 0 10px 30px rgba(0,0,0,.45);
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --serif: var(--sans);   /* заголовки — тот же гротеск, только вес и размер */
  --ease: cubic-bezier(.22,.8,.26,1);
  --radius: 14px; --tap: 44px; --side: 248px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .78 0 0 0 0 .66 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-op: .05;
  color-scheme: dark;
}
/* светлая тема — «пергамент» */
:root[data-theme="light"] {
  --bg: #e8dcc2; --bg2: #e1d3b5; --card: #f1e7d0; --card2: #eadfc4; --line: #cdbb98; --line2: #bba57c;
  --text: #2b2117; --parch: #3a2d1f; --muted: #6b5a42; --faint: #998566;
  --gold: #8a6420; --gold2: #a57a2c; --gold-dim: #c7a868;
  --ok: #4f6b26; --warn: #9a6512; --bad: #9c3b2b; --bad2: #7d2d20; --info: #3e6272;
  --bar-bg: #d8c9a8; --shadow: 0 1px 2px rgba(60,40,10,.12), 0 8px 24px rgba(60,40,10,.10);
  --grain-op: .10; color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; color: var(--text); min-height: 100vh;
  font: 15px/1.45 var(--sans); font-variant-numeric: tabular-nums;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0,0,0,.45) 100%),
    radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; background-image: var(--grain); opacity: var(--grain-op); mix-blend-mode: overlay; }
:root[data-theme="light"] body::before { mix-blend-mode: multiply; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold2); }
h1, h2, h3, h4, .serif { font-family: var(--sans); font-weight: 800; letter-spacing: -.02em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { position: relative; z-index: 1; }
aside.side { display: none; }
.mtop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); }
.mtop img { width: 38px; height: 38px; border-radius: 8px; }
.mtop .name { font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--parch); letter-spacing: .06em; line-height: 1; }
.mtop .name small { display: block; font-size: 12px; letter-spacing: .25em; color: var(--muted); font-weight: 500; margin-top: 2px; }
.mtop .speeds { margin-left: auto; display: grid; justify-items: end; font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.mtop .speeds .d { color: var(--ok); } .mtop .speeds .u { color: var(--info); }
.mtop .tools { display: flex; gap: 4px; }
main.view-wrap { position: relative; z-index: 1; padding: 14px 12px 100px; max-width: 1700px; margin: 0 auto; }

@media (min-width: 1000px) {
  .mtop { display: none; }
  aside.side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 20; padding: 18px 14px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg2) 94%, transparent), color-mix(in srgb, var(--bg) 96%, transparent));
    border-right: 1px solid var(--line); gap: 14px; overflow-y: auto; }
  main.view-wrap { margin-left: var(--side); padding: 22px 28px 40px; max-width: none; }
}
.logo-big { display: block; width: 168px; height: 168px; margin: -6px auto 0; border-radius: 12px; }
.logo-big, .login-logo, .mtop img { mix-blend-mode: lighten; }
:root[data-theme="light"] .logo-big, :root[data-theme="light"] .mtop img, :root[data-theme="light"] .login-logo { filter: invert(1) sepia(.6) saturate(.7) brightness(.95); mix-blend-mode: multiply; }
.side-sub { text-align: center; font-family: var(--serif); letter-spacing: .3em; color: var(--muted); font-size: 13px; margin-top: -10px; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 0 14px; min-height: 46px; border-radius: 10px; text-decoration: none; color: var(--muted);
  font-family: var(--serif); font-size: 20px; font-weight: 600; border: 1px solid transparent; transition: background .15s, color .15s; }
.nav a:hover { color: var(--parch); background: color-mix(in srgb, var(--gold) 7%, transparent); }
.nav a.on { color: var(--parch); background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 20%, transparent), transparent); border-color: color-mix(in srgb, var(--gold) 28%, transparent); }
.nav a.on svg { color: var(--gold2); }
.nav .n { margin-left: auto; font-family: var(--sans); font-size: 11.5px; font-weight: 700; background: var(--gold); color: #120e08; border-radius: 999px; padding: 1px 7px; }
.side-stats { margin-top: auto; display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--card) 70%, transparent); font-size: 13px; }
.side-stats .r { display: flex; align-items: center; gap: 8px; }
.side-stats .r b { font-weight: 700; margin-left: auto; }
.side-stats .d svg { color: var(--ok); } .side-stats .u svg { color: var(--info); }
.diskbar { height: 5px; border-radius: 3px; background: var(--bar-bg); overflow: hidden; }
.diskbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.health { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.side-tools { display: flex; gap: 6px; }
.side-tools .btn { flex: 1; }

/* ---------- view header ---------- */
.vh { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.vh h1 { margin: 0; font-size: 36px; line-height: 1.05; color: var(--parch); }
.vh .sp { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .vh h1 { font-size: 29px; } .vh .sp .t { display: none; } .vh .sp .btn { padding: 0; } }

/* ---------- buttons ---------- */
.btn { min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--card2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font-weight: 600; transition: background .15s, border-color .15s, transform .08s, color .15s; white-space: nowrap; color: var(--text); text-decoration: none; }
.btn:hover { border-color: var(--gold-dim); color: var(--parch); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible, .pcard:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.btn.icon { padding: 0; }
.btn.sm { min-height: 36px; min-width: 36px; padding: 0 10px; font-size: 13.5px; border-radius: 9px; }
.btn.sm.icon { padding: 0; }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); border-color: var(--gold); color: #17110a; }
.btn.primary:hover { color: #000; filter: brightness(1.06); }
.btn.danger { color: #d9826f; border-color: color-mix(in srgb, var(--bad) 45%, var(--line2)); }
:root[data-theme="light"] .btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad2); border-color: var(--bad); color: #f4e6d4; }
.btn.on { background: color-mix(in srgb, var(--gold) 18%, var(--card2)); border-color: var(--gold-dim); color: var(--gold2); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.seg { display: inline-flex; background: var(--card2); border: 1px solid var(--line2); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 38px; padding: 0 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 35%, var(--card)), color-mix(in srgb, var(--gold) 20%, var(--card))); color: var(--parch); }

/* ---------- panels ---------- */
.grid2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1400px) { .grid2 { grid-template-columns: minmax(0, 1fr) 420px; } }
.col { display: grid; gap: 18px; min-width: 0; }
section.panel { position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--card) 96%, var(--gold) 4%), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.ph { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.ph h2 { font-size: 24px; margin: 0; color: var(--parch); line-height: 1.1; }
.ph .count { background: var(--card2); border: 1px solid var(--line2); color: var(--muted); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.ph .sp { margin-left: auto; display: flex; gap: 6px; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; font-family: var(--serif); font-size: 19px;  }
.err { color: #d9826f; font-size: 13px; padding: 6px 2px; }

/* ---------- torrent cards ---------- */
.tgrid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1800px) { .tgrid.multi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tcard { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px;
  grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.poster { width: 58px; aspect-ratio: 2/3; border-radius: 6px; background: var(--bar-bg); overflow: hidden; display: grid; place-items: center; color: var(--faint); border: 1px solid var(--line); }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster.sm { width: 42px; border-radius: 5px; }
.tbody { min-width: 0; display: grid; gap: 8px; }
.tbody > *, .item .main > *, .prow { min-width: 0; }
.ttl { font-weight: 700; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; color: var(--parch); }
.ttl.serif { font-size: 22px; font-weight: 700; }
.rel { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow { display: flex; align-items: center; gap: 10px; }
.bar { position: relative; flex: 1; height: 10px; border-radius: 6px; background: var(--bar-bg); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold) 60%, var(--gold2)); transition: width .9s cubic-bezier(.3,.7,.3,1); }
.tcard.paused .bar > i { background: var(--faint); }
.tcard.stalled .bar > i { background: linear-gradient(90deg, #6d4a22, var(--warn)); }
.tcard.active .bar > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,240,200,.25), transparent); animation: shine 2.4s linear infinite; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } .tcard.active .bar > i::after { animation: none; } }
.pct { font-family: var(--serif); font-weight: 700; min-width: 58px; text-align: right; font-size: 23px; color: var(--gold2); line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; font-weight: 600; }
.chip svg.i { width: 14px; height: 14px; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.chip.bad { color: #d9826f; border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
:root[data-theme="light"] .chip.bad { color: var(--bad); }
.chip.acc { color: var(--gold2); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.chip.strong { color: var(--text); }
.watch { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ok); overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--ok) 9%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); padding: 6px 10px; border-radius: 9px; }
.watch.none { color: var(--muted); background: transparent; border-color: var(--line); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; }
.acts .btn { flex: 1 1 auto; }
@media (min-width: 700px) { .acts { grid-column: 2; } .acts .btn { flex: 0 0 auto; } }
@media (max-width: 520px) { .tcard .poster { width: 44px; } .tcard { padding: 12px; gap: 10px; } section.panel { padding: 14px 12px; } }

details.group { margin-top: 12px; border: 1px dashed var(--line2); border-radius: 12px; }
details.group summary { cursor: pointer; padding: 10px 14px; min-height: var(--tap); display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--muted); list-style: none; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary::before { content: "›"; font-size: 20px; transition: transform .2s; display: inline-block; width: 12px; }
details.group[open] summary::before { transform: rotate(90deg); }
.glist { padding: 0 14px 14px; display: grid; gap: 4px; }
.glist .row { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.glist .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- lists ---------- */
.list { display: grid; gap: 8px; }
.qgrid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1800px) { .qgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: 11px; background: var(--card2); border: 1px solid var(--line); }
.item.click { cursor: pointer; transition: border-color .15s; }
.item.click:hover { border-color: var(--gold-dim); }
.item .main { min-width: 0; display: grid; gap: 4px; }
.item .ttl { font-size: 15px; }
.item .warns { font-size: 12.5px; color: var(--warn); display: grid; gap: 2px; }
.item .side-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.minibar { height: 5px; border-radius: 3px; background: var(--bar-bg); overflow: hidden; }
.minibar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .9s; }

/* ---------- catalog ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 8px; }
.searchbar input, .filter input { flex: 1; min-width: 0; min-height: 48px; border-radius: 11px; border: 1px solid var(--line2); background: var(--card); padding: 0 16px; font-size: 16px; }
.searchbar input::placeholder, .filter input::placeholder { color: var(--faint); }
.row-h { display: flex; align-items: baseline; gap: 10px; margin: 18px 2px 10px; }
.row-h h2 { margin: 0; font-size: 26px; color: var(--parch); }
.row-h .more { margin-left: auto; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 138px; gap: 12px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
@media (min-width: 1000px) { .hscroll { grid-auto-columns: 158px; } }
.pgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 1000px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
@media (max-width: 460px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .pgrid .pcard .pt { font-size: 13px; } }
.pcard { scroll-snap-align: start; cursor: pointer; display: grid; gap: 6px; text-align: left; background: none; border: 0; padding: 0; min-width: 0; align-content: start; }
.pcard .pimg { position: relative; aspect-ratio: 2/3; border-radius: 9px; overflow: hidden; background: var(--card2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint);
  transition: transform .2s, border-color .2s, box-shadow .2s; }
.pcard .pimg img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.pcard:hover .pimg { transform: translateY(-3px); border-color: var(--gold-dim); box-shadow: 0 10px 24px rgba(0,0,0,.45); }
.pcard .badge { position: absolute; top: 6px; left: 6px; z-index: 1; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(11,10,9,.85); color: var(--parch); border: 1px solid #3d3326; }
.pcard .badge.ok { color: #c4d690; border-color: #5a6b35; } .pcard .badge.acc { color: #d6b46e; border-color: #7d6332; }
.pcard .rate { position: absolute; bottom: 6px; right: 6px; z-index: 1; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(11,10,9,.85); color: #d6b46e; }
.pcard .pt { font-weight: 600; font-size: 14px; line-height: 1.25; color: var(--parch); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard .py { font-size: 12px; color: var(--muted); margin-top: -4px; }

/* ---------- library ---------- */
.filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter input { flex: 1 1 240px; }
.lgrid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1150px) { .lgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .lgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- modal / sheet ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(5,4,3,.72); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { position: relative; background: var(--card); border: 1px solid var(--line2); border-radius: 16px; width: min(460px, 100%); padding: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.6); max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal.wide { width: min(980px, 100%); padding: 0; }
.modal h3 { margin: 0 0 8px; font-size: 25px; color: var(--parch); }
.modal p { margin: 0 0 12px; color: var(--muted); overflow-wrap: anywhere; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal label.chk { display: flex; gap: 10px; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 600; }
.modal label.chk input, .seasons input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }
.x { position: absolute; top: 10px; right: 10px; z-index: 2; }
@media (max-width: 640px) {
  .modal-bg.sheet { place-items: end stretch; padding: 0; }
  .modal-bg.sheet .modal { width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; animation: up .2s; }
}
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
.det .hero { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 20px 56px 18px 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent); border-bottom: 1px solid var(--line); }
@media (min-width: 700px) { .det .hero { grid-template-columns: 170px minmax(0, 1fr); } }
.det .hero .poster { width: 100%; }
.det h3 { font-size: 32px; line-height: 1.05; margin: 0 0 4px; }
.det .orig { color: var(--muted); font-family: var(--serif);  font-size: 18px; }
.det .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.det .ov { color: var(--text); opacity: .9; font-size: 14.5px; margin: 0; }
@media (max-width: 640px) { .det .hero .ov { display: none; } .det .ovm { display: block !important; } }
.det .ovm { display: none; }
.det .body { padding: 16px 20px 22px; display: grid; gap: 18px; }
.det .block { display: grid; gap: 10px; }
.det .block h4 { margin: 0; font-family: var(--serif); font-size: 22px; color: var(--parch); font-weight: 700; }
.acts-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seasons { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.seasons label { display: flex; gap: 10px; align-items: center; min-height: var(--tap); padding: 0 10px; border: 1px solid var(--line2); border-radius: 10px; background: var(--card2); cursor: pointer; font-weight: 600; }
.seasons label.dis { opacity: .55; cursor: default; }
.seasons label small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 11.5px; text-align: right; line-height: 1.1; }
details.season { border: 1px solid var(--line); border-radius: 11px; background: var(--card2); }
details.season > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; min-height: 54px; flex-wrap: wrap; }
details.season > summary::-webkit-details-marker { display: none; }
details.season > summary .sn { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--parch); }
details.season > summary .sp { margin-left: auto; display: flex; gap: 6px; }
.eps { display: grid; border-top: 1px solid var(--line); }
.ep { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 8px 4px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ep:last-child { border-bottom: 0; }
.ep .en { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.ep .et { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep .ea { display: flex; gap: 4px; align-items: center; }
.has { color: var(--ok); } .miss { color: var(--faint); }

.rels { display: grid; gap: 6px; }
.rel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card2); }
.rel-row.rej { opacity: .6; }
.rel-row .rt { font-size: 13px; overflow-wrap: anywhere; color: var(--parch); }
.rel-row .rr { font-size: 12px; color: #d9826f; }
.spinner { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 14px 4px; font-family: var(--serif); font-size: 19px;  }
.spinner::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--gold2); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- bottom nav (phone) ---------- */
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
nav.bottom a { position: relative; flex: 1; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 6px 2px; font-size: 11px; color: var(--muted); text-decoration: none; font-weight: 600; min-height: 54px; border-radius: 10px; }
nav.bottom a.on { color: var(--gold2); }
nav.bottom a.on::before { content: ""; position: absolute; top: -4px; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--gold); }
nav.bottom a .n { position: absolute; top: 2px; left: calc(50% + 6px); font-size: 10px; background: var(--gold); color: #120e08; border-radius: 999px; padding: 0 5px; font-weight: 700; }
@media (min-width: 1000px) { nav.bottom { display: none; } }

#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: 84px; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
@media (min-width: 1000px) { #toasts { bottom: 24px; left: calc(50% + var(--side) / 2); } }
.toast { background: var(--parch); color: #17110a; padding: 12px 16px; border-radius: 11px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: fade .2s; }
:root[data-theme="light"] .toast { background: #2b2117; color: #f1e7d0; }
.toast.bad { background: var(--bad2); color: #f4e6d4; }
.stale { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--warn); color: #000; font-weight: 700; padding: 6px 14px; border-radius: 999px; font-size: 13px; }

@media (min-width: 2200px) { body { font-size: 18px; } .ttl { font-size: 20px; } :root { --side: 300px; } }

/* ---------- login ---------- */
.login-wrap { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); background: color-mix(in srgb, var(--card) 85%, transparent); border: 1px solid var(--line2); border-radius: 18px; padding: 8px 28px 28px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.login-logo { width: 240px; height: 240px; margin: 0 auto -8px; display: block; }
.login label { font-family: var(--serif); font-size: 19px; color: var(--muted); }
.login input { min-height: 50px; border-radius: 11px; border: 1px solid var(--line2); background: var(--card2); padding: 0 14px; font-size: 16px; width: 100%; }
.login .btn { min-height: 50px; font-size: 19px; font-family: var(--serif); font-weight: 700; letter-spacing: .04em; }
.login .msg { min-height: 20px; color: #d9826f; font-size: 14px; font-weight: 600; }

/* =====================================================================
   Раунд 3: Manrope, анимации, мобильная версия, выбор источника
   ===================================================================== */
body { font-size: 14.5px; letter-spacing: -.003em; }
.nav a { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.side-sub { font-size: 11px; letter-spacing: .32em; font-weight: 700; }
.vh h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.ph h2, .row-h h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.ttl { font-weight: 700; }
.ttl.serif { font-size: 17px; font-weight: 800; letter-spacing: -.015em; }
.pct { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.det h3 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.det .orig { font-size: 14px; font-weight: 500; }
.det .block h4 { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
details.season > summary .sn { font-size: 15px; font-weight: 800; }
.empty, .spinner { font-size: 14.5px; font-weight: 600; }
.modal h3 { font-size: 20px; font-weight: 800; }
.mtop .name { font-size: 17px; font-weight: 800; letter-spacing: .08em; }
.mtop .name small { font-size: 10px; letter-spacing: .3em; font-weight: 700; }
.login label { font-size: 14px; font-weight: 700; }
.login .btn { font-size: 16px; letter-spacing: 0; font-weight: 800; }
.pcard .pt { font-weight: 700; }

/* ---------- анимации ---------- */
.view:not(.hidden) { animation: viewIn .38s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
.btn { transition: background .18s, border-color .18s, transform .12s var(--ease), color .18s, box-shadow .18s; }
.btn:active { transform: scale(.95); }
.item, .tcard, section.panel { transition: transform .22s var(--ease), border-color .22s, box-shadow .22s; }
.item.click:hover, .item.click:focus-visible, .tcard:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.35); }
.pcard:focus-visible .pimg { transform: translateY(-3px); border-color: var(--gold); }
.pcard .pimg img { opacity: 0; transition: opacity .4s; }
.pcard .pimg img.ld, .poster img.ld { opacity: 1; }
.poster img { opacity: 0; transition: opacity .4s; }
.list > *, .lgrid > *, .qgrid > *, .pgrid > *, .rels > * { animation: itemIn .35s var(--ease) both; }
.list > :nth-child(2), .lgrid > :nth-child(2), .pgrid > :nth-child(2), .rels > :nth-child(2) { animation-delay: .03s; }
.list > :nth-child(3), .lgrid > :nth-child(3), .pgrid > :nth-child(3), .rels > :nth-child(3) { animation-delay: .06s; }
.list > :nth-child(4), .lgrid > :nth-child(4), .pgrid > :nth-child(4), .rels > :nth-child(4) { animation-delay: .09s; }
.list > :nth-child(n+5), .lgrid > :nth-child(n+5), .pgrid > :nth-child(n+5), .rels > :nth-child(n+5) { animation-delay: .12s; }
@keyframes itemIn { from { opacity: 0; transform: translateY(8px); } }
.toast { animation: toastIn .35s var(--ease) both; }
.toast.out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
.hscroll { scroll-behavior: smooth; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.num { display: inline-block; min-width: 1ch; }

/* skeletons */
.skel { position: relative; overflow: hidden; background: var(--card2); border-radius: 8px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--parch) 7%, transparent), transparent); animation: skel 1.3s ease-in-out infinite; }
@keyframes skel { to { transform: translateX(100%); } }
.skel-poster { aspect-ratio: 2/3; border-radius: 9px; }
.skel-line { height: 12px; margin-top: 8px; border-radius: 6px; }
.skel-line.w60 { width: 60%; } .skel-line.w40 { width: 40%; } .skel-line.w80 { width: 80%; }
.skel-item { height: 74px; border-radius: 11px; }
.skel-rel { height: 86px; border-radius: 10px; }

/* modal/sheets: плавное появление */
.modal-bg { animation: fade .2s ease both; }
.modal-bg .modal { animation: popIn .28s var(--ease) both; }
.modal-bg.closing { animation: fadeOut .2s ease both; }
.modal-bg.closing .modal { animation: popOut .2s ease both; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes popOut { to { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fadeOut { to { opacity: 0; } }

/* ---------- кнопка «⋯» и action sheet ---------- */
.acts .more { display: none; }
.asheet { display: grid; gap: 6px; }
.asheet .btn { justify-content: flex-start; min-height: 52px; font-size: 15px; }
.asheet .ttl { margin-bottom: 6px; }

/* ---------- мобильная версия (mobile-first правки до 999px) ---------- */
html, body { overflow-x: hidden; }
.msearch { display: none; }
@media (max-width: 999px) {
  .mtop { flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px 10px; }
  .mtop img { width: 34px; height: 34px; }
  .msearch { display: flex; order: 10; width: 100%; gap: 6px; }
  .msearch input { flex: 1; min-width: 0; min-height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); padding: 0 14px; font-size: 16px; }
  .msearch input::placeholder { color: var(--faint); }
  #cat-search { display: none; }
  main.view-wrap { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .vh { margin-bottom: 12px; }
  .vh h1 { font-size: 24px; }
  section.panel { padding: 12px; border-radius: 14px; }
  .grid2 { gap: 12px; } .col { gap: 12px; }
  /* компактная карточка загрузки: одна главная кнопка + «⋯» */
  .tcard { grid-template-columns: 46px minmax(0, 1fr); padding: 12px; gap: 8px 10px; }
  .tcard .poster { width: 46px; }
  .tcard .ttl.serif { font-size: 15.5px; }
  .tcard .rel { font-size: 11.5px; }
  .tcard .chips .chip.opt { display: none; }
  .tcard .acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 48px; gap: 8px; }
  .tcard .acts .btn { min-height: 46px; }
  .tcard .acts .sec { display: none; }
  .tcard .acts .more { display: inline-flex; }
  .pct { font-size: 16px; min-width: 46px; }
  .item { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px; gap: 10px; }
  .item .side-acts { flex-direction: column; }
  .hscroll { grid-auto-columns: calc((100% - 24px) / 2.6); margin: 0 -12px; padding: 2px 12px 12px; scroll-padding: 0 12px; }
  .row-h { margin: 14px 0 8px; }
  .seg button { min-height: 40px; padding: 0 12px; }
  .filter { gap: 8px; }
  .det .hero { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 16px 52px 14px 16px; }
  .det h3 { font-size: 21px; }
  .det .body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
  .ep { grid-template-columns: 34px minmax(0, 1fr) auto; padding-left: 10px; }
  .ep .ea .btn { min-width: 44px; min-height: 44px; }
}
@media (max-width: 640px) {
  .modal-bg { place-items: end stretch; padding: 0; }
  .modal-bg .modal { width: 100%; max-width: none; border-radius: 20px 20px 0 0; max-height: 92dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: sheetIn .32s var(--ease) both; }
  .modal-bg .modal.wide { padding-bottom: 0; }
  .modal-bg.closing .modal { animation: sheetOut .22s ease both; }
  .modal-bg .modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: -8px auto 12px; }
  .modal-bg .modal.wide::before { margin: 8px auto 0; }
  .modal .row .btn { flex: 1; min-height: 50px; }
}
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@media (max-width: 380px) { .tcard .chips .chip { font-size: 11.5px; padding: 2px 7px; } .mtop .speeds { font-size: 11.5px; } }
@media (orientation: landscape) and (max-height: 500px) {
  .mtop { position: static; } .msearch { order: 0; width: auto; flex: 1; }
  nav.bottom a { min-height: 44px; padding: 2px; } nav.bottom a span:not(.n) { display: none; }
  .modal-bg .modal { max-height: 96dvh; }
}

/* ---------- выбор источника ---------- */
.picker { display: grid; gap: 12px; padding: 18px 20px 20px; }
.picker .ph h2 { padding-right: 44px; }
.pk-ctrl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pk-ctrl .lbl { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-right: -2px; }
.tg { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card2); cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); user-select: none; }
.tg input { appearance: none; width: 30px; height: 18px; border-radius: 9px; background: var(--bar-bg); position: relative; margin: 0; transition: background .2s; flex: none; }
.tg input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--parch); transition: transform .2s var(--ease); }
.tg input:checked { background: var(--gold); } .tg input:checked::after { transform: translateX(12px); }
.tg:has(input:checked) { color: var(--parch); border-color: var(--gold-dim); }
.pk-progress { display: grid; gap: 10px; }
.pk-progress .bar { height: 6px; }
.pk-progress .bar > i { transition: width 1s linear; }
.rr-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card2); }
.rr-row.rej { opacity: .55; filter: grayscale(.4); }
.rr-row.rej:hover { opacity: .85; }
.rr-row .rt { font-size: 12.5px; color: var(--parch); overflow-wrap: anywhere; line-height: 1.35; font-weight: 600; }
.rr-row .chips { margin-top: 6px; gap: 5px; }
.rr-row .chip { font-size: 11.5px; padding: 2px 8px; }
.chip.res { color: #120e08; background: var(--gold2); border-color: var(--gold2); font-weight: 800; }
.chip.res.r4k { background: linear-gradient(90deg, var(--gold2), #e8cf95); }
.chip.hdr { color: #f0d88f; border-color: #6e5a2c; background: rgba(184,146,74,.12); font-weight: 800; }
.chip.dv { color: #c9b2f0; border-color: #5d4c80; background: rgba(150,120,220,.12); font-weight: 800; }
.chip.lang { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }
.chip.lang.ru { color: #e9c98e; border-color: var(--gold-dim); }
.chip.seed-hi { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip.seed-mid { color: var(--gold2); border-color: var(--gold-dim); }
.chip.seed-lo { color: #d9826f; border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.rr-row details.rj { grid-column: 1 / -1; font-size: 12px; color: #d9826f; }
.rr-row details.rj summary { cursor: pointer; list-style: none; font-weight: 700; }
.rr-row details.rj summary::-webkit-details-marker { display: none; }
.rr-row details.rj ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.rr-row .gbtn { align-self: start; }
@media (min-width: 900px) {
  .rr-row { grid-template-columns: minmax(0, 1fr) 120px 90px auto; }
  .rr-row .size, .rr-row .seeds { text-align: right; font-weight: 800; font-size: 14px; }
  .rr-row .size small, .rr-row .seeds small { display: block; font-size: 11px; font-weight: 600; color: var(--faint); }
  .rr-row .chips .chip.m-only { display: none; }
}
@media (max-width: 899px) { .rr-row .size, .rr-row .seeds { display: none; } .picker { padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
/* логотип = ссылка «На главную» */
a.home { display: block; border-radius: 14px; text-decoration: none; color: inherit; transition: transform .2s var(--ease), opacity .2s; }
a.home:hover { opacity: .9; } a.home:active { transform: scale(.97); }
a.home:focus-visible { outline: 2px solid var(--gold2); outline-offset: 4px; }
a.mhome { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-right: 6px; }

/* «В очереди» и «через сколько можно смотреть» */
.item.wanted .side-acts { flex-direction: row; }
@media (max-width: 999px) { .item.wanted { grid-template-columns: auto minmax(0, 1fr); } .item.wanted .side-acts { grid-column: 1 / -1; justify-content: stretch; } .item.wanted .side-acts .btn { flex: 1; } }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.watch .wl { display: flex; flex-wrap: wrap; column-gap: 6px; row-gap: 2px; }
.watch .wl b { font-weight: 800; }
.watch .wl .sep { opacity: .5; }
@media (max-width: 999px) { .watch .wl { flex-direction: column; } .watch .wl .sep { display: none; } }
.pk-more { display: grid; gap: 6px; justify-items: start; padding-top: 4px; }
