@import url("./google/material-symbols-outlined.css");
@import url("./google/material-symbols-filled.css");

:root {
    color-scheme: dark;

    --bg-app: #0b0b10;
    --bg-primary: #101017;
    --bg-secondary: #171720;
    --bg-tertiary: #1d1d28;
    --bg-card: #20202b;
    --bg-elevated: #262633;
    --bg-hover: #2b2b39;

    --text-primary: #f1f1f6;
    --text-secondary: #aaaabc;
    --text-muted: #737389;
    --text-inverse: #101017;

    --accent: #6c5ce7;
    --accent-transparent: rgba(108, 92, 231, 0.8);
    --accent-hover: #7d6ff0;
    --accent-active: #5c4bd5;
    --accent-dim: rgb(108 92 231 / 0.14);
    --accent-soft: rgb(108 92 231 / 0.22);
    --accent-border: rgb(108 92 231 / 0.45);

    --danger: #ef5f65;
    --danger-dim: rgb(239 95 101 / 0.14);
    --success: #36c78a;
    --warning: #f5bd4f;

    --border: #2b2b39;
    --border-strong: #39394a;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;

    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: var(--radius);
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-pill: 999px;

    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.5rem;
    --font-2xl: 2rem;

    --control-sm: 2rem;
    --control-md: 2.5rem;
    --control-lg: 3rem;
    --mobile-header-height: 3.5rem;

    --shadow-sm:
        0 1px 2px rgb(255 255 255 / 0.25);

    --shadow:
        0 8px 24px rgb(255 255 255 / 0.28);

    --shadow-lg:
        0 20px 60px rgb(255 255 255 / 0.42);

    /* Depth under something standing off the page, the same in both themes (perspective-carousel.js). */
    --shadow-depth:
        0 30px 60px rgb(0 0 0 / 0.55),
        0 0 0 1px rgb(255 255 255 / 0.06);
    --shadow-depth-sm:
        0 18px 40px rgb(0 0 0 / 0.45);

    /* Faint top highlight on sidebars and panel headers. */
    --surface-sheen: rgb(255 255 255 / 0.025);

    --focus-ring:
        0 0 0 3px var(--accent-dim);

    --sidebar-width: 15rem;
    --content-width: 96rem;

    --font-sans:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    --transition-fast: 120ms ease;
    --transition: 180ms ease;

    --entry-hero-background: linear-gradient(to right,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.85) 54%,
            rgba(0, 0, 0, 0.4) 100%);
    --entry-detail-background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);

    --bg-media-player-controls: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    /* A video's own controls: light on the dark picture in either theme (info bar, skip buttons). */
    --player-video-text: #fff;
    --player-video-text-secondary: rgb(255 255 255 / 0.72);
    --player-video-text-muted: rgb(255 255 255 / 0.45);
    --player-video-text-inverse: #000;
    --player-video-hover: rgb(255 255 255 / 0.14);
    --player-video-surface: rgb(255 255 255 / 0.1);
    --player-video-border: rgb(255 255 255 / 0.6);
    --player-video-mark: rgb(0 0 0 / 0.6);
    --bg-placeholder-shimmer: linear-gradient(90deg,
            rgba(125, 125, 125, 0) 0%,
            rgba(125, 125, 125, 0.2) 20%,
            rgba(125, 125, 125, 0.5) 60%,
            rgba(125, 125, 125, 0) 100%);
}


/* =========================================================
   Reset and document
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

.text-wrap {
    text-overflow: ellipsis;
    overflow: hidden;
    word-wrap: break-word;
    white-space: pre;
}


/* WebKit Engines (Chrome, Safari, Edge) */
.entry-wrapper::-webkit-scrollbar {
    width: var(--space-2);
    /* Super thin width */
    height: var(--space-2);
}

.entry-wrapper::-webkit-scrollbar-track {
    background: transparent;
    /* Seamless blending */
}

.entry-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--accent-dim);
    border-radius: 10px;
    /* Perfectly rounded capsule */
}

.entry-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}

body:has(.is-expanded) {
    overflow: hidden;
}

hr {
    width: 100%;
    height: 0;
    border: 0;
    border-top: 1px solid var(--border);
}

html {
    min-height: 100%;
    background: var(--bg-app);
    font-family: var(--font-sans);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 70% -20%,
            rgb(108 92 231 / 0.12),
            transparent 34rem),
        var(--bg-app);
    color: var(--text-primary);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

::selection {
    background: var(--accent);
    color: #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}


/* =========================================================
   Application shell
   ========================================================= */

.app-shell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: var(--space-4);
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg,
            var(--surface-sheen),
            transparent 12rem),
        var(--bg-primary);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 3.5rem;
    margin-bottom: var(--space-4);
    padding: var(--space-2);
}

.app-brand-mark {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border-radius: var(--radius);
    background:
        linear-gradient(135deg,
            var(--accent-hover),
            var(--accent-active));
    box-shadow:
        0 8px 22px rgb(108 92 231 / 0.32);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
}

.app-brand-copy {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.app-brand-copy strong {
    font-size: 0.95rem;
}

.app-brand-copy small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* The brand leads home, without looking like a link. */
a.app-brand {
    color: inherit;
    text-decoration: none;
}

.app-brand-copy strong,
.app-brand-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* An uploaded logo replaces the lettered mark, shown whole on no backdrop of its own. */
.app-brand-mark.has-logo {
    overflow: hidden;
    background: none;
    box-shadow: none;
}

.app-brand-mark.has-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Under a server's own name and logo, the software it runs on. */
.powered-by {
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: var(--font-xs);
    text-align: center;
}

/*
 * The destinations scroll on their own when they outgrow the window, so the brand above them and
 * the cast and profile controls below stay where they are. min-height lets the flex item shrink
 * below its content at all; the links keep their size rather than being squeezed to fit.
 */
.app-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-height: 0;
    padding: var(--space-2) 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.app-nav > *,
.app-nav-items > * {
    flex-shrink: 0;
}

/* The laid-out links sit in the list itself, spaced as the others are. */
.app-nav-items {
    display: contents;
}

/* Settings, with the account rather than among the destinations. */
.app-settings-link {
    flex: 0 0 auto;
}

.app-nav-separator {
    margin: var(--space-1) 0;
}

/*
 * The hamburger and the scrim belong to the narrow layout only. A sidebar that is always on screen
 * has nothing to reveal and nothing to dismiss, so both stay out of the document's flow entirely
 * rather than being positioned somewhere harmless.
 */
.app-menu-toggle,
.app-search-toggle,
.app-scrim,
.app-content-footer,
.app-nav-brand {
    display: none;
}

.app-menu-toggle,
.app-search-toggle {
    flex: 0 0 auto;
    place-items: center;
    width: var(--control-md);
    height: var(--control-md);
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.app-menu-toggle:hover,
.app-search-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* A link in the closed drawer has a badge: a dot on the button that opens it. */
.app-menu-toggle {
    position: relative;
}

.app-menu-toggle-dot {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-secondary);
    pointer-events: none;
}

.app-menu-toggle-dot.is-quiet {
    background: var(--text-secondary);
}

.app-menu-toggle-dot[hidden] {
    display: none;
}

/*
 * Cast lives beside the profile rather than inside the player, because a receiver is chosen before
 * there is anything to play as often as during. The element is the Cast framework's own: it draws
 * its connected state and opens the device picker without being told to, and the wrapper is what
 * gets hidden when there is nothing on the network to cast to.
 */
.app-cast {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: var(--control-md);
    height: var(--control-md);
}

.app-cast[hidden] {
    display: none;
}

.app-cast google-cast-launcher {
    width: 1.5rem;
    height: 1.5rem;
    --connected-color: var(--accent);
    --disconnected-color: var(--text-secondary);
    cursor: pointer;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition:
        color var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.app-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.app-nav-link.is-active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
    color: var(--accent);
}

.app-nav-icon {
    display: grid;
    width: 1.5rem;
    place-items: center;
    color: var(--text-muted);
}

.app-nav-link.is-active .app-nav-icon {
    color: currentColor;
}

.app-nav-badge {
    min-width: 1.25rem;
    margin-left: auto;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-align: center;
}

/* Something new, nothing counted: a small dot in the badge's place, quieter than a number. */
.app-nav-badge.is-dot {
    width: 0.5rem;
    min-width: 0;
    height: 0.5rem;
    margin-right: 0.35rem;
    padding: 0;
    background: var(--text-secondary);
}

.app-nav-badge[hidden] {
    display: none;
}

.splash {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
    opacity: 1;
    transform: scale(1);
    cursor: wait;
    transition: 
        opacity var(--transition),
        transform var(--transition);
}

.splash .app-brand {
    flex-direction: column;
    margin: 0;
}

.splash .app-brand-mark {
    width: 7.5rem;
    height: 7.5rem;
    font-size: 4rem;
}

.splash .app-brand-copy {
    text-align: center;
}

.splash .app-brand-copy strong {
    font-size: 2.5rem;
    text-transform: uppercase;
}

.splash .app-brand-copy small {
    font-size: 1rem;
}

.splash.is-hidden {
    opacity: 0;
    transform: scale(1.5);
    pointer-events: none;
}

.switch-control {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    cursor: pointer;
}

.switch-input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
}

.switch-track {
    position: relative;
    inline-size: 2.6rem;
    block-size: 1.45rem;
    border-radius: 999px;
    background: var(--border-strong, #5a5a68);
    transition: background .16s ease;
}

.switch-track::after {
    position: absolute;
    inset: .2rem auto .2rem .2rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    content: '';
    transition: transform .16s ease;
}

.switch-input:checked+.switch-track {
    background: var(--accent, #6c5ce7);
}

.switch-input:checked+.switch-track::after {
    transform: translateX(1.15rem);
}

.switch-input:focus-visible+.switch-track {
    outline: 2px solid var(--accent, #6c5ce7);
    outline-offset: 3px;
}

.switch-input:disabled+.switch-track {
    cursor: not-allowed;
    opacity: .5;
}

.app-sidebar-footer {
    margin-top: auto;
}

.app-content {
    --content-pad-top: 2rem;
    --content-pad-x: clamp(1rem, 3vw, 3rem);
    position: relative;
    min-width: 0;
    /* Room at the end for the mini player docked over the bottom of the page (app.js measures it). */
    padding: var(--content-pad-top) var(--content-pad-x) calc(4rem + var(--activity-dock-height, 0px));
}

/*
 * The top bar: across the content, edge to edge, held at the top while the page scrolls. It carries
 * what is not a destination -- background activity, casting, Settings, the account -- so the
 * sidebar is left with places to go.
 */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    min-height: 3.75rem;
    margin: calc(-1 * var(--content-pad-top)) calc(-1 * var(--content-pad-x)) var(--space-5);
    padding: var(--space-2) var(--content-pad-x);
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.app-account {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* The header's copy of the account is the narrow layout's; a desktop has the top bar. */
.app-account-header {
    display: none;
}
/*
 * Everything in the bar is a round button of one size: background activity, Settings by its icon,
 * and the account by its initial. Names are in their labels and tooltips.
 */
.app-topbar .maintenance-activity-button,
.app-topbar .app-settings-link,
.app-topbar .profile-menu {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    min-height: 0;
    padding: 0;
    border-radius: 50%;
}

.app-topbar .app-settings-link {
    gap: 0;
    border: 1px solid var(--border);
}

.app-topbar .app-settings-link span:not(.app-nav-icon) {
    display: none;
}

.app-topbar .app-settings-link .app-nav-icon {
    width: auto;
}

.app-topbar .profile-menu {
    border: 0;
    text-decoration: none;
}

.app-topbar .profile-menu span:not(.profile-avatar-placeholder) {
    display: none;
}

/* The count of running jobs sits on the button's corner rather than beside its icon. */
.app-topbar .maintenance-activity-button {
    position: relative;
    box-shadow: none;
}

.app-topbar .maintenance-activity-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.65rem;
}

.app-topbar .maintenance-activity-badge:empty {
    display: none;
}

/* The account menu drops down from the bar, lined up with its right edge. */
.app-topbar .dropdown-menu .dropdown {
    top: calc(100% + var(--space-2));
    right: 0;
    bottom: auto;
    left: auto;
}

.app-topbar .profile-avatar-placeholder {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
}




/* =========================================================
   Page primitives
   ========================================================= */

.page {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

/*
 * The accent eyebrow: small uppercase text in the accent, over a page's title, as a section's title
 * (section-header.js) and over a carousel's front title. One rule, so the three never drift apart.
 */
.page-eyebrow,
.section-head h4,
.perspective-eyebrow {
    margin: 0;
    color: var(--accent-hover);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.page-eyebrow {
    margin-bottom: var(--space-2);
}

.page-description {
    max-width: 42rem;
    margin: var(--space-3) 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.container {
    width: 100%;
    max-width: var(--content-width);
    margin-inline: auto;
}


/* =========================================================
   Surfaces and cards
   ========================================================= */

.surface {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.surface-raised {
    box-shadow: var(--shadow-sm);
}

.card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}


/* =========================================================
   Buttons
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius);
    outline: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.btn:hover:not(:disabled) {
    background: var(--bg-hover);
}

/* .btn:active:not(:disabled) {
    transform: translateY(0);
} */

.btn:focus-visible {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-border);
}

.btn-icon {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    border-radius: 100%;
    padding: var(--space-2);
    aspect-ratio: 1;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    border-color: rgb(239 95 101 / 0.4);
    background: var(--danger-dim);
    color: #ff9da1;
}

.btn-link {
    border: 0;
    background: transparent;
}

.btn-sm {
    min-height: 2rem;
    padding: var(--space-1) var(--space-2);
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}


/* =========================================================
   Forms
   ========================================================= */

.form-control {
    display: grid;
    gap: var(--space-2);
}

.form-label {
    display: inline-flex;
    align-items: center;
    justify-content: start;
    gap: var(--space-2);

    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 650;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1px solid var(--border);
    padding: var(--space-3) var(--space-2);
    border-radius: var(--radius);
    outline: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-textarea {
    min-height: 8rem;
    padding: var(--space-3) var(--space-3);
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1rem) 50%,
        calc(100% - 0.7rem) 50%;
    background-size: 0.32rem 0.32rem;
    background-repeat: no-repeat;
    padding-right: var(--space-5);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-strong);
    background-color: var(--bg-secondary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input-search {
    padding-left: var(--space-6);
    background-image:
        radial-gradient(circle,
            transparent 37%,
            var(--text-muted) 39%,
            var(--text-muted) 49%,
            transparent 51%),
        linear-gradient(45deg,
            transparent 44%,
            var(--text-muted) 46%,
            var(--text-muted) 55%,
            transparent 57%);
    background-position:
        0.85rem 50%,
        1.55rem 62%;
    background-size:
        0.9rem 0.9rem,
        0.45rem 0.45rem;
    background-repeat: no-repeat;
}

input[type="date"] {
    color-scheme: dark;
}


/* =========================================================
   Toolbar
   ========================================================= */

.toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    flex: 0 1 auto;
}

/* .library-controls {
    position: sticky;
    top: 1rem;
    z-index: 30;
    padding: var(--space-3);
    background: var(--bg-secondary);
    backdrop-filter: blur(18px);
} */

.filters-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-toolbar {
    margin: 0;
}

.filter-sort,
.filter-sort-direction {
    width: auto;
}

.library-direction {
    width: 9.25rem;
}

.filter-aside-button {
    white-space: nowrap;
}

.filter-count {
    display: inline-grid;
    min-width: 1.25rem;
    height: 1.25rem;
    padding-inline: var(--space-1);
    place-items: center;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 750;
}

.filter-count:empty {
    display: none;
}


/* =========================================================
   Chips and active filters
   ========================================================= */

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.active-filters[hidden] {
    display: none;
}

.chip {
    display: inline-flex;
    overflow: hidden;
    gap: 0;
    padding: 0 var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    text-decoration: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: small;
    font-weight: 600;
}

.chip-accent {
    border-color: var(--accent-border);
    background: var(--accent-dim);
}

.chip-label {
    padding: var(--space-1);
}

.chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    height: auto;
    line-height: 1;
}

.chip-remove:hover {
    background: var(--accent-soft);
    color: #fff;
}

.splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}


/* =========================================================
   Entries
   ========================================================= */

.section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.entry-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: var(--space-1);
}

.entry-wrapper.is-slider {
    display: flex;
    align-items: stretch;
    gap: var(--space-1);
    overflow: scroll hidden;
    padding: var(--space-2);
    padding-block: 1.75rem;
    margin: 0 calc(-1 * var(--space-2));
}

.entry-wrapper.is-slider .entry-card {
    flex: 0 0 128px;
    scroll-snap-align: start;
}

.entry-card {
    position: relative;
    display: flex;
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    flex-direction: column;
    gap: 0;
    padding: 4px;
    color: inherit;
    text-decoration: none;
    transform: translateY(0);
    filter: grayscale(0%);

    isolation: isolate;
    /* Clipped, not hidden: see the hover rules below. */
    overflow: clip;

    background: transparent;
    transition:
        transform var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        filter var(--transition);
}

.entry-card-placeholder .entry-poster-wrapper {
    aspect-ratio: 2 / 3;
    width: 100%;
    background: var(--bg-secondary);
}

.entry-card-placeholder .entry-poster-wrapper:after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: var(--bg-placeholder-shimmer);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.entry-card-placeholder {
    cursor: wait;
}

.entry-card-movie {
    --entry-type-color: #e056fd;
}

.entry-card-show {
    --entry-type-color: #5f8cff;
}

.entry-card-season {
    --entry-type-color: #36c9c6;
}

.entry-card-episode {
    --entry-type-color: #44bd80;
}

.entry-card-artist {
    --entry-type-color: #ff9f43;
}

.entry-card-album {
    --entry-type-color: #f5bd4f;
}

.entry-card-track {
    --entry-type-color: #ff6b81;
}

.entry-card-file {
    --entry-type-color: #8892a6;
}

.entry-card-collection {
    --entry-type-color: #d8e062;
}

.entry-card-person {
    --entry-type-color: #a29bfe;
}

.home-section-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.home-section-editor-row.was-moved {
    animation: homeSectionMovedHint 500ms linear 1;
}

@keyframes homeSectionMovedHint {
    0% {
        border-color: var(--accent);
    }

    20% {
        border-color: inherit;
    }

    40% {
        border-color: var(--accent);
    }

    60% {
        border-color: inherit;
    }

    80% {
        border-color: var(--accent);
    }

    100% {
        border-color: inherit;
    }
}

.home-section-filter-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.section-description {
    margin-top: -0.35rem;
    color: var(--text-muted);
}

.status-success {
    border-color: rgb(54 201 198 / 0.35);
    background: rgb(54 201 198 / 0.12);
    color: #8ce3df;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 1.45rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: .68rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-movie {
    border-color: rgb(224 86 253 / .45);
    background: rgb(224 86 253 / .12);
    color: #e9a0fa;
}

.badge-tv {
    border-color: rgb(95 140 255 / .45);
    background: rgb(95 140 255 / .12);
    color: #9bb8ff;
}

.badge-music {
    border-color: rgb(255 159 67 / .45);
    background: rgb(255 159 67 / .12);
    color: #ffc082;
}

.badge-mixed {
    border-color: rgb(54 201 198 / .45);
    background: rgb(54 201 198 / .12);
    color: #78dedc;
}

.badge-documents {
    border-color: rgb(148 163 255 / .45);
    background: rgb(148 163 255 / .12);
    color: #b3bcff;
}

.badge-error {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong));
    background: var(--danger-dim);
    color: var(--danger);
}

.badge-warning {
    border-color: color-mix(in srgb, var(--warning) 45%, var(--border-strong));
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    color: var(--warning);
}

.diagnostics-panel {
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.diagnostics-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.diagnostics-list > li.muted {
    padding: var(--space-3);
}

.diagnostics-list > li + li {
    border-top: 1px solid var(--border);
}

/* One line per event: the dialog holds the rest. */
.diagnostics-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: .875rem;
    text-align: left;
    cursor: pointer;
}

.diagnostics-row:hover,
.diagnostics-row:focus-visible {
    background: var(--bg-secondary);
}

.diagnostics-severity {
    width: .5rem;
    height: .5rem;
    border-radius: var(--radius-pill);
    background: var(--text-muted);
}

.diagnostics-row.is-error .diagnostics-severity {
    background: var(--danger);
}

.diagnostics-row.is-warning .diagnostics-severity {
    background: var(--warning);
}

.diagnostics-message {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diagnostics-source,
.diagnostics-time {
    color: var(--text-muted);
    font-size: .78rem;
    white-space: nowrap;
}

.diagnostics-time {
    min-width: 6.5em;
    text-align: right;
}

@media (max-width: 600px) {
    .diagnostics-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .diagnostics-source {
        display: none;
    }
}

.diagnostics-dialog .app-dialog-content {
    width: min(48rem, 100%);
}

.diagnostics-dialog-message {
    margin: 0 0 var(--space-3);
    white-space: pre-wrap;
    word-break: break-word;
}

.diagnostics-dialog-body h3 {
    margin: var(--space-3) 0 0;
    font-size: .875rem;
}

.diagnostics-detail {
    max-height: 50vh;
    overflow: auto;
    margin: var(--space-2) 0 0;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    font-family: var(--font-mono, monospace);
    font-size: .78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.settings-diagnostics-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.entry-type-badge,
.folder-type-badge {
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    color: #fff;
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
}

.entry-type-badge {
    position: absolute;
    display: flex;
    z-index: 2;
    opacity: 1;
    transform: translateY(0%);
    transition: transform var(--transition), opacity var(--transition);
    top: 0;
    right: 0;
    border-bottom-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-lg);
}

.entry-type-badge,
.folder-type-badge {
    background:
        color-mix(in srgb, var(--entry-type-color, #777) 82%, #111);
}

.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-type-badge {
    opacity: 0;
    transform: translateY(-100%);
}

.entry-watch-count-badge {
    position: absolute;
    z-index: 3;
    top: var(--space-2);
    left: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: rgb(18 18 26 / 0.88);
    color: #fff;
    font-size: var(--font-xs);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.entry-card.is-shared-file-stack .entry-watch-count-badge {
    top: var(--space-7);
}

.entry-card.is-shared-file-stack .entry-poster-wrapper {
    margin-right: var(--space-2);
    margin-bottom: var(--space-2);
    box-shadow: 4px 4px 0 -1px var(--bg-elevated), 4px 4px 0 0 var(--border),
        8px 8px 0 -1px var(--bg-secondary), 8px 8px 0 0 var(--border);
}

.entry-shared-file-badge {
    position: absolute;
    z-index: 3;
    top: .5rem;
    left: .5rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid rgb(68 189 128 / .45);
    border-radius: var(--radius-pill);
    background: rgb(18 18 26 / .88);
    color: #9be3bb;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
}

/*
 * The availability badge (entry.js, AvailabilityBadge): one solid pill, the same on a card, an
 * episode tile and an entry's page, coloured by its state so it reads at a glance over a picture.
 */
.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    width: max-content;
    max-width: 100%;
    padding: .2rem .55rem .2rem .4rem;
    border-radius: var(--radius-pill);
    background: var(--warning);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
    font-size: .65rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.availability-badge .material-symbols-outlined {
    font-size: .95em;
    font-variation-settings: 'FILL' 1, 'wght' 600;
}

.availability-badge-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.availability-badge.is-missing {
    background: var(--danger);
    color: var(--text-primary);
}

.availability-badge.is-withdrawn {
    background: var(--border-strong);
    color: var(--text-primary);
}

/* Where each place puts it: a card's picture, bottom left; an entry's page, beside its type. */
.entry-availability-badge {
    position: absolute;
    z-index: 3;
    left: var(--space-2);
    bottom: var(--space-2);
    max-width: calc(100% - 2 * var(--space-2));
}

.detail-availability {
    margin: var(--space-1) 0;
    font-size: .75rem;
}

.entry-poster-wrapper {
    flex-grow: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;

    transition:
        transform var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        filter var(--transition);
}

/*
 * The card keeps what it holds to itself except while hovered, so the glow and the lift are not cut
 * off at its edges. (Clipped rather than hidden at rest: a hidden overflow can still be scrolled, and
 * the browser scrolls a card sideways to show its menu's first item when the menu opens.)
 */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover {
    overflow: visible;
    transform: translateY(-4px);
}

.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper {
    z-index: 1;
    transform: translateY(-3px);
    isolation: isolate;
    /* Local sandbox for z-index: -1 */
    overflow: visible;
    /* Allows the rotating outline to stick out */
    transition: transform var(--transition), border-radius var(--transition);
    border-radius: var(--radius-lg);
}

.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper .entry-poster {
    border: 0;
}

/* ==========================================================================
   NEW: DVD SHEEN EFFECT (Using ::before to avoid clashing with the border)
   ========================================================================== */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder) .entry-poster-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    /* Sits cleanly over card imagery */

    /*
     * The pseudo-element never moves: the band of light slides across its background. A clip-path
     * moves with a transform, so a sliding element carried its clip with it and the light showed
     * past the card while the wrapper is overflow: visible (for the glow).
     */
    border-radius: var(--radius-lg);
    clip-path: inset(0 round var(--radius-lg));

    /* Tilted white metallic gradient */
    background: linear-gradient(115deg,
            rgb(255 255 255 / 0) 35%,
            rgb(255 255 255 / 0.08) 41%,
            rgb(255 255 255 / 0.78) 50%,
            /* Core reflection intensity */
            rgb(255 255 255 / 0.08) 59%,
            rgb(255 255 255 / 0) 65%) no-repeat;
    background-size: 300% 100%;
    background-position: 100% 0;

    transition: background-position 0.85s cubic-bezier(.2, .7, .2, 1), opacity 0.2s ease;
    opacity: 0;
}

/* Trigger the sheen swipe on hover */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper::before {
    opacity: 1;
    background-position: 0 0;
}

/* ==========================================================================
   EXISTING: The Layout-Independent Rotating Outline (Kept as ::after)
   ========================================================================== */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder) .entry-poster-wrapper::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: var(--radius-lg);
    border: 3px solid transparent;
    background-image: linear-gradient(var(--bg-primary), var(--bg-primary)), conic-gradient(from var(--outline-angle), #ff007f, #ff7b00, #ffea00, #00f5d4, #7b2cbf, #ff007f);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Activate the rotation on hover */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper::after {
    opacity: 1;
    animation: spinRetroOutline 3s linear infinite;
}

/* --- THE ROTATION ENGINE --- */
/* This tells the browser how to mathematically rotate gradient degrees smoothly */
@property --outline-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@keyframes spinRetroOutline {
    from {
        --outline-angle: 0deg;
    }

    to {
        --outline-angle: 360deg;
    }
}

/* Its picture greyed, not the whole card: the availability badge on it keeps its colour. */
.entry-card.is-missing {
    opacity: 0.8;
}

.entry-card.is-missing .entry-poster {
    filter: grayscale(100%);
    transition: filter var(--transition-fast);
}

.entry-card.is-missing:hover .entry-poster {
    filter: grayscale(0%);
}

.entry-card-episode {
    flex-basis: 18rem;
}

.entry-card.is-active .entry-poster-wrapper {
    outline: 2px solid var(--accent);
}

.entry-card.is-active .entry-detail .entry-title,
.entry-card.is-active .entry-detail .entry-subtitle {
    color: var(--accent);
}


.entry-poster {
    aspect-ratio: 2/3;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    border-top: 4px solid var(--entry-type-color, var(--border));
    object-fit: cover;
    border-radius: var(--radius-lg);
    transition:
        transform var(--transition),
        border var(--transition);
    overflow-clip-margin: unset;
    overflow: hidden;
}

.entry-detail {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-1);
    text-align: center;
    z-index: 10;
    opacity: 1;
    transform: translateY(0%);
    transition: opacity var(--transition),
        transform var(--transition);
}

