@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0d10; --surface: #12151a; --surface-2: #191d23; --surface-3: #22272f;
  --text: #f3f5f7; --muted: #939ba7; --faint: #626b77; --line: #262b33;
  --accent: #c8f66f; --accent-text: #11160b; --purple: #a99bff;
  --danger: #ff7b7b; --success: #8be9b0; --shadow: 0 18px 60px rgba(0,0,0,.34);
  --tier-s: #ff8e8e; --tier-a: #ffbd75; --tier-b: #e9df73; --tier-c: #8edda5; --tier-d: #7dbbe9;
  --sidebar: 232px; --topbar: 76px; --radius: 16px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6f2; --surface: #fff; --surface-2: #eef0ea; --surface-3: #e4e7df;
  --text: #171a17; --muted: #626a63; --faint: #929990; --line: #dfe3da;
  --accent: #a4dc42; --accent-text: #142004; --purple: #7160dc;
  --shadow: 0 18px 60px rgba(40,50,30,.13); color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f2; --surface: #fff; --surface-2: #eef0ea; --surface-3: #e4e7df;
    --text: #171a17; --muted: #626a63; --faint: #929990; --line: #dfe3da;
    --accent: #a4dc42; --accent-text: #142004; --purple: #7160dc;
    --shadow: 0 18px 60px rgba(40,50,30,.13); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar); padding: 25px 16px 18px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; margin-bottom: 14px; font-size: 25px; font-weight: 700; letter-spacing: -.8px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--accent-text); box-shadow: 0 0 28px rgba(200,246,111,.12); }
.brand-mark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; margin-left: 2px; }
.brand-dot { color: var(--accent); }

/* Channel plate. The brand lockup above is identical on every channel, forever.
   The active channel and its FULL domain live here instead, so a long subdomain
   can never squeeze or wrap the logo, and "ai.xiaohu.live" reads as a subdomain
   of xiaohu.live rather than a separate "xiaohulive.ai" site. */
