
main{position:relative}

#selectionToolbar{background:#090b10!important;border:1px solid #4c5563!important;box-shadow:0 14px 45px #000c!important}
#selectionToolbar .selection-actions{border-top-color:#303845}
.file-checkbox,.entry .select-item{display:none!important}
.file-label{align-items:center;gap:12px}
.shared-indicator{align-self:center;display:grid;place-items:center;min-height:28px;min-width:28px}
.top-actions{position:relative;flex-wrap:wrap;min-height:42px}
.search-bar-slot{margin-left:auto;flex:0 0 210px;min-width:0;width:210px;max-width:210px}
#searchInputs{display:flex;margin:0;gap:6px}
#searchInputs input{flex:1;min-width:0;width:100%;max-width:none;background:#202938}
#searchInputs select{flex:0 0 85px}
#searchDialog{position:absolute;right:24px;top:56px;z-index:75;width:min(625px,calc(100% - 48px));background:#1b2533;border:1px solid #4d5d77;border-radius:12px;box-shadow:0 12px 35px #000b;padding:14px;max-height:73vh;overflow:auto}
#searchDialog[hidden]{display:none}
.catalog-controls{margin-left:auto;display:flex;gap:8px;align-items:center}
.catalog-menu{position:relative}
.catalog-menu summary{list-style:none;cursor:pointer;padding:8px 12px;background:#252c38;border:1px solid #414b5a;border-radius:8px;font-size:14px;min-height:37px;user-select:none;white-space:nowrap}
.catalog-menu summary::-webkit-details-marker{display:none}
.catalog-menu[open] summary{background:#314054}
.catalog-popup{position:absolute;right:0;top:calc(100% + 7px);z-index:50;min-width:200px;background:#1b2532;border:1px solid #54627a;box-shadow:0 12px 35px #000a;padding:8px;border-radius:12px;display:grid;gap:3px}
.catalog-popup button{justify-content:flex-start;border:0;background:transparent;min-height:36px;text-align:left}
.catalog-popup button[aria-pressed=true]{background:#394d68}
#loadMore,#morePublicFiles{display:none!important}
#loadMoreBar,#pageMore{min-height:30px;justify-content:center;text-align:center}
#viewer{width:min(1320px,calc(100vw - 64px));max-height:calc(100dvh - 64px);padding:16px 20px}
#preview{max-height:calc(100dvh - 155px);overflow:auto}
#preview img,#preview video{max-width:100%;max-height:calc(100dvh - 186px);object-fit:contain}
#viewer #download,#viewer #original{display:none}
.file-thumb,.public-thumb{background:transparent!important;overflow:visible!important}
.folder-symbol{width:32px;height:28px;position:relative;display:block}
.folder-symbol:before{content:"";position:absolute;left:3%;top:4%;width:52%;height:30%;background:#ffe5a1;border-radius:6px 8px 0 0}
.folder-symbol:after{content:"";position:absolute;inset:20% 0 0;background:linear-gradient(#fff1be,#ffe2a1);border-radius:7px}
body[data-view-mode=tiles] #items,body[data-view-mode=tiles] #entries{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:16px;border:0;overflow:visible}
body[data-view-mode=tiles] #items .list-head{display:none}
body[data-view-mode=tiles] #items .item,body[data-view-mode=tiles] #entries .entry{min-height:152px;padding:12px 8px;border:0;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;text-align:center;gap:5px;position:relative}
body[data-view-mode=tiles] #items .file-label,body[data-view-mode=tiles] #entries .filename-slot{width:100%;display:flex;flex-direction:column;align-items:center;gap:9px;flex:0 0 auto}
body[data-view-mode=tiles] #items .file-thumb,body[data-view-mode=tiles] #entries .public-thumb{width:100%;max-width:none;height:100px;flex:0 0 100px;display:grid;place-items:center}
body[data-view-mode=tiles] .folder-symbol{width:106px;height:82px}
body[data-view-mode=tiles] #items .file-name,body[data-view-mode=tiles] #entries .filename{font-size:13px;line-height:1.3;text-align:center;overflow-wrap:anywhere}
body[data-view-mode=tiles] #items .meta,body[data-view-mode=tiles] #entries .actions{display:none}
body[data-view-mode=tiles] #items .shared-indicator{position:absolute;right:5px;top:85px;background:#293545;border-radius:50%}
body[data-view-mode=tiles] #items .item.selected,body[data-view-mode=tiles] #entries .entry.chosen{background:#293443}
body[data-view-mode=tiles] #items .file-thumb img,body[data-view-mode=tiles] #entries .public-thumb img{object-fit:contain}
body[data-view-mode=gallery] #items,body[data-view-mode=gallery] #entries{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;gap:8px;border:0;padding:8px 0 12px}
body[data-view-mode=gallery] #items .list-head{display:none}
body[data-view-mode=gallery] #items .item,body[data-view-mode=gallery] #entries .entry{flex:0 0 122px;width:122px;min-height:118px;display:flex;flex-direction:column;text-align:center;border:1px solid transparent;border-radius:9px;gap:4px;padding:9px 5px}
body[data-view-mode=gallery] #items .item.selected,body[data-view-mode=gallery] #entries .entry.chosen{border-color:#83aaff}
body[data-view-mode=gallery] #items .file-label,body[data-view-mode=gallery] #entries .filename-slot{display:flex;flex-direction:column;align-items:center}
body[data-view-mode=gallery] #items .file-thumb,body[data-view-mode=gallery] #entries .public-thumb{width:80px;height:66px;flex:0 0 66px;display:grid;place-items:center}
body[data-view-mode=gallery] .folder-symbol{width:76px;height:58px}
body[data-view-mode=gallery] #items .file-name,body[data-view-mode=gallery] #entries .filename{font-size:11px;line-height:1.2;max-height:32px;overflow:hidden;text-align:center}
body[data-view-mode=gallery] #items .meta,body[data-view-mode=gallery] #items .shared-indicator,body[data-view-mode=gallery] #entries .actions{display:none}
#galleryPreview{min-height:min(52vh,510px);border:0;background:transparent;border-radius:0;padding:14px 0;margin-top:10px;display:flex;flex-direction:column;gap:14px;align-items:center}
#galleryPreview[hidden]{display:none}
#galleryPreview .gallery-media{width:100%;min-height:40vh;max-height:67vh;display:grid;place-items:center}
#galleryPreview img,#galleryPreview video{max-width:100%;max-height:65vh;object-fit:contain}
#galleryPreview pre{max-width:100%;max-height:62vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left;font:13px/1.55 ui-monospace,monospace;padding:15px;background:#1b2430;border-radius:10px}
#galleryPreview iframe{width:100%;height:62vh;border:0;background:white}
#galleryPreview .gallery-info{font-size:13px;color:#b5c4da;text-align:center}
#moveDialog{width:min(760px,95vw);min-height:360px}
#moveTrail{display:flex;gap:6px;align-items:center;flex-wrap:wrap;color:#b9c8df;margin-bottom:14px}
#moveFolders{max-height:55vh;min-height:210px;overflow:auto}
#moveFolders .move-entry{padding:10px 12px;display:flex;align-items:center;gap:13px;border-bottom:1px solid #303d4e;cursor:pointer;border-radius:7px}
#moveFolders .move-entry:hover{background:#29384c}
#moveCurrent{color:#bac8df;font-size:12px}
#selectionTools{position:fixed;left:50%;transform:translateX(-50%);top:8px;z-index:80;width:min(1050px,calc(100vw - 24px));background:#090b10;border-color:#515d70;box-shadow:0 12px 40px #000c}
#selectionTools[hidden]{display:none}
.public-file-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0 15px}
.public-file-header .catalog-controls{margin-left:auto}
#viewer{max-width:none}
@media(max-width:700px){#viewer{width:calc(100vw - 22px);padding:12px}#searchDialog{right:8px;width:calc(100% - 16px)}.catalog-controls{margin-left:auto}}


/* Consistent icon sizes and two-line filenames in thumbnail and gallery views. */
body[data-view-mode=tiles] #items .file-thumb>span:not(.folder-symbol),
body[data-view-mode=tiles] #entries .public-thumb>span:not(.folder-symbol){font-size:62px;line-height:1;display:block}
body[data-view-mode=tiles] #items .file-name,
body[data-view-mode=tiles] #entries .filename{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;max-width:100%;overflow-wrap:anywhere}
body[data-view-mode=gallery] #items .item,
body[data-view-mode=gallery] #entries .entry{height:135px;min-height:135px;align-items:center;justify-content:flex-start;overflow:hidden}
body[data-view-mode=gallery] #items .file-label,
body[data-view-mode=gallery] #entries .filename-slot{flex:0 0 auto;width:100%;min-height:0;gap:7px;align-items:center;justify-content:flex-start}
body[data-view-mode=gallery] #items .file-thumb,
body[data-view-mode=gallery] #entries .public-thumb{flex:0 0 66px;min-height:66px;align-self:center}
body[data-view-mode=gallery] #items .file-thumb>span:not(.folder-symbol),
body[data-view-mode=gallery] #entries .public-thumb>span:not(.folder-symbol){font-size:43px;line-height:1;display:block}
body[data-view-mode=gallery] #items .file-name,
body[data-view-mode=gallery] #entries .filename{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;max-height:30px;width:100%;max-width:100%;overflow-wrap:anywhere;word-break:break-word}
body[data-view-mode=gallery] #items .activity-badge{display:none}
#galleryPreview{border:1px solid rgba(145,164,192,.24);background:rgba(25,32,44,.3);border-radius:12px;padding:18px;margin-top:12px}
#galleryPreview .gallery-media .file-thumb,
#galleryPreview .gallery-media .public-thumb{display:grid;place-items:center;width:min(220px,75vw);height:160px;flex:0 0 auto}
#galleryPreview .gallery-media .folder-symbol{width:165px;height:125px}
#galleryPreview .gallery-media .file-thumb>span:not(.folder-symbol),
#galleryPreview .gallery-media .public-thumb>span:not(.folder-symbol){font-size:105px;line-height:1}
#galleryPreview .gallery-media .file-thumb img,
#galleryPreview .gallery-media .public-thumb img{max-width:100%;max-height:160px;object-fit:contain}
#tools{align-items:center}
#tools>.torrent-hint{display:inline-flex;align-items:center;min-height:37px}
#adminTorrentHint{display:inline-flex;align-items:center;min-height:37px}
/* Link buttons belong next to the URL, while expiration stays beneath it. */
.share-row .share-description{flex:1 1 440px;min-width:0}
.share-link-line{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.share-link-line>a{flex:1 1 260px;min-width:0}
.share-link-line .share-actions{flex:0 0 auto}

/* The author stylesheet's display:grid on labels must not override hidden. */
#shareSettings label[hidden]{display:none!important}

/* Search is a virtual catalog, not a popup that steals keyboard focus. */
#searchDialog{display:none!important}
#searchInputs{display:flex;align-items:center;max-width:100%}
#searchInputs input{width:100%;height:39px}
#searchResultHead{display:flex;align-items:center;gap:13px;flex-wrap:wrap;margin:5px 0 14px}
#searchResultHead[hidden]{display:none!important}
#searchResultHead strong{font-size:17px}
#searchResultHead label{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:13px;color:#aab7c8}
#searchResultHead select{padding:8px;background:#232d3b;border:1px solid #4e5e75;color:#fff;border-radius:8px}
#searchResultHead button{white-space:nowrap}
#items .search-path{display:block;color:#94a6bc;font-size:11px;line-height:1.3;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-view-mode=tiles] #items .search-path,body[data-view-mode=gallery] #items .search-path{width:100%;text-align:center}
#adminTorrentHint[hidden],#tools>.torrent-hint[hidden]{display:none!important}
.catalog-popup{max-height:min(70dvh,430px);overflow:auto}
.catalog-menu .catalog-popup{visibility:hidden;pointer-events:none}
.catalog-menu[open] .catalog-popup{visibility:visible;pointer-events:auto}
@media(max-width:700px){#searchResultHead label{margin-left:0};.search-bar-slot{flex:1 1 200px}}

/* Single set of media controls, video above progress, no nested viewer scroll. */
#viewer.kinobi-video-viewer{box-sizing:border-box;overflow:hidden;max-height:calc(100dvh - 20px);width:min(1380px,calc(100vw - 20px));padding:12px 15px}
#viewer.kinobi-video-viewer #preview{overflow:hidden;max-height:none;text-align:center}
#viewer.kinobi-video-viewer .dialoghead{margin-bottom:8px}
#viewer.kinobi-video-viewer #preview>.meta{font-size:11px;margin-top:4px}
#viewer.kinobi-video-viewer #preview>.video-pressure{display:none}
#viewer.kinobi-video-viewer>p{margin:0}
.kinobi-player{width:100%;max-width:100%;display:flex;flex-direction:column;gap:0;background:#12161e;border-radius:9px;overflow:hidden;color:#f5f7fc}
.kinobi-stage{min-height:0;position:relative;display:flex;align-items:center;justify-content:center;background:#090c12;overflow:hidden}
.kinobi-player .kinobi-stage video{display:block;width:100%;max-width:100%;height:auto;max-height:calc(100dvh - 176px);object-fit:contain;background:#090c12}
.kinobi-overlay-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:56px;height:56px;border-radius:50%!important;font-size:24px!important;display:grid!important;place-items:center;opacity:.94;background:rgba(10,13,19,.7)!important;border:1px solid #ffffff55!important;cursor:pointer}
.kinobi-overlay-play[hidden]{display:none!important}
.kinobi-controls{display:flex;align-items:center;gap:10px;min-height:49px;padding:8px 11px;background:#1d2430}
.kinobi-controls button{border:0!important;background:transparent!important;min-height:30px;min-width:30px;padding:4px!important;color:#eef2fa;font-size:18px;cursor:pointer}
.kinobi-controls button:hover{background:#354158!important}
.kinobi-clock{flex:0 0 auto;min-width:37px;font-variant-numeric:tabular-nums;font-size:12px;text-align:center;color:#c9d4e2}
.kinobi-track{height:24px;position:relative;flex:1 1 auto;min-width:40px;display:flex;align-items:center}
.kinobi-track:before{content:"";height:7px;position:absolute;left:0;right:0;border-radius:8px;background:#424c5d;pointer-events:none}
.kinobi-track-ranges{position:absolute;left:0;right:0;top:50%;height:7px;transform:translateY(-50%);pointer-events:none;overflow:hidden;border-radius:8px}
.kinobi-range{position:absolute;top:0;bottom:0;background:#81aee5}
.kinobi-load-spot{position:absolute;left:0;top:50%;height:10px;width:25%;border-radius:10px;transform:translateY(-50%);pointer-events:none;background:radial-gradient(ellipse at center,rgba(231,241,255,.88),rgba(135,186,248,.4) 45%,transparent 77%);filter:blur(2px);animation:kinobi-scan 2.4s ease-in-out infinite alternate;z-index:1}
.kinobi-load-spot[hidden]{display:none!important}
@keyframes kinobi-scan{from{left:0}to{left:75%}}
.kinobi-seek{position:relative;z-index:2;-webkit-appearance:none;appearance:none;width:100%;height:24px;cursor:pointer;background:transparent;margin:0;accent-color:#fff}
.kinobi-seek::-webkit-slider-runnable-track{height:7px;border-radius:10px;background:linear-gradient(to right,rgba(245,247,255,.96) var(--kinobi-progress,0%),transparent var(--kinobi-progress,0%))}
.kinobi-seek::-moz-range-track{height:7px;background:transparent}
.kinobi-seek::-moz-range-progress{height:7px;background:#f3f6ff}
.kinobi-seek::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid #d3e2fb;box-shadow:0 1px 6px #0009;margin-top:-5px}
.kinobi-seek::-moz-range-thumb{width:17px;height:17px;border-radius:50%;background:white;border:2px solid #d3e2fb}
.kinobi-seek:disabled{cursor:default;opacity:.65}
.kinobi-volume{flex:0 0 80px;max-width:80px;accent-color:#dbeaff;cursor:pointer}
.kinobi-player-error{font-size:12px;padding:8px 12px;color:#ffbcbc;text-align:center}
.kinobi-player-error[hidden]{display:none!important}
.kinobi-player:fullscreen{border-radius:0;width:100vw;height:100dvh;max-width:none;max-height:none;justify-content:flex-end}
.kinobi-player:fullscreen .kinobi-stage{flex:1}
.kinobi-player:fullscreen .kinobi-stage video{width:100%;height:100%;max-height:calc(100dvh - 52px)}
@media(max-width:580px){.kinobi-controls{gap:5px;padding:6px};.kinobi-volume{flex-basis:45px;max-width:45px}.kinobi-clock{min-width:31px;font-size:11px};#viewer.kinobi-video-viewer{padding:7px}}

#items .search-name-group{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1;max-width:100%}
body[data-view-mode=tiles] #items .search-name-group,
body[data-view-mode=gallery] #items .search-name-group{width:100%;align-items:center}
@media(max-width:700px){#searchResultHead label{margin-left:0}.search-bar-slot{flex:1 1 200px}}

/* Search keeps the ordinary catalog, but only actions meaningful for results. */
body[data-search-mode="true"] #uploadButton,
body[data-search-mode="true"] #uploadFolderButton,
body[data-search-mode="true"] #newFolder{display:none!important}
#searchType{appearance:none;color:#edf0f7;background:#252c38;border:1px solid #414b5a;
 border-radius:8px;min-height:37px;padding:8px 32px 8px 12px;font-size:14px;cursor:pointer;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c8d6e8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
 background-repeat:no-repeat;background-position:right 10px center}
#searchType[hidden]{display:none!important}
#searchResultHead{margin-bottom:8px}
.catalog-popup hr{display:block;box-sizing:border-box;width:100%;height:0;margin:7px 0;
 border:0;border-top:1px solid #526178;align-self:stretch}
#viewer{position:relative}
#viewer #close{display:grid;place-items:center;margin-left:auto;font-size:24px;line-height:1;
 width:38px;height:38px;min-width:38px;padding:0!important;border-radius:9px}
#viewer.kinobi-video-viewer #close{flex:0 0 auto}
#viewer.kinobi-video-viewer .dialoghead{justify-content:flex-end;min-height:38px}
#viewer:not(.kinobi-video-viewer) #close{margin-left:auto}
#viewer.kinobi-video-viewer #preview{min-height:0}
.kinobi-player .kinobi-icon{display:block;pointer-events:none;width:21px;height:21px}
.kinobi-play,.kinobi-fullscreen,.kinobi-volume-toggle{display:inline-flex!important;
 align-items:center;justify-content:center;flex:0 0 34px}
.kinobi-overlay-play{background:rgba(10,13,19,.4)!important;border:0!important;
 width:49px!important;height:49px!important;opacity:.9}
.kinobi-overlay-play .kinobi-icon{width:24px;height:24px}
/* Until HAVE_FUTURE_DATA the disabled Play button becomes a spinner, in
   exactly the same position. Progress redraws preserve the spinner node. */
.kinobi-ready-spinner{display:block;width:23px;height:23px;box-sizing:border-box;
 border:2.5px solid rgba(238,245,255,.28);border-top-color:#eef5ff;
 border-radius:50%;animation:kinobi-ready-spin .85s linear infinite;pointer-events:none}
.kinobi-play .kinobi-ready-spinner{width:19px;height:19px;border-width:2px}
.kinobi-overlay-play.is-buffering{opacity:.94!important;cursor:wait!important}
.kinobi-play.is-buffering{opacity:.9!important;cursor:wait!important}
@keyframes kinobi-ready-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.kinobi-ready-spinner{animation-duration:2s}}
#galleryPreview .kinobi-player{max-width:min(980px,100%);margin:0 auto}
#galleryPreview .kinobi-player .kinobi-stage video{max-height:min(56vh,560px)}
/* Portrait gallery videos also shrink with the actual frame aspect;
   unlike fullscreen they should not stretch to a 980px-wide backdrop. */
#galleryPreview .kinobi-player.kinobi-video-aspect-known:not(:fullscreen){
 width:min(980px,100%,max(320px,calc(min(56vh,560px) * var(--kinobi-video-ratio))));
}


/* Fullscreen video must override older #preview video {max-height:62vh}
   and gallery max-width rules. Otherwise fullscreen only enlarges black bars. */
#preview .kinobi-player:fullscreen,
#galleryPreview .kinobi-player:fullscreen {
 width:100vw!important;height:100dvh!important;
 max-width:none!important;max-height:none!important;margin:0!important;
 border-radius:0!important;
}
#preview .kinobi-player:fullscreen .kinobi-stage,
#galleryPreview .kinobi-player:fullscreen .kinobi-stage{
 width:100%;flex:1 1 auto;min-height:0;
}
#preview .kinobi-player:fullscreen .kinobi-stage video,
#galleryPreview .kinobi-player:fullscreen .kinobi-stage video{
 width:100%!important;height:100%!important;max-width:100vw!important;
 max-height:calc(100dvh - 56px)!important;object-fit:contain;
}
#viewer #close{display:flex!important;align-items:center;justify-content:center;
 padding:0!important;line-height:1!important;}
#viewer #close svg{display:block;flex:none;width:22px;height:22px}
#galleryPreview .gallery-info{display:none!important}

/* Display the chosen poster until actual playback (including preload=auto).
   Keep the play button and transient notification above the poster image. */
.kinobi-stage .kinobi-poster{
 position:absolute;inset:0;width:100%;height:100%;
 max-width:none;max-height:none;object-fit:contain;
 z-index:1;cursor:pointer;background:#090c12;
}
.kinobi-stage .kinobi-poster[hidden]{display:none!important}
.kinobi-stage .kinobi-overlay-play{z-index:2}
.kinobi-stage .kinobi-poster-toast{
 position:absolute;top:67%;left:50%;transform:translate(-50%,-50%);
 width:max-content;max-width:calc(100% - 32px);
 padding:10px 16px;border-radius:9px;
 background:rgba(11,18,29,.82);color:#edf3fb;
 box-shadow:0 2px 14px rgba(0,0,0,.3);
 font-size:13px;font-weight:500;line-height:1.4;text-align:center;
 pointer-events:none;z-index:3;
}
.kinobi-stage .kinobi-poster-toast[hidden]{display:none!important}
.kinobi-stage .kinobi-poster-toast.success{background:rgba(13,27,37,.86)}

/* Never combine loading=lazy with hidden thumbnails: browsers may postpone
   fetching an element that has no layout. Keep it connected and eager. */
.file-thumb,.public-thumb{position:relative}
.file-thumb img.thumb-pending,.public-thumb img.thumb-pending{
 position:absolute!important;width:1px!important;height:1px!important;
 opacity:0!important;pointer-events:none!important;
}
.file-thumb img:not(.thumb-pending),.public-thumb img:not(.thumb-pending){
 max-width:100%;max-height:100%;object-fit:contain;
}

/* A successful thumbnail replaces its file-type icon, never stacks under it.
   These rules override tile/gallery display:block icon sizing declarations
   which otherwise take precedence over the old span[hidden] selector. */
.file-thumb > span[hidden],
.public-thumb > span[hidden],
.file-thumb.thumb-loaded > span:not(.folder-symbol),
.public-thumb.thumb-loaded > span:not(.folder-symbol){
 display:none!important;
}
.file-thumb.thumb-loaded img,
.public-thumb.thumb-loaded img{
 position:static!important;
 opacity:1!important;
 max-width:100%;
 max-height:100%;
 object-fit:contain;
}

/* Keep portrait and landscape thumbnails inside their allocated catalog
   slots. A 100%-sized image inside a CSS grid can otherwise expand the
   grid's intrinsic row beyond 100px (most obvious with tall PNGs), causing
   the image to paint over the file name and following rows. */
.file-thumb,.public-thumb{
 min-width:0;
 overflow:hidden!important;
}
.file-thumb.thumb-loaded img,
.public-thumb.thumb-loaded img{
 position:absolute!important;
 inset:0!important;
 display:block!important;
 width:100%!important;
 height:100%!important;
 min-width:0!important;
 min-height:0!important;
 max-width:100%!important;
 max-height:100%!important;
 object-fit:contain!important;
 object-position:center center!important;
}
body[data-view-mode=tiles] #items .file-thumb,
body[data-view-mode=tiles] #entries .public-thumb{
 height:100px!important;
 min-height:100px!important;
 max-height:100px!important;
 flex:0 0 100px!important;
}
body[data-view-mode=gallery] #items .file-thumb,
body[data-view-mode=gallery] #entries .public-thumb{
 height:66px!important;
 min-height:66px!important;
 max-height:66px!important;
 flex:0 0 66px!important;
}

/* Global button { display:inline-flex } overrides UA [hidden] on the
   video's "choose cover frame" action. Hide it for every non-video item. */
#viewer #savePoster[hidden]{display:none!important}

/* Video action belongs to the same stage as the close X, so both use
   equal 12px insets and the same 35px control height, even in fullscreen. */
#viewer.kinobi-video-viewer{padding:6px!important}
#viewer.kinobi-video-viewer .dialoghead{display:none!important}
#viewer.kinobi-video-viewer .kinobi-stage #savePoster{
 position:absolute!important;
 top:12px;left:12px;z-index:8;
 display:inline-flex!important;align-items:center;justify-content:center;
 height:35px;min-height:35px;
 border-radius:18px!important;
 background:rgba(10,13,19,.53)!important;
 border:1px solid rgba(255,255,255,.24)!important;
 padding:0 13px!important;
 font-size:12px!important;
 line-height:1!important;
 white-space:nowrap;
}
#viewer.kinobi-video-viewer #close{display:none!important}
#viewer.kinobi-video-viewer #preview{margin:0!important}
#viewer.kinobi-video-viewer .kinobi-player .kinobi-stage video{
 max-height:calc(100dvh - 95px)!important;
}
.kinobi-stage .kinobi-close{
 position:absolute;right:12px;top:12px;z-index:8;
 display:flex;align-items:center;justify-content:center;
 width:35px;height:35px;min-width:35px;min-height:35px;
 padding:0!important;border-radius:50%!important;
 color:#f7f9fd;
 background:rgba(10,13,19,.48)!important;
 border:1px solid rgba(255,255,255,.24)!important;
 cursor:pointer;opacity:.94;
}
.kinobi-stage .kinobi-close:hover,
.kinobi-stage .kinobi-close:focus-visible{
 background:rgba(18,25,37,.85)!important;
 border-color:rgba(255,255,255,.5)!important;
 opacity:1;
}
.kinobi-stage .kinobi-close svg{display:block;pointer-events:none}
.kinobi-stage:focus{outline:none}

/* The #preview img rule capped poster height to viewport - 186px while
   video used viewport - 95px. The shorter overlay exposed the underlying
   video frame as a second strip at the bottom. The poster must fill exactly
   the video's stage in both normal and fullscreen preview. */
#preview .kinobi-stage > img.kinobi-poster,
#galleryPreview .kinobi-stage > img.kinobi-poster {
 position:absolute!important;
 inset:0!important;
 display:block;
 width:100%!important;
 height:100%!important;
 max-width:none!important;
 max-height:none!important;
 min-width:0!important;
 min-height:0!important;
 object-fit:contain!important;
 object-position:center!important;
}
#preview .kinobi-stage > img.kinobi-poster[hidden],
#galleryPreview .kinobi-stage > img.kinobi-poster[hidden]{
 display:none!important;
}

/* Stop controls are visible only while removable uploads are pending;
   override generic button display rules that otherwise defeat [hidden]. */
#cancelAllUploads[hidden],#publicUploadCancelAll[hidden],
#closeCompletedUploads[hidden],#publicUploadClear[hidden]{
 display:none!important;
}
#uploadJobs li button,#publicUploadJobs li button{
 justify-self:start;
 padding:6px 10px;
 font-size:12px;
}

/* The same window-close control for previews and upload rows. */
.kinobi-window-close{
 box-sizing:border-box;
 display:inline-flex!important;
 align-items:center!important;
 justify-content:center!important;
 flex:none;
 width:38px;height:38px;min-width:38px;min-height:38px;
 margin:0;padding:0!important;
 border:1px solid #414b5a;border-radius:8px;
 background:#252c38;color:#edf0f7;
 line-height:0!important;cursor:pointer;
}
.kinobi-window-close:hover{background:#354052}
.kinobi-window-close:focus-visible{outline:2px solid #8db5ff;outline-offset:2px}
.kinobi-window-close svg{display:block;flex:none;width:22px;height:22px;pointer-events:none}
#uploadJobs li .kinobi-window-close,#publicUploadJobs li .kinobi-window-close{
 width:32px;height:32px;min-width:32px;min-height:32px;
 margin:0;padding:0!important;line-height:0!important;
 font-size:inherit;
}
#uploadJobs li .kinobi-window-close svg,
#publicUploadJobs li .kinobi-window-close svg{width:18px;height:18px}


/* Keep modal previews centered in the viewport after page scrolling.
   The earlier #viewer { position:relative } overrides the UA modal rule. */
#viewer:modal{
  position:fixed;
  inset:0;
  margin:auto;
  height:fit-content;
  max-height:calc(100dvh - 20px);
}

/* The default 1380px video dialog makes portrait files appear to have
   huge blank side panels. Once metadata or poster dimensions are available,
   size the modal to the *displayed* video aspect ratio. The available video
   height reserves 95px for controls and dialog chrome. Keep at least 320px
   of width for the timeline and buttons, constrained by the viewport.
   Fullscreen stays 100vw/100dvh under the independent player rules. */
#viewer.kinobi-video-viewer.kinobi-video-aspect-known{
 width:min(1380px,calc(100vw - 20px),
   max(320px,calc((100dvh - 95px) * var(--kinobi-video-ratio) + 12px)))!important;
}

/* Compact, accessible BitTorrent v2 compatibility confirmation.
   Shared by the public and administrator download actions. */
#torrentV2Warning{
 position:fixed;
 inset:0;
 margin:auto;
 width:min(440px,calc(100vw - 32px));
 max-width:calc(100vw - 32px);
 max-height:calc(100dvh - 32px);
 box-sizing:border-box;
 padding:22px;
 border-radius:14px;
 border:1px solid #52617a;
 background:#1a2432;
 color:#eaf0fb;
}
#torrentV2Warning::backdrop{background:rgba(0,0,0,.72)}
#torrentV2Warning h3{margin:0 0 12px;font-size:18px;line-height:1.3}
#torrentV2Warning p{font-size:14px;line-height:1.55;margin:10px 0;color:#c7d4e8}
#torrentV2Warning .torrent-v2-actions{
 display:flex;
 flex-wrap:wrap;
 gap:9px;
 margin-top:20px;
 justify-content:flex-end;
}
#torrentV2Warning .torrent-v2-actions button{min-height:40px;padding:9px 14px}
@media(max-width:420px){
 #torrentV2Warning{padding:18px}
 #torrentV2Warning .torrent-v2-actions button{flex:1 1 auto}
}

/* Shared compact search field across admin toolbar pages. */
.top-actions .search-bar-slot{margin-left:auto;flex:0 0 210px;min-width:0;width:210px;max-width:210px}
.top-actions #searchInputs{margin:0;flex-wrap:nowrap;max-width:100%}
.top-actions #searchInputs input{flex:1 1 auto;min-width:0;max-width:100%;width:100%;height:39px}
@media(max-width:700px){.top-actions .search-bar-slot{margin-left:0;flex:1 1 100%;min-width:0;width:100%;max-width:none}}
