/* Shared blue palette and quiet, layered surfaces for both themes. */
:root{
 color-scheme:light;
 --page:#eaf1fa;--surface:#fcfdff;--surface-2:#f0f5fc;--surface-3:#e4edf9;
 --text:#24334b;--ink:#23446e;--muted:#61738d;--line:#ccd9eb;--line-strong:#9bafcc;
 --md-primary:#42679f;--md-primary-container:#dbe8fa;--md-on-primary-container:#23446e;
 --md-surface:#fcfdff;--md-surface-1:#edf3fb;--md-surface-2:#f0f5fc;--md-surface-3:#e4edf9;
 --md-on-surface:#24334b;--md-on-surface-variant:#61738d;--md-outline:#a9bbd4;--md-outline-variant:#d1deef;
 --shadow:0 12px 34px rgba(37,66,109,.10);--shadow-soft:0 3px 12px rgba(37,66,109,.06);
 --md-elev-3:0 8px 24px rgba(37,66,109,.11),0 1px 3px rgba(37,66,109,.05);
}
html.dark{
 color-scheme:dark;
 --page:#101925;--surface:#192535;--surface-2:#202e42;--surface-3:#293a51;
 --text:#e4edf9;--ink:#d7e7ff;--muted:#a5b7d0;--line:#344960;--line-strong:#58708e;
 --md-primary:#a9c9fa;--md-primary-container:#2b456a;--md-on-primary-container:#d7e7ff;
 --md-surface:#192535;--md-surface-1:#101925;--md-surface-2:#202e42;--md-surface-3:#293a51;
 --md-on-surface:#e4edf9;--md-on-surface-variant:#a5b7d0;--md-outline:#58708e;--md-outline-variant:#344960;
 --shadow:0 12px 34px rgba(0,6,17,.28);--shadow-soft:0 3px 12px rgba(0,6,17,.18);
 --md-elev-3:0 8px 24px rgba(0,6,17,.28),0 1px 3px rgba(0,6,17,.18);
}
#preview-shell .quick-panel{background:linear-gradient(145deg,var(--md-surface-2),var(--md-surface-3))!important}
#preview-shell .pick-feature{background:linear-gradient(135deg,var(--md-surface-3),var(--md-surface) 65%)!important;border-color:var(--md-outline)!important}
#preview-shell :is(.search-zone,.daily-discovery){background:var(--md-surface-2)!important}
html.dark #preview-shell [data-page="anime"]{--section-accent:#eca957}
html.dark #preview-shell [data-page="manga"]{--section-accent:#a5b6f3}
html.dark #preview-shell [data-page="youtube"]{--section-accent:#ed9097}
html.dark #preview-shell [data-page="downloads"]{--section-accent:#54ccdf}
html.dark #preview-shell [data-page="services"]{--section-accent:#6acb9b}
#preview-shell :is(input,textarea,select){background:var(--md-surface)!important;color:var(--md-on-surface)!important}
#preview-shell :is(input,textarea,select):focus-visible{outline:2px solid var(--md-primary);outline-offset:2px}
html.dark #preview-shell .trend-title{color:var(--md-on-surface-variant)!important}
html.dark #preview-shell .meta{color:var(--md-on-surface)!important;background:var(--md-surface-3)!important}
/* Preserve the original search scope treatment; keep discovery's heading unfilled. */
#preview-shell #homeSearchScope{background:#eef2f8!important;color:#6f7a8c!important}
html.dark #preview-shell #homeSearchScope{background:#1d2835!important;color:#aeb9c7!important}
#preview-shell #homeSearchScope:focus-visible{outline:none;box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--md-primary) 44%,transparent)!important}
#preview-shell .trending .daily-discovery{background:transparent!important}
#preview-shell #homeSearchScope{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%236f7a8c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 10px center!important;background-size:14px!important;padding-right:30px!important}
#preview-shell .share::before{content:""!important;opacity:1!important;color:transparent!important}
#preview-shell .share.x::before{background:#161b22!important}
#preview-shell .share.fb::before{background:#658ccb!important}
#preview-shell .share.wa::before{background:#60a886!important}
.site-foot::before,body.lab-home .site-foot::before{top:50%!important;bottom:auto!important;transform:translateY(-50%)!important}
.site-foot::before,body.lab-home .site-foot::before{top:calc((100% - 22px) / 2)!important}
/* Dark framing strips share a restrained navy gradient, without a black edge. */
html.dark .site-head::before,html.dark .site-foot::before{
 background:linear-gradient(90deg,#263d5a 0%,#304d70 50%,#3b587b 100%)!important;
 opacity:1!important;border-color:#405777!important;
 box-shadow:0 4px 16px rgba(0,8,20,.16)!important;
}
#preview-shell .context-return-navigation{display:flex;padding:14px 18px;border-top:1px solid var(--md-outline-variant);background:var(--md-surface)}
html.dark .site-head .status-right:has(.personal-shelf-link:hover),html.dark .site-head .status-right:has(.personal-shelf-link:focus-visible){opacity:1}
html.dark .site-head .personal-shelf-link:hover,html.dark .site-head .personal-shelf-link:focus-visible{color:#f0f6ff!important;text-decoration:underline;text-underline-offset:4px}

/* Content previews retain the poster frame and category badge. */
#pickPoster .pick-preview-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;z-index:1}
#pickPoster .pick-preview-image[hidden]{display:none}
#pickPoster #pickType{z-index:2}

/* Related downloads share compact cards, including asynchronously loaded results. */
#preview-shell #download-related-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#preview-shell #download-related-results>.likebox,#preview-shell #download-related-results>.navi,#preview-shell #download-related-results>.menu:not([data-download-item]){grid-column:1/-1}
#preview-shell #download-related-results [data-download-item]{display:grid;grid-template-columns:88px minmax(0,1fr);gap:10px;max-width:none;width:auto;margin:0;padding:10px!important;min-width:0}
#preview-shell .related-preview img{width:88px!important;height:92px!important;object-fit:cover}
#preview-shell .related-preview button{width:100%;min-height:23px!important;padding:3px 2px!important;font-size:8px!important;line-height:1.3;margin-top:6px;white-space:normal}
#preview-shell .related-info{min-width:0;overflow-wrap:anywhere;font-size:9px;line-height:1.5}
#preview-shell .related-info>div:first-child{font-weight:700;margin-bottom:5px}
#preview-shell .related-info .likebox,#preview-shell .related-info .box{padding:5px 0!important;margin:0!important;border:0!important;background:transparent!important}
#preview-shell .related-primary-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;font-weight:400}
#preview-shell .related-info audio{display:block;width:100%!important;min-width:0;max-width:100%;height:32px;margin:7px 0}
#preview-shell [data-related-layout="ringtone"] .related-preview img{object-fit:contain;width:36px!important;height:36px!important;margin:8px auto;display:block}
#preview-shell [data-related-layout="ringtone"] .related-info>div{display:block!important}
#preview-shell #download-related-status{font-size:9px;color:var(--muted);text-align:left!important;padding:4px 16px 10px!important;border:0!important;background:transparent!important;min-height:0}
@media(max-width:600px){#preview-shell #download-related-results{grid-template-columns:1fr}}

#preview-shell #download-related-results [data-related-layout="ringtone"] .related-preview img{display:none!important}
#preview-shell #download-related-results [data-related-layout="ringtone"] .related-preview::before{content:"♫";display:block;text-align:center;font-size:32px;line-height:60px;color:var(--section-accent)}

/* Related files stand on their own; actions remain native download links. */
#preview-shell #download-related-results{border:0!important;border-radius:0;background:transparent!important;box-shadow:none;padding:0!important;margin:18px 14px 14px;gap:12px}
#preview-shell #download-related-results .related-action-button,#preview-shell #download-related-results .related-size-button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:1px solid var(--section-line);border-radius:7px;background:var(--section-surface);color:var(--section-ink);text-decoration:none;min-height:28px;padding:5px 8px;font-size:9px!important;font-weight:600!important}
#preview-shell #download-related-results .related-action-button:hover,#preview-shell #download-related-results .related-size-button:hover{border-color:var(--section-accent);background:color-mix(in srgb,var(--section-accent) 8%,var(--section-surface))}
#preview-shell #download-related-results .related-download-wide{grid-column:1/-1;width:100%;margin-top:2px}
#preview-shell #download-related-results .related-primary-actions{gap:5px}
#preview-shell #download-related-results .related-info .likebox{border-left:0!important}
#preview-shell #download-related-results .related-info small{display:flex!important;flex-wrap:wrap;gap:4px;margin-top:6px;font-size:0!important}
#preview-shell #download-related-results .related-size-button{min-height:24px;padding:3px 5px;font-size:8px!important}
#preview-shell #download-related-results .related-preview{min-width:0;width:88px}
#preview-shell #download-related-results [data-related-layout="wallpaper"] .related-preview>a{display:block;width:100%}
#preview-shell #download-related-results [data-related-layout="wallpaper"] .related-preview img{display:block;width:100%!important;height:92px!important;box-sizing:border-box}
#preview-shell #download-related-results .related-preview button{display:block;box-sizing:border-box;width:100%!important;margin-left:0;margin-right:0}

/* Keep related action rows close to their content. */
#preview-shell #download-related-results [data-download-item]{row-gap:4px;align-content:start;align-items:start}
#preview-shell #download-related-results .related-info .likebox{min-height:0!important;padding:3px 0!important}
#preview-shell #download-related-results .related-info small{margin-top:4px!important}
#preview-shell #download-related-results .related-info audio{margin-bottom:3px}
#preview-shell #download-related-results .related-info .menu:has(audio){padding:0!important;margin:0!important;min-height:0!important}
#preview-shell #download-related-results .related-download-wide{margin-top:0;align-self:start}

/* Empty refresh status must not reserve a visible strip. */
#preview-shell #download-related-status[hidden],#preview-shell #download-related-status:empty{display:none!important;padding:0!important;margin:0!important;min-height:0!important;border:0!important}
#preview-shell #download-related-results>.navi{display:flex;justify-content:flex-end;align-items:center;min-height:0!important;padding:4px 0 0!important;margin:0!important;background:transparent!important}
#preview-shell #download-related-results>.navi a{min-height:28px!important;padding:5px 10px!important;border-radius:7px;border-color:var(--section-line);font-size:9px!important;font-weight:600;color:var(--section-ink)}

/* Shared downloads information divider in every catalogue and detail view. */
#preview-shell .downloads-about{border-top:1px solid var(--section-line)!important}

/* Compact shared YouTube search history and related navigation. */
#preview-shell [data-page="youtube"] .youtube-recent-searches{gap:6px;padding:12px 14px;background:transparent}
#preview-shell [data-page="youtube"] .youtube-recent-label{flex-basis:100%;margin:0 0 3px}
#preview-shell [data-page="youtube"] .youtube-recent-searches a{padding:4px 8px;border:1px solid var(--section-line);border-radius:6px;max-width:100%;overflow-wrap:anywhere;background:var(--section-surface)}
#preview-shell [data-page="youtube"] .youtube-related-pagination{justify-content:flex-end;background:transparent;border:0;border-radius:0;margin:0;padding:12px 14px;box-shadow:none}

/* YouTube format and audio tools share the catalogue presentation. */
#preview-shell [data-page="youtube"] a[data-favorite-toggle].save-indicator{background:transparent!important;box-shadow:none!important}
#preview-shell [data-page="youtube"] .youtube-format-panel{padding:16px 14px;font-size:10px;line-height:1.6;background:transparent}
#preview-shell [data-page="youtube"] .youtube-format-panel [data-prepared-download]{display:inline-block;vertical-align:top;margin:6px 10px 6px 0}
#preview-shell [data-page="youtube"] .youtube-format-panel p:empty{display:none}
#preview-shell [data-page="youtube"] .youtube-conversion-form{display:block!important;max-width:540px;margin:0 auto;text-align:left;font-size:10px}
#preview-shell [data-page="youtube"] .youtube-conversion-form p{margin:8px 0}
#preview-shell [data-page="youtube"] .youtube-conversion-form input[type="text"]{width:100%;box-sizing:border-box}
#preview-shell [data-page="youtube"] .youtube-conversion-form input[type="submit"]{display:block;margin-top:12px}
#preview-shell [data-page="youtube"] .youtube-return-navigation{display:flex;justify-content:flex-end;padding:12px 14px;border-top:1px solid var(--section-line)}
#preview-shell [data-page="youtube"] .youtube-return-navigation .lab-button{font-size:9px;min-height:30px}
