/* BBTube: a YouTube-style channel page (2024-2026 web layout). Our own drawings and colours; a parody. */

:root {
    --bbt-bg: #fff;
    --bbt-bg-elev: #fff;
    --bbt-text: #0f0f0f;
    --bbt-text-2: #606060;
    --bbt-surface: rgba(0, 0, 0, .05);
    --bbt-surface-2: rgba(0, 0, 0, .1);
    --bbt-border: rgba(0, 0, 0, .1);
    --bbt-link: #065fd4;
    --bbt-link-bg: #def1ff;
    --bbt-accent: #e8003d;
    --bbt-btn-strong-bg: #0f0f0f;
    --bbt-btn-strong-fg: #fff;
    --bbt-input-border: #ccc;
    --bbt-shadow: 0 4px 32px rgba(0, 0, 0, .1);
    --bbt-highlight: rgba(6, 95, 212, .08);
    --bbt-show-light: inline-block;
    --bbt-show-dark: none;
    --bbt-header-h: 56px;
    --bbt-top: var(--wp-admin--admin-bar--height, 0px);
    --bbt-pad: 24px;
    --bbt-radius: 12px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bbt-bg: #0f0f0f;
        --bbt-bg-elev: #212121;
        --bbt-text: #f1f1f1;
        --bbt-text-2: #aaa;
        --bbt-surface: rgba(255, 255, 255, .1);
        --bbt-surface-2: rgba(255, 255, 255, .2);
        --bbt-border: rgba(255, 255, 255, .2);
        --bbt-link: #3ea6ff;
        --bbt-link-bg: rgba(62, 166, 255, .15);
        --bbt-btn-strong-bg: #f1f1f1;
        --bbt-btn-strong-fg: #0f0f0f;
        --bbt-input-border: #303030;
        --bbt-shadow: 0 4px 32px rgba(0, 0, 0, .6);
        --bbt-highlight: rgba(62, 166, 255, .1);
        --bbt-show-light: none;
        --bbt-show-dark: inline-block;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bbt-bg: #0f0f0f;
    --bbt-bg-elev: #212121;
    --bbt-text: #f1f1f1;
    --bbt-text-2: #aaa;
    --bbt-surface: rgba(255, 255, 255, .1);
    --bbt-surface-2: rgba(255, 255, 255, .2);
    --bbt-border: rgba(255, 255, 255, .2);
    --bbt-link: #3ea6ff;
    --bbt-link-bg: rgba(62, 166, 255, .15);
    --bbt-btn-strong-bg: #f1f1f1;
    --bbt-btn-strong-fg: #0f0f0f;
    --bbt-input-border: #303030;
    --bbt-shadow: 0 4px 32px rgba(0, 0, 0, .6);
    --bbt-highlight: rgba(62, 166, 255, .1);
    --bbt-show-light: none;
    --bbt-show-dark: inline-block;
    color-scheme: dark;
}

@media (max-width: 656px) {
    :root { --bbt-pad: 16px; --bbt-header-h: 48px; }
}

/* ---------- Base ---------- */

html.bbt-html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bbt-header-h) + var(--bbt-top) + 8px); }
body.bbt-body {
    margin: 0;
    background: var(--bbt-bg);
    color: var(--bbt-text);
    font: 400 14px/1.43 Roboto, Arial, sans-serif;
    overflow-x: hidden;
}
.bbt-body *, .bbt-body *::before, .bbt-body *::after { box-sizing: border-box; }
/* :where() keeps these resets at element weight, so a component class (.bbt-btn-sub, .bbt-tag...) sets its own colour. */
:where(.bbt-body) a { color: inherit; text-decoration: none; }
.bbt-body img { max-width: 100%; }
/* <picture> (WebP with a JPEG/PNG fallback) adds no box: the <img> inside is laid out and styled as before. */
:where(.bbt-body) picture { display: contents; }
.bbt-body h1, .bbt-body h2, .bbt-body h3 { margin: 0; font-weight: 700; color: inherit; }
:where(.bbt-body) :is(button, input, textarea) { font: inherit; color: inherit; }
.bbt-body button { cursor: pointer; }
.bbt-body :focus-visible { outline: 2px solid var(--bbt-link); outline-offset: 2px; }
.bbt-i { width: 24px; height: 24px; fill: currentColor; flex: none; display: inline-block; vertical-align: middle; }
.bbt-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.bbt-skip { position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--bbt-bg-elev); padding: 8px 16px; border-radius: 8px; box-shadow: var(--bbt-shadow); }
.bbt-skip:focus { top: calc(var(--bbt-top) + 8px); }
.bbt-main { min-height: 60vh; }
.bbt-empty { color: var(--bbt-text-2); padding: 24px 0; }

/* ---------- Buttons ---------- */

.bbt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 16px; border: 0; border-radius: 18px;
    background: var(--bbt-surface); color: var(--bbt-text);
    font-size: 14px; font-weight: 500; line-height: 36px; white-space: nowrap;
    transition: background-color .1s;
}
.bbt-btn:hover { background: var(--bbt-surface-2); }
.bbt-btn .bbt-i { width: 20px; height: 20px; }
.bbt-btn-sub, .bbt-btn-light { background: var(--bbt-btn-strong-bg); color: var(--bbt-btn-strong-fg); }
.bbt-btn-sub:hover, .bbt-btn-light:hover { background: var(--bbt-btn-strong-bg); opacity: .85; }
.bbt-btn-join { background: transparent; box-shadow: inset 0 0 0 1px var(--bbt-border); }
.bbt-btn-join:hover { background: var(--bbt-surface); }
.bbt-btn-primary { background: var(--bbt-link); color: #fff; }
.bbt-btn-primary:hover { background: var(--bbt-link); opacity: .9; }
.bbt-btn-primary:disabled { background: var(--bbt-surface); color: var(--bbt-text-2); cursor: default; opacity: 1; }
.bbt-btn-text { background: transparent; }
.bbt-btn-text:hover { background: var(--bbt-surface-2); }
.bbt-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--bbt-text); padding: 0;
}
.bbt-icon-btn:hover { background: var(--bbt-surface-2); }
.bbt-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px 0 12px;
    border: 0; border-radius: 18px; background: var(--bbt-surface); font-size: 14px; font-weight: 500;
}
.bbt-pill:hover { background: var(--bbt-surface-2); }
.bbt-pill .bbt-i { width: 22px; height: 22px; }
.bbt-like[aria-pressed="true"] { color: var(--bbt-accent); }
.bbt-like[aria-pressed="true"] .bbt-like-n { color: var(--bbt-text); }

