:root[data-theme="light"] body,
:root:not([data-theme]) body {
    color-scheme:light;
    --ground:#fff;
    --surface:#f7f7f8;
    --raised:#eeeef0;
    --ink:#151515;
    --muted:#56565c;
    --line:#d4d4d6;
    --red:#e4002b;
    --soft-red:#b40022;
}
:root[data-theme="dark"] body {
    color-scheme:dark;
    --ground:#101010;
    --surface:#1c1c1c;
    --raised:#272727;
    --ink:#f8f8f8;
    --muted:#bababa;
    --line:#474747;
    --red:#e4002b;
    --soft-red:#ff8499;
}
.theme-toggle {
    display:grid;
    place-items:center;
    flex:0 0 44px;
    height:44px;
    background:var(--ground);
    color:var(--ink);
    border:1px solid var(--line);
    border-radius:0;
}
.theme-toggle:hover {border-color:var(--soft-red)}
.theme-toggle[aria-pressed="false"] .icon:nth-child(2),
.theme-toggle[aria-pressed="true"] .icon:first-child {display:none}
#video-modal {
    position:fixed;
    inset:0;
    width:100%;
    height:100vh;
    height:100dvh;
    max-width:none;
    max-height:none;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    overflow:auto;
    scrollbar-width:none;
    overscroll-behavior:contain;
    background:var(--ground);
    color:var(--ink);
}
#video-modal[open] {display:block}
#video-modal .video-stage {
    position:relative;
    min-width:0;
}
#video-error:empty {display:none}
#video-error:not(:empty) {
    position:absolute;
    inset:auto 16px 56px;
    margin:0;
    padding:8px 12px;
    background:var(--surface);
    color:var(--ink);
    font-size:14px;
}
#video-modal .video-stage video {
    display:block;
    width:100%;
    height:auto;
    aspect-ratio:auto 9 / 16;
    object-fit:contain;
    color-scheme:dark;
}
#video-modal .modal-info {
    min-width:0;
    max-height:none;
    padding:20px max(16px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    border-top:1px solid var(--line);
    overflow-wrap:anywhere;
}
#video-modal .modal-close {
    position:fixed;
    top:max(12px,env(safe-area-inset-top));
    right:max(12px,env(safe-area-inset-right));
    display:grid;
    place-items:center;
    width:44px;
    height:44px;
    padding:0;
    border:1px solid var(--line);
    border-radius:0;
    background:var(--ground);
    color:var(--ink);
}
#video-modal .modal-close:hover {color:var(--soft-red);border-color:var(--soft-red)}
#video-modal .modal-close:focus-visible {outline-offset:-4px}
#video-modal .modal-info h2 {font:700 clamp(18px,2vw,24px)/1.2 var(--body);text-wrap:pretty}
.player-actions {display:flex;gap:6px;flex-wrap:wrap}
.player-actions .account-link,#comment-form button {min-height:44px}
#copy-video {min-width:44px;justify-content:center}
#share-status:not(:empty) {display:block;margin-top:8px;color:var(--muted)}
#video-comments {margin-top:14px;border-top:1px solid var(--line);padding-top:12px}
#video-comments h3 {font:700 16px/1.3 var(--body);margin-bottom:8px}
#comment-form {display:grid;justify-items:start;gap:7px}
#comment-body,.comment-sign-in {
    display:block;
    width:100%;
    padding:9px 10px;
    border:1px solid var(--line);
    background:var(--surface);
    color:var(--ink);
    font:inherit;
}
#comment-body {min-height:70px;resize:vertical}
#video-comments .comment-sign-in {display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:48px;color:var(--soft-red)}
#comment-status {font-size:13px;color:var(--muted);margin-top:7px}
#comment-list {list-style:none;padding:0;margin:0}
#comment-list li {white-space:pre-wrap;border-bottom:1px solid var(--line);padding:8px 0;font-size:14px}
@media(min-width:1000px), (min-width:560px) and (orientation:landscape) and (pointer:fine) {
    #video-modal[open] {
        display:grid;
        grid-template-columns:minmax(0,1fr) clamp(240px,29vw,400px);
        grid-template-rows:minmax(0,1fr);
        align-items:stretch;
        overflow:hidden;
    }
    #video-modal .video-stage {height:100%}
    #video-modal .video-stage video {height:100%}
    #video-modal .modal-info {
        padding-top:max(68px,calc(env(safe-area-inset-top) + 56px));
        border-top:0;
        border-inline-start:1px solid var(--line);
        overflow:auto;
        overscroll-behavior:contain;
    }
}
@media(max-width:700px) {
    body[data-page="home"] .header {column-gap:7px}
    body[data-page="home"] .header nav {gap:12px}
}

