:root {
  --bg: #0f1014;
  --bg2: #181a20;
  --bg3: #23262e;
  --line: #2e323c;
  --text: #e8e9ec;
  --muted: #8b909c;
  --accent: #e50914;
  --accent2: #ff4d57;
  --ok: #3ccf7a;
  --radius: 10px;
  --fs: 1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* clip, unlike hidden, keeps position: sticky working. */
body { overflow-x: clip; }
body { font: calc(15px * var(--fs))/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1 { font-size: calc(26px * var(--fs)); margin: 8px 0 18px; }
h2 { font-size: calc(18px * var(--fs)); margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: calc(13px * var(--fs)); word-break: break-all; }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px;
  padding: 12px 4vw; background: linear-gradient(#0f1014 60%, rgba(15,16,20,.85));
  backdrop-filter: blur(8px); border-bottom: 1px solid #1d2027;
}
.logo { font-size: calc(22px * var(--fs)); font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--accent); }
nav { display: flex; gap: 6px; }
nav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); }
nav a i { display: none; font-style: normal; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); background: var(--bg3); }
.top-search { position: relative; margin-left: auto; }
.top-recent {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: max(100%, 280px); max-height: 60vh; overflow-y: auto;
  padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); box-shadow: 0 12px 30px rgba(0,0,0,.6);
}
.top-recent-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 6px; color: var(--muted); font-size: calc(12px * var(--fs)); }
.top-recent-head .link { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: inherit; }
.top-recent-head .link:hover { color: var(--text); }
.top-recent-item { display: flex; align-items: center; border-radius: 8px; }
.top-recent-item:hover { background: var(--bg3); }
.top-recent-q { flex: 1; min-width: 0; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(14px * var(--fs)); }
.top-search input { width: 240px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); outline: none; }
.top-search input:focus { border-color: var(--accent); }
main { padding: 20px 4vw 60px; }
main.page-in { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.page-hint { margin: -6px 0 16px; }
.tabs + .page-hint { margin-top: 0; }
.back-btn { margin-bottom: 14px; }
.push-right { margin-left: auto; }

/* buttons, chips, inputs */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg3); cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #4a505e; background: #2b2f39; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent2); border-color: var(--accent2); }
.btn.danger { color: #ff7b82; }
.btn.danger-fill { background: #c62a33; border-color: #c62a33; color: #fff; font-weight: 600; }
.btn.danger-fill:hover:not(:disabled) { background: #e0444d; border-color: #e0444d; }
.btn:focus-visible, .chip:focus-visible, .ep:focus-visible, .source-chip:focus-visible, .tab:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn.big { padding: 11px 22px; font-size: calc(16px * var(--fs)); }
.btn.small { padding: 5px 10px; font-size: calc(13px * var(--fs)); }
.btn.more { display: flex; margin: 24px auto 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; align-items: center; }
.chip { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: calc(14px * var(--fs)); }
.chip:hover { border-color: #4a505e; }
.chip.active { background: var(--text); color: #111; border-color: var(--text); font-weight: 600; }
.chip.recent { display: inline-flex; align-items: center; gap: 4px; padding-right: 6px; cursor: default; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: calc(16px * var(--fs)); line-height: 1; padding: 0 4px; border-radius: 50%; }
.chip-x:hover { color: var(--text); background: var(--bg3); }
input[type=text], input[type=search], input[type=number], input[type=password] {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); outline: none;
}
input:focus { border-color: var(--accent); }
input[type=number] { width: 80px; }
.muted { color: var(--muted); font-size: calc(13px * var(--fs)); }
.empty { color: var(--muted); padding: 24px 0; }
.error-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; text-align: center; color: var(--muted); }
.error-state p { margin: 0; }
.error-state.inline { align-items: flex-start; padding: 8px 0; text-align: left; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form input[type=text] { flex: 1; min-width: 260px; }
.password-form input[type=password] { flex: 1; min-width: 180px; }
.account-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.account-head .tag { margin-left: 8px; }
.user-item .spacer { flex: 1; }
.small-note { margin: 0; font-size: calc(13px * var(--fs)); }
.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: calc(14px * var(--fs)); padding: 6px 0; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* posters and cards */
.card { display: block; width: 100%; min-width: 0; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #262a33, #1a1c22); box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.poster .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px; text-align: center; background: linear-gradient(135deg, #2a2a34, #15151b);
}
.poster .ph b { font-size: calc(34px * var(--fs)); font-weight: 900; color: rgba(255,255,255,.4); line-height: 1.1; }
.poster .ph small { font-size: calc(12px * var(--fs)); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card:hover .poster { outline: 2px solid var(--text); outline-offset: 2px; }
.badge { position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 6px; font-size: calc(12px * var(--fs)); background: rgba(0,0,0,.72); color: #ffd36b; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.2); }
.progress i { display: block; height: 100%; background: var(--accent); }
.remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.7); cursor: pointer; font-size: calc(16px * var(--fs)); line-height: 1; opacity: 0;
}
.card:hover .remove, .card:focus-within .remove, .remove:focus-visible { opacity: 1; }
.remove:hover { background: var(--accent); }
@media (hover: none) { .remove { opacity: 1; } }
.card-title { margin-top: 8px; font-size: calc(14px * var(--fs)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: calc(12px * var(--fs)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row { margin: 0 0 30px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.row-more { margin-left: 12px; font-size: calc(13px * var(--fs)); font-weight: 400; color: var(--muted); }
.row-more:hover { color: var(--text); }
.chevron { display: block; width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.row-nav { display: flex; gap: 14px; }
.row-nav button { display: flex; align-items: center; justify-content: center; padding: 0; color: var(--text); width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: calc(18px * var(--fs)); }
.row-nav button:hover { background: var(--bg3); }
/* Positioned so visually hidden labels inside cards are clipped with the row instead of widening the page. */
.row-items { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.row-items::-webkit-scrollbar { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 14px; }
.filters { margin-bottom: 18px; }

/* loading skeletons */
.shimmer { background: linear-gradient(110deg, #1c1c24 30%, #2e2e39 50%, #1c1c24 70%) 0 0 / 300% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.skeleton .poster { box-shadow: none; }
.sk-line { height: 12px; width: 80%; margin-top: 10px; border-radius: 4px; }
.sk-items { overflow: hidden; }

/* search */
.search-box { display: flex; gap: 10px; margin-bottom: 14px; max-width: 720px; }
.search-box input { flex: 1; font-size: calc(17px * var(--fs)); padding: 11px 16px; }
.status { margin: 6px 0 18px; color: var(--muted); }
.status .loading { padding: 0; }

/* detail */
.hero {
  position: relative; display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 28px;
  border-radius: 16px; overflow: hidden; margin-bottom: 24px; background: var(--bg2); isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; inset: -40px; z-index: -1; background: var(--hero-bg) center / cover no-repeat;
  filter: blur(40px) brightness(.35); transform: scale(1.1);
}
.hero h1 { margin: 0 0 10px; font-size: calc(32px * var(--fs)); }
.hero .meta { color: #c4c7cf; font-size: calc(14px * var(--fs)); margin-bottom: 4px; }
.hero .clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 900px; }
.hero .desc { color: #c9ccd3; max-width: 900px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.detail-section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.source-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.source-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 130px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left;
}
.source-chip b { font-size: calc(14px * var(--fs)); }
.source-chip span { font-size: calc(12px * var(--fs)); color: var(--ok); }
.source-chip small { font-size: calc(11px * var(--fs)); color: var(--muted); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-chip.failed { opacity: .55; }
.source-chip.failed span { color: #ff7b82; }
.source-chip.active { border-color: var(--accent); background: #2a1416; }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ep {
  padding: 8px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: calc(14px * var(--fs));
}
.ep:hover { border-color: #4a505e; }
.ep.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-mark { margin-left: 4px; padding: 0 5px; border-radius: 4px; font-size: calc(11px * var(--fs)); background: rgba(0,0,0,.3); }

/* sources and settings */
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.source-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--bg2); border: 1px solid #1f2229; }
.source-item.off .source-name { color: var(--muted); }
.source-name { flex: 1; font-weight: 600; }
.source-name:hover { text-decoration: underline; }
.tag { font-size: calc(12px * var(--fs)); padding: 2px 8px; border-radius: 6px; background: var(--bg3); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #3a3f4a; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.panel { background: var(--bg2); border-radius: 12px; padding: 16px 18px; margin: 10px 0 28px; max-width: 900px; display: grid; gap: 12px; }
.panel .toolbar { margin: 0; }
.sub-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sub-item code { flex: 1; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; }
.setting b { display: block; font-weight: 600; }
.setting small { color: var(--muted); }
.setting.static { cursor: default; flex-wrap: wrap; }
.setting.static .chips { margin: 0; }
.key-setting { align-items: flex-start; margin-bottom: 16px; }
.key-setting > span { flex: 1 1 280px; }
.key-setting .inline-form { flex: 1 1 360px; }
.key-setting input[type=password] { flex: 1; min-width: 220px; }
.about { margin: 0; line-height: 1.7; }

/* player */
body.is-player main { padding-top: 12px; }
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.player-wrap { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.player-wrap:fullscreen { border-radius: 0; aspect-ratio: auto; }
.player-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.player-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(rgba(0,0,0,.75), transparent); opacity: 0; transition: opacity .25s;
}
.player-wrap:hover .player-top, .player-wrap:focus-within .player-top { opacity: 1; }
.player-top .btn { background: rgba(30,30,30,.7); }
.player-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.player-title b, .player-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title span { font-size: calc(13px * var(--fs)); color: #c4c7cf; }
.player-msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 80%; padding: 12px 20px;
  border-radius: 10px; background: rgba(0,0,0,.75); text-align: center; pointer-events: none;
}
.player-msg.interactive { pointer-events: auto; }
.player-msg .btn { margin-top: 10px; }
.player-hud {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); padding: 10px 20px; border-radius: 10px;
  background: rgba(0,0,0,.7); font-size: calc(18px * var(--fs)); font-weight: 700; white-space: nowrap; pointer-events: none;
}
.player-panel { background: var(--bg2); border-radius: 12px; padding: 14px; max-height: calc(100vh - 110px); overflow: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 12px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-body .episodes { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.tab-body .source-chip { min-width: 0; width: 100%; }
.skip-panel p { margin: 0 0 12px; }
.keys { margin: 16px 0 0; line-height: 1.8; }

#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); z-index: 50; display: flex; align-items: center; gap: 14px;
  max-width: min(560px, calc(100vw - 32px)); padding: 8px 10px 8px 20px; min-height: 44px;
  border-radius: 12px; background: #282832; box-shadow: 0 6px 24px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-msg { padding: 2px 10px 2px 0; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; padding: 28px; border-radius: 16px; background: var(--bg2); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-card .logo { margin-bottom: 8px; text-align: center; }
.login-card label { color: var(--muted); font-size: calc(13px * var(--fs)); }
.login-card input { padding: 11px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { justify-content: center; }
.login-error { margin: 0; color: #ff7b82; font-size: calc(14px * var(--fs)); }

/* dialogs */
.dialog {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: #1e1e26; color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog[open] { animation: page-in .16s ease-out; }
.dialog form { padding: 22px 24px; }
.dialog h2 { font-size: calc(20px * var(--fs)); }
.dialog-sub { margin-top: 4px; color: var(--accent2); font-size: calc(13px * var(--fs)); }
.dialog-msg { color: var(--muted); margin: 10px 0 0; word-break: break-all; }
.dialog-list { margin: 14px 0 0; padding-left: 20px; line-height: 1.6; }
.dialog-list li { margin: 6px 0; color: #ddd; }
.dialog-list li::marker { color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

/* personalized home */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.home-head > span { flex: 1; }
.platform-section { margin-top: 12px; }
.platform-heading {
  margin: 28px 0 14px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: calc(24px * var(--fs)); font-weight: 800; letter-spacing: .5px;
}
.home-sentinel { height: 1px; }
.home-note { margin: 0 0 20px; font-size: calc(13px * var(--fs)); }

.hero-carousel { position: relative; height: clamp(260px, 42vw, 460px); margin-bottom: 30px; border-radius: 16px; overflow: hidden; background: var(--bg2); }
.hero-slide {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: clamp(18px, 4vw, 44px);
  background: linear-gradient(90deg, rgba(10,10,14,.92) 0%, rgba(10,10,14,.55) 45%, rgba(10,10,14,0) 75%),
    linear-gradient(0deg, rgba(10,10,14,.85) 0%, rgba(10,10,14,0) 45%), var(--hero-img) center / cover no-repeat;
  opacity: 0; visibility: hidden; transition: opacity .6s, visibility .6s;
}
.hero-slide.active { opacity: 1; visibility: visible; }
.hero-copy { max-width: 560px; }
.hero-copy h2 { margin: 0 0 6px; font-size: calc(34px * var(--fs)); line-height: 1.15; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.hero-copy .meta { color: #c4c7cf; font-size: calc(14px * var(--fs)); }
.hero-reason { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 6px; background: rgba(229,9,20,.85); color: #fff; font-size: calc(13px * var(--fs)); font-weight: 600; }
.hero-copy .desc { color: #d5d7dd; margin: 10px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-copy .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hero-arrow {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(10,10,14,.55); color: #fff; cursor: pointer;
  padding: 0; display: flex; align-items: center; justify-content: center;
  opacity: .55; transition: opacity .2s, background .2s;
}
.hero-carousel:has(.hero-arrow) .hero-slide { padding-left: 76px; padding-right: 76px; }
.hero-arrow.prev { left: 14px; }
.hero-arrow.next { right: 14px; }
.hero-carousel:hover .hero-arrow, .hero-arrow:focus-visible { opacity: 1; }
.hero-arrow:hover { background: rgba(10,10,14,.85); }
.hero-dots { position: absolute; right: 18px; bottom: 16px; display: flex; gap: 6px; }
.hero-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.35); cursor: pointer; }
.hero-dots button.active { background: #fff; width: 22px; border-radius: 5px; }

.top10-row .row-items { grid-auto-columns: 180px; gap: 16px; }
.top10-card { display: block; min-width: 0; }
.top10-art { display: flex; align-items: flex-end; }
.top10-card .top10-rank {
  flex: none; width: 44px; margin-right: -6px; text-align: right; font-size: calc(80px * var(--fs)); font-weight: 900; line-height: .78;
  color: var(--bg); -webkit-text-stroke: 2px #6f7480; letter-spacing: -6px; user-select: none; white-space: nowrap;
}
.top10-card .poster { flex: 1; min-width: 0; z-index: 1; }
.top10-text { padding-left: 38px; }
.top10-card:hover .poster, .top10-card:focus-visible .poster { outline: 2px solid var(--text); outline-offset: 2px; }
.top10-card:hover .top10-rank { -webkit-text-stroke-color: var(--text); }
.up-next {
  position: absolute; right: 16px; bottom: 64px; z-index: 5; display: flex; gap: 12px; max-width: min(420px, calc(100% - 32px));
  padding: 12px; border-radius: 10px; background: rgba(15,16,20,.92); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.up-next img { width: 72px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; flex: none; }
.up-next-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.up-next-body small { color: var(--muted); font-size: calc(12px * var(--fs)); }
.up-next-body b { font-size: calc(16px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-next-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.dismissed { opacity: .25; pointer-events: none; filter: grayscale(1); transition: opacity .3s; }
/* ---- 分類瀏覽 ---- */
.browse-bar {
  position: sticky; top: var(--sticky-top, 0px); z-index: 10; margin: 0 -4vw 10px; padding: 10px 4vw 4px;
  background: var(--bg); box-shadow: 0 12px 16px -12px rgba(0,0,0,.7); display: flex; flex-direction: column; gap: 10px;
}
.pills { display: flex; gap: 8px; align-items: center; }
.pills-scroller { position: relative; min-width: 0; }
.pills.scroll { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; padding: 2px 0; }
.pills.scroll::-webkit-scrollbar { display: none; }
.pills-scroller.can-left .pills.scroll { mask-image: linear-gradient(90deg, transparent, #000 56px); }
.pills-scroller.can-right .pills.scroll { mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.pills-scroller.can-left.can-right .pills.scroll { mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.pills-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; padding: 0; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.pills-arrow:hover { background: var(--bg3); }
.pills-arrow.left { left: 0; }
.pills-arrow.right { right: 0; }
.pills-scroller.can-left .pills-arrow.left, .pills-scroller.can-right .pills-arrow.right { display: flex; }
@media (hover: none) { .pills-arrow { display: none !important; } }
.pill {
  flex: none; padding: 6px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted);
  cursor: pointer; font-size: calc(14px * var(--fs)); transition: color .15s, background .15s, border-color .15s;
}
.pill:hover { color: var(--text); border-color: #4a505e; }
.pill.active { color: #111; background: var(--text); border-color: var(--text); font-weight: 700; }
.pill:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.platform-pills .pill { padding: 9px 20px; font-size: calc(15px * var(--fs)); font-weight: 700; background: var(--bg3); }
.platform-pills .pill.active { color: #fff; background: var(--brand, var(--accent)); border-color: var(--brand, var(--accent)); box-shadow: 0 4px 18px color-mix(in srgb, var(--brand, var(--accent)) 45%, transparent); }
.platform-pills [data-id="netflix"] { --brand: #e50914; }
.platform-pills [data-id="disney"] { --brand: #113ccf; }
.platform-pills [data-id="prime"] { --brand: #00a8e1; }
.platform-pills [data-id="apple"] { --brand: #3a3a3c; }
.platform-pills [data-id="max"] { --brand: #002be7; }
.platform-pills [data-id="douban"] { --brand: #2e963d; }
.platform-pills [data-id="all"] { --brand: #5b5f6b; }
.browse-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.browse-line .spacer { flex: 1; }
.segmented { flex: none; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); }
.segmented .pill { border: 0; background: none; padding: 5px 14px; }
.segmented .pill.active { background: var(--bg3); color: var(--text); box-shadow: inset 0 0 0 1px #4a505e; }
.genre-pills .pill { font-size: calc(13px * var(--fs)); padding: 5px 13px; }
.browse-summary { scroll-margin-top: 200px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 4px 0 16px; min-height: 22px; }
.browse-crumbs { font-weight: 700; }
.browse-checking { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: calc(13px * var(--fs)); }
.card.no-source .poster img { filter: grayscale(.7) brightness(.55); }
.source-tag { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; font-size: calc(12px * var(--fs)); background: rgba(0,0,0,.72); color: #fff; }
.source-tag .spin { width: 12px; height: 12px; }
.browse-footer { display: flex; justify-content: center; padding: 26px 0 10px; }
.browse-end { color: var(--muted); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fade-in { animation: fade-in .35s ease-out both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.platform-heading a { margin-left: 14px; font-size: calc(14px * var(--fs)); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.platform-heading a:hover { color: var(--text); }
@media (max-width: 1000px) {
  .player-layout { grid-template-columns: 1fr; }
  .player-panel { max-height: none; }
  .top-search input { width: 170px; }
}
@media (max-width: 700px) {
  .top-search { flex: 1; min-width: 0; }
  .top-search input { width: 100%; }
  .hero-arrow { width: 36px; height: 36px; opacity: .8; }
  .hero-arrow.prev { left: 8px; }
  .hero-carousel:has(.hero-arrow) .hero-slide { padding-left: 52px; padding-right: 52px; }
  .hero-arrow.next { right: 8px; }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .hero .poster { width: 160px; }
  /* backdrop-filter would make the topbar the containing block of the fixed bottom nav. */
  .topbar { gap: 12px; padding: 10px 3vw; backdrop-filter: none; background: #0f1014; }
  .row-items { grid-auto-columns: 120px; }
  .top10-row .row-items { grid-auto-columns: 140px; gap: 12px; }
  .top10-card .top10-rank { width: 34px; font-size: calc(60px * var(--fs)); letter-spacing: -4px; }
  .top10-text { padding-left: 28px; }
  .hero-copy h2 { font-size: calc(24px * var(--fs)); }
  .hero-copy .desc { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .browse-bar { margin: 0 -3vw 8px; padding: 8px 3vw 2px; gap: 8px; }
  .browse-line { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .browse-line .spacer { display: none; }
  .platform-pills .pill { padding: 7px 15px; }
  /* Narrow windows move the navigation to a bottom bar, like SyncTV in portrait. */
  nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0; padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    background: #101015; border-top: 1px solid #1d2027;
  }
  nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; padding: 4px 0; font-size: calc(11px * var(--fs)); border-radius: 0; }
  nav a i { display: block; padding: 0 12px; border-radius: 12px; font-size: calc(18px * var(--fs)); line-height: 1.4; }
  nav a.active { background: none; color: var(--accent); font-weight: 700; }
  nav a.active i { background: rgba(229,9,20,.2); }
  main { padding-bottom: 90px; }
  #toast { bottom: 76px; }
  body.is-player nav { display: none; }
}
@media (pointer: coarse) {
  .btn, .chip, .ep { min-height: 44px; }
  .chip-x { min-width: 32px; min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  main.page-in, .dialog[open], .shimmer { animation: none; }
  .hero-slide { transition: none; }
}