/* ---------- Header ---------- */

.bbt-header {
    position: sticky; top: var(--bbt-top); z-index: 100;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    height: var(--bbt-header-h); padding: 0 var(--bbt-pad);
    background: var(--bbt-bg);
}
.bbt-logo { display: inline-flex; align-items: center; flex: none; }
.bbt-logo img { display: block; width: 96px; height: 40px; }
.bbt-logo-light { display: var(--bbt-show-light) !important; }
.bbt-logo-dark { display: var(--bbt-show-dark) !important; }
.bbt-search { display: flex; align-items: center; flex: 0 1 640px; min-width: 0; margin: 0 auto; }
.bbt-search input {
    flex: 1; min-width: 0; height: 40px; padding: 0 16px; margin: 0;
    border: 1px solid var(--bbt-input-border); border-right: 0; border-radius: 40px 0 0 40px;
    background: var(--bbt-bg); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
.bbt-search input:focus { border-color: var(--bbt-link); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); }
.bbt-search input::-webkit-search-cancel-button { cursor: pointer; }
.bbt-search-go {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 64px; height: 40px; border: 1px solid var(--bbt-input-border); border-radius: 0 40px 40px 0;
    background: var(--bbt-surface);
}
.bbt-search-go:hover { background: var(--bbt-surface-2); }
.bbt-search-back, .bbt-search-open { display: none; }
.bbt-header-end { display: flex; align-items: center; gap: 4px; flex: none; }
.bbt-theme .bbt-i-sun { display: var(--bbt-show-dark); }
.bbt-theme .bbt-i-moon { display: var(--bbt-show-light); }

@media (max-width: 656px) {
    .bbt-search { display: none; }
    .bbt-search-open { display: inline-flex; }
    .bbt-header.is-searching .bbt-logo, .bbt-header.is-searching .bbt-header-end { display: none; }
    .bbt-header.is-searching .bbt-search { display: flex; flex: 1; gap: 8px; }
    .bbt-header.is-searching .bbt-search-back { display: inline-flex; flex: none; }
    .bbt-search input { height: 36px; border-right: 1px solid var(--bbt-input-border); border-radius: 18px; background: var(--bbt-surface); border-color: transparent; }
    .bbt-search-go { display: none; }
}

/* ---------- Channel header and tabs ---------- */

.bbt-channel { max-width: 1284px; margin: 0 auto; padding: 0 var(--bbt-pad); }
.bbt-banner {
    position: relative; aspect-ratio: 6.2 / 1; min-height: 80px; overflow: hidden;
    border-radius: 16px; background: #181818; margin-top: 8px;
}
.bbt-banner.has-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The default channel banner: a white-to-pink panel with the BBTube logo and tagline, then leaning photo slices of Bianca
   with a gold/red stripe (one pre-composited image), and a light streak that sweeps across every few seconds.
   Transform/opacity animation only; off under reduced motion. Same pink in light and dark mode. */
.bbt-banner.bbt-hdr {
    aspect-ratio: 1600 / 258; min-height: 0; isolation: isolate;
    background: linear-gradient(100deg, #ffeef5 0%, #ffe9f2 22%, #ffd3e5 42%, #ff8dbb 100%);
}
.bbt-hdr-slices { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
.bbt-hdr-center { position: absolute; left: 1.25%; top: 0; z-index: 2; width: 31.25%; height: 100%; }
.bbt-hdr-center img { display: block; width: 100%; height: 100%; }
.bbt-hdr-streak {
    position: absolute; top: -5%; bottom: -5%; left: 0; z-index: 3; width: 9%; pointer-events: none; opacity: .6; will-change: transform;
    transform: translateX(-200%) skewX(-14deg); animation: bbt-hdr-streak 7s ease-in-out 1.5s infinite;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .9), rgba(255, 255, 255, 0));
}
@keyframes bbt-hdr-streak { 0%, 45% { transform: translateX(-200%) skewX(-14deg); } 85%, 100% { transform: translateX(1150%) skewX(-14deg); } }
.bbt-chan-row { display: flex; align-items: center; gap: 24px; padding: 24px 0 8px; }
.bbt-chan-avatar { width: 160px; height: 160px; flex: none; border-radius: 50%; object-fit: cover; background: var(--bbt-surface); }
.bbt-chan-info { min-width: 0; }
.bbt-chan-name { display: flex; align-items: center; gap: 8px; font-size: 36px; line-height: 50px; font-weight: 700; }
.bbt-chan-name .bbt-i, .bbt-owner-name .bbt-i { width: 20px; height: 20px; fill: var(--bbt-text-2); }
.bbt-chan-sub { color: var(--bbt-text-2); margin-top: 4px; }
.bbt-chan-sub b { color: var(--bbt-text); font-weight: 500; }
.bbt-chan-tagline { display: block; color: var(--bbt-text-2); margin-top: 8px; max-width: 640px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbt-chan-tagline span { color: var(--bbt-text); font-weight: 500; }
.bbt-chan-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bbt-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--bbt-border); overflow-x: auto; scrollbar-width: none; margin-bottom: 24px; }
.bbt-tabs::-webkit-scrollbar { display: none; }
.bbt-tabs a { display: block; flex: none; padding: 0 0 2px; line-height: 46px; font-size: 16px; font-weight: 500; color: var(--bbt-text-2); border-bottom: 2px solid transparent; }
.bbt-tabs a:hover { color: var(--bbt-text); border-bottom-color: var(--bbt-text-2); }
.bbt-tabs a.is-active { color: var(--bbt-text); border-bottom-color: var(--bbt-text); }

@media (max-width: 656px) {
    .bbt-banner { aspect-ratio: 4 / 1; border-radius: 12px; }
    .bbt-banner.bbt-hdr { aspect-ratio: 3 / 1; }
    .bbt-hdr-center { left: 0; width: 44.44%; }
    .bbt-chan-row { gap: 16px; padding-top: 16px; align-items: flex-start; flex-wrap: wrap; }
    .bbt-chan-avatar { width: 72px; height: 72px; }
    .bbt-chan-info { flex: 1; }
    .bbt-chan-name { font-size: 24px; line-height: 32px; }
    .bbt-chan-btns { flex-basis: 100%; }
    .bbt-chan-btns .bbt-btn { flex: 1; }
    .bbt-tabs { gap: 20px; margin-bottom: 16px; }
}