.channel-plate { position: relative; margin: 0 9px 20px; }
.channel-switch > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.channel-switch > summary::-webkit-details-marker { display: none; }
.channel-switch > summary::marker { content: ''; }
.channel-switch > summary:hover { border-color: var(--faint); background: var(--surface-3); }
.channel-switch[open] > summary { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.channel-glyph { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.channel-meta { min-width: 0; flex: 1; display: grid; gap: 2px; }
.channel-name, .channel-host { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; color: var(--text); }
.channel-host { font-size: 11px; line-height: 1.3; color: var(--faint); }
.channel-host b, .channel-option-host b { color: var(--accent); font-weight: 700; }
.channel-root { color: var(--muted); }
.channel-caret { width: 14px; height: 14px; flex: none; color: var(--faint); transition: transform .18s ease; }
.channel-switch[open] .channel-caret { transform: rotate(180deg); }
.channel-switch:not([open]) .channel-menu { display: none; }
.channel-switch[open] .channel-menu { display: block; }
.channel-menu { position: absolute; z-index: 45; top: calc(100% + 7px); left: 0; right: 0; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-3); box-shadow: var(--shadow); }
.channel-menu-label { padding: 5px 9px 7px; color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: 1.4px; }
.channel-option { display: grid; gap: 2px; padding: 8px 9px; border-radius: 9px; }
.channel-option:hover { background: var(--surface-2); }
.channel-option.current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.channel-option-name { font-size: 12px; font-weight: 600; color: var(--text); }
.channel-option-host { display: block; font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-option.current .channel-option-name::after { content: '•'; margin-left: 7px; color: var(--accent); }
.channel-menu-note { padding: 8px 9px 3px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9.5px; }
.nav-label { padding: 0 12px; margin: 0 0 8px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-label:not(:first-of-type) { margin-top: 28px; }
.side-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; border: 0; background: transparent; border-radius: 11px; padding: 11px 12px; display: flex; align-items: center; gap: 12px; color: var(--muted); text-align: left; font-weight: 500; transition: .18s ease; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item.active svg { color: var(--accent); }
.nav-item.active[data-view="favorites"] svg, .nav-item.active[data-view="subscriptions"] svg { color: var(--purple); }
.nav-count { margin-left: auto; min-width: 20px; text-align: right; font-size: 11px; color: var(--faint); }
.sidebar-bottom { margin-top: auto; }
.source-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); text-align: left; }
.source-card:hover { border-color: var(--faint); }
.source-icon { display: grid; place-items: center; width: 32px; height: 32px; background: var(--surface-3); border-radius: 9px; color: var(--accent); }
.source-icon svg { width: 17px; }
.source-card strong, .source-card small { display: block; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-card strong { font-size: 12px; font-weight: 600; }
.source-card small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.source-chevron { margin-left: auto; width: 14px; color: var(--faint); }
.local-note { text-align: center; color: var(--faint); font-size: 10px; margin: 12px 0 0; }

.topbar { position: fixed; z-index: 30; top: 0; left: var(--sidebar); right: 0; height: var(--topbar); display: flex; align-items: center; gap: 20px; padding: 0 34px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(20px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.search-box { width: min(580px, 52vw); height: 43px; margin: 0 auto; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); transition: .2s; }
.search-box:focus-within { border-color: var(--faint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.search-box > svg { width: 18px; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--faint); }
.search-box kbd { border: 1px solid var(--line); border-radius: 5px; color: var(--faint); padding: 0 6px; font: 11px/20px inherit; }
.search-clear { display: none; border: 0; background: transparent; padding: 2px; color: var(--muted); }
.search-clear svg { width: 15px; }
.search-box.has-value kbd { display: none; }
.search-box.has-value .search-clear { display: block; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); transition: .18s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.lang-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; transition: .18s; }
.lang-btn:hover { color: var(--text); border-color: var(--faint); background: var(--surface-2); }
.lang-btn svg { width: 15px; height: 15px; }
.data-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; background: var(--surface); font-size: 12px; color: var(--muted); }
.data-pill:hover { color: var(--text); border-color: var(--faint); }
.data-pill svg { width: 15px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px color-mix(in srgb, var(--success) 45%, transparent); }
.data-pill.error .status-dot { background: var(--danger); }
.data-pill.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mobile-menu, .mobile-brand, .mobile-nav { display: none; }

.main { margin-left: var(--sidebar); padding: calc(var(--topbar) + 28px) 34px 70px; max-width: 1800px; }
.hero { position: relative; min-height: 360px; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(350px, .9fr); gap: 30px; padding: 44px 48px; border: 1px solid var(--line); border-radius: 24px; background: radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--purple) 16%, transparent), transparent 40%), radial-gradient(circle at 40% 120%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 42%), var(--surface); }
.hero::before { content: ""; position: absolute; width: 280px; height: 280px; right: 23%; top: -230px; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 50%; box-shadow: 0 0 0 50px color-mix(in srgb, var(--accent) 3%, transparent), 0 0 0 100px color-mix(in srgb, var(--accent) 2%, transparent); }
.hero-copy { position: relative; z-index: 2; align-self: center; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: 1.4px; }
.eyebrow span { width: 17px; height: 1px; background: var(--accent); }
.hero h1 { margin: 15px 0 16px; font-size: clamp(36px, 3.4vw, 54px); line-height: 1.12; letter-spacing: -2.2px; font-weight: 700; }
.hero-copy > p { max-width: 510px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.hero-actions { display: flex; gap: 10px; margin-top: 26px; }
.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 17px; font-weight: 600; font-size: 13px; transition: .18s; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 15%, transparent); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--faint); }
.btn-small { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.btn.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.hero-stats { display: flex; align-items: center; gap: 13px; margin-top: 27px; color: var(--muted); font-size: 11px; }
.hero-stats strong { color: var(--text); font-weight: 600; }
.hero-stats i { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.hero-collage { position: relative; min-height: 270px; }
.hero-card { position: absolute; width: 64%; overflow: hidden; border-radius: 15px; background: var(--surface-2); border: 1px solid rgba(255,255,255,.13); box-shadow: var(--shadow); transform: rotate(var(--rotate)); }
.hero-card:nth-child(1) { top: 5%; left: 0; z-index: 3; }
.hero-card:nth-child(2) { top: 19%; right: 0; z-index: 2; }
.hero-card:nth-child(3) { bottom: -6%; left: 15%; z-index: 1; }
.hero-card img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.hero-card::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.hero-card span { position: absolute; z-index: 2; left: 13px; right: 13px; bottom: 11px; color: white; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content-section, .channels-section { margin-top: 38px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-kicker { margin-bottom: 6px; color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: 1.8px; }
.section-heading h2, .dialog-header h2 { margin: 0; font-size: 25px; letter-spacing: -.7px; line-height: 1.25; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; gap: 8px; flex: none; }
.filter-panel { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.tier-filters { display: flex; gap: 4px; }
.tier-chip { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; white-space: nowrap; }
.tier-chip:hover { background: var(--surface-2); color: var(--text); }
.tier-chip.active { background: var(--surface-3); color: var(--text); }
.tier { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: #141414; font-size: 10px; font-weight: 800; }
.tier-s { background: var(--tier-s); }.tier-a { background: var(--tier-a); }.tier-b { background: var(--tier-b); }.tier-c { background: var(--tier-c); }.tier-d { background: var(--tier-d); }
.filter-controls { display: flex; align-items: center; gap: 7px; }
.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select { height: 34px; appearance: none; padding: 0 28px 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); outline: 0; font-size: 11px; cursor: pointer; }
.select-wrap select:hover, .select-wrap select:focus { color: var(--text); border-color: var(--faint); }
.select-wrap > svg { position: absolute; right: 8px; width: 13px; pointer-events: none; color: var(--faint); }
.layout-toggle { display: flex; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.layout-toggle button { display: grid; place-items: center; width: 29px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--faint); }
.layout-toggle button.active { background: var(--surface-3); color: var(--text); }
.layout-toggle svg { width: 15px; }
.result-meta { min-height: 33px; display: flex; align-items: center; color: var(--faint); font-size: 11px; }
.active-filter { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.active-filter button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); color: var(--text); padding: 7px 11px; border-radius: 9px; font-size: 11px; }
.active-filter svg { width: 13px; }

/* Order switch shown while a channel filter is active */
.order-chips { display: inline-flex; gap: 4px; padding-left: 10px; border-left: 1px solid var(--line); }
.active-filter .order-chip { border: 1px solid transparent; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 11px; cursor: pointer; transition: color .15s, background .15s, border-color .15s; }
.active-filter .order-chip:hover { color: var(--text); background: var(--surface-2); }
.active-filter .order-chip.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }

.video-grid, .skeleton-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 24px 18px; }
.video-card { min-width: 0; position: relative; cursor: pointer; animation: cardIn .35s both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.thumb-wrap { position: relative; overflow: hidden; aspect-ratio: 16/9; border-radius: 13px; background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.thumb-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s, opacity .3s; }
.video-card:hover .thumb-wrap img { transform: scale(1.035); }
.video-card:hover .video-title { color: var(--accent); }
.thumb-shade { position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.5)); pointer-events: none; }
.duration { position: absolute; right: 7px; bottom: 7px; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.78); color: white; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pick-badge { position: absolute; left: 8px; top: 8px; display: flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 6px; background: rgba(10,10,10,.8); backdrop-filter: blur(8px); color: #ffe092; font-size: 9px; font-weight: 600; }
.pick-badge svg { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.watched-badge { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; color: white; font-size: 9px; }
.watched-badge svg { width: 12px; }
.card-actions { position: absolute; right: 7px; top: 7px; display: flex; gap: 5px; opacity: 0; transform: translateY(-3px); transition: .2s; }
.video-card:hover .card-actions, .card-actions:focus-within, .card-actions.has-active { opacity: 1; transform: none; }
.card-action { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: rgba(10,10,10,.78); color: white; backdrop-filter: blur(8px); }
.card-action:hover { background: rgba(30,30,30,.95); }
.card-action.active { color: #ff9b9b; }
.card-action.active[data-action="later"] { color: var(--accent); }
.card-action.active svg { fill: currentColor; }
.card-action svg { width: 15px; height: 15px; }
.video-info { display: flex; gap: 10px; padding-top: 11px; }
.channel-avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-top: 1px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; }
.video-copy { min-width: 0; }
.video-title { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 0; min-height: 39px; font-size: 13px; font-weight: 600; line-height: 1.45; transition: color .18s; }
.video-byline { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 6px; color: var(--muted); font-size: 10px; }
.channel-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; padding: 0; background: transparent; color: inherit; text-align: left; }
.channel-link:hover { color: var(--text); }
.video-byline .tier { width: 15px; height: 15px; border-radius: 4px; font-size: 8px; }
.video-stats { margin-top: 2px; color: var(--faint); font-size: 10px; }
.video-grid.list-view { grid-template-columns: 1fr; gap: 10px; }
.list-view .video-card { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 15px; padding: 9px; border-radius: 14px; }
.list-view .video-card:hover { background: var(--surface); }
.list-view .video-info { padding-top: 5px; }
.list-view .channel-avatar { display: none; }
.list-view .video-title { font-size: 15px; -webkit-line-clamp: 2; }
.list-view .video-byline { margin-top: 12px; }
.list-view .video-stats { margin-top: 6px; }

.skeleton-card { overflow: hidden; }
.skeleton { background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 45%, var(--surface) 70%); background-size: 250% 100%; animation: shimmer 1.4s infinite; }
.skeleton-thumb { aspect-ratio: 16/9; border-radius: 13px; }
.skeleton-line { height: 12px; border-radius: 5px; margin-top: 11px; }
.skeleton-line.short { width: 60%; margin-top: 8px; height: 9px; }
@keyframes shimmer { to { background-position: -250% 0; } }
.empty-state { padding: 75px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 18px; background: var(--surface); }
.empty-visual { display: grid; place-items: center; width: 62px; height: 62px; margin: auto; border-radius: 20px; background: var(--surface-2); color: var(--faint); }
.empty-visual svg { width: 25px; height: 25px; }
.empty-state h3 { margin: 18px 0 6px; font-size: 18px; }
.empty-state p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.load-more-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 30px 0 0; }
.load-more-wrap span { color: var(--faint); font-size: 10px; }

