/* Two themes (theme.js sets data-theme before the first paint). Light is the default, like YouTube's;
   Settings → Appearance switches to dark. Anything drawn over a video picture keeps its own fixed colours. */
:root {
  --bg: #ffffff; --surface: #f2f2f2; --surface2: #e5e5e5; --line: #dedede;
  --text: #0f0f0f; --muted: #606060; --dim: #737373;
  --accent: #f0355a; --accent2: #ff7a29; --ok: #128a5a;
  --hover: #d6d6d6; --bar: rgba(255, 255, 255, .94); --bar2: rgba(255, 255, 255, .97); --bar-line: #e5e5e5;
  --field: #ffffff; --field-search: #ffffff; --field-focus: #1c62b9; --inv: #0f0f0f; --inv-fg: #ffffff; --inv-hover: #3a3a3a;
  --danger: #fde8ec; --danger-fg: #c21e43; --err: #fdecee; --err-fg: #a3172f;
  --track: #dadada; --switch: #c4c4c4; --link: #065fd4; --own: #dcdcdc;
  --toast: #0f0f0f; --toast-fg: #ffffff; --shadow: rgba(0, 0, 0, .16);
  --now: #fdebef; --now-fg: #c8244a; --sel: #fff0f3; --mini-bg: #ffffff; --plempty: linear-gradient(135deg, #f6e7ec, #e9e9f1);
  --top: 56px; --nav: 60px; --mini: 64px; --rail: 84px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0f12; --surface: #18181d; --surface2: #222229; --line: #2c2c35;
  --text: #f1f1f4; --muted: #a2a2ad; --dim: #6f6f7a;
  --accent: #ff4d6d; --accent2: #ff8a3d; --ok: #3ddc97;
  --hover: #2d2d36; --bar: rgba(15, 15, 18, .92); --bar2: rgba(15, 15, 18, .96); --bar-line: #1c1c22;
  --field: #111115; --field-search: #121216; --field-focus: #4a4a58; --inv: #f1f1f4; --inv-fg: #111111; --inv-hover: #d9d9de;
  --danger: #3a1820; --danger-fg: #ff8fa3; --err: #2a1519; --err-fg: #ffb3c0;
  --track: #333333; --switch: #3a3a44; --link: #7cb7ff; --own: #3a3a46;
  --toast: #f1f1f4; --toast-fg: #111111; --shadow: rgba(0, 0, 0, .5);
  --now: #2a1820; --now-fg: #ff9fb2; --sel: #24141a; --mini-bg: #1b1b21; --plempty: linear-gradient(135deg, #2a1a22, #1d1d28);
  color-scheme: dark;
}
/* The Android app before 2.1.4 keeps white status / navigation bar icons whatever the page does: on the light
   theme the strips behind them stay dark, or the clock and the gesture bar would be white on white. */
html.nb-darkbars #topbar { box-shadow: inset 0 var(--safe-t) 0 #000; }
html.nb-darkbars #nav { box-shadow: inset 0 calc(-1 * var(--safe-b)) 0 #000; }
html.nb-darkbars .sheet-card { box-shadow: inset 0 calc(-1 * var(--safe-b)) 0 #000; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { position: relative; min-height: 100vh; overscroll-behavior-y: contain; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
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 ── */
#topbar { position: fixed; inset: 0 0 auto 0; height: calc(var(--top) + var(--safe-t)); padding: var(--safe-t) 12px 0;
  display: flex; align-items: center; gap: 10px; background: var(--bar);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 40; border-bottom: 1px solid var(--bar-line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 19px; letter-spacing: -.3px; flex: none; }
.brand img { border-radius: 7px; }
.brand b { color: var(--accent); font-weight: 700; }
#searchForm { position: relative; flex: 1; max-width: 640px; margin: 0 auto; display: flex; }
#q { flex: 1; min-width: 0; height: 40px; border-radius: 20px 0 0 20px; border: 1px solid var(--line);
  background: var(--field-search); padding: 0 16px; outline: none; }
#q:focus { border-color: var(--field-focus); }
#searchForm > .icon-btn { border-radius: 0 20px 20px 0; border: 1px solid var(--line); border-left: 0;
  background: var(--surface2); width: 56px; height: 40px; }
#suggest { position: absolute; top: 44px; left: 0; right: 56px; margin: 0; padding: 6px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; z-index: 50;
  box-shadow: 0 12px 40px var(--shadow); }
#suggest li { padding: 9px 16px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
#suggest li.sel, #suggest li:hover { background: var(--surface2); }
#suggest li svg { width: 18px; height: 18px; color: var(--dim); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface2); }
.avatar-btn img { width: 30px; height: 30px; border-radius: 50%; }
.avatar-btn .letter { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; }

/* ── nav: bottom on mobile, rail on desktop ── */
#nav { position: fixed; z-index: 41; display: flex; background: var(--bar2);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--muted); }
#nav a.on { color: var(--text); }
#nav a.on svg { color: var(--accent); }
@media (max-width: 999px) {
  #nav { inset: auto 0 0 0; height: calc(var(--nav) + var(--safe-b)); padding-bottom: var(--safe-b);
    border-top: 1px solid var(--bar-line); }
  #nav a { flex: 1; }
  #view { padding: calc(var(--top) + var(--safe-t) + 8px) 0 calc(var(--nav) + var(--safe-b) + 16px); }
  body.has-mini #view { padding-bottom: calc(var(--nav) + var(--mini) + var(--safe-b) + 16px); }
  .brand span { display: none; }
}
@media (min-width: 1000px) {
  #nav { top: var(--top); left: 0; bottom: 0; width: var(--rail); flex-direction: column; padding-top: 8px; gap: 4px; }
  #nav a { height: 70px; border-radius: 12px; margin: 0 6px; }
  #nav a:hover { background: var(--surface); }
  #view { padding: calc(var(--top) + 16px) 24px 40px calc(var(--rail) + 24px); }
  body.has-mini #view { padding-bottom: 120px; }
}

/* ── generic ── */
#view:focus { outline: none; }
.page { max-width: 1800px; margin: 0 auto; }
h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 22px 0 12px; }
.pad { padding: 0 14px; }
@media (min-width: 1000px) { .pad { padding: 0; } }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 13px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 19px;
  border: 0; background: var(--surface2); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--inv); color: var(--inv-fg); }
.btn.primary:hover { background: var(--inv-hover); }
.btn.accent { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn.on { background: var(--inv); color: var(--inv-fg); }
.btn.danger { background: var(--danger); color: var(--danger-fg); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 14px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 1000px) { .chips { padding: 2px 0 14px; } }
.chip { flex: none; height: 32px; padding: 0 14px; border-radius: 9px; background: var(--surface2); border: 0;
  cursor: pointer; display: inline-flex; align-items: center; font-size: 14px; }
.chip.on { background: var(--inv); color: var(--inv-fg); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--dim); margin-bottom: 8px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--track); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { background: var(--err); color: var(--err-fg); padding: 12px 16px; border-radius: 10px; margin: 12px 14px; }

/* ── video cards ── */
.grid { display: grid; gap: 22px 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 680px) { .grid { grid-template-columns: 1fr; gap: 18px; } }
.card { display: block; min-width: 0; position: relative; }
.thumb { display: block; position: relative; aspect-ratio: 16/9; background: var(--surface); overflow: hidden; }
@media (min-width: 681px) { .thumb { border-radius: var(--radius); } }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.03); }
.badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.82); color: #fff; font-size: 12px; font-weight: 600;
  padding: 2px 5px; border-radius: 5px; }
