:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #0e131d;
  --panel-2: #131a26;
  --line: #222c3b;
  --text: #f4f7fb;
  --muted: #8d98a9;
  --accent: #7cff7a;
  --accent-2: #b8ff61;
  --danger: #ff6b73;
  --radius: 20px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 75% 15%, rgba(78, 143, 255, .09), transparent 28rem), var(--bg); color: var(--text); font-size: 16px; }
button, input { font: inherit; }
button { color: inherit; }
button, [role="tab"], .channel { -webkit-tap-highlight-color: transparent; }
.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; }
.app-shell { min-height: 100dvh; display: grid; grid-template-rows: 72px 1fr; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(8, 11, 18, .78); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 11px; font-size: 1.12rem; font-weight: 800; letter-spacing: -.03em; }
.brand > span:last-child span { color: var(--accent); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); border-radius: 10px; box-shadow: 0 0 30px rgba(124, 255, 122, .18); }
.brand-mark span { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid #07100a; margin-left: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.connection { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.connection.error i { background: var(--danger); box-shadow: 0 0 12px var(--danger); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); cursor: pointer; transition: .18s ease; }
.icon-button:hover { border-color: #3a475a; transform: translateY(-1px); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.workspace { height: calc(100dvh - 72px); min-height: 0; overflow: hidden; display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.library { border-right: 1px solid var(--line); padding: 30px 14px 18px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: rgba(11, 15, 23, .65); }
.library-head { display: flex; align-items: end; justify-content: space-between; padding: 0 7px 22px; gap: 12px; }
.library-heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.library-heading > div { min-width: 0; }
.back-button { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: #111824; color: #c9d3df; cursor: pointer; }
.back-button[hidden] { display: none; }
.back-button:hover { color: var(--accent); border-color: rgba(124, 255, 122, .38); }
.back-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.library h1 { max-width: 240px; margin-bottom: 0; font-size: 1.35rem; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { min-width: 30px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); display: grid; place-items: center; font-size: .75rem; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; pointer-events: none; }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #0a0f17; color: var(--text); padding: 12px 44px 12px 42px; outline: none; }
.search input:focus { border-color: rgba(124, 255, 122, .65); box-shadow: 0 0 0 3px rgba(124, 255, 122, .08); }
.search kbd { position: absolute; right: 12px; min-width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: #6c7787; background: #111722; font-size: .72rem; }
.category-list, .channel-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 5px 4px 0; scrollbar-width: thin; scrollbar-color: #344155 transparent; }
.category-list[hidden], .channel-list[hidden] { display: none; }
.category-list::-webkit-scrollbar, .channel-list::-webkit-scrollbar { width: 7px; }
.category-list::-webkit-scrollbar-thumb, .channel-list::-webkit-scrollbar-thumb { background: #344155; border-radius: 10px; }
.category-list::-webkit-scrollbar-track, .channel-list::-webkit-scrollbar-track { background: transparent; }
.category-row { width: 100%; min-height: 62px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto 18px; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid transparent; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; transition: .16s ease; }
.category-row:hover, .category-row:focus-visible { background: #121a26; border-color: #273449; outline: none; }
.category-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: rgba(124, 255, 122, .09); border: 1px solid rgba(124, 255, 122, .18); font-size: .72rem; font-weight: 850; }
.category-row.special .category-symbol { color: #07100a; background: var(--accent); border-color: var(--accent); }
.category-copy { min-width: 0; }
.category-name { display: block; color: #eef3f9; font-size: .88rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-meta { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; }
.category-count { color: #a8b3c2; font-size: .72rem; font-variant-numeric: tabular-nums; }
.category-chevron { width: 17px; fill: none; stroke: #657287; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.load-progress { padding: 16px 10px 12px; color: var(--muted); text-align: center; font-size: .72rem; }
.channel { width: 100%; border: 1px solid transparent; border-radius: 14px; background: transparent; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 9px; text-align: left; cursor: pointer; transition: .16s ease; }
.channel:hover { background: #111824; }
.channel.active { background: #151e2b; border-color: #283548; }
.channel-avatar { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(145deg, #1f2b3d, #121925); display: grid; place-items: center; overflow: hidden; border: 1px solid #29364a; color: #cbd6e6; font-weight: 800; font-size: .7rem; }
.channel-avatar img { width: 100%; height: 100%; object-fit: contain; background: #f4f6f8; }
.channel-copy { min-width: 0; }
.channel-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: .9rem; }
.channel-group { display: block; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; }
.channel-live { color: var(--accent); font-size: .63rem; font-weight: 850; letter-spacing: .09em; }
.list-empty { text-align: center; color: var(--muted); padding: 48px 22px; line-height: 1.5; }
.stage { min-width: 0; padding: clamp(22px, 4vw, 54px); overflow-y: auto; }
.video-card { max-width: 1160px; margin: 0 auto; }
.video-wrap { aspect-ratio: 16/9; position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: #030508; border: 1px solid #202b3b; box-shadow: var(--shadow); }
video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.video-empty, .video-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 28px; background: radial-gradient(circle at 50% 45%, #151d2a, #05070b 70%); }
.video-empty[hidden], .video-loader[hidden] { display: none; }
.video-empty h2 { margin: 5px 0 10px; font-size: clamp(1.4rem, 3vw, 2.4rem); letter-spacing: -.04em; }
.video-empty > p:not(.eyebrow) { color: var(--muted); margin-bottom: 22px; }
.empty-symbol { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 20px; background: rgba(124, 255, 122, .1); border: 1px solid rgba(124, 255, 122, .25); }
.empty-symbol span { width: 0; height: 0; border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-left: 17px solid var(--accent); margin-left: 4px; }
.video-loader { background: rgba(3, 5, 8, .84); backdrop-filter: blur(6px); }
.video-loader span { width: 36px; height: 36px; border: 3px solid #263244; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
.video-loader p { margin: 15px 0 0; color: #c4cedc; }
@keyframes spin { to { transform: rotate(360deg); } }
.now-playing { min-height: 100px; display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: linear-gradient(120deg, #121925, #0e141e); border: 1px solid #202b3b; border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.channel-avatar.large { width: 58px; height: 58px; border-radius: 15px; flex: none; }
.now-copy { min-width: 0; flex: 1; }
.now-copy .eyebrow { margin-bottom: 3px; }
.now-copy h2 { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-copy > p:last-child { color: var(--muted); margin: 5px 0 0; font-size: .78rem; }
.favorite-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.favorite-button:disabled { opacity: .35; cursor: default; }
.favorite-button svg { width: 22px; fill: none; stroke: #8994a5; stroke-width: 1.7; }
.favorite-button.active svg { fill: var(--accent); stroke: var(--accent); }
.status-card { max-width: 1160px; margin: 18px auto 0; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: var(--muted); background: rgba(14, 19, 29, .75); }
.status-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #172131; color: #a9b6c8; font-weight: 800; }
.status-card div:nth-child(2) { flex: 1; }
.status-card strong { color: #dfe6ef; font-size: .86rem; }
.status-card p { margin: 3px 0 0; font-size: .78rem; }
.status-card button { border: 0; background: transparent; color: var(--accent); font-size: .8rem; font-weight: 800; cursor: pointer; }
.source-dialog { width: min(590px, calc(100% - 28px)); padding: 0; border: 1px solid #2b3749; border-radius: 22px; color: var(--text); background: #0e141e; box-shadow: var(--shadow); }
.source-dialog::backdrop { background: rgba(1, 3, 7, .74); backdrop-filter: blur(8px); }
.dialog-card { padding: 25px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin: 0; letter-spacing: -.035em; font-size: 1.4rem; }
.icon-button.close { background: transparent; }
.source-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #090d14; padding: 5px; border-radius: 12px; margin: 24px 0 20px; }
.source-tabs button { border: 0; border-radius: 9px; background: transparent; color: var(--muted); padding: 10px; cursor: pointer; }
.source-tabs button[aria-selected="true"] { background: #192231; color: var(--text); font-weight: 750; }
.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 14px; }
.tab-panel label { color: #b8c2d0; font-size: .8rem; font-weight: 650; }
.tab-panel input:not([type="file"]) { width: 100%; margin-top: 8px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #090d14; color: var(--text); outline: none; }
.tab-panel input:focus { border-color: rgba(124, 255, 122, .65); box-shadow: 0 0 0 3px rgba(124, 255, 122, .08); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file-drop { display: grid; place-items: center; min-height: 66px; padding: 12px; border: 1px dashed #354259; border-radius: 11px; color: var(--muted) !important; cursor: pointer; text-align: center; }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.remember-card { margin-top: 17px; border: 1px solid var(--line); border-radius: 13px; background: #0a0f17; overflow: hidden; }
.remember-option { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 12px 13px; cursor: pointer; }
.remember-option input { position: absolute; opacity: 0; pointer-events: none; }
.remember-switch { width: 42px; height: 24px; flex: none; position: relative; border-radius: 999px; background: #273143; transition: .18s ease; }
.remember-switch i { width: 18px; height: 18px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #96a2b2; transition: .18s ease; }
.remember-option input:checked + .remember-switch { background: var(--accent); }
.remember-option input:checked + .remember-switch i { left: 21px; background: #07100a; }
.remember-option input:focus-visible + .remember-switch { outline: 3px solid rgba(124, 255, 122, .2); outline-offset: 2px; }
.remember-option input:disabled + .remember-switch { opacity: .38; }
.remember-option:has(input:disabled) { cursor: not-allowed; }
.remember-copy { min-width: 0; display: grid; gap: 3px; }
.remember-copy strong { color: #e9eef5; font-size: .8rem; }
.remember-copy small { color: var(--muted); font-size: .69rem; line-height: 1.35; }
.saved-source { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; border-top: 1px solid var(--line); color: #abb6c5; font-size: .72rem; }
.saved-source[hidden] { display: none; }
.saved-source > span { min-width: 0; display: flex; align-items: center; gap: 8px; }
.saved-source > span > i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(124, 255, 122, .55); }
.saved-source > span > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-source button { border: 0; background: transparent; color: #ff8b93; font-size: .7rem; font-weight: 750; cursor: pointer; }
.form-error { margin: 15px 0 0; padding: 11px 12px; border-radius: 10px; color: #ffc1c5; background: rgba(255, 107, 115, .1); border: 1px solid rgba(255, 107, 115, .23); font-size: .8rem; }
.privacy-note { display: flex; gap: 8px; align-items: center; margin: 16px 0 0; color: var(--muted); font-size: .74rem; }
.privacy-note svg { width: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.primary-button, .ghost-button { min-height: 42px; border-radius: 11px; padding: 0 17px; font-weight: 800; cursor: pointer; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #07100a; }
.primary-button:hover { background: var(--accent-2); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.ghost-button { border: 1px solid var(--line); background: transparent; color: #b7c1cf; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 18px); padding: 11px 16px; border: 1px solid #344159; border-radius: 11px; background: #151d2a; box-shadow: var(--shadow); color: #eaf0f7; font-size: .82rem; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 860px) {
  .app-shell { grid-template-rows: 64px auto; }
  .topbar { height: 64px; padding: 0 16px; }
  .connection span { display: none; }
  .workspace { height: auto; min-height: calc(100dvh - 64px); overflow: visible; display: flex; flex-direction: column-reverse; }
  .stage { padding: 16px; overflow: visible; }
  .library { height: 62dvh; min-height: 430px; max-height: 680px; border: 0; border-top: 1px solid var(--line); padding: 24px 14px 14px; }
  .video-wrap { border-radius: 16px 16px 0 0; }
  .now-playing { border-radius: 0 0 16px 16px; padding: 13px; min-height: 84px; }
  .channel-avatar.large { width: 48px; height: 48px; }
  .status-card { display: none; }
  .video-empty > p:not(.eyebrow) { display: none; }
  .empty-symbol { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 13px; }
  .video-empty h2 { margin-bottom: 14px; }
}
@media (max-width: 520px) {
  .stage { padding: 0; }
  .video-wrap { border-radius: 0; border-left: 0; border-right: 0; }
  .now-playing { border-radius: 0; border-left: 0; border-right: 0; }
  .video-empty { padding: 12px; }
  .video-empty .eyebrow { display: none; }
  .video-empty h2 { font-size: 1.12rem; }
  .field-row { grid-template-columns: 1fr; }
  .dialog-card { padding: 20px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
