/* Fade the page in once Material Web is ready, so components never flash unstyled */
body { opacity: 0; transition: opacity .28s ease; }
body.ready { opacity: 1; }
:not(:defined) { visibility: hidden; }

:root {
    color-scheme: dark;
    --md-ref-typeface-brand: "Roboto", "Helvetica Neue", sans-serif;
    --md-ref-typeface-plain: "Roboto", "Helvetica Neue", sans-serif;

    --md-sys-color-primary: #FF5500;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #4A1D00;
    --md-sys-color-on-primary-container: #FFB68C;
    --md-sys-color-secondary: #E0B7A3;
    --md-sys-color-on-secondary: #1F0E05;
    --md-sys-color-secondary-container: #2B1A10;
    --md-sys-color-on-secondary-container: #F2D6C6;
    --md-sys-color-tertiary: #FFC400;
    --md-sys-color-on-tertiary: #000000;

    --md-sys-color-surface: #0B0B0B;
    --md-sys-color-surface-dim: #0B0B0B;
    --md-sys-color-surface-bright: #2A2A2A;
    --md-sys-color-surface-container-lowest: #060606;
    --md-sys-color-surface-container-low: #111111;
    --md-sys-color-surface-container: #161616;
    --md-sys-color-surface-container-high: #1D1D1D;
    --md-sys-color-surface-container-highest: #262626;

    --md-sys-color-on-surface: #F2F2F2;
    --md-sys-color-on-surface-variant: #B8B8B8;
    --md-sys-color-inverse-surface: #F2F2F2;
    --md-sys-color-inverse-on-surface: #111111;
    --md-sys-color-inverse-primary: #B03A00;
    --md-sys-color-outline: #4A4A4A;
    --md-sys-color-outline-variant: #262626;
    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-scrim: #000000;
    --md-sys-color-shadow: #000000;

    --md-filled-button-container-shape: 10px;
    --md-outlined-button-container-shape: 10px;
    --md-text-button-container-shape: 10px;
    --md-filled-tonal-button-container-shape: 10px;
    --md-filled-text-field-container-shape: 10px;
    --md-dialog-container-shape: 16px;
    --md-menu-container-shape: 12px;
    --md-menu-container-color: #1D1D1D;
}
md-menu { --md-menu-container-elevation: 3; --md-menu-item-container-height: 44px; }
md-menu-item { --md-menu-item-label-text-color: var(--md-sys-color-on-surface); --md-menu-item-one-line-container-height: 44px; }
md-menu-item div[slot=headline] { white-space: nowrap; font-size: 14px; }
md-menu { min-width: 190px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
@media (prefers-reduced-motion: no-preference) {
    a, .asset-card, .btn, md-icon-button, .picker-item, .chip, .crumbs a { transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
body {
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-ref-typeface-plain);
    font-size: 15px; min-height: 100vh;
}
a { color: var(--md-sys-color-primary); text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px 96px; }
.wrap.narrow { max-width: 520px; }
.wrap.admin { max-width: 900px; }

header.site {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 18px 0 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
}
.brand-left, .brand-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-left img.gloria { height: 32px; display: block; }
img.gso-wordmark { height: 30px; display: block; }
img.gso-wordmark.small { height: 22px; }
img.gso-wings { height: 22px; display: block; opacity: .95; }
img.innocean-logo { height: 18px; display: block; opacity: .92; }
.brand-divider { width: 1px; height: 26px; background: var(--md-sys-color-outline-variant); flex: none; }

h1.pagetitle {
    font-family: "Barlow Condensed", sans-serif; font-weight: 700;
    font-size: 44px; line-height: 1.02; text-transform: uppercase; margin: 6px 0 4px;
    animation: fadeIn .4s ease both;
}
h1.pagetitle .accent { color: var(--md-sys-color-primary); }
.sub { color: var(--md-sys-color-on-surface-variant); margin: 0 0 20px; font-size: 14px; max-width: 70ch; }

/* toolbar */
.toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; margin-bottom: 8px;
}
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar md-outlined-text-field.search {
    --md-outlined-text-field-container-shape: 999px;
    --md-outlined-text-field-top-space: 8px;
    --md-outlined-text-field-bottom-space: 8px;
    width: 260px;
    max-width: 60vw;
    overflow: hidden;
    contain: layout;
}
.toolbar-right { flex: none; }
.chipbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 20px; flex-wrap: wrap; }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-family: "Roboto Mono", monospace; font-size: 12px;
    color: var(--md-sys-color-on-surface-variant); min-height: 40px; }