.badge.live { background: #e0244a; }
.resume { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.meta { display: flex; gap: 10px; padding: 10px 2px 0; }
@media (max-width: 680px) { .meta { padding: 10px 14px 0; } }
.meta .av { width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); flex: none; object-fit: cover; }
.meta .av.ph { display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.meta .txt { flex: 1; min-width: 0; }
.meta .t { font-weight: 600; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.meta .s { color: var(--muted); font-size: 13px; line-height: 1.35; }
.meta .s a:hover { color: var(--text); }
.meta .why { color: var(--dim); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { margin: -6px -8px 0 0; width: 34px; height: 34px; align-self: flex-start; }
.more svg { width: 20px; height: 20px; }

/* list rows (search results, related on desktop) */
.rows { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 14px; min-width: 0; }
.row .thumb { width: min(42%, 360px); flex: none; border-radius: var(--radius); }
.row .meta { padding: 0; flex: 1; min-width: 0; }
.row .desc { color: var(--dim); font-size: 13px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.rows.compact .row .thumb { width: 168px; }
.rows.compact .meta .t { font-size: 14px; }
@media (max-width: 680px) {
  .rows { gap: 18px; }
  .rows:not(.compact) .row { flex-direction: column; gap: 0; }
  .rows:not(.compact) .row .thumb { width: 100%; border-radius: 0; }
  .rows:not(.compact) .row .meta { padding: 10px 14px 0; }
  .rows.compact { padding: 0 14px; }
  .rows.compact .row .thumb { width: 150px; }
}

/* horizontal shelf */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 14px;
  overflow-x: auto; padding: 0 14px 6px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.shelf .card { scroll-snap-align: start; }
.shelf .thumb { border-radius: var(--radius); }
.shelf .meta { padding: 8px 0 0; }
@media (min-width: 1000px) { .shelf { padding: 0 0 6px; } }

/* ── player ── */
/* below #topbar (40) and #nav (41): the top bar owns a stacking context, so a player above it would also
   cover the search suggestions that hang out of it (z-index 50 inside 40 still loses to 45). */
#player { position: fixed; z-index: 35; background: #000; }
#player.hidden { display: none; }
#player .stage { position: relative; width: 100%; height: 100%; background: #000; color: #fff; }
#player video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
/* the last 360p frame, held over the picture for the moment the player switches to HD (P.swapToHD) */
#player .hd-hold { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
#player audio { display: none; }
/* a tapped Home preview playing on as the picture until the full player has its own (PV.bridge in app.js) */
#player video.pv-bridge { position: absolute; inset: 0; z-index: 1; }
/* the standby (PV.standby in app.js): a player loaded to its first picture for the likeliest next tap — out of sight */
.pv-standby-host { position: fixed; left: 0; top: 0; width: 4px; height: 4px; overflow: hidden; opacity: 0; pointer-events: none; z-index: -1; }
.pv-standby-host video { width: 4px; height: 4px; }
/* The video element never gets `controls`, so the browser draws nothing of its own over the picture — no
   control bar, no ⋮ menu, no play mark, no loading ring. These rules are only a guard for a WebView that
   puts them up anyway (some do in full screen). Everything the viewer sees is .pc, further down. */
video::-webkit-media-controls, video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-panel, video::-webkit-media-controls-overlay-play-button { display: none !important; }
.audio-art { position: absolute; inset: 0; display: grid; place-items: center; background: #000; pointer-events: none; }
.audio-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(24px) brightness(.45); }
.audio-art span { position: relative; padding: 6px 14px; border-radius: 16px; background: rgba(0,0,0,.6); font-size: 13px; }
#player.audio .stage video { opacity: 0; }
.player-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  background: rgba(0,0,0,.75); font-size: 14px; }
.player-msg.tap { cursor: pointer; }                 /* "Tap to start": the message is the button */
.mini-progress, .mini-left, .mini-meta, .mini-acts, .mini-right { display: none; }

/* watch mode (mobile): pinned under the top bar */
#player.watch { top: calc(var(--top) + var(--safe-t)); left: 0; width: 100%; aspect-ratio: 16/9; max-height: 45vh; }
/* pin the stage to the player box: % heights don't resolve reliably inside aspect-ratio boxes */
#player.watch .stage { position: absolute; inset: 0; width: auto; height: auto; }
body.watching #view { padding-top: calc(var(--top) + var(--safe-t) + min(56.25vw, 45vh)); }
/* desktop: JS places it over .player-slot */
@media (min-width: 1000px) {
  #player.watch { position: absolute; aspect-ratio: auto; max-height: none; border-radius: var(--radius); overflow: hidden; }
  body.watching #view { padding-top: calc(var(--top) + 16px); }
}
/* A phone watching a video has no top bar at all, like YouTube's app: the picture starts right under the
   status bar, and the strip behind that bar is black with the rest of the player (theme.js is told to put
   light icons on it, as it does for Shorts). The chevron on the video and the system back do what the bar's
   back arrow did; the search is one step away, on whatever page you came from. */
@media (max-width: 999px) {
  body.watching #topbar { display: none; }
  body.watching #player.watch { top: var(--safe-t); }
  body.watching #view { padding-top: calc(var(--safe-t) + min(56.25vw, 45vh)); }
  body.watching::before { content: ""; position: fixed; inset: 0 0 auto 0; height: var(--safe-t); background: #000; z-index: 36; }
}

/* mini mode: a bar along the bottom, laid out like YouTube Music's player bar. Phones: right above the tab bar,
   with the cover, title, play and next. 760px and up: the whole bar. 1000px and up: along the very bottom,
   under the side rail too (P.miniRect() mirrors the phone numbers). The picture itself is the cover: the
   stage shrinks into the square, so nothing is ever drawn over it. */
#player.mini { left: 0; right: 0; bottom: calc(var(--nav) + var(--safe-b)); height: var(--mini);
  display: grid; align-items: center; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "art meta left";
  padding: 0 4px 0 8px; background: var(--mini-bg); color: var(--text); touch-action: none; cursor: pointer;
  box-shadow: 0 -1px 0 var(--line); }
#player.mini .stage { grid-area: art; width: 48px; height: 48px; border-radius: 4px; overflow: hidden; }
#player.mini video, #player.mini .hd-hold { object-fit: cover; }
#player.mini .player-msg, #player.mini .audio-art span { display: none; }
#player.mini .audio-art img { filter: none; }
/* while the stage flies between the page and the bar (P.fly), the bar comes in around it */
#player.mini > :not(.stage) { transition: opacity .2s ease; }
#player.mini.flying { background: transparent; box-shadow: none; }
#player.mini.flying > :not(.stage) { opacity: 0; transition: none; }
#player.mini.flying .stage { height: 27px; align-self: center; border-radius: 0; }

#player.mini .mini-left { grid-area: left; display: flex; align-items: center; }
#player.mini .mini-meta { grid-area: meta; display: block; min-width: 0; padding: 0 12px; }
.mini-title { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title:hover { text-decoration: underline; }
.mini-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-time { display: none; margin-left: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#player.mini .icon-btn { color: var(--text); }
#player.mini .icon-btn:hover { background: transparent; }
#player.mini .mb-play svg { width: 30px; height: 30px; }
#player.mini .mb-next svg { width: 24px; height: 24px; }
#player .i-pause { display: none; }
#player.playing .i-pause { display: block; }
#player.playing .i-play { display: none; }

/* the red line on the top edge: 2px, thicker with a knob under the pointer or while dragged (wide screens) */
#player.mini .mini-progress { display: block; position: absolute; left: 0; right: 0; top: -1px; height: 2px; pointer-events: none; z-index: 1; }
.mp-track { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--track); transition: height .1s, top .1s; }
.mp-buf, .mp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; font-style: normal; }
.mp-buf { background: rgba(128, 128, 128, .35); }
.mp-fill { background: #f0002a; }
.mp-knob { position: absolute; top: 1px; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: #f0002a; transform: scale(0); transition: transform .1s; }

@media (min-width: 760px) {
  #player.mini { grid-template-columns: minmax(max-content, 1fr) auto minmax(0, max-content) max-content minmax(max-content, 1fr);
    grid-template-areas: "left art meta acts right"; padding: 0 16px 0 8px; }
  #player.mini .stage { width: 40px; height: 40px; border-radius: 2px; }
  #player.mini.flying .stage { height: 22.5px; }
  #player.mini .mini-meta { padding: 0 8px 0 16px; max-width: min(36vw, 440px); }
  .mini-title { font-size: 16px; }
  .mini-sub { font-size: 14px; }
  .mini-time { display: inline; }
  #player.mini .mb-play { width: 56px; height: 56px; }
  #player.mini .mb-play svg { width: 40px; height: 40px; }
  #player.mini .mini-acts { grid-area: acts; display: flex; align-items: center; gap: 4px; }
  #player.mini .mini-right { grid-area: right; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
  #player.mini .mini-acts svg, #player.mini .mini-right svg { width: 24px; height: 24px; }
  .mb-like.on svg, .mb-dislike.on svg { fill: currentColor; }
  .mb-like.on svg path:first-child, .mb-dislike.on svg path:first-child { fill: currentColor; }
  #player.mini .mb-repeat, #player.mini .mb-shuffle { color: var(--muted); position: relative; }
  #player.mini .mb-repeat.on, #player.mini .mb-shuffle.on { color: var(--text); }
  #player.mini .mb-shuffle:disabled { opacity: .35; cursor: default; }
  .mb-repeat b { display: none; position: absolute; left: 0; right: 0; top: 13px; font-size: 8px; font-weight: 800; text-align: center; }
  .mb-repeat.one b { display: block; }
  .mb-vol { display: flex; align-items: center; }
  .mb-vol .i-mute { display: none; }
  .mb-vol.muted .i-mute { display: block; }
  .mb-vol.muted .i-vol { display: none; }
  .mb-vol input { -webkit-appearance: none; appearance: none; width: 0; height: 3px; opacity: 0; margin: 0; border-radius: 2px; cursor: pointer;
    background: linear-gradient(var(--text), var(--text)) 0 0 / var(--v, 100%) 100% no-repeat, var(--track);
    transition: width .15s, opacity .15s, margin .15s; }
  .mb-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); }
  .mb-vol input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); }
  .mb-vol:hover input, .mb-vol input:focus-visible { width: 96px; opacity: 1; margin-right: 6px; }
  #player.mini .mini-progress { top: -7px; height: 14px; pointer-events: auto; cursor: pointer; touch-action: none; }
  #player.mini .mp-track { top: 6px; }
  #player.mini .mp-knob { top: 7px; }
  #player.mini .mini-progress:hover .mp-track, #player.mini .mini-progress.drag .mp-track { top: 5px; height: 4px; }
  #player.mini .mini-progress:hover .mp-knob, #player.mini .mini-progress.drag .mp-knob { transform: scale(1); }
}
/* touch screens set the volume with their own buttons */
@media (hover: none) { .mb-vol { display: none !important; } }
@media (min-width: 1000px) {
  :root { --mini: 72px; }
  #player.mini { bottom: 0; z-index: 42; }                 /* over the rail, which stops short of it */
  body.has-mini #nav { bottom: var(--mini); }
  body.has-mini #toast { bottom: calc(var(--mini) + 24px); }
}
@media (max-width: 999px) {
  #player.watch .stage { touch-action: none; }         /* a vertical swipe on the video is ours (minimise), not a scroll */
}
/* The native app's floating window (picture-in-picture) shows this page shrunk to a thumbnail, so while it
   is up the page is nothing but the picture. */
body.pip { overflow: hidden; }
body.pip #topbar, body.pip #nav, body.pip #view, body.pip #toast, body.pip #sheet, body.pip .shorts { display: none !important; }
body.pip #player { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto;
  border: 0; border-radius: 0; padding: 0; box-shadow: none; transform: none !important; opacity: 1 !important; }
