/* The picture keeps its ratio; controls keep their own space at every size. */
html body:is(.project-detail,body) :is(#film-viewer,#project-viewer){box-sizing:border-box;width:min(1160px,calc(100% - 48px));max-width:calc(100% - 48px);max-height:calc(100dvh - 48px);padding:0;margin:auto;border:1px solid #ffffff28;border-radius:16px;background:#0c0b10;color:#f3edf9;overflow:auto;overscroll-behavior:contain;color-scheme:dark}
html body:is(.project-detail,body) :is(#film-viewer,#project-viewer)[data-film-orientation="portrait"]{width:min(560px,calc(100% - 48px))}
html body:is(.project-detail,body) :is(#film-viewer,#project-viewer)::backdrop{background:#000e;backdrop-filter:blur(12px)}
html body .viewer-header{position:relative;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:16px 20px;background:#111015;border-bottom:1px solid #ffffff12}
html body .viewer-header>div{min-width:0}
html body .viewer-header h2,html body.project-detail #project-viewer h2{font:400 clamp(16px,1.8vw,23px)/1.3 Arial,sans-serif;margin:0;overflow-wrap:anywhere}
html body .viewer-header p{font-size:12px;line-height:1.4;margin:5px 0 0;color:#aca4b5}
html body :is(.close-film,.close-project-film){position:static;float:none;flex-shrink:0;min-width:68px;min-height:44px;padding:8px 14px;border:1px solid #ffffff30;border-radius:24px;background:#1a171f;color:inherit;cursor:pointer;font:400 13px/1.2 Arial,sans-serif}
html body :is(.viewer-stage,.project-viewer-stage){height:auto;min-height:0;max-height:none;aspect-ratio:auto;display:block;padding:0;margin:0;background:#000}
.fc-player{--film-ratio:1.77778;--fc-screen-height:min(60dvh,calc(100vw / var(--film-ratio)));width:100%;margin:0;background:#000;color:#eee;box-sizing:border-box;outline:none}
.fc-player *{box-sizing:border-box}
.fc-screen{display:flex;align-items:center;justify-content:center;width:100%;height:var(--fc-screen-height);min-height:0;background:#000;overflow:hidden}
html body :is(.viewer-stage,.project-viewer-stage) .fc-screen video{position:static;display:block;inset:auto;width:100%;height:100%;max-height:none;object-fit:contain;aspect-ratio:auto;transform:none;cursor:pointer}
html body :is(.viewer-stage,.project-viewer-stage) .fc-screen iframe{position:static;display:block;width:min(100%,calc(var(--fc-screen-height) * var(--film-ratio)));height:100%;border:0;aspect-ratio:auto}
.fc-controls{position:relative;width:100%;padding:4px 16px 10px;background:#111015;border-top:1px solid #ffffff18}
.fc-seek{--fc-progress:0%;display:block;position:static;width:100%;max-width:none;min-width:0;height:28px;margin:0;padding:0;accent-color:#c7a4ec;cursor:pointer;touch-action:pan-y;transform:none}
.fc-seek::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(to right,#ccb1ee var(--fc-progress),#39343f var(--fc-progress))}
.fc-seek::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;margin-top:-4px;background:#e8d6ff}
.fc-seek{-webkit-appearance:none;background:transparent}
.fc-seek::-moz-range-track{height:4px;border-radius:4px;background:#39343f}.fc-seek::-moz-range-progress{height:4px;background:#ccb1ee}.fc-seek::-moz-range-thumb{width:12px;height:12px;background:#e8d6ff;border:0;border-radius:50%}
.fc-actions{display:flex;align-items:center;gap:8px;width:100%;min-width:0}
.fc-actions button,.fc-speed{position:static;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;min-width:44px;height:44px;min-height:44px;border:1px solid transparent;border-radius:9px;padding:11px;background:transparent;color:inherit;font:400 13px/1 Arial,sans-serif;cursor:pointer;margin:0}
.fc-actions button svg{display:block;width:21px;height:21px;flex:none;pointer-events:none}
.fc-actions .fc-play{background:#e4d0fb;color:#18101f}
.fc-actions button:hover,.fc-speed:hover{background:#ffffff12}.fc-actions .fc-play:hover{background:#f0e4ff}
.fc-actions button:disabled,.fc-seek:disabled{opacity:.4;cursor:default}
.fc-actions button:focus-visible,.fc-controls input:focus-visible,.fc-speed:focus-visible,.fc-retry:focus-visible,.fc-original:focus-visible,html body :is(.close-film,.close-project-film):focus-visible{outline:2px solid #ddc6f8;outline-offset:2px}
.fc-time{font:12px/1.4 ui-monospace,monospace;font-variant-numeric:tabular-nums;white-space:nowrap;color:#d4cddc;flex-shrink:0}
.fc-sound{display:flex;align-items:center;gap:2px;margin-left:auto;min-width:0}
.fc-volume{width:64px;min-width:0;height:28px;margin:0 6px 0 0;accent-color:#ccb1ee;cursor:pointer}
.fc-speed{width:62px;padding:0 5px;background:#1b1821;border-color:#ffffff15;text-align:center}
.fc-feedback{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px}
.fc-status{font:400 12px/1.45 Arial,sans-serif;color:#c7bdd0;margin:6px 0 0;flex:1 1 auto}
.fc-retry,.fc-original{font:400 12px/1.3 Arial,sans-serif;color:#e4d0fb;background:transparent;border:0;padding:8px 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px;min-height:36px}
.fc-status:empty,.fc-player [hidden]{display:none!important}
html body .viewer-bottom{display:block;padding:12px 20px}.viewer-bottom p{font-size:13px;line-height:1.5;margin:0}.viewer-help:empty{display:none}.viewer-related{padding:0 20px 8px;margin:0}.viewer-related:empty{display:none}
.fc-player:fullscreen,.fc-player:-webkit-full-screen,.fc-player.fc-expanded{width:100vw;height:100dvh;max-width:none;display:flex;flex-direction:column;justify-content:center;background:#000;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.fc-player.fc-expanded{position:fixed;inset:0;z-index:9999;width:100%;height:100dvh}
.fc-player:fullscreen .fc-screen,.fc-player:-webkit-full-screen .fc-screen,.fc-player.fc-expanded .fc-screen{flex:1;min-height:0}
.fc-player:fullscreen .fc-controls,.fc-player:-webkit-full-screen .fc-controls,.fc-player.fc-expanded .fc-controls{flex-shrink:0;width:min(100%,1160px);align-self:center}
.fc-embedded .fc-fullscreen{margin-left:auto}
@media(max-width:700px){
 html body:is(.project-detail,body) :is(#film-viewer,#project-viewer),html body:is(.project-detail,body) :is(#film-viewer,#project-viewer)[data-film-orientation="portrait"]{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);border-radius:12px}
 html body .viewer-header{padding:10px 12px;gap:12px}html body .viewer-header h2,html body.project-detail #project-viewer h2{font-size:16px}
 html body .viewer-header p{font-size:11px}.fc-controls{padding:2px 8px 8px}.fc-actions{gap:4px}.fc-time{font-size:11px}.fc-volume{display:none}
 .fc-actions .fc-pip{display:none}.fc-speed{width:54px;min-width:54px}.fc-sound{gap:0}
 html body .viewer-bottom{padding:10px 12px}.viewer-related{padding-inline:12px}.viewer-bottom p{font-size:12px}
}
@media(max-width:360px){.fc-actions{gap:2px}.fc-time{font-size:10px}.fc-speed{width:48px;min-width:48px}.fc-actions button{width:44px;min-width:44px;padding:12px}}
@media(max-height:500px){
 html body:is(.project-detail,body) :is(#film-viewer,#project-viewer),html body:is(.project-detail,body) :is(#film-viewer,#project-viewer)[data-film-orientation="portrait"]{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 16px)}
 html body .viewer-header{padding:4px 12px}html body .viewer-header h2,html body.project-detail #project-viewer h2{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 html body .viewer-header p,html body .viewer-bottom,html body .viewer-related{display:none}.fc-controls{padding-block:0 4px}.fc-seek{height:22px}.fc-actions{gap:6px}
}
@media(prefers-reduced-motion:no-preference){.fc-actions button,.fc-speed{transition:background .15s ease}}

/* Fullscreen fallback must escape the dialog’s transformed containing block. */
html body:is(.project-detail,body) :is(#film-viewer,#project-viewer).fc-dialog-expanded{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;transform:none;overflow:hidden}
html body:is(.project-detail,body) :is(#film-viewer,#project-viewer).fc-dialog-expanded>:not(.viewer-stage):not(.project-viewer-stage){display:none!important}
html body .fc-dialog-expanded :is(.viewer-stage,.project-viewer-stage){height:100%;margin:0}
html body .fc-dialog-expanded .fc-expanded{width:100vw;height:100dvh}