.crumbs a { color: var(--md-sys-color-on-surface-variant); padding: 4px 2px; }
.crumbs a:hover { color: var(--md-sys-color-primary); }
.crumbs .sep { opacity: .45; }
.crumbs .here { color: var(--md-sys-color-on-surface); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.asset-card {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 14px; overflow: visible;
    display: flex; flex-direction: column;
    transition: border-color .15s ease, background .15s ease;
    position: relative;
}
.asset-card { animation: cardIn .32s ease both; }
.asset-card:hover { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-surface-container); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.thumbbox img { transition: transform .35s ease; }
.asset-card:hover .thumbbox img { transform: scale(1.04); }
.play-scrim .pbtn { transition: transform .18s ease, background-color .18s ease; }
.asset-card:hover .play-scrim .pbtn { transform: scale(1.08); }
.thumbbox {
    aspect-ratio: 16 / 9; border-radius: 13px 13px 0 0;
    background: var(--md-sys-color-surface-container-high);
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.thumbbox.clickable { cursor: pointer; }
.thumbbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbbox .kind {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: var(--md-sys-color-primary);
    font-family: "Barlow Condensed", sans-serif; font-weight: 600; font-size: 15px;
    letter-spacing: 2px; text-transform: uppercase;
}
.thumbbox .kind svg { width: 42px; height: 42px; fill: currentColor; }
.play-scrim { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.28); }
.play-scrim .pbtn {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
    display: flex; align-items: center; justify-content: center;
}
.play-scrim .pbtn svg { width: 28px; height: 28px; fill: currentColor; }
.duration-badge {
    position: absolute; right: 8px; bottom: 8px;
    background: rgba(0,0,0,.72); color: #fff;
    font-family: "Roboto Mono", monospace; font-size: 11px;
    border-radius: 6px; padding: 3px 7px;
}
.stack-badge {
    position: absolute; left: 8px; bottom: 8px;
    display: flex; align-items: center; gap: 3px;
    background: rgba(255,85,0,.9); color: #000;
    font-family: "Roboto Mono", monospace; font-size: 11px; font-weight: 600;
    border-radius: 6px; padding: 3px 7px;
}
.stack-badge svg { width: 14px; height: 14px; fill: currentColor; }
.cardbody { padding: 10px 4px 6px 16px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.fline { display: flex; align-items: flex-start; justify-content: space-between; gap: 2px; }
.fname { font-weight: 500; font-size: 14px; line-height: 1.35; word-break: break-word; padding-top: 6px; }
.fmeta { font-family: "Roboto Mono", monospace; font-size: 11px; color: var(--md-sys-color-on-surface-variant); padding-bottom: 4px; }
.card-actions { display: flex; align-items: center; gap: 8px; padding: 4px 12px 12px; margin-top: auto; }
.card-actions md-filled-tonal-button { --md-filled-tonal-button-container-height: 38px; }
.card-actions md-text-button { --md-text-button-container-height: 38px; }
.fline md-icon-button { --md-icon-button-icon-color: var(--md-sys-color-on-surface-variant); flex: none; }

.sv { display: inline-flex; }
.sv svg { width: 22px; height: 22px; fill: currentColor; }
.sv.s18 svg { width: 18px; height: 18px; }

.empty { color: var(--md-sys-color-on-surface-variant); padding: 56px 0; text-align: center; }
.errbox {
    border: 1px solid var(--md-sys-color-primary); border-radius: 14px; padding: 18px 20px;
    color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container-low);
}
.errbox b { color: var(--md-sys-color-primary); }

/* gate */
.gate-card {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 18px; padding: 32px 28px;
    display: flex; flex-direction: column; gap: 20px; margin-top: 7vh;
}
.gate-card .lockrow { display: flex; align-items: center; gap: 14px; color: var(--md-sys-color-primary); }
.gate-card .lockrow svg { width: 30px; height: 30px; fill: currentColor; }

/* panels / admin */
.panel {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 18px; padding: 24px; margin-bottom: 20px;
}
.panel h2 {
    font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 24px;
    text-transform: uppercase; margin: 0 0 6px;
}
.panel h2 .accent { color: var(--md-sys-color-primary); }
.panel .hint { font-size: 12.5px; color: var(--md-sys-color-on-surface-variant); margin: 0 0 18px; line-height: 1.55; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.formgrid .full { grid-column: 1 / -1; }
.formgrid md-filled-text-field { width: 100%; }
.rowline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rowline.between { justify-content: space-between; }
.chan-panel { border: 1px solid var(--md-sys-color-outline-variant); border-radius: 14px; padding: 18px; margin-bottom: 14px; background: var(--md-sys-color-surface-container-lowest); }
.chan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.chan-head .cname { font-family: "Barlow Condensed", sans-serif; font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: .5px; }
.switchline { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--md-sys-color-on-surface-variant); }
.linkrow {
    display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap;
    font-family: "Roboto Mono", monospace; font-size: 12px;
    color: var(--md-sys-color-on-surface-variant); word-break: break-all;
}
.statusline { display: flex; align-items: center; gap: 8px; font-family: "Roboto Mono", monospace; font-size: 12px; margin-top: 6px; }
.statusline.ok { color: #7CE0A0; }
.statusline.bad { color: var(--md-sys-color-error); }
.statusline svg { width: 16px; height: 16px; fill: currentColor; }
.flash { font-family: "Roboto Mono", monospace; font-size: 12px; margin: 0 0 16px; }
.flash.ok { color: #7CE0A0; }
.flash.bad { color: var(--md-sys-color-error); }
.save-row { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }

table.logs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.logs th { text-align: left; font-family: "Roboto Mono", monospace; font-size: 11px; letter-spacing: 1px;
    text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); padding: 8px 10px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant); }
table.logs td { padding: 8px 10px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
table.logs td.mono { font-family: "Roboto Mono", monospace; font-size: 11.5px; color: var(--md-sys-color-on-surface-variant); }

/* preview dialog */
md-dialog.preview { --md-dialog-container-color: var(--md-sys-color-surface-container-lowest); max-width: min(1180px, 95vw); width: min(1180px, 95vw); }
.preview-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.preview-left { min-width: 0; }
.preview-stage { background: #000; border-radius: 10px; overflow: hidden;
    height: min(56vh, 460px);
    display: flex; align-items: center; justify-content: center; color: var(--md-sys-color-on-surface-variant); }
.preview-stage video, .preview-stage img { max-width: 100%; max-height: 100%; }
.preview-stage video { width: 100%; height: 100%; object-fit: contain; }
.preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap;
    font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
@media (max-width: 820px) {
    .preview-body { grid-template-columns: 1fr; gap: 14px; }
    .preview-stage { height: min(44vh, 380px); }
}
.preview-nav { display: flex; gap: 4px; }
.comments { display: flex; flex-direction: column; min-width: 0; }
.comments-list { flex: 1; }
@media (max-width: 820px) { .comments { border-top: 1px solid var(--md-sys-color-outline-variant); padding-top: 14px; } }
.comments-head { font-family: "Barlow Condensed", sans-serif; font-weight: 700; text-transform: uppercase; font-size: 16px; letter-spacing: .5px; margin-bottom: 12px; }
.comments-head span { color: var(--md-sys-color-on-surface-variant); font-family: "Roboto Mono", monospace; font-size: 12px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; max-height: 40vh; overflow: auto; margin-bottom: 14px; }
.comment { background: var(--md-sys-color-surface-container); border: 1px solid var(--md-sys-color-outline-variant); border-radius: 10px; padding: 10px 12px; animation: fadeIn .25s ease both; }
.comment .cmeta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.comment .cauthor { font-weight: 600; font-size: 13px; }
.comment .cwhen { font-family: "Roboto Mono", monospace; font-size: 11px; color: var(--md-sys-color-on-surface-variant); }
.comment .ctext { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.comment .cts { display: inline-block; margin-right: 6px; color: var(--md-sys-color-primary); font-family: "Roboto Mono", monospace; font-size: 11px; }
.comments-empty { color: var(--md-sys-color-on-surface-variant); font-size: 13px; padding: 6px 0 12px; }
.comments-form { display: flex; flex-direction: column; gap: 10px; }
.comment-nameid { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--md-sys-color-on-surface-variant); }
.comment-nameid b { color: var(--md-sys-color-on-surface); }
.comment-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface-variant); border-radius: 999px;
    padding: 6px 12px; cursor: pointer; font-size: 13px; font-family: inherit;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.tc-chip:hover { border-color: var(--md-sys-color-primary); color: var(--md-sys-color-primary); }
.tc-chip.set { border-color: var(--md-sys-color-primary); color: var(--md-sys-color-primary); background: var(--md-sys-color-primary-container); }
.tc-chip svg { width: 16px; height: 16px; fill: currentColor; }

/* picker dialog */
md-dialog.picker { --md-dialog-container-color: var(--md-sys-color-surface-container-lowest); max-width: min(640px, 94vw); width: min(640px, 94vw); }
.picker-crumbs { font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-bottom: 10px; min-height: 18px; }
.picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--md-sys-color-outline-variant); cursor: pointer; background: var(--md-sys-color-surface-container-low); }
.picker-item:hover { border-color: var(--md-sys-color-primary); }
.picker-item .sv { color: var(--md-sys-color-primary); }
.picker-item .pl { flex: 1; font-size: 14px; }
.picker-item .pt { font-family: "Roboto Mono", monospace; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); }