body.pip #player .stage, body.pip #player.mini .stage { position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; }
body.pip #player.mini { background: #000; box-shadow: none; }
body.pip #player.mini video, body.pip #player.mini .hd-hold { object-fit: contain; }
body.pip #player:not(.hidden) { display: block !important; }
body.pip #player .mini-meta, body.pip #player .mini-left, body.pip #player .mini-acts, body.pip #player .mini-right, body.pip #player .mini-progress,
body.pip #player .pc, body.pip .audio-art span { display: none !important; }

/* ── the player's own controls, drawn like YouTube's ──
   While the video plays there is nothing over the picture at all. A tap brings the whole layer up — a dim
   over the picture, the chevron and the buttons at the top, the three transport buttons in the middle, the
   time and full screen at the bottom, and the red line along the bottom edge — and a few seconds later it
   goes again. Paused, it stays up. Only in watch mode: the floating mini player is a picture and nothing
   else. Colours here are fixed, never the theme's: this all sits on a black picture. */
#player .pc { position: absolute; inset: 0; z-index: 4; color: #fff; display: none; }
#player.watch .pc { display: block; opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility .15s; }
#player.watch.pc-on .pc { opacity: 1; visibility: visible; }
#player .pc-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); }
#player .pc button { color: #fff; background: none; border: 0; padding: 0; cursor: pointer; }
#player .pc .icon-btn:hover { background: rgba(255, 255, 255, .15); }
/* the rows let a tap through to the picture (that is what shows and hides the layer); their buttons take it */
#player .pc-top, #player .pc-mid, #player .pc-bot { pointer-events: none; }
#player .pc-top button, #player .pc-mid button, #player .pc-bot button { pointer-events: auto; }
#player .pc-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 2px; padding: 6px 10px; }
#player .pc-sp { flex: 1; min-width: 0; }
#player .pc-top .icon-btn svg { width: 22px; height: 22px; }
#player .pc-cc.on { background: #fff; color: #111; }
#player .pc-cc.off { opacity: .5; }
#player .pc-mid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 14%; }
#player .pc-mid button { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; }
#player .pc-mid svg { width: 30px; height: 30px; }
#player .pc-play svg { width: 44px; height: 44px; }
#player .pc-mid button:disabled { opacity: .3; cursor: default; }
#player .pc-bot { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; align-items: center;
  gap: 8px; padding: 0 10px; font-size: 12px; }
#player .pc-time { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
#player .pc-chap { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; opacity: .92; display: flex; align-items: center; gap: 2px; }
#player .pc-chap svg { width: 14px; height: 14px; }
#player .pc-full svg { width: 22px; height: 22px; }
/* the seek bar: a 3 px line along the very bottom edge, with a taller invisible band to grab it by */
#player .pc-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; touch-action: none; cursor: pointer; }
#player .pc-bar > * { position: absolute; bottom: 3px; left: 0; height: 3px; border-radius: 2px; }
#player .pc-track { right: 0; background: rgba(255, 255, 255, .3); }
#player .pc-buf { width: 0; background: rgba(255, 255, 255, .5); }
#player .pc-fill { width: 0; background: #f0002a; }
#player .pc-knob { width: 13px; height: 13px; bottom: -2px; margin-left: -6.5px; border-radius: 50%; background: #f0002a;
  transform: scale(0); transition: transform .12s ease; }