.entry-title {
    flex: 1;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.87rem;
    font-weight: 680;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-subtitle {
    overflow: hidden;
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

/* The entry's average score, a tab in the poster's top-left corner opposite the type badge. */
.entry-card-rating {
    position: absolute;
    z-index: 2;
    top: 0.725rem;
    left: 0.5rem;
    display: inline-flex;
    gap: 2px;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-lg);
    background: rgb(18 18 26 / .82);
    box-shadow: var(--shadow-sm);
    color: #fff;
    font-size: .72rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    transform: translateY(0%);
    transition: transform var(--transition), opacity var(--transition);
}

.entry-card:hover .entry-card-rating {
    opacity: 0;
    transform: translateY(-100%);
}

.entry-card-rating .material-symbols-outlined {
    color: var(--warning);
    font-size: .85rem;
    font-variation-settings: 'FILL' 1;
}

/* Below the view count or the shared-file badge, which sit in the same corner. */
.entry-card:has(> .entry-watch-count-badge) .entry-card-rating,
.entry-card.is-shared-file-stack .entry-card-rating {
    top: var(--space-7);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

.entry-card.is-shared-file-stack:has(> .entry-watch-count-badge) .entry-card-rating {
    top: calc(var(--space-7) * 2);
}

.entry-wrapper .btn-next {
    grid-column: 1 / -1;
    justify-self: center;
    min-width: 9rem;
    margin-top: var(--space-3);
}


/* =========================================================
   Offcanvas
   ========================================================= */

.filter-offcanvas {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 1001;
    display: flex;
    width: min(28rem, 94vw);
    height: 100vh;
    flex-direction: column;
    padding: 0;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
    transform: translateX(100%);
    transition: transform var(--transition);
}

.filter-offcanvas.is-open {
    transform: translateX(0);
}

.filter-offcanvas-head {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.25rem;
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    backdrop-filter: blur(16px);
}

.filter-offcanvas-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.offcanvas-close {
    width: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
    font-size: 1.25rem;
}

.filter-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: var(--space-2);
    padding: var(--space-4);
}

.offcanvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: block;
    border: 0;
    background: rgb(3 3 7 / 0.68);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(2px);
    transition: opacity var(--transition);
}

.offcanvas-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.has-offcanvas {
    overflow: hidden;
}


/* =========================================================
   Filter fields
   ========================================================= */

.filter-field {
    padding: 0;
    margin: 0;
    border: 0;
}

.filter-field legend {
    margin-bottom: var(--space-2);
    padding: 0;
    color: var(--text-secondary);
    font-weight: 750;
}

.filter-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

[hidden] {
    display: none;
}

.filter-range label {
    display: grid;
    gap: var(--space-2);
}

.filter-range label>span {
    color: var(--text-muted);
    font-size: 0.75rem;
}


/* =========================================================
   Multiselect
   ========================================================= */

.multiselect {
    position: relative;
    width: 100%;
}

.multiselect-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    list-style: none;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.multiselect-summary::-webkit-details-marker {
    display: none;
}

.multiselect-summary::marker {
    content: "";
}

.multiselect-summary:hover {
    border-color: var(--border-strong);
    background: var(--bg-tertiary);
}

.multiselect[open] .multiselect-summary {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.multiselect-summary-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-summary-label {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    min-width: 0;
}

.multiselect-placeholder {
    color: var(--text-muted);
}

.multiselect-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 100%;
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-pill);
    background: var(--accent-dim);
    color: var(--text-primary);
    font-size: .72rem;
}

.multiselect-chip>span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-chip button {
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    line-height: 1;
}

.multiselect-chip button:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
}

.multiselect-chevron {
    width: 0.45rem;
    height: 0.45rem;
    margin-left: var(--space-4);
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-0.12rem) rotate(45deg);
    transition: transform var(--transition-fast);
}

.multiselect[open] .multiselect-chevron {
    transform: translateY(0.12rem) rotate(225deg);
}

.multiselect-dropdown {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
}

.multiselect-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.multiselect-clear {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-hover);
    font-weight: 650;
}

.multiselect-clear:hover {
    color: #fff;
}

.multiselect-options {
    display: grid;
    max-height: 18rem;
    overflow-y: auto;
}

.multiselect-option {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2);
    color: var(--text-primary);
    transition:
        color var(--transition-fast),
        background-color var(--transition-fast);
    background: transparent;
}

.multiselect-option {
    width: 100%;
    border: 0;
    text-align: left;
}

.multiselect-option.is-selected {
    background: var(--accent-dim);
    color: var(--text-primary);
}

.multiselect-option:hover {
    background: var(--bg-hover);
}

.multiselect-option:has(input:checked) {
    background: var(--accent-dim);
    color: #fff;
}

.multiselect-option:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.multiselect-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.multiselect-check {
    position: relative;
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.multiselect-option input:checked+.multiselect-check {
    border-color: var(--accent);
    background: var(--accent);
}

.multiselect-option input:checked+.multiselect-check::after {
    content: "";
    position: absolute;
    top: 0.1rem;
    left: 0.3rem;
    width: 0.25rem;
    height: 0.5rem;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}

.multiselect-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-option-count {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.filter-fields .filter-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.multiselect-sm .multiselect-summary,
.form-input-sm,
.form-select-sm,
.form-textarea-sm {
    font-size: small;
    padding: var(--space-2);
}

.form-select-sm {
    padding-right: var(--space-6);
}

.form-input-sm.form-input-search {
    padding-left: var(--space-6);
}

.filter-search-control {
    flex: 0 0 100%;
    order: 1;
}

.filter-field-sm .multiselect .multiselect-summary,
.filter-field-sm .form-input,
.filter-field-sm .form-select,
.filter-field-sm .form-textarea {
    font-size: small;
    padding: var(--space-2);
}

.filter-field-sm legend {
    font-size: small;
}

.library-filter-switch {
    block-size: 1.25rem;
}

.library-filter-switch .switch-label {
    font-size: small;
}

/* =========================================================
   Feedback
   ========================================================= */

.error {
    padding: var(--space-3) var(--space-4);
    border: 1px solid rgb(239 95 101 / 0.3);
    border-radius: var(--radius);
    background: var(--danger-dim);
    color: #ffb2b5;
}

.section-loader {
    grid-column: 1 / -1;
    padding: var(--space-7);
    color: var(--text-muted);
    text-align: center;
}

/* =========================================================
   Settings
   ========================================================= */

.settings-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-bottom: var(--space-7);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}


/* Settings overview */

.link-card-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(21rem, 100%), 1fr));
    gap: var(--space-4);
}

.settings-overview-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.settings-overview-heading {
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.active-user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: var(--space-4);
    margin-top: var(--space-3);
}

.active-user-card {
    padding: var(--space-4);
}

.active-user-card header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.active-client {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.active-client-head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
}

.active-client-head small,
.active-client-page {
    color: var(--text-muted);
}

.active-client-page {
    margin: var(--space-1) 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-playback-summary {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.active-playback-summary .panel {
    flex: 0 1 320px;
}

.active-playback-summary .panel .panel-header > div {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    font-size: small;
}

.active-playback-summary .panel .panel-header {
    padding: var(--space-2);
}

.active-playback-lines {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    list-style: none;
}

.active-playback-line {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: small;
}

.active-playback-line .material-symbols-outlined {
    flex: none;
    color: var(--accent);
}

.active-playback-line.is-user .material-symbols-outlined {
    color: var(--text-muted);
}

.active-playback-line-text {
    display: grid;
    min-width: 0;
}

.active-playback-line-text a,
.active-playback-line-text strong {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-playback-line-text small {
    color: var(--text-muted);
}

.active-playback {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
}

.active-playback progress {
    width: 100%;
}

.active-playback-head,
.active-playback-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}

.active-playback-head a {
    min-width: 0;
    overflow: hidden;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-playback-head small,
.active-playback-meta small {
    color: var(--text-muted);
}

.active-playback-head small {
    flex: none;
    text-transform: capitalize;
}

.active-playback-meta {
    align-items: center;
}

.active-playback-meta strong {
    flex: none;
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 600;
}

.active-playback-stale,
.active-playback-subtitle.is-warning {
    color: var(--warning);
}

.active-playback-subtitle {
    color: var(--text-muted);
}

.activity-list-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.activity-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    margin: 0;
}

.activity-item.is-danger {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.activity-item > .material-symbols-outlined {
    color: var(--text-muted);
}

.activity-item.is-danger > .material-symbols-outlined {
    color: var(--danger);
}

.activity-title {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-datetime {
    color: var(--text-muted);
    white-space: nowrap;
}

.link-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-4);
    min-height: 10rem;
    padding: var(--space-4);
    color: inherit;
    text-decoration: none;
    transition:
        transform var(--transition),
        border-color var(--transition),
        background-color var(--transition),
        box-shadow var(--transition);
}

a.link-card:hover {
    z-index: 1;
    transform: translateY(-0.2rem);
    border-color: var(--accent-border);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow);
}

a.link-card:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.link-card.is-disabled {
    opacity: 0.55;
}

.link-card-icon {
    display: flex;
    width: 2.85rem;
    height: 2.85rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    background: var(--accent-dim);
    color: var(--accent-hover);
    font-size: 1.15rem;
    font-weight: 750;
    line-height: normal;
}

.link-card-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.link-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.link-card-heading h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 720;
}

.link-card-arrow {
    color: var(--text-muted);
    font-size: 1.15rem;
    transition:
        color var(--transition-fast),
        transform var(--transition-fast);
}

a.link-card:hover .link-card-arrow {
    color: var(--accent-hover);
    transform: translateX(0.2rem);
}

.link-card-content p {
    margin: var(--space-2) 0 var(--space-4);
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.55;
}

.link-card-meta {
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}


/* Breadcrumbs */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent-hover);
}

.breadcrumbs [aria-current="page"] {
    color: var(--text-primary);
}

.panel-body {
    padding: var(--space-4);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    background:
        linear-gradient(180deg,
            var(--surface-sheen),
            transparent),
        var(--bg-tertiary);
}

.surface.accent {
    background: var(--accent-dim);
}

.surface.accent .panel-header {
    background:
    linear-gradient(180deg,
        var(--surface-sheen),
        transparent),
    var(--accent-soft);
}



.panel-header:not(:has(+ .panel-body)) {
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.panel-header h1,
.panel-header h2,
.panel-header h3,
.panel-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.panel-header p {
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.panel-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4);
}


/* =========================================================
   Responsive application shell
   ========================================================= */







/* =========================================================
   Folder form
   ========================================================= */

.folder-form label,
.folder-form .form-group,
.folder-form .field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.folder-form label>span,
.folder-form .form-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 650;
}

.folder-form input:not([type="checkbox"]):not([type="radio"]),
.folder-form select,
.folder-form textarea {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.folder-form input:not([type="checkbox"]):not([type="radio"]),
.folder-form textarea {
    padding: var(--space-1) var(--space-2);
}

.folder-form select {
    appearance: none;
    padding: var(--space-1) var(--space-2);
    background-image:
        linear-gradient(45deg,
            transparent 50%,
            var(--text-muted) 50%),
        linear-gradient(135deg,
            var(--text-muted) 50%,
            transparent 50%);
    background-position:
        calc(100% - 1rem) 50%,
        calc(100% - 0.7rem) 50%;
    background-size: 0.32rem 0.32rem;
    background-repeat: no-repeat;
}

.folder-form input:hover,
.folder-form select:hover,
.folder-form textarea:hover {
    border-color: var(--border-strong);
    background-color: var(--bg-secondary);
}

.folder-form input:focus,
.folder-form select:focus,
.folder-form textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.folder-form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.folder-form button[type="submit"]:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
}

.folder-form button[type="submit"]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* =========================================================
   Section layout: a sidebar of a section's pages beside the page
   ========================================================= */

.section-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}

.section-sidebar {
    position: sticky;
    top: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.section-sidebar-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-3);
    list-style: none;
    cursor: pointer;
}

.section-sidebar-heading::-webkit-details-marker {
    display: none;
}

.section-sidebar-heading small {
    grid-column: 1;
    color: var(--text-muted);
}

.section-sidebar-toggle {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.section-sidebar[open] .section-sidebar-toggle {
    transform: rotate(180deg);
}

.section-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.section-sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-sidebar-group-label {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-2);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.section-sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
}

.section-sidebar-link .material-symbols-outlined {
    font-size: 1.2rem;
}

.section-sidebar-link:hover {
    background: var(--accent-dim);
    color: var(--text-primary);
}

.section-sidebar-link.is-active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

/* On a wide screen the sidebar always stands open beside the page; only a narrow one folds it. */
@media (min-width: 992px) {
    .section-sidebar-heading {
        pointer-events: none;
        cursor: default;
    }

    .section-sidebar-toggle,
    .section-sidebar-heading small {
        display: none;
    }
}

@media (width < 992px) {
    .section-layout {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .section-sidebar {
        position: static;
    }

    .section-sidebar:not([open]) .section-sidebar-heading {
        padding-bottom: var(--space-1);
    }
}

/* =========================================================
   Settings blocks
   ========================================================= */

.panel .panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.panel-flush {
    min-width: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: var(--space-4);
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--notice-border);
    border-radius: var(--radius-sm);
    background: var(--notice-background);
    color: var(--text-primary);
    font-size: 0.85rem;
    --notice-color: var(--accent);
    --notice-border: color-mix(in srgb, var(--notice-color) 45%, var(--border-strong));
    --notice-background: color-mix(in srgb, var(--notice-color) 10%, transparent);
}

.notice.is-warning { --notice-color: var(--warning); }
.notice.is-error { --notice-color: var(--danger); }
.notice.is-success { --notice-color: var(--success); }

.notice > .material-symbols-outlined {
    color: var(--notice-color);
}

.notice-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.notice-body ul {
    margin: 0;
    padding-left: var(--space-4);
    color: var(--text-secondary);
}

.notice[hidden] {
    display: none;
}


/* =========================================================
   Configured folders
   ========================================================= */

.settings-folder-list {
    min-width: 0;
}

.folder-list {
    display: grid;
    gap: 0;
}

.folder-list-item .scan-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.folder-list-item .scan-label {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.folder-list-item .scan-label small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.radial-progress {
    --bar-color: var(--accent);
    --bar-thickness: 1px;
    --track-color: #ddd;
    display: grid;
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#705df2 var(--value), #e2e2e2 0);
    --thickness: 8px;
    -webkit-mask: radial-gradient(circle, transparent calc(100% - var(--thickness)), black calc(100% - var(--thickness) + 0.5px));
    mask: radial-gradient(circle, transparent calc(100% - var(--thickness)), black calc(100% - var(--thickness) + 0.5px));
}

.radial-progress.is-intermediate {
    --value: 33%;
    animation: spin-circle 900ms linear infinite;
}

@keyframes spin-circle {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    display: grid;
    place-items: center;
    align-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    margin: 0;
    color: var(--text-muted);
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-2);
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--accent-hover);
    font-size: 1.2rem;
}

.empty-state h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.empty-state p {
    max-width: 23rem;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.settings-folder-list-panel {
    overflow: hidden;
}

.folder-states {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.folder-watch-status {
    color: var(--text-muted);
    opacity: 0.8;
}

.folder-watch-status.is-watching {
    color: var(--accent);
}

.folder-storage-summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.folder-storage-bar {
    position: relative;
    flex: none;
    width: 4.5rem;
    height: 0.375rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.folder-storage-bar::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--used, 0%);
    border-radius: inherit;
    background: var(--accent);
    content: '';
}

.folder-storage-summary.is-low {
    color: var(--warning);
}

.folder-storage-summary.is-low .folder-storage-bar::after {
    background: var(--warning);
}

.folder-storage-warning {
    flex: none;
    color: var(--warning);
    font-size: 1rem;
}

.folder-low-space-notice {
    margin: var(--space-3) var(--space-4) 0;
}

.folder-type-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    background: rgb(255 255 255 / 0.02);
    transition: background var(--transition), box-shadow var(--transition);
}

/* The library a dragged folder would join, if not its own. */
.folder-type-group.is-drop-target {
    background: var(--accent-dim);
    box-shadow: inset 3px 0 0 var(--accent);
}

.folder-type-heading {
    flex: 1 1 14rem;
    min-width: 0;
    margin: 0;
    font-size: 0.95rem;
}

