:root {
    color-scheme: dark;
    font-family: system-ui, sans-serif;
    background: #101010;
    color: #f5f5f5;
    --muted: #bdbdbd;
    --accent: #eaeaea;
    --line: #414141;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.site-header { padding: 1.15rem clamp(1rem, 6vw, 4rem); border-bottom: 1px solid var(--line); }
.brand { color: inherit; font-weight: 700; text-decoration: none; letter-spacing: -.025em; }
.brand span, a { color: var(--accent); }
a { text-underline-offset: .2em; }
main { padding: clamp(2.5rem, 9vh, 6rem) 1rem 2rem; }
.panel {
    max-width: 29rem;
    margin: auto;
    padding: clamp(1.25rem, 5vw, 2.25rem);
    background: #1a1a1a;
    border: 1px solid var(--line);
    border-radius: 1.1rem;
}
h1 { margin: 0 0 .65rem; font-size: clamp(1.75rem, 6vw, 2.35rem); letter-spacing: -.045em; line-height: 1.15; }
p { margin: 0 0 1.35rem; color: var(--muted); line-height: 1.55; }
form { display: grid; gap: .45rem; }
label { font-weight: 600; }
input {
    min-height: 2.75rem;
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    background: #141414;
    color: inherit;
    font: inherit;
}
form label:not(:first-child) { margin-top: .45rem; }
button, .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 2.75rem;
    padding: .6rem 1rem;
    border: 1px solid transparent;
    border-radius: .55rem;
    background: var(--accent);
    color: #151515;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .button:hover { background: #ffffff; }
form button { margin-top: .55rem; }
button.secondary { width: fit-content; background: transparent; border-color: var(--line); color: inherit; }
button.secondary:hover { background: #2c2c2c; }
:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.related { margin: 1.2rem 0 0; }
.validation { color: #ededed; font-weight: 600; line-height: 1.45; }
.validation ul { margin: .2rem 0; padding-left: 1.2rem; }
.validation.field-validation-valid, .validation.validation-summary-valid { display: none; }
.input-validation-error { border-color: #ededed; }
.volume-setting { display: grid; grid-template-columns: minmax(0, 1fr) 3rem; align-items: center; gap: .8rem; }
.volume-setting input { padding: 0; accent-color: #eee; }

.video-header {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) minmax(0, 40rem) minmax(9rem, 1fr);
    align-items: center;
    gap: .5rem;
    padding: .55rem clamp(.65rem, 2vw, 1.5rem);
    background: #141414;
}
.video-brand {
    justify-self: start;
    white-space: nowrap;
    font-size: 1.05rem;
}
.video-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .4rem;
    min-width: 0;
}
.video-search:has(button[aria-controls]) { grid-template-columns: minmax(0, 1fr) auto auto; }
.video-search input { min-width: 0; }
.video-search button { margin: 0; padding-inline: clamp(.65rem, 1.4vw, 1rem); }
.video-search [aria-expanded="true"] { background: #2c2c2c; }
.video-main { padding: 0; }
.feed-layout {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    max-width: 106rem;
    min-height: calc(100vh - 4rem);
    margin-inline: auto;
}
.video-navigation {
    display: grid;
    align-content: start;
    gap: .25rem;
    padding: .6rem .45rem;
}
.video-navigation a {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: .4rem .65rem;
    border-radius: .4rem;
    color: var(--muted);
    font-size: .875rem;
    text-decoration: none;
    white-space: nowrap;
}
.video-navigation a:hover,
.video-navigation a[aria-current] { color: #fff; background: #242424; }
.feed-content {
    min-width: 0;
    padding: .65rem clamp(.65rem, 1.6vw, 1.5rem) 2rem;
    border-inline-start: 1px solid var(--line);
}
.topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .8rem;
}
.topic-list[hidden] { display: none; }
.topic-list a {
    display: flex;
    align-items: center;
    min-height: 2.5rem;
    padding: .3rem .7rem;
    color: inherit;
    border: 1px solid var(--line);
    border-radius: .4rem;
    font-size: .875rem;
    text-decoration: none;
}
.topic-list a:hover { background: #292929; }
.topic-list a[aria-current] { background: #eee; border-color: #eee; color: #121212; }
.feed-section + .feed-section { margin-top: 1.1rem; }
.feed-section h2 {
    margin: 0 0 .45rem;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    letter-spacing: -.025em;
}
.video-row, .video-grid {
    display: grid;
    gap: .9rem;
}
.video-row {
    grid-auto-flow: column;
    grid-auto-columns: clamp(12rem, 21vw, 16rem);
    overflow-x: auto;
    padding: 3px 3px .55rem;
    margin-inline: -3px;
    scrollbar-color: #585858 transparent;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}
.video-row > article { scroll-snap-align: start; }
.video-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
    row-gap: 1.25rem;
}
.video-card { min-width: 0; }
.video-card-watch {
    display: block;
    color: inherit;
    text-decoration: none;
}
.video-cover {
    display: grid;
    position: relative;
    place-items: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: .55rem;
    background: #242424;
}
.video-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-cover img[hidden] { display: none; }
.video-cover-fallback { padding: .6rem; color: var(--muted); text-align: center; font-size: .9rem; }
.video-card h3 {
    margin: .5rem 0 .22rem;
    font-size: .925rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.video-card-watch:hover h3 { text-decoration: underline; }
.video-author {
    color: var(--muted);
    font-size: .825rem;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.video-author:hover, .video-author:focus-visible { text-decoration: underline; }
.feed-empty { padding: 1rem; border: 1px solid var(--line); border-radius: .55rem; }
.feed-empty p { margin-bottom: .6rem; }
.feed-note { margin: 0; font-size: .875rem; }
.feed-more { grid-column: 1 / -1; justify-self: start; padding-block: .4rem; }

.channel-content, .watch-content {
    margin-inline: auto;
    padding: .65rem clamp(.65rem, 2vw, 1.5rem) 2rem;
}
.channel-content { max-width: 106rem; }
.channel-heading { margin-bottom: 1rem; }
.channel-heading h1, .watch-details h1 { overflow-wrap: anywhere; }
.watch-content {
    --watch-player-gutter: .65rem;
    --watch-viewport-height: 100vh;
    --watch-player-height: calc(var(--watch-viewport-height) - var(--watch-header-height, 7rem)
        - 2 * var(--watch-player-gutter) - env(safe-area-inset-bottom, 0px));
    padding-block-start: var(--watch-player-gutter);
}
@supports (height: 100dvh) {
    .watch-content { --watch-viewport-height: 100dvh; }
}
.watch-details, .watch-publications {
    width: min(75vw, 100%);
    margin-inline: auto;
}
.watch-details { margin-top: .95rem; }
.watch-details h1 { font-size: clamp(1.4rem, 3.6vw, 2.1rem); }
.watch-meta, .watch-actions, .watch-links { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; }
.watch-meta time { color: var(--muted); font-size: .875rem; }
.watch-actions { margin-top: .85rem; }
.watch-actions button:disabled { cursor: default; background: transparent; }
.watch-links { margin-top: .8rem; }
.back-link { display: inline-block; margin-bottom: 1rem; }
.video-player {
    display: block;
    width: clamp(0px, calc(var(--watch-player-height) * 16 / 9), min(75vw, 100%));
    height: auto;
    aspect-ratio: 16 / 9;
    margin-inline: auto;
    border: 0;
    border-radius: .45rem;
    background: #000;
}

.publication-content h1 { margin: .55rem 0 1rem; }
.publication-form { max-width: 58rem; }
.publication-fields { display: grid; gap: .55rem; }
.publication-fields[hidden] { display: none; }
.publication-fields fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.publication-fields legend { padding: 0; font-weight: 600; }
.publication-fields button { justify-self: start; min-width: 7rem; }
.publication-fields button:disabled { opacity: .55; cursor: default; }
.publication-status { margin: 0; font-size: .875rem; overflow-wrap: anywhere; }
.publication-status:empty { display: none; }
.publication-fields textarea {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    background: #141414;
    color: inherit;
    font: inherit;
    resize: vertical;
}
.publication-fields textarea[aria-invalid="true"] { border-color: #ffb1a0; }
.tag-cloud, .publication-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.tag-cloud { margin-top: .45rem; }
.tag-cloud label { position: relative; margin: 0; }
.tag-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    opacity: 0;
}
.tag-option span, .publication-tags li {
    display: block;
    padding: .3rem .65rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    font-size: .875rem;
}
.tag-option span { cursor: pointer; }
.tag-option input:checked + span { background: var(--accent); color: #151515; }
.tag-option input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.tag-option input:disabled + span { opacity: .55; cursor: default; }
.watch-publications { margin-top: 1.25rem; }
.watch-publications h2 { margin: 0 0 .55rem; font-size: 1.2rem; }
.publication-entry {
    max-width: 58rem;
    padding: .85rem 0;
    border-top: 1px solid var(--line);
    scroll-margin-block-start: 1rem;
}
.publication-byline { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .85rem; }
.publication-byline h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.publication-byline time { color: var(--muted); font-size: .875rem; }
.publication-tags { margin: .55rem 0 0; padding: 0; list-style: none; }
.publication-description { margin: .55rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.youtube-description, .watch-notice { margin: .75rem 0 0; }
.youtube-description summary { cursor: pointer; }
.account-panel { max-width: 52rem; }
.account-panel h2 { margin: 1.25rem 0 .55rem; font-size: 1.15rem; }
.invite-account code { display: inline-block; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: .45rem; font-size: 1rem; }
.ticket-balances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .75rem 0; }
.ticket-balances div { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .45rem; }
.ticket-balances dt { color: var(--muted); font-size: .85rem; }
.ticket-balances dd { margin: .15rem 0 0; font-size: 1.1rem; font-weight: 700; }
.direct-invitations { margin-block: 1.2rem; border-top: 1px solid var(--line); }
.direct-invitation-create { justify-items: start; }
.direct-invitation-list { list-style: none; margin: .9rem 0 0; padding: 0; }
.direct-invitation-list li { border-top: 1px solid var(--line); padding: .75rem 0; }
.direct-invitation-detail { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .75rem; }
.direct-invitation-detail span { color: var(--muted); font-size: .875rem; }
.direct-invitation-copy { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.direct-invitation-copy input { flex: 1 1 12rem; min-width: 0; }
.direct-invitation-copy button[hidden] { display: none; }
#invitation-copy-status { margin: 0; }
.pending-approval { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.pending-approval > div { display: grid; gap: .2rem; min-width: 0; }
.pending-approval span, .pending-approval time { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.pending-approval button:disabled { opacity: .5; cursor: default; }
.approve-dialog { width: min(30rem, calc(100vw - 2rem)); padding: 1.25rem; border: 1px solid var(--line); border-radius: .75rem; background: #1a1a1a; color: inherit; }
.approve-dialog::backdrop { background: rgb(0 0 0 / 70%); }
.approve-dialog form { gap: .65rem; }
.approve-dialog h2 { margin: 0 0 .2rem; }
.approve-dialog select, .direct-invitation-create select { min-height: 2.75rem; padding: .5rem; border: 1px solid var(--line); border-radius: .45rem; background: #141414; color: inherit; font: inherit; }
.approve-dialog p { margin: 0; }
.account-preferences { margin: 1.2rem 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 44rem) {
    .video-header { grid-template-columns: minmax(0, 1fr); }
    .feed-layout { grid-template-columns: minmax(0, 1fr); }
    .feed-content { border-inline-start: 0; }
    .video-navigation { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
    .video-navigation { padding-inline: .25rem; }
    .video-navigation a { padding-inline: .4rem; }
    .video-row { grid-auto-columns: min(82%, 14rem); }
}
