/* =========================================================================
   NetTube design system
   One accent color plus neutral surfaces. To re-theme, change the accent
   tokens below (both modes); nothing else references a raw brand color.
   ========================================================================= */
:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #eef0f6;
    --surface-3: #e5e8f0;
    --border: #e4e7ee;
    --border-strong: #cfd4df;
    --text: #121620;
    --text-2: #5b6474;
    --muted: #8a92a3;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-weak: #eceafd;
    --accent-text: #3730a3;
    --on-accent: #ffffff;
    --danger: #dc2626;
    --danger-weak: #fde8e8;
    --good: #15803d;
    --warn: #b45309;
    --shadow: 0 1px 2px rgba(18, 22, 32, .06), 0 8px 24px rgba(18, 22, 32, .08);
    --shadow-lg: 0 12px 40px rgba(18, 22, 32, .16);
    --topbar: rgba(246, 247, 251, .82);

    /* Charts: validated reference palette (blue series, blue sequential ramp) */
    --viz-series: #2a78d6;
    --viz-grid: #e8eaf0;
    --viz-axis: #c9ced9;
    --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;

    --radius: 12px;
    --radius-lg: 18px;
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
        color-scheme: dark;
        --bg: #0e1016;
        --surface: #161a23;
        --surface-2: #1d2230;
        --surface-3: #262c3b;
        --border: #262b36;
        --border-strong: #353c4b;
        --text: #eef0f5;
        --text-2: #9aa3b2;
        --muted: #6b7385;
        --accent: #6366f1;
        --accent-hover: #7c7ff5;
        --accent-weak: #23264a;
        --accent-text: #c7c9ff;
        --danger: #f87171;
        --danger-weak: #3a1d22;
        --good: #4ade80;
        --warn: #fbbf24;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
        --topbar: rgba(14, 16, 22, .78);
        --viz-series: #3987e5;
        --viz-grid: #232838;
        --viz-axis: #363d4f;
        --seq-1: #1b2c48; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf; --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #9ec5f4;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1016;
    --surface: #161a23;
    --surface-2: #1d2230;
    --surface-3: #262c3b;
    --border: #262b36;
    --border-strong: #353c4b;
    --text: #eef0f5;
    --text-2: #9aa3b2;
    --muted: #6b7385;
    --accent: #6366f1;
    --accent-hover: #7c7ff5;
    --accent-weak: #23264a;
    --accent-text: #c7c9ff;
    --danger: #f87171;
    --danger-weak: #3a1d22;
    --good: #4ade80;
    --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
    --topbar: rgba(14, 16, 22, .78);
    --viz-series: #3987e5;
    --viz-grid: #232838;
    --viz-axis: #363d4f;
    --seq-1: #1b2c48; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf; --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #9ec5f4;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img, video, svg { display: block; }
svg { flex-shrink: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
h1, h2, h3 { line-height: 1.25; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); }
.flex { flex: 1; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- Buttons ---------- */
.btn {
    height: 38px; padding: 0 16px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--surface-2); color: var(--text); font-weight: 600; white-space: nowrap;
    border: 1px solid transparent; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; cursor: default; transform: none; }