/* ---------- Cards, grids, shelves ---------- */

.bbt-main > .bbt-grid, .bbt-main > .bbt-shelf, .bbt-main > .bbt-chips, .bbt-main > .bbt-featured, .bbt-main > .bbt-about,
.bbt-main > .bbt-results, .bbt-main > .bbt-404, .bbt-main > .bbt-plpage {
    max-width: 1284px; margin-left: auto; margin-right: auto; padding-left: var(--bbt-pad); padding-right: var(--bbt-pad);
}
.bbt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 16px; padding-bottom: 40px; }
@media (max-width: 1100px) { .bbt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .bbt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 12px; } }
@media (max-width: 520px) { .bbt-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

.bbt-card { position: relative; min-width: 0; }
.bbt-thumb {
    position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
    border-radius: var(--bbt-radius); background: var(--bbt-surface);
}
.bbt-thumb img, .bbt-noimg { display: block; width: 100%; height: 100%; object-fit: cover; }
.bbt-card-grid .bbt-thumb img { transition: transform .2s; }
.bbt-card-grid:hover .bbt-thumb img { transform: scale(1.02); }
.bbt-dur {
    position: absolute; right: 8px; bottom: 8px; padding: 1px 4px; border-radius: 4px;
    background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 500; line-height: 18px;
}
.bbt-dur-list { display: inline-flex; align-items: center; gap: 2px; }
.bbt-dur-list .bbt-i { width: 16px; height: 16px; }
.bbt-thumb-stack { overflow: visible; margin-top: 8px; }
.bbt-thumb-stack::before {
    content: ""; position: absolute; left: 12px; right: 12px; top: -8px; height: 8px;
    border-radius: 8px 8px 0 0; background: var(--bbt-surface-2);
}
.bbt-thumb-stack img { border-radius: var(--bbt-radius); }
.bbt-card-meta { padding-top: 12px; min-width: 0; }
.bbt-card-title { font-size: 16px; line-height: 22px; font-weight: 500; }
.bbt-card-title a { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.bbt-card-sub { color: var(--bbt-text-2); font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbt-card-sub a:hover { color: var(--bbt-text); }
.bbt-card-desc { color: var(--bbt-text-2); font-size: 12px; line-height: 18px; margin: 8px 0 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* Search results: thumbnail left. */
.bbt-results { padding-top: 16px; padding-bottom: 40px; max-width: 1096px !important; }
.bbt-card-row { display: flex; gap: 16px; margin-bottom: 16px; }
.bbt-card-row .bbt-thumb { width: 360px; flex: none; }
.bbt-card-row .bbt-card-meta { padding-top: 0; flex: 1; }
.bbt-card-row .bbt-card-title { font-size: 18px; line-height: 26px; font-weight: 400; margin-bottom: 4px; }
.bbt-card-row .bbt-card-sub { font-size: 12px; line-height: 18px; }
@media (max-width: 656px) {
    .bbt-card-row { display: block; margin-bottom: 24px; }
    .bbt-card-row .bbt-thumb { width: auto; }
    .bbt-card-row .bbt-card-meta { padding-top: 12px; }
    .bbt-card-row .bbt-card-title { font-size: 16px; line-height: 22px; font-weight: 500; }
}

/* Compact: up next, playlist lists. */
.bbt-card-compact { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.bbt-card-compact .bbt-thumb { width: 168px; flex: none; border-radius: 8px; }
.bbt-card-compact .bbt-dur { right: 4px; bottom: 4px; }
.bbt-card-compact .bbt-card-meta { padding: 0 0 0 0; flex: 1; }
.bbt-card-compact .bbt-card-title { font-size: 14px; line-height: 20px; margin-bottom: 4px; }
.bbt-card-compact .bbt-card-sub { font-size: 12px; line-height: 18px; }
.bbt-card-index { flex: none; width: 24px; align-self: center; text-align: center; color: var(--bbt-text-2); font-size: 12px; }
.bbt-card-index .bbt-i { width: 14px; height: 14px; }
.bbt-card-compact.is-current { background: var(--bbt-surface); border-radius: 8px; }

/* Shelves (Home). */
.bbt-shelf { padding-top: 24px; padding-bottom: 8px; border-top: 1px solid var(--bbt-border); }
.bbt-featured + .bbt-shelf, .bbt-channel + .bbt-shelf { border-top: 0; }
.bbt-shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.bbt-shelf-head h2 { font-size: 20px; line-height: 28px; }
.bbt-chip-link { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 18px; font-weight: 500; color: var(--bbt-text); }
.bbt-chip-link:hover { background: var(--bbt-surface-2); }
.bbt-shelf-row {
    display: grid; grid-auto-flow: column; grid-auto-columns: 210px; column-gap: 4px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding-bottom: 16px;
    scrollbar-width: thin;
}
.bbt-shelf-row .bbt-card { scroll-snap-align: start; padding-right: 4px; }
.bbt-shelf-row .bbt-card-title { font-size: 14px; line-height: 20px; }
.bbt-shelf-row .bbt-card-meta { padding-top: 8px; }
.bbt-shelf-row .bbt-card-sub { font-size: 12px; line-height: 18px; }
.bbt-shelf-row .bbt-thumb { border-radius: 8px; }
@media (max-width: 656px) { .bbt-shelf-row { grid-auto-columns: 64%; } }

/* Featured video (Home). */
.bbt-featured { display: flex; gap: 24px; padding-bottom: 24px; }
.bbt-featured .bbt-thumb { width: 424px; flex: none; }
.bbt-featured > noscript { display: contents; } /* No JS: its default video lays out like the rotated one. */
.bbt-featured-meta { min-width: 0; max-width: 560px; }
.bbt-featured-meta h2 { font-size: 18px; line-height: 26px; font-weight: 500; margin-bottom: 4px; }
.bbt-featured-meta p { color: var(--bbt-text-2); margin: 12px 0 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
@media (max-width: 800px) {
    .bbt-featured { display: block; }
    .bbt-featured .bbt-thumb { width: auto; margin-bottom: 12px; }
}

/* Chips (Videos tab sort). */
.bbt-chips { display: flex; gap: 12px; padding-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.bbt-chip {
    display: inline-flex; align-items: center; flex: none; height: 32px; padding: 0 12px; border-radius: 8px;
    background: var(--bbt-surface); font-weight: 500;
}
.bbt-chip:hover { background: var(--bbt-surface-2); }
.bbt-chip.is-active { background: var(--bbt-text); color: var(--bbt-bg); }

/* About. */
.bbt-about { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding-bottom: 48px; }
.bbt-about h2 { font-size: 20px; line-height: 28px; margin-bottom: 16px; }
.bbt-about-text { font-size: 15px; line-height: 1.6; max-width: 72ch; }
.bbt-about-text p { margin: 0 0 1em; white-space: pre-line; }
.bbt-about-side ul { list-style: none; margin: 0; padding: 0; }
.bbt-about-side li { padding: 10px 0; border-bottom: 1px solid var(--bbt-border); }
.bbt-about-side a { color: var(--bbt-link); }
@media (max-width: 800px) { .bbt-about { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

/* 404. */
.bbt-404 { text-align: center; padding-top: 64px !important; padding-bottom: 32px !important; }
.bbt-404 h1 { font-size: 24px; margin-bottom: 8px; }
.bbt-404 p { color: var(--bbt-text-2); }

/* ---------- Playlist page ---------- */

.bbt-plpage { display: flex; gap: 24px; align-items: flex-start; padding-top: 24px !important; padding-bottom: 48px !important; }
.bbt-plhead {
    position: sticky; top: calc(var(--bbt-top) + var(--bbt-header-h) + 16px); width: 360px; flex: none;
    padding: 24px; border-radius: 16px; color: #fff;
    background: linear-gradient(180deg, #5b2333 0%, #2a1118 60%, #160a0e 100%);
}
.bbt-plhead .bbt-thumb { margin-bottom: 16px; }
.bbt-plhead h1 { font-size: 28px; line-height: 38px; margin-bottom: 16px; }
.bbt-plhead-sub { font-size: 12px; line-height: 18px; color: rgba(255, 255, 255, .7); }
.bbt-plhead-sub b { color: #fff; font-size: 14px; font-weight: 500; }
.bbt-plhead-desc { font-size: 14px; color: rgba(255, 255, 255, .7); margin: 12px 0 0; white-space: pre-line; }
.bbt-plhead .bbt-btn { margin-top: 20px; width: 100%; background: #fff; color: #0f0f0f; }
.bbt-pllist { flex: 1; min-width: 0; }
.bbt-pllist .bbt-card-compact { padding: 8px; border-radius: 12px; }
.bbt-pllist .bbt-card-compact:hover { background: var(--bbt-surface); }
@media (max-width: 900px) {
    .bbt-plpage { display: block; padding-top: 0 !important; }
    .bbt-plhead { position: static; width: auto; margin: 0 calc(var(--bbt-pad) * -1) 16px; border-radius: 0; }
    .bbt-plhead .bbt-thumb { max-width: 420px; }
}
@media (max-width: 520px) { .bbt-pllist .bbt-card-compact .bbt-thumb { width: 140px; } }

/* ---------- Watch page ---------- */

.bbt-watch { max-width: 1754px; margin: 0 auto; }
.bbt-theater-slot:empty { display: none; }
.bbt-watch-cols { display: flex; gap: 24px; padding: 24px var(--bbt-pad) 48px; }
.bbt-watch-main { flex: 1; min-width: 0; }
.bbt-watch-side { width: 402px; flex: none; min-width: 0; }
.bbt-watch-title { font-size: 20px; line-height: 28px; font-weight: 700; margin: 12px 0 0; word-wrap: break-word; }
.bbt-watch-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.bbt-owner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bbt-owner-avatar { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bbt-surface); }
.bbt-owner-text { display: flex; flex-direction: column; min-width: 0; margin-right: 12px; }
.bbt-owner-name { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; line-height: 22px; font-weight: 500; }
.bbt-owner-name .bbt-i { width: 14px; height: 14px; }
.bbt-owner-sub { color: var(--bbt-text-2); font-size: 12px; line-height: 18px; }
.bbt-owner-btns { display: flex; gap: 8px; }
.bbt-actions { display: flex; gap: 8px; }

.bbt-desc { position: relative; margin-top: 12px; padding: 12px; border-radius: var(--bbt-radius); background: var(--bbt-surface); font-size: 14px; line-height: 20px; cursor: pointer; }
.bbt-desc.is-open { cursor: default; }
.bbt-desc:hover:not(.is-open) { background: var(--bbt-surface-2); }
.bbt-desc-meta { font-weight: 500; }
.bbt-desc-meta b { margin-right: 8px; }
.bbt-tag { color: var(--bbt-link); margin-right: 4px; font-weight: 400; }
.bbt-desc-text { max-height: 60px; overflow: hidden; }
.bbt-desc.is-open .bbt-desc-text { max-height: none; }
.bbt-desc-text p { margin: 0 0 12px; }
.bbt-desc-text p:last-child { margin-bottom: 0; }
.bbt-desc-text a { color: var(--bbt-link); }
.bbt-desc-toggle { border: 0; background: none; padding: 0; margin-top: 4px; font-weight: 500; }

/* Member card. */
.bbt-mcard {
    display: flex; gap: 16px; align-items: stretch; margin-top: 16px; padding: 12px;
    border: 1px solid var(--bbt-border); border-radius: var(--bbt-radius);
    background: linear-gradient(120deg, rgba(232, 0, 61, .07), transparent 60%);
    container-type: inline-size;
}
/* The cover is at least 2:3 (the ::before); when the text beside it is taller (a phone), it stretches to the card's full
   height and the photo is cropped at the sides. */
.bbt-mcard-cover { position: relative; flex: none; width: 112px; border-radius: 8px; overflow: hidden; background: var(--bbt-surface); }
.bbt-mcard-cover::before { content: ""; display: block; padding-top: 150%; }
.bbt-mcard-cover img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.bbt-mcard-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bbt-mcard-eyebrow { font-size: 12px; line-height: 18px; color: var(--bbt-accent); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.bbt-mcard h2 { font-size: 18px; line-height: 26px; margin-top: 2px; }
.bbt-mcard-date { color: var(--bbt-text-2); font-size: 13px; }
.bbt-mcard-btns { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.bbt-mcard.is-generic { align-items: center; }
.bbt-mcard.is-generic h2 { font-size: 16px; line-height: 22px; }
/* A wide card (the watch page on a PC): a bigger cover, the text centred beside it, the buttons on the right. */
@container (min-width: 700px) {
    .bbt-mcard-cover { width: 128px; }
    .bbt-mcard-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-content: center; }
    .bbt-mcard-body > * { grid-column: 1; }
    .bbt-mcard-body > .bbt-mcard-btns { grid-column: 2; grid-row: 1 / span 3; align-self: center; flex-wrap: nowrap; margin: 0; padding: 0; }
    .bbt-mcard h2 { font-size: 20px; line-height: 28px; }
}
@media (max-width: 520px) {
    .bbt-mcard-cover { width: 84px; }
    .bbt-mcard h2 { font-size: 16px; line-height: 22px; }
    .bbt-mcard-btns .bbt-btn { flex: 1 1 auto; }
}

/* Sidebar: playlist panel, up next. */
.bbt-plpanel { border: 1px solid var(--bbt-border); border-radius: var(--bbt-radius); overflow: hidden; margin-bottom: 16px; }
.bbt-plpanel-head { display: flex; flex-direction: column; padding: 12px 16px; background: var(--bbt-surface); }
.bbt-plpanel-head b { font-size: 18px; line-height: 26px; }
.bbt-plpanel-head span { color: var(--bbt-text-2); font-size: 12px; }
.bbt-plpanel-list { max-height: 400px; overflow-y: auto; padding: 4px 8px 8px 0; }
.bbt-plpanel-list .bbt-card-compact .bbt-thumb { width: 100px; }
.bbt-upnext-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bbt-upnext-head h2 { font-size: 16px; line-height: 22px; font-weight: 500; }
.bbt-upnext .bbt-card-compact { margin-bottom: 4px; }
.bbt-switch { display: inline-flex; align-items: center; gap: 8px; color: var(--bbt-text-2); font-size: 13px; cursor: pointer; position: relative; }
.bbt-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bbt-switch-track { position: relative; width: 36px; height: 14px; border-radius: 7px; background: var(--bbt-surface-2); transition: background .15s; }
.bbt-switch-track::after {
    content: ""; position: absolute; left: -2px; top: -3px; width: 20px; height: 20px; border-radius: 50%;
    background: #f1f1f1; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .15s;
}
.bbt-switch input:checked + .bbt-switch-track { background: rgba(232, 0, 61, .45); }
.bbt-switch input:checked + .bbt-switch-track::after { transform: translateX(20px); background: var(--bbt-accent); }
.bbt-switch input:focus-visible + .bbt-switch-track { outline: 2px solid var(--bbt-link); outline-offset: 4px; }

@media (max-width: 1000px) {
    .bbt-watch-cols { flex-direction: column; gap: 0; padding-top: 0; }
    .bbt-watch-main { display: contents; }
    .bbt-player-slot { order: 1; margin: 0 calc(var(--bbt-pad) * -1); }
    .bbt-watch-title, .bbt-watch-row, .bbt-desc, .bbt-mcard { order: 2; }
    .bbt-watch-side { order: 3; width: auto; margin-top: 24px; }
    .bbt-comments { order: 4; }
    .bbt-player-slot .bbt-player { border-radius: 0; }
}
@media (max-width: 656px) {
    .bbt-watch-title { font-size: 18px; line-height: 26px; }
    .bbt-watch-row { gap: 12px; }
    .bbt-owner { width: 100%; }
    .bbt-owner-btns { margin-left: auto; }
    .bbt-owner-btns .bbt-btn-join { display: none; }
    .bbt-actions { overflow-x: auto; scrollbar-width: none; }
    .bbt-card-compact .bbt-thumb { width: 150px; }
}

/* ---------- Player ---------- */

.bbt-player {
    position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
    border-radius: var(--bbt-radius); background: #000; color: #fff;
    -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; outline: none;
}
.bbt-player .bbt-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* The poster over the video until playback starts (clicks go through to the video). */
.bbt-p-poster { position: absolute; inset: 0; pointer-events: none; background: #000; }
.bbt-p-poster img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bbt-player.is-started .bbt-p-poster { display: none; }
/* No JS: the plain <video controls> covers the box (with JS, <noscript> holds text, not elements). */
.bbt-player > noscript > .bbt-video { position: absolute; inset: 0; z-index: 5; }
.bbt-player.is-idle { cursor: none; }
.bbt-player button { border: 0; background: none; color: #fff; padding: 0; }
.bbt-player .bbt-i { width: 24px; height: 24px; }

.bbt-p-big {
    position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .6) !important; transition: background .15s, opacity .2s, transform .15s;
}
.bbt-p-big .bbt-i { width: 40px; height: 40px; }
.bbt-p-big:hover { background: var(--bbt-accent) !important; }
.bbt-player.is-playing .bbt-p-big { opacity: 0; pointer-events: none; }
.bbt-player.is-touch.is-playing:not(.is-idle) .bbt-p-big { opacity: 1; pointer-events: auto; }
.bbt-p-spin {
    position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
    border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%;
    animation: bbt-spin .9s linear infinite; display: none; pointer-events: none;
}
.bbt-player.is-waiting .bbt-p-spin { display: block; }
.bbt-player.is-waiting .bbt-p-big { opacity: 0; }
@keyframes bbt-spin { to { transform: rotate(360deg); } }

.bbt-p-ctrl {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
    transition: opacity .25s;
}
.bbt-player.is-idle .bbt-p-ctrl, .bbt-player.is-ended .bbt-p-ctrl { opacity: 0; pointer-events: none; }
.bbt-p-bar { position: relative; height: 16px; margin: 0 0 -2px; cursor: pointer; touch-action: none; }
.bbt-p-track { position: absolute; left: 0; right: 0; bottom: 6px; height: 3px; background: rgba(255, 255, 255, .2); transition: height .1s, bottom .1s; }
.bbt-p-bar:hover .bbt-p-track, .bbt-player.is-scrubbing .bbt-p-track { height: 5px; bottom: 5px; }
.bbt-p-buf, .bbt-p-hov, .bbt-p-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.bbt-p-buf { background: rgba(255, 255, 255, .4); }
.bbt-p-hov { background: rgba(255, 255, 255, .5); display: none; }
.bbt-p-bar:hover .bbt-p-hov { display: block; }
.bbt-p-fill { background: var(--bbt-accent); }
.bbt-p-knob {
    position: absolute; bottom: 1px; left: 0; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%;
    background: var(--bbt-accent); transform: scale(0); transition: transform .1s;
}
.bbt-p-bar:hover .bbt-p-knob, .bbt-player.is-scrubbing .bbt-p-knob, .bbt-player.is-touch .bbt-p-knob { transform: scale(1); }
.bbt-p-tip {
    position: absolute; bottom: 22px; padding: 2px 6px; border-radius: 4px; background: rgba(28, 28, 28, .9);
    font-size: 12px; font-weight: 500; transform: translateX(-50%); display: none; white-space: nowrap; pointer-events: none;
}
.bbt-p-bar:hover .bbt-p-tip, .bbt-player.is-scrubbing .bbt-p-tip { display: block; }
.bbt-p-row { display: flex; align-items: center; height: 48px; }
.bbt-p-row button { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: none; opacity: .9; }
.bbt-p-row button:hover { opacity: 1; }
.bbt-p-vol { display: flex; align-items: center; }
.bbt-p-vol input {
    width: 0; opacity: 0; margin: 0; transition: width .2s, opacity .2s, margin .2s; accent-color: #fff; cursor: pointer; height: 4px;
}
.bbt-p-vol:hover input, .bbt-p-vol:focus-within input { width: 64px; opacity: 1; margin: 0 8px 0 0; }
.bbt-p-time { font-size: 13px; line-height: 48px; padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bbt-p-time span { opacity: .75; }
.bbt-p-space { flex: 1; }
.bbt-p-q-badge { position: relative; }
.bbt-p-q-badge[data-hd]::after {
    content: attr(data-hd); position: absolute; right: 6px; top: 10px; padding: 0 2px; border-radius: 2px;
    background: var(--bbt-accent); font-size: 8px; font-weight: 700; line-height: 10px;
}
.bbt-player .bbt-p-gear .bbt-i { transition: transform .2s; }
.bbt-player.is-menu .bbt-p-gear .bbt-i { transform: rotate(30deg); }

.bbt-p-menu {
    position: absolute; right: 12px; bottom: 60px; z-index: 5; min-width: 240px; max-height: calc(100% - 72px); overflow-y: auto;
    padding: 8px 0; border-radius: 12px; background: rgba(28, 28, 28, .92); font-size: 14px;
}
.bbt-p-menu[hidden] { display: none; }
.bbt-p-menu button { display: flex; align-items: center; width: 100%; height: 40px; padding: 0 16px; gap: 12px; text-align: left; }
.bbt-p-menu button:hover, .bbt-p-menu button:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.bbt-p-menu .bbt-p-mv { margin-left: auto; opacity: .8; }
.bbt-p-menu .bbt-p-mhead { font-weight: 500; border-bottom: 1px solid rgba(255, 255, 255, .2); margin-bottom: 8px; height: 48px; }
.bbt-p-menu .bbt-p-mhead .bbt-i { width: 20px; height: 20px; }
.bbt-p-menu [aria-checked] { padding-left: 48px; position: relative; }
.bbt-p-menu [aria-checked="true"]::before {
    content: ""; position: absolute; left: 20px; top: 13px; width: 10px; height: 6px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}

.bbt-p-flash {
    position: absolute; left: 50%; top: 14%; transform: translateX(-50%); padding: 8px 14px; border-radius: 6px;
    background: rgba(0, 0, 0, .6); font-size: 15px; font-weight: 500; pointer-events: none; opacity: 0; transition: opacity .3s;
}
.bbt-p-flash.is-on { opacity: 1; transition: none; }

.bbt-p-end {
    position: absolute; inset: 0; z-index: 4; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    padding: 16px; background: rgba(0, 0, 0, .78); text-align: center;
}
.bbt-player.is-ended .bbt-p-end { display: flex; }
.bbt-p-end-cta { background: var(--bbt-accent) !important; color: #fff; height: 40px; padding: 0 20px !important; border-radius: 20px; font-weight: 500; display: inline-flex; align-items: center; }
.bbt-p-end-cta:hover { filter: brightness(1.1); }
.bbt-p-end-grid { display: flex; gap: 12px; justify-content: center; width: 100%; max-width: 640px; }
.bbt-p-end-item { flex: 1 1 0; min-width: 0; max-width: 300px; text-align: left; color: #fff; }
.bbt-p-end-item .bbt-p-end-img { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #222; }
.bbt-p-end-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bbt-p-end-item b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 13px; line-height: 18px; margin-top: 6px; font-weight: 500; }
.bbt-p-end-item:hover b { text-decoration: underline; }
.bbt-p-end-next { font-size: 14px; }
.bbt-p-end-next .bbt-p-end-label { opacity: .8; margin-bottom: 8px; }
.bbt-p-end-next .bbt-p-end-item { margin: 0 auto 12px; width: 280px; max-width: 70vw; }
.bbt-p-end-btns { display: flex; gap: 8px; justify-content: center; }
.bbt-p-end-btns button, .bbt-p-replay { height: 36px; padding: 0 16px !important; border-radius: 18px; background: rgba(255, 255, 255, .15) !important; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.bbt-p-end-btns button:hover, .bbt-p-replay:hover { background: rgba(255, 255, 255, .25) !important; }
.bbt-p-end .bbt-i { width: 20px; height: 20px; }
@media (max-width: 560px) {
    .bbt-p-end { gap: 10px; }
    .bbt-p-end-grid { display: none; }
    .bbt-p-end-next .bbt-p-end-item { width: 180px; }
    .bbt-p-row button { width: 40px; }
    .bbt-p-vol input { display: none; }
    .bbt-p-big { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
}

/* Theater mode: the player moves above the columns, full width. */
.bbt-watch.is-theater .bbt-theater-slot { display: block; background: #000; }
.bbt-watch.is-theater .bbt-theater-slot .bbt-player {
    border-radius: 0; aspect-ratio: auto; height: min(56.25vw, calc(100vh - var(--bbt-header-h) - var(--bbt-top) - 113px)); min-height: 480px;
}
.bbt-p-theater { display: none !important; }
@media (min-width: 1001px) { .bbt-p-theater { display: inline-flex !important; } }

/* Fullscreen. */
.bbt-player:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100%; height: 100%; }
.bbt-player:-webkit-full-screen { border-radius: 0; width: 100%; height: 100%; }
.bbt-player:fullscreen .bbt-p-row { height: 56px; }

/* Miniplayer buttons: the chevron (touch, top left) and the control-bar button (mouse). */
.bbt-p-down {
    position: absolute; left: 4px; top: 4px; z-index: 3; width: 48px; height: 48px; display: none;
    align-items: center; justify-content: center; transition: opacity .25s;
}
.bbt-p-down .bbt-i { width: 32px; height: 32px; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.bbt-player.is-touch .bbt-p-down { display: flex; }
.bbt-player.is-idle .bbt-p-down, .bbt-player.is-ended .bbt-p-down, .bbt-player.is-menu .bbt-p-down { opacity: 0; pointer-events: none; }
.bbt-player.is-touch .bbt-p-minib, .bbt-player:fullscreen .bbt-p-minib, .bbt-player:fullscreen .bbt-p-down { display: none !important; }
.bbt-player:-webkit-full-screen .bbt-p-minib, .bbt-player:-webkit-full-screen .bbt-p-down { display: none !important; }
.bbt-player.is-dragging { z-index: 60; box-shadow: 0 8px 32px rgba(0, 0, 0, .4); }
/* Touch: a finger moving down on the video is the miniplayer swipe, not a page scroll (moving up still scrolls). */
.bbt-player.is-touch { touch-action: pan-x pan-down; }
.bbt-swiping, .bbt-swiping body { overscroll-behavior-y: contain; }

/* The miniplayer: the same player, moved into a box in the bottom right corner over a channel page. */
.bbt-mini {
    position: fixed; z-index: 900; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 400px; max-width: calc(100vw - 24px); overflow: hidden; border-radius: 12px;
    background: var(--bbt-bg-elev); color: var(--bbt-text); box-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}
.bbt-mini-vid { position: relative; aspect-ratio: 16 / 9; background: #000; }
.bbt-mini .bbt-player { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; cursor: pointer; }
.bbt-mini .bbt-p-ctrl, .bbt-mini .bbt-p-big, .bbt-mini .bbt-p-menu, .bbt-mini .bbt-p-end, .bbt-mini .bbt-p-flash, .bbt-mini .bbt-p-down { display: none !important; }
.bbt-mini .bbt-p-spin { width: 32px; height: 32px; margin: -16px 0 0 -16px; border-width: 3px; }
.bbt-mini-hit { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.bbt-mini-hit:focus-visible { outline-offset: -3px; }
.bbt-mini-btn {
    position: absolute; top: 6px; z-index: 2; display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff;
    opacity: 0; transition: opacity .2s, background .15s;
}
.bbt-mini-btn:hover { background: rgba(0, 0, 0, .7); }
.bbt-mini-play { left: 6px; }
.bbt-mini-close { right: 6px; }
.bbt-mini-vid:hover .bbt-mini-btn, .bbt-mini-vid:focus-within .bbt-mini-btn, .bbt-mini.is-paused .bbt-mini-btn, .bbt-mini.is-touch .bbt-mini-btn { opacity: 1; }
.bbt-mini-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; background: rgba(255, 255, 255, .25); pointer-events: none; }
.bbt-mini-bar i { display: block; width: 0; height: 100%; background: var(--bbt-accent); }
.bbt-mini-info { display: flex; align-items: center; gap: 8px; padding: 8px 4px 8px 12px; }
.bbt-mini-title {
    flex: 1; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    font-size: 14px; font-weight: 500; line-height: 20px;
}
.bbt-mini.is-touch .bbt-mini-info { display: none; }
/* --bbt-mini-h: the miniplayer's height, set by the script. */
.bbt-has-mini .bbt-footer { padding-bottom: calc(36px + var(--bbt-mini-h, 300px)); }
.bbt-browse:focus { outline: none; }
.bbt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 656px) {
    .bbt-mini { width: 45vw; min-width: 180px; border-radius: 8px; }
    .bbt-mini-btn { top: 2px; width: 36px; height: 36px; }
    .bbt-mini-play { left: 2px; }
    .bbt-mini-close { right: 2px; }
    .bbt-mini-btn .bbt-i { width: 20px; height: 20px; }
}
/* A channel page loading behind the miniplayer: a bar under the header. */
.bbt-browse.is-loading::before {
    content: ""; position: fixed; left: 0; top: var(--bbt-top); z-index: 1001; width: 30%; height: 3px;
    background: var(--bbt-accent); animation: bbt-load 1s ease-in-out infinite;
}
@keyframes bbt-load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ---------- Comments ---------- */

.bbt-comments { margin-top: 24px; }
.bbt-comments-head { display: flex; align-items: center; gap: 32px; margin-bottom: 24px; }
.bbt-comments-head h2 { font-size: 20px; line-height: 28px; }
.bbt-sort { display: flex; align-items: center; gap: 4px; }
.bbt-sort button { border: 0; background: none; padding: 4px 10px; border-radius: 16px; font-weight: 500; color: var(--bbt-text-2); }
.bbt-sort button:hover { background: var(--bbt-surface); }
.bbt-sort button.is-active { color: var(--bbt-text); background: var(--bbt-surface); }
.bbt-c-av { flex: none; width: 40px; }
.bbt-c-av img, .bbt-c-letter { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.bbt-c-letter { color: #fff; font-size: 18px; font-weight: 500; background: #888; }
.bbt-c-letter-you { background: var(--bbt-surface-2); color: var(--bbt-text); }
.bbt-cform { display: flex; gap: 16px; margin-bottom: 32px; }
.bbt-cform-body { flex: 1; min-width: 0; }
.bbt-cform textarea {
    display: block; width: 100%; min-height: 26px; max-height: 300px; padding: 2px 0 4px; margin: 0; resize: none; overflow-y: auto;
    border: 0; border-bottom: 1px solid var(--bbt-border); background: transparent; outline: none; font-size: 14px; line-height: 20px;
}
.bbt-cform textarea:focus { border-bottom: 2px solid var(--bbt-text); padding-bottom: 3px; }
.bbt-cform-guest { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.bbt-cform-guest input, .bbt-dialog input[type="text"], .bbt-dialog input[type="email"] {
    min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--bbt-input-border); border-radius: 8px;
    background: var(--bbt-bg); font-size: 14px; outline: none;
}
.bbt-cform-guest input { flex: 1 1 200px; } /* Not in the dialog: its labels are flex columns, where a basis is a height. */
.bbt-cform-guest input:focus, .bbt-dialog input:focus { border-color: var(--bbt-link); }
.bbt-turnstile { margin-top: 12px; min-height: 0; }
.bbt-turnstile:empty { display: none; }
.bbt-cform-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.bbt-form-msg { margin: 8px 0 0; font-size: 13px; color: var(--bbt-text-2); }
.bbt-form-msg.is-error { color: #cc0000; }
:root[data-theme="dark"] .bbt-form-msg.is-error { color: #ff6b6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bbt-form-msg.is-error { color: #ff6b6b; } }

.bbt-thread { margin-bottom: 16px; }
.bbt-c { display: flex; gap: 16px; padding: 4px; margin: -4px -4px 0; border-radius: 8px; transition: background .6s; }
.bbt-c.is-highlight, .bbt-c:target { background: var(--bbt-highlight); }
.bbt-c.is-pending { opacity: .75; }
.bbt-c-body { flex: 1; min-width: 0; }
.bbt-c-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 2px; font-size: 13px; line-height: 18px; }
.bbt-c-author { font-weight: 500; }
.bbt-c.is-creator .bbt-c-author { padding: 0 6px; border-radius: 9px; background: var(--bbt-surface-2); }
.bbt-badge { display: inline-flex; align-items: center; color: var(--bbt-text-2); }
.bbt-badge .bbt-i { width: 14px; height: 14px; }
.bbt-badge-member { padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 500; line-height: 16px; background: rgba(232, 0, 61, .12); color: var(--bbt-accent); }
.bbt-c-time { color: var(--bbt-text-2); font-size: 12px; margin-left: 2px; }
.bbt-c-time:hover { color: var(--bbt-text); }
.bbt-c-text { font-size: 14px; line-height: 20px; white-space: normal; overflow-wrap: anywhere; }
.bbt-c-pending { margin: 4px 0 0; font-size: 12px; color: var(--bbt-text-2); font-style: italic; }
.bbt-c-actions { margin: 4px 0 0 -8px; }
.bbt-c-reply { height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: none; font-size: 12px; font-weight: 500; }
.bbt-c-reply:hover { background: var(--bbt-surface-2); }
.bbt-replies-toggle {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; margin: 2px 0 0 48px; padding: 0 16px 0 8px; border: 0; border-radius: 18px;
    background: none; color: var(--bbt-link); font-weight: 500;
}
.bbt-replies-toggle:hover { background: var(--bbt-link-bg); }
.bbt-replies-toggle .bbt-i { transition: transform .15s; }
.bbt-replies-toggle[aria-expanded="true"] .bbt-i { transform: rotate(180deg); }
.bbt-replies { margin: 8px 0 0 56px; }
.bbt-replies .bbt-c { margin-bottom: 12px; gap: 12px; }
.bbt-replies .bbt-c-av { width: 24px; }
.bbt-replies .bbt-c-av img, .bbt-replies .bbt-c-letter { width: 24px; height: 24px; font-size: 12px; }
.bbt-replies .bbt-cform, .bbt-thread > .bbt-cform { margin: 8px 0 16px 56px; gap: 12px; }
.bbt-replies .bbt-cform .bbt-c-av, .bbt-thread > .bbt-cform .bbt-c-av { width: 24px; }
.bbt-replies .bbt-cform .bbt-c-av img, .bbt-replies .bbt-cform .bbt-c-letter, .bbt-thread > .bbt-cform .bbt-c-av img, .bbt-thread > .bbt-cform .bbt-c-letter { width: 24px; height: 24px; font-size: 12px; }
.bbt-replies .bbt-cform { margin-left: 0; }
.bbt-cmore { display: flex; margin: 8px auto 0; }
.bbt-cmore[hidden] { display: none; }
@media (max-width: 656px) {
    .bbt-comments-head { gap: 16px; }
    .bbt-c, .bbt-cform { gap: 12px; }
    .bbt-replies { margin-left: 40px; }
    .bbt-replies-toggle { margin-left: 36px; }
    .bbt-thread > .bbt-cform { margin-left: 40px; }
}

/* ---------- Dialog, toast, footer ---------- */

.bbt-dialog {
    width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 12px;
    background: var(--bbt-bg-elev); color: var(--bbt-text); box-shadow: var(--bbt-shadow);
}
.bbt-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.bbt-dialog h2 { font-size: 20px; line-height: 28px; margin: 0 32px 8px 0; }
.bbt-dialog p { color: var(--bbt-text-2); margin: 0 0 16px; }
.bbt-dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.bbt-dialog label input { width: 100%; }
.bbt-dialog .bbt-form-msg { margin: 0 0 12px; color: var(--bbt-text); }
.bbt-dialog .bbt-form-msg.is-error { color: #cc0000; }
.bbt-dialog-close { position: absolute; right: 12px; top: 12px; }
.bbt-dialog-btns { display: flex; justify-content: flex-end; gap: 8px; }
.bbt-toast {
    position: fixed; left: 16px; bottom: 16px; z-index: 2000; max-width: calc(100vw - 32px);
    padding: 12px 16px; border-radius: 8px; background: #0f0f0f; color: #fff; font-size: 14px;
    box-shadow: var(--bbt-shadow); transform: translateY(150%); transition: transform .2s;
}
:root[data-theme="dark"] .bbt-toast { background: #f1f1f1; color: #0f0f0f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bbt-toast { background: #f1f1f1; color: #0f0f0f; } }
.bbt-toast.is-on { transform: none; }
.bbt-footer { padding: 32px var(--bbt-pad) 24px; border-top: 1px solid var(--bbt-border); text-align: center; color: var(--bbt-text-2); font-size: 13px; }
.bbt-footer p { margin: 0 0 8px; }
.bbt-footer a { margin: 0 8px; display: inline-block; }
.bbt-footer a:hover { color: var(--bbt-text); }

@media (prefers-reduced-motion: reduce) {
    .bbt-body *, .bbt-body *::before, .bbt-body *::after { transition: none !important; animation-duration: .01ms !important; }
    .bbt-hdr-streak { display: none; }
    .bbt-browse.is-loading::before { animation: none; width: 100%; opacity: .6; }
}