.folder-type-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.folder-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.folder-group-tag {
    padding: 0 var(--space-2);
    border: 1px solid var(--accent-border, var(--border-strong));
    border-radius: var(--radius-pill);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.folder-type-group.is-group {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.folder-group-note {
    margin: 0;
    padding: var(--space-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
}

/* The shared settings sit in the form as if written into it. */
.folder-settings-fields {
    display: contents;
}

.folder-settings-fields[hidden],
.folder-group-note[hidden] {
    display: none;
}

.folder-type-chevron {
    color: var(--text-muted);
    transition: transform var(--transition);
}

.folder-type-group.is-collapsed .folder-type-chevron {
    transform: rotate(-90deg);
}

.folder-type-count {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
}

.folder-type-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

/* The type icons wear the entry type badge's colour, round. */
.folder-type-badge {
    display: inline-flex;
    flex: none;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 100%;
    font-size: 1.1rem;
}

.folder-type-badge[data-folder-type='movie'] { --entry-type-color: #e056fd; }
.folder-type-badge[data-folder-type='tv'] { --entry-type-color: #5f8cff; }
.folder-type-badge[data-folder-type='mixed'] { --entry-type-color: #36c9c6; }
.folder-type-badge[data-folder-type='music'] { --entry-type-color: #ff9f43; }
.folder-type-badge[data-folder-type='karaoke'] { --entry-type-color: #ff6b81; }
.folder-type-badge[data-folder-type='books'] { --entry-type-color: #d8e062; }
.folder-type-badge[data-folder-type='audiobooks'] { --entry-type-color: #f5bd4f; }
.folder-type-badge[data-folder-type='documents'] { --entry-type-color: #94a3ff; }

.folder-list-item[hidden] {
    display: none;
}

.folder-list-item .folder-path {
    min-width: 0;
    overflow-wrap: anywhere;
}

.folder-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.folder-title > .folder-states {
    flex: 0 0 auto;
}


/* =========================================================
   Section heading
   ========================================================= */

.section {
    min-width: 0;
}

.section+.section {
    margin-top: var(--space-4);
}

.section-head {
    display: grid;
    grid-template-columns: auto minmax(2rem, 1fr) auto;
    align-items: center;
    gap: var(--space-4);
}

.section-head-title {
    min-width: 0;
}

.section-subhead {
    grid-column: 1 / -1;
    flex: 0 0 100%;
    margin: var(--space-2) 0 0;
    font-size: small;
    font-weight: 600;
    color: var(--text-muted);
}

.entry-wrapper.is-slider > .section-subhead {
    flex: 0 0 auto;
    align-self: flex-start;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 0;
}

.section-head-rule {
    height: 1px;
    background:
        linear-gradient(90deg,
            var(--accent-border),
            var(--border),
            transparent);
}

/* A secret's field, and under it the box that clears what is stored (controls.js, SecretInput). */
.secret-input {
    display: grid;
    gap: var(--space-2);
}

.secret-input-clear {
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

/* Text said second: a row's description, a note under a control. Used across the app and plugins. */
.text-muted {
    color: var(--text-muted);
}

/* What a form says after saving, under its fields (folder/form.js and its kin). */
.form-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.form-message:empty {
    display: none;
}

/* The notices a settings page stacks above its form (settings-network.js). */
.network-status {
    display: grid;
    gap: var(--space-2);
}

.network-status:empty {
    display: none;
}

/* An update's release notes, line breaks kept (settings-updates.js). */
.update-notes {
    white-space: pre-line;
}

/* A plugin's edit dialog (page/plugins.js): its state, the switch, then its settings, spaced apart. */
.plugin-edit-body {
    display: grid;
    gap: var(--space-5);
}

.item-list-dialog-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.item-list-dialog-status p {
    margin: 0;
}

/* A provider's settings fields (plugin-runtime.js, mountSettingsFields). */
.plugin-settings-fields {
    display: grid;
    gap: var(--space-4);
}

/* "Show all" and a layout's own controls, at the end of the rule (section-header.js). */
.section-head-end {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.section-head-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 650;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.section-head-link:hover {
    color: var(--accent-hover);
}

.detail-overview {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* =========================================================
   Entry detail page
   ========================================================= */

.detail-page {
    max-width: none;
}

.entry-hero {
    position: relative;
    min-height: 30rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    background-image: var(--entry-hero-background), var(--detail-backdrop);

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: var(--shadow);
}

.entry-hero::after {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0;
    background:
        linear-gradient(90deg,
            rgb(11 11 16 / 0.98) 0%,
            rgb(11 11 16 / 0.9) 35%,
            rgb(11 11 16 / 0.46) 68%,
            rgb(11 11 16 / 0.72) 100%),
        linear-gradient(0deg,
            var(--bg-app),
            transparent 50%);

    border-radius: var(--radius-xl);
}

.entry-hero-inner {
    display: grid;
    align-items: center;
    grid-template-columns:
        minmax(12rem, 18rem) minmax(0, 44rem);
    gap: clamp(1.5rem, 4vw, 3rem);
    min-height: inherit;
    padding: clamp(1.25rem, 4vw, 3rem);
}

.entry-hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.detail-poster {
    width: 100%;
    aspect-ratio: 2 / 3;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow:
        0 24px 60px rgb(0 0 0 / 0.55);
    object-fit: cover;
    overflow-clip-margin: unset;
    overflow: hidden;
}

.detail-poster-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.detail-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.detail-breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.detail-breadcrumbs a:hover {
    color: var(--accent-hover);
}

.detail-breadcrumb-separator {
    color: var(--text-muted);
}

.detail-type {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--accent-hover);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    text-decoration: none;
}

.detail-title {
    max-width: 15ch;
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(2rem, 5vw, 4.25rem);
    font-weight: 780;
    line-height: 1;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.detail-title a {
    text-decoration: none;
}

.detail-episode-identity {
    margin: var(--space-3) 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

.detail-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.detail-facts span {
    display: inline-flex;
    align-items: center;
}

.detail-facts span+span::before {
    content: "";
    width: 0.25rem;
    height: 0.25rem;
    margin-inline: var(--space-3);
    border-radius: 50%;
    background: var(--text-muted);
}

.detail-watch-count,
.entry-list-watch-count {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.detail-genres {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.detail-genre {
    min-height: 1.75rem;
    padding: var(--space-1) var(--space-3);
    border-color: rgb(255 255 255 / 0.14);
    background: rgb(255 255 255 / 0.08);
    color: var(--text-primary);
    text-decoration: none;
}

.detail-genre:hover {
    border-color: var(--accent-border);
    background: var(--accent-dim);
}

.detail-overview {
    display: -webkit-box;
    max-width: 44rem;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

.detail-overview-block {
    display: flex;
    max-width: 44rem;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
}

.detail-overview-block .detail-overview {
    max-width: none;
}

/* A link in prose, not a control beside it: it continues the sentence above. */
.detail-overview-more {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.detail-overview-more:hover,
.detail-overview-more:focus-visible {
    text-decoration: underline;
}

.detail-overview-full {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.65;
    white-space: pre-wrap;
}

.detail-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    align-items: start;
    gap: var(--space-4);
}

.detail-panel {
    overflow: hidden;
}

.detail-panel-head {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.detail-panel-head h2 {
    margin: 0;
    font-size: 1rem;
}

.detail-panel-content {
    padding: var(--space-4);
}

.detail-summary {
    max-width: 70ch;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.75;
}

.detail-definition-list {
    display: grid;
    grid-template-columns: minmax(6rem, auto) minmax(0, 1fr);
    gap: 0;
    margin: 0;
}

.detail-definition-list dt,
.detail-definition-list dd {
    margin: 0;
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.detail-definition-list dt {
    padding-right: var(--space-4);
    color: var(--text-muted);
}

.detail-definition-list dd {
    color: var(--text-secondary);
    text-align: right;
}

.detail-definition-list dt:last-of-type,
.detail-definition-list dd:last-of-type {
    border-bottom: 0;
}


/* Loading skeleton */

.detail-skeleton {
    display: grid;
    grid-template-columns: minmax(12rem, 18rem) 1fr;
    gap: var(--space-6);
    min-height: 30rem;
    padding: var(--space-7);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-elevated);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg,
            transparent 20%,
            rgb(255 255 255 / 0.045) 45%,
            transparent 70%);
    transform: translateX(-100%);
    animation: skeleton-shimmer 1.4s infinite;
}

.detail-skeleton-poster {
    aspect-ratio: 2 / 3;
    align-self: center;
}

.detail-skeleton-content {
    display: grid;
    align-content: center;
    gap: var(--space-4);
}

.detail-skeleton-line {
    height: 1rem;
}

.detail-skeleton-title {
    width: min(30rem, 80%);
    height: 3.5rem;
}

.detail-skeleton-line.is-short {
    width: 35%;
}

.detail-skeleton-line.is-medium {
    width: 65%;
}

@keyframes skeleton-shimmer {
    to {
        transform: translateX(100%);
    }
}





/* =========================================================
   Entry list
   ========================================================= */

/* A list of entries is a plain list: rows under their heading, no box around them. */
.entry-wrapper.is-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.entry-wrapper.is-list > .item-list-row.track-row:not([hidden]) {
    padding-inline: 0;
}

.entry-poster-placeholder {
    display: grid;
    width: 100%;
    place-items: center;
    background:
        radial-gradient(circle at 30% 20%,
            var(--accent-soft),
            transparent 55%),
        var(--bg-primary);
    color: var(--accent-hover);
    font-size: 2rem;
    font-weight: 750;
}

.entry-card-album .entry-poster-placeholder,
.entry-card-album .entry-poster,
.entry-card-track .entry-poster-placeholder,
.entry-card-track .entry-poster,
.entry-card-artist .entry-poster-placeholder,
.entry-card-artist .entry-poster {
    aspect-ratio: 1;
}

.entry-detail-artist .detail-poster,
.entry-detail-album .detail-poster,
.entry-detail-track .detail-poster {
    aspect-ratio: 1;
}

.entry-card-episode .entry-poster-placeholder,
.entry-card-episode .entry-poster {
    aspect-ratio: 2/3;
}

.entry-detail-artist .detail-poster {
    border-radius: 50%;
}



.player-timeline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
}

.player-time {
    min-width: 2.8rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.player-time:last-child {
    text-align: right;
}

.player-seek-wrap {
    position: relative;
    min-width: 0;
}

.player-seek-wrap .player-seek {
    width: 100%;
}

/*
 * The preview above the seek bar: the frame at that point, framed by a thin border, and under it
 * the time on a label of its own, centred. The popover itself has no background, so the video
 * shows around both.
 */
.player-seek-popover {
    position: absolute;
    bottom: calc(100% + .65rem);
    left: clamp(2.8rem, var(--seek-preview-position, 0%), calc(100% - 2.8rem));
    z-index: 9;
    display: grid;
    justify-items: center;
    gap: var(--space-1);
    color: #fff;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
}

.player-seek-preview-time {
    padding: 0.15rem var(--space-2);
    border-radius: var(--radius-pill);
    background: rgb(0 0 0 / .82);
    text-align: center;
}

.player-seek-popover[hidden] {
    display: none;
}

.player-seek-preview-image {
    display: block;
    width: min(17rem, 44vw);
    aspect-ratio: 16 / 9;
    border: 2px solid rgb(255 255 255 / .85);
    border-radius: var(--radius);
    object-fit: cover;
    background: #111;
    box-shadow: 0 6px 18px rgb(0 0 0 / .45);
}

.player-seek-preview-image[hidden] {
    display: none;
}

.player-seek,
.player-volume {
    appearance: none;
    height: 0.3rem;
    margin: 0;
    border-radius: var(--radius-pill);
    outline: none;
    cursor: pointer;
    background:
        linear-gradient(90deg,
            var(--accent) 0,
            var(--accent) var(--progress, 0%),
            var(--border-strong) var(--progress, 0%),
            var(--border-strong) 100%);
}

.detail-settings {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.player-subtitle-select,
.player-version-select {
    max-width: 10rem;
    min-height: 2rem;
    padding: var(--space-1) var(--space-5) var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: .75rem;
}

.player-subtitle-select[hidden],
.player-version-select[hidden] {
    display: none;
}

.player-subtitle-select option {
    max-width: 24rem;
}

.detail-subtitle-select {
    width: auto;
    min-width: 14rem;
    max-width: 22rem;
}

.detail-subtitle-select[hidden] {
    display: none;
}

.detail-file-version {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-3);
}

.detail-file-version>div {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.detail-file-version>small {
    overflow-wrap: anywhere;
    color: var(--text-muted);
}

.detail-file-version.is-conflict {
    border-color: var(--warning, #d89b35);
}



.player-seek::-webkit-slider-thumb,
.player-volume::-webkit-slider-thumb {
    appearance: none;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.player-seek::-moz-range-thumb,
.player-volume::-moz-range-thumb {
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.player-seek:focus-visible,
.player-volume:focus-visible {
    box-shadow: var(--focus-ring);
}

.player-control-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.player-control-group {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.player-control-spacer {
    flex: 1;
}

.player-settings-wrap {
    position: relative;
}

.player-settings-button[hidden] {
    display: none;
}

.player-settings-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + .6rem);
    display: grid;
    width: min(22rem, calc(100vw - 1rem));
    max-height: min(24rem, 60vh, var(--settings-menu-room, 100vh));
    overflow-y: auto;
    padding: var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-primary) 94%, transparent);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    z-index: 8;
}

.player-settings-menu[hidden] {
    display: none;
}

/*
 * The menu lives in the controls layer, below the player's collapse and dismiss buttons (z-index 7),
 * which it can reach on a phone. While it is open, the whole layer goes above them.
 */
.player-controls:has(.player-settings-menu:not([hidden])) {
    z-index: 8;
}

/* Where there is more room below the button than above it (see placeSettingsMenu). */
.player-settings-menu.opens-down {
    top: calc(100% + .6rem);
    bottom: auto;
}

.player-settings-row,
.player-settings-choice,
.player-settings-back {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-3);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.player-playback-stats {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

.player-playback-stats .playback-stat-row {
    padding-inline: var(--space-3);
}

.player-settings-row:hover,
.player-settings-choice:hover:not(:disabled),
.player-settings-back:hover,
.player-settings-row:focus-visible,
.player-settings-choice:focus-visible,
.player-settings-back:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.player-settings-row small {
    overflow: hidden;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-settings-choice {
    grid-template-columns: 1.25rem minmax(0, 1fr);
}

.player-settings-choice:disabled {
    opacity: .45;
}

/* A line of explanation under a choice: what "Normalise loudness" found, say. */
.player-settings-note {
    display: block;
    max-width: 18rem;
    padding: 0.25rem 0.75rem 0.5rem 2.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

.player-settings-back {
    grid-template-columns: auto minmax(0, 1fr);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.player-gesture-hud {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-pill);
    background: rgb(0 0 0 / .72);
    color: #fff;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.player-gesture-hud[hidden] {
    display: none;
}

.player-gesture-surface {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.media-player.is-expanded .player-gesture-surface {
    pointer-events: auto;
    touch-action: none;
}

.media-player.is-expanded,
.media-player.is-expanded .media-player-stage {
    overscroll-behavior: none;
}

.player-volume {
    width: 6rem;
}

/* The volume: wide, the slider beside the mute button and the panel no box of its own; the
   panel's own mute button is for the narrow layout, below. */
.player-volume-control {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.player-volume-panel {
    display: contents;
}

.player-cast {
    width: 3rem;
    height: 3rem;
    padding: .75rem;
    --connected-color: #fff;
    --disconnected-color: currentColor;
}

.player-cast.is-active {
    border-color: #5f8cff;
    background: #3973f6;
    color: #fff;
    box-shadow: 0 0 0 1px rgb(95 140 255 / 0.35), 0 0.25rem 1rem rgb(57 115 246 / 0.3);
}

.player-cast.is-active:hover,
.player-cast.is-active:focus-visible {
    background: #5f8cff;
}

/* =========================================================
   Media player
   ========================================================= */

#activity-dock {
    position: fixed;
    z-index: 900;
    left: 0rem;
    right: 0rem;
    bottom: 0rem;
    display: grid;
    gap: var(--space-2);
    pointer-events: none;
}

#player-root,
#reader-root {
    min-width: 0;
}

#player-root > *,
#reader-root > * {
    pointer-events: auto;
}

.media-player {
    color: var(--text-primary);
}

.media-player.is-expanded.is-audio {
    background: var(--bg-primary);
    color: var(--text-primary);
}
/* 
.media-player.is-expanded.is-audio .player-control-button:not(.player-toggle),
.media-player .media-player-mini-controls .player-control-button:not(.player-toggle) {
    color: var(--text-primary);
} */


.media-player:fullscreen {
    width: 100vw;
    height: 100vh;
    background: #000;
}

.media-player:fullscreen .media-player-expanded {
    position: relative;
    width: 100%;
    height: 100%;
}

.media-player:fullscreen .media-player-surface {
    position: relative;
    width: 100%;
    height: 100%;
}

.media-player:fullscreen .media-player-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.media-player:fullscreen .media-player-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.media-player:fullscreen .media-player-artwork {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.media-player .player-controls {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    background: var(--bg-media-player-controls);
    z-index: 6;
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.media-player.is-controls-hidden {
    cursor: none;
}

.media-player.is-controls-hidden .player-controls {
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.75rem);
}

.media-player[hidden] {
    display: none;
}

/*
 * The component contains two separate views.
 * Only one may participate in layout at a time.
 */
.media-player.is-mini .media-player-expanded {
    display: none;
}

.media-player.is-expanded .media-player-mini {
    display: none;
}

.media-player-expanded-copy {
    display: grid;
    min-width: 0;
    max-width: min(32rem, 40vw);
    gap: var(--space-1);
}

.media-player-expanded-copy .media-player-title,
.media-player-expanded-copy .media-player-subtitle,
.player-playlist-copy .media-player-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.media-player-title,
.media-player-subtitle a,
.player-playlist-copy .media-player-subtitle {
    color: var(--text-primary);
    text-decoration: none;
}

.media-player-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-player-title:hover,
.media-player-subtitle a:hover,
.player-playlist-copy .media-player-subtitle a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.player-playlist-copy .media-player-subtitle,
.media-player-subtitle {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: smaller;
}

.media-player-subtitle-separator {
    color: var(--text-muted);
}

/* =========================================================
   Mini player
   ========================================================= */

.media-player.is-mini {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-top: 1px solid var(--border-strong);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}



.media-player-mini {
    display: flex; 
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
}



.media-player-mini-preview {
    flex-basis: 148px;
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #000;
    margin: 0 0 0 -0.5rem;
}

@media (width > 992px) {
    .media-player.is-mini.is-video {
        width: 25%;
        align-self: flex-end;
        justify-self: end;
        border-top: 0;
        margin: 0 var(--space-2) var(--space-2) 0;
        border-radius: var(--radius);
    }

    .media-player.is-mini.is-video .media-player-mini {
        flex-direction: column;
    }

    .media-player.is-mini.is-video .media-player-mini-preview {
        flex-basis: 100%;
    }
}

.media-player-mini .player-seek {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.5rem;
    z-index: 10;
}

.media-player-mini-seek {
    grid-column: 1 / -1;
    width: 100%;
    height: 0.35rem;
    margin: -0.25rem 0 0;
}

.playback-stat-list {
    display: grid;
    gap: var(--space-2);
    margin: 0;
}

.playback-stat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-2);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
}

.playback-stat-row dt,
.playback-stat-row dd,
.playback-stat-source,
.playback-stat-route {
    min-width: 0;
    margin: 0;
}

.playback-stat-row dt,
.playback-stat-source {
    display: grid;
    gap: .1rem;
}

.playback-stat-row dt > span,
.playback-stat-source strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playback-stat-row dt small,
.playback-stat-source small {
    color: var(--text-muted);
    font-size: .68rem;
}

.playback-stat-row dd,
.playback-stat-route {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 600;
    text-align: right;
}

.playback-stat-row.is-transcode dd,
.playback-stat-row.is-transcode .playback-stat-route {
    color: var(--warning);
}

.playback-stat-row.is-remux dd,
.playback-stat-row.is-remux .playback-stat-route {
    color: var(--accent-hover);
}

.playback-stat-output {
    white-space: nowrap;
}

.media-player-mini-copy {
    flex: 1;
    display: grid;
    min-width: 0;
}

.media-player-title,
.media-player-subtitle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-player-title {
    font-size: small;
    font-weight: 680;
}

.media-player-mini-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-1);
}

.media-player-mini-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
}

.media-player-mini .player-toggle {
    width: 2.75rem;
    height: 2.75rem;
}

/* The mini player's cast button: the same launcher, sized with the buttons beside it. */
.media-player-mini-cast {
    width: 2.5rem;
    height: 2.5rem;
    padding: .6rem;
}

.media-player .player-toggle:hover:not(:disabled) {
    color: #fff;
}

/* =========================================================
   Expanded player layout
   ========================================================= */

.media-player.is-expanded {
    position: fixed;
    z-index: 1100;
    inset: 0;
    background: #111;
}

.media-player-expanded {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.media-player-playlist[hidden] {
    display: none;
}

.media-player:-webkit-full-screen .media-player-expanded,
.media-player:fullscreen .media-player-expanded {
    grid-template-columns: 1fr;
}

.media-player:-webkit-full-screen .media-player-playlist,
.media-player:fullscreen .media-player-playlist {
    display: none;
}

/*
 * When no playlist is visible, let the surface use the full width.
 */
.media-player-expanded:has(> .media-player-playlist[hidden]) {
    grid-template-columns: minmax(0, 1fr);
}


/* =========================================================
   Media surface
   ========================================================= */

.media-player-surface {
    flex: 1;
    display: grid;
    grid-template-rows:
        minmax(0, 1fr) auto;

    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.media-player-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    place-items: center;
}

.media-player-element {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}


/* =========================================================
   Video poster / audio artwork
   ========================================================= */

.media-player-artwork {
    pointer-events: none;
}

.media-player-artwork[hidden],
.media-player-artwork-placeholder[hidden] {
    display: none;
}

.media-player-artwork-placeholder,
.media-player-mini-artwork-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: var(--bg-primary);
}

.media-player-artwork-placeholder {
    font-size: 3rem;
}

.media-player-mini-artwork-placeholder  {
    font-size: 2rem;
}

/* Styling the hidden blueprint element */
.drag-ghost-preview {
    position: absolute;
    top: 0;  /* Pushes the element off-screen so users don't see a duplicate */
    left: 0;
    height: auto;
    opacity: 0.8;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/*
 * Video artwork acts as a temporary poster.
 * It is absolutely positioned and therefore cannot affect layout.
 */
.media-player.is-video .media-player-artwork:not([hidden]) {
    position: absolute;
    z-index: 2;
    inset: 0;

    display: block;
    width: 100%;
    height: 100%;

    background: #000;
    object-fit: contain;

    opacity: 0;
    transition: opacity var(--transition);
}

.media-player.is-video.is-media-loading .media-player-artwork {
    opacity: 1;
}

/*
 * For audio, hide the actual video surface and show square artwork.
 */
.media-player.is-audio .media-player-element {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.media-player.is-karaoke .media-player-element {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.media-player.is-audio .media-player-artwork {
    position: relative;
    z-index: 1;
    max-height: 50%;
    max-width: 50%;

    width: min(20rem, 70vw);
    height: auto;
    max-width: 100%;
    max-height: 65vh;
    aspect-ratio: 1;

    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    object-fit: cover;
    opacity: 1;
}


.media-player.is-video .media-player-expanded .media-player-title,
.media-player.is-video .media-player-expanded .media-player-subtitle a,
.media-player.is-video .media-player-expanded .player-playlist-copy .media-player-subtitle {
    color: #fff;
}

/* =========================================================
   Loading state
   ========================================================= */

.media-player-loading {
    position: absolute;
    z-index: 3;

    width: 2.5rem;
    height: 2.5rem;

    border: 3px solid rgb(255 255 255 / 0.2);
    border-top-color: #fff;
    border-radius: 50%;

    opacity: 0;
    pointer-events: none;
    animation: player-spin 800ms linear infinite;
}

.media-player.is-media-loading .media-player-loading {
    opacity: 1;
}

.media-player.is-media-loading .player-prev,
.media-player.is-media-loading .player-next,
.media-player.is-media-loading .player-toggle,
.media-player.is-media-loading .player-mute,
.media-player.is-media-loading .player-settings-button,
.media-player.is-media-loading .player-seek,
.media-player.is-media-loading .player-volume,
.media-player.is-media-loading .player-cast {
    opacity: 0.35;
    cursor: wait;
}

@keyframes player-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   Custom controls
   ========================================================= */

.player-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    z-index: 1;
    backdrop-filter: blur(4px);
}

.player-timeline {
    display: grid;
    grid-template-columns:
        auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
}

.player-time {
    min-width: 2.8rem;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.media-player.is-video .player-time {
    color: #fff;
}

/* The length, with when it would end beneath it. */
.player-time-total {
    display: grid;
    justify-items: end;
    line-height: 1.2;
}

.player-end-time {
    font-size: 0.62rem;
    opacity: 0.7;
    white-space: nowrap;
}

.player-time:last-child {
    text-align: right;
}

.player-seek,
.player-volume {
    appearance: none;
    height: 0.3rem;
    margin: 0;
    border: 0;
    border-radius: var(--radius-pill);
    outline: none;

    background:
        linear-gradient(90deg,
            var(--accent) 0,
            var(--accent) var(--progress, 0%),
            var(--border-strong) var(--progress, 0%),
            var(--border-strong) 100%);
}

.player-seek::-webkit-slider-thumb,
.player-volume::-webkit-slider-thumb {
    appearance: none;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.player-seek::-moz-range-thumb,
.player-volume::-moz-range-thumb {
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.player-seek:focus-visible,
.player-volume:focus-visible {
    box-shadow: var(--focus-ring);
}

.player-control-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.player-control-group {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.player-control-spacer {
    flex: 1;
}

.player-control-button {
    display: flex;
    align-items: center;
    justify-content: center;
    place-items: center;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-primary);
    padding: var(--space-4);
    font-size: 1rem;
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.player-control-button:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-secondary-hover);
}

.player-control-button:active:not(:disabled) {
    transform: scale(0.94);
}

.player-control-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.player-control-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.player-toggle {
    background: var(--accent);
    color: #fff;
    font-size: 2rem;
    padding: var(--space-2);
}

.player-toggle:hover:not(:disabled) {
    background: var(--accent-hover);
}

.player-collapse-button,
.player-dismiss-button {
    position: absolute;
    top: 1rem;
    opacity: 1;
    z-index: 7;
    font-size: 2rem;
}

.media-player.is-controls-hidden .player-collapse-button,
.media-player.is-controls-hidden .player-dismiss-button {
    opacity: 0;
}

.media-player.is-controls-hidden .media-player-mini .player-dismiss-button {
    opacity: 1;
}

.media-player.is-media-loading {
    cursor: default;
}

.media-player.is-media-loading .player-collapse-button,
.media-player.is-media-loading .player-dismiss-button {
    opacity: 1;
}

.player-collapse-button {
    left: 1rem;
}

.player-dismiss-button {
    right: 1rem;
}

.media-player-mini .player-dismiss-button {
    font-size: 1rem;
}


/* =========================================================
   Playlist
   ========================================================= */

.media-player-playlist {
    flex-basis: 33%;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
}

.media-player-playlist-head {
    position: sticky;
    z-index: 2;
    top: 0;

    display: none;
    align-items: center;
    justify-content: space-between;

    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    backdrop-filter: blur(16px);
}

@media (width >= 992px) {
    .media-player-playlist-head {
        display: flex;
    }
}

.media-player-playlist-head h2 {
    margin: 0;
    font-size: 1rem;
}

.media-player-playlist-head small {
    color: var(--text-muted);
}

.media-player-playlist-items {
    display: grid;
}

.player-playlist-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);

    width: 100%;
    padding: var(--space-3) var(--space-3);

    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: inherit;
    text-align: left;
    border-left: 4px solid transparent;
    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast);
}

.player-playlist-item:hover {
    background: var(--bg-hover);
}

.player-playlist-item.is-active {
    border-left: 4px solid var(--accent);
    background: var(--accent-dim);
}

.player-playlist-index {
    flex-basis: 1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.player-playlist-item.is-active .player-playlist-index {
    color: var(--accent-hover);
}

.player-playlist-image {
    width: 2rem;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    object-fit: cover;
}

.media-player.is-audio .player-playlist-image {
    aspect-ratio: 1;
}

.player-playlist-image.is-placeholder {
    display: grid;
    place-items: center;
    color: var(--accent-hover);
    font-size: 1.1rem;
}

.player-playlist-copy {
    flex: 1;
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.player-playlist-title,
.player-playlist-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-playlist-title {
    color: var(--text-primary);
    font-size: 0.82rem;
}

.player-playlist-subtitle {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.player-playlist-subtitle a {
    text-decoration: none;
}

.player-playlist-subtitle a:hover {
    text-decoration: underline;
}

.player-playlist-duration {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}


/* =========================================================
   Responsive player
   ========================================================= */





.app-dialog {
    width: min(36rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: hidden;

    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

/* A question before an action (dialog.js, confirmDialog): narrower, its message kept as written. */
.confirm-dialog {
    width: min(28rem, calc(100vw - 2rem));
}

.confirm-dialog-message {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: pre-line;
}

.app-dialog::backdrop {
    background: rgb(3 3 7 / 0.72);
    backdrop-filter: blur(3px);
}

.app-dialog-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: inherit;
}

.app-dialog-header,
.app-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-4);
}

.app-dialog-header {
    border-bottom: 1px solid var(--border);
}

.app-dialog-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.app-dialog-header p {
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.app-dialog-body {
    display: grid;
    gap: var(--space-4);
    overflow: hidden auto;
    padding: var(--space-4);
}

.app-dialog-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.form-help {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.detail-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* The hero's main button: a pill in the accent, its icon in a circle filling the pill's rounded end. */
.detail-play-button {
    position: relative;
    min-height: 3.25rem;
    padding: 0 var(--space-5, 1.5rem) 0 0;
    gap: var(--space-2);
    border: none;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    white-space: nowrap;
}

.detail-play-button::before {
    content: attr(data-icon);
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    flex: 0 0 auto;
    font-family: 'Material Symbols Outlined';
    font-size: 1.75rem;
    font-weight: normal;
    line-height: 1;
    font-variation-settings: 'FILL' 1;
}

/* Play alone: just the circle. */
.detail-play-button.is-icon-only {
    padding: 0;
}

/*
 * Play with its other ways to play attached: lyrics and karaoke for a track, then where it was
 * left off and the cross that forgets it. The last segment closes the pill.
 */
.detail-play-group {
    display: inline-flex;
    align-items: stretch;
    border-radius: var(--radius-pill);
}

.detail-play-group .detail-play-button {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.detail-play-segment {
    position: relative;
    min-height: 3.25rem;
    padding: 0 var(--space-3);
    border: none;
    border-radius: 0;
    font-size: 1.25rem;
}

.detail-play-segment:last-child {
    padding-right: var(--space-4);
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

.detail-play-resume {
    font-size: 0.95rem;
    white-space: nowrap;
}

/* How far along a resumable entry is, as a bar beneath where it was left off. */
.detail-play-resume::after {
    content: "";
    position: absolute;
    left: var(--space-3);
    right: var(--space-3);
    bottom: 0.5rem;
    height: 3px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, rgb(255 255 255 / 0.85) var(--resume-progress, 0%), rgb(255 255 255 / 0.25) 0);
}

.detail-version-select,
.detail-subtitle-select {
    width: auto;
}

.detail-toggle-watched {
    background: 0;
    border: 0;
}

.detail-toggle-watched.is-watched {
    color: var(--success);
}

.dropdown-menu {
    position: relative;
}

.dropdown-menu.left .dropdown {
    left: 0;
}

.dropdown-menu.right .dropdown {
    right: 0;
}

.dropdown-menu.top .dropdown {
    bottom: calc(100% + var(--space-2));
}

.dropdown-menu.bottom .dropdown {
    top: calc(100% + var(--space-2));
}

.dropdown {
    position: absolute;
    z-index: 20;
    right: 0;
    bottom: calc(100% + 0.5rem);

    display: none;
    flex-direction: column;
    width: 13rem;
    overflow: hidden;

    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
    z-index: 10;
}

.dropdown-menu.is-open .dropdown {
    display: flex;
}

/*
 * A menu's z-index counts only inside the nearest stacking context, and the hero and the cards
 * are each one (isolation). What comes after them on the page -- the cast's cards, isolated in
 * turn -- would paint over an open menu, on a phone over the whole sheet. Raised while it is open,
 * under the fixed header.
 */
.entry-hero:has(.dropdown-menu.is-open),
.entry-card:has(.dropdown-menu.is-open) {
    z-index: 1000;
}

.dropdown-item {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2);

    width: 100%;
    min-height: 2.6rem;
    padding: var(--space-2) var(--space-3);
    text-decoration: none;

    border: 0;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
}

.dropdown-item:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.is-danger {
    color: #ff9da1;
}

.dropdown-item.is-danger:hover {
    background: var(--danger-dim);
}

.entry-actions-icon {
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.entry-actions-separator {
    height: 1px;
    background: var(--border);
}

/* =========================================================
   Lists
   ========================================================= */

ul,
ol {
    margin: var(--space-4) 0;
    padding-left: var(--space-5);

    color: var(--text-secondary);
    line-height: 1.7;
}

li {
    position: relative;
}

/* Spacing for prose lists only, as with the bullets below: a list with a class lays out its own items. */
:is(ul:not([class]), ul.bullet-list, ol:not([class]))>li {
    margin: var(--space-1) 0;
}

:is(ul:not([class]), ul.bullet-list, ol:not([class]))>li+li {
    margin-top: var(--space-2);
}

/* ---------------------------------------------------------
   Unordered lists
   --------------------------------------------------------- */

ul {
    list-style: none;
    padding-left: 0;
}

/*
 * Bullets for prose: a list without a class, or one that asks with .bullet-list. A list with a
 * class of its own is a piece of interface -- chips, rows, a menu -- and draws its own items.
 */
:is(ul:not([class]), ul.bullet-list)>li {
    padding-left: var(--space-5);
}

:is(ul:not([class]), ul.bullet-list)>li::before {
    content: "";

    position: absolute;
    top: 0.72em;
    left: 0.15rem;

    width: 0.45rem;
    height: 0.45rem;

    border-radius: var(--radius-pill);

    background: var(--accent);
    box-shadow:
        0 0 0 3px color-mix(in srgb,
            var(--accent) 15%,
            transparent);
}

/* Nested bullets */

ul ul>li::before {
    width: 0.38rem;
    height: 0.38rem;

    background: color-mix(in srgb,
            var(--accent) 70%,
            white);
}

ul ul ul>li::before {
    background: transparent;
    border: 2px solid var(--accent);
}

/* ---------------------------------------------------------
   Ordered lists
   --------------------------------------------------------- */

ol {
    padding-left: 0;
    list-style: none;
    counter-reset: app-list;
}

ol>li {
    counter-increment: app-list;
    padding-left: var(--space-6);
}

/* 
ol>li::before {
    content: counter(app-list);

    position: absolute;
    left: 0;
    top: 0.1rem;

    display: flex;
    justify-content: center;
    align-items: center;

    width: 1.6rem;
    height: 1.6rem;

    border-radius: var(--radius-pill);

    background: color-mix(in srgb,
            var(--accent) 18%,
            var(--bg-card));

    border: 1px solid color-mix(in srgb,
            var(--accent) 35%,
            transparent);

    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
} */

/* ---------------------------------------------------------
   Nested lists
   --------------------------------------------------------- */

li>ul,
li>ol {
    margin-top: var(--space-2);
    margin-bottom: var(--space-1);
    padding-left: var(--space-4);
}

/* ---------------------------------------------------------
   Lists inside cards / surfaces
   --------------------------------------------------------- */

/* ---------------------------------------------------------
   Interactive lists (future proof)
   --------------------------------------------------------- */

.list-clickable {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);

    margin: 0;
    padding: 0;

    list-style: none;
}

.list-clickable>li {
    margin: 0;
    padding: var(--space-3) var(--space-4);

    border-radius: var(--radius);
    cursor: pointer;

    transition:
        background 120ms ease,
        transform 120ms ease;
}

.list-clickable>li:hover {
    background: var(--bg-primary-hover);
}

.list-clickable>li:active {
    transform: scale(0.99);
}

/* =========================================================
   List groups
   ========================================================= */

.list-group {
    margin: 0;
    padding: 0;
    overflow: hidden;

    list-style: none;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--bg-card);
}

.list-group>li {
    display: flex;
    align-items: center;
    gap: var(--space-3);

    min-height: 3rem;
    padding: var(--space-3) var(--space-4);

    transition:
        background-color 150ms ease,
        border-color 150ms ease;
}

.list-group>li+li {
    border-top: 1px solid var(--border);
}

.list-group>li:hover {
    background: var(--bg-primary-hover);
}

.list-group.list-group-flush {
    border-radius: 0;
    border: 0;
    background: transparent;
}

.list-group-flush li {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding-left: 0;
    padding-right: 0;
}

/* Optional numbering */

ol.list-group {
    counter-reset: list-group;
}

ol.list-group>li {
    counter-increment: list-group;
}

ol.list-group>li::before {
    content: counter(list-group);

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    width: 1.6rem;
    height: 1.6rem;

    border-radius: var(--radius-pill);

    background: color-mix(in srgb,
            var(--accent) 18%,
            var(--bg-card));

    border: 1px solid color-mix(in srgb,
            var(--accent) 40%,
            transparent);

    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
}

.list-group-clickable>li {
    cursor: pointer;
}

.list-group-clickable>li:hover {
    background: color-mix(in srgb,
            var(--accent) 8%,
            var(--bg-card));
}

.list-group-clickable>li:active {
    background: color-mix(in srgb,
            var(--accent) 14%,
            var(--bg-card));
}

.list-group>li.is-active {
    position: relative;

    background: color-mix(in srgb,
            var(--accent) 12%,
            var(--bg-card));
}

.list-group>li.is-active::after {
    content: "";

    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;

    width: 3px;
    background: var(--accent);
}

.list-group>li.is-danger {
    color: #ffb0b0;
}

.list-group>li.is-danger:hover {
    background: color-mix(in srgb,
            var(--danger) 12%,
            var(--bg-card));
}

.list-group-sm>li {
    min-height: 2.5rem;
    padding: var(--space-3) var(--space-3);
}

.list-group-lg>li {
    min-height: 4rem;
    padding: var(--space-4) var(--space-4);
}

/* Administration, appearance and authentication */
:root[data-theme="light"] {
    color-scheme: light;
    --bg-app: #f4f4f8;
    --bg-primary: #fff;
    --bg-secondary: #eeeef4;
    --bg-tertiary: #e6e6ee;
    --bg-card: #fff;
    --bg-elevated: #fff;
    --bg-hover: #e9e9f1;
    --text-primary: #171721;
    --text-secondary: #555568;
    --text-secondary-hover: #24242c;
    --text-muted: #77778b;
    --text-inverse: #fff;
    --border: #dadae5;
    --border-strong: #c4c4d2;

    --shadow-sm:
        0 1px 2px rgb(0 0 0 / 0.25);

    --shadow:
        0 8px 24px rgb(0 0 0 / 0.28);

    --shadow-lg:
        0 20px 60px rgb(0 0 0 / 0.42);

    --shadow-depth:
        0 24px 48px rgb(0 0 0 / 0.22),
        0 0 0 1px rgb(0 0 0 / 0.06);
    --shadow-depth-sm:
        0 14px 30px rgb(0 0 0 / 0.16);

    --focus-ring:
        0 0 0 3px var(--accent-dim);

    --entry-hero-background: linear-gradient(to right,
            rgba(255, 255, 255, 0.85) 0%,
            rgba(255, 255, 255, 0.85) 54%,
            rgba(255, 255, 255, 0.4) 100%);

    --entry-detail-background: linear-gradient(to top, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 100%);
}

:root[data-theme="light"] .media-player.is-expanded.is-audio .player-controls {
    --bg-media-player-controls: linear-gradient(to top, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 100%);
}

:root[data-theme="dark"] .media-player.is-expanded.is-audio .player-controls {
    --bg-media-player-controls: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
}

:root[data-density="compact"] {
    --sidebar-width: 13rem;
}

.media-player-mini-preview[hidden] {
    display: none;
}

.media-player-mini-preview .media-player-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.media-player-mini-artwork {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-player-mini-artwork[hidden] {
    display: none;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-5);
}

.login-form {
    width: min(100%, 28rem);
    display: grid;
    gap: var(--space-4);
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-2);
}

.login-brand h1,
.login-brand p {
    margin: 0;
}

.login-form label {
    display: grid;
    gap: var(--space-2);
    color: var(--text-secondary);
}

.login-form input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    min-height: 2.75rem;
    padding: var(--space-3) var(--space-3);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.login-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Account security holds more than one panel; they stack, centred, instead of sharing the grid cell. */
.account-screen {
    align-content: center;
    gap: var(--space-5);
}

.google-sign-in {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.google-mark {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #fff;
    color: #4285f4;
    font-weight: 700;
    font-size: 0.8rem;
}

.account-security form {
    display: grid;
    gap: var(--space-4);
}

.account-security h2,
.account-security p {
    margin: 0;
}

/* The QR code stays dark on light whatever the theme: authenticator apps read it more reliably. */
.two-factor-qr {
    justify-self: center;
    width: 200px;
    height: 200px;
    padding: var(--space-2);
    border-radius: var(--radius);
    background: #fff;
}

.two-factor-key {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    overflow-wrap: anywhere;
    user-select: all;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-6);
    margin: 0;
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    user-select: all;
}

.d-flex {
    display: flex;
}

.flex-row {
    flex-direction: row;
}

.flex-column {
    flex-direction: column;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.flex-grow-1,
.flex-1 {
    flex-grow: 1;
}

.flex-shrink-1,
.flex-1 {
    flex-shrink: 1;
}

.flex-grow-0,
.flex-0 {
    flex-grow: 0;
}

.flex-shrink-0,
.flex-0 {
    flex-shrink: 0;
}

.item-list {
    display: grid;
    gap: var(--space-4);
}

.item-list-compact {
    gap: 0;
}

.item-list-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: var(--space-4);
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--border);
}

.item-list-row:hover {
    background: rgb(255 255 255 / .018);
}

.item-list-main {
    display: flex;
    align-items: center;
    flex: 1 1 18rem;
    min-width: 0;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.item-list-copy {
    flex: 1;
    display: grid;
    gap: var(--space-1);
}

.item-list-copy strong {
    overflow: hidden;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-list-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-list-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    color: var(--text-secondary);
    font-size: .82rem;
}

.item-list-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: var(--space-2);
    margin-left: auto;
}

.item-list-row:first-child {
    border-top: 0;
}

.user-edit-dialog {
    width: min(48rem, calc(100vw - 2rem));
}

.settings-provider-card {
    overflow: hidden;
}

.status {
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--accent);
    border-radius: 100%;
}

.status.status-online {
    background-color: var(--success);
}

.status.status-offline {
    background-color: var(--danger);
}

/* Switched off, as an installed plugin can be (page/plugins.js). */
.status.status-inactive {
    background-color: var(--text-muted);
}

.status.status-warning {
    background-color: var(--warning);
}

.status.status-unknownn {
    background-color: var(--bg-primary);
}

.status.status-disabled {
    background-color: var(--text-muted);
}

/* The row menu stays beside the name at every width; the name gives way and ellipsises instead. */
.user-list-item {
    flex-wrap: nowrap;
}

.user-list-item .item-list-main {
    flex: 1 1 0;
}

.user-list-item .item-list-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.user-role {
    margin-left: var(--space-2);
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge {
    display: inline-flex;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: var(--bg-primary);
    font-size: .72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.status-warning {
    border-color: rgb(245 189 79 / .45);
    color: var(--warning);
    background: rgb(245 189 79 / .1);
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    color: var(--text-primary);
    cursor: pointer;
}

.check-row>input {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: var(--space-1) 0 0;
    accent-color: var(--accent);
}

.check-row>span {
    display: grid;
    gap: var(--space-1);
}

.check-row small {
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 400;
}

.check-list {
    display: grid;
    gap: var(--space-3);
}

.folder-access-list {
    max-height: 14rem;
    overflow: auto;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.settings-disclosure {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.settings-disclosure summary {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    font-weight: 650;
    cursor: pointer;
}

.settings-disclosure[open] summary {
    border-bottom: 1px solid var(--border);
}

.settings-disclosure .check-list,
.settings-disclosure .permission-grid {
    padding: var(--space-4);
}

.panel-collapsible {
    overflow: hidden;
}

.panel-collapsible > summary {
    padding: var(--space-4);
    cursor: pointer;
    list-style-position: inside;
}

.panel-collapsible > summary > div {
    display: inline-block;
    width: calc(100% - var(--space-5));
    vertical-align: middle;
}

.panel-collapsible > summary h2,
.panel-collapsible > summary p {
    margin: 0;
}

.panel-collapsible > summary p {
    margin-top: var(--space-1);
    color: var(--text-secondary);
    font-weight: 400;
}

.panel-collapsible[open] > summary {
    border-bottom: 1px solid var(--border);
}

.permission-grid {
    display: grid;
    gap: var(--space-3);
}

.permission-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10rem;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-secondary);
}

.toast-container {
    position: fixed;
    z-index: 2000;
    top: 1rem;
    right: 1rem;
    display: grid;
    gap: var(--space-3);
    width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in 180ms ease-out;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-info {
    border-left-color: var(--accent);
}

.toast-close {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.toast.is-leaving {
    opacity: 0;
    transform: translateX(1rem);
    transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-.5rem);
    }
}


.entry-identify-dialog {
    width: min(58rem, calc(100vw - 2rem));
}

.identify-dialog-body {
    display: grid;
    gap: var(--space-4);
}

.identify-search-form {
    display: grid;
    grid-template-columns:
        minmax(0, 2fr) minmax(7rem, 0.65fr) minmax(9rem, 1fr);
    gap: var(--space-3);
    align-items: end;
}

.identify-dialog-status {
    margin: 0;
    color: var(--text-secondary);
}

.identify-results {
    display: grid;
    gap: var(--space-3);
    max-height: min(55vh, 34rem);
    overflow-y: auto;
}

.identify-result {
    display: grid;
    grid-template-columns:
        4.5rem minmax(0, 1fr) auto;
    gap: var(--space-4);
    align-items: center;
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.identify-result:hover {
    border-color:
        color-mix(in srgb,
            var(--accent) 65%,
            var(--border));

    background:
        color-mix(in srgb,
            var(--accent) 8%,
            var(--bg-card));
}

.identify-result:disabled {
    opacity: 0.65;
    cursor: wait;
}

.identify-result-image {
    width: 4.5rem;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-secondary);
}

.identify-result-image.is-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 1.5rem;
}

.identify-result-content {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.identify-result-content strong,
.identify-result-content small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.identify-result-content small {
    color: var(--text-secondary);
}

.identify-result-overview {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.identify-result-action {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}



.folder-edit-dialog {
    width: min(44rem, calc(100vw - 2rem));
}

.home-section-edit-dialog {
    width: min(64rem, calc(100vw - 2rem));
}

.folder-edit-dialog .folder-form {
    display: grid;
    gap: var(--space-4);
}

.folder-edit-dialog .folder-form>h2 {
    display: none;
}

.folder-provider-settings,
.folder-sidebar-setting,
.danger-zone {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.folder-provider-settings h3,
.folder-provider-settings p,
.folder-sidebar-setting h3,
.danger-zone h3 {
    margin: 0;
}

.danger-zone {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* Shared expanded/miniplayer buffered seek state. */
.player-seek {
    background: linear-gradient(90deg,
            var(--accent) 0, var(--accent) var(--progress, 0%),
            color-mix(in srgb, var(--accent) 30%, var(--border-strong)) var(--progress, 0%),
            color-mix(in srgb, var(--accent) 30%, var(--border-strong)) var(--buffered, 0%),
            var(--border-strong) var(--buffered, 0%), var(--border-strong) 100%);
}

.maintenance-activity-button {
    position: relative;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.maintenance-activity-button.is-busy {
    color: var(--accent);
}

.maintenance-activity-button.is-busy .material-symbols-outlined {
    color: inherit;
    animation: maintenance-spin 1.5s linear infinite;
}

.maintenance-activity-badge {
    border-radius: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: .725rem;
    line-height: normal;
    width: 1.75rem;
    height: 1.75rem;
}

.maintenance-activity-drawer {
    position: absolute;
    top: 3rem;
    right: 0;
    width: min(28rem, calc(100vw - 2rem));
    max-height: min(36rem, calc(100vh - 5rem));
    overflow: auto;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.maintenance-activity-heading,
.maintenance-activity-job {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
}

.maintenance-activity-heading {
    align-items: center;
    margin-bottom: var(--space-3);
}

.maintenance-activity-job {
    flex-direction: column;
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border);
}

.maintenance-activity-job span,
.maintenance-activity-job small {
    color: var(--text-muted);
}

.maintenance-activity-job progress {
    width: 100%;
}

.folder-background-tasks {
    white-space: nowrap;
}

@keyframes maintenance-spin {
    to {
        transform: rotate(-360deg);
    }
}
/* 
.home-section-filter-editor .library-controls {
    margin: 0;
} */

.home-section-preview {
    display: grid;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.home-section-preview>h4 {
    margin: 0;
}

.home-section-query-preview .section-head {
    display: none;
}

.form-actions {
    position: sticky;
    bottom: 1rem;
    right: 0;
    justify-content: end;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.detail-reviews {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    overflow: hidden;
}

.reviews-heading,
.review-card-footer {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: flex-start;
}

.reviews-heading {
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.reviews-heading h2,
.review-editor h3 {
    margin: 0;
}

.reviews-heading .section-description {
    margin: var(--space-1) 0 0;
    color: var(--text-secondary);
}

.reviews-body,
.review-editor {
    display: grid;
    gap: var(--space-4);
}

.review-slider {
    display: flex;
    overflow: auto hidden;
    flex-wrap: nowrap;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
}

.review-slider .review-card {
    flex: 0 0 225px;
    scroll-snap-align: start;
}

.review-summary-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    justify-content: space-between;
}

.review-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.source-item {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--accent-dim), transparent);
}

.source-item .source-logo,
.source-icon .source-logo {
    font-size: .6rem;
}

.source-item strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.review-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    display: flex;
    height: 250px;
    flex-direction: column;
    gap: var(--space-2);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast),
        background var(--transition-fast);
    cursor: pointer;

}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-3);
}


.push-notification-settings h2,
.push-notification-settings p {
    margin-top: 0;
}

.review-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.review-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.review-card-header {
    display: flex;
    grid-template-columns: auto minmax(0, 1fr) auto;
    flex-direction: row;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

.review-author {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    align-items: center;
    min-width: 0;
}

.review-author-name {
    flex: 1;
}

.review-rating-wrapper {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.review-author .review-source-name {
    flex-basis: 100%;
    color: var(--text-muted);
    font-size: .75rem;
}

.source-logo {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: -.04em;
    box-shadow: var(--shadow-sm);
}

.source-item.is-local .source-logo,
.source-icon.is-local .source-logo {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-active));
}

a.source-item {
    color: inherit;
    text-decoration: none;
}

.source-item.is-average .source-logo {
    background: var(--warning);
    color: var(--bg-primary);
    font-size: 1rem;
    font-variation-settings: 'FILL' 1;
}

/* The services' own marks (Wikimedia Commons, public-domain text logos; trademarks of their owners). */
.source-item.is-imdb .source-logo,
.source-icon.is-imdb .source-logo {
    background: #f5c518 url(/assets/media/logos/imdb.svg) center / 88% auto no-repeat;
    font-size: 0;
}

.source-item.is-rottentomatoes .source-logo,
.source-icon.is-rottentomatoes .source-logo {
    background: #fff url(/assets/media/logos/rottentomatoes.svg) center / 70% auto no-repeat;
    font-size: 0;
}

.source-item.is-metacritic .source-logo,
.source-icon.is-metacritic .source-logo {
    background: url(/assets/media/logos/metacritic.png) center / contain no-repeat;
    font-size: 0;
}

.source-item.is-tmdb .source-logo,
.source-icon.is-tmdb .source-logo {
    background: url(/assets/media/logos/tmdb.jpg);
    font-size: 0;
    background-size: contain;
}

.review-card-header strong,
.review-card-header a {
    color: var(--text-primary);
    font-weight: 700;
}

.review-rating {
    flex: 0 0 auto;
    display: inline-flex;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--accent-dim);
    color: var(--accent-hover);
    font-weight: 700;
    font-size: .82rem;
}

.review-actions {
    display: flex;
    gap: var(--space-2);
}

.review-actions .review-action {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font-size: small;
    color: var(--text-primary);
}

.review-action-delete {
    color: #ff9da1;
}

.review-action-delete:hover {
    color: var(--danger);
}

.review-content:not([hidden]) {
    flex: 1;
    display: -webkit-box;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: small;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
}

.review-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.review-card-footer {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text-muted);
}

.review-card-footer a {
    color: var(--text-secondary);
}

.review-license {
    color: var(--text-muted);
}

.review-editor {
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.review-editor label {
    display: grid;
    gap: var(--space-2);
}

.review-editor textarea {
    min-height: 8rem;
    resize: vertical;
}

.review-dialog-content {
    display: grid;
    gap: var(--space-4);
}

.review-dialog-meta {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.review-dialog-meta>div {
    padding: 0;
}

.review-dialog-meta small {
    color: var(--text-muted);
}

.review-dialog-text {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.7;
    color: var(--text-secondary);
}

.review-dialog-spoiler {
    display: grid;
    justify-items: start;
    gap: var(--space-4);
}

.review-spoiler-toggle {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    color: var(--text-secondary);
}

.review-spoiler {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-items: start;
    border-radius: var(--radius);
}

.review-loading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 3rem;
    color: var(--text-muted);
}

.review-loading-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    color: var(--text-muted);
}

/* A source still being asked: a card's size, so the row keeps its height while reviews arrive. */
.review-card.review-card-loading {
    justify-content: center;
    align-items: center;
    cursor: default;
    color: var(--text-muted);
    box-shadow: none;
    border-style: dashed;
}

.review-card.review-card-loading:hover {
    border-color: var(--border);
    background: var(--bg-card);
}

.review-card-loading .review-loading {
    min-height: 0;
    font-size: .85rem;
    text-align: center;
}

/* Room for the score chips before they arrive, so the cards under them do not move. */
.review-summary-row {
    min-height: 2.5rem;
}

.review-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.review-provider-state {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    background: var(--danger-dim);
}

.review-loading .section-loader {
    position: static;
    width: 1rem;
    height: 1rem;
}

/* =========================================================
   Responsive layout modes
   ========================================================= */

@media (min-width: 992px) {
    .entry-wrapper.is-slider .entry-card {
        flex: 0 0 180px;
    }
}

@media (width < 992px) {
    
    .app-sidebar-footer .btn::after {
        content: "⇥";
        font-size: 1rem;
    }

    .app-shell {
        display: block;
        padding-top: var(--mobile-header-height);
    }

    /*
     * A header that holds still, and the destinations behind it.
     *
     * Laying every destination along an edge worked while there were four of them. Plugins keep
     * adding, and past a certain count the choice is between targets too small to hit and words
     * too clipped to read -- so the bar stops carrying them. What stays is what has to be
     * permanent: which install this is, how to reach the account, and what is playing. The
     * destinations move into a drawer, which does not care how many there are.
     */
    .app-sidebar {
        position: fixed;
        flex-direction: row;
        align-items: center;
        inset: 0 0 auto;
        z-index: 1100;
        width: auto;
        height: var(--mobile-header-height);
        gap: var(--space-2);
        padding: 0 var(--space-3);
        border-right: 0;
        border-bottom: 1px solid var(--border);
        /*
         * No backdrop-filter here, however tempting. It is invisible behind an opaque background,
         * and it makes this element the containing block for every position:fixed descendant --
         * which collapses the drawer to the height of the header instead of the viewport. Same
         * applies to filter and transform if either is ever wanted on the header.
         */
        background: var(--bg-secondary);
    }

    .app-sidebar>hr,
    .app-sidebar-footer,
    .app-sidebar .profile-menu span:nth-child(2n) {
        display: none;
    }

    .app-menu-toggle,
    .app-search-toggle {
        display: grid;
    }

    .app-search-toggle {
        border-radius: 50%;
    }

    /* The header shows the logo alone; the name and subtitle are the sidebar's on a desktop. */
    .app-sidebar > .app-brand .app-brand-copy {
        display: none;
    }

    /* "Powered by" goes to the foot of the page rather than into the header. */
    .app-sidebar > .powered-by {
        display: none;
    }

    .app-content-footer {
        display: block;
        margin-top: var(--space-6);
    }

    /*
     * Quick search opened from the header: the top bar's field as a strip under the header, the
     * results across the width of the screen.
     */
    .app-shell.is-search-open .app-topbar .quick-search {
        position: fixed;
        top: var(--mobile-header-height);
        right: 0;
        left: 0;
        z-index: 1099;
        display: block;
        max-width: none;
        margin: 0;
        padding: var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--border);
        background: var(--bg-secondary);
    }

    .app-shell.is-search-open .app-search-toggle {
        background: var(--accent-dim);
        color: var(--accent);
    }

    .app-topbar .quick-search-icon {
        left: calc(var(--space-3) * 2);
    }

    .app-topbar .quick-search-key {
        display: none;
    }

    .app-topbar .quick-search-panel {
        right: var(--space-3);
        left: var(--space-3);
        width: auto;
        max-height: calc(100vh - var(--mobile-header-height) - 5rem);
    }

    /*
     * The brand is what holds the two groups apart, rather than the first item of the right-hand
     * one: the cast button is absent whenever there is no receiver on the network, and an element
     * that is display:none cannot push anything anywhere.
     */
    .app-sidebar > .app-brand {
        display: flex;
        min-height: 0;
        min-width: 0;
        margin: 0 auto 0 0;
        padding: 0;
    }

    .app-sidebar > .app-brand .app-brand-mark {
        width: 2rem;
        height: 2rem;
        font-size: 0.95rem;
    }

    /* The drawer's brand, as the desktop sidebar has it. */
    .app-nav-brand {
        display: flex;
        flex: 0 0 auto;
        margin-bottom: var(--space-2);
    }

    .app-sidebar .profile-menu {
        height: auto;
    }

    /*
     * The drawer: parked off the left edge, under the header rather than over it, so the control
     * that opened it stays visible and in reach to close it again.
     */
    /*
     * The drawer is the desktop sidebar brought in from the left: full height, over the header,
     * with the same brand at its top and the same background, so a phone looks like the same app.
     */
    .app-nav {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 99;
        flex-direction: column;
        width: min(17rem, 82vw);
        /* The drawer reaches the bottom too, under the docked mini player: leave it room. */
        padding: var(--space-4) var(--space-4) calc(var(--space-4) + var(--activity-dock-height, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        border-right: 1px solid var(--border);
        background:
            linear-gradient(180deg,
                var(--surface-sheen),
                transparent 12rem),
            var(--bg-primary);
        box-shadow: var(--shadow-lg);
        visibility: hidden;
        transform: translateX(-100%);
        transition:
            transform var(--transition),
            visibility var(--transition);
    }

    .app-shell.is-nav-open .app-nav {
        visibility: visible;
        transform: none;
    }

    .app-nav-link {
        flex: 0 0 auto;
    }

    /* In the header, Settings is a button beside the account, its icon alone. */
    .app-settings-link {
        min-height: 0;
        margin: 0;
        padding: var(--space-2);
    }

    .app-settings-link span:not(.app-nav-icon) {
        display: none;
    }

    .app-scrim {
        position: fixed;
        inset: 0;
        z-index: 98;
        display: block;
        background: rgb(0 0 0 / 0.5);
        opacity: 0;
        visibility: hidden;
        transition:
            opacity var(--transition),
            visibility var(--transition);
    }

    .app-shell.is-nav-open .app-scrim {
        opacity: 1;
        visibility: visible;
    }

    .app-content {
        --content-pad-top: var(--space-4);
        --content-pad-x: var(--space-4);
        padding: var(--content-pad-top) var(--content-pad-x) calc(var(--space-6) + var(--activity-dock-height, 0px));
    }

    /*
     * The header carries the account and background activity here, so the top bar has nothing of
     * its own to show: no bar, only its search field when the header opens it.
     */
    .app-account-header {
        display: flex;
    }

    .app-account-topbar,
    .app-topbar .maintenance-activity {
        display: none;
    }

    /* In the header, the activity button is one of its round buttons, the count on its corner. */
    .app-account-header .maintenance-activity {
        position: relative;
    }

    .app-account-header .maintenance-activity-button {
        display: inline-grid;
        place-items: center;
        width: var(--control-md);
        height: var(--control-md);
        min-height: 0;
        padding: 0;
        border-radius: 50%;
        box-shadow: none;
    }

    .app-account-header .maintenance-activity-badge {
        position: absolute;
        top: -0.25rem;
        right: -0.25rem;
        width: 1.15rem;
        height: 1.15rem;
        font-size: 0.65rem;
    }

    .app-account-header .maintenance-activity-badge:empty {
        display: none;
    }

    /* The jobs open under the header, across the screen, rather than off the button's edge. */
    .app-account-header .maintenance-activity-drawer {
        position: fixed;
        top: calc(var(--mobile-header-height) + var(--space-2));
        right: var(--space-3);
        left: var(--space-3);
        z-index: 1103;
        width: auto;
        max-height: calc(100vh - var(--mobile-header-height) - var(--space-6));
    }

    .app-topbar {
        top: 1rem;
        min-height: 0;
        height: 0;
        margin: 0;
        padding: 0;
        border: 0;
        background: none;
    }

    .toolbar,
    .filter-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-aside-button {
        grid-column: 1 / -1;
    }

    .entry-wrapper {
        grid-template-columns: repeat(auto-fill, minmax(min(128px, 100%), 1fr));
    }

    .entry-title {
        font-size: small;
    }

    .link-card-grid {
        grid-template-columns: 1fr;
    }

    .link-card {
        min-height: 0;
    }

    .folder-list-item .scan-progress {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .section-head {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .section-head-rule {
        display: none;
    }

    .detail-body {
        grid-template-columns: 1fr;
    }

    /*
     * A dropdown on a phone is a sheet: across the bottom of the screen, within reach of a thumb,
     * sliding up over a backdrop that fades in. Whichever side a dropdown opens from on a desktop,
     * here they all open the same way. The backdrop and sheet sit just above the header (1100), so
     * a sheet opened from the page dims the header as well.
     */
    .dropdown-menu.is-open .dropdown-toggle:after {
        content: '';
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1101;
        background: rgb(0 0 0 / 0.6);
        animation: sheet-backdrop-in 200ms ease-out;
    }

    .dropdown-menu.left .dropdown,
    .dropdown-menu.right .dropdown,
    .dropdown-menu.top .dropdown,
    .dropdown-menu.bottom .dropdown,
    .app-topbar .dropdown-menu .dropdown,
    .dropdown {
        position: fixed;
        z-index: 1102;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: none;
        max-height: 80vh;
        overflow-y: auto;
        padding: var(--space-2) var(--space-2) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: none;
    }

    .dropdown-menu.is-open .dropdown {
        animation: sheet-slide-up 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    /* A handle across the top, as sheets have, saying it belongs to the bottom edge. */
    .dropdown::before {
        content: '';
        flex: 0 0 auto;
        align-self: center;
        width: 2.5rem;
        height: 0.25rem;
        margin: var(--space-1) 0 var(--space-2);
        border-radius: 999px;
        background: var(--border-strong);
    }

    .dropdown .dropdown-item {
        min-height: 3rem;
    }

    .app-sidebar .profile-menu {
        left: auto;
        right: 0;
        height: 100%;
        padding: 0;
    }

    .entry-hero::after {
        background:
            linear-gradient(0deg,
                var(--bg-app) 0%,
                rgb(11 11 16 / 0.9) 54%,
                rgb(11 11 16 / 0.45) 100%);
    }

    /* A narrower poster beside the title; on a phone it moves above the title (below). */
    .entry-hero-inner {
        grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
        align-items: end;
        padding-top: 6rem;
    }

    .detail-title {
        max-width: none;
        font-size: clamp(2rem, 11vw, 3rem);
    }

    .detail-skeleton {
        grid-template-columns: 1fr;
        padding: var(--space-4);
    }

    .detail-skeleton-poster {
        width: 10rem;
    }

    .media-player.is-mini {
        width: 100%;
    }

    .media-player-expanded {
        flex-direction: column;
    }

    #activity-dock {
        z-index: 1100;
    }

    .media-player.is-video .media-player-mini-controls {
        flex-direction: row;
        max-width: fit-content;
    }

    .media-player-playlist {
        flex-basis: 50%;
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    /* Narrow: the mute button opens a panel above it, the slider standing up in it, low at the
       bottom, and a mute button under it. */
    .player-volume-panel {
        position: absolute;
        bottom: calc(100% + var(--space-2));
        left: 50%;
        z-index: 30;
        display: none;
        flex-direction: column;
        align-items: center;
        gap: var(--space-2);
        padding: var(--space-3) var(--space-2) var(--space-2);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--bg-elevated);
        box-shadow: var(--shadow-lg);
        translate: -50% 0;
    }

    .player-volume-control.is-open .player-volume-panel {
        display: flex;
    }

    .player-volume-panel .player-volume {
        width: 0.3rem;
        height: 8rem;
        writing-mode: vertical-lr;
        direction: rtl;
        background:
            linear-gradient(0deg,
                var(--accent) 0,
                var(--accent) var(--progress, 0%),
                var(--border-strong) var(--progress, 0%),
                var(--border-strong) 100%);
        touch-action: none;
    }

    .player-control-row {
        gap: 0;
    }

    .player-control-spacer {
        min-width: 0;
    }

    .player-control-options {
        gap: 0;
    }

    .player-control-options .player-control-button {
        padding: var(--space-3);
    }

    .player-settings-menu {
        width: min(22rem, calc(100vw - 1rem));
        max-height: min(65vh, 28rem, var(--settings-menu-room, 100vh));
    }

    .player-playlist-item {
        grid-template-columns:
            1.5rem 4rem minmax(0, 1fr) auto;
    }

    .media-player-mini-actions {
        gap: 0;
    }

    .player-controls {
        padding-inline: var(--space-3);
    }

    .login-form {
        padding: var(--space-4);
    }

    .identify-search-form {
        grid-template-columns: 1fr;
    }

    .identify-result {
        grid-template-columns:
            3.5rem minmax(0, 1fr);
    }

    .identify-result-image {
        width: 3.5rem;
    }

    .identify-result-action {
        display: none;
    }

    .reviews-heading,
    .review-card-footer,
    .review-summary-row {
        align-items: stretch;
        flex-direction: column;
    }

    .review-summary {
        align-items: flex-start;
    }

    .review-card-header {
        grid-template-columns: auto 1fr;
    }

    .review-actions {
        grid-column: 1 / -1;
    }
}

.profile-menu {
    position: relative;
    margin-top: auto;
}

.profile-menu-trigger {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem;
    cursor: pointer;
    list-style: none;
}

.profile-avatar-placeholder {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent, #6c5ce7);
    color: white;
    font-weight: 700;
}

.profile-menu-dropdown {
    display: grid;
    gap: .25rem;
    padding: .5rem;
}

.profile-page {
    display: grid;
    gap: 1rem;
    max-width: 42rem;
}

.profile-page>.profile-avatar-placeholder {
    width: 5rem;
    height: 5rem;
    font-size: 2rem;
}

.server-overview {
    width: min(30rem, calc(100vw - 2rem));
}

.collection-tile {
    display: grid;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease;
}

.collection-tile:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.collection-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    background: var(--surface-raised);
}

.collection-cover-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.collection-cover-placeholder .material-symbols-outlined {
    font-size: 3rem;
}

.collection-tile-detail {
    display: grid;
    gap: .3rem;
    padding: .85rem;
}

.collection-tile-detail small {
    color: var(--text-muted);
}

.collection-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.collection-item {
    position: relative;
    min-width: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
}

.collection-item.is-selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.collection-item.is-dragging {
    opacity: .45;
}

.collection-item.is-drop-target {
    box-shadow: -4px 0 0 var(--accent);
}

.collection-select-control,
.drag-handle {
    position: absolute;
    z-index: 3;
    top: .55rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(8px);
}

.collection-select-control[hidden],
.drag-handle[hidden] {
    display: none;
}

.collection-select-control {
    left: .55rem;
}

.drag-handle {
    right: .55rem;
    cursor: grab;
}

.collection-item>.entry-card {
    width: 100%;
}

.collection-selection-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
    padding: .65rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.collection-selection-bar>span:first-child {
    margin-right: auto;
}

@media (max-width: 640px) {

    .collection-grid,
    .collection-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .item-list-row {
        align-items: flex-start;
    }

    .item-list-main,
    .item-list-actions {
        flex-basis: 100%;
    }

    .item-list-actions {
        justify-content: flex-start;
        margin-left: 0;
    }
}
/* =========================================================
   Publication reader
   ========================================================= */

.publication-reader-shell {
    color: var(--text-primary);
}

.publication-reader-shell[hidden] {
    display: none;
}

.publication-reader-shell.is-expanded {
    position: fixed;
    z-index: 1100;
    inset: 0;
    background: var(--bg-primary);
}

.publication-reader-shell.is-mini .publication-reader-expanded,
.publication-reader-shell.is-expanded .publication-reader-mini {
    display: none;
}

.publication-reader-expanded {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

.publication-reader-icon-button {
    flex: none;
    width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    border-radius: var(--radius-pill);
}

.publication-reader-icon-button .material-symbols-outlined {
    font-size: 1.35rem;
}

.publication-reader-icon-button.is-active {
    background: var(--accent-dim);
    color: var(--text-primary);
}

/* Top bar */

.publication-reader-shell-toolbar {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 3.5rem;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.publication-reader-heading {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 0.1rem;
    padding: 0 var(--space-2);
    line-height: 1.2;
}

.publication-reader-heading .publication-reader-title {
    font-size: 0.95rem;
}

.publication-reader-heading .publication-reader-detail {
    font-size: 0.78rem;
}

.publication-reader-session-controls {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.publication-reader-session-controls:empty {
    display: none;
}

.publication-reader-session-controls::after {
    content: "";
    width: 1px;
    height: 1.5rem;
    margin: 0 var(--space-1);
    background: var(--border-strong);
}

.publication-reader-page-field {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-right: var(--space-1);
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.publication-reader-page-input {
    width: 3.75rem;
    min-height: 2rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
    font: inherit;
}

/* Menus */

.publication-reader-menu-anchor {
    position: relative;
}

.publication-reader-menu {
    position: absolute;
    z-index: 10;
    top: calc(100% + var(--space-2));
    right: 0;
    display: grid;
    gap: var(--space-4);
    width: min(20rem, calc(100vw - 1.5rem));
    max-height: min(32rem, calc(100dvh - 5rem));
    padding: var(--space-4);
    overflow: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

.publication-reader-menu[hidden] {
    display: none;
}

.publication-reader-menu-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.publication-reader-menu-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.publication-reader-toc {
    display: grid;
    gap: 1px;
    margin: calc(var(--space-2) * -1) calc(var(--space-3) * -1) 0;
}

.publication-reader-toc-item {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.publication-reader-toc-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.publication-reader-toc-item.is-current {
    background: var(--accent-dim);
    color: var(--text-primary);
    font-weight: 650;
}

.publication-reader-field {
    display: grid;
    gap: var(--space-2);
}

.publication-reader-field-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.publication-reader-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
}

.publication-reader-stepper-value {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.publication-reader-segmented {
    display: flex;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.publication-reader-segmented button {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.1rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 0.15rem);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.publication-reader-segmented button:hover {
    color: var(--text-primary);
}

.publication-reader-segmented button[aria-checked="true"] {
    border-color: var(--accent-border);
    background: var(--accent-dim);
    color: var(--text-primary);
}

.publication-reader-swatch {
    width: 0.9rem;
    height: 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
}

.publication-reader-menu-actions {
    display: flex;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.publication-reader-menu-actions .btn {
    flex: 1;
}

/* Body */

.publication-reader-host {
    display: flex;
    flex: 1;
    min-height: 0;
}

.publication-reader-loading {
    position: absolute;
    z-index: 3;
    inset: 3.5rem 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    color: var(--text-secondary);
    background: var(--bg-primary);
    pointer-events: none;
}

.publication-reader-loading[hidden] {
    display: none;
}

.publication-reader-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: publication-reader-spin 0.8s linear infinite;
}

@keyframes publication-reader-spin {
    to { transform: rotate(360deg); }
}

.publication-reader-error {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    max-width: 28rem;
    margin: auto;
    padding: var(--space-6);
    text-align: center;
}

.publication-reader-error > .material-symbols-outlined {
    color: var(--danger);
    font-size: 2.5rem;
}

.publication-reader-error h2 {
    margin: 0;
    font-size: 1.1rem;
}

.publication-reader-error p {
    margin: 0;
}

.publication-reader-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.publication-reader-epub {
    --reader-paper: #ffffff;
    --reader-ink: #1b1b1f;
    --reader-muted: rgb(27 27 31 / 0.55);
    --reader-rule: rgb(27 27 31 / 0.1);
    background: var(--reader-paper);
    color: var(--reader-ink);
}

.publication-reader-epub[data-reader-theme="sepia"] {
    --reader-paper: #f4ecd8;
    --reader-ink: #3b3024;
    --reader-muted: rgb(59 48 36 / 0.6);
    --reader-rule: rgb(59 48 36 / 0.14);
}

.publication-reader-epub[data-reader-theme="dark"] {
    --reader-paper: #16161d;
    --reader-ink: #e4e4ea;
    --reader-muted: rgb(228 228 234 / 0.5);
    --reader-rule: rgb(228 228 234 / 0.1);
}

.publication-reader-stage {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.publication-epub-viewport {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--space-5) 0 var(--space-3);
    background: var(--reader-paper);
}

.publication-reader-epub[data-flow="scrolled-doc"] .publication-epub-viewport {
    max-width: 48rem;
    padding: 0;
}

.publication-reader-epub .epub-container {
    scrollbar-color: var(--reader-rule) transparent;
    scrollbar-width: thin;
}

.publication-reader-epub[data-flow="scrolled-doc"] .epub-container {
    overflow-x: hidden !important;
}

.publication-reader-edge {
    position: relative;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: clamp(2.5rem, 6vw, 4.5rem);
    border: 0;
    background: transparent;
    color: var(--reader-muted, var(--text-muted));
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.publication-reader-edge .material-symbols-outlined {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.75rem;
    transition: background-color var(--transition-fast);
}

.publication-reader-edge:hover,
.publication-reader-edge:focus-visible {
    opacity: 1;
    color: var(--reader-ink, var(--text-primary));
    outline: none;
}

.publication-reader-edge:hover .material-symbols-outlined,
.publication-reader-edge:focus-visible .material-symbols-outlined {
    background: var(--reader-rule, var(--bg-hover));
}

.publication-reader-footer {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 2.25rem;
    padding: var(--space-2) var(--space-4);
    color: var(--reader-muted, var(--text-muted));
    font-size: 0.8rem;
}

.publication-reader-footer-track {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--reader-rule, var(--border));
}

.publication-reader-footer-fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.publication-reader-footer-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.publication-reader-footer-percent {
    font-variant-numeric: tabular-nums;
}

/* Comics */

.publication-reader-comic {
    --reader-muted: rgb(255 255 255 / 0.55);
    --reader-ink: #fff;
    --reader-rule: rgb(255 255 255 / 0.12);
    background: #111;
    color: #eee;
}

.publication-comic-layout {
    display: grid;
    flex: 1;
    min-height: 0;
    grid-template-columns: 6.5rem minmax(0, 1fr);
}

.publication-comic-stage {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.publication-comic-thumbnails {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2);
    overflow: auto;
    border-right: 1px solid rgb(255 255 255 / 0.08);
    background: #0b0b0e;
}

.publication-comic-thumbnails button {
    display: grid;
    gap: 0.2rem;
    padding: 0.25rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgb(255 255 255 / 0.6);
    cursor: pointer;
}

.publication-comic-thumbnails button:hover {
    background: rgb(255 255 255 / 0.06);
}

.publication-comic-thumbnails button.is-current {
    border-color: var(--accent);
    color: #fff;
}

.publication-comic-thumbnails img {
    display: block;
    width: 100%;
    max-height: 7rem;
    object-fit: contain;
}

.publication-comic-thumbnails span {
    font-size: 0.72rem;
}

.publication-comic-page {
    display: block;
    object-fit: contain;
}

.publication-comic-stage.fit-page .publication-comic-page {
    max-width: 50%;
    max-height: 100%;
}

.publication-comic-stage.fit-page .publication-comic-page:only-child {
    max-width: 100%;
}

.publication-comic-stage.fit-width {
    align-items: flex-start;
}

.publication-comic-stage.fit-width .publication-comic-page {
    width: 100%;
    height: auto;
}

.publication-comic-stage.fit-width .publication-comic-page:not(:only-child) {
    width: 50%;
}

/* Mini reader */

.publication-reader-mini {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    padding-right: var(--space-2);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.publication-reader-mini-resume {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    gap: var(--space-3);
    padding: var(--space-2);
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.publication-reader-mini-cover,
.publication-reader-mini-cover-placeholder {
    grid-row: 1;
    width: 2.75rem;
    height: 3.5rem;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-primary);
}

.publication-reader-mini-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.publication-reader-mini-cover[hidden],
.publication-reader-mini-cover-placeholder[hidden] {
    display: none;
}

.publication-reader-mini-copy {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.publication-reader-title,
.publication-reader-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.publication-reader-detail {
    color: var(--text-muted);
}

.publication-reader-detail[hidden] {
    display: none;
}

.publication-reader-progress {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 0.2rem;
    border: 0;
    appearance: none;
    background: transparent;
}

.publication-reader-progress::-webkit-progress-bar {
    background: transparent;
}

.publication-reader-progress::-webkit-progress-value {
    background: var(--accent);
}

.publication-reader-progress::-moz-progress-bar {
    background: var(--accent);
}

@media (max-width: 640px) {
    .publication-reader-shell-toolbar {
        min-height: 3rem;
        padding: var(--space-1) var(--space-2);
    }

    .publication-reader-loading {
        inset: 3rem 0 0;
    }

    .publication-reader-heading .publication-reader-detail,
    .publication-reader-fullscreen,
    .publication-reader-session-controls::after {
        display: none;
    }

    .publication-reader-mini {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .publication-reader-mini > .btn:first-of-type {
        display: none;
    }

    .publication-epub-viewport {
        padding-top: var(--space-3);
    }

    .publication-reader-edge {
        width: 2rem;
    }

    .publication-reader-edge .material-symbols-outlined {
        width: 2rem;
        height: 2rem;
        font-size: 1.4rem;
    }

    .publication-comic-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .publication-comic-thumbnails {
        display: none;
    }
}

.media-player-karaoke {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    background: #000;
}

/* Entry editor: a value and its padlock sit on one line, so the lock reads as
   belonging to the field rather than as a separate setting. */
.entry-edit-field {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    gap: .5rem;

}

.entry-edit-field > .form-input,
.entry-edit-field > .form-textarea {
    flex: 1 1 auto;
    min-width: 0;
}

.entry-edit-lock {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    cursor: pointer;
    opacity: .45;
    transition: opacity .15s ease;
}

.entry-edit-lock:hover,
.entry-edit-lock:has(input:checked) {
    opacity: 1;
}

/* The checkbox itself is replaced by the padlock glyph, which carries the state. */
.entry-edit-lock > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.entry-edit-lock:has(input:focus-visible) {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 4px;
}

.entry-edit-artwork {
    flex: 0 0 100%;
    display: flex;
    justify-content: center;
}

/*
 * A label, not a div: the browser already turns a click anywhere inside one into
 * a click on the file input it wraps, and already makes that input keyboard
 * reachable. Empty it is a dropzone; filled it is the image and nothing else.
 *
 * Positioned, because the remove control is placed against it -- which is why it
 * hugs the image rather than the row once there is one to hug.
 */
.entry-edit-artwork-zone {
    position: relative;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    min-height: 25vh;
    padding: var(--space-4);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

/* Nothing to hug yet, so the dropzone is the whole width of the field. */
.entry-edit-artwork-zone:not(.has-image) {
    flex: 1 1 auto;
}

/* With an image the frame gets out of its way. Kept above the hover and focus
   rules so those still read over it -- the zone is clickable either way, and
   silence on hover would be the one state that hides that. */
.entry-edit-artwork-zone.has-image {
    padding: 0;
    border-color: transparent;
    background: none;
}

.entry-edit-artwork-zone:hover,
.entry-edit-artwork-zone.is-dropping {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text-primary);
}

.entry-edit-artwork-zone:has(input:focus-visible) {
    outline: none;
    box-shadow: var(--focus-ring);
    border-color: var(--accent);
}

/*
 * Children ignore the pointer so a drag crossing the image or the hint does not
 * read as leaving the zone -- `dragleave` bubbles, and the border would flicker
 * off and on as the cursor moved within one target. The remove button is the one
 * child that has to answer the pointer itself.
 */
.entry-edit-artwork-zone > * {
    pointer-events: none;
}

.entry-edit-artwork-zone > .entry-edit-artwork-remove {
    pointer-events: auto;
}

.entry-edit-artwork-hint {
    font-size: var(--font-sm);
    text-align: center;
}

.entry-edit-artwork-zone.has-image > .entry-edit-artwork-hint {
    display: none;
}

.entry-edit-artwork-preview {
    max-width: 100%;
    height: 25vh;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

/* No image, no frame to sit in: the dashed zone is the whole control. */
.entry-edit-artwork-zone:not(.has-image) > .entry-edit-artwork-preview {
    display: none;
}

.entry-edit-artwork-remove {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    display: grid;
    place-items: center;
    width: var(--control-sm);
    height: var(--control-sm);
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    /* Opaque: it lands on artwork of unknown colour and has to stay legible. */
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

/* `display: grid` above is a later rule than the global `[hidden]`, and would
   otherwise beat it on order at equal specificity. */
.entry-edit-artwork-remove[hidden] {
    display: none;
}

.entry-edit-artwork-remove:hover:not(:disabled) {
    border-color: var(--danger);
    background: var(--danger-dim);
    color: var(--danger);
}

.entry-edit-artwork-remove:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.entry-edit-artwork-remove > .material-symbols-outlined {
    font-size: var(--font-md);
}

/* Mid-request the control is not worth interacting with, and says so. */
.entry-edit-artwork.is-busy {
    opacity: .6;
}

.entry-edit-artwork.is-busy .entry-edit-artwork-zone {
    cursor: progress;
}

.entry-edit-artwork-section {
    display: grid;
    gap: .75rem;
}

/* One block per kind of identifier, so a column of ids reads as a group rather
   than as a dozen unrelated fields. */
.entry-edit-identity {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.entry-edit-identity > small {
    margin: 0;
}

/* Kind beside value, so the pair reads as one identifier. */
.entry-edit-identity-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--space-2);
}

.entry-edit-paths {
    display: flex;
    flex-direction: column;
}

.entry-edit-paths li {
    font-size: small;
    white-space: pre;
    text-overflow: ellipsis;
    overflow: hidden;
}
/* =========================================================
   Profile viewing history
   ========================================================= */

.profile-history-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: var(--space-3);
}

.profile-history-item {
    display: flex;
    flex-direction: column;
    color: inherit;
    gap: 0.35rem;
    text-decoration: none;
}

.profile-history-item img,
.profile-history-placeholder {
    display: grid;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-2);
    background: var(--surface-2);
    object-fit: cover;
    place-items: center;
}

.profile-history-title {
    font-size: 0.85rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.profile-history-item small {
    color: var(--text-secondary);
}

/* =========================================================
   Filename parts
   ========================================================= */

.filename-editor {
    display: grid;
    gap: var(--space-3);
}

/* Wraps rather than scrolls: the whole name has to be readable at once, which is
   the only way to see that a separator is missing between two parts. */
.filename-sequence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 2.25rem;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-2);
    background: var(--surface-2);
    gap: var(--space-1);
}

.filename-sequence:empty::after {
    content: 'No parts yet, so files of this type keep their own name.';
    color: var(--text-muted);
    font-size: 0.78rem;
}

.filename-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem var(--space-2);
    border-radius: var(--radius-1);
    font-size: 0.78rem;
    gap: var(--space-1);
}

/* A token and a literal are different things and the difference decides what the
   file is called, so they do not look alike. */
.filename-chip.is-token {
    border: 1px solid var(--accent-border, var(--accent));
    background: var(--accent-dim);
    font-weight: 600;
}

.filename-chip.is-text {
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
    white-space: pre;
}

.filename-chip-remove {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
}

.filename-chip-remove:hover,
.filename-chip-remove:focus-visible {
    opacity: 1;
}

.filename-sequence-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.filename-sequence-controls .form-input {
    flex: 0 1 16rem;
}

.filename-token-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.filename-raw {
    font-family: var(--font-mono, monospace);
}

.filename-raw-warning {
    color: var(--danger, #d9534f);
}

/* The answer to "what will this actually be called", so it reads as a filename
   rather than as more settings. */
.filename-preview {
    display: block;
    padding: var(--space-2);
    border-radius: var(--radius-1);
    background: var(--surface-3, var(--surface-2));
    color: var(--text-secondary);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.filename-mode {
    justify-self: start;
}

/* A library's name in Settings > Libraries, after the icon its sidebar link uses. */
.library-settings-title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* A library's views, across the top of its page. */
.library-tabs:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.library-tab {
    padding: var(--space-2) var(--space-3);
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: none;
}

.library-tab:hover {
    color: var(--text-primary);
}

.library-tab.is-active {
    border-bottom-color: var(--accent);
    color: var(--text-primary);
}

/* A library's genres, each leading to its entries narrowed to that genre. */
.library-genres {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: var(--space-3);
}

.library-genre {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.library-genre:hover {
    border-color: var(--accent-border);
    background: var(--bg-hover);
}

.library-genre span {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* Settings > Branding: the top of the sidebar, as it will look. */
.branding-preview {
    margin: 0 var(--space-4) var(--space-3);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

/* Settings > Sidebar: each row of the layout, with its icon, dimmed while hidden. */
.sidebar-layout-title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.sidebar-layout-title .material-symbols-outlined {
    color: var(--text-muted);
}

.sidebar-layout-row.is-hidden .item-list-copy,
.sidebar-layout-row.is-missing .item-list-copy {
    opacity: 0.55;
}

.sidebar-layout-row.is-separator .item-list-copy strong {
    color: var(--text-muted);
    font-weight: 500;
}

/*
 * Quick search, at the left of the top bar: a field that opens a panel of a few results of each
 * kind, grouped under their kind's name, with a way through to everything on Browse.
 */
.quick-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 30rem;
    margin-right: auto;
}

.quick-search-icon {
    position: absolute;
    top: 50%;
    left: var(--space-3);
    color: var(--text-muted);
    font-size: 1.25rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.quick-search-input {
    width: 100%;
    height: 2.5rem;
    padding: 0 2.5rem 0 2.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
}

.quick-search-input:focus {
    border-color: var(--accent-border);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.quick-search-input::-webkit-search-cancel-button {
    display: none;
}

.quick-search-key {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    padding: 0 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    transform: translateY(-50%);
}

.quick-search.is-open .quick-search-key,
.quick-search-input:focus + .quick-search-key {
    display: none;
}

.quick-search-panel {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: 0;
    width: max(100%, 24rem);
    max-height: min(32rem, calc(100vh - 6rem));
    overflow-y: auto;
    padding: var(--space-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

.quick-search-group + .quick-search-group {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.quick-search-group-label {
    margin: var(--space-1) var(--space-2);
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quick-search-result,
.quick-search-all {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
}

.quick-search-result:hover,
.quick-search-result.is-active,
.quick-search-all:hover,
.quick-search-all.is-active {
    background: var(--bg-hover);
}

.quick-search-thumb {
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    width: 2rem;
    height: 3rem;
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-secondary);
}

.quick-search-thumb.is-square {
    height: 2rem;
}

.quick-search-thumb.is-round {
    height: 2rem;
    border-radius: 50%;
}

.quick-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quick-search-copy {
    display: grid;
    min-width: 0;
}

.quick-search-copy strong,
.quick-search-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-search-copy small {
    color: var(--text-muted);
}

.quick-search-empty {
    margin: var(--space-2);
    color: var(--text-muted);
}

.quick-search-all {
    margin-top: var(--space-2);
    padding: var(--space-2);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    color: var(--accent);
}

/* The narrow layout has no top bar to put it in: it opens from the header's search button instead. */
/* As a picker (QuickSearch's `onSelect`): its results drawn in place, under the box. */
.quick-search.is-picker {
    max-width: none;
    margin: 0;
}

.quick-search.is-picker .quick-search-input {
    padding-right: var(--space-4);
}

/* Centred on the box, not on the box and the results under it. */
.quick-search.is-picker .quick-search-icon,
.quick-search.is-picker .quick-search-spinner {
    top: 1.25rem;
}

.quick-search.is-picker .quick-search-panel {
    position: static;
    width: auto;
    max-height: min(24rem, 55vh);
    margin-top: var(--space-3);
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

@media (width < 992px) {
    .app-shell:not(.is-search-open) .app-topbar .quick-search {
        display: none;
    }
}

/* Settings > Search: the filter choices. */
.search-filter-options {
    margin: var(--space-4) 0 0;
    padding: 0;
    border: 0;
}

.search-filter-options legend {
    font-weight: 600;
}

.search-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-2);
}

.search-filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.search-type-list .item-list-row {
    padding-block: var(--space-2);
}

@keyframes sheet-slide-up {
    from { transform: translateY(100%); }
    to { transform: none; }
}

@keyframes sheet-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .dropdown-menu.is-open .dropdown,
    .dropdown-menu.is-open .dropdown-toggle:after,
    .row-menu-list:popover-open,
    .row-menu-list::backdrop {
        animation: none;
    }
}

/* Quick search's spinner takes the place of the "/" hint, at the right of the field, while it searches. */
.quick-search-spinner {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    display: none;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: quick-search-spin 0.7s linear infinite;
}

.quick-search.is-searching .quick-search-spinner {
    display: block;
}

.quick-search.is-searching .quick-search-key {
    display: none;
}

@media (width < 992px) {
    .app-topbar .quick-search-spinner {
        right: calc(var(--space-3) * 2);
    }
}

@keyframes quick-search-spin {
    to { transform: rotate(360deg); }
}

/*
 * Sortable lists (component/sortable.js), the same on every page that reorders something: a grip
 * at each row's start to drag it by, a placeholder that opens where the row will land, the row
 * itself faded while it is carried, and arrows as small as text for one step at a time.
 */
.is-sortable .item-list-main {
    align-items: center;
}

.sortable-handle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    min-width: 1.75rem;
    min-height: 1.75rem;
    margin: 0 calc(-1 * var(--space-1)) 0 calc(-1 * var(--space-2));
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.sortable-handle:hover {
    color: var(--text-primary);
}

.is-sort-disabled .sortable-handle {
    opacity: 0.3;
    cursor: default;
}

.is-sorting,
.is-sorting .sortable-handle {
    cursor: grabbing;
}

/* The row being carried: lifted out of the list and drawn under the pointer, above everything. */
.is-sortable.is-dragging {
    position: fixed;
    z-index: 2000;
    margin: 0;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.sortable-placeholder {
    box-sizing: border-box;
    flex: 0 0 auto;
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    background: var(--accent-dim);
    animation: sortable-placeholder-in 120ms ease-out;
}

@keyframes sortable-placeholder-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/*
 * Sortable rows on a phone, laid out the way phone lists are: the title on a line of its own, what
 * describes it -- the detail text, the badge, any summary -- on the lines below, and the row's
 * controls last, a switch at the start and the menu at the end. The handle runs down the row's
 * left edge, wide enough for a thumb.
 */
@media (max-width: 640px) {
    .item-list-row.is-sortable:not([hidden]) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: var(--space-2);
        align-items: start;
        padding: var(--space-3);
    }

    .is-sortable .item-list-main {
        display: contents;
    }

    .is-sortable .sortable-handle {
        grid-column: 1;
        grid-row: 1 / span 4;
        align-self: center;
        min-width: 2.25rem;
        min-height: 2.75rem;
        margin: 0;
        font-size: 1.4rem;
    }

    .is-sortable .item-list-main > :not(.sortable-handle),
    .is-sortable .item-list-actions {
        grid-column: 2;
    }

    .is-sortable .item-list-copy { order: 1; }
    .is-sortable .item-list-main > .badge { order: 2; justify-self: start; margin-top: var(--space-1); }
    .is-sortable .item-list-summary { order: 3; margin-top: var(--space-1); }
    .is-sortable .item-list-actions { order: 4; }

    .is-sortable .item-list-copy strong,
    .is-sortable .item-list-copy small {
        white-space: normal;
    }

    .is-sortable .item-list-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: var(--space-1) var(--space-2);
        margin: var(--space-2) 0 0;
    }

    .is-sortable .item-list-actions > .row-menu {
        margin-left: auto;
    }

    /* A folder has only its menu, which stays beside the path in a column of its own. */
    .item-list-row.is-sortable.folder-list-item:not([hidden]) {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .folder-list-item.is-sortable .item-list-actions {
        grid-column: 3;
        grid-row: 1 / span 4;
        align-self: start;
        margin: 0;
    }
}

/* Phones: the entry's picture sits above its title, small enough to leave the backdrop showing. */
@media (width < 600px) {
    .entry-hero-inner {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        padding-top: 4rem;
    }

    .detail-poster-wrap {
        width: 8.5rem;
    }

    .entry-detail-artist .detail-poster-wrap,
    .entry-detail-album .detail-poster-wrap,
    .entry-detail-track .detail-poster-wrap {
        width: 10rem;
    }
}

.player-view-button[hidden],
.media-player-lyrics[hidden],
.media-player-lyrics-language[hidden] {
    display: none;
}

.player-view-button.is-active,
.player-sing-view-button.is-active {
    color: var(--accent);
}

.media-player-lyrics {
    position: absolute;
    inset: 4rem 0 9rem;
    z-index: 4;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.media-player-lyrics-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
}

.media-player-lyrics:not(.is-synced) .player-sing-view-button {
    display: none;
}

.media-player-lyrics-language {
    max-width: 12rem;
    padding: .3rem .5rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md, 6px);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.media-player-lyrics-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 30vh var(--space-4);
    text-align: center;
    scrollbar-width: thin;
    mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
}

.media-player-lyrics:not(.is-synced) .media-player-lyrics-body {
    padding-block: 4rem;
}

.media-player-lyrics-line {
    margin: 0 auto;
    max-width: 40rem;
    padding: .35rem 0;
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.media-player-lyrics.is-synced .media-player-lyrics-line {
    font-size: 1.4rem;
    font-weight: 600;
    opacity: .45;
    cursor: pointer;
    transition: opacity 200ms ease, transform 200ms ease;
}

.media-player-lyrics.is-synced .media-player-lyrics-line:hover,
.media-player-lyrics.is-synced .media-player-lyrics-line:focus-visible {
    opacity: .8;
}

.media-player-lyrics.is-synced .media-player-lyrics-line.is-active {
    opacity: 1;
    color: var(--accent);
    transform: scale(1.04);
}

/* Word timings: the current line is white, each word turns to the accent as it is sung. */
.media-player-lyrics.is-synced .media-player-lyrics-line.is-active.has-words {
    color: var(--text-primary);
}

.media-player-lyrics-line.is-active .media-player-lyrics-word.is-sung {
    color: var(--accent);
}

.media-player-lyrics-word {
    transition: color 120ms linear;
}

.media-player.is-lyrics-open .media-player-artwork {
    opacity: .12;
}

/* The sing view: lyrics over the whole stage in large type. */
.media-player.is-sing-view .media-player-lyrics {
    inset: 0;
    z-index: 5;
    padding-top: 1rem;
    background: #000;
}

.media-player.is-sing-view .media-player-lyrics-body {
    padding-block: 35vh;
}

.media-player.is-sing-view .media-player-lyrics-line {
    max-width: 60rem;
    padding: .6rem 0;
    font-size: clamp(1.6rem, 4.5vw, 3.2rem);
    line-height: 1.25;
    color: #fff;
}

.media-player.is-sing-view .media-player-lyrics.is-synced .media-player-lyrics-line {
    opacity: .3;
}

.media-player.is-sing-view .media-player-lyrics.is-synced .media-player-lyrics-line.is-active {
    opacity: 1;
    transform: scale(1.06);
}

.media-player.is-sing-view .media-player-lyrics.is-synced .media-player-lyrics-line.is-active:not(.has-words) {
    color: var(--accent);
}

.media-player.is-sing-view .media-player-lyrics-toolbar {
    padding: .75rem 5rem 0;
}

/* The audio visualiser: over the whole stage, under the artwork; each style picks where it draws. */
.media-player-visualiser {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    pointer-events: none;
    opacity: .85;
}

.media-player-visualiser[hidden] {
    display: none;
}

/* A visualiser drawn as light adding up on the dark brings the dark with it, in either theme. */
.media-player-visualiser.is-dark {
    background: #05050a;
    opacity: 1;
}

/* Now playing (src/now-playing.js): an equaliser on the card or list row of what is playing,
   moving while it plays and still while paused. It only appears where that module gives it content. */
.entry-card::after,
.track-row-position::after {
    position: absolute;
    width: 1.1rem;
    height: 1rem;
    background:
        linear-gradient(var(--accent), var(--accent)) 0 100% / 25% 40% no-repeat,
        linear-gradient(var(--accent), var(--accent)) 50% 100% / 25% 90% no-repeat,
        linear-gradient(var(--accent), var(--accent)) 100% 100% / 25% 60% no-repeat;
    animation: now-playing-bars .9s ease-in-out infinite alternate;
    animation-play-state: var(--now-playing-state, paused);
    pointer-events: none;
}

.entry-card::after {
    top: .5rem;
    left: .5rem;
    z-index: 2;
    padding: .3rem;
    border-radius: .35rem;
    background-color: rgb(0 0 0 / .6);
    background-origin: content-box;
    background-clip: content-box;
    box-sizing: content-box;
}

.track-row-position::after {
    inset: 0;
    margin: auto;
}

@keyframes now-playing-bars {
    0% { background-size: 25% 40%, 25% 90%, 25% 60%; }
    50% { background-size: 25% 85%, 25% 35%, 25% 75%; }
    100% { background-size: 25% 55%, 25% 70%, 25% 30%; }
}

@media (prefers-reduced-motion: reduce) {
    .entry-card::after,
    .track-row-position::after {
        animation: none;
    }
}

/*
 * A heart that likes the entry, filled once liked, beside a rounded badge of how many like it.
 * Both take the theme's surface, so they read on a poster and on the page alike.
 */
.like-control {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.like-control .like-button {
    background: 0;
    border: 0;
}

.like-control.has-likes .like-button {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    color: var(--danger);
}

.like-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.like-icon path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

.like-control.is-liked .like-icon path {
    stroke: currentColor;
    fill: var(--bg-primary);
}

.like-count {
    font-size: small;
}

.like-count[hidden] {
    display: none;
}

/*
 * A row's actions behind one "•••" button (row-menu.js). The menu is a popover in the top layer,
 * placed against the button by script, so nothing it sits in can clip it.
 */
.row-menu[hidden] {
    display: none;
}

.row-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border-radius: 50%;
    color: var(--text-secondary);
}

.row-menu-toggle .material-symbols-outlined {
    font-size: 1.25rem;
}

.row-menu-toggle:hover,
.row-menu.is-open .row-menu-toggle {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.row-menu-list {
    position: fixed;
    inset: auto;
    margin: 0;
    flex-direction: column;
    min-width: 11rem;
    max-width: min(18rem, calc(100vw - 1rem));
    padding: var(--space-1) 0;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    box-shadow: var(--shadow);
}

.row-menu-list:popover-open {
    display: flex;
}

.row-menu-item {
    min-height: 2.25rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.row-menu-item:disabled {
    opacity: 0.4;
    cursor: default;
}

.row-menu-icon {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 1.15rem;
}

.row-menu-item.is-danger .row-menu-icon {
    color: inherit;
}

.row-menu-separator {
    height: 1px;
    margin: var(--space-1) 0;
    background: var(--border);
}

/* On a phone, a row's menu is a sheet like every dropdown there (see the dropdown sheet above). */
@media (width < 992px) {
    /* As a popover, the menu has a backdrop of its own. */
    .row-menu-list {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 80vh;
        overflow-y: auto;
        padding: var(--space-2) var(--space-2) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .row-menu-list:popover-open {
        animation: sheet-slide-up 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .row-menu-list::backdrop {
        background: rgb(0 0 0 / 0.6);
        animation: sheet-backdrop-in 200ms ease-out;
    }

    .row-menu-list::before {
        content: '';
        flex: 0 0 auto;
        align-self: center;
        width: 2.5rem;
        height: 0.25rem;
        margin: var(--space-1) 0 var(--space-2);
        border-radius: 999px;
        background: var(--border-strong);
    }

    .row-menu-list .row-menu-item {
        min-height: 3rem;
        font-size: 1rem;
    }
}

/* An entry's title as its own logo (TMDB's, fanart.tv's, or clearlogo.png beside the media). */
.detail-title.has-logo {
    max-width: none;
}

.detail-title-logo {
    display: block;
    width: auto;
    max-width: min(28rem, 100%);
    height: auto;
    max-height: clamp(4.5rem, 14vw, 9rem);
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 2px 12px rgb(0 0 0 / 0.55));
}

.detail-trailer-button:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.detail-trailer-button .material-symbols-outlined {
    font-size: 1.2rem;
}

.detail-theme-toggle[aria-pressed="false"] {
    color: var(--text-muted);
}

/* A provider's trailer, at the width of the screen and the shape of a film. */
.app-dialog.trailer-dialog {
    width: min(64rem, calc(100vw - 2rem));
}

.trailer-dialog .app-dialog-body {
    padding: 0;
}

.trailer-frame {
    aspect-ratio: 16 / 9;
    background: #000;
}

.trailer-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Every kind of artwork side by side where there is room for it. */
.entry-edit-artwork-section {
    grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
}

.entry-edit-artwork-section > .form-help {
    grid-column: 1 / -1;
}

/* The Games section (page/games.js): a card for each game a plugin registered. */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
    gap: 1.25rem;
}

.game-card {
    --game-accent: var(--accent);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.game-card:hover,
.game-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--game-accent);
    box-shadow: var(--shadow-lg);
}

.game-card-art {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--game-accent) 70%, transparent), transparent 70%), #07060f;
}

.game-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-card-icon {
    color: #fff;
    font-size: 4rem;
    text-shadow: 0 0 1.5rem var(--game-accent);
}

.game-card-body {
    display: grid;
    align-content: start;
    gap: .35rem;
    padding: 1rem 1.1rem .5rem;
}

.game-card-title {
    margin: 0;
    font-size: 1.25rem;
}

.game-card-tagline {
    margin: 0;
    color: var(--game-accent);
    font-weight: 600;
}

.game-card-description {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.45;
}

.game-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: .35rem 0 0;
    padding: 0;
    list-style: none;
}

.game-card-tags li {
    padding: .1rem .55rem;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: .8rem;
}

.game-card-tags li,
.game-card-play {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: .35rem;
    margin: .5rem 1.1rem 1.1rem;
}

/* =========================================================
   Play button: loading and buffering
   A ring turning round the button while what plays loads or
   buffers, as on a radio station's public page; the button
   itself stays as it is, rather than fading out.
   ========================================================= */

.player-toggle {
    position: relative;
    box-shadow: 0 8px 20px rgb(0 0 0 / .25);
}

.player-toggle[data-state="loading"]::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    animation: player-spin .9s linear infinite;
    pointer-events: none;
}

.media-player.is-media-loading .player-toggle,
.player-toggle[data-state="loading"]:disabled {
    opacity: 1;
    cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
    .player-toggle[data-state="loading"]::after {
        animation-duration: 2.5s;
    }
}

/* Sound has its ring on the button; the stage's own spinner is for video. */
.media-player.is-audio .media-player-loading {
    display: none;
}

/* =========================================================
   Audio: what is playing, under the artwork
   ========================================================= */

.media-player.is-audio .media-player-stage {
    flex-direction: column;
    gap: var(--space-4);
}

.media-player.is-audio .media-player-artwork {
    max-height: calc(65vh - 6rem);
}

.media-player-caption {
    position: relative;
    z-index: 1;
    display: grid;
    gap: .2rem;
    width: min(24rem, 80vw);
    text-align: center;
}

.media-player-caption[hidden],
.media-player.is-video .media-player-caption,
.media-player.is-lyrics-open .media-player-caption {
    display: none;
}

.media-player-caption-title,
.media-player-caption-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-player-caption-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.media-player-caption-line {
    color: var(--text-secondary);
}

.media-player-caption-line.is-album {
    font-size: .9rem;
    color: var(--text-muted);
}

/* =========================================================
   Live streams (a radio station): no end, so no seek bar and
   no before or after; a red dot says it is live.
   ========================================================= */

.media-player.is-live .player-timeline,
.media-player.is-live .media-player-mini-seek,
.media-player.is-live .player-prev,
.media-player.is-live .player-next {
    display: none;
}

.media-player-live-dot,
.media-player.is-live .media-player-mini-copy .media-player-title::before,
.media-player.is-live .media-player-expanded-copy .media-player-title::before {
    display: inline-block;
    flex: none;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #ff3b4e;
    box-shadow: 0 0 0 3px rgb(255 59 78 / .22);
    animation: live-dot-pulse 2s ease-in-out infinite;
}

.media-player.is-live .media-player-mini-copy .media-player-title::before,
.media-player.is-live .media-player-expanded-copy .media-player-title::before {
    content: "";
    margin-right: .45rem;
    vertical-align: .1em;
}

@keyframes live-dot-pulse {
    50% {
        box-shadow: 0 0 0 5px rgb(255 59 78 / .08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .media-player-live-dot,
    .media-player.is-live .media-player-title::before {
        animation: none;
    }
}

.media-player-caption a {
    color: inherit;
    text-decoration: none;
}

.media-player-caption a:hover {
    text-decoration: underline;
}

/* What a live item is -- the station -- over what it plays now. */
.media-player-caption-line.is-source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-bottom: .25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.media-player-caption-line.is-source .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Over the stage's gesture surface, so its links can be followed; the rest of it lets taps through to the gestures. */
.media-player-caption {
    z-index: 4;
    pointer-events: none;
}

.media-player-caption a {
    pointer-events: auto;
}

/* The mini player's close, at its end: quieter than the buttons that play. */
.media-player-mini .player-mini-close {
    font-size: 1.25rem;
    padding: var(--space-2);
    color: var(--text-secondary);
}

.media-player-mini .player-mini-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Settings > Updates: installing an update and going back */
.update-progress {
    width: 100%;
    height: 0.4rem;
    border: 0;
    border-radius: var(--radius-pill);
    overflow: hidden;
    appearance: none;
    background: var(--bg-hover);
    accent-color: var(--accent);
}

.update-progress::-webkit-progress-bar {
    background: var(--bg-hover);
}

.update-progress::-webkit-progress-value {
    background: var(--accent);
}

.update-progress::-moz-progress-bar {
    background: var(--accent);
}

/* The progress notice's body spans the notice, so the bar does too. */
.update-notice .notice-body {
    flex: 1;
}

/* Without a value (a phase with no amount to show) a band sweeps across, since the styled bar no
   longer draws the browser's own activity animation. */
.update-progress:indeterminate {
    background: linear-gradient(90deg, transparent 0 35%, var(--accent) 35% 65%, transparent 65% 100%) var(--bg-hover);
    background-size: 200% 100%;
    animation: update-progress-sweep 1.4s linear infinite;
}

.update-progress:indeterminate::-webkit-progress-bar {
    background: transparent;
}

.update-progress:indeterminate::-moz-progress-bar {
    background: transparent;
}

@keyframes update-progress-sweep {
    from { background-position: 150% 0; }
    to { background-position: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .update-progress:indeterminate {
        animation-duration: 4s;
    }
}

.update-rollback {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.update-rollback p {
    margin: 0;
}

/*
 * A list row that can be removed by a swipe (component/row-remove.js): the row slides to the left
 * and the action, in red, fills the room it leaves at its right edge.
 */
/* Not while it is dragged: then it is lifted out of the list, fixed where the pointer carries it (sortable.js). */
.item-list-row.is-swipe-removable:not(.is-dragging) {
    position: relative;
}

.item-list-row.is-swipe-removable {
    touch-action: pan-y;
    transform: translateX(var(--swipe-x, 0));
}

.item-list-row.is-swipe-settling {
    transition: transform 180ms ease;
}

.item-list-row.is-swipe-settling .row-swipe-remove {
    transition: width 180ms ease;
}

.row-swipe-remove {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: var(--danger);
    color: #fff;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 650;
    white-space: nowrap;
}

/* What slides out of a list being swiped is cut off at its edges, not drawn over the page. */
.item-list:has(> .is-swipe-removable) {
    overflow-x: clip;
}

/*
 * Rows chosen to be acted on together (component/list-selection.js): marked, with a bar above the
 * list saying how many and what can be done with them. A chosen row dragged by its handle carries
 * the others: they fold away while it is carried, and it shows how many it carries.
 */
.item-list-row.is-selected {
    background: var(--accent-dim);
    box-shadow: inset 3px 0 0 var(--accent);
}

.item-list.is-selecting > .item-list-row {
    cursor: pointer;
}

.list-selection-bar {
    position: sticky;
    /* Below the app's own top bar, which stays at the top as the page scrolls. */
    top: calc(3.75rem + var(--space-2));
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm, 0 2px 8px rgb(0 0 0 / .15));
}

.list-selection-bar[hidden] {
    display: none;
}

.list-selection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.item-list-row.is-carried-along {
    display: none;
}

.item-list-row.is-dragging[data-carry-count]::after {
    content: attr(data-carry-count);
    position: absolute;
    top: -0.6rem;
    right: -0.6rem;
    display: grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Below the phone header, where the app has that instead. */
@media (width < 992px) {
    .list-selection-bar {
        top: calc(var(--mobile-header-height, 3.5rem) + var(--space-2));
    }
}

/* =========================================================
   Track rows (component/entry/track-row.js): an album's track list, a library shown as a list, a
   radio station's On air and Playlist. On one line at every width -- the handle, the number, the
   artwork, the title over who and where from, then its controls and its length -- not the phone
   layout other lists take below 640px. Last in the file, so it wins over those.
   ========================================================= */

.item-list-row.track-row:not([hidden]) {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    column-gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
}

.item-list-row.track-row.is-openable {
    cursor: pointer;
}

.item-list-row.track-row.is-openable:hover {
    background: var(--bg-hover);
}

.item-list-row.track-row.is-active {
    background: var(--accent-dim);
}

.track-row .item-list-main {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
}

.track-row .item-list-copy {
    min-width: 0;
}

.track-row .item-list-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    flex-basis: auto;
    gap: var(--space-2);
    margin: 0 0 0 auto;
    justify-content: flex-end;
}

.track-row .sortable-handle {
    flex: none;
    min-height: 0;
    margin: 0;
}

.track-row-track {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.track-row-position {
    position: relative;
    flex: 0 0 1.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.track-row-artwork {
    position: relative;
    display: grid;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-sm, 0.35rem);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Posters and book covers stand upright. */
.track-row-artwork.is-movie,
.track-row-artwork.is-show,
.track-row-artwork.is-book,
.track-row-artwork.is-comic_issue,
.track-row-artwork.is-audiobook {
    width: calc(2.75rem * 2 / 3);
}

.track-row-image {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    object-fit: cover;
    font-size: 1.2rem;
}

/* The artwork that plays its track: a play button over it on hover or focus. */
.track-row-artwork.is-playable {
    cursor: pointer;
}

.track-row-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.track-row-artwork.is-playable:hover .track-row-play,
.track-row-artwork.is-playable:focus-visible .track-row-play {
    opacity: 1;
}

.track-row-text {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.item-list-row.track-row .track-row-title,
.item-list-row.track-row .track-row-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-list-row.track-row .track-row-title {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 650;
}

.track-row-subtitle {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.track-row-title a,
.track-row-subtitle a {
    color: inherit;
    text-decoration: none;
}

.track-row-title a:hover,
.track-row-subtitle a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.track-row-text .badge {
    justify-self: start;
    margin-top: 0.2rem;
}

.track-row-duration {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* A list with a heading and nothing around it (component/panel.js, ListSection). */
.list-section {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
}

.list-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.list-section-header h2 {
    flex: none;
    margin: 0;
    font-size: var(--font-lg, 1.15rem);
}

.list-section-actions {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* Its rows line up with its heading: the list brings no padding of its own. */
.list-section .item-list-row.track-row:not([hidden]),
.list-section > .item-list > .item-list-row {
    padding-inline: 0;
}

/* =========================================================
   A card's actions (component/entry/actions.js), shared by entry and station cards: a round play
   button over its picture and its "Options for …" menu in the top corner, both shown on hover or
   focus. On a touch screen the play button stays out of the way; a long press opens the menu.
   ========================================================= */

.card-play {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin: -1.5rem 0 0 -1.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: 1.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.card-play:hover {
    transform: scale(1.06);
}

.card-menu {
    position: absolute;
    z-index: 4;
    top: calc(4px + 0.4rem);
    right: calc(4px + 0.4rem);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.card-menu .row-menu-toggle {
    background: rgb(0 0 0 / 0.45);
    color: #fff;
}

:is(.entry-card, .radio-card):is(:hover, :focus-within) :is(.card-play, .card-menu),
.card-menu.is-open {
    opacity: 1;
}

/* The menu takes the corner the type badge sits in while it shows. */
.entry-card:is(:hover, :focus-within) .entry-type-badge {
    opacity: 0;
}

@media (hover: none) {
    .card-play,
    .card-menu {
        display: none;
    }
}

/* Liked by this person: a small heart, on the card's picture and at the end of a row. */
.entry-liked-badge {
    display: none;
    color: var(--danger);
    font-size: 1rem;
    font-variation-settings: 'FILL' 1;
}

.entry-card.is-liked .entry-liked-badge {
    position: absolute;
    z-index: 2;
    right: 0.4rem;
    bottom: 0.4rem;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.55);
    font-size: 0.95rem;
}

.track-row.is-liked .entry-liked-badge {
    display: inline-block;
}

/* =========================================================
   Entry hero (component/entry/hero.js), full bleed: the backdrop runs edge to edge under the top
   bar and fades into the page, its contents sit at its foot within the page's own padding. With a
   logo it is cinematic -- the logo for a title, no poster; without one the poster stands beside the
   title. The fades are the page's own colour, so the text reads in either theme. Last in the file,
   so it wins over the card it was.
   ========================================================= */

.entry-hero {
    --hero-fade: var(--bg-app);
    min-height: clamp(24rem, 64vh, 42rem);
    margin: calc(-1 * var(--space-5)) calc(-1 * var(--content-pad-x)) var(--space-5);
    overflow: hidden;
    isolation: isolate;
    border: 0;
    border-radius: 0;
    background: var(--bg-secondary);
    box-shadow: none;
}

.entry-hero.has-backdrop {
    background-image: var(--detail-backdrop);
    background-size: cover;
    background-position: center 25%;
    background-repeat: no-repeat;
}

.entry-hero::after {
    z-index: -1;
    border-radius: 0;
    background:
        linear-gradient(90deg,
            color-mix(in srgb, var(--hero-fade) 94%, transparent) 0%,
            color-mix(in srgb, var(--hero-fade) 74%, transparent) 36%,
            color-mix(in srgb, var(--hero-fade) 12%, transparent) 72%,
            transparent 100%),
        linear-gradient(0deg, var(--hero-fade) 0%, transparent 45%);
}

.entry-hero-inner {
    align-items: end;
    box-sizing: border-box;
    min-height: inherit;
    padding: clamp(4rem, 12vh, 8rem) var(--content-pad-x) clamp(1.5rem, 4vw, 2.75rem);
}

/* Cinematic: the logo is the title, and the poster gives way to the backdrop. */
.entry-hero.has-logo .entry-hero-inner {
    grid-template-columns: minmax(0, 42rem);
}

.entry-hero.has-logo .detail-poster-wrap {
    display: none;
}

.entry-hero.has-logo .detail-title-logo {
    max-width: min(30rem, 100%);
    max-height: clamp(5rem, 16vh, 10rem);
    margin-bottom: var(--space-2);
}

@media (width < 992px) {
    /* No top bar above it here: flush with the top of the content. */
    .entry-hero {
        min-height: clamp(22rem, 70vh, 34rem);
        margin-top: calc(-1 * var(--content-pad-top));
    }

    .entry-hero::after {
        background:
            linear-gradient(0deg,
                var(--hero-fade) 0%,
                color-mix(in srgb, var(--hero-fade) 85%, transparent) 45%,
                color-mix(in srgb, var(--hero-fade) 20%, transparent) 100%);
    }

    .entry-hero.has-logo .entry-hero-inner {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* =========================================================
   A show's episodes, a season at a time (component/entry/season-episodes.js): the seasons as tabs,
   the chosen season's episodes in a row that scrolls sideways, each a still over its number,
   title, length and a line of what happens.
   ========================================================= */

.season-episodes {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
}

.season-episodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.season-episodes-header h2 {
    margin: 0;
}

.season-episodes-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.season-open-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.season-open-link[hidden] {
    display: none;
}

.episode-row-arrows {
    display: flex;
    gap: var(--space-2);
}

@media (hover: none) {
    .episode-row-arrows {
        display: none;
    }
}

/*
 * Every season in sight: the tabs wrap onto more lines rather than run past the section's edge, where
 * a hidden scrollbar left no sign there were more.
 */
.season-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-width: 0;
    padding-bottom: var(--space-1);
}

.season-tabs[hidden] {
    display: none;
}

.season-tab {
    flex: none;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.season-tab:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.season-tab.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.episode-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(15rem, 24vw, 20rem);
    gap: var(--space-4);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--space-1);
    padding: var(--space-1) var(--space-1) var(--space-3);
    scrollbar-width: thin;
}

.episode-tile {
    position: relative;
    display: grid;
    align-content: start;
    gap: var(--space-2);
    min-width: 0;
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
}

.episode-tile-still {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.episode-tile-still img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* A missing episode greyed as a missing card is: its still, not its badge, coloured again on hover. */
.episode-tile.is-missing .episode-tile-still img {
    filter: grayscale(100%);
    transition: filter var(--transition-fast), opacity var(--transition-fast);
}

.episode-tile.is-missing:hover .episode-tile-still img,
.episode-tile.is-missing:focus-visible .episode-tile-still img {
    filter: grayscale(0%);
    opacity: 1;
}

.episode-tile-placeholder {
    color: var(--text-muted);
    font-size: 2rem;
}

.episode-tile:is(:hover, :focus-visible) .episode-tile-still {
    border-color: var(--accent-border, var(--accent));
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.3);
    transform: translateY(-2px);
}

/* The episode being looked at. */
.episode-tile.is-active .episode-tile-still {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

/* The availability badge (see .availability-badge), on an episode's still. */
.episode-tile-badge {
    position: absolute;
    z-index: 2;
    left: 0.5rem;
    top: 0.5rem;
    max-width: calc(100% - 1rem);
}

.episode-tile-text {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.episode-tile-facts {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.episode-tile-title {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.episode-tile-overview {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.episode-tile.is-loading .episode-tile-still {
    border: 0;
}

/* Its play button and menu, as on a card (entry/actions.js): shown on hover or focus. */
.episode-tile .card-menu {
    top: calc(0.4rem + 1px);
    right: calc(0.4rem + 1px);
}

.episode-tile:is(:hover, :focus-within) :is(.card-play, .card-menu) {
    opacity: 1;
}

@media (width < 600px) {
    .episode-row {
        grid-auto-columns: 78%;
    }
}

/* =========================================================
   Featured titles, one at a time across the page (component/hero-carousel.js): full bleed as the
   detail page's hero is, the slides in a row that snaps, arrows at the sides and dots at the foot.
   ========================================================= */

/* Edge to edge of the content area, whatever width the page's container keeps to: the carousel
   measures the area (--bleed-width) and reaches out to it from the middle of the container. */
.hero-carousel {
    position: relative;
    width: var(--bleed-width, calc(100% + 2 * var(--content-pad-x)));
    margin-inline: calc(50% - var(--bleed-width, calc(100% + 2 * var(--content-pad-x))) / 2);
    margin-bottom: var(--space-5);
}

.hero-carousel[hidden] {
    display: none;
}

/* The section heading, over the top of the slides, on a scrim so it reads on any backdrop. */
.hero-carousel-head {
    position: absolute;
    z-index: 3;
    inset: 0 0 auto;
    padding: var(--space-4) var(--content-pad-x) var(--space-7);
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-app) 85%, transparent), transparent);
    pointer-events: none;
}

.hero-carousel-head .section-head-link {
    pointer-events: auto;
}

/* The page's first section reaches up to the top bar, as the detail hero does. */
.container > .hero-carousel:first-child {
    margin-top: calc(-1 * var(--space-5));
}

.hero-carousel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.hero-carousel-track::-webkit-scrollbar {
    display: none;
}

.hero-slide {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(22rem, 56vh, 36rem);
    overflow: hidden;
    isolation: isolate;
    background: var(--bg-secondary) var(--slide-backdrop, none) center 25% / cover no-repeat;
    scroll-snap-align: start;
}

.hero-slide::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(90deg,
            color-mix(in srgb, var(--bg-app) 94%, transparent) 0%,
            color-mix(in srgb, var(--bg-app) 72%, transparent) 34%,
            color-mix(in srgb, var(--bg-app) 10%, transparent) 70%,
            transparent 100%),
        linear-gradient(0deg, var(--bg-app) 0%, transparent 40%);
}

.hero-slide-content {
    display: grid;
    justify-items: start;
    gap: var(--space-2);
    max-width: 38rem;
    padding: clamp(3rem, 10vh, 6rem) var(--content-pad-x) clamp(3rem, 7vh, 4.5rem);
}


.hero-slide-title {
    margin: 0;
    font-size: clamp(1.9rem, 4.5vw, 3.6rem);
    font-weight: 780;
    line-height: 1;
    letter-spacing: -0.05em;
    text-wrap: balance;
}

.hero-slide-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.hero-slide-logo {
    display: block;
    max-width: min(26rem, 100%);
    max-height: clamp(4.5rem, 14vh, 8.5rem);
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 2px 12px rgb(0 0 0 / 0.45));
}

.hero-slide-facts {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.hero-slide-overview {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.hero-slide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.hero-slide-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.hero-carousel-arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-top: -1.375rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.45);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.hero-carousel-arrow:hover {
    background: rgb(0 0 0 / 0.65);
}

.hero-carousel-arrow.is-previous {
    left: 0.75rem;
}

.hero-carousel-arrow.is-next {
    right: 0.75rem;
}

.hero-carousel:is(:hover, :focus-within) .hero-carousel-arrow {
    opacity: 1;
}

.hero-carousel-dots {
    position: absolute;
    z-index: 2;
    right: var(--content-pad-x);
    bottom: 1.25rem;
    display: flex;
    gap: 0.4rem;
}

/* A carousel's dots, one per title, the current one drawn out long: the featured and the 3D carousels. */
.carousel-dot {
    width: 0.55rem;
    height: 0.55rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--text-primary) 30%, transparent);
    cursor: pointer;
    transition: width var(--transition), background var(--transition);
}

.carousel-dot.is-active {
    width: 1.6rem;
    background: var(--accent);
}

.hero-carousel.has-one :is(.hero-carousel-arrow, .hero-carousel-dots) {
    display: none;
}

@media (hover: none) {
    .hero-carousel-arrow {
        display: none;
    }
}

@media (width < 992px) {
    .container > .hero-carousel:first-child {
        margin-top: calc(-1 * var(--content-pad-top));
    }

    .hero-slide {
        min-height: clamp(24rem, 70vh, 32rem);
    }

    .hero-slide::after {
        background: linear-gradient(0deg,
            var(--bg-app) 0%,
            color-mix(in srgb, var(--bg-app) 82%, transparent) 45%,
            color-mix(in srgb, var(--bg-app) 15%, transparent) 100%);
    }

    .hero-carousel-dots {
        right: 50%;
        transform: translateX(50%);
        bottom: 0.75rem;
    }
}

/* What the chosen file is, at a glance, under the hero's title (component/entry/info-chips.js). */
.info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-1) 0 0;
    padding: 0;
    list-style: none;
}

.info-chip {
    padding: 0.15rem 0.55rem;
    border: 1px solid color-mix(in srgb, var(--text-primary) 28%, transparent);
    border-radius: var(--radius-sm, 0.35rem);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
    white-space: nowrap;
}

.info-chip.is-quality {
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: var(--bg-app);
}

.info-chip.is-hdr {
    border-color: #f5c542;
    color: #f5c542;
}

:root[data-theme="light"] .info-chip.is-hdr {
    border-color: #9a6b00;
    color: #9a6b00;
}

/* =========================================================
   A card's hover, made more of: it lifts, a soft halo in the outline's colours spreads around it,
   the rotating outline is a touch thicker and the sheen sweeps brighter and slower. Still for
   anyone who asked for less motion.
   ========================================================= */

/*
 * The glow is the outline's own colours, blurred, behind the poster and turning with it -- around the
 * picture, not the card, whose title sits on the page itself. (The lift, outline and sheen it goes
 * with are with the card's other hover rules, under .entry-card.)
 */

/* Unclipped, the picture keeps its own rounded corners. */
.entry-card:not(.is-missing, .is-active, .entry-card-placeholder) .entry-poster {
    border-radius: var(--radius-lg);
}

.entry-poster-glow {
    position: absolute;
    z-index: -2;
    inset: -2px;
    border-radius: var(--radius-lg);
    background: conic-gradient(from var(--outline-angle), #ff007f, #ff7b00, #ffea00, #00f5d4, #7b2cbf, #ff007f);
    filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-glow {
    opacity: 0.75;
    animation: spinRetroOutline 3s linear infinite;
}

/*
 * How far into it the person is (watchProgress in entry/cards.js): a line along the foot of a card's
 * or an episode tile's picture, part of the way while watching and all the way, quieter, once watched.
 * It covers the picture and is rounded with it, so the line follows the picture's corners.
 */
.watch-progress {
    position: absolute;
    z-index: 2;
    inset: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.watch-progress::before,
.watch-progress::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
}

.watch-progress::before {
    right: 0;
    background: rgb(0 0 0 / 0.45);
}

.watch-progress::after {
    width: var(--progress, 0%);
    background: var(--accent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Watched: the full line in green rather than the accent, and a check in the corner, like the like heart opposite. */
.watch-progress.is-watched::after {
    background: var(--success);
    box-shadow: 0 0 6px color-mix(in srgb, var(--success) 60%, transparent);
}

.watch-progress-check {
    position: absolute;
    left: 0.4rem;
    bottom: calc(0.4rem + 2px);
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.55);
    color: var(--success);
    font-size: 1rem;
    font-weight: 700;
}

/* Where a card says it is missing or withdrawn, on the same edge, that says more than the line. */
.entry-availability-badge ~ .watch-progress {
    display: none;
}

/*
 * The corner tabs slide up out of the picture on hover. With the wrapper no longer clipping (for the
 * glow), each tab clips itself to the slot it rests in: the clip shifts down by as much as the tab
 * moves up, so the tab disappears behind its own top edge instead of rising above the card. The
 * clip reaches past the tab's sides and bottom so its shadow still shows.
 */
.entry-poster-wrapper :is(.entry-type-badge, .entry-card-rating) {
    clip-path: inset(0 -12px -12px -12px);
    transition: transform var(--transition), opacity var(--transition), clip-path var(--transition);
}

.entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper :is(.entry-type-badge, .entry-card-rating) {
    clip-path: inset(100% -12px calc(-100% - 12px) -12px);
}

@media (prefers-reduced-motion: reduce) {
    .entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper {
        transform: none;
    }

    .entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-glow {
        animation: none;
    }

    .entry-card:not(.is-missing, .is-active, .entry-card-placeholder):hover .entry-poster-wrapper::after {
        animation: none;
    }
}
/* =========================================================
   One player (component/media-player.js): the same stage and controls at every size.

   Full: what plays across the top of the picture; under the picture its progress, and one row of
   controls -- previous, play, next and the time on the left; volume, subtitles, the queue, cast,
   settings, fullscreen and back to the mini player on the right. Audio keeps its artwork and the
   caption under it instead of the title across the top.

   Mini audio (and video on a phone): a card floating just above the foot of the page -- the
   picture, what plays, previous, play and next, volume and cast where there is room, and ⋯ for
   the rest; its progress a hairline along its foot.

   Mini video on a wide screen: a tile in the corner, the picture edge to edge with open and close
   in its top corners, previous, play and next over its middle, its progress
   along its foot, and under it only what plays.
   ========================================================= */

.player-expand-button,
.media-player .row-menu {
    display: none;
}

.player-time-readout {
    display: inline-flex;
    align-items: baseline;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.player-time-readout .player-time {
    min-width: 0;
}

.player-time-separator {
    padding-inline: 0.2rem;
    color: var(--text-muted);
}

.media-player.is-live .player-time-readout {
    display: none;
}

.player-control-button.is-active {
    color: var(--accent);
}

.media-player.is-queue-closed .media-player-playlist {
    display: none;
}

/* ---------- Full ---------- */

.media-player.is-expanded .player-timeline {
    display: block;
}

.media-player.is-expanded .player-collapse-button {
    position: static;
    font-size: 1.5rem;
    opacity: 1;
}

.media-player.is-expanded .player-dismiss-button {
    display: none;
}

.media-player .media-player-header {
    display: grid;
    justify-self: start;
    gap: 0.15rem;
    max-width: none;
    padding: var(--space-3);
}

/* What plays, across the top of the picture, with the controls. */
.media-player.is-expanded .media-player-header {
    position: absolute;
    z-index: 6;
    top: 0;
    right: 0;
    left: 0;
    padding: 1.25rem 1.5rem 2.5rem;
    background: linear-gradient(to bottom, rgb(0 0 0 / 0.65), transparent);
    color: #fff;
    transition: opacity 180ms ease;
    width: 100%;
}

.media-player.is-expanded .media-player-header .media-player-title {
    color: #fff;
    font-size: 1.15rem;
}

.media-player.is-expanded .media-player-header .media-player-subtitle,
.media-player.is-expanded .media-player-header .media-player-subtitle a {
    color: rgb(255 255 255 / 0.8);
}

.media-player.is-controls-hidden .media-player-header {
    opacity: 0;
}

/* Full audio: its artwork and the caption under it say what plays. */
.media-player.is-expanded.is-audio .media-player-header {
    display: none;
}

/* ---------- Mini, both ---------- */

.media-player.is-mini {
    container: mini-player / inline-size;
    overflow: visible;
    pointer-events: auto;
    color: var(--text-primary);
}

.media-player.is-mini .media-player-expanded {
    display: block;
}

.media-player.is-mini :is(.media-player-playlist, .media-player-caption,
    .media-player-lyrics, .media-player-visualiser, .media-player-karaoke, .player-gesture-hud,
    .player-collapse-button, .player-settings-wrap, .player-fullscreen, .player-view-button,
    .player-captions-button, .player-queue-button, .player-time-readout, .player-control-spacer) {
    display: none;
}

.media-player.is-mini .media-player-surface {
    display: block;
    overflow: visible;
}

.media-player.is-mini .media-player-stage {
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-2);
    min-height: 0;
    padding: var(--space-2);
    overflow: visible;
}

/* Clicking anywhere that is not a control opens the full player; a finger can draw it up. */
.media-player.is-mini .player-gesture-surface {
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    touch-action: pan-y;
}

.media-player.is-mini .media-player-stage > .player-controls {
    position: static;
    z-index: 3;
    display: flex;
    flex: none;
    align-items: center;
    min-width: 0;
    padding: 0;
    background: none;
    /* A backdrop filter would make the controls the box the progress line is placed in. */
    backdrop-filter: none;
    opacity: 1;
    transform: none;
    pointer-events: none;
}

.media-player.is-mini .player-controls :is(button, a, input, select, google-cast-launcher, .player-volume-control, .row-menu) {
    pointer-events: auto;
}

.media-player.is-mini .player-control-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
}

.media-player.is-mini .player-control-options {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.media-player.is-mini .media-player .row-menu,
.media-player.is-mini .player-control-options > .row-menu {
    display: inline-flex;
}

/* What plays: its title over who and where from. */
.media-player.is-mini .media-player-header {
    position: relative;
    z-index: 3;
    display: grid;
    flex: 1 1 auto;
    gap: 0.1rem;
    min-width: 0;
    max-width: none;
    pointer-events: none;
}

.media-player.is-mini .media-player-header :is(a, .media-player-subtitle a) {
    pointer-events: auto;
}

.media-player.is-mini .media-player-expanded :is(.media-player-title, .media-player-subtitle a) {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.media-player.is-mini .media-player-expanded .media-player-subtitle {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.media-player.is-mini .media-player-expanded .player-control-button:not(.player-toggle) {
    color: var(--text-primary);
}

.media-player.is-mini .player-toggle {
    width: 2.5rem;
    height: 2.5rem;
}

/* Progress: a hairline along the foot, still a slider to seek with. */
.media-player.is-mini .player-timeline {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
}

.media-player.is-mini .player-seek-wrap {
    width: 100%;
}

.media-player.is-mini .player-seek {
    display: block;
    width: 100%;
    height: 3px;
    margin: 0;
}

.media-player.is-mini.is-live .player-timeline {
    display: none;
}

/* ---------- Mini audio, and video on a phone: the card ---------- */

.media-player.is-mini {
    width: auto;
    margin: 0 var(--space-3) var(--space-3);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

.media-player.is-mini :is(.player-expand-button, .player-dismiss-button) {
    display: none;
}

/* The picture: the artwork, or the video itself, at the start of the card. */
.media-player.is-mini :is(.media-player-artwork, .media-player-element) {
    position: relative;
    z-index: 1;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-sm, 0.35rem);
    object-fit: cover;
    background: var(--bg-primary);
    font-size: 1.3rem;
}

.media-player.is-mini.is-audio .media-player-element,
.media-player.is-mini.is-video .media-player-artwork {
    display: none;
}

.media-player.is-mini.is-video .media-player-element {
    width: 4.9rem;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #000;
}

/* Least needed first: cast, then volume. Previous and next stay, as the design has them. */
@container mini-player (width < 760px) {
    .media-player.is-mini .player-cast {
        display: none;
    }
}

@container mini-player (width < 560px) {
    .media-player.is-mini .player-volume-control {
        display: none;
    }
}

@container mini-player (width < 340px) {
    .media-player.is-mini :is(.player-prev, .player-next) {
        display: none;
    }
}

/* ---------- Mini on a wide screen, audio and video alike: the tile ---------- */

/*
 * The picture edge to edge (the video, or the artwork of what plays), open and close in its top
 * corners, previous, play and next over its middle, and its progress along its foot. Under it
 * what plays, with the volume beside it.
 */
@media (width >= 992px) {
    /* Nothing clips the tile, so the volume panel can rise out of it: the picture rounds its own corners. */
    .media-player.is-mini:is(.is-audio, .is-video) {
        width: min(22rem, 30vw);
        margin: 0 var(--space-3) var(--space-3) auto;
        overflow: visible;
        border-radius: var(--radius-lg);
    }

    .media-player.is-mini:is(.is-audio, .is-video) .media-player-stage {
        position: relative;
        display: block;
        padding: 0;
    }

    .media-player.is-mini:is(.is-audio, .is-video) :is(.media-player-element, .media-player-artwork),
    .media-player.is-mini:is(.is-audio, .is-video) .player-transport {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
    }

    /* A track's artwork is mostly square: all of it, on black either side. */
    .media-player.is-mini.is-audio .media-player-artwork:not([hidden]) {
        display: block;
        object-fit: contain;
        background: #000;
    }

    .media-player.is-mini.is-audio .media-player-artwork-placeholder:not([hidden]) {
        display: grid;
        place-items: center;
        font-size: 2.5rem;
    }

    /*
     * The controls lie over the whole tile: the transport and the progress over the picture, the
     * volume beside what plays under it.
     */
    .media-player.is-mini:is(.is-audio, .is-video) .media-player-stage > .player-controls {
        position: absolute;
        inset: 0;
        display: grid;
        grid-template-rows: auto 1fr;
        grid-template-columns: minmax(0, 1fr);
        /* The full player's gap between its rows pushed the volume out of the tile's foot. */
        gap: 0;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-control-row {
        display: contents;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-transport {
        grid-area: 1 / 1;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: var(--space-4);
        width: 100%;
        aspect-ratio: 16 / 9;
        opacity: 0;
        transition: opacity var(--transition-fast), background var(--transition-fast);
    }

    .media-player.is-mini:is(.is-audio, .is-video):is(:hover, :focus-within, :not(.is-playing)) .player-transport {
        background: rgb(0 0 0 / 0.35);
        opacity: 1;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .media-player-expanded .player-transport .player-control-button:not(.player-toggle) {
        color: var(--text-primary);
        font-size: 1.5rem;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .media-player-expanded .player-transport .player-toggle {
        color: #fff;
    }

    /* Its progress along the picture's foot. */
    .media-player.is-mini:is(.is-audio, .is-video) .player-timeline {
        position: relative;
        grid-area: 1 / 1;
        align-self: end;
        border-radius: 0;
    }

    /* Open and close in the picture's top corners, always there. */
    .media-player.is-mini:is(.is-audio, .is-video) .media-player-expanded :is(.player-expand-button, .player-dismiss-button).player-control-button {
        position: absolute;
        z-index: 4;
        top: 0.35rem;
        display: inline-grid;
        place-items: center;
        width: 1.9rem;
        height: 1.9rem;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: rgb(0 0 0 / 0.4);
        color: #fff;
        font-size: 1.05rem;
        cursor: pointer;
        opacity: 0;
        transition: opacity var(--transition-fast);
    }

    /* They fade with the transport: playing and left alone, the tile is only its picture. */
    .media-player.is-mini:is(.is-audio, .is-video):is(:hover, :focus-within, :not(.is-playing)) .media-player-expanded :is(.player-expand-button, .player-dismiss-button).player-control-button {
        opacity: 1;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-expand-button {
        left: 0.35rem;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-dismiss-button {
        right: 0.35rem;
    }

    /* What plays, with room on its right for the volume. */
    .media-player.is-mini:is(.is-audio, .is-video) .media-player-header {
        padding-right: 3.25rem;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .media-player-header .media-player-subtitle {
        min-width: 0;
        font-size: 0.72rem;
    }

    /*
     * Of the options, only the volume beside what plays: its button, and over it the panel with the
     * slider standing up, as everywhere else.
     */
    .media-player.is-mini:is(.is-audio, .is-video) .player-control-options {
        grid-area: 2 / 1;
        justify-self: end;
        align-self: center;
        padding-right: var(--space-2);
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-control-options > :not(.player-volume-control),
    .media-player.is-mini:is(.is-audio, .is-video) .player-control-options > .row-menu {
        display: none;
    }

    .media-player.is-mini:is(.is-audio, .is-video) .player-control-options > .player-volume-control {
        position: relative;
        display: flex;
        align-items: center;
    }
}

/* The morph between the sizes (setExpanded): the player is one piece that grows or shrinks. */
.media-player {
    view-transition-name: media-player;
}

::view-transition-group(media-player) {
    animation-duration: 280ms;
    animation-timing-function: cubic-bezier(.2, .7, .2, 1);
}

::view-transition-old(media-player),
::view-transition-new(media-player) {
    height: 100%;
    object-fit: cover;
}

/* The row's order, as the design has it, whatever order the script left them in. */
.media-player .player-control-options > .player-view-button { order: 0; }
.media-player .player-control-options > .player-volume-control { order: 1; }
.media-player .player-control-options > .player-captions-button { order: 2; }
.media-player .player-control-options > .player-queue-button { order: 3; }
.media-player .player-control-options > .player-cast { order: 4; }
.media-player .player-control-options > .player-settings-wrap { order: 5; }
.media-player .player-control-options > .player-fullscreen { order: 6; }
.media-player .player-control-options > .player-collapse-button { order: 7; }
.media-player .player-control-options > .row-menu { order: 8; }

/* A control with nothing to do is not drawn at all. */
.media-player .player-control-options > [hidden] {
    display: none;
}

/* The time on one line: 12:04 / 47:30 · ends at 21:40. */
.player-time-readout .player-time-total {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
}

.player-time-readout .player-end-time {
    color: var(--text-muted);
}


/* =========================================================
   One player, refined: one size for every control and its icon, a compact audio card in the
   corner on a wide screen, its progress exactly along its foot, and on a phone both mini players
   the full width of the screen with nothing round them.
   ========================================================= */

/* Every control the same square, its icon the same size and in its middle. */
.media-player .player-control-button {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.media-player .player-control-button[hidden] {
    display: none;
}

.media-player .player-toggle {
    width: 3rem;
    height: 3rem;
    font-size: 1.9rem;
}

.media-player google-cast-launcher.player-cast {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.5rem;
    box-sizing: content-box;
}

.media-player.is-mini .player-control-button {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.35rem;
}

.media-player.is-mini .player-toggle {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.6rem;
}

/* The card is what its progress line and its click-anywhere surface are placed in. */
.media-player.is-mini {
    position: relative;
}

@media (width < 992px) {
    .media-player.is-mini:not(.is-video) .media-player-stage {
        position: static;
        padding: 0.4rem 0.5rem;
    }

    .media-player.is-mini:not(.is-video) :is(.media-player-artwork, .media-player-element) {
        width: 2.5rem;
        height: 2.5rem;
    }
}

.media-player.is-mini .player-timeline {
    bottom: 0;
    line-height: 0;
}

.media-player.is-mini .player-seek {
    height: 3px;
    vertical-align: bottom;
}

/* The seek handle shows only while the pointer is over the line. */
.media-player.is-mini .player-seek::-webkit-slider-thumb {
    opacity: 0;
}

.media-player.is-mini .player-seek:hover::-webkit-slider-thumb {
    opacity: 1;
}

.media-player.is-mini .player-seek::-moz-range-thumb {
    opacity: 0;
}

/* A phone: either mini player the width of the screen, flush with its foot and sides. */
@media (width < 992px) {
    .media-player.is-mini,
    .media-player.is-mini.is-video {
        width: auto;
        margin: 0;
        border-width: 1px 0 0;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Small, the player is as tall as what is in it: the full player's 100% heights do not reach here. */
.media-player.is-mini,
.media-player.is-mini .media-player-expanded,
.media-player.is-mini .media-player-surface {
    height: auto;
    min-height: 0;
}


/* =========================================================
   The player, tidied (component/media-player.js).
   ========================================================= */

/* Back to full size is the mini player's alone. */
.media-player.is-expanded .player-control-button.player-expand-button {
    display: none;
}

/* Cast small is in the ⋯ menu; the SDK shows its button with a style of its own, so this insists. */
@container mini-player (width < 760px) {
    .media-player.is-mini google-cast-launcher.player-cast {
        display: none !important;
    }
}

/* No preview of the frame over a line three pixels high. */
.media-player.is-mini .player-seek-popover {
    display: none !important;
}

/*
 * The time, and when it would end, in the colours of the controls they sit among: the theme's text
 * on the page under a track's artwork, white over a video's picture. Inherited, it took the page's
 * dark text over the picture as well.
 */
.media-player .player-time-readout {
    color: var(--text-primary);
}

.media-player.is-video .player-time-readout,
.media-player.is-video .player-control-button:not(:hover) {
    color: #fff;
}

.media-player.is-video .player-control-button:hover {
    color: var(--player-video-text-inverse);
}

.player-time-readout .player-time {
    color: inherit;
}

.player-time-readout :is(.player-end-time, .player-time-separator) {
    color: inherit;
    opacity: 0.7;
}

/*
 * The volume at every size, as the design has it: a button, and over it a panel with the slider
 * standing up, low at the bottom, and a mute button under it.
 */
.media-player .player-volume-panel {
    position: absolute;
    bottom: calc(100% + var(--space-2));
    left: 50%;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    translate: -50% 0;
}

.media-player .player-volume-control.is-open .player-volume-panel {
    display: flex;
}

.media-player .player-volume-panel .player-volume {
    width: 0.3rem;
    height: 8rem;
    writing-mode: vertical-lr;
    direction: rtl;
    background:
        linear-gradient(0deg,
            var(--accent) 0,
            var(--accent) var(--progress, 0%),
            var(--border-strong) var(--progress, 0%),
            var(--border-strong) 100%);
    touch-action: none;
}

.media-player .player-volume-panel .player-control-button {
    color: var(--text-primary);
}

/* Nothing clips a mini player, so the volume panel can rise above it; its progress line keeps to its
   rounded foot. */
.media-player.is-mini {
    overflow: visible;
}

.media-player.is-mini .player-timeline {
    overflow: hidden;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@media (width >= 992px) {
    .media-player.is-mini .player-timeline {
        border-radius: 0;
    }
}

@media (width < 992px) {
    .media-player.is-mini .player-timeline {
        border-radius: 0;
    }
}

/* On a phone or tablet, no cast button in either player's row: Cast is in the mini player's ⋯ and the
   full player's settings menu instead. The SDK shows the button with a style of its own, so this insists. */
@media (width < 992px) {
    .media-player google-cast-launcher.player-cast {
        display: none !important;
    }
}

/* =========================================================
   The full player's corners, and less of it on a phone (component/media-player.js).
   ========================================================= */

/* On a phone the full player keeps to what is needed: no times beside the transport. */
@media (width < 768px) {
    .media-player.is-expanded .player-time-readout {
        display: none;
    }
}

.media-player .player-control-button.player-minimize-button {
    display: none;
}

/*
 * Back to the mini player in the top left and close in the top right, at every size, where what
 * plays across the top of the picture leaves room for them; the row keeps no button of its own for
 * either. They come and go with the controls, and look as the mini tile's corners do: a dark
 * round over the picture or the page, white in it.
 */
.media-player.is-expanded .player-control-options > .player-collapse-button {
    display: none;
}

.media-player.is-expanded :is(.player-minimize-button, .player-dismiss-button).player-control-button {
    position: absolute;
    z-index: 7;
    top: 1rem;
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.4);
    color: #fff;
    font-size: 1.4rem;
    opacity: 1;
    cursor: pointer;
    transition: opacity 180ms ease, background var(--transition-fast);
}

.media-player.is-expanded :is(.player-minimize-button, .player-dismiss-button).player-control-button:hover {
    background: rgb(0 0 0 / 0.6);
}

.media-player.is-expanded .player-minimize-button {
    left: 1rem;
}

.media-player.is-expanded .player-dismiss-button {
    right: 1rem;
}

.media-player.is-expanded.is-controls-hidden :is(.player-minimize-button, .player-dismiss-button).player-control-button {
    opacity: 0;
    pointer-events: none;
}

.media-player.is-expanded .media-player-header {
    padding-inline: 4.5rem;
}

@media (width < 768px) {
    .media-player.is-expanded :is(.player-minimize-button, .player-dismiss-button).player-control-button {
        top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }

    .media-player.is-expanded .player-minimize-button {
        left: 0.75rem;
    }

    .media-player.is-expanded .player-dismiss-button {
        right: 0.75rem;
    }

    .media-player.is-expanded .media-player-header {
        padding-inline: 4rem;
    }
}

/* The tile's volume panel short enough to stay clear of its close button in the corner. */
@media (width >= 992px) {
    .media-player.is-mini .player-volume-panel .player-volume {
        height: 4.5rem;
    }
}

/*
 * Next episode: near an episode's end, at the picture's bottom right. It stays while the controls
 * fade, and stands clear of them while they show.
 */
.media-player .player-next-episode {
    position: absolute;
    z-index: 7;
    right: 1.5rem;
    bottom: 7rem;
    display: flex;
    align-items: stretch;
    max-width: min(24rem, calc(100% - 3rem));
    overflow: hidden;
    border-radius: var(--radius-lg, 0.75rem);
    background: rgb(0 0 0 / 0.72);
    color: #fff;
    box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.35);
    transition: bottom 180ms ease;
}

.media-player .player-next-episode[hidden],
.media-player:not(.is-expanded) .player-next-episode {
    display: none;
}

.media-player.is-controls-hidden .player-next-episode {
    bottom: 2rem;
}

.media-player .player-next-episode button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.media-player .player-next-episode button:hover {
    background: rgb(255 255 255 / 0.12);
}

.media-player .player-next-episode-play {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.7rem 1rem;
    text-align: left;
}

.media-player .player-next-episode-play > .material-symbols-outlined {
    font-size: 1.75rem;
}

.media-player .player-next-episode-text {
    display: grid;
    min-width: 0;
}

.media-player .player-next-episode-text small {
    overflow: hidden;
    color: rgb(255 255 255 / 0.75);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-player .player-next-episode-dismiss {
    padding: 0 0.75rem;
    border-left: 1px solid rgb(255 255 255 / 0.15) !important;
    font-size: 1.2rem;
}

/* Skip intro, recap, credits or preview: in the same place, above the next episode when both show. */
.media-player.has-next-episode .player-skip-segment {
    bottom: 11.5rem;
}

.media-player.has-next-episode.is-controls-hidden .player-skip-segment {
    bottom: 6.5rem;
}

/* Chapter starts on the seek bar: thin gaps in the track, clear of the pointer. */
.player-seek-chapters {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.player-seek-chapter {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 0.45rem;
    transform: translate(-50%, -50%);
    border-radius: 1px;
    background: var(--player-video-mark);
}

.media-player.is-mini .player-seek-chapters {
    display: none;
}

/*
 * Info bar: under the controls of a video, tabs for its chapters, cast and what plays next. A tab
 * opens a strip of cards that scrolls sideways.
 */
/*
 * The controls are a grid, whose items grow to fit what is in them unless told otherwise: a long
 * cast would widen the player past the screen. The bar keeps to the controls' width and its strip
 * scrolls inside it.
 */
.media-player .player-info-bar {
    min-width: 0;
    max-width: 100%;
    padding: 0 1rem 0.75rem;
}

.media-player .player-info-panel {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.media-player .player-info-bar[hidden],
.media-player.is-mini .player-info-bar {
    display: none;
}

.media-player .player-info-tabs {
    display: flex;
    gap: 0.25rem;
}

.media-player .player-info-tab {
    padding: 0.3rem 0.8rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--player-video-text-secondary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.media-player .player-info-tab:hover,
.media-player .player-info-tab:focus-visible {
    background: var(--player-video-hover);
    color: var(--player-video-text);
}

.media-player .player-info-tab.is-active {
    background: var(--player-video-text);
    color: var(--player-video-text-inverse);
}

.media-player .player-info-panel[hidden] {
    display: none;
}

.media-player .player-info-strip {
    display: flex;
    gap: 0.75rem;
    max-width: 100%;
    padding: 0.75rem 0 0.25rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.media-player .player-info-card {
    display: grid;
    flex: 0 0 auto;
    align-content: start;
    gap: 0.2rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--player-video-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
}

.media-player .player-info-card.is-wide {
    width: 11rem;
}

.media-player .player-info-card.is-portrait {
    width: 6.5rem;
}

.media-player .player-info-card-image {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: var(--radius-md, 0.5rem);
    background: var(--player-video-surface);
}

.media-player .player-info-card.is-wide .player-info-card-image {
    aspect-ratio: 16 / 9;
}

.media-player .player-info-card.is-portrait .player-info-card-image {
    aspect-ratio: 2 / 3;
}

.media-player .player-info-card-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-player .player-info-card-placeholder {
    color: var(--player-video-text-muted);
    font-size: 1.25rem;
    font-weight: 700;
}

.media-player .player-info-card:hover .player-info-card-image,
.media-player .player-info-card:focus-visible .player-info-card-image {
    border-color: var(--player-video-border);
}

.media-player .player-info-card.is-active .player-info-card-image {
    border-color: var(--accent);
}

.media-player .player-info-card strong,
.media-player .player-info-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-player .player-info-card strong {
    font-size: 0.85rem;
}

.media-player .player-info-card small {
    color: var(--player-video-text-secondary);
    font-size: 0.75rem;
}

/* The info bar makes the controls taller: the skip and next-episode buttons stay above them. */
.media-player.has-info-bar:not(.is-controls-hidden) .player-next-episode {
    bottom: calc(var(--player-controls-height, 6rem) + 1rem);
}

.media-player.has-info-bar.has-next-episode:not(.is-controls-hidden) .player-skip-segment {
    bottom: calc(var(--player-controls-height, 6rem) + 5.5rem);
}

@media (width < 768px) {
    .media-player .player-next-episode {
        right: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }
}

/*
 * Subtitles: the box Chrome and Safari draw cues in is raised --subtitle-inset (media-player.js,
 * updateSubtitlePosition), so they end over the picture and clear of the controls while they show.
 * Each cue keeps its own place inside the box. The box takes no height of its own, so it is moved
 * rather than made shorter.
 */
.media-player video::-webkit-media-text-track-container {
    transform: translateY(calc(-1 * var(--subtitle-inset, 0px)));
    transition: transform 180ms ease;
}

/* Beside the username: the account signs in through Metia Platform. Dimmed until it first has. */
.user-platform-link {
    display: inline-flex;
    vertical-align: middle;
    margin-left: var(--space-2);
    color: var(--success);
}

.user-platform-link.is-pending {
    color: var(--text-muted);
}

.user-platform-link .material-symbols-outlined {
    font-size: 1.1em;
}

.notice-actions {
    margin-top: var(--space-2);
}

/* Kitchen sink (page/kitchen-sink.js): every shared component and token on one page. */
.kitchen-sink-page {
    display: grid;
    gap: var(--space-6);
}

.kitchen-sink-nav {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    background: var(--bg-app);
    border-bottom: 1px solid var(--border);
}

.kitchen-sink-nav a {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: var(--font-sm);
    text-decoration: none;
}

.kitchen-sink-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.kitchen-sink-section {
    display: grid;
    gap: var(--space-4);
    scroll-margin-top: var(--space-8);
}

.kitchen-sink-section-header {
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

.kitchen-sink-section-header h2,
.kitchen-sink-section-header p {
    margin: 0;
}

.kitchen-sink-section > div > h3 {
    margin: var(--space-4) 0 var(--space-2);
    font-size: var(--font-md);
    color: var(--text-secondary);
}

.kitchen-sink-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.kitchen-sink-caption {
    margin-top: calc(-1 * var(--space-2));
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.kitchen-sink-tokens {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: var(--space-2);
}

.kitchen-sink-token {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.kitchen-sink-token-copy {
    display: grid;
    min-width: 0;
    font-size: var(--font-xs);
}

.kitchen-sink-token-copy strong,
.kitchen-sink-token-copy code {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kitchen-sink-token-copy code {
    color: var(--text-muted);
}

.kitchen-sink-swatch,
.kitchen-sink-radius {
    flex: none;
    width: var(--control-md);
    height: var(--control-md);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.kitchen-sink-space {
    flex: none;
    height: var(--space-3);
    background: var(--accent);
    border-radius: var(--radius-sm);
}

.kitchen-sink-font {
    flex: none;
    min-width: var(--control-md);
    line-height: 1;
}

.kitchen-sink-control {
    flex: none;
    width: var(--control-md);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
}

.kitchen-sink-skeleton {
    width: 12rem;
    height: var(--control-md);
    border-radius: var(--radius);
}

/* Detail card (component/entry/detail-card.js): the cover down the left, what it is beside it. */
.detail-card {
    display: flex;
    height: var(--detail-card-height, 22.5rem);
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    transition: border-color var(--transition);
}

.detail-card:hover {
    border-color: var(--border-strong);
}

.detail-card-cover {
    position: relative;
    display: block;
    flex: none;
    height: 100%;
}

.detail-card-cover .entry-poster {
    display: block;
    width: auto;
    height: 100%;
    border-radius: 0;
}

.detail-card-cover .entry-poster-placeholder {
    display: grid;
}

.detail-card-cover .watch-progress {
    border-radius: 0;
}

.detail-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
    padding: var(--space-5);
}

.detail-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: 600;
}

.detail-card-type {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.15rem var(--space-2) 0.15rem 0.4rem;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--entry-type-color, var(--accent)) 16%, transparent);
    color: color-mix(in srgb, var(--entry-type-color, var(--accent)) 55%, var(--text-primary));
    font-weight: 700;
}

.detail-card-type .material-symbols-outlined {
    font-size: 0.95rem;
}

.detail-card-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 780;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.detail-card-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.detail-card-title a:hover {
    color: var(--accent-hover);
}

.detail-card-byline {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-weight: 650;
}

.detail-card-overview.is-empty {
    color: var(--text-muted);
    font-style: italic;
}

.detail-card-tagline {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-weight: 600;
}

/* Never squeezed out by a short card: the line clamp bounds it instead. */
.detail-card-overview {
    display: -webkit-box;
    flex-shrink: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* One row however narrow the card: a label is cut short before the row wraps out of the card. */
.detail-card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    margin-top: auto;
}

.detail-card-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.detail-card-actions .btn > span:not(.material-symbols-outlined) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-card-actions .like-control {
    flex: none;
}

.detail-card-menu {
    margin-left: auto;
}

@media (max-width: 640px) {
    .detail-card {
        --detail-card-height: 15rem;
    }

    .detail-card-body {
        padding: var(--space-3);
    }

    .detail-card-tagline {
        display: none;
    }

    .detail-card-overview {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

/* Perspective carousel (component/perspective-carousel.js): coverflow, ring and stage. */
.perspective-carousel {
    --perspective-poster-width: clamp(9.5rem, 18vw, 15rem);
    --perspective-card-height: clamp(13rem, 34vw, 24rem);
    --perspective-cover-width: calc(var(--perspective-card-height) * 2 / 3);
    --perspective-pace: clamp(3.5rem, 8vw, 7.5rem);
    --perspective-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    /* Edge to edge of the content area as the featured carousel is (it measures --bleed-width), its
       heading and copy kept in by the page's own side padding. */
    width: var(--bleed-width, calc(100% + 2 * var(--content-pad-x)));
    margin-inline: calc(50% - var(--bleed-width, calc(100% + 2 * var(--content-pad-x))) / 2);
    padding: var(--space-4) var(--content-pad-x) var(--space-5);
}

.perspective-glow {
    position: absolute;
    z-index: -1;
    inset: 10% 15%;
    opacity: 0.32;
    filter: blur(90px) saturate(1.3);
    pointer-events: none;
}

/* The backdrop behind it changes only once the next one has loaded, fading over the last. */
.perspective-glow-layer {
    position: absolute;
    inset: 0;
    background: center / cover no-repeat;
    opacity: 0;
    transition: opacity 600ms ease;
}

.perspective-glow-layer.is-shown {
    opacity: 1;
}

.perspective-carousel > .section-head {
    margin-bottom: var(--space-3);
}

.perspective-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.perspective-arrow {
    border-radius: var(--radius-pill);
}

.perspective-counter {
    min-width: 3.25rem;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.perspective-carousel.has-one .perspective-controls,
.perspective-carousel.has-one .perspective-dots {
    display: none;
}

.perspective-stage {
    position: relative;
    height: calc(var(--perspective-poster-width) * 1.5 + var(--space-6));
    perspective: 1400px;
    perspective-origin: 50% 45%;
    touch-action: pan-y;
    user-select: none;
}

.perspective-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--perspective-poster-width);
    margin-left: calc(var(--perspective-poster-width) / -2);
    transform-style: preserve-3d;
    transform: translateY(-50%) translateX(var(--x, 0)) translateZ(var(--z, 0)) rotateY(var(--rotate, 0deg));
    filter: brightness(var(--brightness, 1));
    transition:
        transform 560ms var(--perspective-ease),
        width 560ms var(--perspective-ease),
        margin 560ms var(--perspective-ease),
        opacity 400ms ease,
        filter 400ms ease;
}

.perspective-carousel.is-placing .perspective-item,
.perspective-carousel.is-placing .detail-card-body {
    transition: none;
}

/* Carried under the finger: the titles keep up with it rather than easing after it. The stage steps
   along while dragged, so it keeps its easing. */
.perspective-carousel.is-dragging:not(.is-stage) .perspective-item {
    transition: none;
}

.perspective-carousel.is-dragging .perspective-stage {
    cursor: grabbing;
}

.perspective-item .entry-poster {
    box-shadow: var(--shadow-depth-sm);
}

.perspective-item.is-front .entry-poster {
    box-shadow: var(--shadow-depth);
}

.perspective-item:not(.is-front) {
    cursor: pointer;
}

.perspective-copy {
    display: grid;
    gap: var(--space-2);
}

.perspective-title {
    margin: 0;
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    font-weight: 780;
    line-height: 1;
    letter-spacing: -0.045em;
    text-wrap: balance;
    text-overflow: ellipsis;
    overflow: hidden;
}

.perspective-title a {
    color: var(--text-primary);
    text-decoration: none;
}

@media (width > 992px) {
    .is-ring .perspective-title a {
        max-width: 50%;
    }
}

.perspective-facts {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    font-weight: 600;
}

.perspective-overview {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.perspective-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.perspective-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* Coverflow: what the front one is, centred under it, then the dots. */
.perspective-foot {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    max-width: 38rem;
    margin: var(--space-2) auto 0;
    text-align: center;
}

.perspective-foot .perspective-copy,
.perspective-foot .perspective-actions {
    justify-items: center;
    justify-content: center;
}

.perspective-dots {
    display: flex;
    gap: 0.4rem;
}


/* Ring: the posters on a drum, the front one's copy beside it. */
.perspective-ring-layout {
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-5);
}

.perspective-ring-side {
    position: relative;
    z-index: 60;
    display: grid;
    gap: var(--space-5);
}

.is-ring .perspective-stage {
    --perspective-poster-width: clamp(8rem, 13vw, 12.5rem);
    perspective: 1600px;
    perspective-origin: 50% 40%;
}

.is-ring .perspective-item {
    transform: translateY(-50%) translateZ(calc(var(--radius, 380px) * -1)) rotateY(var(--angle, 0deg)) translateZ(var(--radius, 380px));
    backface-visibility: hidden;
    transition:
        transform 700ms cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 500ms ease,
        filter 500ms ease;
}

.is-ring .perspective-item .entry-card {
    backface-visibility: hidden;
}

@media (max-width: 760px) {
    .perspective-ring-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .perspective-ring-side {
        order: 2;
    }
}

/* Stage: the front one opens out into its detail card; the rest stand turned behind it. */
.is-stage .perspective-stage {
    height: calc(var(--perspective-card-height) + var(--space-7));
    perspective: 1500px;
    perspective-origin: 50% 50%;
}

.is-stage .perspective-item {
    --x: calc(var(--side, 0) * var(--depth, 1) * (var(--perspective-front-width) / 2 + var(--space-4) + var(--steps, 0) * var(--perspective-pace)));
    width: var(--perspective-cover-width);
    height: var(--perspective-card-height);
    margin-left: calc(var(--perspective-cover-width) / -2);
    transform: translateY(-50%) translateX(var(--x)) translateZ(var(--z, 0)) rotateY(var(--rotate, 0deg)) scale(var(--scale, 1));
}

.is-stage .perspective-item.is-before {
    margin-left: calc(var(--perspective-cover-width) * -1);
    transform-origin: right center;
}

.is-stage .perspective-item.is-after {
    margin-left: 0;
    transform-origin: left center;
}

.is-stage .perspective-item.is-front {
    width: var(--perspective-front-width);
    margin-left: calc(var(--perspective-front-width) / -2);
}

.is-stage .perspective-item.is-square {
    --perspective-cover-width: var(--perspective-card-height);
}

/* The cover takes exactly the width the stage gives it, front or behind, so the body beside it fits. */
.is-stage .detail-card-cover {
    width: var(--perspective-cover-width);
}

.is-stage .detail-card-cover .entry-poster {
    width: 100%;
    aspect-ratio: auto;
    object-fit: cover;
}

.is-stage .detail-card {
    --detail-card-height: 100%;
    height: 100%;
    box-shadow: var(--shadow-depth-sm);
}

.is-stage .perspective-item.is-front .detail-card {
    box-shadow: var(--shadow-depth);
}

.is-stage .detail-card-body {
    flex: none;
    width: calc(var(--perspective-front-width) - var(--perspective-cover-width));
    box-sizing: border-box;
    transition: opacity 300ms ease;
}

.is-stage .perspective-item:not(.is-front) .detail-card-body {
    opacity: 0;
}

/* A narrow stage: a taller, tighter card, so its overview and actions still fit beside the cover. */
@media (max-width: 760px) {
    .is-stage {
        --perspective-card-height: 18rem;
    }

    .is-stage .detail-card-body {
        gap: var(--space-1);
        padding: var(--space-3);
    }

    .is-stage .detail-card-tagline {
        display: none;
    }

    .is-stage .detail-card-overview {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

/* A phone: a slimmer cover, cropped, leaves the text room to read. */
@media (max-width: 520px) {
    .is-stage,
    .is-stage .perspective-item.is-square {
        --perspective-cover-width: 8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .detail-card-body,
    .perspective-glow-layer {
        transition: none;
    }
}

.kitchen-sink-detail-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr));
    gap: var(--space-4);
}

/*
 * Settings sections: the pages of a section as tabs under its header (component/settings/components.js).
 * They wrap onto another line on a narrow screen rather than run past its edge.
 */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    min-width: 0;
    margin: 0 0 var(--space-4);
    border-bottom: 1px solid var(--border);
}

.settings-tab {
    margin-bottom: -1px;
    padding: var(--space-2) 0;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.settings-tab:hover,
.settings-tab:focus-visible {
    color: var(--text-primary);
}

.settings-tab.is-active {
    border-bottom-color: var(--accent);
    color: var(--text-primary);
}

.settings-tab-description {
    margin: 0 0 var(--space-4);
    color: var(--text-secondary);
}
