:root {
  color-scheme: dark;
  --page: #131313;
  --surface: #1d1c1b;
  --raised: #242321;
  --ink: #f6f1e9;
  --muted: #b7ada2;
  --line: #39342f;
  --accent: #ff916a;
  --accent-strong: #ffac8c;
  --sticky: #e0ccff;
  --sticky-border: #8c69b3;
  --sticky-bg: #352646;
  --danger: #ffaaa7;
  --radius: 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--page);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, input, select, textarea { font: inherit; }
button, .button { display: inline-flex; gap: .55rem; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--line); background: var(--raised); border-radius: 8px; padding: .68rem 1rem; text-decoration: none; font-weight: 650; color: var(--ink); cursor: pointer; min-height: 42px; }
button:hover, .button:hover { background: #312c27; color: var(--ink); }
button:disabled, input:disabled { opacity: .58; cursor: default; }
.primary { background: var(--accent); color: #20120d; border-color: var(--accent); }
.primary:hover { background: var(--accent-strong); color: #20120d; }
.ghost { border-color: transparent; background: transparent; }
.icon-google { width: 18px; height: 18px; }
.google { background: #fff; color: #222; border-color: #ede8e4; }
.google:hover { background: #f0eeec; color: #181715; }
input:not([type=checkbox],[type=range],[type=file]), textarea, select { width: 100%; background: #171615; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); padding: .68rem .8rem; min-height: 42px; }
input[type=checkbox], input[type=range], progress { accent-color: var(--accent); }
textarea { min-height: 6rem; resize: vertical; }
label { font-weight: 590; }
.field { display: grid; gap: .4rem; margin-bottom: .9rem; }
.check { display: flex; gap: .6rem; align-items: center; }
[role=alert], .error { color: var(--danger); }
button.danger { color: var(--danger); }
.skip { position: absolute; top: .5rem; left: .5rem; z-index: 20; transform: translateY(-160%); background: var(--surface); padding: .6rem; }
.skip:focus { transform: none; }
.top { border-bottom: 1px solid var(--line); background: #171614; }
.top-inner, .shell, .foot { width: min(1190px, calc(100% - 3.5rem)); margin: 0 auto; }
.top-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 1.4rem; }
.brand { display: inline-flex; align-items: center; text-decoration: none; font-size: 1.55rem; font-weight: 780; letter-spacing: -.06em; white-space: nowrap; }
.brand-mark { width: 21px; height: 21px; margin-right: .55rem; border: 2px solid var(--accent); border-radius: 5px; background: linear-gradient(90deg, transparent 30%, var(--accent) 30% 42%, transparent 42% 60%, var(--accent) 60% 72%, transparent 72%); transform: rotate(-8deg); }
.brand-dot { color: var(--accent); }
nav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
nav .button { font-size: .88rem; padding: .55rem .68rem; min-height: 36px; }
nav [aria-current=page] { color: var(--accent-strong); background: var(--surface); }
.shell { flex: 1; padding: 3.2rem 0 5rem; }
.shell:focus { outline: none; }
.foot { color: var(--muted); font-size: .86rem; padding: 1rem 0 1.7rem; display: flex; gap: 1rem; justify-content: space-between; border-top: 1px solid var(--line); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -.035em; }
h1 { font-size: clamp(2.45rem, 6vw, 4.25rem); font-weight: 780; }
h2 { font-size: 1.4rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; }
p { line-height: 1.58; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.stack { display: grid; gap: 1.1rem; }
.row, .inline { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.split { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; }
.page-head { margin-bottom: 2.4rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.05rem,3vw,1.7rem); }
.narrow { max-width: 700px; }
.login { min-height: 58vh; display: grid; align-content: center; justify-items: start; gap: 1.25rem; padding: 2rem clamp(0rem, 7vw, 6rem); background: radial-gradient(ellipse at 68% 30%, #30221d, transparent 64%); }
.login h1 { font-size: clamp(3.2rem, 10vw, 7.5rem); }
.login p { max-width: 36ch; }
.login form { margin-top: .65rem; }
.search-form { display: grid; grid-template-columns: minmax(0,1fr) 6rem 8rem 11rem 8.5rem auto; gap: .6rem; align-items: end; margin-bottom: 1.6rem; }
.search-form .field { margin: 0; }
.search-actions { display: flex; gap: .45rem; }
.torrent-filters { grid-column: 1 / -1; gap: .65rem 1.2rem; }
#birth-year-help { grid-column: 1 / -1; margin: 0; }
.tag-filters, .film-tags { display: grid; gap: .55rem; min-width: 0; }
.tag-filters { margin: 0 0 1.4rem; }
.tag-filters > .field { max-width: 24rem; margin: 0; }
.tag-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .425rem; }
.tag-chips:empty { display: none; }
.tag-chip, .tag-remove { display: inline-flex; align-items: center; min-height: 34px; padding: .2rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .84rem; text-decoration: none; overflow-wrap: anywhere; max-width: 100%; }
.tag-chip:hover, .tag-remove:hover { border-color: var(--accent); color: var(--accent); }
.tag-selected { border-color: var(--accent); color: var(--accent); }
.tag-sticky { border-color: var(--sticky-border); background: var(--sticky-bg); color: var(--sticky); }
.tag-sticky:hover { border-color: var(--sticky); background: var(--sticky-bg); color: var(--sticky); }
.tag-sticky.tag-selected { border-color: var(--sticky); }
.tag-assignment { display: inline-flex; min-width: 0; max-width: 100%; }
.tag-assignment .tag-chip { border-start-end-radius: 0; border-end-end-radius: 0; min-width: 0; }
.tag-remove { border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start: 0; min-width: 32px; }
.tag-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .4rem; max-width: 28rem; }
.tag-add .field { margin: 0; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill,minmax(155px,1fr)); gap: 1.5rem 1rem; }
.catalog-sort { display: flex; justify-content: flex-end; margin-bottom: .9rem; }
.catalog-sort .field { min-width: min(100%, 12rem); margin: 0; }
.continue-watching { margin: 0 0 1.6rem; }
.continue-watching h2 { margin-bottom: .6rem; }
.resume-list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(min(15rem, 90%), 1fr); gap: .65rem; overflow-x: auto; padding: .25rem .25rem .6rem; margin-inline: -.25rem; scroll-snap-type: x proximity; }
.resume-card { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); align-items: center; gap: .65rem; padding: .55rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; scroll-snap-align: start; }
.resume-card:hover { border-color: var(--accent); }
.resume-card .poster { border-radius: 6px; }
.resume-details { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.resume-details h3 { font-size: .99rem; }
.resume-time { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.tile { min-width: 0; text-decoration: none; display: grid; grid-template-rows: auto auto; gap: .6rem; }
.tile:hover .poster { border-color: var(--accent); }
.poster { width: 100%; aspect-ratio: 2 / 3; border: 1px solid var(--line); border-radius: var(--radius); object-fit: cover; background: linear-gradient(154deg,#342822,#251e1a 56%,#1a1817 56%); display: grid; place-items: center; overflow: hidden; }
.poster-mark { width: min(36%,64px); aspect-ratio: 1; border: 1px solid #6c5448; border-radius: 22%; transform: rotate(-10deg); box-shadow: inset 0 0 0 10px #241c19, inset 0 0 0 11px #6c5448; }
.tile h3 { overflow-wrap: anywhere; }
.tile .muted { margin-top: .25rem; }
.empty { display: grid; justify-items: start; gap: .75rem; min-height: 132px; align-content: center; }
.drop { border: 1px dashed #806755; padding: clamp(1.1rem, 5vw, 2.5rem); display: grid; gap: 1rem; }
.drop:focus-within { border-color: var(--accent); }
.film-grid { display: grid; grid-template-columns: minmax(125px,220px) minmax(0,1fr); gap: clamp(1.2rem,4vw,2.7rem); align-items: start; margin: 1.1rem 0 1.7rem; }
.film-grid h1 { font-size: clamp(2rem,5vw,3.8rem); overflow-wrap: anywhere; }
.details { display: grid; gap: .85rem; }
.details p { max-width: 77ch; white-space: pre-line; }
.episode-season { padding: .8rem 0; border-top: 1px solid var(--line); }
.episode-season summary { width: fit-content; cursor: pointer; font-weight: 650; }
.episode-list { margin-top: .8rem; }
.episode-list [aria-current="page"] { color: var(--accent); font-weight: 700; }
.episode-editor input { inline-size: 9rem; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; align-self: start; font-size: .82rem; padding: .27rem .54rem; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.credit { width: 68px; height: auto; }
.results, .list { margin: 0; padding: 0; list-style: none; }
.list li, .results li { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .55rem; padding: .64rem 0; overflow-wrap: anywhere; }
.results .tmdb-result { display: grid; grid-template-columns: clamp(42px, 8vw, 64px) minmax(0, 1fr) auto; gap: clamp(.45rem, 2vw, .9rem); }
.tmdb-result-poster { border-radius: 6px; }
.tmdb-result-poster img { width: 100%; height: 100%; object-fit: cover; }
.tmdb-result-title { display: grid; gap: .2rem; }
.tmdb-result button { padding-inline: .65rem; }
.list li:last-child { padding-bottom: 0; }
.list .account-row { display: grid; gap: .55rem; }
.access-restriction summary { cursor: pointer; }
.access-restriction > .stack { margin-top: .75rem; }
.storage-chart { display: grid; gap: .9rem; font-variant-numeric: tabular-nums; }
.storage-summary { display: flex; justify-content: space-between; align-items: end; gap: .75rem; }
.storage-used, .storage-total { display: grid; gap: .18rem; }
.storage-used strong { font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1; letter-spacing: -.045em; }
.storage-total { text-align: right; }
.storage-bar { display: flex; height: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #181716; }
.storage-segment { flex: 0 1 0; min-width: 0; }
.storage-persistent { background: var(--accent); }
.storage-cache { background: #d3b470; }
.storage-playback { background: #b7a3df; }
.storage-other { background: #9c8b80; }
.storage-free { background: #423a35; }
.storage-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: .5rem; margin: 0; }
.storage-item { min-width: 0; background: #181716; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; }
.storage-item dt { display: flex; align-items: center; gap: .46rem; font-size: .82rem; color: var(--muted); }
.storage-item dd { margin: .2rem 0 0 1.05rem; font-size: 1rem; font-weight: 700; }
.storage-swatch { flex: 0 0 .58rem; aspect-ratio: 1; border-radius: 2px; }
.storage-swatch.storage-free { outline: 1px solid #827268; outline-offset: -1px; }
.storage-details { display: flex; flex-wrap: wrap; gap: .5rem 1.35rem; margin: 0; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.storage-details div { display: flex; align-items: baseline; gap: .45rem; }
.storage-details dt { color: var(--muted); font-size: .85rem; }
.storage-details dd { margin: 0; font-size: .88rem; font-weight: 650; }
.torrent-metrics dd { margin-left: 0; }
.torrent-seed { margin-top: .55rem; }
.player { position: relative; border-radius: var(--radius); overflow: hidden; background: #070707; }
.player-viewport-open { overflow: hidden; }
.player.player-viewport { position: fixed; inset: 0; z-index: 4; }
.player:is(:fullscreen, .player-viewport) { border-radius: 0; }
.player:is(:fullscreen, .player-viewport).player-idle { cursor: none; }
.player:is(:fullscreen, .player-viewport).player-idle :is(.player-controls, .player-status) { visibility: hidden; }
.player video { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: contain; background: #070707; }
.player:is(:fullscreen, .player-viewport) video { height: 100%; }
.player-status { position: absolute; top: .7rem; left: .7rem; right: .7rem; width: fit-content; max-width: calc(100% - 1.4rem); padding: .25rem .55rem; background: #000c; border-radius: 5px; font-size: .82rem; }
.player-controls { position: absolute; inset: auto 0 0; display: grid; gap: .3rem; padding: 1.15rem .8rem .55rem; background: linear-gradient(transparent, #000e 45%); }
.player-controls input[type=range] { margin: 0; }
.player-timeline { --thumb-size: 16px; position: relative; display: grid; }
.player-timeline input { position: relative; width: 100%; min-height: 22px; appearance: none; background: transparent; padding: 0; border: 0; cursor: pointer; }
.player-timeline input:disabled { cursor: default; }
.player-timeline input::-webkit-slider-thumb { appearance: none; width: var(--thumb-size); height: var(--thumb-size); border-radius: 50%; background: var(--accent); }
.player-timeline input::-moz-range-thumb { width: var(--thumb-size); height: var(--thumb-size); border: 0; border-radius: 50%; background: var(--accent); }
.player-timeline-track { position: absolute; inset-inline: calc(var(--thumb-size) / 2); top: 50%; height: 8px; transform: translateY(-50%); overflow: hidden; border-radius: 999px; background: #64605d; pointer-events: none; }
.player-cache-track, .player-buffer-track, .player-timeline-track span, .player-timeline-track::after { position: absolute; }
.player-cache-track, .player-buffer-track { inset-inline: 0; }
.player-cache-track { inset-block: auto 0; height: 3px; background: #393734; }
.player-buffer-track, .player-timeline-track::after { inset-block: 0 3px; }
.player-timeline-track span { inset-block: 0; }
.player-cache-track span, .player-cache-key::before { background: #63c4fa; }
.player-buffer-track span, .player-buffer-key::before { background: #c3bdb7; }
.player-timeline-track::after { content: ''; inset-inline-start: 0; width: var(--played, 0%); background: var(--accent); }
.player-track-legend { display: flex; flex-wrap: wrap; gap: .25rem .8rem; color: #eee; font-size: .73rem; }
.player-track-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.player-track-legend span::before { content: ''; width: .5rem; height: .5rem; border-radius: 2px; }
.player-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .6rem; }
.player-quality { width: auto; }
.player-options .player-quality { min-height: 32px; padding: .2rem .4rem; font-size: .82rem; }
.player-hover-time { position: absolute; bottom: calc(100% + .35rem); left: clamp(2.4rem, var(--hover-x), 100% - 2.4rem); transform: translateX(-50%); padding: .2rem .4rem; border-radius: 4px; background: #151515; color: #fff; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.player-actions, .player-transport { display: flex; align-items: center; gap: .35rem; }
.player-actions { flex-wrap: wrap; }
.player-control { min-width: 32px; min-height: 32px; padding: .25rem .4rem; border-color: transparent; background: transparent; color: #fff; font-size: .85rem; }
.player-control:hover { background: #fff3; }
.player-jump { touch-action: manipulation; white-space: nowrap; }
@media (pointer: coarse) {
  .player-fullscreen, .player-large-view, .player-transport .player-control { min-width: 44px; min-height: 44px; }
}
.player-volume { width: clamp(45px, 8vw, 95px); }
.player-time { flex: 1 0 auto; font-size: .86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 600px) {
  .player-volume { display: none; }
  .player-controls { padding-inline: .4rem; }
}
.toast { position: fixed; right: 1.3rem; bottom: 1.3rem; z-index: 3; padding: .85rem 1.2rem; background: #342b25; border: 1px solid #735b4d; border-radius: 8px; max-width: min(34rem,calc(100% - 2.6rem)); box-shadow: 0 8px 22px #0005; }
@media (max-width:940px) {
  .search-form { grid-template-columns: 6rem minmax(0,1fr) minmax(9rem,1fr) minmax(7rem,1fr) auto; }
  .search-form .field:first-child { grid-column: 1 / -1; }
}
@media (max-width:640px) {
  .top-inner, .shell, .foot { width: calc(100% - 1.6rem); }
  .top-inner { align-items: start; padding: .68rem 0; gap: .6rem; }
  .brand { margin-top: .22rem; }
  nav { justify-content: end; }
  nav .button { padding: .4rem .5rem; }
  .shell { padding: 2rem 0 3rem; }
  .page-head { margin-bottom: 1.5rem; }
  .catalog { grid-template-columns: repeat(auto-fill,minmax(125px,1fr)); }
  .search-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .search-actions { grid-column: 1 / -1; }
  .film-grid { grid-template-columns: 100px minmax(0,1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .list li { align-items: start; flex-direction: column; }
}