/* top loading bar */
#loadbar {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--md-sys-color-primary), #FF8A3D);
    z-index: 120; opacity: 0; transition: width .2s ease, opacity .3s ease;
    box-shadow: 0 0 8px rgba(255,85,0,.6);
}
#loadbar.active { opacity: 1; }
/* spinner */
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--md-sys-color-outline-variant);
    border-top-color: var(--md-sys-color-primary);
    animation: spin .8s linear infinite;
}
.spinner.small { width: 20px; height: 20px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 0; color: var(--md-sys-color-on-surface-variant); font-family: "Roboto Mono", monospace; font-size: 12px; }
/* image lazy shimmer */
.thumbbox.loading-thumb::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.05) 40%, transparent 60%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.thumbbox img { opacity: 0; transition: opacity .35s ease; }
.thumbbox img.loaded { opacity: 1; }

/* toast */
#toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
    background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
    border-radius: 10px; padding: 10px 18px; font-size: 13.5px;
    opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 90;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.site { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--md-sys-color-outline-variant);
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.site .fnote { font-family: "Roboto Mono", monospace; font-size: 11px; color: #555; letter-spacing: 1px; }
.footer-logos { display: flex; align-items: center; gap: 16px; }
.footer-logos .powered { display: flex; align-items: center; gap: 8px; color: #666; font-family: "Roboto Mono", monospace; font-size: 11px; letter-spacing: .5px; }
.footer-logos .powered:hover { color: var(--md-sys-color-on-surface-variant); }
.footer-logos .powered img.frameio-logo { height: 30px; display: block; opacity: .82; transition: opacity .16s ease; margin-top: -1px; }
.footer-logos .powered:hover img.frameio-logo { opacity: 1; }
.footer-sep { width: 1px; height: 20px; background: var(--md-sys-color-outline-variant); }

@media (max-width: 680px) {
    h1.pagetitle { font-size: 33px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .brand-right { display: none; }
    .formgrid { grid-template-columns: 1fr; }
    .toolbar-right { width: 100%; }
    .toolbar md-outlined-text-field.search { width: 100%; max-width: none; flex: 1; }
    .card-actions md-filled-tonal-button .btxt { display: none; }
}

/* ============================ custom preview overlay ============================ */
body.ovl-lock { overflow: hidden; }
.ovl {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    padding: 32px; opacity: 0; visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
.ovl.open { opacity: 1; visibility: visible; }
.ovl-scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ovl-panel {
    position: relative; z-index: 1;
    width: min(1180px, 96vw); max-height: 92vh;
    display: flex; flex-direction: column;
    background: var(--md-sys-color-surface-container-lowest, #0f0f0f);
    border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    transform: translateY(14px) scale(.985); opacity: .6;
    transition: transform .24s cubic-bezier(.2,.8,.2,1), opacity .24s ease;
    outline: none;
}
.ovl.open .ovl-panel { transform: none; opacity: 1; }
.ovl-head {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px 12px; border-bottom: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
}
.ovl-title {
    flex: 1; min-width: 0; font-family: "Barlow Condensed", sans-serif;
    text-transform: uppercase; font-size: 22px; letter-spacing: .3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ovl-x {
    flex: none; width: 40px; height: 40px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    color: var(--md-sys-color-on-surface-variant); cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.ovl-x:hover { border-color: var(--md-sys-color-primary); color: var(--md-sys-color-primary); }
.ovl-x svg { width: 20px; height: 20px; fill: currentColor; }
.ovl-body {
    flex: 1; min-height: 0; overflow: auto;
    display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
    gap: 20px; padding: 18px;
}
.ovl-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 12px 18px; border-top: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
}
@media (max-width: 820px) {
    .ovl { padding: 0; }
    .ovl-panel { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
    .ovl-body { grid-template-columns: 1fr; gap: 14px; }
}
/* media fade-in without inline styles */
.preview-stage .media-fade { opacity: 0; transition: opacity .3s ease; }
.preview-stage .media-fade.shown { opacity: 1; }
/* attribute-based hide (CSP-safe, replaces inline display:none) */
[data-hidden] { display: none !important; }
.w-full { width: 100%; }
.asset-card.hidden, .empty.hidden { display: none !important; }

/* ==================== consistent button system ==================== */
/* Explicit horizontal padding - the bundle leaves leading/trailing-space at 0,
   which makes labels sit flush against the edges. */
md-filled-button, md-filled-tonal-button, md-outlined-button, md-text-button, md-elevated-button {
    --md-filled-button-leading-space: 22px;
    --md-filled-button-trailing-space: 22px;
    --md-filled-button-with-leading-icon-leading-space: 16px;
    --md-filled-button-with-leading-icon-trailing-space: 22px;
    --md-filled-tonal-button-leading-space: 22px;
    --md-filled-tonal-button-trailing-space: 22px;
    --md-filled-tonal-button-with-leading-icon-leading-space: 16px;
    --md-filled-tonal-button-with-leading-icon-trailing-space: 22px;
    --md-outlined-button-leading-space: 22px;
    --md-outlined-button-trailing-space: 22px;
    --md-outlined-button-with-leading-icon-leading-space: 16px;
    --md-outlined-button-with-leading-icon-trailing-space: 22px;
    --md-text-button-leading-space: 16px;
    --md-text-button-trailing-space: 16px;
    --md-text-button-with-leading-icon-leading-space: 12px;
    --md-text-button-with-leading-icon-trailing-space: 16px;
}
/* Force host padding so labels never sit flush (shadow trailing-space is unreliable). */
md-filled-button, md-filled-tonal-button, md-outlined-button, md-elevated-button {
    padding-inline: 10px;
}
md-text-button { padding-inline: 2px; }

md-filled-button {
    --md-filled-button-container-color: var(--md-sys-color-primary);
    --md-filled-button-label-text-color: #ffffff;
    --md-filled-button-label-text-weight: 600;
    --md-filled-button-container-height: 42px;
    --md-filled-button-icon-color: #ffffff;
    --md-filled-button-hover-label-text-color: #ffffff;
    --md-filled-button-pressed-label-text-color: #ffffff;
    --md-filled-button-focus-label-text-color: #ffffff;
}
md-filled-tonal-button {
    --md-filled-tonal-button-container-color: #1e1e1e;
    --md-filled-tonal-button-label-text-color: #f2f2f2;
    --md-filled-tonal-button-icon-color: #f2f2f2;
    --md-filled-tonal-button-label-text-weight: 600;
    --md-filled-tonal-button-container-height: 42px;
    --md-filled-tonal-button-hover-label-text-color: #ffffff;
}
md-outlined-button {
    --md-outlined-button-label-text-color: var(--md-sys-color-on-surface);
    --md-outlined-button-outline-color: var(--md-sys-color-outline);
    --md-outlined-button-container-height: 42px;
    --md-outlined-button-label-text-weight: 600;
    --md-outlined-button-hover-label-text-color: var(--md-sys-color-primary);
}
md-text-button {
    --md-text-button-label-text-color: var(--md-sys-color-primary);
    --md-text-button-label-text-weight: 600;
    --md-text-button-container-height: 42px;
}
md-icon-button { --md-icon-button-icon-color: var(--md-sys-color-on-surface-variant); }

/* ==================== CSP-safe utility classes (replace inline styles) ==================== */
.u-m0 { margin: 0 !important; }
.u-mt6 { margin-top: 6px; }
.u-mt12 { margin-top: 12px; }
.u-mt14 { margin-top: 14px; }
.u-mt16 { margin-top: 16px; }
.u-mb6 { margin-bottom: 6px; }
.u-mb10 { margin-bottom: 10px; }
.u-w-full { width: 100%; }
.u-hidden { display: none !important; }
.u-inline { display: inline; }
.u-nodecor { text-decoration: none; }
.u-col18 { display: flex; flex-direction: column; gap: 18px; }
.u-row-end { display: flex; margin-top: 12px; justify-content: flex-end; }
.u-overflow-x { overflow-x: auto; }
.u-muted { color: var(--md-sys-color-on-surface-variant); }
.u-mono11 { font-family: "Roboto Mono", monospace; font-size: 11px; color: var(--md-sys-color-on-surface-variant); }
.u-title32 { font-size: 32px; }
.u-title-bc { font-family: "Barlow Condensed", sans-serif; text-transform: uppercase; font-size: 22px; }
.u-logo32 { height: 32px; }
.u-logo34 { height: 34px; }
.header-center { border-bottom: 0; justify-content: center; gap: 18px; }
.header-center-2 { border-bottom: 0; justify-content: center; }
.status-inline { margin: 0; }
.picker-search { width: 100%; margin-bottom: 10px; --md-outlined-text-field-top-space: 6px; --md-outlined-text-field-bottom-space: 6px; }
.picker-count { margin: 8px 0 0; }
.hint-pad { padding: 8px 2px; }

/* ============================ dedicated review page ============================ */
.review-wrap { max-width: 1400px; height: 100vh; display: flex; flex-direction: column; padding-bottom: 16px; }
body.review-page { overflow: hidden; }
.review-top { flex: none; }
.review-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 8px 0 18px; }
.review-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--md-sys-color-on-surface-variant); font-size: 14px; text-decoration: none; transition: color .15s ease; }
.backlink:hover { color: var(--md-sys-color-primary); }
.backlink svg { width: 18px; height: 18px; fill: currentColor; }
.review-crumb { font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.review-crumb .sep { margin: 0 8px; opacity: .5; }
.review-crumb .cur { color: var(--md-sys-color-on-surface); }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: stretch; animation: fadeIn .35s ease both;
    flex: 1; min-height: 0; }
.review-main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.player-shell { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.player-shell video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-shell img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.player-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; transition: opacity .3s ease; }
.player-loading.gone { opacity: 0; pointer-events: none; }
.player-fallback { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--md-sys-color-on-surface-variant); padding: 48px; text-align: center; }
.player-fallback svg { width: 46px; height: 46px; fill: var(--md-sys-color-primary); }
.player-fallback .pf-name { font-size: 15px; color: var(--md-sys-color-on-surface); word-break: break-word; }
.player-fallback .pf-hint { font-size: 13px; }
.media-fade { opacity: 0; transition: opacity .4s ease; }
.media-fade.shown { opacity: 1; }
.review-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; flex: none; }
.rb-name { font-family: "Barlow Condensed", sans-serif; text-transform: uppercase; font-size: 26px; line-height: 1.1; }
.rb-meta { display: flex; align-items: center; gap: 8px; font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-top: 4px; flex-wrap: wrap; }
.rb-badge { display: inline-flex; align-items: center; gap: 3px; background: rgba(255,85,0,.9); color: #000; font-weight: 600; border-radius: 6px; padding: 2px 7px; }
.rb-badge svg { width: 13px; height: 13px; fill: currentColor; }
.rb-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }
.rb-actions { display: flex; align-items: center; gap: 14px; }
/* comments sidebar */
.review-side { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--md-sys-color-surface-container-lowest, #0f0f0f); border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a); border-radius: 14px; overflow: hidden; }
.rs-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--md-sys-color-outline-variant, #2a2a2a); font-family: "Barlow Condensed", sans-serif; text-transform: uppercase; font-size: 18px; letter-spacing: .4px; }
.rs-count { margin-left: auto; font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.rs-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rs-item { background: var(--md-sys-color-surface-container, #1a1a1a); border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a); border-radius: 10px; padding: 10px 12px; animation: cardIn .3s ease both; }
.rs-item-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.rs-who { font-weight: 600; font-size: 13px; }
.rs-when { font-family: "Roboto Mono", monospace; font-size: 10.5px; color: var(--md-sys-color-on-surface-variant); }
.rs-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.rs-tc { display: inline-block; margin-right: 7px; padding: 1px 6px; border-radius: 5px; background: rgba(255,85,0,.16); color: var(--md-sys-color-primary); font-family: "Roboto Mono", monospace; font-size: 11px; border: none; cursor: pointer; transition: background-color .15s ease; vertical-align: 1px; }
.rs-tc:hover { background: rgba(255,85,0,.32); }
.rs-empty { color: var(--md-sys-color-on-surface-variant); font-size: 13px; padding: 20px 4px; text-align: center; }
.rs-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-top: 1px solid var(--md-sys-color-outline-variant, #2a2a2a); }
.rs-nameid { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--md-sys-color-on-surface-variant); }
.rs-nameid b { color: var(--md-sys-color-on-surface); }
.rs-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 900px) {
    body.review-page { overflow: auto; }
    .review-grid { grid-template-columns: 1fr; height: auto; }
    .player-shell { aspect-ratio: 16 / 9; flex: none; }
    .review-side { height: auto; max-height: none; }
    .rs-list { max-height: 50vh; }
}

body.review-page .footer, body.review-page footer { display: none; }

/* ==================== version switcher (Frame.io style) ==================== */
.version-switch { position: relative; flex: none; }
.vs-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--md-sys-color-surface-container, #1a1a1a);
    border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    color: var(--md-sys-color-on-surface); border-radius: 999px;
    padding: 8px 14px; cursor: pointer; font-size: 13px; font-family: inherit;
    transition: border-color .15s ease, background-color .15s ease;
}
.vs-toggle:hover { border-color: var(--md-sys-color-primary); }
.vs-current { font-weight: 600; }
.vs-latest {
    font-family: "Roboto Mono", monospace; font-size: 10px; text-transform: uppercase;
    letter-spacing: .5px; background: rgba(255,85,0,.16); color: var(--md-sys-color-primary);
    border-radius: 4px; padding: 1px 5px;
}
.vs-caret { width: 18px; height: 18px; fill: var(--md-sys-color-on-surface-variant); }
.vs-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px;
    background: var(--md-sys-color-surface-container-high, #232323);
    border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
    animation: menuIn .16s ease both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.vs-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
    color: var(--md-sys-color-on-surface); text-decoration: none; font-size: 14px;
    transition: background-color .12s ease;
}
.vs-item:hover { background: var(--md-sys-color-surface-container-highest, #2b2b2b); }
.vs-item.active { background: rgba(255,85,0,.10); }
.vs-item-v { flex: 1; font-weight: 500; }
.vs-check { width: 18px; height: 18px; fill: var(--md-sys-color-primary); }
@media (max-width: 900px) {
    .version-switch { order: 3; width: 100%; }
    .vs-menu { left: 0; right: auto; }
}

/* top-right share button */
.share-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--md-sys-color-surface-container, #1a1a1a);
    border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    color: var(--md-sys-color-on-surface); border-radius: 999px;
    padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.share-btn:hover { border-color: var(--md-sys-color-primary); color: var(--md-sys-color-primary); }
.share-btn svg { width: 17px; height: 17px; fill: currentColor; }

/* ==================== comment replies ==================== */
.rs-item.done { opacity: .62; }
.rs-item-actions { margin-top: 8px; display: flex; align-items: center; gap: 14px; }
.rs-link {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--md-sys-color-primary); font-size: 12.5px; font-weight: 600; font-family: inherit;
    transition: opacity .15s ease;
}
.rs-link:hover { opacity: .8; }
.rs-thread { margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--md-sys-color-outline-variant, #2a2a2a); display: flex; flex-direction: column; gap: 8px; }
.rs-thread-load { display: flex; justify-content: center; padding: 8px 0; }
.rs-reply { background: var(--md-sys-color-surface-container-high, #232323); border-radius: 8px; padding: 8px 10px; animation: cardIn .25s ease both; }
.rs-reply .rs-text { font-size: 13px; }
.rs-reply-box { display: flex; gap: 8px; align-items: flex-end; margin-top: 4px; }
.rs-reply-input {
    flex: 1; resize: none; min-height: 36px; max-height: 120px;
    background: var(--md-sys-color-surface-container, #1a1a1a);
    border: 1px solid var(--md-sys-color-outline-variant, #2a2a2a);
    border-radius: 8px; padding: 9px 11px; color: var(--md-sys-color-on-surface);
    font-family: inherit; font-size: 13px; line-height: 1.4;
}
.rs-reply-input:focus { outline: none; border-color: var(--md-sys-color-primary); }
.rs-reply-send {
    flex: none; background: var(--md-sys-color-primary); color: #fff; border: none;
    border-radius: 8px; padding: 9px 16px; cursor: pointer; font-weight: 600; font-size: 13px; font-family: inherit;
    transition: filter .15s ease;
}
.rs-reply-send:hover { filter: brightness(1.08); }
.rs-reply-send:disabled { opacity: .5; cursor: default; }