.channel-tier-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 10px; margin-bottom: 22px; }
.tier-summary-card { display: flex; align-items: center; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.tier-summary-card .tier { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.tier-summary-card strong, .tier-summary-card small { display: block; }
.tier-summary-card strong { font-size: 15px; }
.tier-summary-card small { color: var(--muted); font-size: 10px; }
.channel-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.channel-card { display: flex; flex-direction: column; min-height: 205px; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: .2s; }
.channel-card:hover { border-color: var(--faint); transform: translateY(-2px); }
.channel-card-head { display: flex; align-items: center; gap: 11px; }
.channel-card-head .channel-avatar { width: 38px; height: 38px; border-radius: 11px; color: var(--text); }
.channel-card-title { min-width: 0; flex: 1; }
.channel-card-title h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.channel-card-title span { color: var(--muted); font-size: 10px; }
.subscribe-btn { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.subscribe-btn svg { width: 15px; }
.subscribe-btn.active { color: #ffe092; border-color: color-mix(in srgb, #ffe092 30%, var(--line)); }
.subscribe-btn.active svg { fill: currentColor; }
.channel-tag { margin-top: 12px; color: var(--accent); font-size: 10px; }
.channel-description { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 5px 0 15px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.channel-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.channel-card-footer button { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0; color: var(--text); font-size: 11px; font-weight: 600; }
.channel-card-footer button svg { width: 13px; }
.channel-card-footer span { color: var(--faint); font-size: 10px; }

/* Player */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(8px); }
.player-dialog { width: min(1240px,94vw); max-width: none; height: min(790px,92vh); max-height: none; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.player-shell { height: 100%; display: grid; grid-template-columns: minmax(0,1fr) 350px; }
.player-main { min-width: 0; display: flex; flex-direction: column; background: #08090b; }
.player-stage { position: relative; flex: 1; min-height: 0; background: #000; }
.player-stage iframe, .player-stage #ytPlayer { width: 100%; height: 100%; border: 0; }
.player-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: #888; pointer-events: none; }
.player-placeholder p { margin: 0; font-size: 12px; }
.player-close { position: absolute; z-index: 5; right: 15px; top: 15px; color: white; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); }
.player-close:hover { background: rgba(0,0,0,.8); }
.player-controlbar { min-height: 59px; display: flex; align-items: center; gap: 15px; padding: 9px 15px; border-top: 1px solid #202227; color: #ccc; }
.player-controlbar .btn-ghost { margin-left: auto; background: #17191d; border-color: #292d33; color: #ddd; }
.player-nav-controls { display: flex; gap: 2px; }
.player-nav-controls .icon-btn:hover { background: #22252a; color: white; }
.autoplay-toggle { display: flex; align-items: center; gap: 7px; color: #999; font-size: 11px; cursor: pointer; }
.autoplay-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.autoplay-toggle span { position: relative; width: 28px; height: 16px; border-radius: 20px; background: #3a3d43; transition: .2s; }
.autoplay-toggle span::after { content: ""; position: absolute; width: 12px; height: 12px; top: 2px; left: 2px; border-radius: 50%; background: white; transition: .2s; }
.autoplay-toggle input:checked + span { background: var(--accent); }
.autoplay-toggle input:checked + span::after { transform: translateX(12px); background: #172009; }
.player-info { min-width: 0; border-left: 1px solid var(--line); background: var(--surface); }
.player-info-scroll { height: 100%; overflow-y: auto; padding: 26px 23px; }
.player-channel-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.player-info h2 { margin: 13px 0 9px; font-size: 21px; line-height: 1.4; letter-spacing: -.4px; }
.player-meta { color: var(--faint); font-size: 11px; }
.player-actions { display: flex; gap: 7px; margin: 20px 0; }
.player-actions .btn { flex: 1; padding: 8px; font-size: 11px; }
.player-actions .btn.active { color: var(--accent); }
.player-actions .icon-btn { border: 1px solid var(--line); background: var(--surface-2); }
.channel-blurb { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 4; -webkit-box-orient: vertical; color: var(--muted); font-size: 11px; line-height: 1.75; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.related-heading { margin: 20px 0 10px; font-size: 11px; font-weight: 600; }
.related-list { display: grid; gap: 10px; }
.related-card { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 9px; padding: 0; border: 0; background: transparent; text-align: left; }
.related-card img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; }
.related-card strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 10px; line-height: 1.45; font-weight: 500; }
.related-card small { display: block; margin-top: 5px; color: var(--faint); font-size: 9px; }
.tv-title { display: none; }
.player-dialog.theater { width: 100vw; height: 100vh; margin: 0; border: 0; border-radius: 0; background: #000; }
.player-dialog.theater .player-shell { grid-template-columns: 1fr; }
.player-dialog.theater .player-info { display: none; }
.player-dialog.theater .player-controlbar { position: absolute; z-index: 5; left: 20px; right: 20px; bottom: 20px; border: 1px solid #333; border-radius: 13px; background: rgba(10,10,10,.7); backdrop-filter: blur(15px); }
.player-dialog.theater .tv-title { display: block; position: absolute; z-index: 4; left: 25px; bottom: 92px; max-width: 75%; color: white; font-size: 24px; font-weight: 600; text-shadow: 0 2px 10px #000; }

/* Source dialog */
.source-dialog { width: min(660px,92vw); max-height: 88vh; padding: 26px; overflow-y: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.email-dialog { width: min(470px,92vw); padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.email-dialog::backdrop { background: rgba(6,7,9,.62); backdrop-filter: blur(3px); }
.email-dialog .dialog-intro { margin-bottom: 16px; }
.email-dialog .add-source-row { display: flex; gap: 8px; }
.email-dialog .add-source-row input { flex: 1; min-width: 0; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 13px; }
.email-dialog .add-source-row input::placeholder { color: var(--faint); }
.email-dialog .add-source-row input:focus { outline: none; border-color: var(--accent); }
.email-dialog .add-source-row .btn { flex: none; min-height: 42px; padding: 0 18px; font-size: 12px; }
.email-note { margin: 14px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; line-height: 1.7; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-header h2 { font-size: 23px; }
.dialog-intro { margin: 12px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.update-status { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.update-status > svg { color: var(--success); }
.update-status.error > svg { color: var(--danger); }
.update-status strong, .update-status small { display: block; }
.update-status strong { font-size: 12px; }
.update-status small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.source-list { display: grid; gap: 8px; margin: 16px 0 23px; }
.source-item { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.source-item.active { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.source-item-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.source-item-icon svg { width: 16px; }
.source-item-copy { min-width: 0; flex: 1; }
.source-item-copy strong, .source-item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item-copy strong { font-size: 12px; }
.source-item-copy small { margin-top: 3px; color: var(--faint); font-size: 9px; }
.source-use, .source-remove { border: 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); padding: 6px 9px; font-size: 10px; }
.source-use:hover { color: var(--text); }
.source-item.active .source-use { color: var(--accent); background: transparent; }
.source-remove { padding: 7px; }
.source-remove svg { width: 14px; display: block; }
.add-source { padding-top: 19px; border-top: 1px solid var(--line); }
.add-source > label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.add-source-row { display: flex; gap: 8px; }
.add-source-row input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); padding: 10px 12px; outline: 0; font-size: 11px; }
.add-source-row input:focus { border-color: var(--faint); }
.add-source small, .refresh-settings small { display: block; margin-top: 7px; color: var(--faint); font-size: 9px; }
.refresh-settings { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 17px 0; border-top: 1px solid var(--line); }
.refresh-settings strong { font-size: 12px; }
.refresh-settings small { margin-top: 3px; }
.refresh-settings .select-wrap { flex: none; }
.data-format { display: grid; gap: 7px; padding: 13px; border-radius: 10px; background: var(--surface-2); }
.data-format strong { font-size: 10px; }
.data-format code { overflow-x: auto; color: var(--accent); font-size: 9px; white-space: nowrap; }
.data-format span { color: var(--faint); font-size: 9px; }

.toast-stack { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 340px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); font-size: 12px; animation: toastIn .25s both; }
.toast svg { width: 16px; color: var(--accent); }
.toast.error svg { color: var(--danger); }
.toast.out { animation: toastOut .25s both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.sidebar-scrim { display: none; }

.site-footer { margin-top: 54px; padding-top: 26px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,390px); gap: 26px 40px; align-items: start; }
.footer-logo { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.footer-logo .brand-mark { width: 27px; height: 27px; border-radius: 8px; box-shadow: none; }
.footer-logo .brand-mark svg { width: 13px; height: 13px; }
.footer-brand p { max-width: 390px; margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.footer-subscribe h3 { margin: 0; font-size: 13px; font-weight: 600; }
.footer-subscribe > p { margin: 6px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.subscribe-row { display: flex; gap: 8px; }
.subscribe-row input { flex: 1; min-width: 0; height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 12px; }
.subscribe-row input::placeholder { color: var(--faint); }
.subscribe-row input:focus { outline: none; border-color: var(--accent); }
.subscribe-row .btn { flex: none; min-height: 40px; padding: 0 16px; font-size: 12px; }
.subscribe-status { min-height: 16px; margin: 9px 0 0; color: var(--accent); font-size: 11px; }
.subscribe-status[data-state="error"] { color: var(--danger); }
.footer-base { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.footer-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 0 4px; color: var(--faint); font-size: 10.5px; transition: .18s; }
.footer-link svg { width: 13px; height: 13px; }
.footer-link:hover { color: var(--accent); }
.footer-privacy { display: inline-flex; align-items: center; gap: 7px; }
.footer-privacy::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .75; }

@media (max-width: 1280px) {
  .video-grid, .skeleton-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .filter-panel { align-items: flex-start; flex-direction: column; }
  .filter-controls { width: 100%; }
  .sort-select { margin-left: auto; }
  .hero { padding: 38px; grid-template-columns: 1.15fr .85fr; }
  .channel-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1000px) {
  :root { --sidebar: 210px; }
  .main { padding-left: 24px; padding-right: 24px; }
  .topbar { padding: 0 24px; }
  .data-pill > span:not(.status-dot) { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-collage { display: none; }
  .hero-copy > p { max-width: 620px; }
  .player-dialog { width: 96vw; }
  .player-shell { grid-template-columns: minmax(0,1fr) 300px; }
}
@media (max-width: 760px) {
  .site-footer { margin-top: 38px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .footer-base { flex-direction: column; align-items: flex-start; gap: 6px; }
  :root { --topbar: 66px; }
  body { padding-bottom: 66px; }
  .sidebar { width: 250px; transform: translateX(-102%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sidebar-scrim.open { display: block; position: fixed; z-index: 35; inset: 0; background: rgba(0,0,0,.55); }
  .topbar { left: 0; gap: 8px; padding: 0 13px; }
  .mobile-menu { display: grid; width: 34px; }
  .mobile-brand { display: none; align-items: center; gap: 7px; font-weight: 700; font-size: 17px; }
  .mobile-brand .brand-mark { width: 27px; height: 27px; border-radius: 8px; }
  .mobile-brand .brand-mark svg { width: 13px; }
  .search-box { width: auto; flex: 1; height: 39px; margin: 0; border-radius: 11px; }
  .search-box kbd { display: none; }
  .top-actions { gap: 0; }
  .top-actions .icon-btn { width: 34px; }
  #randomBtn { display: none; }
  .data-pill { padding: 8px; border: 0; background: transparent; }
  .data-pill .status-dot { display: none; }
  .data-pill svg { width: 18px; }
  .main { margin-left: 0; padding: calc(var(--topbar) + 17px) 15px 30px; }
  .hero { padding: 26px 22px; border-radius: 18px; }
  .hero h1 { font-size: 35px; letter-spacing: -1.5px; }
  .hero-copy > p { font-size: 12px; }
  .hero-stats { flex-wrap: wrap; gap: 9px; }
  .hero-actions .btn { padding: 10px 13px; }
  .content-section, .channels-section { margin-top: 29px; }
  .section-heading { align-items: flex-start; margin-bottom: 17px; }
  .section-heading h2 { font-size: 22px; }
  .section-heading p { max-width: 250px; }
  .section-actions { gap: 5px; }
  .section-actions .btn { width: 35px; min-height: 35px; padding: 0; }
  .section-actions .btn { font-size: 0; }
  .section-actions .btn svg { width: 16px; }
  .filter-panel { padding: 8px; gap: 9px; overflow: hidden; }
  .tier-filters { width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .tier-filters::-webkit-scrollbar { display: none; }
  .filter-controls { overflow-x: auto; scrollbar-width: none; }
  .filter-controls::-webkit-scrollbar { display: none; }
  .select-wrap { flex: none; }
  .sort-select { margin-left: 0; }
  .layout-toggle { display: none; }
  .video-grid, .skeleton-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 10px; }
  .video-title { font-size: 12px; }
  .channel-avatar { display: none; }
  .card-actions { opacity: 1; transform: none; }
  .card-action { width: 28px; height: 28px; }
  .card-action[data-action="later"] { display: none; }
  .video-byline { margin-top: 4px; }
  .pick-badge { font-size: 0; padding: 5px; }
  .pick-badge svg { width: 12px; height: 12px; }
  .channel-tier-summary { grid-template-columns: repeat(5,130px); overflow-x: auto; padding-bottom: 5px; }
  .channel-grid { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-around; height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(20px); }
  .mobile-nav button { flex: 1; display: grid; justify-items: center; gap: 3px; border: 0; background: transparent; color: var(--faint); font-size: 9px; }
  .mobile-nav button svg { width: 19px; height: 19px; }
  .mobile-nav button.active { color: var(--accent); }
  .player-dialog { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .player-shell { display: block; overflow-y: auto; background: var(--surface); }
  .player-main { display: block; background: #000; }
  .player-stage { width: 100%; height: auto; aspect-ratio: 16/9; }
  .player-controlbar { min-height: 50px; }
  .player-info { border: 0; }
  .player-info-scroll { height: auto; overflow: visible; padding: 22px 18px; }
  .player-info h2 { font-size: 20px; }
  .channel-blurb { -webkit-line-clamp: 6; }
  .player-dialog.theater .player-main { height: 100%; display: flex; }
  .player-dialog.theater .player-stage { flex: 1; aspect-ratio: auto; }
  .player-dialog.theater .tv-title { font-size: 18px; left: 18px; bottom: 85px; }
  .player-dialog.theater .player-controlbar { left: 10px; right: 10px; bottom: 15px; gap: 8px; }
  .player-dialog.theater .autoplay-toggle { display: none; }
  .source-dialog { padding: 21px 17px; }
  .add-source-row { flex-direction: column; }
  .refresh-settings { align-items: flex-start; }
  .toast-stack { left: 15px; right: 15px; bottom: 78px; }
  .toast { max-width: none; }
}
@media (max-width: 390px) {
  .video-grid, .skeleton-grid { grid-template-columns: 1fr; }
  .video-title { font-size: 14px; }
  .hero-stats i:last-of-type, .hero-stats span:last-child { display: none; }
  .top-actions #themeBtn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- Channel directory: clickable tier filters + exposure-aware ordering ---- */
.tier-summary-card[data-dir-tier] { position: relative; width: 100%; font: inherit; color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .15s, opacity .15s; }
.tier-summary-card[data-dir-tier]:hover { border-color: var(--faint); background: var(--surface-2); transform: translateY(-1px); }
.tier-summary-card[data-dir-tier]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tier-summary-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-2); }
.channel-tier-summary.has-filter .tier-summary-card:not(.selected) { opacity: .58; }
.dir-check { position: absolute; top: 6px; right: 7px; display: none; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 9px; font-weight: 800; line-height: 1; }
.tier-summary-card.selected .dir-check { display: grid; }
.dir-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; }
.dir-toolbar-left, .dir-toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.dir-label { margin-right: 4px; color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.dir-chip { height: 29px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.dir-chip:hover { color: var(--text); border-color: var(--faint); }
.dir-chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.dir-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dir-reshuffle { border-style: dashed; }
.dir-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.dir-clear { height: 29px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.dir-clear:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.dir-empty { grid-column: 1 / -1; padding: 50px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface); }
.dir-empty h3 { margin: 0 0 6px; font-size: 16px; }
.dir-empty p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
@media (max-width: 700px) {
  .dir-toolbar { gap: 8px; }
  .dir-toolbar-right { width: 100%; justify-content: space-between; }
}