.btn-danger { background: var(--danger-weak); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
.btn-ghost { background: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.subscribe.subscribed { background: var(--surface-2); color: var(--text); box-shadow: none; }
.subscribe.subscribed:hover { background: var(--surface-3); }

.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; color: var(--text); transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 34px; height: 34px; color: var(--text-2); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-weak); }
.link-btn { color: var(--accent-text); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
:root:not([data-theme="dark"]) .link-btn { color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: 64px; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px;
    background: var(--topbar); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border);
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.logo-mark { width: 28px; height: 28px; filter: drop-shadow(0 3px 8px color-mix(in srgb, var(--accent) 40%, transparent)); }
.search { flex: 0 1 620px; display: flex; height: 42px; min-width: 0; position: relative; }
.search input {
    flex: 1; min-width: 0; height: 100%; padding: 0 52px 0 20px; font: inherit; font-size: 15px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search button[type=submit] { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.search button[type=submit]:hover { background: var(--surface-2); color: var(--text); }
.upload-btn svg { margin-left: -2px; }
.signin-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px 0 12px; border-radius: 999px;
    border: 1px solid var(--border-strong); color: var(--accent); font-weight: 600; white-space: nowrap;
}
:root[data-theme="dark"] .signin-btn { color: var(--accent-text); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .signin-btn { color: var(--accent-text); } }
.signin-btn:hover { background: var(--accent-weak); border-color: transparent; }
.avatar { width: var(--size); height: var(--size); border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; color: #fff; font-weight: 700; font-size: calc(var(--size) * .42); line-height: 1; user-select: none; }
.avatar-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--accent-weak); }

.menu-wrap { position: relative; }
.menu {
    position: absolute; right: 0; top: 50px; width: 300px; z-index: 70; display: none; padding: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 80px); overflow-y: auto;
}
.menu.open { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-head { display: flex; gap: 14px; padding: 10px; }
.menu-name { font-size: 15px; font-weight: 700; }
.menu-handle { color: var(--text-2); margin: 2px 0 6px; }
.menu-link { color: var(--accent-text); font-weight: 600; }
:root:not([data-theme="dark"]) .menu-link { color: var(--accent); }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 10px; text-align: start; cursor: pointer; }
.menu-item:hover, .menu-item.active { background: var(--surface-2); }
.menu-item svg { color: var(--text-2); }
.menu-caption { padding: 8px 12px 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.menu-sub summary { list-style: none; }
.menu-sub summary::-webkit-details-marker { display: none; }
.menu-sub[open] summary { background: var(--surface-2); }
.menu-sub .menu-item:not(summary) { padding-inline-start: 46px; }
.lang-code { font-size: 11px; font-weight: 700; color: var(--muted); width: 22px; }

/* ---------- Navigation ---------- */
.sidebar { position: fixed; top: 64px; bottom: 0; left: 0; width: 248px; z-index: 40; padding: 12px; overflow-y: auto; background: var(--bg); scrollbar-width: thin; }
.sidebar h3 { margin: 4px 0; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 16px; height: 42px; padding: 0 12px; border-radius: 12px; white-space: nowrap; color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; }
.nav-item svg { color: var(--muted); }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-weak); color: var(--accent-text); font-weight: 700; }
:root:not([data-theme="dark"]) .nav-item.active { color: var(--accent); }
.nav-item.active svg { color: currentColor; }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.sidebar-signin { padding: 4px 12px; }
.sidebar-signin p, .sidebar-note { line-height: 20px; margin: 4px 0 12px; color: var(--text-2); }
.sidebar-note { padding: 0 12px; }
.sidebar-foot { padding: 16px 12px; color: var(--muted); font-size: 12px; }
.sidebar-foot p { margin: 0; overflow-wrap: anywhere; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.foot-links a { color: var(--text-2); font-weight: 600; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
.drawer-head { display: none; align-items: center; gap: 12px; height: 64px; margin: 0 0 4px 4px; }

.mini-guide { position: fixed; top: 64px; bottom: 0; left: 0; width: 76px; z-index: 40; padding: 8px 6px; background: var(--bg); display: none; }
.mini-guide a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px; border-radius: 14px; font-size: 10.5px; color: var(--text-2); text-align: center; }
.mini-guide a:hover { background: var(--surface); color: var(--text); }
.mini-guide a.active { color: var(--accent-text); background: var(--accent-weak); font-weight: 700; }
:root:not([data-theme="dark"]) .mini-guide a.active { color: var(--accent); }

.scrim { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(5, 7, 12, .5); backdrop-filter: blur(2px); }
.content { margin: 64px 0 0 248px; padding: 24px 28px 48px; min-height: calc(100vh - 64px); }

@media (min-width: 1313px) {
    body.sb-collapsed .sidebar { display: none; }
    body.sb-collapsed .mini-guide { display: block; }
    body.sb-collapsed .content { margin-left: 76px; }
}
@media (max-width: 1312px) {
    .sidebar { display: none; }
    .mini-guide { display: block; }
    .content { margin-left: 76px; }
}
@media (max-width: 791px) {
    .mini-guide { display: none; }
    .content { margin-left: 0; }
}
body.watch-page .sidebar, body.watch-page .mini-guide { display: none; }
body.watch-page .content { margin-left: 0; }
body.sb-open .sidebar { display: block; top: 0; z-index: 60; padding-top: 0; background: var(--surface); box-shadow: var(--shadow-lg); }
body.sb-open .drawer-head { display: flex; }
body.sb-open .scrim { display: block; }

/* ---------- Chips ---------- */
.chips {
    position: sticky; top: 64px; z-index: 10; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    margin: -24px -28px 20px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
}
.chips.static { position: static; margin: 0 0 20px; padding: 0; background: none; backdrop-filter: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    height: 34px; padding: 0 14px; border-radius: 999px; flex-shrink: 0; display: inline-flex; align-items: center;
    background: var(--surface); border: 1px solid var(--border); font-weight: 600; white-space: nowrap; color: var(--text-2); transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Thumbnails and cards ---------- */
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--surface-2); isolation: isolate; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.thumb .preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; z-index: 1; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.duration {
    position: absolute; right: 8px; bottom: 8px; z-index: 2; padding: 2px 7px; border-radius: 7px;
    background: rgba(8, 10, 16, .78); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; backdrop-filter: blur(4px);
}
.res-badge {
    display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; vertical-align: 1px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .3px; color: var(--text-2); border: 1px solid var(--border-strong);
}
.res-badge:empty { display: none; }
.res-badge.hdr { background: var(--accent-weak); color: var(--accent-text); border-color: transparent; }

.grid { display: grid; gap: 32px 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { min-width: 0; }
.card:hover .thumb img { transform: scale(1.04); }
.card .thumb { box-shadow: 0 0 0 0 transparent; transition: box-shadow .25s; }
.card:hover .thumb { box-shadow: var(--shadow); }
.card-meta { display: flex; gap: 12px; margin-top: 12px; }
.card-text { min-width: 0; }
.card-title, .row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 650; word-break: break-word; }
.card-title { font-size: 15px; line-height: 21px; margin-bottom: 4px; }
.card-channel, .card-stats { display: block; color: var(--text-2); line-height: 20px; font-size: 13.5px; }
.card-channel:hover, .row-channel:hover { color: var(--text); }

/* ---------- Home: hero and shelves ---------- */
.hero {
    display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 28px; align-items: center;
    padding: 16px; margin-bottom: 36px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero-media { border-radius: 16px; }
.hero:hover .hero-media img { transform: scale(1.03); }
.hero-body { padding: 8px 12px 8px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.eyebrow { padding: 4px 10px; border-radius: 999px; background: var(--accent-weak); color: var(--accent-text); font-size: 12px; font-weight: 700; }
:root:not([data-theme="dark"]) .eyebrow { color: var(--accent); }
.hero-title { margin: 0; font-size: clamp(22px, 2.3vw, 30px); font-weight: 800; letter-spacing: -.5px; word-break: break-word; }
.hero-channel { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.hero-meta { margin: 0; color: var(--text-2); }
.hero-desc { margin: 0 0 6px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

.shelf { margin-bottom: 36px; }
.shelf-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.shelf-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.shelf-head .icon-btn { align-self: center; border: 1px solid var(--border); background: var(--surface); }
.shelf-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 2px 8px; }
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-item { position: relative; scroll-snap-align: start; }
.rank {
    position: absolute; z-index: 3; top: 10px; left: 10px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
    display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- Row list (up next, search, history) ---------- */
.row { display: flex; gap: 10px; margin-bottom: 10px; padding: 6px; margin-inline: -6px; border-radius: 14px; transition: background .15s; }
.row:hover { background: var(--surface); }
.row .thumb { width: 168px; flex-shrink: 0; border-radius: 10px; }
.row-text { min-width: 0; display: flex; flex-direction: column; }
.row-title { font-size: 14px; line-height: 20px; margin-bottom: 4px; }
.row-stats, .row-channel { font-size: 12.5px; line-height: 18px; color: var(--text-2); }
.row-channel { order: 2; display: flex; align-items: center; gap: 8px; }
.row-stats { order: 3; }
.row-channel .avatar, .row-desc { display: none; }
.results { max-width: 1120px; }
.results-count { margin: 0 0 12px; }
.results .row { gap: 18px; margin-bottom: 14px; padding: 8px; margin-inline: -8px; }
.results .row .thumb { width: min(460px, 44%); border-radius: 14px; }
.results .row-title { font-size: 18px; line-height: 26px; }
.results .row-stats { order: 1; }
.results .row-channel { margin: 12px 0; font-size: 13px; }
.results .row-channel .avatar { display: inline-grid; }
.results .row-desc { order: 4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--text-2); }

/* ---------- Watch page ---------- */
.watch { display: flex; gap: 28px; max-width: 1760px; margin: 0 auto; }
.watch-main { flex: 1; min-width: 0; }
.watch-side { width: 400px; flex-shrink: 0; }
.side-title { margin: 0 0 12px; font-size: 16px; font-weight: 800; }
.player-stage { position: relative; isolation: isolate; }
.ambient {
    position: absolute; inset: 4% 2%; z-index: -1; background-size: cover; background-position: center;
    filter: blur(70px) saturate(1.6); opacity: .45; transform: scale(1.04); border-radius: 40px; pointer-events: none;
}
:root[data-theme="light"] .ambient { opacity: .28; }
@media (prefers-color-scheme: light) { :root:where(:not([data-theme="dark"])) .ambient { opacity: .28; } }
.player { position: relative; aspect-ratio: 16 / 9; max-height: calc(100vh - 160px); width: 100%; background: #000; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player.processing { display: grid; place-items: center; background: var(--surface); box-shadow: none; border: 1px solid var(--border); }
.processing-box { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 420px; padding: 24px; color: var(--text-2); }
.processing-box strong { color: var(--text); font-size: 18px; }
.processing-box .progress { width: 260px; }
.processing-box.failed svg { color: var(--danger); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.watch-title { margin: 18px 0 10px; font-size: 22px; line-height: 30px; font-weight: 800; letter-spacing: -.3px; word-break: break-word; }
.watch-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.owner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.owner-text { min-width: 0; margin-right: 10px; }
.owner-name { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-subs { font-size: 12.5px; color: var(--text-2); }
.watch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.pill .btn { background: none; border-radius: 0; }
.pill .btn:hover { background: var(--surface-3); }
.pill .sep { width: 1px; height: 22px; background: var(--border-strong); }
.react.active { color: var(--accent-text); }
:root:not([data-theme="dark"]) .react.active { color: var(--accent); }
.desc { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; line-height: 21px; transition: border-color .15s; }
.desc:hover { border-color: var(--border-strong); }
.desc.open { cursor: auto; }
.desc-stats { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.desc-stats a { color: var(--accent-text); }
:root:not([data-theme="dark"]) .desc-stats a { color: var(--accent); }
.desc-text { white-space: pre-wrap; word-break: break-word; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desc.open .desc-text { display: block; }
.desc-more { font-weight: 700; margin-top: 6px; }
.vis-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }

.comments h2 { margin: 28px 0 20px; font-size: 18px; font-weight: 800; }
.comments-off { margin: 28px 0; color: var(--text-2); }
.comment-form { display: flex; gap: 14px; margin-bottom: 28px; }
.comment-input { flex: 1; }
.comment-input textarea {
    width: 100%; min-height: 44px; padding: 11px 14px; resize: none; overflow: hidden; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.comment-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.comment-actions { display: none; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.comment-form.focused .comment-actions { display: flex; }
.comment { display: flex; gap: 14px; margin-bottom: 22px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { font-size: 13px; margin-bottom: 3px; }
.comment-head a { font-weight: 700; margin-inline-end: 6px; }
.comment-head span { color: var(--muted); font-size: 12px; }
.comment-text { white-space: pre-wrap; word-break: break-word; line-height: 21px; }
.signin-hint { margin-bottom: 28px; color: var(--text-2); }
.signin-hint a { color: var(--accent-text); font-weight: 700; }
:root:not([data-theme="dark"]) .signin-hint a { color: var(--accent); }
@media (max-width: 1016px) { .watch { flex-direction: column; } .watch-side { width: auto; } }
/* Video page: the player has its own grid cell, so theater mode can stretch it over the side column. */
.watch-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto 1fr; grid-template-areas: "player side" "main side"; column-gap: 28px; }
.watch-grid > .watch-player { grid-area: player; min-width: 0; }
.watch-grid > .watch-main { grid-area: main; }
.watch-grid > .watch-side { grid-area: side; width: auto; min-width: 0; }
.watch-grid.theater { grid-template-areas: "player player" "main side"; }
.watch-grid.theater > .watch-side { margin-top: 18px; }
.watch-grid.theater .player { max-height: calc(100vh - 130px); }
@media (max-width: 1016px) {
    .watch-grid, .watch-grid.theater { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "player" "main" "side"; }
    .watch-grid > .watch-side, .watch-grid.theater > .watch-side { margin-top: 28px; }
    .p-btn[data-act="theater"] { display: none; }
}

/* ---------- Custom player ---------- */
.player { --p-accent: var(--accent); color: #fff; user-select: none; }
.player:not(.active):not(.paused):not(.menu-open) { cursor: none; }
.p-controls {
    position: absolute; inset: auto 0 0 0; z-index: 3; padding: 40px 14px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 55%, transparent);
    opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s;
}
.player.active .p-controls, .player.paused .p-controls, .player.menu-open .p-controls, .p-controls:has(:focus-visible) { opacity: 1; transform: none; }
.p-progress { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.p-track { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; transition: height .15s; }
.p-progress:hover .p-track { height: 6px; }
.p-buffered { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .35); }
.p-played { position: absolute; inset: 0 auto 0 0; background: var(--p-accent); }
.p-thumb { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--p-accent); transform: scale(0); transition: transform .15s; }
.p-progress:hover .p-thumb, .player.paused .p-thumb { transform: scale(1); }
.p-tip { position: absolute; bottom: 22px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: rgba(10, 12, 18, .9); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; white-space: nowrap; }
.p-progress:hover .p-tip { opacity: 1; }
.p-bar { display: flex; align-items: center; gap: 4px; height: 44px; }
.p-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; position: relative; transition: background .15s; }
.p-btn:hover { background: rgba(255, 255, 255, .14); }
.p-btn.on::after { content: ""; position: absolute; bottom: 6px; left: 12px; right: 12px; height: 3px; border-radius: 3px; background: var(--p-accent); }
.p-volume { display: flex; align-items: center; }
.p-vol { width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: #fff; cursor: pointer; }
.p-volume:hover .p-vol, .p-vol:focus { width: 84px; opacity: 1; margin-inline-end: 8px; }
.p-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 8px; white-space: nowrap; }
.p-flex { flex: 1; }
.p-q-badge { position: absolute; top: 6px; right: 2px; padding: 0 3px; border-radius: 4px; background: var(--p-accent); font-size: 9px; font-weight: 800; line-height: 13px; }
.p-q-badge:empty { display: none; }
.p-big {
    position: absolute; z-index: 2; top: 50%; left: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
    display: grid; place-items: center; color: #fff; background: rgba(10, 12, 18, .55); backdrop-filter: blur(8px);
    opacity: 0; transform: scale(.9); transition: opacity .2s, transform .2s; pointer-events: none;
}
.player.paused .p-big { opacity: 1; transform: none; pointer-events: auto; }
.player.paused .p-big:hover { background: var(--p-accent); }
.p-osd {
    position: absolute; z-index: 4; top: 16%; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px;
    background: rgba(10, 12, 18, .75); backdrop-filter: blur(6px); font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.p-osd.show { opacity: 1; }
.p-spinner { position: absolute; z-index: 2; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite; }
.p-menu {
    position: absolute; z-index: 5; right: 14px; bottom: 64px; width: 290px; max-height: calc(100% - 80px); overflow-y: auto; padding: 6px;
    background: rgba(20, 23, 32, .94); backdrop-filter: blur(14px); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); animation: pop .14s ease-out;
}
.p-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 9px; color: #fff; text-align: start; font-size: 14px; }
.p-item:hover { background: rgba(255, 255, 255, .1); }
.p-item svg { opacity: .9; }
.p-item small { color: rgba(255, 255, 255, .6); font-weight: 600; margin-inline-start: 4px; }
.p-label { flex: 1; display: flex; align-items: center; gap: 10px; }
.p-value { color: rgba(255, 255, 255, .65); font-size: 13px; }
.p-check { width: 18px; color: var(--p-accent); }
.p-head { border-bottom: 1px solid rgba(255, 255, 255, .1); border-radius: 9px 9px 0 0; margin-bottom: 4px; font-weight: 700; }
.p-note { padding: 8px 12px; color: rgba(255, 255, 255, .6); font-size: 12px; }
.player video::cue { background: rgba(8, 10, 16, .78); color: #fff; font: 600 1.05em/1.35 var(--font); }
.player.fullscreen { border-radius: 0; max-height: none; }

/* ---------- Channel page ---------- */
.channel { max-width: 1300px; margin: 0 auto; }
.channel-banner {
    height: clamp(110px, 17vw, 210px); border-radius: 22px; overflow: hidden;
    background: radial-gradient(120% 140% at 85% 0%, color-mix(in srgb, var(--c) 55%, #fff) 0%, transparent 45%), linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 30%, #000));
}
.channel-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
img.avatar { object-fit: cover; }
.channel-head { display: flex; align-items: center; gap: 24px; margin: -36px 0 18px 28px; position: relative; }
.channel-head > .avatar, .channel-head > .avatar-edit .avatar { box-shadow: 0 0 0 6px var(--bg); }
.channel-banner { position: relative; }
.banner-edit { position: absolute; right: 14px; bottom: 14px; background: rgba(0, 0, 0, .55); color: #fff; border-color: transparent; backdrop-filter: blur(6px); }
.banner-edit:hover { background: rgba(0, 0, 0, .72); }
.avatar-edit { position: relative; display: inline-grid; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.avatar-edit-icon { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; opacity: 0; transition: opacity .15s; }
.avatar-edit:hover .avatar-edit-icon, .avatar-edit:focus-within .avatar-edit-icon { opacity: 1; }
@media (hover: none) { .avatar-edit-icon { opacity: .85; background: none; place-items: end; } .avatar-edit-icon svg { background: rgba(0, 0, 0, .6); border-radius: 50%; padding: 4px; } }
.account-profile { grid-column: 1 / -1; }
.account-profile-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.channel-info { padding-top: 40px; }
.channel-name { margin: 0; font-size: 32px; line-height: 40px; font-weight: 800; letter-spacing: -.6px; }
.channel-meta { color: var(--text-2); margin: 4px 0 8px; }
.channel-meta strong { color: var(--text); font-weight: 700; }
.channel-desc { color: var(--text-2); margin: 0 0 12px; max-width: 640px; line-height: 21px; }
.channel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs a { padding: 12px 14px; font-size: 15px; font-weight: 700; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.about { max-width: 720px; line-height: 22px; }
.about h2 { font-size: 18px; margin: 0 0 10px; }
.about p { white-space: pre-wrap; margin: 0 0 28px; color: var(--text-2); }
.about ul { padding: 0; list-style: none; }
.about li { padding: 6px 0; }

/* ---------- Panels, pages, forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.panel h2 { margin: 0 0 12px; font-size: 16px; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2 { margin-bottom: 2px; }
.panel-head p { margin: 0; }
.page-title { font-size: 26px; margin: 0 0 22px; font-weight: 800; letter-spacing: -.4px; }
.feed-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.empty { text-align: center; padding: 72px 20px; color: var(--text-2); max-width: 520px; margin: 0 auto; }
.empty h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }
.empty p { margin: 0 0 18px; font-size: 15px; }
.empty-icon { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 28px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); }
:root:not([data-theme="dark"]) .empty-icon { color: var(--accent); }
.error-page h1 { color: var(--text); font-size: 24px; }
.error-code { font-size: 88px; font-weight: 900; letter-spacing: -3px; color: var(--accent); line-height: 1; margin-bottom: 8px; }

.field { margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
/* Field captions only: checkbox rows and option cards inside a field keep their own layout. */
.field > label:not(.check, .radio-card, .big-check), .field > legend { display: block; font-weight: 700; margin-bottom: 8px; padding: 0; }
.input {
    width: 100%; height: 44px; padding: 0 14px; font: inherit; font-size: 15px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 21px; }
select.input { cursor: pointer; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
.input-prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input-prefix span { padding-inline-start: 14px; color: var(--muted); font-size: 15px; }
.input-prefix .input { border: 0; padding-inline-start: 2px; box-shadow: none; background: none; }
.input-action { display: flex; gap: 8px; }
.field-error, .form-errors { color: var(--danger); font-size: 13px; }
.field-error { display: block; margin-top: 6px; }
.form-errors ul { margin: 0 0 16px; padding-inline-start: 18px; }
.validation-summary-valid { display: none; }
.hint { color: var(--text-2); font-size: 12.5px; line-height: 18px; margin: 8px 0 0; }
.hint.warn { color: var(--warn); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 8px 0; }
.check input, .radio-card input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.big-check { align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.big-check span { display: flex; flex-direction: column; gap: 2px; }
.big-check small { color: var(--text-2); }
.radio-card {
    display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color .15s, background .15s;
}
.radio-card:hover { border-color: var(--border-strong); }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.radio-card > svg { color: var(--text-2); }
.radio-card:has(input:checked) > svg { color: var(--accent); }
.radio-card span { display: flex; flex-direction: column; gap: 1px; }
.radio-card small { color: var(--text-2); }
.schedule { margin-top: 6px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.schedule .check { margin-top: 0; }
.schedule .input { max-width: 280px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.auth { max-width: 440px; margin: 40px auto; padding: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.auth h1 { font-size: 24px; margin: 18px 0 4px; font-weight: 800; }
.auth-sub { color: var(--text-2); margin: 0 0 26px; }
.auth-logo { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; }
.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }
.auth-actions a { color: var(--accent-text); font-weight: 700; }
:root:not([data-theme="dark"]) .auth-actions a { color: var(--accent); }

/* ---------- Upload ---------- */
.upload { max-width: 1080px; margin: 0 auto; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 64px 24px; cursor: pointer;
    border: 2px dashed var(--border-strong); border-radius: 24px; background: var(--surface); transition: border-color .15s, background .15s;
}
.dropzone > span:not(.btn) { color: var(--text-2); max-width: 560px; }
.dropzone .btn { margin-top: 14px; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.big-icon { width: 120px; height: 120px; border-radius: 36px; margin-bottom: 10px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); }
:root:not([data-theme="dark"]) .big-icon { color: var(--accent); }
.upload-status { padding: 14px 18px; margin-bottom: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.upload-status-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.upload-status-head span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
.upload-side video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 16px 16px 0 0; }
.thumb-preview { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 16px 16px; }
.thumb-preview span { color: var(--text-2); font-size: 12px; font-weight: 600; }
.thumb-preview img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.thumb-preview img:not([src]) { visibility: hidden; }
.thumb-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.upload-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-top: 18px; margin-top: 8px; border-top: 1px solid var(--border); }
.progress { height: 6px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .25s; }
.mini-progress { height: 4px; margin-top: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; max-width: 140px; }
.mini-progress > div { height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- Studio ---------- */
.studio { max-width: 1400px; margin: 0 auto; }
.studio-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.studio-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.studio-head p { margin: 4px 0 0; color: var(--text-2); }
.studio-head p a { color: var(--accent-text); font-weight: 600; }
:root:not([data-theme="dark"]) .studio-head p a { color: var(--accent); }
.studio-id { display: flex; align-items: center; gap: 14px; }
.studio-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }
.studio-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.studio-tabs a:not(.btn) { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 11px; font-weight: 700; color: var(--text-2); }
.studio-tabs a:not(.btn):hover { background: var(--surface-2); color: var(--text); }
.studio-tabs a.active { background: var(--accent-weak); color: var(--accent-text); }
:root:not([data-theme="dark"]) .studio-tabs a.active { color: var(--accent); }
.studio-tabs-flex { flex: 1; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.stat span { display: block; color: var(--text-2); font-size: 13px; font-weight: 600; }
.stat strong { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }

.studio-table { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.st-row { display: grid; grid-template-columns: minmax(300px, 2.6fr) 150px 160px 110px 100px 80px 80px 172px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.st-row:first-child { border-top: 0; }
.st-row:not(.st-headrow):hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.st-headrow { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding-block: 12px; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.st-video { display: flex; gap: 14px; align-items: center; min-width: 0; }
.st-thumb { position: relative; width: 132px; flex-shrink: 0; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-thumb .duration { right: 5px; bottom: 5px; font-size: 11px; padding: 0 5px; }
.st-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-title small { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-video:hover strong { color: var(--accent-text); }
:root:not([data-theme="dark"]) .st-video:hover strong { color: var(--accent); }
.vis-form { display: flex; align-items: center; gap: 6px; }
.vis-icon { color: var(--text-2); }
.vis-select { font: inherit; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: 9px; padding: 5px 8px; cursor: pointer; }
.vis-select:hover { border-color: var(--border-strong); }
.st-status { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.chip-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.chip-status.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.chip-status.bad { background: var(--danger-weak); color: var(--danger); }
.chip-status.busy { background: var(--accent-weak); color: var(--accent-text); }
:root:not([data-theme="dark"]) .chip-status.busy { color: var(--accent); }
.chip-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.st-actions { display: flex; justify-content: flex-end; gap: 2px; }

.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.edit-side { display: flex; flex-direction: column; gap: 16px; }
.thumb-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thumb-edit img { width: 200px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.side-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.side-thumb img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--text-2); font-size: 13px; }
.facts dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.rendition-list, .subtitle-list { list-style: none; margin: 10px 0 0; padding: 0; }
.rendition-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-top: 1px solid var(--border); }
.rendition-list li:first-child { border-top: 0; }
.rendition-list .muted { width: 100%; font-size: 12.5px; }
.codec { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); }
.subtitle-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.subtitle-list li span { flex: 1; }
.subtitle-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.subtitle-form .input { flex: 1 1 140px; height: 38px; }
.channel-form { max-width: 860px; }
.channel-media { max-width: 860px; margin-bottom: 16px; }
.channel-media .channel-banner { height: clamp(90px, 13vw, 172px); border-radius: 16px; }
.media-row { display: flex; align-items: flex-end; gap: 16px; margin: -40px 0 18px 20px; position: relative; }
.media-row .avatar { box-shadow: 0 0 0 5px var(--surface); }
.media-text { padding-bottom: 6px; min-width: 0; }
.media-text strong { display: block; font-size: 18px; overflow-wrap: anywhere; }
.media-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.media-group { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.media-group small { color: var(--text-2); line-height: 18px; }
.media-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.media-buttons form { display: contents; }
/* ---------- Admin ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty-note { margin: 8px 0; color: var(--text-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid .stat { display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
.stat-grid .stat:hover { border-color: var(--border-strong); }
.stat-grid .stat small { color: var(--text-2); }
.stat-grid .stat.attention { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.admin-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.admin-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-list li > span:not(.badge, .avatar) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.admin-list strong, .admin-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list li > span > a { min-width: 0; }
.admin-list small { color: var(--text-2); }
.mini-thumb { width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex-shrink: 0; display: block; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-weak); color: var(--accent-text); white-space: nowrap; }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--text); }
.more-link { font-weight: 600; color: var(--accent-text); }
.admin-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-search { flex: 1 1 260px; max-width: 420px; }
.admin-toolbar .chips.static { margin: 0; }
/* position: keeps the absolutely positioned .visually-hidden headers inside the scroll box (else the page scrolls sideways) */
.admin-table { position: relative; overflow-x: auto; padding: 6px 8px; }
.admin-table .data-table td { vertical-align: middle; }
.admin-table tr.is-suspended td { background: color-mix(in srgb, var(--warn) 6%, transparent); }
.admin-user, .admin-video { display: flex; align-items: center; gap: 10px; min-width: 200px; color: inherit; }
.admin-user > span:not(.avatar), .admin-video > span:not(.avatar) { display: flex; flex-direction: column; min-width: 0; }
.admin-user small, .admin-video small { color: var(--text-2); }
.admin-video strong { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.row-actions form { display: contents; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; color: var(--text-2); }
.admin-comments { list-style: none; margin: 0; padding: 0; }
.admin-comments li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.admin-comments li:last-child { border-bottom: 0; }
.admin-comments li > div { flex: 1; min-width: 0; }
.admin-comments p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.admin-comment-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.admin-comment-head a { color: inherit; }
.admin-comment-head .muted a { color: var(--accent-text); }
.updater { margin-top: 16px; }
.updater > p { color: var(--text-2); margin: 0 0 14px; }
.updater h3 { margin: 20px 0 10px; font-size: 14px; }
.update-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.update-sources .input { margin-top: 4px; }
.update-confirm { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--accent-weak); }
.update-confirm p { margin: 0 0 8px; }
.update-history li > span { flex: 1; }
pre.code { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.settings-grid { display: grid; gap: 16px; max-width: 860px; }
.option-list { display: grid; gap: 8px; margin-top: 4px; }
.option-list .check { margin: 0; }

.account-grid { display: grid; gap: 16px; max-width: 860px; }
.account-grid .facts { margin-top: 18px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form .input-prefix { flex: 1 1 240px; }
.stack-form .grid-2 { margin-top: 4px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone > p { color: var(--text-2); margin: 0 0 12px; }
.notice { margin: 14px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); font-weight: 600; }
.notice.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--text); }
.notice.error { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--text); }
.site-alert { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.site-alert svg { flex-shrink: 0; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.crop-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.crop-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.crop-dialog h2 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.crop-stage { position: relative; max-height: 56vh; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; }
.crop-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-stage.round { max-width: min(420px, 56vh); }
.crop-stage.round::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); }
.crop-zoom { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--text-2); }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-dialog .test-result:empty { display: none; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.channel-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.channel-preview strong { display: block; font-size: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); transition: transform .12s; }
.swatch span:hover { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---------- Analytics ---------- */
.range { display: flex; gap: 6px; flex-wrap: wrap; }
.an-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; margin-bottom: 16px; }
.analytics .panel { margin-bottom: 16px; }
.an-top .panel { margin-bottom: 0; }
.kpi-label { display: block; color: var(--text-2); font-size: 13px; font-weight: 600; }
.hero-number { display: block; font-size: 52px; line-height: 1.05; font-weight: 800; letter-spacing: -1.6px; margin: 2px 0 4px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 18px; }
.kpi { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.kpi strong { display: block; font-size: 21px; font-weight: 800; margin: 2px 0; letter-spacing: -.3px; }
.delta { display: inline-flex; align-items: baseline; gap: 4px; font-size: 12.5px; font-weight: 700; }
.delta .muted { font-weight: 500; }
.delta.up { color: var(--good); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-2); font-weight: 500; }
.an-live { display: flex; flex-direction: column; }
.live-head { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.live-number { font-size: 44px; font-weight: 800; line-height: 1.1; margin-top: 10px; }
.live-sub { margin: 10px 0 4px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.an-grid .panel { margin-bottom: 0; }
.analytics .an-grid { margin-bottom: 16px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.seg button { height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 700; color: var(--text-2); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.chart { width: 100%; }
.hbars { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 52px; align-items: center; gap: 12px; padding: 2px 0; border-radius: 8px; cursor: default; }
.hbars li:hover .hb-fill { filter: brightness(1.12); }
.hb-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 14px; border-radius: 0 4px 4px 0; }
.hb-fill { display: block; height: 100%; min-width: 2px; background: var(--viz-series); border-radius: 0 4px 4px 0; }
.hb-value { font-size: 13px; color: var(--text-2); text-align: end; font-variant-numeric: tabular-nums; }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-2); }
.heat-legend span { margin: 0 4px; }
.viz-heat-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: start; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: end; }
.table-view { margin-top: 10px; }
.table-view summary { color: var(--text-2); font-weight: 600; cursor: pointer; font-size: 13px; }
.table-view[open] summary { margin-bottom: 8px; }
.table-view .data-table { max-height: 320px; display: block; overflow-y: auto; }
.tv-cell { display: flex; align-items: center; gap: 12px; }
.tv-cell img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.tv-cell span { display: flex; flex-direction: column; font-weight: 600; }
.tv-cell small { font-weight: 500; }

/* SVG charts (see wwwroot/js/charts.js) */
.viz { overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-base { stroke: var(--viz-axis); stroke-width: 1; }
.viz-label { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-line { fill: none; stroke: var(--viz-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { fill: var(--viz-series); opacity: .1; }
.viz-dot { fill: var(--viz-series); stroke: var(--surface); stroke-width: 2; }
.viz-cross { stroke: var(--text-2); stroke-width: 1; }
.viz-bar { fill: var(--viz-series); }
.viz-heat.s0 { fill: var(--surface-2); }
.viz-heat.s1, .viz-heat-swatch.s1 { fill: var(--seq-1); background: var(--seq-1); }
.viz-heat.s2, .viz-heat-swatch.s2 { fill: var(--seq-2); background: var(--seq-2); }
.viz-heat.s3, .viz-heat-swatch.s3 { fill: var(--seq-3); background: var(--seq-3); }
.viz-heat.s4, .viz-heat-swatch.s4 { fill: var(--seq-4); background: var(--seq-4); }
.viz-heat.s5, .viz-heat-swatch.s5 { fill: var(--seq-5); background: var(--seq-5); }
.viz-heat.s6, .viz-heat-swatch.s6 { fill: var(--seq-6); background: var(--seq-6); }
.viz-heat.s7, .viz-heat-swatch.s7 { fill: var(--seq-7); background: var(--seq-7); }
.viz-heat { stroke: var(--surface); stroke-width: 0; }
.viz-heat:hover { stroke: var(--text); stroke-width: 1.5; }
.viz-tip {
    position: fixed; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .12s; padding: 8px 10px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.viz-tip.show { opacity: 1; }
.viz-tip span { display: block; font-weight: 600; color: var(--text-2); }
.viz-tip strong { color: var(--text); font-size: 15px; }

/* ---------- Setup wizard ---------- */
.setup-page { background: radial-gradient(1200px 600px at 50% -200px, var(--accent-weak), transparent 70%), var(--bg); }
.setup-shell { min-height: 100vh; display: grid; place-items: start center; padding: 48px 16px; }
.setup-card { width: min(780px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 32px 36px; box-shadow: var(--shadow-lg); }
.setup-brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; margin-bottom: 22px; }
.setup-brand small { font-size: 13px; font-weight: 600; color: var(--text-2); padding-inline-start: 8px; border-inline-start: 1px solid var(--border-strong); }
.setup-langs { display: flex; gap: 4px; }
.setup-langs a { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.setup-langs a.active, .setup-langs a:hover { background: var(--surface-2); color: var(--text); }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; list-style: none; padding: 0; margin: 0 0 28px; counter-reset: s; }
.steps li { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.steps li::before { content: ""; height: 5px; border-radius: 5px; background: var(--surface-3); }
.steps li span { display: none; }
.steps li.done, .steps li.active { color: var(--text); }
.steps li.done::before, .steps li.active::before { background: var(--accent); }
.step h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.lead { margin: 0 0 22px; color: var(--text-2); font-size: 15px; }
.checks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.checks li span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.checks li small { color: var(--text-2); word-break: break-word; }
.checks li.ok > svg { color: var(--good); }
.checks li.warn > svg { color: var(--warn); }
.checks li.bad > svg { color: var(--danger); }
.provider-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.provider-cards .radio-card { flex-direction: column; align-items: flex-start; margin: 0; }
.advanced { margin: 10px 0 0; }
.advanced summary { cursor: pointer; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.test-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.test-result { margin: 0; font-size: 13.5px; }
.test-result.ok { color: var(--good); }
.test-result.bad { color: var(--danger); }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 10px 0 20px; padding: 18px; border-radius: 16px; background: var(--surface-2); }
.summary dt { color: var(--text-2); font-weight: 600; }
.summary dd { margin: 0; font-weight: 700; word-break: break-word; }
.setup-foot { display: flex; align-items: center; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.key-field { margin-top: 18px; }
.ffmpeg-install { display: grid; gap: 10px; margin: 0 0 20px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.ffmpeg-install-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ffmpeg-install-row .btn { flex: none; }
.ffmpeg-install-row .hint { flex: 1 1 260px; margin: 0; }
.ffmpeg-install .advanced { margin: 0; }
.ffmpeg-install .advanced summary { margin: 0; font-size: 13.5px; }
.manual-steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.manual-steps a { color: var(--accent-text); font-weight: 600; }
.manual-steps code, .ffmpeg-install code { font-size: 12.5px; padding: 1px 5px; border-radius: 6px; background: var(--surface-2); word-break: break-all; }
.system-panel { max-width: 860px; }
.system-panel .checks { margin-bottom: 16px; }
.unconverted { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; background: var(--accent-weak); }
.unconverted p { margin: 0; flex: 1 1 260px; }
.unconverted .hint { flex-basis: 100%; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 300; pointer-events: none; max-width: min(560px, calc(100% - 32px));
    padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-lg);
    opacity: 0; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Small screens ---------- */
@media (max-width: 1100px) {
    .st-row { grid-template-columns: minmax(240px, 2fr) 140px 150px 90px 140px; }
    .st-row > :nth-child(4), .st-row > :nth-child(6), .st-row > :nth-child(7) { display: none; }
    .an-top, .edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 16px; }
    .hero-body { padding: 0 4px 6px; }
    .upload-grid { grid-template-columns: 1fr; }
    .channel-head { flex-direction: column; align-items: flex-start; margin: -30px 0 18px 16px; gap: 10px; }
    .channel-head > .avatar, .channel-head > .avatar-edit .avatar { --size: 96px !important; }
    .channel-info { padding-top: 0; }
    .channel-name { font-size: 26px; line-height: 32px; }
    .provider-cards { grid-template-columns: 1fr; }
    .provider-cards .radio-card { flex-direction: row; align-items: center; }
    .st-row { grid-template-columns: minmax(0, 1fr) auto; }
    .st-headrow { display: none; }
    .st-row > :nth-child(3), .st-row > :nth-child(5) { display: none; }
    .st-row > :nth-child(2) { grid-column: 1; }
    .st-actions { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; }
}
@media (max-width: 656px) {
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar-start { gap: 2px; }
    .logo-text, .signin-btn span, .upload-btn span { display: none; }
    .upload-btn { width: 40px; padding: 0; }
    .signin-btn { padding: 0 10px; }
    .content { padding: 16px 16px 40px; }
    .chips { margin: -16px -16px 16px; padding: 12px 16px; }
    .grid { grid-template-columns: 1fr; gap: 24px; }
    .results .row { flex-direction: column; }
    .results .row .thumb { width: 100%; }
    .player { border-radius: 0; margin: -16px -16px 0; width: auto; max-height: none; }
    .player-stage .ambient { display: none; }
    .p-volume:hover .p-vol { width: 0; opacity: 0; }
    .auth { padding: 24px; margin: 8px auto; border: 0; box-shadow: none; }
    .setup-card { padding: 22px 18px; border-radius: 20px; }
    .grid-2 { grid-template-columns: 1fr; }
    .steps li { font-size: 0; }
    .hero-number { font-size: 40px; }
    .studio-tabs-flex { display: none; }
    .top-videos th:nth-child(n+3), .top-videos td:nth-child(n+3) { display: none; }
    .tv-cell img { width: 72px; }
    .hbars li { grid-template-columns: minmax(80px, 110px) 1fr 48px; gap: 8px; }
}

/* ---------- Shorts ---------- */
.shorts-head { display: inline-flex; align-items: center; gap: 8px; }
.shorts-head svg { color: var(--accent); }
.shelf-track.shorts-track { grid-auto-columns: minmax(150px, 180px); gap: 14px; }
.shorts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.short-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.short-thumb { display: block; aspect-ratio: 9 / 16; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.short-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.short-card:hover .short-thumb img { transform: scale(1.03); }
.short-title { margin-top: 6px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.short-views { color: var(--text-2); font-size: 13px; }

body.shorts-page .content { padding: 0; min-height: 0; }
.shorts-feed { height: calc(100dvh - 64px); overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.shorts-feed::-webkit-scrollbar { display: none; }
.short { height: calc(100dvh - 64px); scroll-snap-align: start; scroll-snap-stop: always; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px 0; box-sizing: border-box; }
.short-stage { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100vw - 120px); border-radius: var(--radius-lg); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.short-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.short-tap { position: absolute; inset: 0; width: 100%; border: 0; background: transparent; cursor: pointer; }
.short.paused .short-tap::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%;
    background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 40px no-repeat;
}
.short-mute { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(0, 0, 0, .45); color: #fff; }
.short-mute:hover { background: rgba(0, 0, 0, .65); }
.short-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .25); pointer-events: none; }
.short-progress > div { height: 100%; width: 0; background: var(--accent); }
.short-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 16px 18px; color: #fff; pointer-events: none; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); }
.short-info a, .short-info button { pointer-events: auto; }
.short-channel { display: flex; align-items: center; gap: 8px; min-width: 0; }
.short-handle { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.short-sub { background: #fff; color: #111; border-color: #fff; }
.short-sub.subscribed { background: rgba(255, 255, 255, .2); color: #fff; border-color: transparent; }
.short-caption { margin: 8px 0 0; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.short-rail { display: flex; flex-direction: column; align-items: center; gap: 14px; align-self: flex-end; padding-bottom: 8px; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.rail-btn svg { width: 50px; height: 50px; padding: 12px; box-sizing: border-box; border-radius: 50%; background: var(--surface-2); transition: background .15s; }
.rail-btn:hover svg { background: var(--surface-3); }
.rail-btn.active svg { background: var(--text); color: var(--bg); }
.shorts-nav { position: fixed; right: 28px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; z-index: 5; }
.shorts-nav .icon-btn { border: 1px solid var(--border); background: var(--surface); }
.shorts-nav .icon-btn:first-child svg { transform: rotate(90deg); }
.shorts-nav .icon-btn:last-child svg { transform: rotate(90deg); }
.shorts-more { height: 1px; }

@media (max-width: 640px) {
    .shorts-feed, .short { height: calc(100dvh - 56px); }
    .short { padding: 0; position: relative; }
    .short-stage { width: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
    .short-info { padding-right: 76px; }
    .short-rail { position: absolute; right: 8px; bottom: 84px; z-index: 2; }
    .rail-btn { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
    .rail-btn svg { background: rgba(0, 0, 0, .4); }
    .rail-btn.active svg { background: #fff; color: #111; }
    .shorts-nav { display: none; }
}

/* ---------- Ads in the player ---------- */
.p-ad { position: absolute; inset: 0; z-index: 20; background: #000; }
.p-ad video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.p-ad-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: #fff; font-size: 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); pointer-events: none; }
.p-ad-label { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: #f5c518; color: #111; font-weight: 700; }
.p-ad-label b { font-variant-numeric: tabular-nums; }
.p-ad-visit { pointer-events: auto; margin-left: auto; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.p-ad-visit:hover { background: rgba(255, 255, 255, .28); }
.p-ad-skip { position: absolute; right: 0; bottom: 56px; padding: 12px 18px; border: 1px solid rgba(255, 255, 255, .5); border-right: 0; background: rgba(0, 0, 0, .72); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.p-ad-skip:disabled { cursor: default; opacity: .8; }
.player.ad-mode .p-controls, .player.ad-mode .p-big, .player.ad-mode .p-menu, .player.ad-mode .p-osd { display: none !important; }
.ad-preview { display: block; width: 100%; max-width: 420px; margin-top: 10px; border-radius: var(--radius); background: #000; }

/* ---------- Premium ---------- */
.badge.premium { background: color-mix(in srgb, #f5c518 22%, var(--surface)); color: var(--text); }
.premium-page { max-width: 880px; margin: 0 auto; }
.premium-hero { padding: 40px 32px; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent-weak), var(--surface)); border: 1px solid var(--border); text-align: center; }
.premium-mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.premium-hero h1 { margin: 14px 0 6px; font-size: clamp(26px, 4vw, 40px); letter-spacing: -.6px; }
.premium-hero .lead { margin: 0 auto 20px; max-width: 520px; color: var(--text-2); }
.premium-status { display: inline-flex; align-items: center; gap: 8px; color: var(--good); font-weight: 700; }
.premium-plan { display: grid; gap: 12px; justify-items: center; margin-top: 18px; }
.premium-price { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.premium-plan p { max-width: 520px; margin: 0; }
.premium-perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; }
.perk { display: grid; gap: 6px; padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.perk svg { color: var(--accent); }
.perk span { color: var(--text-2); }
.hint.warn { color: var(--warn); }

/* ---------- 1.4: bell, ⋮ menus, dialogs ---------- */
.create-menu { width: 220px; right: auto; left: 0; }
.bell { position: relative; }
.bell-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.bell-menu { width: min(420px, calc(100vw - 24px)); padding: 0; }
.bell-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 16px; }
.bell-list { max-height: min(560px, calc(100vh - 160px)); overflow-y: auto; padding: 6px; }
.bell-list .spinner { margin: 24px auto; }
.bell-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 12px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.bell-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 19px; }
.bell-text > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.bell-text small { color: var(--muted); }
.bell-thumb { width: 86px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.bell-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 24px; text-align: center; color: var(--text-2); }
.spinner.small { width: 26px; height: 26px; border-width: 3px; }

details.kebab { position: relative; }
details.kebab > summary { list-style: none; cursor: pointer; }
details.kebab > summary::-webkit-details-marker { display: none; }
.kebab-menu { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s ease-out; }
.kebab-menu.right { left: auto; right: 0; }
.kebab-menu form { margin: 0; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.btn.icon-only { width: 40px; padding: 0; justify-content: center; }

dialog.small-dialog, dialog.share-dialog { width: min(460px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.small-dialog::backdrop, dialog.share-dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog.small-dialog h2, dialog.share-dialog h2 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.share-dialog h3 { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 15px; }
.share-row { display: flex; gap: 8px; margin-bottom: 10px; }
.share-row .input { flex: 1; min-width: 0; }
.embed-code { width: 100%; font: 12px/1.45 ui-monospace, Consolas, monospace; resize: none; margin-bottom: 8px; }
.input.mono { font-family: ui-monospace, Consolas, monospace; }
.save-lists { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 14px; }
.save-lists .spinner { margin: 12px auto; }
.save-list { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.save-list:hover { background: var(--surface-2); }
.save-list span { flex: 1; }
.save-new { display: flex; gap: 8px; flex-wrap: wrap; }
.save-new .input:first-child { flex: 1 1 180px; }
.save-new select { flex: 0 0 auto; width: auto; }
.report-reasons { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 12px; }
.radio-line { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; cursor: pointer; }
.radio-line:hover { background: var(--surface-2); }
dialog textarea.input { width: 100%; }

/* ---------- 1.4: watch page ---------- */
.watch-tags { display: flex; gap: 10px; margin: 16px 0 -10px; font-size: 13.5px; font-weight: 600; }
.watch-tags a, .desc-text a, .comment-text a, .post-text a { color: var(--accent-text); }
:root:not([data-theme="dark"]) .watch-tags a, :root:not([data-theme="dark"]) .desc-text a, :root:not([data-theme="dark"]) .comment-text a, :root:not([data-theme="dark"]) .post-text a { color: var(--accent); }
.members-tag, .member-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #f5b400 22%, var(--surface)); color: var(--text); font-size: 12px; font-weight: 700; vertical-align: middle; }
.member-badge { padding: 6px 12px; font-size: 13px; }
.res-badge.members { display: inline-flex; align-items: center; gap: 3px; background: color-mix(in srgb, #f5b400 22%, var(--surface)); border-color: transparent; color: var(--text); }
.verified { display: inline-flex; vertical-align: -2px; color: var(--text-2); margin-inline-start: 3px; }
.subscribe-group { display: inline-flex; gap: 6px; align-items: center; }
.bell-toggle.muted { color: var(--text-2); }
.chapters { margin-top: 14px; display: none; }
.desc.open .chapters { display: block; }
.chapters h3 { margin: 0 0 8px; font-size: 15px; }
.chapter-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.chapter { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.chapter:hover { background: var(--surface-3); }
.chapter-time { color: var(--accent-text); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.chapter-title { font-weight: 600; font-size: 14px; }
.p-mark { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: rgba(0, 0, 0, .75); z-index: 2; }
.p-chapter { font-size: 13px; font-weight: 600; color: #fff; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; padding: 0 6px; }
.p-chapter:empty { display: none; }
.p-upnext { position: absolute; right: 16px; bottom: 76px; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(10, 12, 18, .85); color: #fff; font-weight: 700; }
.p-upnext-cancel { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; }
.player.locked { display: grid; place-items: center; }
.locked-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(24px) brightness(.45); transform: scale(1.1); }
.player.locked .processing-box { position: relative; color: rgba(255, 255, 255, .85); }
.player.locked .processing-box strong { color: #fff; }
.player.locked .processing-box svg { color: #f5b400; }

.comments-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 28px 0 20px; }
.comments .comments-head h2 { margin: 0; }
.chips.static.small { margin: 0; }
.chips.small .chip { height: 30px; font-size: 13px; }
.comment-toolbar { display: flex; align-items: center; gap: 2px; margin: 4px 0 0 -8px; }
.comment-toolbar .icon-btn.active { color: var(--accent); }
.comment-likes { font-size: 12px; color: var(--text-2); min-width: 14px; margin-inline-end: 4px; }
.heart-btn.hearted { color: #e53935; }
.heart-mark { position: relative; display: inline-flex; margin: 0 8px 0 4px; }
.heart-mark > .heart-icon { position: absolute; right: -6px; bottom: -4px; color: #e53935; display: flex; }
.comment-pinned { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.comment-creator { padding: 1px 7px; border-radius: 999px; background: var(--surface-3); }
.comment.highlight { padding: 10px; margin-inline: -10px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.highlighted-comments { border-bottom: 1px solid var(--border); margin-bottom: 18px; padding-bottom: 6px; }
.highlighted-comments .small { margin: 0 0 8px; font-size: 12px; }
.comment.reply { margin-bottom: 14px; }
.replies { margin-top: 4px; }
.replies-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; margin-inline-start: -8px; border-radius: 999px; color: var(--accent-text); font-weight: 700; font-size: 14px; }
.replies-toggle:hover { background: var(--accent-weak); }
.replies-toggle svg { transition: transform .15s; }
.replies-toggle.open svg { transform: rotate(180deg); }
.reply-list { margin-top: 8px; }
.reply-form { margin: 8px 0 12px; }
.comments-more { display: flex; margin: 0 auto 20px; }

.playlist-panel { border: 1px solid var(--border); border-radius: 16px; margin-bottom: 18px; overflow: hidden; background: var(--surface); }
.playlist-panel header { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.playlist-panel-items { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow-y: auto; }
.playlist-panel-items a { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; }
.playlist-panel-items li.current a, .playlist-panel-items a:hover { background: var(--surface-2); }
.playlist-panel-items img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.pl-index { width: 22px; text-align: center; color: var(--text-2); font-size: 12px; flex-shrink: 0; }
.pl-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.pl-title { font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 1.4: thumbnails, cards ---------- */
.thumb-action { position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(10, 12, 18, .75); color: #fff; opacity: 0; transition: opacity .15s; }
.thumb:hover .thumb-action, .thumb-action:focus-visible { opacity: 1; }
.thumb-action[aria-pressed="true"] { background: var(--accent); opacity: 1; }
@media (hover: none) { .thumb-action { opacity: .85; } }
.live-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: #e53935; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .3px; vertical-align: middle; }
.live-thumb { background: radial-gradient(120% 140% at 85% 0%, color-mix(in srgb, var(--c) 55%, #fff) 0%, transparent 45%), linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 30%, #000)); }
.live-thumb .live-badge { position: absolute; left: 8px; bottom: 8px; }
.playlist-card .thumb.stacked { box-shadow: 0 -6px 0 -3px var(--surface-3), 0 -11px 0 -6px var(--surface-2); margin-top: 11px; overflow: visible; }
.playlist-card .thumb.stacked img { border-radius: 14px; }
.playlist-count { position: absolute; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 6px 10px; border-radius: 0 0 14px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); color: #fff; font-size: 12.5px; font-weight: 700; }
.playlist-empty-thumb { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-2); }
.playlist-card .card-text { margin-top: 10px; }

/* ---------- 1.4: playlist page ---------- */
.playlist-page { display: flex; gap: 24px; align-items: flex-start; max-width: 1300px; margin: 0 auto; }
.playlist-hero { position: sticky; top: 76px; width: 360px; flex-shrink: 0; padding: 18px; border-radius: 20px; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 75%, #000), color-mix(in srgb, var(--c) 25%, #000)); }
.playlist-hero > a > img, .playlist-hero .playlist-empty-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; background: rgba(255, 255, 255, .1); color: #fff; }
.playlist-hero h1 { margin: 14px 0 8px; font-size: 24px; line-height: 30px; font-weight: 800; word-break: break-word; }
.playlist-hero .muted { color: rgba(255, 255, 255, .75); }
.playlist-owner { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.playlist-desc { color: rgba(255, 255, 255, .85); white-space: pre-wrap; }
.playlist-hero .btn:not(.btn-accent) { background: rgba(255, 255, 255, .16); color: #fff; }
.playlist-edit { margin-top: 14px; }
.playlist-edit summary { list-style: none; color: #fff; }
.playlist-edit form { margin-top: 10px; padding: 14px; border-radius: 14px; background: var(--surface); color: var(--text); }
.playlist-items { flex: 1; min-width: 0; }
.playlist-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; }
.playlist-row:hover { background: var(--surface); }
.playlist-row .thumb { width: 160px; flex-shrink: 0; border-radius: 10px; }
.playlist-row .row-text { flex: 1; min-width: 0; }
.playlist-row .row-stats { color: var(--text-2); font-size: 13px; margin-top: 4px; }
@media (max-width: 900px) { .playlist-page { flex-direction: column; } .playlist-hero { position: static; width: auto; } .playlist-row .thumb { width: 120px; } }

/* ---------- 1.4: channel ---------- */
.avatar-live { position: relative; display: inline-grid; border-radius: 50%; box-shadow: 0 0 0 4px #e53935; }
.avatar-live .live-badge { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); }
.live-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 18px; border-radius: 14px; background: color-mix(in srgb, #e53935 10%, var(--surface)); border: 1px solid color-mix(in srgb, #e53935 30%, var(--border)); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs a { white-space: nowrap; }
.community { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.post-composer { display: flex; flex-direction: column; gap: 10px; }
.composer-head { display: flex; align-items: center; gap: 10px; }
.post-composer textarea { width: 100%; resize: vertical; }
.poll-editor { display: flex; flex-direction: column; gap: 6px; }
.composer-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-flex { flex: 1; }
.post-head { display: flex; gap: 12px; align-items: flex-start; }
.post-head > div { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.post-author { font-weight: 700; }
.post-text { white-space: pre-wrap; word-break: break-word; margin: 12px 0 0 52px; line-height: 22px; }
.post-image { display: block; max-width: calc(100% - 52px); max-height: 520px; margin: 12px 0 0 52px; border-radius: 14px; object-fit: contain; background: var(--surface-2); }
.post-locked { display: flex; align-items: center; gap: 10px; margin: 12px 0 0 52px; padding: 16px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); }
.poll { margin: 12px 0 0 52px; display: flex; flex-direction: column; gap: 6px; }
.poll-option { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; text-align: start; }
.poll-option:not(:disabled):hover { border-color: var(--border-strong); }
.poll-option.chosen { border-color: var(--accent); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-weak); transition: width .3s; z-index: 0; }
.poll-text, .poll-pct { position: relative; z-index: 1; }
.poll-text { flex: 1; font-weight: 600; }
.poll-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.post-foot { display: flex; gap: 4px; margin: 10px 0 0 44px; }
.post-foot .btn.active { color: var(--accent); }
.single-post .comments h2 { margin-top: 12px; }
@media (max-width: 560px) { .post-text, .post-image, .poll, .post-locked { margin-left: 0; max-width: 100%; } .post-foot { margin-left: -8px; } }

/* ---------- 1.4: Studio members, live ---------- */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.member-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.member-list li:last-child { border-bottom: 0; }
.member-list a { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.live-now { margin-bottom: 16px; border-color: color-mix(in srgb, #e53935 35%, var(--border)); }
.live-now-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hint.warn { color: var(--text); }

/* ---------- 1.4: live watch page ---------- */
.live-player video { cursor: pointer; }
.live-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; z-index: 3; }
.live-overlay[hidden] { display: none; }
.live-overlay .processing-box, .live-overlay .processing-box strong { color: #fff; }
.live-overlay .processing-box svg { color: #e53935; }
.live-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 24px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); opacity: 0; transition: opacity .2s; }
.live-player:hover .live-controls, .live-player.paused .live-controls, .live-controls:focus-within { opacity: 1; }
.live-controls .p-btn { color: #fff; }
.live-controls .p-vol { width: 80px; accent-color: #fff; }
.live-controls .live-badge { cursor: pointer; }
.live-unmute { position: absolute; top: 14px; left: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #111; font-weight: 700; }
.live-unmute[hidden] { display: none; }
.live-viewers { align-self: center; color: var(--text-2); font-weight: 600; margin-inline-end: 8px; }
.live-chat { display: flex; flex-direction: column; height: min(calc(100vh - 110px), 720px); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; position: sticky; top: 76px; }
.live-chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 800; }
.chat-list { list-style: none; margin: 0; padding: 8px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-item { position: relative; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; padding: 2px 22px 2px 0; }
.chat-item .avatar { margin-top: -2px; }
.chat-name { color: var(--text-2); font-weight: 700; white-space: nowrap; }
.chat-item.owner .chat-name { padding: 0 6px; border-radius: 4px; background: #f5b400; color: #111; }
.chat-text { word-break: break-word; min-width: 0; }
.chat-delete { position: absolute; right: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; color: var(--muted); opacity: 0; }
.chat-item:hover .chat-delete { opacity: 1; }
.chat-form { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-form .input { flex: 1; min-width: 0; height: 38px; }
.live-chat .signin-hint, .live-chat .empty-note { padding: 12px 16px; }
@media (max-width: 1016px) { .live-chat { position: static; height: 480px; } }

/* ---------- 1.4: embedded player ---------- */
body.embed { margin: 0; background: #000; overflow: hidden; }
body.embed .player { position: fixed; inset: 0; aspect-ratio: auto; max-height: none; border-radius: 0; box-shadow: none; }
.embed-title { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 14px 28px; background: linear-gradient(rgba(0, 0, 0, .7), transparent); color: #fff; font-weight: 700; font-size: 16px; opacity: 0; transition: opacity .2s; }
.embed-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player.active .embed-title, .player.paused .embed-title { opacity: 1; }
.embed-logo { position: absolute; right: 14px; bottom: 58px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 800; font-size: 13px; opacity: 0; transition: opacity .2s; }
.embed-logo .logo-mark { width: 20px; height: 20px; }
.player.active .embed-logo, .player.paused .embed-logo { opacity: .9; }
.embed-blocked { position: fixed; inset: 0; display: grid; place-items: center; background: #000 center / cover; color: #fff; text-align: center; }
.embed-blocked > div { display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 24px; border-radius: 16px; background: rgba(0, 0, 0, .7); }



/* ---------- 1.4.1: responsive fixes ---------- */
/* Channel row under the video: the name keeps room, buttons move to the next line when they don't fit. */
.owner { flex-wrap: wrap; row-gap: 10px; }
.owner-text { flex: 1 1 110px; }
.owner-subs { white-space: nowrap; }
.owner form { margin: 0; }
.watch-actions form { margin: 0; }
/* Upload progress: a long file name wraps instead of squeezing the status. */
.upload-status-head { flex-wrap: wrap; }
.upload-status-head strong { min-width: 0; overflow-wrap: anywhere; }
/* Copy rows (stream key, share link): the field keeps a usable width, buttons wrap below. */
.share-row { flex-wrap: wrap; }
.share-row .input { flex: 1 1 180px; }
/* Textareas never poke out of their card. */
textarea.input { max-width: 100%; box-sizing: border-box; }
/* Search is a button on phones; it opens over the top bar. */
.search-open, .search-close { display: none; }

@media (max-width: 860px) {
    /* Studio and admin tabs scroll sideways instead of stacking into many rows. */
    .studio-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .studio-tabs::-webkit-scrollbar { display: none; }
    .studio-tabs a, .studio-tabs .btn { flex-shrink: 0; white-space: nowrap; }
    .comments-head { gap: 10px; }
    .live-banner { flex-wrap: wrap; }
}

@media (max-width: 560px) {
    .search-open { display: inline-grid; }
    .search { display: none; }
    body.search-active .search {
        display: flex; position: absolute; inset: 11px 10px auto 10px; z-index: 5; gap: 6px; align-items: center;
    }
    body.search-active .search-close { display: inline-grid; flex-shrink: 0; }
    body.search-active .topbar-start, body.search-active .topbar-end { visibility: hidden; }
    .watch-title { font-size: 19px; line-height: 26px; }
    .watch-actions { gap: 6px; }
    .watch-actions .btn { padding: 0 12px; }
    .pill .btn { padding: 0 12px; }
    .channel-actions { gap: 6px; }
    .subscribe-group { flex-wrap: nowrap; }
    .comment { gap: 10px; }
    .comment-toolbar { flex-wrap: wrap; }
    .kebab-menu { min-width: 200px; max-width: calc(100vw - 24px); }
    .playlist-row { gap: 8px; padding: 6px 0; }
    .playlist-row .pl-index { display: none; }
    .composer-foot .p-flex { display: none; }
    .composer-foot .btn-accent { margin-inline-start: auto; }
    .studio-head p { margin-top: 4px; }
    .form-foot { flex-wrap: wrap; }
    .account-profile-row .media-buttons .btn { flex: 1 1 auto; justify-content: center; }
    .live-controls .p-vol { display: none; }
}

/* Studio's content table picks its columns by its own width (the sidebar may take part of the screen). */
.studio-table { container-type: inline-size; }
@container (max-width: 1280px) {
    .st-row { grid-template-columns: minmax(240px, 2fr) 140px 150px 90px 140px; }
    .st-row > :nth-child(4), .st-row > :nth-child(6), .st-row > :nth-child(7) { display: none; }
}
@container (max-width: 860px) {
    .st-row { grid-template-columns: minmax(0, 1fr) auto; }
    .st-headrow { display: none; }
    .st-row > :nth-child(3), .st-row > :nth-child(5) { display: none; }
    .st-row > :nth-child(2) { grid-column: 1; }
    .st-actions { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; }
}

/* ---------- 1.5: video menu, history ---------- */
.card-meta .card-text, .row .row-text { flex: 1; }
.card-kebab { flex-shrink: 0; align-self: flex-start; margin: -4px -8px 0 0; }
.card-kebab > summary { opacity: 0; transition: opacity .15s; }
.card:hover .card-kebab > summary, .row:hover .card-kebab > summary, .card-kebab[open] > summary, .card-kebab > summary:focus-visible { opacity: 1; }
@media (hover: none) { .card-kebab > summary { opacity: 1; } }
.dismissed { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--border-strong); color: var(--text-2); }
.feed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.history-item { display: flex; align-items: flex-start; gap: 6px; }
.history-item > .row { flex: 1; min-width: 0; }

/* ---------- 1.6: encoding nodes ---------- */
.nodes-page { max-width: 1000px; }
.nodes-page h2 { display: flex; align-items: center; gap: 8px; }
.nodes-page h3 { margin: 16px 0 0; font-size: 14px; }
.node-modes { margin: 14px 0 6px; }
.node-modes .radio-card small { line-height: 18px; }
.node-token { border-color: var(--accent); }
.machine-facts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; }
.machine-facts li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.machine-facts small { color: var(--muted); font-size: 12px; }
.machine-facts strong { font-size: 13.5px; overflow-wrap: anywhere; }
.encoder-speeds { display: grid; gap: 6px; margin-bottom: 10px; }
.encoder-speeds > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.encoder-speeds > div > strong { width: 52px; flex-shrink: 0; }
.encoder { display: inline-flex; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.encoder b { color: var(--text); }
.encoder.gpu { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.node-list { display: grid; gap: 12px; }
.node-card { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.node-card > header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.node-card > header > strong { font-size: 15px; overflow-wrap: anywhere; }
.node-card > header > small { flex-basis: 100%; }
.node-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.node-foot > span { flex: 1 1 260px; }
.node-foot form { margin: 0; }
.node-foot .inline-form { margin: 0; flex-wrap: nowrap; }
.input-sm { height: 30px; width: 64px; padding: 0 8px; font-size: 13px; }
.node-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.node-add .field { flex: 1 1 260px; margin: 0; }
.node-jobs .progress { display: block; margin-top: 6px; }
.node-jobs .progress > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s; }
.node-jobs small { white-space: normal; }

/* ---------- 1.6.1: autoplay, next video, loop, shuffle, favorites, queue ---------- */
.p-switch { position: relative; width: 38px; height: 42px; display: grid; place-items: center; flex-shrink: 0; }
.p-switch > span { position: relative; width: 32px; height: 16px; border-radius: 999px; background: rgba(255, 255, 255, .3); transition: background .15s; }
.p-switch > span::after { content: ""; position: absolute; top: -3px; left: -2px; width: 22px; height: 22px; border-radius: 50%; background: #ddd; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .15s, background .15s; }
.p-switch[aria-checked="true"] > span { background: color-mix(in srgb, var(--p-accent) 60%, transparent); }
.p-switch[aria-checked="true"] > span::after { transform: translateX(14px); background: #fff; }
.p-unmute { position: absolute; top: 14px; left: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #111; font-weight: 700; }
.p-upnext { flex-wrap: wrap; max-width: min(420px, calc(100% - 32px)); }
.p-upnext-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.p-upnext-text small { color: rgba(255, 255, 255, .7); font-weight: 600; }
.p-upnext-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-upnext-actions { display: flex; gap: 8px; }
.p-upnext-go { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--p-accent); color: #fff; font-weight: 700; }
@media (max-width: 560px) { .p-upnext { bottom: 64px; right: 8px; padding: 8px 10px; gap: 8px; } .p-switch { display: none; } }
.playlist-panel header { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.pl-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-head-text strong { overflow-wrap: anywhere; }
.pl-modes { display: flex; gap: 2px; flex-shrink: 0; }
.pl-modes .icon-btn.on { color: var(--accent-text); background: var(--accent-weak); }
:root:not([data-theme="dark"]) .pl-modes .icon-btn.on { color: var(--accent); }
.queue-panel .playlist-panel-items li { display: flex; align-items: center; gap: 2px; }
.queue-panel .playlist-panel-items li > a { flex: 1; min-width: 0; }
.queue-panel .playlist-panel-items li > .icon-btn { flex-shrink: 0; color: var(--text-2); }
.watch-actions .btn[data-favorite].active { color: #f5b400; }
.new-playlist { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; max-width: 720px; }
.new-playlist .input:first-child { flex: 1 1 240px; }
.new-playlist select.input { flex: 0 0 auto; width: auto; }

/* ---------- 1.7: going live from the browser ---------- */
.golive-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin: 10px 0; }
.golive-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.golive-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; background: #e5273c; color: #fff; font-weight: 800; font-size: 12px; pointer-events: none; }
.golive-stats { position: absolute; bottom: 8px; right: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none; }
.golive-stats:empty { display: none; }
.golive .form-foot { justify-content: flex-start; flex-wrap: wrap; align-items: center; }

/* ---------- 1.8: the browser studio ---------- */
.golive-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .golive-layout { grid-template-columns: minmax(0, 1fr); } }
.golive-scenes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.golive-scene { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; text-align: center; cursor: pointer; }
.golive-scene:hover { color: var(--text); }
.golive-scene.active { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.golive-scene kbd { position: absolute; top: 4px; right: 6px; font: 600 10px var(--font); color: var(--text-2); opacity: .7; }
@media (max-width: 560px) { .golive-scenes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.golive-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.golive-group { min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.golive-group > summary { cursor: pointer; font-weight: 800; font-size: 14px; }
.golive-group[open] > summary { margin-bottom: 10px; }
.golive-group > * + * { margin-top: 8px; }
.golive-group .field { margin: 8px 0 0; }
.golive-group .check { margin: 6px 0 0; }
.golive-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.golive-source select { flex: 1 1 140px; width: auto; min-width: 0; }
.golive-source small { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.golive-source small:empty { display: none; }
.golive-source .btn.on { border-color: var(--accent); color: var(--accent-text, var(--accent)); }
.golive-range { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.golive-range input { flex: 1; accent-color: var(--accent); }
.golive-mixer { display: grid; gap: 10px; }
.golive-channel { display: flex; gap: 8px; align-items: flex-start; }
.golive-channel .icon-btn.off { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.golive-channel-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.golive-channel-body select { width: 100%; }
.golive-channel-body input[type=range] { width: 100%; accent-color: var(--accent); }
.golive-channel-name { font-size: 13px; font-weight: 700; padding-top: 8px; }
.golive-meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.golive-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e 0 70%, #eab308 70% 90%, #ef4444 90%); background-size: 320px 100%; transition: width .08s linear; }
.golive-meter i.hot { box-shadow: 0 0 6px #ef4444; }
.notice .inline-form { display: inline-flex; margin: 0 0 0 10px; }

/* ---------- 1.7: node management ---------- */
.node-more { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.node-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text-2); }
.node-more .stack-form { margin-top: 10px; display: grid; gap: 10px; max-width: 560px; }
.node-log { max-height: 320px; overflow: auto; white-space: pre; font-size: 11.5px; }
.node-load { margin-bottom: 8px; }
.node-jobs li { flex-wrap: wrap; }
.admin-list.node-jobs li > span.node-job-actions { display: flex; flex-direction: row; flex: 0 0 auto; gap: 4px; }
.node-job-actions form { margin: 0; }

/* ---------- 1.6.2: Share dialog ---------- */
dialog.share-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.share-targets { display: flex; gap: 6px; overflow-x: auto; margin: 0 -4px 14px; padding: 2px 4px 6px; scrollbar-width: thin; }
.share-target { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 66px; padding: 4px 2px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; }
.share-target:hover { color: var(--text); background: var(--surface-2); }
.share-target > span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; }
:root[data-theme="dark"] .share-target > span[style*="#000"] { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .share-target > span[style*="#000"] { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); } }
.share-embed { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.share-embed > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 800; font-size: 15px; list-style: none; }
.share-embed > summary::-webkit-details-marker { display: none; }
.share-embed > summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border: solid var(--text-2); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.share-embed[open] > summary::after { transform: rotate(-135deg); }
.embed-preview { margin: 12px 0; }
.embed-preview:empty { display: none; }
.embed-preview iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; }
.embed-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 12px 0 6px; }
.embed-options .check { margin: 0; }
.embed-size { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-basis: 100%; }
.embed-size .input { width: auto; flex: 0 1 260px; min-width: 0; }

/* ---------- 1.8: live chat moderation, badges, emojis ---------- */
.live-chat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-chat-head > span:first-child { margin-inline-end: auto; }
.chat-modes { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-chip { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 700; }
.chat-settings { display: grid; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-settings .field { margin: 0; }
.chat-settings .hint { margin: 0; font-size: 12px; }
.chat-item { flex-wrap: wrap; column-gap: 6px; row-gap: 0; padding: 3px 26px 3px 4px; border-radius: 8px; }
.chat-item.highlight { background: color-mix(in srgb, var(--hl, var(--accent)) 16%, transparent); box-shadow: inset 3px 0 0 var(--hl, var(--accent)); }
.chat-item.mod .chat-name { color: #4f8cff; }
.chat-badges { display: inline-flex; gap: 2px; align-items: center; height: 20px; }
.chat-badge { display: inline-flex; align-items: center; }
.chat-badge.owner { color: #f5b400; }
.chat-badge.mod { color: #4f8cff; }
.chat-badge.member { color: #22c55e; }
.chat-badge.verified { color: var(--text-2); }
.premium-tag { justify-content: center; width: 16px; height: 16px; border-radius: 5px; background: linear-gradient(135deg, #f5b400, #ff6b3d); color: #111; font-size: 10px; font-weight: 900; line-height: 1; }
.chat-item .chat-text { flex: 1 1 140px; }
.chat-item .avatar + .chat-name { margin-inline-start: 0; }
.chat-more { position: absolute; right: 2px; top: 2px; width: 22px; height: 22px; border-radius: 6px; color: var(--text-2); opacity: 0; font-weight: 900; }
.chat-item:hover .chat-more, .chat-more:focus-visible { opacity: 1; }
@media (hover: none) { .chat-more { opacity: .6; } }
.chat-menu { position: absolute; right: 4px; top: 26px; z-index: 6; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.chat-menu .menu-item { min-height: 34px; font-size: 13.5px; }
.chat-note { margin: 0; padding: 6px 12px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.chat-form { position: relative; }
.chat-form .input:disabled { opacity: .6; }
.emoji-inline { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; margin: 0 1px; }
.emoji-picker { position: absolute; right: 8px; bottom: calc(100% + 6px); z-index: 7; width: min(330px, calc(100vw - 32px)); max-height: 340px; display: flex; flex-direction: column;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; }
.emoji-picker[hidden] { display: none; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.emoji-tab { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; font-size: 17px; display: grid; place-items: center; }
.emoji-tab img { width: 20px; height: 20px; object-fit: contain; }
.emoji-tab.on, .emoji-tab:hover { background: var(--surface-2); }
.emoji-head { padding: 6px 10px 2px; font-size: 12px; font-weight: 800; color: var(--text-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; padding: 4px 8px 8px; overflow-y: auto; }
.emoji-item { height: 34px; border-radius: 8px; font-size: 21px; line-height: 1; display: grid; place-items: center; }
.emoji-item:hover { background: var(--surface-2); }
.emoji-item.custom img { width: 26px; height: 26px; object-fit: contain; }
.emoji-item.locked { opacity: .35; filter: grayscale(1); cursor: not-allowed; }
.emoji-note { grid-column: 1 / -1; margin: 6px 2px; font-size: 12.5px; color: var(--text-2); }
.comment-form .emoji-picker, .reply-form .emoji-picker { right: 0; bottom: auto; top: calc(100% + 4px); }

/* Member and Premium badges next to names (comments, channel page) */
.member-badge { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 4px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; vertical-align: 1px;
    color: var(--badge, #22c55e); background: color-mix(in srgb, var(--badge, #22c55e) 14%, transparent); }
.premium-badge { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 4px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 900; vertical-align: 1px;
    color: #1a1204; background: linear-gradient(135deg, #ffd34d, #ff8a3d); letter-spacing: .02em; }
.premium-badge svg { width: 11px; height: 11px; }

/* Premium avatar rings */
.avatar.ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring1, #f5b400); }
.avatar-wrap { position: relative; display: inline-grid; place-items: center; border-radius: 50%; }
.ring-gold { --ring1: #f5b400; }
.ring-ice { --ring1: #7dd3fc; }
.ring-rose { --ring1: #fb7185; }
.ring-aurora, .ring-neon, .ring-fire { box-shadow: none !important; }
.avatar-wrap.ring-aurora::before, .avatar-wrap.ring-neon::before, .avatar-wrap.ring-fire::before {
    content: ""; position: absolute; inset: -3px; border-radius: 50%; z-index: 0; animation: ring-spin 4s linear infinite; }
.avatar-wrap.ring-aurora::before { background: conic-gradient(#22d3ee, #a855f7, #f472b6, #facc15, #22d3ee); }
.avatar-wrap.ring-neon::before { background: conic-gradient(#39ff14, #00e5ff, #39ff14); filter: drop-shadow(0 0 4px #39ff14); }
.avatar-wrap.ring-fire::before { background: conic-gradient(#ff3d00, #ffb300, #ff6d00, #ff3d00); filter: drop-shadow(0 0 4px #ff6d00); }
.avatar-wrap > .avatar { position: relative; z-index: 1; box-shadow: 0 0 0 2px var(--bg); }
@keyframes ring-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .avatar-wrap::before { animation: none; } }
.avatar.emoji-avatar { font-size: calc(var(--size) * .55); line-height: 1; }
.comment-input { position: relative; }

/* ---------- 1.8: Premium site colours (data-accent on <html>) ---------- */
:root[data-accent] { --accent: var(--a); --accent-hover: color-mix(in srgb, var(--a) 82%, #000); --accent-weak: color-mix(in srgb, var(--a) 12%, #fff); --accent-text: color-mix(in srgb, var(--a) 72%, #000); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"])[data-accent] { --accent-hover: color-mix(in srgb, var(--a) 78%, #fff); --accent-weak: color-mix(in srgb, var(--a) 24%, #12141c); --accent-text: color-mix(in srgb, var(--a) 45%, #fff); }
}
:root[data-theme="dark"][data-accent] { --accent-hover: color-mix(in srgb, var(--a) 78%, #fff); --accent-weak: color-mix(in srgb, var(--a) 24%, #12141c); --accent-text: color-mix(in srgb, var(--a) 45%, #fff); }
:root[data-accent="violet"] { --a: #7c3aed; }
:root[data-accent="ocean"] { --a: #0284c7; }
:root[data-accent="emerald"] { --a: #059669; }
:root[data-accent="sunset"] { --a: #ea580c; }
:root[data-accent="rose"] { --a: #e11d48; }
:root[data-accent="gold"] { --a: #ca8a04; }

.logo-premium { margin-inline-start: 6px; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 900; letter-spacing: .03em; color: #1a1204; background: linear-gradient(135deg, #ffd34d, #ff8a3d); align-self: center; }
@media (max-width: 560px) { .logo-premium { display: none; } }
.menu-item.premium-item svg { color: #f5a400; }
.menu-item.premium-item small { display: block; color: var(--text-2); font-weight: 500; }
.premium-avatar { display: grid; place-items: center; color: #1a1204; background: linear-gradient(135deg, #ffd34d, #ff8a3d) !important; }
a.premium-badge { text-decoration: none; }

/* Avatar and look (Studio > Customize channel) */
.emoji-avatar-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.emoji-avatar-input { width: 72px; text-align: center; font-size: 22px; }
.ring-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.ring-choice { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.ring-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.ring-choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.ring-choice input { margin: 0; }
.ring-sample.none { width: 32px; height: 32px; border-radius: 50%; border: 2px dashed var(--border-strong, var(--border)); }
.theme-sample { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.field-inline { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 0 30px; font-size: 13.5px; font-weight: 600; }
.field-inline select { width: auto; }

/* Membership levels (Studio) and the Join dialog */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tier-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-top: 4px solid var(--tier); border-radius: 14px; background: var(--surface); }
.tier-card.archived { opacity: .65; }
.tier-card.new { border-style: dashed; border-top-style: solid; }
.tier-card .field { margin: 0; }
.tier-card .check { margin: 0; font-size: 13.5px; }
.tier-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tier-level { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--tier); }
.color-input { padding: 2px; height: 38px; }
.emoji-add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.emoji-add .input { width: auto; flex: 1 1 160px; }
.emoji-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.emoji-admin-item { display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.emoji-admin-item img { grid-row: span 2; width: 40px; height: 40px; object-fit: contain; }
.emoji-admin-item code { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.emoji-admin-item small { grid-column: 2; }
.emoji-admin-item form { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
.join-dialog { width: min(760px, calc(100vw - 32px)); }
.join-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 12px 0; }
.join-tier { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-top: 4px solid var(--tier); border-radius: 14px; }
.join-tier.current { box-shadow: 0 0 0 2px var(--tier); }
.join-tier-head { display: flex; flex-direction: column; gap: 2px; }
.join-tier-head strong { color: var(--tier); font-size: 16px; }
.join-price { font-weight: 800; font-size: 18px; }
.join-tier ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-2); flex: 1; }
.join-emojis { display: flex; flex-wrap: wrap; gap: 4px; }
.join-emojis:empty { display: none; }
.join-emojis img { width: 26px; height: 26px; object-fit: contain; }
.join-tier .btn { align-self: stretch; justify-content: center; }
.premium-card { display: grid; gap: 10px; max-width: 460px; margin: 14px 0; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.premium-card-row { display: flex; align-items: center; gap: 12px; }
.premium-card-row > div { display: grid; gap: 2px; }
.premium-meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.premium-meter span { display: block; height: 100%; width: var(--left); background: linear-gradient(90deg, #ffd34d, #ff8a3d); }
.premium-card .btn { justify-self: start; }
.premium-perks { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.premium-hero .premium-card { margin: 14px auto; text-align: start; }