#player.pc-on .pc-knob, #player.pc-scrub .pc-knob { transform: scale(1); }
#player.pc-scrub .pc-knob { transform: scale(1.35); }
/* double tap left or right: ∓10 s, with the same mark YouTube flashes — outside .pc, so it shows over a
   bare picture too (and leaves it bare: it fades out by itself and nothing else comes up) */
.pc-set { padding: 0 18px 6px; }                       /* the ⋮ sheet: quality and speed */
#player .pc-taps { position: absolute; inset: 0; z-index: 5; pointer-events: none; color: #fff; }
#player.mini .pc-taps, body.pip #player .pc-taps { display: none; }
#player .pc-tap { position: absolute; top: 0; bottom: 0; width: 36%; display: grid; place-items: center; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%); }
#player .pc-tap span { display: flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
#player .pc-tap svg { width: 15px; height: 15px; }
#player .pc-tap-l { left: 0; } #player .pc-tap-r { right: 0; }
#player .pc-tap.go { animation: pcTap .5s ease-out; }
@keyframes pcTap { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
/* full screen: the box is the full-screen element, so the controls come with it */
#player:fullscreen, #player:-webkit-full-screen { top: 0; left: 0; width: 100%; height: 100%;
  max-height: none; aspect-ratio: auto; border-radius: 0; }
