/* pages.css — page chrome, hero, rows, posters, search, files, settings (matches V2 preview design) */
.main{width:min(1260px,100%); margin:0 auto; padding:34px 26px 60px}
.page-head{display:flex; justify-content:space-between; align-items:end; gap:20px; margin-bottom:22px}
.page-head h1{font-family:var(--font-serif); font-weight:600; font-size:clamp(34px,4vw,54px); line-height:1; margin:0}
.page-head p{margin:7px 0 0; color:var(--muted); font-size:14px}
.section-tag{color:var(--tone); font-size:12px; font-weight:800; letter-spacing:.12em; text-transform:uppercase}

/* ---------- Hero ---------- */
.hero{
  min-height:320px; border:1px solid var(--line); border-radius:20px; background:var(--surface);
  padding:clamp(26px,4vw,48px); display:flex; align-items:flex-end;
  position:relative; overflow:hidden; box-shadow:var(--shadow);
}
.hero::after{
  content:""; position:absolute; width:460px; height:460px; right:-140px; top:-210px;
  border-radius:50%; background:var(--tone); opacity:.3; pointer-events:none;
}
.hero-copy{position:relative; z-index:1; max-width:540px}
.hero .label{color:var(--tone); font-size:12px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; margin-bottom:10px}
.hero h2{font-family:var(--font-serif); font-weight:600; font-size:clamp(34px,5vw,58px); line-height:1; margin:0 0 12px}
.hero p{color:var(--muted); margin:0; max-width:48ch}

/* ---------- Rows + posters ---------- */
.row{margin-top:30px}
.row-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:13px}
.row-head h2{font-size:18px; margin:0; font-weight:700}
.muted-link{color:var(--muted); font-size:13px}

/* Recently Watched — horizontal carousel with progress + continue */
.rw-strip{display:flex; gap:14px; overflow-x:auto; padding:4px 2px 12px;
  scroll-snap-type:x proximity; scrollbar-width:thin}
.rw-card{position:relative; flex:0 0 300px; scroll-snap-align:start;
  display:flex; align-items:center; gap:12px; padding:10px;
  background:var(--surface); border:1px solid var(--line, rgba(255,255,255,.08));
  border-radius:16px}
.rw-main{display:flex; align-items:center; gap:12px; flex:1; min-width:0;
  text-decoration:none; color:inherit}
.rw-poster{position:relative; flex:0 0 64px; width:64px; height:96px; border-radius:10px;
  overflow:hidden; background:rgba(255,255,255,.06)}
.rw-poster img{width:100%; height:100%; object-fit:cover; display:block}
.rw-noposter{width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  color:var(--muted)}
.rw-noposter .icon{width:24px; height:24px}
.rw-badge{position:absolute; left:4px; bottom:4px; font-size:10px; font-weight:800;
  letter-spacing:.4px; background:rgba(0,0,0,.72); color:#fff;
  padding:3px 7px; border-radius:7px}
.rw-info{flex:1; min-width:0; display:flex; flex-direction:column; gap:4px}
.rw-info b{font-size:14px; line-height:1.25; display:-webkit-box; -webkit-line-clamp:2;
  -webkit-box-orient:vertical; overflow:hidden}
.rw-info small{font-size:12px; color:var(--muted)}
.rw-bar{display:block; height:5px; border-radius:99px; background:rgba(255,255,255,.12);
  overflow:hidden; margin-top:2px}
