:root {
  --bg: #0f0f0f; --bg2: #1c1c1c; --bg3: #272727; --fg: #f1f1f1; --fg2: #aaa; --line: #303030;
  --accent: #ff6600; --top: 56px; --side: 228px; --bottom: 0px; --bar: 46px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; height: calc(var(--top) + env(safe-area-inset-top)); z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--bg);
}
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg3); }
.logo { font-size: 20px; letter-spacing: -.5px; display: flex; align-items: baseline; gap: 1px; white-space: nowrap; }
.logo b { background: var(--accent); color: #fff; border-radius: 6px; padding: 0 5px; margin-left: 2px; }
.logo small { font-size: 11px; color: var(--fg2); margin-left: 5px; }
.search { flex: 1; max-width: 560px; margin: 0 auto; display: flex; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-right: 0;
  border-radius: 20px 0 0 20px; background: #121212; color: var(--fg); font-size: 16px; outline: none;
}
.search input:focus { border-color: #1c62b9; }
.search button { width: 60px; border: 1px solid var(--line); border-radius: 0 20px 20px 0; background: var(--bg3); display: grid; place-items: center; }
.search-toggle { display: none; }
.lang-btn { border: 1px solid var(--line); background: var(--bg2); border-radius: 18px; height: 36px; min-width: 44px; padding: 0 12px; font-weight: 600; }
.lang-btn:hover { background: var(--bg3); }

/* ---------- navigation ---------- */
.side {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); padding: 8px 12px; overflow-y: auto; z-index: 40; background: var(--bg);
}
.side a { display: flex; align-items: center; gap: 20px; padding: 0 12px; height: 42px; border-radius: 10px; font-size: 14px; }
.side a:hover { background: var(--bg2); }
.side a.on { background: var(--bg3); font-weight: 600; }
.bottom { display: none; }
main { padding: calc(var(--top) + env(safe-area-inset-top) + 8px) 24px calc(32px + var(--bottom)) calc(var(--side) + 24px); min-height: 100vh; }

/* ---------- chips & lists ---------- */
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.sub { padding-top: 0; }
.chip { flex: none; padding: 6px 12px; border-radius: 8px; background: var(--bg3); font-size: 14px; white-space: nowrap; border: 0; }
.chip:hover { background: #3a3a3a; }
.chip.on { background: var(--fg); color: #0f0f0f; }
.chip.plain { background: transparent; border: 1px solid var(--line); color: var(--fg2); }
.chips .sep { flex: none; width: 1px; background: var(--line); margin: 4px 2px; }
.page-title { font-size: 22px; margin: 8px 0 12px; }
.page-desc { color: var(--fg2); margin: -6px 0 14px; max-width: 900px; font-size: 14px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; color: var(--fg2); font-size: 14px; }
.list-head h1, .list-head h2 { color: var(--fg); margin: 0; }
select { background: var(--bg3); color: var(--fg); border: 0; border-radius: 8px; padding: 6px 8px; font: inherit; }
.btn { background: var(--bg3); border: 0; border-radius: 18px; padding: 8px 18px; font-size: 14px; }
.btn:hover { background: #3a3a3a; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.primary { background: var(--fg); color: #0f0f0f; font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
a.btn { display: inline-block; }

/* account */
.acct { max-width: 560px; }
.acct-intro { color: var(--fg2); font-size: 14px; margin: -4px 0 16px; }
.acct-card { background: var(--bg2); border-radius: 14px; padding: 18px 20px; margin-bottom: 12px; }
.acct-card h2 { font-size: 16px; margin: 0 0 6px; }
.acct-card p { color: var(--fg2); font-size: 13px; margin: 0 0 12px; }
.acct-number { font: 600 22px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; margin: 6px 0 14px; font-variant-numeric: tabular-nums; }
.acct-number.big { font-size: clamp(22px, 6vw, 32px); padding: 14px 16px; background: #0f0f0f; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.acct-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.acct-actions:last-child { margin-bottom: 0; }
.acct-warn { color: #f5d48a !important; background: rgba(245, 180, 40, .1); border: 1px solid rgba(245, 180, 40, .25); border-radius: 10px; padding: 10px 12px; }
.acct-meta { margin: 0 0 6px !important; }
.acct-login { display: flex; gap: 8px; }
.acct-login input {
  flex: 1; min-width: 0; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 19px; background: #121212; color: var(--fg);
  font: 500 16px ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; outline: none;
}
.acct-login input:focus { border-color: #3ea6ff; }
.acct-error { color: #ff6b6b !important; font-size: 13px; margin: 0 0 12px; }
.btn.danger { color: #ff6b6b; }
.acct-summary { margin-bottom: 10px !important; }
.more { display: flex; justify-content: center; padding: 24px 0; }
.empty { color: var(--fg2); padding: 24px 0; }
.loading { height: 3px; width: 30%; background: var(--accent); animation: load 1s infinite ease-in-out; margin: 24px 0; border-radius: 2px; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 32px 16px; }
.card { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--bg2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.card:hover .thumb img { transform: scale(1.03); }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.badge-zh { position: absolute; left: 6px; bottom: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.prog { position: absolute; left: 0; bottom: 0; height: 3px; background: #f00; }
.info { padding: 10px 2px 0; }
.info h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.4; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ch, .mt { color: var(--fg2); font-size: 13px; }
.why { color: var(--fg2); font-size: 12px; margin-top: 4px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.area { margin-bottom: 28px; }
.area h2 { font-size: 18px; margin: 0 0 10px; }
.area h2 small { color: var(--fg2); font-weight: 400; font-size: 13px; margin-left: 6px; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; background: var(--bg2); border-radius: 10px; font-size: 14px; }
.cat:hover { background: var(--bg3); }
.cat small { color: var(--fg2); }
.shelf { margin-bottom: 24px; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 260px; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.row .empty { grid-column: 1 / -1; }

.settings section { padding: 16px 0; border-bottom: 1px solid var(--line); max-width: 640px; }
.settings h2 { font-size: 16px; margin: 0 0 10px; }
.settings p { color: var(--fg2); font-size: 13px; margin: 8px 0 0; }
.prose { max-width: 720px; color: #ddd; }
.prose a { color: #3ea6ff; }
.prose a.btn { color: #0f0f0f; }
.prose h2 { font-size: 16px; margin: 20px 0 8px; }
.prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 6px; }
.prose .note { color: var(--fg2); font-size: 14px; }

/* Android app bar (Android browsers only, until closed): floats above the bottom navigation, under the sticky
   player and its style sheet; the page gets room at its end so nothing stays hidden behind it */
.app-banner {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--bottom) + 8px); z-index: 25; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 12px; background: var(--bg3); border: 1px solid var(--line); border-radius: 14px;
}
body.has-app-banner main::after { content: ""; display: block; height: 72px; }
.ab-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ab-info img { flex: none; border-radius: 9px; }
.ab-info span { min-width: 0; display: flex; flex-direction: column; }
.ab-info b { font-size: 14px; }
.ab-info small { color: var(--fg2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-banner .btn { flex: none; padding: 6px 14px; }
.app-banner .icon-btn { flex: none; color: var(--fg2); padding: 6px; }
.app-banner .icon-btn svg { width: 20px; height: 20px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--bottom)); transform: translateX(-50%); background: #f1f1f1; color: #0f0f0f; padding: 10px 18px; border-radius: 8px; z-index: 2000; font-size: 14px; }

/* segmented control (settings + player bar) */
.seg { display: inline-flex; background: var(--bg3); border-radius: 18px; padding: 3px; gap: 2px; align-items: center; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 15px; font-size: 13px; white-space: nowrap; }
.seg button.on { background: var(--fg); color: #0f0f0f; font-weight: 600; }

/* ---------- watch page ---------- */
body[data-page=watch] main { padding-left: 24px; }
body[data-page=watch] .side { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px #000; }
body[data-page=watch].side-open .side { transform: none; }
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; max-width: 1760px; margin: 0 auto; }
.watch-main, .watch-side { min-width: 0; }
/* the maximized player must sit above the header and bottom bar, so lift its sticky wrapper too */
.player-slot.lifted { position: relative; z-index: 1000 !important; }
.v-title { font-size: 20px; line-height: 1.4; margin: 12px 0 2px; }
.v-orig { color: var(--fg2); font-size: 13px; }
.v-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 8px 0; font-size: 14px; color: var(--fg2); }
.v-meta b { color: var(--fg); font-size: 15px; }
.actions { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.actions::-webkit-scrollbar { display: none; }
.pill { flex: none; border: 0; background: var(--bg3); border-radius: 18px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.pill:hover { background: #3a3a3a; }
.pill.on { background: var(--fg); color: #0f0f0f; }
.desc { background: var(--bg2); border-radius: 12px; padding: 12px 16px; margin: 8px 0 20px; font-size: 14px; }
.desc p { margin: 4px 0 10px; }
.desc h3 { font-size: 14px; margin: 12px 0 2px; color: var(--fg2); }
.desc blockquote { margin: 10px 0; padding-left: 12px; border-left: 3px solid var(--accent); color: #ddd; }
.desc blockquote small { color: var(--fg2); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.warn { background: #3a2a00; color: #ffcf66; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.warn a { text-decoration: underline; }
.comments h2, .watch-side h2 { font-size: 18px; margin: 0 0 12px; }
.comments h2 small { color: var(--fg2); font-weight: 400; font-size: 13px; margin-left: 6px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.c-head { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.author { font-weight: 600; }
.author:hover { text-decoration: underline; }
.month { color: var(--fg2); }
.stance { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--bg3); color: var(--fg2); }
.stance.strong_rec { background: #1f3d1f; color: #8fe08f; }
.stance.rec { background: #1d2f3f; color: #8cc8ff; }
.stance.critical { background: #3f1d1d; color: #ff9b9b; }
.c-story { color: var(--fg2); font-size: 12px; margin: 4px 0; }
.c-text, .c-orig { line-height: 1.65; overflow-wrap: anywhere; }
.c-orig { color: #ccc; }
.ph { color: var(--accent); font-size: 12px; }
.link { background: none; border: 0; padding: 4px 0 0; color: #3ea6ff; font-size: 13px; }
.watch-side .card.compact { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; margin-bottom: 10px; }
.card.compact .thumb { border-radius: 8px; }
.card.compact .info { padding: 0; }
.card.compact h3 { font-size: 14px; }
.card.compact .ch, .card.compact .mt { font-size: 12px; }

/* ---------- player ---------- */
.player-shell { background: #000; border-radius: 12px; overflow: hidden; }
.player-stage { display: grid; place-items: center; background: #000; }
.player-video { position: relative; width: 100%; aspect-ratio: 16/9; container-type: inline-size; }
.player-video iframe, .player-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.subs-overlay {
  position: absolute; left: 4%; right: 4%; bottom: var(--sub-bottom, 10%); display: flex; flex-direction: column; align-items: center; gap: .3em;
  pointer-events: none; text-align: center; --k: 1;
}
/* --sub-* come from substyle.js */
.sub {
  max-width: 100%; padding: .12em .5em; border-radius: .3em; background: var(--sub-bg, rgba(0,0,0,.7)); color: var(--sub-color, #fff);
  font-family: var(--sub-font, inherit); font-size: max(13px, calc(var(--k) * 2.7cqw)); line-height: 1.4; letter-spacing: .01em;
  text-shadow: var(--sub-shadow, none); white-space: pre-line; transition: background-color .2s, color .2s;
}
.sub.src { font-size: max(11px, calc(var(--k) * 1.9cqw)); color: color-mix(in srgb, var(--sub-color, #fff) 82%, #808080); }
.sub.zh { order: 2; font-weight: 500; }
.glass .sub {
  padding: .2em .7em; border-radius: .55em; border: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
}
.player-bar {
  display: flex; align-items: center; gap: 8px; height: var(--bar); padding: 0 8px; background: #161616; overflow-x: auto; scrollbar-width: none;
}
.player-bar::-webkit-scrollbar { display: none; }
.player-bar .seg { background: #262626; }
.seg-icon { display: grid; place-items: center; padding: 0 4px 0 6px; color: var(--fg2); }
.seg-icon svg { width: 20px; height: 20px; }
.pbtn { flex: none; display: flex; align-items: center; gap: 6px; border: 0; background: #262626; border-radius: 18px; height: 32px; padding: 0 12px; font-size: 13px; }
.pbtn:hover { background: #333; }
.pbtn svg { width: 20px; height: 20px; }
.pbtn.on { background: var(--fg); color: #0f0f0f; }
.bar-note { flex: 1; min-width: 0; color: var(--fg2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* subtitle style panel (over the video) and its controls (also on the settings page) */
.player-shell { position: relative; }
.sub-panel {
  position: absolute; right: 12px; bottom: calc(var(--bar) + 10px); z-index: 5; width: 344px; max-width: calc(100% - 24px);
  max-height: calc(100% - var(--bar) - 20px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 14px;
  background: rgba(24,24,26,.88); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.08); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.55); font-size: 13px;
}
.sub-panel[hidden] { display: none; }
@media (min-width: 721px) { /* keep the live subtitles beside the open panel, not under it */
  .player-shell:has(.sub-panel:not([hidden])) .subs-overlay { right: 368px; }
}
.sub-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 10px; font-size: 14px; font-weight: 600; }
.sub-panel-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--fg2); font-size: 13px; }
.sub-panel-close:hover { background: rgba(255,255,255,.08); color: var(--fg); }
.ss-swatch, .ss-preview {
  background: radial-gradient(ellipse 45% 40% at 50% 92%, #e9e3d6, transparent), radial-gradient(ellipse 40% 50% at 22% 30%, #b49a7c, transparent),
    linear-gradient(160deg, #46586a, #1c2127 70%);
}
.ss-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.ss-preset { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--fg2); font-size: 11px; white-space: nowrap; }
.ss-swatch { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 10px; display: grid; place-items: end center; padding-bottom: 14%; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.ss-swatch .sub { font-size: 13px; padding: .05em .4em; }
.ss-preset:hover .ss-swatch { outline-color: #555; }
.ss-preset.on { color: var(--fg); }
.ss-preset.on .ss-swatch { outline-color: var(--fg); }
.ss-row { display: grid; grid-template-columns: 6em minmax(0, 1fr) 40px; align-items: center; gap: 10px; min-height: 38px; }
.ss-row > span { color: var(--fg2); }
.ss-row output { text-align: right; color: var(--fg2); font-variant-numeric: tabular-nums; font-size: 12px; }
.ss-row > .seg, .ss-colors { grid-column: 2 / 4; justify-self: start; }
.ss-row .seg { background: rgba(255,255,255,.08); }
.ss-row .seg button { padding: 4px 12px; }
.ss-row input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; margin: 0; border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--fg) var(--fill), rgba(255,255,255,.16) var(--fill));
}
.ss-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.ss-row input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.ss-colors { display: flex; gap: 12px; padding-left: 2px; }
.ss-colors button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.ss-colors button.on { outline-color: var(--fg); }
.ss-reset { margin-top: 6px; padding: 4px 0; border: 0; background: none; color: var(--fg2); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.ss-reset:hover { color: var(--fg); }
.ss-preview { position: relative; aspect-ratio: 16/9; max-width: 560px; border-radius: 12px; overflow: hidden; container-type: inline-size; margin-bottom: 8px; }
.ss-panel { max-width: 560px; font-size: 14px; }

/* in-window maximize and fullscreen share one layout: video fills the window, bar at the bottom */
.player-shell.theater, .player-shell.fullscreen {
  position: fixed; inset: 0; z-index: 1000; border-radius: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.player-shell.fullscreen { position: static; width: 100%; height: 100%; }
.theater .player-stage, .fullscreen .player-stage { flex: 1; min-height: 0; }
.theater .player-video, .fullscreen .player-video {
  width: min(100%, calc((100dvh - var(--bar) - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9));
}
.theater .player-bar, .fullscreen .player-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bar) + env(safe-area-inset-bottom)); }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  :root { --side: 76px; }
  .side a { flex-direction: column; gap: 4px; height: 66px; justify-content: center; font-size: 10px; padding: 0; text-align: center; }
  .side a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; }
  .watch { grid-template-columns: minmax(0, 1fr); }
  .watch-side .card.compact { grid-template-columns: 200px minmax(0, 1fr); }
}

/* ---------- phone ---------- */
@media (max-width: 720px) {
  :root { --top: 50px; --bottom: calc(56px + env(safe-area-inset-bottom)); }
  .top { gap: 6px; padding: 0 8px 0 12px; }
  .menu-btn { display: none; }
  .logo { font-size: 18px; }
  .search { display: none; }
  .search-toggle { display: grid; margin-left: auto; }
  body.search-open .search { display: flex; position: absolute; inset: 0; background: var(--bg); padding: 7px 8px; z-index: 2; max-width: none; }
  .side { display: none; }
  .bottom {
    display: flex; position: fixed; inset: auto 0 0 0; height: var(--bottom); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(15,15,15,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 50;
  }
  .bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--fg2); }
  .bottom a.on { color: var(--fg); }
  .bottom a.on svg { stroke-width: 2.4; }
  main { padding: calc(var(--top) + env(safe-area-inset-top) + 4px) 0 calc(24px + var(--bottom)) 0; }
  .chips, .list-head, .page-title, .page-desc, .area, .settings, .prose, .shelf, .empty, .more { padding-left: 12px; padding-right: 12px; }
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .thumb { border-radius: 0; }
  .info { padding: 10px 12px 0; }
  .row { grid-auto-columns: 70%; padding-left: 12px; }
  .row .card .thumb { border-radius: 10px; }
  .row .info { padding: 8px 0 0; }

  /* watch: header scrolls away, the player sticks to the top */
  body[data-page=watch] .top { position: absolute; }
  body[data-page=watch] main { padding: calc(var(--top) + env(safe-area-inset-top)) 0 calc(24px + var(--bottom)); }
  .player-slot { position: sticky; top: env(safe-area-inset-top); z-index: 30; }
  .player-shell { border-radius: 0; }
  .pbtn .lbl, .seg-icon { display: none; }
  .pbtn { padding: 0 9px; }
  .seg button { padding: 5px 9px; }
  .watch { gap: 8px; }
  .watch-main > :not(.player-slot) { margin-left: 12px; margin-right: 12px; }
  .v-title { font-size: 17px; }
  .watch-side { padding: 0 12px; }
  .watch-side .card.compact { grid-template-columns: 150px minmax(0, 1fr); }
  .toast { bottom: calc(16px + var(--bottom)); }
  /* style panel as a bottom sheet that keeps the sticky video above it visible */
  .sub-panel {
    position: fixed; left: 0; right: 0; bottom: var(--bottom); width: auto; max-width: none; border-radius: 18px 18px 0 0;
    max-height: min(70dvh, calc(100dvh - var(--bottom) - 56.25vw - var(--bar) - 8px)); padding-bottom: 16px;
  }
  .theater .sub-panel, .fullscreen .sub-panel { bottom: 0; max-height: 70dvh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* phone held sideways: a sticky 16:9 player would fill the screen, so let it scroll away
   (网页全屏 is one tap away) */
@media (max-height: 500px) and (orientation: landscape) {
  .player-slot { position: static; }
}

/* Infinite scroll status under lists */
.more { align-items: center; gap: 12px; min-height: 40px; color: var(--fg2); font-size: 14px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--bg3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-shell:focus { outline: none; }
/* Server-rendered page content, shown until the app renders the page */
.ssr { padding: 8px 0 32px; }
.ssr h1 { font-size: 20px; margin: 8px 0 12px; }
.ssr ul { padding-left: 1.2em; }
.ssr blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--fg2); }
/* "+5 秒" after an arrow-key seek, over the middle of the video */
.seek-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 18px; font-weight: 600; padding: 8px 16px; border-radius: 18px; }
/* Shortcut key on the maximize and fullscreen buttons: desktop only (a mouse and a wide window) */
.pkbd { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 721px) {
  .pkbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 2px;
    border: 1px solid #4a4a4a; border-bottom-width: 2px; border-radius: 4px; background: #1a1a1a; color: var(--fg2);
    font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
}