#comment-list strong {display:block;margin-bottom:3px;font-size:13px}
.comment-name,.comment-name input {display:block;width:100%}
.comment-name input {font:inherit;color:var(--ink);background:var(--ground);border:1px solid var(--line);padding:8px}

#video-title:has(+ #video-published-at:not([hidden])) {margin-bottom:3px}
#video-published-at {color:var(--muted);font-size:13px}

.clip-watch {
    --stage-max-h:min(80vh,780px);
    display:grid;
    grid-template-columns:minmax(0,auto) minmax(300px,1fr);
    gap:clamp(18px,3vw,36px);
    align-items:start;
    padding:20px 0 28px;
    border-bottom:1px solid var(--line);
}
.clip-watch.clip-watch-landscape {
    grid-template-columns:minmax(0,1.55fr) minmax(300px,1fr);
}
.clip-watch-stage {
    --clip-w:9;
    --clip-h:16;
    position:relative;
    width:min(100%,calc(var(--stage-max-h) * var(--clip-w) / var(--clip-h)));
    background:#080608;
    border:1px solid var(--line);
    justify-self:start;
    overflow:hidden;
}
.clip-watch-player {
    display:block;
    width:100%;
    height:auto;
    aspect-ratio:var(--clip-w) / var(--clip-h);
    max-height:var(--stage-max-h);
    background:#000;
    object-fit:contain;
    color-scheme:dark;
}
.clip-watch-error:empty {display:none}
.clip-watch-error:not(:empty) {
    margin:0;
    padding:10px 12px;
    background:var(--surface);
    color:var(--ink);
    font-size:14px;
    border-top:1px solid var(--line);
}
.clip-watch-info {
    min-width:0;
    overflow-wrap:anywhere;
}
.clip-watch-info h1 {
    font:800 clamp(22px,2.4vw,34px)/1.12 var(--display);
    letter-spacing:-.04em;
    margin:0 0 10px;
}
.clip-watch-meta {
    display:flex;
    flex-wrap:wrap;
    gap:8px 14px;
    font-size:13px;
    color:var(--muted);
    margin-bottom:16px;
}
.clip-watch-creator {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:14px 0;
    border-block:1px solid var(--line);
    margin-bottom:14px;
}
.clip-watch-creator .creator-byline {
    display:inline-flex;
    align-items:center;
    gap:10px;
}
.clip-watch-creator .creator-byline img {
    width:48px;
    height:48px;
    object-fit:cover;
}
.clip-watch-creator .creator-byline strong {display:block;font-size:15px}
.clip-watch-creator .creator-byline small {display:block;color:var(--muted);font-size:13px}
.clip-watch-creator-actions {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
}
.clip-watch-tags {margin:0 0 14px}
.watch-share-status:not(:empty) {display:block;margin-top:8px;font-size:13px;color:var(--muted)}
.clip-watch-comments {
    margin-top:18px;
    padding-top:14px;
    border-top:1px solid var(--line);
}
.clip-watch-comments h2 {font:700 17px/1.3 var(--body);margin:0 0 10px}
.watch-comment-form {display:grid;justify-items:start;gap:8px}
.watch-comment-form textarea {
    display:block;
    width:100%;
    min-height:76px;
    padding:9px 10px;
    border:1px solid var(--line);
    background:var(--surface);
    color:var(--ink);
    font:inherit;
    resize:vertical;
}
.watch-comment-form button {min-height:44px}
.watch-comment-status {font-size:13px;color:var(--muted);margin:8px 0 0}
.watch-comment-list {list-style:none;padding:0;margin:8px 0 0}
.watch-comment-list li {
    white-space:pre-wrap;
    border-bottom:1px solid var(--line);
    padding:9px 0;
    font-size:14px;
}
.watch-comment-list strong {display:block;margin-bottom:3px;font-size:13px}
@media(max-width:940px) {
    .clip-watch,
    .clip-watch.clip-watch-landscape {
        --stage-max-h:74dvh;
        grid-template-columns:1fr;
    }
    .clip-watch-stage {
        justify-self:center;
    }
}