.rw-bar i{display:block; height:100%; border-radius:99px;
  background:var(--tone, #8b5cf6)}
.rw-go{flex:0 0 auto; display:inline-flex; align-items:center; gap:6px; border:0; cursor:pointer;
  font-family:inherit; font-weight:800; font-size:13px; color:#fff;
  background:var(--tone, #8b5cf6); padding:9px 14px; border-radius:999px}
.rw-go .icon{width:15px; height:15px}
.rw-go:active{transform:scale(.96)}
@media (max-width:560px){ .rw-card{flex-basis:270px} }
/* History page: the same cards stacked vertically. */
.rw-list{display:flex; flex-direction:column; gap:10px; margin-top:6px}
.rw-list .rw-card{flex:1 1 auto; width:100%}
/* Private hentai folders: blurred poster cards with no name. */
.hfolder-row{display:flex; gap:14px; margin:2px 0 18px}
/* 18+ posters stay blurred until hovered (PC) or tapped (touch).
 * First tap/click adds .revealed for 5s (JS); a second tap/click within
 * those 5s opens the info page. Titles are never blurred. */
.rw-card.is-adult .rw-poster img,
.poster-card.is-adult .poster-img img{filter:blur(14px) brightness(.72)}
.rw-card.is-adult:hover .rw-poster img,
.rw-card.is-adult.revealed .rw-poster img,
.poster-card.is-adult:hover .poster-img img,
.poster-card.is-adult.revealed .poster-img img{filter:none}
/* 18+ blur master toggle (search page): OFF shows posters plainly. */
body.adult-blur-off .rw-card.is-adult .rw-poster img,
body.adult-blur-off .poster-card.is-adult .poster-img img{filter:none}.hfolder{position:relative; display:block; width:148px; max-width:40vw; aspect-ratio:2/3;
  border-radius:14px; overflow:hidden; background:#0b0b0d;
  border:1px solid var(--line, rgba(255,255,255,.08))}
.hfolder-poster{position:absolute; inset:0; display:block}
.hfolder-poster img{width:100%; height:100%; object-fit:cover; display:block;
  filter:blur(16px) brightness(.62); transform:scale(1.15)}
.hfolder-badge{position:absolute; right:8px; bottom:8px; width:30px; height:30px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.65); border:1px solid rgba(255,255,255,.14); border-radius:99px; color:#fff}
.hfolder-badge .icon{width:15px; height:15px}
.hfolder:active{transform:scale(.97)}
.poster-grid{display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:14px}
.poster{
  aspect-ratio:2/3; border-radius:14px; background:var(--surface);
  border:1px solid var(--line); position:relative; overflow:hidden;
}
.poster::before{
  content:""; position:absolute; inset:0;
  background:linear-gradient(145deg, color-mix(in srgb, var(--tone) 12%, transparent), transparent 55%);
}
.poster::after{
  content:""; position:absolute; left:15px; right:35%; bottom:16px; height:8px; border-radius:4px;
  background:var(--surface-3);
  box-shadow:0 -15px 0 color-mix(in srgb, var(--surface-3) 70%, transparent);
}

/* ---------- Empty states ---------- */
.empty{border:1px solid var(--line); background:var(--surface); border-radius:18px; padding:54px 24px; text-align:center}
.empty > .icon{width:46px; height:46px; margin:0 auto 16px; color:var(--faint)}
.empty h2{font-size:19px; margin:0 0 7px}
.empty p{color:var(--muted); font-size:14px; margin:0 auto; max-width:440px}

/* ---------- Search ---------- */
.search-box{
  display:flex; align-items:center; gap:10px; padding:7px 8px 7px 16px;
  border:1px solid var(--line); background:var(--surface); border-radius:14px; margin-bottom:18px;
  position:relative; /* Entry S7: anchors the suggestion dropdown */
}
/* Entry S7: autocomplete suggestions dropdown. */
.sug-drop{
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:60;
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  box-shadow:0 12px 32px rgba(0,0,0,.45); overflow:hidden;
  max-height:322px; overflow-y:auto;
}
.sug-drop[hidden]{display:none}
.sug-row{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:8px 10px; background:none; border:0; color:inherit;
  font:inherit; text-align:left; cursor:pointer;
}
.sug-row + .sug-row{border-top:1px solid var(--line)}
.sug-row.active,.sug-row:hover{background:rgba(255,255,255,.07)}
.sug-img{width:34px; height:48px; object-fit:cover; border-radius:6px; flex:none}
.sug-img-ph{background:rgba(255,255,255,.08)}
.sug-title{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:14px; font-weight:600}
.sug-type{flex:none; font-size:11px; color:var(--faint)}
/* Entry S10: search empty state — recent searches + trending. */
.search-empty-head{display:flex; align-items:center; justify-content:space-between;
  margin:20px 0 10px}
.search-empty-head:first-child{margin-top:0}
.search-empty-head h3{font-size:15px; font-weight:700; margin:0}
.recent-clear{background:none; border:0; color:var(--faint); font-size:13px;
  font-weight:600; cursor:pointer; padding:4px 2px}
.recent-row{display:flex; flex-wrap:wrap; gap:8px}
.recent-chip{border:1px solid var(--line); background:var(--surface); color:inherit;
  font-size:13px; font-weight:600; padding:8px 14px; border-radius:999px; cursor:pointer}
.recent-chip:active{transform:scale(.96)}
.trend-list{display:flex; flex-direction:column; gap:2px}
button.top10-row{width:100%; background:none; border:0; color:inherit;
  font:inherit; text-align:left; cursor:pointer}
button.top10-row:hover{background:rgba(255,255,255,.05)}
.search-box:focus-within{border-color:var(--tone)}
.search-box input{flex:1; min-width:0; border:0; outline:0; background:transparent; padding:10px 0; font-size:16px}
/* Entry 111: hide the browser's native × inside type="search" — the app has
   its own #clearSearch button, so the native one only duplicates it. */
#searchInput::-webkit-search-cancel-button{ -webkit-appearance:none; appearance:none; display:none; }
.search-box .icon{color:var(--faint)}
.clear-btn{min-width:40px; height:40px; display:grid; place-items:center; border-radius:10px; color:var(--muted)}

/* ---------- Local files ---------- */
.file-panel{border:1.5px dashed var(--line); background:var(--surface); border-radius:18px; padding:54px 24px; text-align:center}
.file-panel > .icon{width:48px; height:48px; margin:0 auto 15px; color:var(--tone)}
.file-panel h2{font-size:19px; margin:0 0 7px}
.file-panel p{font-size:14px; color:var(--muted); margin:0 auto 20px; max-width:450px}
.primary{min-height:44px; padding:0 18px; border-radius:999px; background:var(--tone); color:#fff; font-weight:800;
  box-shadow:0 8px 26px color-mix(in srgb, var(--tone) 38%, transparent)}
.format-list{display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-top:18px}
.chip{padding:5px 10px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:12px; background:var(--bg)}
#fileInput{display:none}
.file-results{margin-top:18px; display:grid; gap:9px}
.file-row{
  display:flex; align-items:center; gap:12px; padding:12px 14px;
  border:1px solid var(--line); background:var(--surface); border-radius:12px; text-align:left; width:100%;
}
.file-row .icon{color:var(--tone)}
.file-row span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px}

/* ---------- Settings ---------- */
.settings{display:grid; grid-template-columns:1fr 1fr; gap:18px}
.settings-group{border:1px solid var(--line); background:var(--surface); border-radius:16px; overflow:hidden}
.settings-group h2{font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); margin:0; padding:16px 17px 9px}
.setting{width:100%; min-height:66px; display:flex; align-items:center; gap:13px; padding:12px 17px; border-top:1px solid var(--line); text-align:left}
.setting:first-of-type{border-top:0}
.setting-copy{flex:1}
.setting-copy b{display:block; font-size:14px}
.setting-copy small{display:block; color:var(--muted); font-size:12px; margin-top:2px}
.switch{width:46px; height:27px; border-radius:999px; background:var(--surface-3); position:relative; transition:background .15s; flex:0 0 auto}
.switch::after{
  content:""; position:absolute; width:21px; height:21px; border-radius:50%;
  left:3px; top:3px; background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.25); transition:transform .15s;
}
.setting[aria-checked="true"] .switch{background:var(--tone)}
.setting[aria-checked="true"] .switch::after{transform:translateX(19px)}

/* ---------- Toast ---------- */
.toast{
  position:fixed; z-index:100; left:50%; bottom:24px; transform:translateX(-50%);
  background:#1d1d24; color:#fff; border:1px solid var(--line); border-radius:999px; padding:11px 16px;
  font-size:13px; font-weight:700; box-shadow:var(--shadow); animation:pop .18s ease;
}
@keyframes pop{from{opacity:0; transform:translate(-50%,8px)} to{opacity:1; transform:translate(-50%,0)}}

@media (max-width:1050px){
  .poster-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (max-width:859px){
  .main{padding:24px 16px calc(var(--nav-h) + 26px + env(safe-area-inset-bottom))}
  .poster-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .settings{grid-template-columns:1fr}
  .hero{min-height:275px}
  .toast{bottom:calc(var(--nav-h) + 20px)}
  .page-head{display:block}
  .section-tag{display:inline-block; margin-bottom:8px}
}
@media (max-width:600px){
  .poster-grid{grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px}
  .hero{min-height:250px; padding:25px}
  .hero::after{width:300px; height:300px; right:-125px}
  .hero h2{font-size:38px}
}

/* ---------- STEP 3: section theme swatches ---------- */
.theme-block{padding:6px 17px 16px}
.theme-label{font-size:13px; color:var(--muted); margin:6px 0 12px}
.theme-label b{color:var(--text)}
.swatches{display:flex; flex-wrap:wrap; gap:10px; margin-bottom:12px}
.swatch{
  width:42px; height:42px; border-radius:50%; background:var(--sw);
  border:2px solid transparent; position:relative; transition:transform .15s ease;
}
.swatch:hover{transform:scale(1.08)}
.swatch.active{border-color:#fff; box-shadow:0 0 0 3px color-mix(in srgb, var(--sw) 55%, transparent)}
.swatch.custom{display:grid; place-items:center; background:var(--surface-3); color:var(--muted);
  font-size:24px; font-weight:300; line-height:1; overflow:hidden}
.swatch.custom input{position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%}
.link-btn{color:var(--tone); font-size:13px; font-weight:700; padding:6px 0; min-height:32px}
.link-btn:hover{text-decoration:underline}

/* ---------- STEP 3: poster cards ---------- */
.poster-grid.cards{gap:20px 14px}
.poster-card{display:block; min-width:0}
.poster-img{
  display:block; aspect-ratio:2/3; border-radius:14px; overflow:hidden;
  border:1px solid var(--line); background:var(--surface); position:relative;
  transition:transform .18s ease, border-color .18s ease;
}
.poster-card:hover .poster-img{transform:translateY(-4px); border-color:color-mix(in srgb, var(--tone) 60%, var(--line))}
.poster-img img{width:100%; height:100%; object-fit:cover; display:block}
.poster-title{display:block; margin-top:9px; font-size:13.5px; font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.poster-meta{display:block; font-size:12px; color:var(--muted); margin-top:2px}

/* ---------- STEP 7 · CHUNK 5: hover ambient previews ---------- */
.poster-preview{
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  opacity:0; transition:opacity .22s ease; pointer-events:none;
}
.poster-preview.is-playing{opacity:1}
@media (prefers-reduced-motion: reduce){
  .poster-preview{display:none}
}

/* ---------- STEP 3: detail page (chameleon accents) ---------- */
.back-link{display:inline-flex; align-items:center; gap:8px; color:var(--muted);
  font-weight:700; font-size:14px; min-height:44px; margin-bottom:6px}
.back-link:hover{color:var(--text)}
.back-link .icon{width:19px; height:19px}
.detail-hero{
  position:relative; overflow:hidden; border:1px solid var(--line); border-radius:22px;
  background:
    radial-gradient(700px 340px at 12% -10%, color-mix(in srgb, var(--poster, var(--tone)) 26%, transparent), transparent 70%),
    var(--surface);
  padding:clamp(22px,4vw,44px); display:grid; grid-template-columns:240px 1fr;
  gap:clamp(20px,4vw,44px); align-items:center;
}
.detail-poster img{width:100%; aspect-ratio:2/3; object-fit:cover; border-radius:16px; display:block;
  border:1px solid var(--line);
  box-shadow:0 24px 60px color-mix(in srgb, var(--poster, var(--tone)) 32%, transparent)}
.detail-info .section-tag{color:var(--poster, var(--tone))}
.detail-info h1{font-family:var(--font-serif); font-weight:600; font-size:clamp(32px,4.5vw,56px);
  line-height:1.02; margin:8px 0 10px}
.detail-meta{color:var(--muted); font-size:14px; margin:0 0 14px}
.detail-blurb{color:var(--text); opacity:.85; max-width:56ch; margin:0 0 22px; font-size:15px}
.detail-actions{display:flex; gap:12px; flex-wrap:wrap}
.detail-actions .primary{display:inline-flex; align-items:center; gap:9px}
.detail-actions .primary .icon{width:18px; height:18px}
.primary.poster-accent{background:var(--poster, var(--tone));
  box-shadow:0 10px 30px color-mix(in srgb, var(--poster, var(--tone)) 42%, transparent)}
.ghost{min-height:44px; padding:0 18px; border-radius:999px; border:1px solid var(--line);
  font-weight:800; color:var(--text); background:color-mix(in srgb, var(--surface-2) 70%, transparent)}
.ghost:hover{border-color:var(--poster, var(--tone)); color:var(--poster, var(--tone))}
@media (max-width:700px){
  .detail-hero{grid-template-columns:1fr}
  .detail-poster{max-width:220px}
}

/* ---------- STEP 4: liquid display ---------- */
.detail-hero,.settings-group,.empty,.file-panel,.search-box,.file-row{
  box-shadow:var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
/* fluid sheen sweeping across hero surfaces */
.hero::before,.detail-hero::before{
  content:""; position:absolute; inset:-35%; pointer-events:none;
  background:linear-gradient(115deg, transparent 32%,
    color-mix(in srgb, var(--poster, var(--tone)) 13%, transparent) 46%,
    transparent 60%);
  animation:sheen 9s ease-in-out infinite;
}
@keyframes sheen{0%,100%{transform:translateX(-10%)}50%{transform:translateX(10%)}}
/* springy micro-interactions */
.primary,.ghost,.swatch,.poster-card .poster-img,.setting{
  transition-timing-function:cubic-bezier(.22,1,.36,1);
}
.primary:active,.ghost:active{transform:scale(.97)}
.poster-card:hover .poster-img{
  box-shadow:0 18px 44px color-mix(in srgb, var(--tone) 28%, transparent);
}
/* day/dark segmented control */
.segmented{display:flex; gap:4px; padding:4px; border-radius:999px;
  background:var(--surface-2); border:1px solid var(--line); margin-bottom:6px}
.segment{flex:1; min-height:46px; border-radius:999px; display:flex; align-items:center;
  justify-content:center; gap:8px; font-weight:800; font-size:14px; color:var(--muted);
  transition:background .2s cubic-bezier(.22,1,.36,1), color .2s, box-shadow .2s}
.segment .icon{width:18px; height:18px}
.segment.active{background:color-mix(in srgb, var(--tone) 20%, var(--surface-3)); color:var(--text);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 4px 14px color-mix(in srgb, var(--tone) 25%, transparent)}
/* light-mode toast */
[data-theme="light"] .toast{background:#171715; color:#f6f4ef; border-color:transparent}

/* ---------- STEP 5: media details & watch order ---------- */
.kind-tag{display:inline-block; font-size:11px; font-weight:800; letter-spacing:2px;
  padding:6px 12px; border-radius:999px; margin-bottom:10px;
  color:var(--poster, var(--tone));
  border:1px solid color-mix(in srgb, var(--poster, var(--tone)) 55%, transparent);
  background:color-mix(in srgb, var(--poster, var(--tone)) 12%, transparent)}
.rating{color:#f5b50a; font-weight:800}
.genre-row{display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 2px}
.genre-chip{font-size:12px; font-weight:700; padding:6px 12px; border-radius:999px;
  background:var(--surface-2); border:1px solid var(--line); color:var(--muted)}
.smart-wrap{margin:18px 0 6px}
.smart-play{width:100%; min-height:56px; font-size:16px; display:inline-flex; align-items:center; justify-content:center; gap:10px}
.smart-play .icon{width:20px; height:20px}
.toolbar{display:flex; flex-wrap:wrap; gap:10px; margin:14px 0 6px}
.tool-btn{flex:1 1 140px; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:48px; padding:12px 16px; border-radius:14px; font-weight:700; font-size:14px;
  color:var(--text); background:var(--surface-2); border:1px solid var(--line);
  transition:transform .2s cubic-bezier(.22,1,.36,1), border-color .2s, background .2s}
.tool-btn:hover{transform:translateY(-1px)}
.tool-btn .icon{width:18px; height:18px}
.tool-btn.active{background:color-mix(in srgb, var(--tone) 18%, var(--surface-2));
  border-color:color-mix(in srgb, var(--tone) 55%, transparent)}
.watch-order{margin-top:26px}
.wo-total{margin-left:auto; font-size:13px; color:var(--muted); font-weight:700}
/* STEP 5b: horizontal strip of numbered season/part cards */
.watch-flow{display:flex; gap:10px; overflow-x:auto; padding:4px 2px 14px;
  scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch; scrollbar-width:thin}
.watch-part{flex:0 0 262px; display:flex; align-items:center; gap:10px; text-align:left;
  font:inherit; color:var(--text); cursor:pointer;
  border:1px solid var(--line); border-radius:14px; padding:10px 12px;
  background:color-mix(in srgb, var(--surface-2) 70%, transparent);
  scroll-snap-align:start;
  transition:border-color .18s, background .18s, box-shadow .18s, transform .18s}
.watch-part:hover{border-color:color-mix(in srgb, var(--poster, var(--tone)) 48%, var(--line));
  transform:translateY(-2px)}
.watch-part.selected{border-color:color-mix(in srgb, var(--poster, var(--tone)) 62%, var(--line));
  background:color-mix(in srgb, var(--poster, var(--tone)) 16%, var(--surface-2));
  box-shadow:0 12px 30px color-mix(in srgb, var(--poster, var(--tone)) 12%, transparent)}
.flow-index{font-size:12px; font-weight:800; color:var(--muted); flex:none}
.watch-part.selected .flow-index{color:var(--poster, var(--tone))}
.watch-thumb{width:52px; height:52px; border-radius:10px; overflow:hidden; flex:none;
  background:var(--surface-2); border:1px solid var(--line)}
.watch-thumb img{width:100%; height:100%; object-fit:cover; display:block}
.watch-part-title{flex:1; min-width:0}
.watch-part-title h3{font-size:13px; margin:0 0 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.watch-part-title p{color:var(--muted); font-size:11px; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.watch-chevron{color:var(--muted); flex:none; display:inline-flex}
.watch-chevron .icon{width:16px; height:16px}
.watch-part.selected .watch-chevron{color:var(--poster, var(--tone))}
/* STEP 5b: rich episode cards for the selected entry */
.episode-panel-head{margin:4px 0 12px}
.episode-panel-head h3{font-size:16px; margin:0}
.episode-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:12px}
.episode-card{position:relative; min-height:152px; overflow:hidden; border:1px solid var(--line);
  border-radius:14px; background:var(--surface-2); isolation:isolate;
  transition:border-color .18s, transform .18s cubic-bezier(.22,1,.36,1)}
.episode-card:hover{transform:translateY(-2px);
  border-color:color-mix(in srgb, var(--poster, var(--tone)) 45%, var(--line))}
.episode-card>img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  filter:saturate(.85); z-index:-2}
.episode-card::after{content:""; position:absolute; inset:0;
  background:linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.3) 40%, rgba(0,0,0,.94)); z-index:-1}
.episode-card.watched{border-color:color-mix(in srgb, var(--poster, var(--tone)) 55%, transparent)}
.episode-number{position:absolute; top:10px; left:10px; font-size:12px; font-weight:800;
  background:rgba(0,0,0,.65); border:1px solid rgba(255,255,255,.18); color:#fff;
  padding:4px 8px; border-radius:8px}
.episode-actions{position:absolute; top:10px; right:10px; display:flex; gap:6px}
.episode-action{width:30px; height:30px; border-radius:50%; display:inline-flex; align-items:center;
  justify-content:center; background:rgba(0,0,0,.6); border:1px solid rgba(255,255,255,.16);
  color:#fff; cursor:pointer}
.episode-action .icon{width:15px; height:15px}
.episode-action.online{background:color-mix(in srgb, #ff6a1a 80%, #000)}
.episode-open{position:absolute; left:0; right:0; bottom:0; width:100%; text-align:left;
  font:inherit; padding:12px 14px; background:none; border:0; color:#fff; cursor:pointer}
.episode-open h4{margin:0 0 4px; font-size:14px}
.episode-open p{margin:0; font-size:11px; color:rgba(255,255,255,.65)}
.reviews{margin:30px 0 10px}
.row-head .review-avg{margin-left:auto}
.review-avg{font-size:13px; font-weight:800; color:#f5b50a}
.review-card{background:var(--surface); border:1px solid var(--line); border-radius:16px;
  padding:14px 16px; margin-bottom:10px; box-shadow:var(--shadow)}
.review-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; gap:10px}
.review-head b{font-size:14px}
.stars{color:#f5b50a; font-size:13px; letter-spacing:1px; white-space:nowrap}
.stars small{color:var(--muted); margin-left:6px; font-weight:800}
.review-card p{font-size:14px; color:var(--muted); line-height:1.55; margin:0}
.muted{color:var(--muted)}

/* ---------------------------------------------------------------------------
 * STEP 6: Cast & Characters (design phase — demo placeholders)
 * ------------------------------------------------------------------------- */
.cast{margin:30px 0 10px}
.cast-heading{font-size:12px; font-weight:800; letter-spacing:.14em; text-transform:uppercase;
  color:var(--poster, var(--tone)); margin:22px 0 12px}
.cast-heading:first-of-type{margin-top:4px}
.cast-list{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px}
.cast-card{width:100%; min-width:0; display:grid; grid-template-columns:74px minmax(0,1fr) auto;
  align-items:center; gap:13px; padding:9px; border:1px solid var(--line); border-radius:16px;
  background:var(--surface); text-align:left; cursor:pointer; color:inherit; font:inherit;
  transition:transform .24s cubic-bezier(.22,1,.36,1), border-color .2s ease, box-shadow .24s ease}
.cast-card:hover{transform:translateY(-2px);
  border-color:color-mix(in srgb, var(--poster, var(--tone)) 48%, var(--line));
  box-shadow:0 18px 38px color-mix(in srgb, var(--poster, var(--tone)) 14%, transparent)}
.cast-card-photo{width:74px; height:88px; object-fit:cover; object-position:center 26%;
  border-radius:11px; background:#19191f; filter:saturate(.86);
  transition:filter .22s ease, transform .32s cubic-bezier(.22,1,.36,1)}
.cast-card:hover .cast-card-photo{filter:saturate(1.08); transform:scale(1.025)}
.cast-card-copy{min-width:0}
.cast-card-copy strong, .cast-card-copy span, .cast-card-copy small{display:block}
.cast-card-copy strong{font-family:var(--font-serif); font-size:19px; line-height:1.08;
  color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.cast-card-copy span{font-size:12.5px; color:var(--muted); margin-top:5px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.cast-card-copy small{font-size:10.5px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--poster, var(--tone)); margin-top:5px}
.cast-card-arrow{display:inline-flex; color:var(--muted)}
.cast-card-arrow .icon{width:18px; height:18px}
.demo-note{display:inline-block; margin-top:12px; color:var(--muted); font-size:11px}
/* Profile modal */
.cast-profile-veil{position:fixed; inset:0; z-index:120; display:flex; align-items:center;
  justify-content:center; padding:22px; background:rgba(0,0,0,.72);
  -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px)}
.cast-profile-modal{position:relative; width:min(430px, 100%); max-height:88vh; overflow:auto;
  display:grid; grid-template-columns:150px minmax(0,1fr); border-radius:22px;
  background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow)}
.cast-profile-close{position:absolute; top:10px; right:10px; z-index:2; width:34px; height:34px;
  border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.55); border:1px solid var(--line); color:#fff; cursor:pointer}
.cast-profile-close .icon{width:16px; height:16px}
.cast-profile-image-wrap{background:#0c0c10}
.cast-profile-image{display:block; width:100%; height:100%; min-height:230px; object-fit:cover;
  object-position:center 24%; filter:saturate(.9)}
.cast-profile-content{display:flex; flex-direction:column; justify-content:center;
  padding:30px 24px; color:var(--text)}
.cast-profile-kicker{color:var(--poster, var(--tone)); font-size:10px; font-weight:800;
  letter-spacing:.16em; text-transform:uppercase}
.cast-profile-content h3{font-family:var(--font-serif); font-size:27px; margin:8px 0 4px; line-height:1.1}
.cast-profile-credit{font-size:13px; color:var(--muted); margin:0 0 12px}
.cast-profile-bio{font-size:14px; line-height:1.6; color:var(--text); opacity:.85; margin:0 0 14px}
.cast-profile-facts{list-style:none; margin:0 0 4px; padding:0; display:grid; gap:7px}
.cast-profile-facts li{font-size:12.5px; color:var(--muted); padding-left:14px; position:relative}
.cast-profile-facts li::before{content:""; position:absolute; left:0; top:7px; width:6px; height:6px;
  border-radius:50%; background:var(--poster, var(--tone))}
@media (max-width:560px){
  .cast-list{grid-template-columns:1fr}
  /* Mobile: clean cards — character image + name + tappable VA avatar only */
  .cast-card{grid-template-columns:60px minmax(0,1fr) auto; gap:10px; padding:8px}
  .cast-card-photo{width:60px; height:72px}
  .cast-card-copy strong{font-size:16px}
  .cast-card-copy span, .cast-card-copy small{display:none}
  .cast-va-photo{width:34px; height:34px}
  .cast-profile-modal{grid-template-columns:1fr; padding:0}
  .cast-profile-image-wrap{max-height:300px; overflow:hidden}
  .cast-profile-image{min-height:0; height:300px}
}
@media (prefers-reduced-motion:reduce){
  .cast-card, .cast-card-photo{transition:none}
  .cast-card:hover{transform:none}
}

/* Per-item history remove (History tab only). */
.rw-remove{position:absolute; top:6px; right:6px; z-index:2; width:26px; height:26px;
  border-radius:50%; border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.5); color:rgba(255,255,255,.85); cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center}
.rw-remove .icon{width:12px; height:12px}
.rw-remove:active{transform:scale(.92)}

/* ---- Manual Downloads ---- */
.episode-action.st-dl{background:rgba(20,60,120,.72); border-color:rgba(96,165,250,.65)}
.episode-action.st-dl.is-busy{background:rgba(120,70,10,.78); border-color:rgba(245,181,10,.7)}
.episode-action.st-dl.is-done{background:rgba(20,110,50,.78); border-color:rgba(52,211,153,.7)}
.st-dl-pct{font-size:9px; font-weight:800; color:#fff}
.dl-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:14px; margin-top:14px}
.dl-card .poster-img{position:relative}
.dl-count{position:absolute; left:8px; bottom:8px; font-size:11px; font-weight:800;
  background:rgba(0,0,0,.7); border:1px solid rgba(52,211,153,.6); color:#d1fae5;
  padding:3px 8px; border-radius:8px}
.episode-card.dl-have{border-color:rgba(52,211,153,.55)}
.dl-badge{position:absolute; right:8px; bottom:8px; width:24px; height:24px; border-radius:50%;
  background:rgba(20,110,50,.9); border:1px solid rgba(52,211,153,.8); color:#fff;
  display:inline-flex; align-items:center; justify-content:center}
.dl-badge .icon{width:13px; height:13px}
.trailer-btn.dl-series-del{border-color:rgba(248,113,113,.5); color:#fca5a5}

/* ---- Downloads: quality sheet + season picker ---- */
.dl-scrim{position:fixed; inset:0; z-index:1200; background:rgba(0,0,0,.62);
  display:flex; align-items:flex-end; justify-content:center; padding:0}
.dl-sheet{width:100%; max-width:520px; max-height:82vh; overflow-y:auto;
  background:#101828; border:1px solid rgba(96,165,250,.35); border-bottom:0;
  border-radius:16px 16px 0 0; padding:18px 16px calc(20px + env(safe-area-inset-bottom, 0px))}
.dl-sheet h3{margin:0 0 4px; font-size:17px}
.dl-sub{margin:0 0 12px; font-size:12px; color:#9fb0c9}
.dl-qopts{display:flex; flex-direction:column; gap:8px}
.dl-qopt{display:flex; align-items:center; justify-content:space-between;
  background:#0b1220; border:1px solid rgba(148,163,184,.25); border-radius:12px;
  padding:12px 14px; color:#e8eef7; font-size:15px; cursor:pointer}
.dl-qopt.sel{border-color:#3b82f6; background:rgba(59,130,246,.14)}
.dl-q{font-weight:800}
.dl-size{font-size:13px; color:#9fb0c9}
.dl-qopt.sel .dl-size{color:#cfe1ff}
.dl-sheet-actions{display:flex; gap:10px; margin-top:14px; position:sticky; bottom:0;
  background:#101828; padding:12px 0 4px}
.dl-cancel,.dl-go{flex:1; padding:12px; border-radius:12px; font-size:15px; font-weight:700; cursor:pointer}
.dl-cancel{background:transparent; border:1px solid rgba(148,163,184,.4); color:#cbd5e1}
.dl-go{background:#2563eb; border:1px solid #2563eb; color:#fff}
.dl-go:disabled{opacity:.45; cursor:default}
/* Loading state inside a sheet: spinner while the next step (e.g. probing
 * qualities) is being fetched, so the popup never leaves a dead gap. */
.dl-loading{display:flex; align-items:center; justify-content:center; padding:28px 0 10px}
.dl-spinner{width:34px; height:34px; border-radius:50%;
  border:3px solid rgba(148,163,184,.25); border-top-color:#3b82f6;
  animation:dl-spin .8s linear infinite}
@keyframes dl-spin{to{transform:rotate(360deg)}}
.dl-selectall{align-self:flex-start; background:rgba(59,130,246,.14); border:1px solid rgba(59,130,246,.5);
  color:#bfdbfe; border-radius:999px; padding:7px 14px; font-size:13px; font-weight:700; margin-bottom:10px; cursor:pointer}
.dl-eplist{display:flex; flex-direction:column; gap:6px; margin-bottom:4px}
.dl-ep{display:flex; align-items:center; gap:10px; background:#0b1220;
  border:1px solid rgba(148,163,184,.18); border-radius:10px; padding:9px 12px; cursor:pointer}
.dl-ep input{width:18px; height:18px; accent-color:#2563eb; flex:none}
.dl-epn{font-weight:800; font-size:13px; color:#9fb0c9; min-width:26px}
.dl-ept{flex:1; font-size:13px; color:#e8eef7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.dl-ep.is-done{opacity:.75}
.dl-epcheck{color:#34d399; display:inline-flex}
.dl-epcheck .icon{width:16px; height:16px}
/* season-download button in the episode list header */
.ep-season-dl{margin-left:10px; width:34px; height:34px; border-radius:50%;
  background:rgba(20,60,120,.72); border:1px solid rgba(96,165,250,.65); color:#fff;
  display:inline-flex; align-items:center; justify-content:center; cursor:pointer}
.ep-season-dl .icon{width:16px; height:16px}
.ep-season-dl:active{transform:scale(.92)}

/* Entry S15: on-device download matches in search */
.dev-sec{margin:0 0 14px}
.dev-title{font-size:13px; font-weight:800; letter-spacing:.04em; text-transform:uppercase;
  opacity:.75; margin:2px 2px 8px}
.dev-row{display:flex; gap:12px; overflow-x:auto; padding-bottom:6px; scroll-snap-type:x mandatory}
.dev-card{flex:0 0 118px; scroll-snap-align:start; text-decoration:none}

/* Entry 142 — auth screens */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: #0a0a0f; }
.auth-card { width: 100%; max-width: 380px; background: #14141c; border: 1px solid #26263a; border-radius: 18px; padding: 28px 24px; }
.auth-logo { font-weight: 800; font-size: 22px; letter-spacing: .5px; color: #fff; margin-bottom: 6px; }
.auth-title { font-size: 20px; margin: 0 0 18px; color: #fff; }
.auth-note { color: #a7a7c0; font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.auth-label { display: block; color: #c9c9de; font-size: 13px; margin-bottom: 12px; }
.auth-input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid #2c2c44; background: #0e0e15; color: #fff; font-size: 15px; box-sizing: border-box; }
.auth-input:focus { outline: none; border-color: #6d5cff; }
.auth-btn { width: 100%; padding: 13px; margin-top: 6px; border: none; border-radius: 12px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.auth-btn:disabled { opacity: .6; cursor: default; }
.auth-btn-ghost { background: #1e1e2c; border: 1px solid #2c2c44; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.auth-links a { color: #8f8ff0; text-decoration: none; }
.auth-err { background: #3a1620; border: 1px solid #7c2d3e; color: #ff9dab; font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }

/* Entry 142 chunk 2 — admin approvals */
.auth-sub { color: #fff; font-size: 14px; margin: 18px 0 8px; }
.auth-user { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: #0e0e15; border: 1px solid #26263a; border-radius: 12px; margin-bottom: 8px; }
.auth-user-name { color: #fff; font-weight: 700; font-size: 14px; }
.auth-user-sub { color: #8a8aa3; font-size: 12px; margin-top: 2px; }
.auth-mini-btn { padding: 7px 12px; border: none; border-radius: 9px; background: #2f7a4d; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-mini-btn:disabled { opacity: .5; }
.auth-mini-danger { background: #5c2430; }