#player:fullscreen .stage, #player:-webkit-full-screen .stage { position: absolute; inset: 0; width: auto; height: auto; }
#player:fullscreen .pc-bot, #player:-webkit-full-screen .pc-bot { bottom: 20px; padding: 0 18px; font-size: 13px; }
#player:fullscreen .pc-top, #player:-webkit-full-screen .pc-top { padding: 10px 14px; }
/* the chevron shrinks the player to the floating one: a phone thing, as it was before */
@media (min-width: 1000px) { #player .pc-min { display: none; } }
/* Subtitles are the browser's own box, which a page may not style or move with CSS — PC.cueLine() lifts
   them off the bottom edge, and further while the controls are up, by each cue's own `line`. */

/* ── watch page ── */
/* minmax(0,1fr): without it the single mobile column grows to the widest child (the
   one-line action row), which widens the whole layout viewport on phones. */
.watch { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.watch-col, .watch-main, #side, .actions, .chapters { min-width: 0; max-width: 100%; }
@media (min-width: 1000px) { .watch { grid-template-columns: minmax(0, 1fr) 400px; max-width: 1760px; margin: 0 auto; } }
.player-slot { aspect-ratio: 16/9; width: 100%; max-height: calc(100vh - 170px); border-radius: var(--radius); background: #000; }
@media (max-width: 999px) { .player-slot { display: none; } }
/* Title and stats are one button, as on YouTube: the title is cut to a line under the picture, the stats
   line ends in "…more", and a tap on either opens the full title and the description together. */
.vmeta { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.vtitle { display: block; font-size: 19px; font-weight: 700; margin: 12px 0 6px; line-height: 1.3; letter-spacing: -.2px; }
.vstats { display: block; color: var(--muted); font-size: 13px; }
.vstats b { color: var(--text); font-weight: 600; margin-left: 5px; }
.vmeta.open .vstats b { display: none; }
@media (max-width: 999px) {
  .vmeta .vtitle { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 17px; }
  .vmeta.open .vtitle { -webkit-line-clamp: 6; }
}
@media (min-width: 1000px) { .vstats b { display: none; } }   /* the desktop title is never cut */
.owner { display: flex; align-items: center; gap: 12px; margin: 14px 0 12px; flex-wrap: wrap; }
.owner img { width: 42px; height: 42px; border-radius: 50%; background: var(--surface2); }
.owner .n { font-weight: 600; }
.owner .grow { flex: 1; min-width: 120px; }
.actions { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
/* A phone drops the words from Share and Save, as YouTube does, so all five fit without the row scrolling
   (the count stays on Like — it is worth the width). */
@media (max-width: 999px) {
  .actions .lb { display: none; }
  .actions .btn { padding: 0 14px; }
  .actions #moreBtn { margin-left: auto; }
}
.actions::-webkit-scrollbar { display: none; }
.actions select { height: 38px; border-radius: 19px; border: 0; background: var(--surface2); padding: 0 12px; cursor: pointer; }
.descbox { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; font-size: 14px;
  white-space: pre-wrap; word-break: break-word; cursor: pointer; }
.descbox.clamp { max-height: 7.2em; overflow: hidden; -webkit-mask: linear-gradient(#000 60%, transparent); mask: linear-gradient(#000 60%, transparent); }
.descbox a { color: var(--link); }
/* ── comments: YouTube's, to read only (mountComments in app.js) ── */
.comments { margin-top: 12px; background: var(--surface); border-radius: var(--radius); }
.cm-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left; font-size: 15px; }
button.cm-head { cursor: pointer; }
.cm-count { flex: 1; color: var(--muted); font-size: 13px; }
.cm-head svg { width: 20px; height: 20px; color: var(--muted); transition: transform .15s; }
.cm-head[aria-expanded="true"] svg, .cm-rep.open svg { transform: rotate(180deg); }
.cm-body { padding: 2px 14px 14px; }
.cm-body .spinner { margin: 14px auto; }
.cm-body .err { margin: 0 0 10px; }
.cm-sort { display: flex; gap: 8px; margin-bottom: 16px; }
.cm-sort button { height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: var(--surface2); font-size: 13px; cursor: pointer; }
.cm-sort button.on { background: var(--inv); color: var(--inv-fg); }
.cm { display: flex; gap: 12px; margin-bottom: 16px; min-width: 0; }
.cm-av { flex: none; width: 36px; height: 36px; }
.cm-av img, .cm-av .ph { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--surface2); display: grid; place-items: center;
  font-weight: 700; text-transform: uppercase; }
.cm-b { flex: 1; min-width: 0; }
.cm-pin { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cm-h { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.cm-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 13px; font-weight: 600; }
.cm-n.own { padding: 1px 8px; border-radius: 10px; background: var(--own); }                 /* the uploader's own comment */
.cm-h svg { flex: none; width: 13px; height: 13px; stroke-width: 2.5; }                     /* verified channel */
.cm-h > span:last-child { flex: none; }
.cm-t { margin-top: 3px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-t.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cm-t a { color: var(--link); }
.cm-rm { display: block; margin-top: 2px; padding: 2px 0; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.cm-f { display: flex; align-items: center; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.cm-f span { display: inline-flex; align-items: center; gap: 5px; }
.cm-f svg { width: 15px; height: 15px; }
.cm-heart { color: var(--accent); font-size: 14px; }                                        /* the uploader liked it */
.cm-rep { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; border: 0; background: none; color: var(--link); font-size: 13px; font-weight: 600; cursor: pointer; }
.cm-rep svg { transition: transform .15s; }
.cm-replies { margin-top: 12px; }
.cm-replies .cm { margin-bottom: 12px; }
.cm-replies .cm-av { width: 24px; height: 24px; }
.cm-none { margin: 0; padding: 2px 0; color: var(--muted); font-size: 14px; }
/* in Shorts they open in the sheet, which scrolls; tall from the start so it doesn't jump when they arrive */
.cm-sheet { min-height: 60vh; margin: 0; background: none; }
/* Shorts comments: a sheet of fixed height with a grip; the list scrolls inside it under a heading that stays.
   Pulled down (grip, heading, or the list at its top) it follows the finger and closes. */
#sheet.cm-mode .sheet-card { display: flex; flex-direction: column; overflow: hidden; height: 64vh; max-height: none; padding-top: 0;
  transition: transform .2s ease; }
#sheet.cm-mode .sheet-card.dragging { transition: none; }
.cm-grab { flex: none; height: 24px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.cm-grab::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--dim); }
#sheet.cm-mode .cm-sheet { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#sheet.cm-mode .cm-head { position: sticky; top: 0; z-index: 1; background: var(--surface); padding-top: 2px; touch-action: none; cursor: grab; }
/* Phones: no dimming — the short shrinks into the space above the sheet and keeps playing, with nothing over it.
   A tap on it closes the sheet (that tap lands on #sheet's empty part). */
@media (max-width: 999px) {
  #sheet.cm-mode { background: none; align-items: flex-end; }
  #sheet.cm-mode .sheet-card { max-width: none; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 18px rgba(0, 0, 0, .35); }
  .shorts .s-frame { transition: height .2s ease; }
  body:has(#sheet.cm-mode:not([hidden])) .shorts .short { align-items: flex-start; }
  body:has(#sheet.cm-mode:not([hidden])) .shorts .s-frame { height: calc(36vh - var(--safe-t)); margin-top: var(--safe-t); }
  body:has(#sheet.cm-mode:not([hidden])) .shorts .s-frame video,
  body:has(#sheet.cm-mode:not([hidden])) .shorts .s-frame .sposter { object-fit: contain; }
  body:has(#sheet.cm-mode:not([hidden])) .shorts :is(.s-meta, .s-acts, .s-prog, .sh-top) { display: none; }
  body:has(#sheet.cm-mode:not([hidden])) .shorts .s-frame::after { display: none; }
}
.chapters { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; }
.chapters button { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; cursor: pointer; font-size: 13px; text-align: left; max-width: 220px; }
.chapters b { color: var(--link); display: block; font-size: 12px; }
.upnext-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--switch); position: relative; cursor: pointer; transition: .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; }
@media (max-width: 999px) { .watch-main { padding: 0 14px; } .upnext-head { padding: 0 14px; } }

/* ── channel ── */
.banner { aspect-ratio: 6.2/1; background: var(--surface) center/cover; border-radius: var(--radius); margin-bottom: 16px; }
@media (max-width: 680px) { .banner { border-radius: 0; } }
.chead { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.chead img { width: 88px; height: 88px; border-radius: 50%; background: var(--surface2); }
.chead h1 { margin: 0 0 4px; }

/* ── forms / settings ── */
.panel { background: var(--surface); border-radius: 16px; padding: 18px; margin: 0 14px 16px; max-width: 640px; }
@media (min-width: 1000px) { .panel { margin: 0 0 16px; } }
.panel h2 { margin-top: 0; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.panel .note { font-size: 13px; margin: 12px 0 0; }
.nudge { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 14px; }
.nudge p { flex: 1 1 200px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field input, .field select { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); padding: 0 14px; outline: none; }
.field input:focus { border-color: var(--accent); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow .l { flex: 1; } .setrow .l small { display: block; color: var(--dim); font-size: 13px; margin-top: 2px; }
.setrow select { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); padding: 0 10px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 0 14px 16px; overflow-x: auto; }
@media (min-width: 1000px) { .tabs { margin: 0 0 16px; } }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.chlist { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 14px 10px; }
.chlist .ph { display: grid; place-items: center; font-size: 24px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.subs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 12px; }
.subs-head h2 { margin: 0; }
.btn.small svg { width: 17px; height: 17px; }
.newmark { color: var(--accent); font-weight: 600; }
#nav a { position: relative; }
#nav .nbadge { position: absolute; top: 6px; left: calc(50% + 4px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent);
  color: #fff; font: 600 11px/17px system-ui, sans-serif; font-style: normal; text-align: center; }
@media (min-width: 1000px) { #nav .nbadge { top: 10px; } }
.chlist a { display: flex; flex-direction: column; align-items: center; width: 84px; gap: 6px; font-size: 12px; text-align: center; }
.chlist img, .chlist .ph { width: 64px; height: 64px; border-radius: 50%; background: var(--surface2); object-fit: cover; }
.chlist span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
@media (min-width: 1000px) { .chlist { padding: 0 0 10px; } }
/* one swipeable row on phones, as on YouTube: 64 channels were a wall before the first video.
   After the base .chlist rules on purpose — a media query adds no specificity, so source order decides. */
@media (max-width: 680px) {
  .chlist { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 10px; }
  .chlist::-webkit-scrollbar { display: none; }
  .chlist a { flex: none; width: 72px; }
}
.kw { display: inline-block; background: var(--surface2); border-radius: 8px; padding: 3px 9px; margin: 3px; font-size: 13px; }

/* ── toast / sheet ── */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav) + var(--mini) + var(--safe-b) + 18px); transform: translate(-50%, 20px);
  background: var(--toast); color: var(--toast-fg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1000px) { #toast { bottom: 28px; } }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { background: var(--surface); width: 100%; max-width: 460px; border-radius: 18px 18px 0 0; padding: 8px 0 calc(8px + var(--safe-b)); }
@media (min-width: 681px) { #sheet { align-items: center; } .sheet-card { border-radius: 16px; } }
.sheet-card .st { padding: 12px 18px 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-card > button { display: flex; width: 100%; align-items: center; gap: 14px; padding: 13px 18px; border: 0; background: none; cursor: pointer; text-align: left; }
.sheet-card > button:hover { background: var(--surface2); }
.sheet-card > button svg { width: 22px; height: 22px; color: var(--muted); }
.install-hint { display: flex; gap: 12px; align-items: center; }

/* ── playlists ── */
.sheet-card { max-height: 85vh; overflow-y: auto; }
.sheet-card > button .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sheet-card > button small { color: var(--dim); font-size: 12px; }
.sheet-card > button > svg:last-child:not(:first-child) { color: var(--ok); }
.plform { padding: 0 18px 8px; }
.plform .st { padding-left: 0; padding-right: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.seg button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--field); cursor: pointer; text-align: left; }
.seg button small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.seg button.on { border-color: var(--accent); background: var(--sel); }
.seg button.on svg { color: var(--accent); }
.plform-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pl-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chips.inline { padding: 0; }
.chip svg { width: 16px; height: 16px; margin-right: 5px; }
.plgrid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 680px) { .plgrid { grid-template-columns: 1fr 1fr; gap: 16px 12px; padding: 0 14px; } }
.plcard { display: block; min-width: 0; }
.plcard .thumb { border-radius: var(--radius); }
.plcount { position: absolute; right: 0; top: 0; bottom: 0; width: 38%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; background: rgba(10, 10, 14, .78); color: #fff; font-weight: 600; font-size: 15px; }
.plempty { width: 100%; height: 100%; display: grid; place-items: center; background: var(--plempty); }
.plempty svg { width: 40px; height: 40px; color: var(--muted); }
.pltitle { font-weight: 600; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-head { display: flex; gap: 22px; align-items: flex-end; margin-bottom: 22px; padding: 0 14px; flex-wrap: wrap; }
@media (min-width: 1000px) { .pl-head { padding: 0; } }
.pl-cover { width: min(320px, 100%); aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: var(--surface); flex: none; }
.pl-cover img { width: 100%; height: 100%; object-fit: cover; }
.pl-info { flex: 1; min-width: 240px; }
.pl-info h1 { font-size: 28px; margin: 4px 0 6px; word-break: break-word; }
.pl-info .actions { margin-top: 14px; }
.pl-kind { display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .5px; font-size: 12px; }
.pl-kind svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .45; cursor: default; }
.pl-items { display: flex; flex-direction: column; gap: 2px; }
.pl-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 4px; border-radius: 12px; }
.pl-row:hover { background: var(--surface); }
.pl-row.now { background: var(--now); }
.pl-row.now .t { color: var(--now-fg); }
.pl-row.dragging { opacity: .4; }
.pl-row.over { box-shadow: inset 0 2px 0 var(--accent); }
.grip { color: var(--dim); cursor: grab; display: grid; place-items: center; width: 22px; }
.grip svg { width: 18px; height: 18px; fill: currentColor; }
@media (hover: none) { .grip { display: none; } }
.pl-row button { background: none; border: 0; cursor: pointer; text-align: left; padding: 0; }
.pl-thumb { position: relative; display: flex; align-items: center; gap: 10px; flex: none; }
.pl-thumb .n { width: 22px; text-align: right; color: var(--dim); font-size: 13px; }
.pl-thumb img { width: 128px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--surface); }
.pl-thumb .badge { right: 4px; bottom: 4px; font-size: 11px; }
.pl-items.music .pl-thumb img { width: 56px; aspect-ratio: 1; }
.pl-items.music .pl-thumb .badge { display: none; }
.pl-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-meta .t { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-meta .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-ctl { display: flex; flex: none; }
.pl-ctl .icon-btn { width: 34px; height: 34px; }
.pl-ctl .icon-btn svg { width: 18px; height: 18px; }
.pl-ctl .icon-btn[disabled] { opacity: .25; }
@media (max-width: 680px) { .pl-thumb img { width: 96px; } .pl-thumb .n { display: none; } .pl-ctl [data-up], .pl-ctl [data-down] { width: 30px; } }
.ctx-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ctx-title svg { width: 18px; height: 18px; color: var(--accent); }
.ctxlist { gap: 4px !important; max-height: 420px; overflow-y: auto; }
.ctxrow { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 10px; }
.ctxrow:hover { background: var(--surface); }
.ctxrow.now { background: var(--now); }
.ctxrow .n { width: 20px; text-align: center; color: var(--dim); font-size: 12px; flex: none; }
.ctxrow .n svg { width: 14px; height: 14px; color: var(--accent); fill: var(--accent); }
.ctxrow img { width: 88px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; flex: none; }
.ctxrow .m { min-width: 0; display: flex; flex-direction: column; }
.ctxrow .t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctxrow .s { font-size: 12px; color: var(--muted); }

/* ── Music ── */
@media (max-width: 999px) { #nav a span { font-size: 10px; } }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.music h2 { margin: 0; font-size: 20px; letter-spacing: -.2px; }
.mshelf { margin: 8px 0 30px; }
.mshelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 14px 12px; }
@media (min-width: 1000px) { .mshelf-head { margin: 0 0 12px; } }
.mcards { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 16px; overflow-x: auto; padding: 0 14px 8px;
  scroll-snap-type: x proximity; scrollbar-width: thin; }
@media (min-width: 1000px) { .mcards { padding: 0 0 8px; grid-auto-columns: 184px; } }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px 16px; padding: 0 14px; }
@media (min-width: 1000px) { .mgrid { padding: 0; } }
.mcard { display: block; min-width: 0; scroll-snap-align: start; cursor: pointer; }
.mcard .cover { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface); }
.mcard.wide .cover { aspect-ratio: 16/9; }
.mcard.wide { grid-column: span 1; }
.mcard .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.mcard:hover .cover img { transform: scale(1.04); }
.mcard.artist .cover { border-radius: 50%; }
.mcard.artist { text-align: center; }
.mcard .play { position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.65); opacity: 0; transition: .2s; }
.mcard .play svg { width: 18px; height: 18px; fill: #fff; stroke: none; }
.mcard:hover .play { opacity: 1; }
.mcard .t { font-weight: 600; font-size: 14px; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrows { display: flex; flex-direction: column; padding: 0 6px; }
@media (min-width: 1000px) { .mrows { padding: 0; } .mrows.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 18px; } }
.mrow { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; cursor: pointer; min-width: 0; }
.mrow:hover { background: var(--surface); }
.mrow.now { background: var(--now); }
.mrow.now .t { color: var(--now-fg); }
.mrow img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }
.mrow img.wide { width: 85px; }
.mnum { width: 28px; text-align: center; color: var(--dim); flex: none; font-size: 14px; }
.mrow .mm { flex: 1; min-width: 0; }
.mrow .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .s a:hover { color: var(--text); text-decoration: underline; }
.mrow .d { color: var(--dim); font-size: 13px; flex: none; }
.mrow .more { margin: 0; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; background: var(--surface2);
  color: var(--muted); border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: 2px; }
.moods { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 0 14px; }
@media (min-width: 1000px) { .moods { padding: 0; } }
.mood { display: flex; align-items: center; height: 52px; padding: 0 14px; border-radius: 10px; background: var(--surface);
  border-left: 6px solid var(--c); font-weight: 600; font-size: 14px; }
.mood:hover { background: var(--surface2); }
.mtop { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; padding: 0 14px; }
@media (min-width: 1000px) { .mtop { padding: 0; } }
@media (max-width: 680px) { .mtop { grid-template-columns: 1fr; } .mtop > .mcard { max-width: 200px; } }
.mhead { display: flex; gap: 24px; align-items: flex-end; margin: 4px 14px 22px; flex-wrap: wrap; }
@media (min-width: 1000px) { .mhead { margin: 4px 0 22px; } }
.mhead .cover { width: min(260px, 70vw); aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface); flex: none;
  box-shadow: 0 18px 50px var(--shadow); }
.mhead .cover img { width: 100%; height: 100%; object-fit: cover; }
.mhead .info, .martist .info { flex: 1; min-width: 240px; }
.mhead h1, .martist h1 { font-size: 30px; margin: 4px 0 6px; word-break: break-word; }
.mhead .kind { text-transform: uppercase; letter-spacing: .5px; font-size: 12px; }
.mhead .muted a, .martist a { color: var(--text); }
.mhead .actions, .martist .actions { margin-top: 14px; flex-wrap: wrap; }
.mdesc { color: var(--muted); font-size: 14px; margin-top: 10px; white-space: pre-wrap; cursor: pointer; max-width: 760px; }
.mdesc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mrows.tracks { margin-bottom: 30px; }
.martist { min-height: 260px; display: flex; align-items: flex-end; padding: 24px 14px 10px; margin-bottom: 24px;
  background: var(--surface) center 20% / cover no-repeat; border-radius: 0; }
@media (min-width: 1000px) { .martist { border-radius: 16px; padding: 30px; min-height: 320px; } }
.lyrics { padding: 4px 18px 16px; white-space: pre-wrap; line-height: 1.7; font-size: 15px; }

/* ── import ── */
.imp .panel { max-width: 760px; }
.imp h1 { margin-bottom: 18px; }
.panel h2 svg { width: 22px; height: 22px; vertical-align: -4px; margin-right: 6px; color: var(--accent); }
.impform { display: flex; gap: 8px; margin: 6px 0 14px; }
.impform input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); padding: 0 14px; outline: none; }
.impform input:focus { border-color: var(--accent); }
.impform .btn { height: 44px; }
.imp-preview { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 14px; }
.imp-thumbs { width: 220px; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; overflow: hidden; background: var(--surface2); flex: none; }
.imp-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.imp-meta { flex: 1; min-width: 240px; }
.imp-meta .seg { margin: 12px 0; }
.imp-list { padding: 0 !important; margin-top: 6px; }
.steps { color: var(--muted); padding-left: 20px; line-height: 1.6; }
.steps a { color: var(--link); }
.tk-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; max-height: 420px; overflow-y: auto; }
.tk-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--field); }
.tk-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.tk-name { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: transparent; padding: 0 10px; }
.tk-row select { height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--field); }

/* ── Shorts ── */
@media (max-width: 999px) { #nav a span[data-s] { font-size: 0; } #nav a span[data-s]::after { content: attr(data-s); font-size: 10px; } }
.link { color: var(--link); }
.center { text-align: center; }
.badge.short { display: inline-flex; align-items: center; gap: 3px; }
.badge.short svg { width: 13px; height: 13px; stroke-width: 2.2; }
/* shelves + grids of vertical cards */
.sshelf-wrap { margin: 20px 0 28px; }
.rows > .sshelf-wrap { margin: 8px 0 12px; min-width: 0; }     /* between search results: the rows' gap does the rest */
.sh-h { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.sh-h svg { color: var(--accent); }
.sshelf { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 10px; overflow-x: auto; padding: 0 14px 6px;
  scroll-snap-type: x proximity; scrollbar-width: thin; }
@media (min-width: 1000px) { .sshelf { grid-auto-columns: 196px; gap: 14px; padding: 0 0 6px; } }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 18px 10px; }
@media (min-width: 1000px) { .sgrid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 22px 14px; } }
.scard { display: block; min-width: 0; scroll-snap-align: start; }
.sthumb { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--surface); }
.sthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.scard:hover .sthumb img { transform: scale(1.03); }
.scard .t { font-weight: 600; font-size: 14px; line-height: 1.3; margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.scard .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
/* a side-scrolling row snaps its first card to the row's edge: without this the 14px side padding is scrolled away */
@media (max-width: 999px) { .shelf, .sshelf { scroll-padding-inline: 14px; } }
/* Home, like YouTube's. The shelves stand there empty until the shorts arrive, so a caption keeps its full height. */
.sshelf-wrap.home .scap { display: flow-root; min-height: 60px; }        /* flow-root: the title's top margin counts as the caption's */
@media (max-width: 680px) {
  .sshelf-wrap.home { margin: 26px 0; }
  /* the first shelf on a phone: a 2×2 block, title and views on the picture */
  .sshelf.quad { grid-auto-flow: row; grid-template-columns: 1fr 1fr; gap: 8px; overflow: visible; padding-bottom: 0; scroll-snap-type: none; }
  .sshelf.quad .scard { position: relative; }
  .sshelf.quad .scap { position: absolute; inset: auto 0 0 0; min-height: 0; padding: 44px 10px 10px; border-radius: 0 0 12px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .55) 45%, rgba(0, 0, 0, .88)); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
  .sshelf.quad .scap:empty { display: none; }
  .sshelf.quad .t { margin-top: 0; }
  .sshelf.quad .s { color: rgba(255, 255, 255, .85); }
}
/* the player: one full-height slide per short, native scroll snapping does the swiping */
body.shorts-mode #player { display: none !important; }
body.shorts-mode #view { padding: 0; }
.shorts { position: fixed; z-index: 30; background: #000; color: #fff; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (max-width: 999px) {
  body.shorts-mode #topbar { display: none; }
  .shorts { inset: 0 0 calc(var(--nav) + var(--safe-b)) 0; }
}
@media (min-width: 1000px) { .shorts { top: var(--top); left: var(--rail); right: 0; bottom: 0; background: var(--bg); color: var(--text); } }
.sh-list { position: absolute; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none;
  touch-action: none; }                               /* a finger's swipe is SH.swipe()'s, with a real threshold */
.sh-list.swiping { scroll-snap-type: none; }
.sh-list::-webkit-scrollbar { display: none; }
.short { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; align-items: center;
  justify-content: center; gap: 14px; overflow: hidden; }
.sh-loading { display: grid; place-items: center; }
.s-frame { position: relative; width: 100%; height: 100%; background: #000; color: #fff; overflow: hidden; }
@media (min-width: 1000px) { .short { padding: 14px 0; } .s-frame { width: auto; aspect-ratio: 9 / 16; max-width: calc(100% - 200px); border-radius: 16px; } }
/* The whole picture, never a crop: a phone is taller than 9:16 (20:9 screens leave the frame at about
   0.49), and filling it would cut ~13% off the sides — which walks an off-centre subject out of the
   frame. YouTube fits the short to the width and letterboxes the rest; so do we. */
.s-frame video, .sposter { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.s-frame.wide video, .s-frame.wide .sposter { object-fit: contain; }
/* the hqdefault fallback (a short with no vertical thumbnail) is 16:9 with the picture pillarboxed in
   its centre: that one still has to be cropped to the centre, or it shows as a stamp inside bars */
.sposter.hq { object-fit: cover; }
.s-frame video { opacity: 0; transition: opacity .15s; background: #000; }
.s-frame video.ready { opacity: 1; }
.s-frame::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.s-tap { position: absolute; inset: 0; z-index: 2; }
/* (no play mark over a paused short: a tap pauses and plays, and nothing is drawn on the picture for it) */
.s-mute { position: absolute; top: 10px; right: 10px; z-index: 4; color: #fff; background: rgba(0, 0, 0, .35); }
@media (max-width: 999px) { .s-mute { display: none; } }
.s-meta { position: absolute; left: 12px; right: 78px; bottom: 22px; z-index: 3; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
@media (min-width: 1000px) { .s-meta { right: 12px; } }
.s-ch { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-width: 0; }
.s-chn { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.s-chn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-chn img, .s-chn .ph { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface2);
  display: grid; place-items: center; font-weight: 700; text-shadow: none; text-transform: uppercase; }
.s-sub { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; border: 0; background: #fff; color: #111; font-weight: 600; font-size: 13px; cursor: pointer; }
.s-sub.on { background: rgba(255, 255, 255, .22); color: #fff; }
.s-title { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word; cursor: pointer; }
.s-title.open { display: block; max-height: 38vh; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; }
.s-why { font-size: 12px; color: rgba(255, 255, 255, .7); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-acts { position: absolute; right: 4px; bottom: 26px; z-index: 3; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 1000px) { .s-acts { position: static; align-self: flex-end; margin-bottom: 30px; } }
.s-acts button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 60px; border: 0; background: none; color: #fff;
  font-size: 12px; cursor: pointer; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.s-acts svg { width: 24px; height: 24px; padding: 12px; box-sizing: content-box; border-radius: 50%; background: rgba(0, 0, 0, .35); }
.s-acts button.on svg { background: #fff; color: #111; }
@media (min-width: 1000px) {
  .s-acts button { color: var(--text); text-shadow: none; }
  .s-acts svg { background: var(--surface2); }
  .s-acts button:hover svg { background: var(--hover); }
  .s-acts button.on svg { background: var(--inv); color: var(--inv-fg); }
}
.s-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; z-index: 4; cursor: pointer; }
.s-prog::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .25); }
.s-prog i { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); transition: width .25s linear; }
.s-pill { position: absolute; top: calc(56px + var(--safe-t)); left: 50%; z-index: 4; transform: translateX(-50%); padding: 6px 12px; border-radius: 14px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; white-space: nowrap; pointer-events: none; }
@media (min-width: 1000px) { .s-pill { top: 14px; } }
.s-msg { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center; background: rgba(0, 0, 0, .72); font-size: 14px; }
.s-heart { position: absolute; z-index: 4; width: 96px; height: 96px; margin: -48px 0 0 -48px; pointer-events: none; animation: sheart .85s ease-out forwards; }
.s-heart svg { width: 100%; height: 100%; fill: var(--accent); stroke: #fff; stroke-width: 1.2; }
@keyframes sheart { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1) translateY(-46px); opacity: 0; } }
.sh-top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(6px + var(--safe-t)) 6px 0 14px; pointer-events: none; }
.sh-top > * { pointer-events: auto; display: flex; align-items: center; gap: 6px; }
.sh-top b { font-size: 18px; text-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.sh-top b svg { color: var(--accent); }
.sh-top .icon-btn { color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
@media (min-width: 1000px) { .sh-top { display: none; } }
.sh-arrows { position: absolute; right: 22px; top: 50%; z-index: 5; display: flex; flex-direction: column; gap: 12px; transform: translateY(-50%); }
.sh-arrows .icon-btn { width: 52px; height: 52px; background: var(--surface2); }
.sh-arrows .icon-btn:hover { background: var(--hover); }
@media (max-width: 999px) { .sh-arrows { display: none; } }
/* Takeout import options */
.tk-opts { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.tk-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--field); cursor: pointer; }
.tk-opt input { width: 18px; height: 18px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.tk-opt small { display: block; color: var(--dim); font-size: 13px; margin-top: 3px; }
/* subtitles button: dimmed while the video has no subtitles in its own language */
.btn.off { opacity: .5; }

/* ── 1.1.3: feed cards like YouTube's — sharp full-width picture, lighter title, one compact line under it ── */
.grid .meta, .shelf .meta { gap: 12px; }
.grid .meta .t, .shelf .meta .t { font-weight: 500; }
.meta .s.line { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 18px; }
.meta .s.line > .age { display: block; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }      /* ages aren't short in every language */
.meta .s.line > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; flex: none; }
.meta .s.line > .ch { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.meta .s.line svg { width: 13px; height: 13px; stroke-width: 2; }
.more svg.dots circle { fill: currentColor; stroke: none; }
.thumb .badge { z-index: 2; }
@media (max-width: 680px) {
  .grid:not(.plgrid) { gap: 26px; }
  .shelf + .grid { margin-top: 26px; }
  .grid .meta { padding: 12px 8px 0 12px; }               /* ≥ the More button's -8px margin, or the page scrolls sideways */
  .grid .meta .t { font-size: 16px; line-height: 22px; margin-bottom: 2px; }
  .grid .meta .why { display: none; }             /* still there on wider screens */
  .grid .badge { right: 8px; bottom: 8px; font-weight: 500; border-radius: 4px; padding: 1px 5px; }
  .grid .badge:not(.live) { background: rgba(0, 0, 0, .72); }
  .grid .more { margin-top: -8px; }
}
/* the card you stop on plays in place, silently (PV in app.js) */
.thumb video.pv { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0;
  transition: opacity .25s; pointer-events: none; }
.thumb.pv-on video.pv { opacity: 1; }
.thumb.pv-on .resume { display: none; }
.thumb .pv-bar { position: absolute; left: 0; bottom: 0; z-index: 2; height: 3px; width: 0; background: var(--accent); transition: width .25s linear; }
.thumb .pv-cc, .s-cc { position: absolute; left: 50%; z-index: 3; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px);
  padding: 2px 7px; border-radius: 4px; background: rgba(8, 8, 8, .78); color: #fff; text-align: center; white-space: pre-line;
  pointer-events: none; }
.thumb .pv-cc { bottom: 34px; font-size: 13px; line-height: 1.3; }      /* clear of the time badge */
.thumb .pv-cc:empty, .s-cc:empty { display: none; }
/* captions in Shorts sit above the channel / title block */
.s-cc { bottom: 132px; left: calc(50% - 32px); max-width: calc(100% - 88px); font-size: 16px; line-height: 1.35; text-shadow: none; }   /* centred in the space left of the buttons */
@media (min-width: 1000px) { .s-cc { left: 50%; max-width: calc(100% - 24px); } }
.sh-top .icon-btn.on, .s-ccb.on { background: #fff; color: #111; filter: none; }
.s-ccb { position: absolute; top: 10px; right: 58px; z-index: 4; color: #fff; background: rgba(0, 0, 0, .35); }
@media (max-width: 999px) { .s-ccb { display: none; } }

/* ── Library → Downloads ── */
.dlnote { margin: 0 0 6px; }
.dlhead { display: flex; align-items: center; gap: 10px; padding: 18px 14px 10px; }
.dlhead b { font-size: 15px; }
.dlhead .btn { margin-left: auto; }
.dlrows { margin-bottom: 6px; }
.dlrow .meta { flex-direction: column; gap: 0; }
.dlrow .t { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.dlrow.done .thumb, .dlrow.done .t { cursor: pointer; }
.dlrow.gone .thumb { opacity: .4; }
.dlplay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .3); }
.dlplay svg { width: 32px; height: 32px; fill: #fff; stroke: none; }
.dlbar { height: 4px; border-radius: 2px; background: var(--track); margin: 8px 0 0; overflow: hidden; }
.dlbar i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.dlbar.queued i, .dlbar.paused i { background: var(--muted); }
.dlbar.error i { background: var(--danger-fg); }
.dlacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dlerr { color: var(--err-fg); }

/* ── TikTok tab (TT in app.js): the Shorts player with its own top bar ── */
.tt-top { justify-content: space-between; }
.tt-tabs { gap: 4px !important; }
.tt-tabs button { height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: none; color: rgba(255, 255, 255, .75);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.tt-tabs button.on { color: #fff; background: rgba(255, 255, 255, .2); }
.tt-top .tt-name { font-size: 16px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-top .s-sub { height: 28px; }
.s-chn.tt-acct { border: 0; padding: 0; background: none; color: inherit; font: inherit; font-size: 14px; cursor: pointer; text-shadow: inherit; text-align: left; }
@media (min-width: 1000px) {
  .sh-top.tt-top { display: flex; padding: 10px 16px 0; }
  .tt-tabs button { color: var(--muted); text-shadow: none; }
  .tt-tabs button.on { color: var(--text); background: var(--surface2); }
  .tt-top .icon-btn { color: var(--text); filter: none; }
  .tt-top .tt-name { text-shadow: none; }
  .tt-top .s-sub { background: var(--inv); color: var(--inv-fg); }
  .tt-top .s-sub.on { background: var(--surface2); color: var(--text); }
}
.tt-empty p { max-width: 300px; margin: 0 auto 16px; line-height: 1.4; }
.tt-empty .btn svg { width: 18px; height: 18px; margin: 0; color: inherit; }
.tt-add { display: flex; gap: 8px; padding: 4px 18px 10px; }
.tt-add input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--text);
  padding: 0 12px; outline: none; font: inherit; }
.tt-add input:focus { border-color: var(--accent); }
.tt-err { padding: 0 18px 8px; color: var(--err-fg); font-size: 13px; }
.tt-none { padding: 6px 18px 12px; color: var(--muted); margin: 0; }
.tt-row { display: flex; align-items: center; gap: 10px; padding: 6px 18px; }
.tt-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; padding: 0; }
.tt-who img, .tt-who .ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface2);
  display: grid; place-items: center; font-weight: 700; text-transform: uppercase; }
.tt-who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tt-who b, .tt-who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-who small { color: var(--dim); font-size: 12px; }
/* Music → Playlists: the "New playlist" tile is a button drawn as a card */
button.mcard.mnew { background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }

/* APK 2.5+: the car's screen (NB.carVideo) — only the picture, edge to edge, nothing over it */
body.carvid #player, body.carvid #player.mini, body.carvid #player.watch, body.carvid #player.hidden {
  display: block; position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto;
  border-radius: 0; box-shadow: none; z-index: 1000; background: #000; }
body.carvid #player > :not(.stage) { display: none !important; }
body.carvid #player .stage, body.carvid #player.mini .stage, body.carvid #player.watch .stage {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
body.carvid #player video, body.carvid #player.mini video { object-fit: contain; }
body.carvid #player .stage > :not(video):not(.audio-art) { display: none !important; }
