/* ==========================================================================
   MASTER HI-FI CONSOLE STYLESHEET MANIFEST
   ========================================================================== */

/* 1. Base Tokens & Reset */
/* ----------------------------------------------------------------------
   BREAKPOINT SCALE (CSS-008)
   Declared once here. The build (scripts/lib/css-bundle.mjs) turns these into plain
   `@media (…)` queries in the emitted bundle and strips the definitions below, so
   breakpoints are documented in one place. Tiers:
     --small    ≤620px                          very small phones
     --narrow   ≤767px, or ≤1024px + coarse     phones + touch tablets (compact UI)
     --desktop  ≥768px + fine pointer           mouse / trackpad desktops
     --rail     ≤1100px                          narrow desktop / split rail
     --wide     ≥1800px + ≥900px tall           large displays
   Hover/pointer (`hover: none`) and `prefers-reduced-motion` queries are not
   viewport tiers and stay inline.
   ---------------------------------------------------------------------- */






:root {
    /* Warm Obsidian & Brushed Champagne Studio Console Palette */
    --bg-canvas: #07090e;
    --bg-card: #151a26;

    /* Height of the sticky filter/header bar that overlays the top of the ledger feed.
       Used for `scroll-margin-top` so native scrollIntoView targets clear it (CSS-04). */
    --ledger-sticky-height: 84px;

    --border-subtle: rgba(226, 185, 115, 0.16);
    --border-highlight: rgba(240, 205, 145, 0.35);

    --text-primary: #fcfbfa;
    --text-secondary: #a9b5c7;
    --text-muted: #6b778a;

    /* Library text ramp. Declared globally because modals and option popups portal to <body>,
       outside the .console-tracklist-bay scope these were originally (and only) declared in;
       there they resolved to nothing and inheriting text stayed near-white. */
    --lib-text-primary: #f5f6f8;
    --lib-text-secondary: #a7acb9;
    --lib-text-muted: #6e7484;

    --accent-brand: #dca342;
    --accent-brand-light: #f5cf7e;
    --accent-glow: rgba(220, 163, 66, 0.42);
    --accent-amber: #f59e0b;
    --accent-emerald: #10b981;
    --accent-apple: #fa2d48;
    --accent-cyan: #38bdf8;

    --font-display: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Type scale (CSS-007): the most-repeated font sizes, tokenized to keep the
       ramp consistent. One-off sizes stay literal. Values are 1:1 with the
       existing sizes so migrating them is visually identical. */
    --fs-2xs: 0.65rem;
    --fs-xs: 0.68rem;
    --fs-sm: 0.72rem;
    --fs-md: 0.75rem;
    --fs-lg: 0.8rem;
    --fs-xl: 0.85rem;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    /* Spacing scale (CSS-007): the most-repeated gap/padding/margin steps. */
    --space-1: 4px;
    --space-2: 6px;
    --space-3: 8px;
    --space-4: 10px;
    --space-5: 12px;
    --space-6: 16px;

    --ambient-art: url('');

    --player-bar-height: 84px;

    /* ----------------------------------------------------------------------
       Z-INDEX SCALE (CSS-009)
       A small, documented scale for the GLOBAL app-shell overlay stack.
       Values are chosen to preserve the existing stacking order exactly while
       naming the *relationship* (not an arbitrary number). Lower layer names
       sit below higher ones. Only elements that stack against each other at
       the app-shell level use these; component-internal / local stacking
       contexts (turntable platter internals, library rows, modal internals)
       keep their own local z-index and are intentionally NOT tokenized.

       Order (highest first): toast > popover > drawer > dropdown > stage >
       mobile-bar > player/nav > base.

       React modals use native <dialog> (top layer) and need no z-index.
       The boot-error banner (assets/js/app/boot.js) uses a dedicated
       near-max value because it must sit above every possible context.
       ---------------------------------------------------------------------- */
    --z-base: 1; /* base content within a local stacking context (reserved rung of the scale; no direct var() consumer yet — components still use local z-index) */
    --z-player: 100; /* sticky bottom player bar + top nav */
    --z-mobile-bar: 1000; /* mobile bottom app navigation bar */
    --z-stage: 9999; /* active-listening stage / theater overlay */
    --z-dropdown: 10000; /* dropdowns & popovers (filter grid-density, studio backdrop) */
    --z-drawer: 10001; /* studio customizer drawer (above its backdrop) */
    --z-popover: 99999; /* add-to-playlist / track options popups (above player + drawer) */
    --z-toast: 999999; /* transient toasts (above everything non-modal) */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    overflow: clip;
    overscroll-behavior: none;
    /* iOS Safari text autosizing inflates text in wide blocks; opt out so the rendered size
       matches the CSS pixels (and the Chrome device emulator). */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(ellipse 90% 60% at 50% -15%, rgba(212, 147, 56, 0.12), transparent 70%),
        radial-gradient(ellipse 60% 40% at 95% 35%, rgba(95, 140, 170, 0.08), transparent 70%);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   KEYBOARD FOCUS BASELINE (CSS-001)
   A single, visible focus indicator for every keyboard-focusable element.
   Scoped to :focus-visible so pointer clicks don't show a ring, while
   keyboard navigation always does. Components may still override with a
   bespoke ring (e.g. custom box-shadow) — those must not remove the outline
   without providing an equivalent indicator.
   -------------------------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--accent-brand-light);
    outline-offset: 2px;
}

/* iOS Safari zooms the viewport when a form control with font-size < 16px receives focus.
   Keep text controls at 16px on narrow screens so the viewport stays put (no auto-zoom). */
@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    input:not([type='range']):not([type='file']),
    textarea,
    select {
        font-size: 16px;
    }
}


/* 2. Layout & Chassis Structure */
/* ==========================================================================
   EFFECT BUDGET / MOTION POLICY (T9.8)
   ========================================================================== */

/* Hidden tab: stop every animation until the page is visible again. */
html.effects-paused *,
html.effects-paused *::before,
html.effects-paused *::after {
    animation-play-state: paused !important;
}

/* Offscreen animated surfaces. */
.is-offscreen,
.is-offscreen::before,
.is-offscreen::after {
    animation-play-state: paused !important;
}

/* Idle platter: pause decorative vinyl sheen until playback starts. */
html.effects-idle .vinyl-shine,
html.effects-idle .vinyl-shine::before,
html.effects-idle .vinyl-shine::after {
    animation-play-state: paused !important;
}

/* OS-level reduced motion. */
html.motion-reduced {
    scroll-behavior: auto !important;
}

html.motion-reduced *,
html.motion-reduced *::before,
html.motion-reduced *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

html.motion-reduced .fa-spin,
html.motion-reduced .vinyl-shine,
html.motion-reduced .vinyl-shine::before,
html.motion-reduced .vinyl-shine::after {
    animation: none !important;
}

/* Self-sufficient OS reduced-motion baseline (CSS-013).
   Mirrors the `html.motion-reduced` policy above so the stylesheet honors
   `prefers-reduced-motion` even before effects-budget.js runs (or if it
   fails to load). The JS class remains the primary mechanism; this is the
   no-JS / fail-safe fallback. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .fa-spin,
    .vinyl-shine,
    .vinyl-shine::before,
    .vinyl-shine::after {
        animation: none !important;
    }
}

/* Low-power / touch / narrow devices: drop composited blur and heavy ambience. */
html.effects-lite * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.effects-lite .ambient-backdrop,
html.effects-lite .studio-backdrop {
    filter: brightness(0.35) !important;
}

html.effects-lite .vinyl-shine,
html.effects-lite .vinyl-shine::before,
html.effects-lite .vinyl-shine::after,
html.effects-lite .ambient-backdrop,
html.effects-lite .stage-sleeve-jacket {
    animation: none !important;
}

/* Top Navigation Bar */
.site-nav {
    position: relative;
    z-index: var(--z-player);
    height: 60px;
    flex-shrink: 0;
    background: rgba(6, 7, 10, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Application menu (hamburger) — upper-left nav control with an anchored dropdown. */
.nav-app-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-nav-app-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    &:hover {
        color: #fff;
    }

    &.is-open {
        color: var(--accent-brand-light);
    }

    i {
        font-size: 1rem;
    }
}

.nav-app-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: auto;
    right: 0;
    min-width: 200px;
    background: #1c1b20;
    border: 1px solid rgba(212, 154, 106, 0.35);
    border-radius: 12px;
    padding: var(--space-2);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.7),
        0 0 16px rgba(0, 0, 0, 0.4);
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    animation: libraryMenuSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-app-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #e0dcd5;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition:
        background-color,
        border-color,
        color 0.15s ease;

    i {
        font-size: var(--fs-sm);
        width: 14px;
        text-align: center;
        color: var(--accent-brand-light);
        opacity: 0.85;
    }

    &:hover,
    &:focus-visible {
        background: rgba(220, 163, 66, 0.15);
        border-color: rgba(220, 163, 66, 0.3);
        color: var(--text-primary);
        outline: none;

        i {
            opacity: 1;
            color: #fff;
        }
    }
}

/* Desktop Media Library Drawer Toggle Button */
.btn-nav-library-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: var(--space-3);

    &:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    &.is-collapsed {
        color: var(--accent-brand-light);
        border-color: rgba(212, 147, 56, 0.35);
        background: rgba(212, 147, 56, 0.08);

        &:hover {
            background: rgba(212, 147, 56, 0.16);
            border-color: var(--accent-brand);
            box-shadow: 0 0 14px var(--accent-glow);
        }
    }

    i {
        font-size: 0.82rem;
        opacity: 0.85;
    }
}

/* Mobile Bottom App Navigation Bar (Default: strictly hidden on desktop) */
.mobile-bottom-app-bar {
    display: none !important;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    text-decoration: none;
    color: var(--text-primary);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;

    &:hover {
        opacity: 0.88;
        transform: translateY(-0.5px);
    }
}

.nav-logo-xoetic {
    height: 22px;
    width: auto;
    display: block;
    color: #ede8df;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.artist-search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 2px 4px 2px 12px;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.25s ease;
}

.artist-search-form:focus-within {
    border-color: var(--accent-brand);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 16px var(--accent-glow);
}

.artist-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: var(--fs-xl);
    width: 170px;
    transition: width 0.25s ease;
}

/* Restore a visible ring for keyboard focus (CSS-001). */
.artist-search-input:focus-visible {
    outline: 2px solid var(--accent-brand-light);
    outline-offset: 2px;
}

.artist-search-input:focus {
    width: 220px;
}

/* ==========================================================================
   FULL-BLEED HERO: UNIFIED HI-FI CONSOLE PANEL
   ========================================================================== */
.chronicle-hero-wrapper {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: var(--player-bar-height);
    /* App-shell grid: [persistent library | swappable .app-main]. The library-column
       responsive variants below target this grid; .app-main holds .chassis-main-body
       (turntable | companion). */
    display: grid;
    grid-template-columns: 410px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    /* Named container so the library bay can switch between push (wide) and
       overlay drawer (tight) based on the shell width, not the viewport. */
    container-type: inline-size;
    container-name: chassis;
}

/* Atmospheric Ambient Backdrop */
.ambient-backdrop {
    position: absolute;
    inset: -40px;
    background-image: var(--ambient-art);
    background-size: cover;
    background-position: center;
    filter: blur(90px) brightness(0.25) saturate(1.4);
    transform: scale(1.15);
    transition:
        background-image 0.9s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.6s ease;
    z-index: 1;
    pointer-events: none;
    opacity: 0.75;
}

/* Suppress photo glow behind opaque table finishes so wood/slate/metal textures remain pure */
.chassis-main-body:not([data-plinth-style='album-blur']):not([data-plinth-style='none']) ~ .ambient-backdrop,
.chronicle-hero-wrapper:has(.chassis-main-body:not([data-plinth-style='album-blur']):not([data-plinth-style='none']))
    .ambient-backdrop {
    opacity: 0.1;
}

.ambient-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(6, 7, 10, 0.4) 0%, rgba(6, 7, 10, 0.88) 75%, #06070a 100%),
        linear-gradient(to bottom, rgba(6, 7, 10, 0.7) 0%, transparent 20%, transparent 80%, #06070a 100%);
    z-index: 2;
    pointer-events: none;
}

/* Integrated Turntable Deck Header (Album Title, Eyebrow & Store Links) */
.deck-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    width: 100%;
    margin-bottom: auto;
    /* Top/left breathing room so the artist/album stack isn't flush to the bar edges. */
    padding: 10px 4px 8px 16px;
    z-index: 15;
    flex-shrink: 0;
}

.deck-action-links {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Focus / split layout toggles in the stage top bar (regular view). The deck
   buttons reuse the .theater-tool-btn class, styled via .deck-action-links below. */
.deck-layout-toggles {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    padding: 3px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 2px;
}

.deck-action-links .theater-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 0;
    border-radius: 9px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: background-color, color, box-shadow, transform 0.2s ease;

    &:hover {
        color: #ffffff;
    }

    &.is-active {
        background: rgba(255, 255, 255, 0.18);
        color: #ffffff;
    }

    .theater-icon-svg {
        display: block;
        width: 16px;
        height: 16px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
}

/* Focus-close button (circle, like the theater close) — only in focus mode. */
.btn-stage-focus-close {
    display: none;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color, border-color, color, transform 0.2s ease;

    &:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #ffffff;
        transform: scale(1.08);
    }
}

body.is-stage-focus .btn-stage-focus-close {
    display: inline-flex !important;
}

.slide-shutter-box {
    overflow: hidden;
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.slide-content-wrap {
    transition:
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease;
    transform: translateY(0);
    opacity: 1;
}

.slide-content-wrap.slide-in-up {
    transform: translateY(35px);
    opacity: 0;
}

.slide-content-wrap.slide-in-down {
    transform: translateY(-35px);
    opacity: 0;
}

.deck-artist-eyebrow {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-brand-light);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chassis-album-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.25;
    color: #fff;
    letter-spacing: -0.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.chassis-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chassis-release-spec {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    flex-shrink: 0;
    text-transform: uppercase;
}

.spec-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 22px;
    box-sizing: border-box;
    text-decoration: none;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.spec-badge[href] {
    cursor: pointer;
}

.spec-badge[href]:hover {
    color: var(--accent-brand-light);
    border-color: rgba(212, 147, 56, 0.45);
    background: rgba(212, 147, 56, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(212, 147, 56, 0.25);
}

.spec-badge.gold {
    color: var(--accent-brand-light);
    background: rgba(212, 147, 56, 0.12);
    border-color: rgba(212, 147, 56, 0.35);
}

.btn-chassis-outbound {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 0 10px;
    height: 22px;
    line-height: 22px;
    box-sizing: border-box;
    border-radius: var(--radius-full);
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-chassis-amazon {
    background: linear-gradient(135deg, #ff9900, #c87400);
    color: #0c0e14;
    box-shadow: 0 2px 10px rgba(255, 153, 0, 0.25);
}

.btn-chassis-amazon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(255, 153, 0, 0.4);
}

.btn-chassis-ebay {
    background: linear-gradient(135deg, #0064d2, #004fb0);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 100, 210, 0.3);
}

.btn-chassis-ebay:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 100, 210, 0.5);
}

.btn-chassis-bandcamp {
    background: linear-gradient(135deg, #1da0c3, #157995);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(29, 160, 195, 0.35);
}

.btn-chassis-bandcamp:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(29, 160, 195, 0.6);
}

.btn-chassis-soundcloud {
    background: linear-gradient(135deg, #ff5500, #c93f00);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.35);
}

.btn-chassis-soundcloud:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(255, 85, 0, 0.6);
}

.btn-chassis-youtube {
    background: linear-gradient(135deg, #ff0000, #c00000);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.35);
}

.btn-chassis-youtube:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.6);
}

@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    .deck-action-links .btn-chassis-outbound span {
        display: none;
    }
    .deck-action-links .btn-chassis-outbound {
        padding: 0;
        width: 24px;
        height: 24px;
        justify-content: center;
    }
    /* Focus/split layout toggles are a desktop concept; hide on mobile. */
    .deck-layout-toggles {
        display: none;
    }
}

/* Sleek Toast Notification */
.share-toast {
    position: fixed;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 22, 33, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 147, 56, 0.4);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(212, 147, 56, 0.2);
    opacity: 0;
    pointer-events: none;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--z-toast);
    max-width: min(90vw, 480px);
    box-sizing: border-box;
}

@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    .share-toast {
        bottom: calc(64px + 56px + 12px + env(safe-area-inset-bottom, 0px));
        width: calc(100vw - 24px);
        max-width: 420px;
        border-radius: 14px;
        padding: 12px 14px;
        font-size: var(--fs-lg);
        line-height: 1.4;
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: var(--space-4);
        align-items: center;
    }

    .share-toast span#share-toast-msg {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.35;
    }

    .share-toast .toast-actions {
        margin-left: auto;
        flex-shrink: 0;
    }

    .share-toast .toast-action {
        margin-left: 0;
        padding: 5px 12px;
        font-size: var(--fs-md);
    }
}

.share-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.share-toast i {
    color: var(--accent-brand-light);
    font-size: 0.95rem;
}

.share-toast .toast-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.share-toast .toast-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: var(--space-2);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(212, 147, 56, 0.55);
    background: rgba(212, 147, 56, 0.18);
    color: var(--accent-brand-light);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.share-toast .toast-action:hover {
    background: rgba(212, 147, 56, 0.3);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   MAIN CONSOLE PANEL BODY (2 BAYS: MEDIA LIBRARY ON LEFT, TURNTABLE ON RIGHT)
   -------------------------------------------------------------------------- */
.app-main {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    height: 100%;
    position: relative;
    /* Above the ambient backdrop/overlay (z-index 1) which are now siblings. */
    z-index: 5;
}

/* Idle gate (app-shell step 3): when a non-stage page replaces the stage, the
   stage stays mounted (instant return, no plinth re-prime) but its visual work
   is suspended — content-visibility skips layout/paint/animation of the hidden
   subtree for free. The JS visual-scheduler guard (isStageSuspended) skips the
   per-frame DOM writes; the audio clock keeps running. */
body.is-stage-suspended .app-main {
    content-visibility: hidden;
    pointer-events: none;
}

.chassis-main-body {
    position: relative;
    z-index: 5;
    display: grid;
    /* Row 1: full-width stage top bar; Row 2: turntable | companion. The side-
       companion rules below set the row-2 columns. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    transition: grid-template-columns 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stage top bar spans the full stage width (row 1, both columns). */
.chassis-main-body > .deck-title-row {
    grid-column: 1 / -1;
    grid-row: 1;
}

/* Desktop Collapsed Drawer: Hide Media Library Bay & Center Turntable Deck (only on desktop > 767px).
   The library column now lives on .chronicle-hero-wrapper (app-shell grid), so collapse targets it. */
@media (min-width: 768px) and (pointer: fine) {
    .chronicle-hero-wrapper:has(.chassis-main-body.is-ledger-collapsed) {
        grid-template-columns: 0px minmax(0, 1fr);

        .console-tracklist-bay {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            overflow: hidden;
            border: none;
        }
    }
}

/* SIDE COMPANION BAY (Phase 5b): hidden by default. When wide and a companion
   tab is active (body.has-side-companion), the grid gains a second column beside
   the turntable and the #theater-wing-content companion content renders there. */
.console-companion-bay {
    display: none;
}

@media (min-width: 768px) and (pointer: fine) {
    body.has-side-companion .console-companion-bay {
        display: flex;
        flex-direction: column;
        grid-column: 2;
        grid-row: 2;
        order: 2;
        min-width: 0;
        /* visible so the sleeve/notes artwork drop shadow isn't clipped into a hard
           vertical line at the bay edge (the lyrics river scrolls internally). */
        overflow: visible;
        /* No border/divider: the companion flows seamlessly beside the turntable,
           just like the theater wing (no vertical line between the panes). */
        border-left: none;
        /* No background: the companion presents transparently, just like in theater. */
        background: transparent;
        /* Query container so the sleeve's cqi/cqh sizing resolves against the bay. */
        container-type: size;
        /* Match the RECORD's exact size formula (the deck's --stage-size) so the
           sleeve/notes always render at the same size as the platter, just like in
           theater. Both bays are equal-width grid cells, so the same min(cqh,cqi)
           yields the same size. */
        --theater-jacket-size: clamp(280px, min(82cqh, 80cqi), 1040px);
    }

    body.has-side-companion .chassis-main-body {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    /* When the library is collapsed, the companion still sits beside the turntable. */
    body.has-side-companion .chassis-main-body.is-ledger-collapsed {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    /* Remove the inter-pane gap: the deck's right padding + the companion content's
       left padding would otherwise stack into a visible vertical space between panes. */
    body.has-side-companion .console-turntable-bay {
        padding-right: 0;
        /* overflow:visible so the tonearm base drop shadow isn't clipped into a hard
           vertical line at the bay's right edge (matches the theater wing, which is
           overflow:visible). The shadow paints seamlessly toward the companion. */
        overflow: visible;
    }

    body.has-side-companion .console-companion-bay .theater-wing-content {
        padding-left: 0;
        /* Layout for the reparented content in the side bay (theater uses 50% width;
           here it fills the bay). Content styling comes from the shared :is() block.
           Bottom padding mirrors theater (28px) so the pane switcher isn't flush
           against the bottom player bar. */
        flex: 1;
        min-height: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-bottom: 28px;
        box-sizing: border-box;
        overflow: hidden;
    }
}

/* TIGHT OVERLAY TIER (desktop but the stage shell is narrow, container-driven).
   The library stops taking a grid column and becomes a fixed overlay drawer that
   slides over the turntable, which stays full-width underneath. Closed by default
   (drawer open == `.is-ledger-collapsed` NOT set, matching the push tier's meaning
   so the same Library toggle drives both). */
@container chassis (min-width: 768px) and (max-width: 900px) {
    .chassis-main-body {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* FOCUS MODE override: the library is already hidden, so the tight tier's
       single-column (turntable full-width, library-as-overlay) layout doesn't apply.
       Restore the two-column side-companion layout so the companion docks beside the
       turntable instead of collapsing to 0 width. */
    body.is-stage-focus .chassis-main-body {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }

    /* Single column now: the turntable bay must not sit in an implicit column 2
       (which left a library-width blank gap on the left and pushed it off-center). */
    .chassis-main-body .console-turntable-bay {
        grid-column: 1 !important;
    }

    /* Anchor the drawer to the hero (which already sits below the top nav), not the
       viewport, so it doesn't slide up under the header. The hero is position:relative.
       Left-docked: closed = off-screen LEFT (-105%), open slides rightward to 0. */
    .chassis-main-body .console-tracklist-bay {
        position: absolute !important;
        top: 0;
        bottom: 0;
        left: 0;
        width: 410px;
        max-width: 88vw;
        height: auto;
        max-height: none;
        z-index: 10002 !important;
        background: var(--lib-bg, #151418);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.8);
        transform: translateX(-105%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Open state: the drawer is shown when the ledger is NOT collapsed. */
    .chassis-main-body:not(.is-ledger-collapsed) .console-tracklist-bay {
        transform: translateX(0);
    }
}


/* 3. Turntable Deck, Plinth & Vinyl Physics */
/* ==========================================================================
   DEFAULT RIGHT BAY: INTEGRATED TURNTABLE DECK
   ========================================================================== */
.console-turntable-bay {
    grid-column: 1;
    grid-row: 2;
    order: 1;
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    background: transparent;
    /* Named query container so the stage (turntable size, companion placement)
       responds to its OWN box, not the viewport. The plinth is moved into the
       theater wing at runtime; that wing is the same named container, so the
       rules follow the plinth. size containment is safe here: the bay is
       grid-stretched to a definite height (html/body 100vh → hero flex:1). */
    container-type: size;
    container-name: media-stage;
    /* Turntable size tied to the stage box. The tonearm base overhangs the platter's
       right edge by ~0.115× the platter width; 81cqi leaves a symmetric gap on each
       side equal to that overhang, so the record stays centered with equal room for
       the base on both sides. 82cqh leaves headroom for the deck header + tonearm. */
    --stage-size: clamp(280px, min(82cqh, 81cqi), 1040px);
    --stage-scale: calc(var(--stage-size) / 280px);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    z-index: 1;
}

/* Turntable Plinth Housing Container */
.turntable-plinth-housing {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: var(--stage-size);
    flex: 1;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    box-shadow: none;
    /* Keep the platter itself centered in the bay. The tonearm base overhangs the
       platter's right edge slightly; the stage-size width fraction (below) leaves
       room for it so it isn't clipped, without nudging the record off-center. */
    transform: none;
}

/* --------------------------------------------------------------------------
   CONSOLE & THEATER FULL-SURFACE THEME SYSTEM ("Table Background")
   Edge-to-edge luxury console surfaces & seamless ambient theater backgrounds
   -------------------------------------------------------------------------- */
.chassis-main-body {
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* Chassis Variant: Deep Dark American Walnut (Smoked Espresso & Aged Dark Timber with Fine Grain) */
.chassis-main-body[data-plinth-style='walnut'] {
    position: relative;
    background-color: #0c0704;

    background-image:
        /* Subtle top specular face highlight */
        linear-gradient(175deg, rgba(212, 147, 56, 0.06) 0%, transparent 20%),
        /* Very fine horizontal micro-grain */
        repeating-linear-gradient(
                0deg,
                rgba(255, 160, 70, 0.012) 0px,
                rgba(255, 160, 70, 0.012) 1px,
                transparent 1px,
                transparent 4px
            ),
        /* Deep dark charred walnut */ linear-gradient(160deg, #1c0e07 0%, #150a05 35%, #0e0603 65%, #070301 100%);
}

/* =========================================================
   SOFT, HORIZONTAL, WANDERING WALNUT GRAIN
   ========================================================= */
.chassis-main-body[data-plinth-style='walnut']::before {
    content: '';
    position: absolute;
    inset: 0;

    background:
        /* Broad flowing horizontal grain */
        linear-gradient(
            2deg,
            transparent 0%,
            transparent 8%,
            rgba(72, 28, 9, 0.13) 12%,
            rgba(34, 11, 4, 0.16) 15%,
            transparent 20%,
            transparent 26%,
            rgba(83, 32, 9, 0.11) 32%,
            rgba(35, 11, 4, 0.15) 36%,
            transparent 42%,
            transparent 49%,
            rgba(72, 26, 8, 0.12) 55%,
            rgba(28, 9, 3, 0.14) 59%,
            transparent 65%,
            transparent 73%,
            rgba(88, 34, 10, 0.1) 80%,
            rgba(36, 11, 4, 0.12) 84%,
            transparent 91%
        ),
        /* Main horizontal fibers */
        repeating-linear-gradient(
                1deg,
                transparent 0px,
                transparent 12px,
                rgba(83, 32, 9, 0.1) 17px,
                rgba(111, 43, 11, 0.065) 23px,
                transparent 29px,
                transparent 43px,
                rgba(39, 13, 4, 0.12) 48px,
                rgba(70, 25, 7, 0.075) 54px,
                transparent 62px,
                transparent 83px
            ),
        /* Secondary fibers */
        repeating-linear-gradient(
                -2deg,
                transparent 0px,
                transparent 25px,
                rgba(94, 37, 10, 0.065) 31px,
                rgba(48, 16, 5, 0.085) 37px,
                transparent 45px,
                transparent 72px
            );

    filter: blur(6px);
    opacity: 0.88;
    transform: scale(1.08, 1.02) skewY(-0.5deg);

    pointer-events: none;
    z-index: 0;
}

/* Fine Horizontal Fibers */
.chassis-main-body[data-plinth-style='walnut']::after {
    content: '';
    position: absolute;
    inset: 0;

    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 5px,
            rgba(255, 166, 77, 0.012) 7px,
            transparent 9px,
            transparent 17px,
            rgba(98, 37, 9, 0.025) 20px,
            transparent 23px,
            transparent 34px
        ),
        repeating-linear-gradient(
            1deg,
            transparent 0px,
            transparent 19px,
            rgba(144, 57, 14, 0.018) 23px,
            transparent 28px,
            transparent 47px
        );

    filter: blur(1px);
    opacity: 0.75;
    pointer-events: none;
    z-index: 1;
}

/* Keep chassis contents above the wood texture */
.chassis-main-body[data-plinth-style='walnut'] > * {
    position: relative;
    z-index: 2;
}

/* =========================================================
   CHASSIS PHOTOGRAPHIC BACKGROUND SURFACES
   ========================================================= */
.chassis-main-body[data-plinth-style^='bg-'] {
    position: relative;
    background-color: #090c12;
}

.chassis-main-body[data-plinth-style^='bg-']::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    transition: background-image 0.4s ease;
}

.chassis-main-body[data-plinth-style^='bg-']::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 50% 42%,
        rgba(8, 10, 16, 0.12) 0%,
        rgba(8, 10, 16, 0.45) 72%,
        rgba(4, 6, 10, 0.76) 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 0 40px rgba(0, 0, 0, 0.65);
    z-index: 1;
    pointer-events: none;
}

.chassis-main-body[data-plinth-style^='bg-'] > * {
    position: relative;
    z-index: 2;
}

.chassis-main-body[data-plinth-style='bg-1990s-band-stickers']::before {
    background-image: url('../../images/backgrounds/1990s-band-stickers.webp');
}
.chassis-main-body[data-plinth-style='bg-art-school']::before {
    background-image: url('../../images/backgrounds/art-school-studio-table.webp');
}
.chassis-main-body[data-plinth-style='bg-autumn-leaves']::before {
    background-image: url('../../images/backgrounds/autumn-concrete-leaves.webp');
}
.chassis-main-body[data-plinth-style='bg-caution-heavy']::before {
    background-image: url('../../images/backgrounds/caution-do-not-operate.webp');
}
.chassis-main-body[data-plinth-style='bg-radio-tubes']::before {
    background-image: url('../../images/backgrounds/radio-tubes.webp');
}
.chassis-main-body[data-plinth-style='bg-route-66']::before {
    background-image: url('../../images/backgrounds/route-66-diner.webp');
}
.chassis-main-body[data-plinth-style='bg-rustic-workbench']::before {
    background-image: url('../../images/backgrounds/rustic-workbench.webp');
}
.chassis-main-body[data-plinth-style='bg-shou-sugi-dark']::before {
    background-image: url('../../images/backgrounds/shou-sugi-ban-[dark].webp');
}
.chassis-main-body[data-plinth-style='bg-shou-sugi-light']::before {
    background-image: url('../../images/backgrounds/shou-sugi-ban-[light].webp');
}
.chassis-main-body[data-plinth-style='bg-walnut-timber']::before {
    background-image: url('../../images/backgrounds/walnut.webp');
}

/* Chassis Variant: Living Ambient Album Blur */
.chassis-main-body[data-plinth-style='album-blur'] {
    position: relative;
    background: transparent;
}

.chassis-main-body[data-plinth-style='album-blur']::before {
    content: '';
    position: absolute;
    inset: -20px;
    background-image: var(--ambient-art, none);
    background-size: cover;
    background-position: center;
    filter: blur(50px) saturate(180%) brightness(0.48);
    opacity: 0.92;
    z-index: 0;
    pointer-events: none;
    transition: background-image 0.8s ease;
}

.chassis-main-body[data-plinth-style='album-blur']::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 50% 40%,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(8, 10, 16, 0.72) 75%,
        rgba(4, 6, 10, 0.92) 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 0 40px rgba(0, 0, 0, 0.7);
    z-index: 1;
    pointer-events: none;
}

.chassis-main-body[data-plinth-style='album-blur'] > * {
    position: relative;
    z-index: 2;
}

/* Chassis Variant: Custom Uploaded / Dropped Table Surface Image */
.chassis-main-body[data-plinth-style='custom-image'] {
    position: relative;
    background-color: #090c12;
}

.chassis-main-body[data-plinth-style='custom-image']::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--custom-plinth-bg, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    transition: background-image 0.4s ease;
}

.chassis-main-body[data-plinth-style='custom-image']::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 50% 42%,
        rgba(8, 10, 16, 0.18) 0%,
        rgba(8, 10, 16, 0.52) 72%,
        rgba(4, 6, 10, 0.78) 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 0 40px rgba(0, 0, 0, 0.65);
    z-index: 1;
    pointer-events: none;
}

.chassis-main-body[data-plinth-style='custom-image'] > * {
    position: relative;
    z-index: 2;
}

/* Recessed Physical Turntable Platter Well */
.turntable-platter-well {
    position: relative;
    width: var(--stage-size);
    height: var(--stage-size);
    min-width: var(--stage-size);
    min-height: var(--stage-size);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    border-radius: 50%;
    border: 5px solid transparent;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    overflow: visible;
    transition:
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

/* Glowing Amber Platter Drop Target for external links and artwork */
.platter-drop-target {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px dashed var(--accent-brand);
    background: radial-gradient(circle, rgba(220, 163, 66, 0.22) 0%, rgba(7, 9, 14, 0.88) 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
    transition:
        opacity 0.25s ease,
        transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.25s ease;
    box-shadow:
        0 0 35px rgba(220, 163, 66, 0.45),
        inset 0 0 25px rgba(220, 163, 66, 0.25);
}

body.is-external-drag.is-platter-drop-active .platter-drop-target {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    animation: pulse-drop-glow 1.6s ease-in-out infinite alternate;
}

/* Only the copy for the current drag kind is rendered inside the platter badge. */
.drop-target-copy {
    display: none;
}

body[data-drag-kind='link'] .drop-target-copy[data-drag-copy='link'],
body[data-drag-kind='image'] .drop-target-copy[data-drag-copy='image'],
body[data-drag-kind='audio'] .drop-target-copy[data-drag-copy='audio'],
body[data-drag-kind='file'] .drop-target-copy[data-drag-copy='file'] {
    display: block;
}

/* During an external drag the iframe must not become the drop target (it would navigate
   its own document or swallow the event before the app-level handler sees it). */
body.is-external-drag iframe {
    pointer-events: none;
}

@keyframes pulse-drop-glow {
    0% {
        box-shadow:
            0 0 25px rgba(220, 163, 66, 0.35),
            inset 0 0 15px rgba(220, 163, 66, 0.2);
        border-color: rgba(220, 163, 66, 0.75);
    }

    100% {
        box-shadow:
            0 0 45px rgba(220, 163, 66, 0.65),
            inset 0 0 30px rgba(220, 163, 66, 0.4);
        border-color: var(--accent-brand-light);
    }
}

.drop-target-disc {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    text-align: center;
    pointer-events: none;
}

.drop-target-disc i {
    font-size: 2.2rem;
    color: var(--accent-brand-light);
    animation: bounce-drop-icon 1s ease-in-out infinite alternate;
}

@keyframes bounce-drop-icon {
    0% {
        transform: translateY(-4px);
    }

    100% {
        transform: translateY(4px);
    }
}

.drop-target-text {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.drop-target-sub {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent-brand-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(220, 163, 66, 0.3);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* Platter rotator hidden when cover is seated and paused */
.turntable-platter-rotator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    transform-origin: center center;
    transition:
        background 0.4s ease,
        opacity 0.4s ease;
}

.turntable-platter-well:has(.vinyl-stage.is-spinning) .turntable-platter-rotator,
.turntable-platter-well:has(.vinyl-stage.is-flipping-disc) .turntable-platter-rotator,
.turntable-platter-well:has(.vinyl-stage.is-animating) .turntable-platter-rotator,
body.is-studio-mode .turntable-platter-rotator {
    opacity: 1;
}

/* Stationary Overhead Lighting & Platter Chamfer Overlay (Sibling to rotator, stays 100% stationary) */
.turntable-platter-lighting {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    /* Stationary directional studio key-light from upper-left (35% 25%) that casts realistic fixed sheen */
    background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.14) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.turntable-platter-well:has(.vinyl-stage.is-spinning) .turntable-platter-lighting,
.turntable-platter-well:has(.vinyl-stage.is-flipping-disc) .turntable-platter-lighting,
.turntable-platter-well:has(.vinyl-stage.is-animating) .turntable-platter-lighting,
body.is-studio-mode .turntable-platter-lighting {
    opacity: 1;
}

/* Platter & Disc Rotation Period (Default: 33⅓ RPM = 1.8s, 45 RPM = 1.3333s) */
.turntable-platter-well,
.vinyl-stage {
    --spin-period: 1.8s;
}

.turntable-platter-well.is-45-rpm,
.turntable-platter-well:has(.vinyl-stage.is-45-rpm),
.vinyl-stage.is-45-rpm {
    --spin-period: 1.3333s;
}

/* Synchronized Platter Rotation with Turntable Motor */
.turntable-platter-well:has(.vinyl-stage.is-spinning) .turntable-platter-rotator,
.turntable-platter-well.is-motor-running .turntable-platter-rotator {
    animation: spinDisc var(--spin-period) linear infinite;
}

/* OPTICAL STROBE SHUTTER MODE (Synchronized with Zoetrope 24-Frame Ring & Technics Checkerboard)
   33⅓ RPM: 1.8s full rotation / 24 frames = 75ms per step (13.33 frames/sec animation)
   45 RPM:  1.3333s full rotation / 24 frames = 55.5ms per step (18.0 frames/sec animation)
   This "steps(24, end)" shutter quantizes rotation so bird silhouettes flap & morph in place without seizure-inducing screen flashing! */
.turntable-platter-well.is-strobe-active:has(.vinyl-stage.is-spinning) .turntable-platter-rotator,
.turntable-platter-well.is-strobe-active.is-motor-running .turntable-platter-rotator,
.turntable-platter-well.is-strobe-active .vinyl-stage.is-spinning .vinyl-disc,
.turntable-platter-well.is-strobe-active.is-motor-running .vinyl-disc,
.turntable-platter-well.is-strobe-active:has(.vinyl-stage.is-45-rpm.is-spinning) .turntable-platter-rotator,
.turntable-platter-well.is-strobe-active.is-45-rpm.is-motor-running .turntable-platter-rotator,
.turntable-platter-well.is-strobe-active.is-motor-running:has(.vinyl-stage.is-45-rpm) .turntable-platter-rotator,
.turntable-platter-well.is-strobe-active .vinyl-stage.is-45-rpm.is-spinning .vinyl-disc,
.turntable-platter-well.is-strobe-active.is-45-rpm.is-motor-running .vinyl-disc,
.turntable-platter-well.is-strobe-active.is-motor-running .vinyl-stage.is-45-rpm .vinyl-disc {
    animation-timing-function: steps(24, end) !important;
}

/* Platter Finish 1: Carbon Matrix High-Tech [Default] (Woven 3K Carbon Fiber & Crimson Laser Strobe) */
.turntable-platter-well[data-platter-style='carbon-matrix']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='carbon-matrix']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='carbon-matrix']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='carbon-matrix'] {
    border: 5px solid #1e293b;
    box-shadow:
        inset 0 0 32px rgba(0, 0, 0, 0.95),
        0 0 0 2px rgba(100, 116, 139, 0.5),
        0 0 20px rgba(239, 68, 68, 0.2),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='carbon-matrix'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 10px),
            rgba(239, 68, 68, 0.45) calc(100% - 9px),
            rgba(239, 68, 68, 0.2) calc(100% - 5px),
            transparent 100%
        ),
        radial-gradient(circle at center, transparent 44px, rgba(239, 68, 68, 0.3) 45px, transparent 46px),
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.04) 0px,
            rgba(255, 255, 255, 0.04) 2px,
            transparent 2px,
            transparent 6px
        ),
        repeating-linear-gradient(
            -45deg,
            rgba(0, 0, 0, 0.7) 0px,
            rgba(0, 0, 0, 0.7) 2px,
            transparent 2px,
            transparent 6px
        ),
        radial-gradient(circle at center, #181d26 0%, #0d1015 65%, #05070a 100%);
}

.turntable-platter-well[data-platter-style='carbon-matrix']::before {
    background: radial-gradient(circle at 35% 35%, #94a3b8 0%, #475569 40%, #1e293b 80%, #020617 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(239, 68, 68, 0.35);
}

.turntable-platter-well[data-platter-style='carbon-matrix']::after {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 28px rgba(239, 68, 68, 0.2);
}

/* Platter Finish: Portuguese Natural Cork (High-Res Natural Cork Photo Texture & Recessed Label Cup) */
.turntable-platter-well[data-platter-style='cork-audiophile']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='cork-audiophile']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='cork-audiophile']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='cork-audiophile'] {
    border: 5px solid #4d301b;
    box-shadow:
        inset 0 0 28px rgba(30, 14, 5, 0.95),
        0 0 0 2px rgba(180, 115, 60, 0.35),
        0 18px 50px rgba(0, 0, 0, 0.9);
}

.turntable-platter-well[data-platter-style='cork-audiophile'] .turntable-platter-rotator {
    background:
        /* Outer edge chamfer */
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(30, 14, 5, 0.5) calc(100% - 8px),
            #361b0a 100%
        ),
        /* Recessed center label cup */
        radial-gradient(
                circle at center,
                rgba(30, 14, 5, 0.35) 0px,
                rgba(30, 14, 5, 0.18) 46px,
                rgba(255, 230, 190, 0.12) 47px,
                transparent 48px
            ),
        /* Concentric ring grooves pressed into cork for slip resistance */
        repeating-radial-gradient(
                circle at center,
                transparent 0px,
                transparent 28px,
                rgba(0, 0, 0, 0.08) 29px,
                transparent 30px
            ),
        /* Perfectly centered vignette */
        radial-gradient(circle at center, transparent 30%, rgba(20, 10, 4, 0.4) 85%, #180c05 100%),
        /* High-resolution natural cork photograph centered */ url('../../images/platters/natural-cork.webp')
            center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='cork-audiophile']::before {
    /* 1950s Moulded Bakelite Art Deco Brown Spindle Pin with Aged Brass Rim */
    background: radial-gradient(circle at 35% 35%, #6a3a22 0%, #3d2215 30%, #24140b 65%, #0d0603 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(181, 135, 57, 0.5);
}

.turntable-platter-well[data-platter-style='cork-audiophile']::after {
    border-color: rgba(181, 135, 57, 0.25);
    box-shadow: 0 0 26px rgba(61, 34, 21, 0.22);
}

/* Platter Finish 5: Live-Edge Cross-Cut Timber / Tree Stump (Organic Rings & Medullary Rays) */
.turntable-platter-well[data-platter-style='tree-stump']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='tree-stump']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='tree-stump']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='tree-stump'] {
    border: 6px solid #24150c;
    box-shadow:
        inset 0 0 36px rgba(15, 7, 2, 0.95),
        0 0 0 2px #4a2f1b,
        0 0 0 4px #1a0f07,
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='tree-stump'] .turntable-platter-rotator {
    background:
        /* Outer bark & cambium rugged rim */
        radial-gradient(
            circle at center,
            transparent calc(100% - 28px),
            rgba(220, 175, 120, 0.45) calc(100% - 22px),
            rgba(165, 110, 55, 0.75) calc(100% - 12px),
            #2d180c 100%
        ),
        /* Radiating medullary rays (fine wood fibers radiating outward from center pith) */
        repeating-conic-gradient(
                from 0deg at center,
                transparent 0deg,
                transparent 2.5deg,
                rgba(70, 32, 10, 0.12) 2.9deg,
                rgba(235, 185, 125, 0.08) 3.2deg,
                transparent 3.6deg
            ),
        /* Dense core pith growth rings (tightly packed dark amber and espresso rings near center) */
        radial-gradient(
                circle at center,
                #2e1205 0px,
                #4a1c07 4px,
                #1a0802 6px,
                #823e14 10px,
                #331204 13px,
                #964e1a 18px,
                #3a1505 21px,
                transparent 28px
            ),
        /* Golden-cream sapwood active growth zone */
        radial-gradient(
                circle at center,
                transparent 0%,
                transparent 81%,
                rgba(225, 178, 120, 0.35) 86%,
                rgba(240, 202, 150, 0.5) 91%,
                rgba(120, 68, 25, 0.35) 96%,
                transparent 99%
            ),
        /* Varied Growth Rings Tier 1: Bold decadal seasonal boundaries (31px spacing) */
        repeating-radial-gradient(
                circle at center,
                transparent 0px,
                transparent 19px,
                rgba(45, 18, 5, 0.4) 22px,
                rgba(18, 7, 2, 0.7) 24px,
                rgba(245, 185, 115, 0.2) 25.5px,
                transparent 31px
            ),
        /* Varied Growth Rings Tier 2: Irregular seasonal climate cycles (13.5px spacing) */
        repeating-radial-gradient(
                circle at center,
                transparent 0px,
                transparent 7px,
                rgba(60, 25, 8, 0.35) 8.5px,
                rgba(25, 10, 3, 0.58) 10px,
                rgba(220, 155, 85, 0.15) 11px,
                transparent 13.5px
            ),
        /* Varied Growth Rings Tier 3: Delicate fine latewood striations (5.5px spacing) */
        repeating-radial-gradient(
                circle at center,
                transparent 0px,
                transparent 2.2px,
                rgba(48, 20, 6, 0.3) 2.8px,
                rgba(20, 8, 2, 0.48) 3.5px,
                transparent 4px,
                transparent 5.5px
            ),
        /* Deep warm heartwood core warmth with undulating radial depth */
        radial-gradient(
                circle at center,
                rgba(125, 52, 16, 0.75) 0%,
                rgba(145, 75, 30, 0.45) 30%,
                rgba(95, 42, 14, 0.6) 60%,
                rgba(50, 20, 6, 0.85) 88%,
                #200d04 100%
            ),
        /* Natural wood cross-cut base tone */ linear-gradient(135deg, #a86b36 0%, #8c5324 50%, #6e3a15 100%);
}

.turntable-platter-well[data-platter-style='tree-stump']::before {
    /* Hand-Turned Aged Patina Bronze Spindle Pin */
    background: radial-gradient(circle at 35% 35%, #ebd1b3 0%, #a8764a 35%, #5a381e 75%, #1c0f07 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(168, 118, 74, 0.35);
}

.turntable-platter-well[data-platter-style='tree-stump']::after {
    border-color: rgba(168, 118, 74, 0.3);
    box-shadow: 0 0 30px rgba(168, 118, 74, 0.15);
}

/* Platter Finish: Kinetic Zoetrope Slipmat (Dynamic Optical Animation Tiers) */
.turntable-platter-well[data-platter-style='zoetrope-kinetic']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='zoetrope-kinetic']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='zoetrope-kinetic']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='zoetrope-kinetic'] {
    border: 5px solid #0284c7;
    box-shadow:
        inset 0 0 34px rgba(2, 132, 199, 0.4),
        0 0 0 2px rgba(56, 189, 248, 0.5),
        0 0 28px rgba(2, 132, 199, 0.35),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='zoetrope-kinetic'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 14px),
            rgba(56, 189, 248, 0.4) calc(100% - 10px),
            #0369a1 100%
        ),
        url('../../images/platters/zoetrope-kinetic.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='zoetrope-kinetic']::before {
    /* Blue-anodized titanium spindle pin */
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #38bdf8 35%, #0284c7 75%, #0369a1 100%);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.95),
        0 0 3px rgba(56, 189, 248, 0.7);
}

.turntable-platter-well[data-platter-style='zoetrope-kinetic']::after {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 32px rgba(2, 132, 199, 0.3);
}

/* Platter Finish 8b: Mystic Raven & Moon Zoetrope (24-Frame Corvid Flight & Lunar Phases) */
.turntable-platter-well[data-platter-style='zoetrope-raven']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='zoetrope-raven']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='zoetrope-raven']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='zoetrope-raven'] {
    border: 5px solid #292524;
    box-shadow:
        inset 0 0 34px rgba(12, 10, 9, 0.95),
        0 0 0 2px rgba(120, 113, 108, 0.45),
        0 0 28px rgba(68, 64, 60, 0.4),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='zoetrope-raven'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 14px),
            rgba(28, 25, 23, 0.5) calc(100% - 10px),
            #0c0a09 100%
        ),
        url('../../images/platters/zoetrope-raven.webp') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='zoetrope-raven']::before {
    /* Antique bronze & ebony spindle pin */
    background: radial-gradient(circle at 35% 35%, #fef3c7 0%, #d97706 40%, #78350f 75%, #1c1917 100%);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.95),
        0 0 3px rgba(245, 158, 11, 0.5);
}

.turntable-platter-well[data-platter-style='zoetrope-raven']::after {
    border-color: rgba(120, 113, 108, 0.35);
    box-shadow: 0 0 32px rgba(68, 64, 60, 0.25);
}

/* Platter Finish 9: 1970s Technics Pitch Calibration Disc / Checkerboard Strobe */
.turntable-platter-well[data-platter-style='technics-checkerboard']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='technics-checkerboard']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='technics-checkerboard']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='technics-checkerboard'] {
    border: 5px solid #475569;
    box-shadow:
        inset 0 0 36px rgba(0, 0, 0, 0.98),
        0 0 0 2px rgba(203, 213, 225, 0.5),
        0 0 24px rgba(56, 189, 248, 0.25),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='technics-checkerboard'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(255, 255, 255, 0.2) calc(100% - 12px),
            #1e293b 100%
        ),
        url('../../images/platters/technics-checkerboard.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='technics-checkerboard']::before {
    /* Precision-machined Technics stainless-steel bullet spindle */
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 35%, #475569 75%, #0f172a 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(255, 255, 255, 0.5);
}

.turntable-platter-well[data-platter-style='technics-checkerboard']::after {
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 0 28px rgba(56, 189, 248, 0.2);
}

/* Platter Finish 10: Moroccan Arabesque Mandala (Hand-Tooled Leather & Gold) */
.turntable-platter-well[data-platter-style='moroccan-mandala']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='moroccan-mandala']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='moroccan-mandala']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='moroccan-mandala'] {
    border: 5px solid #854d0e;
    box-shadow:
        inset 0 0 34px rgba(26, 10, 3, 0.95),
        0 0 0 2px rgba(212, 175, 55, 0.6),
        0 0 28px rgba(20, 184, 166, 0.25),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='moroccan-mandala'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(36, 16, 6, 0.6) calc(100% - 10px),
            #150903 100%
        ),
        url('../../images/platters/moroccan-mandala.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='moroccan-mandala']::before {
    /* Burnished antique gold & turquoise jewel stud spindle */
    background: radial-gradient(circle at 35% 35%, #fae082 0%, #d4af37 40%, #854d0e 80%, #241006 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 2px 1px rgba(20, 184, 166, 0.7);
}

.turntable-platter-well[data-platter-style='moroccan-mandala']::after {
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 32px rgba(212, 175, 55, 0.2);
}

/* Platter Finish 10b: Moroccan Zellij Knotwork (Interlaced Strapwork Ribbon) */
.turntable-platter-well[data-platter-style='moroccan-zellij']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='moroccan-zellij']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='moroccan-zellij']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='moroccan-zellij'] {
    border: 5px solid #78350f;
    box-shadow:
        inset 0 0 34px rgba(26, 10, 3, 0.95),
        0 0 0 2px rgba(245, 158, 11, 0.6),
        0 0 28px rgba(13, 148, 136, 0.25),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='moroccan-zellij'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(36, 16, 6, 0.6) calc(100% - 10px),
            #150903 100%
        ),
        url('../../images/platters/moroccan-zellij-knotwork.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='moroccan-zellij']::before {
    background: radial-gradient(circle at 35% 35%, #fde68a 0%, #d4af37 40%, #78350f 80%, #1c0a02 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 2px 1px rgba(13, 148, 136, 0.7);
}

.turntable-platter-well[data-platter-style='moroccan-zellij']::after {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 32px rgba(245, 158, 11, 0.2);
}

/* Platter Finish 10c: Sacred Flower of Life (Concentric Petal Moiré Rings) */
.turntable-platter-well[data-platter-style='moroccan-flower']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='moroccan-flower']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='moroccan-flower']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='moroccan-flower'] {
    border: 5px solid #0f766e;
    box-shadow:
        inset 0 0 34px rgba(15, 118, 110, 0.35),
        0 0 0 2px rgba(94, 234, 212, 0.5),
        0 0 28px rgba(20, 184, 166, 0.3),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='moroccan-flower'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(15, 118, 110, 0.4) calc(100% - 10px),
            #042f2e 100%
        ),
        url('../../images/platters/moroccan-flower-of-life.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='moroccan-flower']::before {
    background: radial-gradient(circle at 35% 35%, #fae082 0%, #14b8a6 45%, #0f766e 80%, #042f2e 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 2px 1px rgba(94, 234, 212, 0.7);
}

.turntable-platter-well[data-platter-style='moroccan-flower']::after {
    border-color: rgba(20, 184, 166, 0.4);
    box-shadow: 0 0 32px rgba(20, 184, 166, 0.25);
}

/* Platter Finish 10d: Engraved Brass Tray Filigree (Pierced Coins & Paisley Volutes) */
.turntable-platter-well[data-platter-style='moroccan-brass']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='moroccan-brass']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='moroccan-brass']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='moroccan-brass'] {
    border: 5px solid #a16207;
    box-shadow:
        inset 0 0 36px rgba(20, 12, 4, 0.95),
        0 0 0 2px rgba(254, 240, 138, 0.6),
        0 0 28px rgba(234, 179, 8, 0.35),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='moroccan-brass'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 16px),
            rgba(161, 98, 7, 0.5) calc(100% - 10px),
            #1e1305 100%
        ),
        url('../../images/platters/moroccan-brass-tray.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='moroccan-brass']::before {
    background: radial-gradient(circle at 35% 35%, #fef08a 0%, #eab308 40%, #854d0e 80%, #1c1305 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 2px 1px rgba(250, 204, 21, 0.6);
}

.turntable-platter-well[data-platter-style='moroccan-brass']::after {
    border-color: rgba(234, 179, 8, 0.4);
    box-shadow: 0 0 32px rgba(234, 179, 8, 0.25);
}

/* Platter Finish 11: 1930s Art Deco Geometric Sunburst & Compass Rose */
.turntable-platter-well[data-platter-style='artdeco-sunburst']:has(.vinyl-stage.is-spinning),
.turntable-platter-well[data-platter-style='artdeco-sunburst']:has(.vinyl-stage.is-flipping-disc),
.turntable-platter-well[data-platter-style='artdeco-sunburst']:has(.vinyl-stage.is-animating),
body.is-studio-mode .turntable-platter-well[data-platter-style='artdeco-sunburst'] {
    border: 5px solid #b58739;
    box-shadow:
        inset 0 0 36px rgba(13, 6, 3, 0.95),
        0 0 0 2px rgba(250, 224, 130, 0.6),
        0 0 24px rgba(181, 135, 57, 0.3),
        0 18px 50px rgba(0, 0, 0, 0.95);
}

.turntable-platter-well[data-platter-style='artdeco-sunburst'] .turntable-platter-rotator {
    background:
        radial-gradient(
            circle at center,
            transparent calc(100% - 14px),
            rgba(181, 135, 57, 0.4) calc(100% - 10px),
            #24140b 100%
        ),
        url('../../images/platters/artdeco-sunburst.svg') center/cover no-repeat;
}

.turntable-platter-well[data-platter-style='artdeco-sunburst']::before {
    /* 1950s Bakelite brown & brass bevel spindle */
    background: radial-gradient(circle at 35% 35%, #fae082 0%, #b58739 35%, #3d2215 75%, #0d0603 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(250, 224, 130, 0.6);
}

.turntable-platter-well[data-platter-style='artdeco-sunburst']::after {
    border-color: rgba(250, 224, 130, 0.3);
    box-shadow: 0 0 30px rgba(181, 135, 57, 0.22);
}

/* Center Stainless-Steel Turntable Spindle Pin Base */
.turntable-platter-well::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    box-sizing: border-box;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 35%, #475569 75%, #0f172a 100%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.95),
        0 0 1px 1px rgba(255, 255, 255, 0.35);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 0.4s ease,
        background 0.4s ease,
        box-shadow 0.4s ease;
}

.turntable-platter-well:has(.vinyl-stage.is-spinning)::before,
.turntable-platter-well:has(.vinyl-stage.is-flipping-disc)::before,
.turntable-platter-well:has(.vinyl-stage.is-animating)::before,
body.is-studio-mode .turntable-platter-well::before {
    opacity: 1;
}

/* Ambient Plinth Halo around Platter Base */
.turntable-platter-well::after {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px dashed rgba(220, 163, 66, 0.25);
    box-shadow: 0 0 26px rgba(220, 163, 66, 0.12);
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 0.5s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

.turntable-platter-well:has(.vinyl-stage.is-spinning)::after,
.turntable-platter-well:has(.vinyl-stage.is-flipping-disc)::after,
.turntable-platter-well:has(.vinyl-stage.is-animating)::after,
body.is-studio-mode .turntable-platter-well::after {
    opacity: 1;
}

/* Plinth Hardware Switch Bar */
.plinth-hardware-bar {
    display: inline-flex;
    align-items: center;
    gap: var(--space-5);
    margin-top: clamp(0.75rem, 2.5vh, 1.75rem);
    background: rgba(14, 18, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    flex-shrink: 0;
}

.plinth-hardware-switch {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 6px;
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;
    user-select: none;
}

.plinth-hardware-switch:hover {
    color: #fff;
}

.plinth-hardware-switch .switch-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #334155;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.25s ease;
    box-shadow: none;
}

.plinth-hardware-switch.is-active {
    color: var(--accent-brand-light);
}

.plinth-hardware-switch.is-active .switch-led {
    background: var(--accent-brand);
    box-shadow: 0 0 8px var(--accent-brand);
}

/* Strobe Switch: Iconic Red Neon / Ruby Prism LED */
.plinth-hardware-switch#plinth-strobe-switch.is-active {
    color: #fda4af;
}

.plinth-hardware-switch#plinth-strobe-switch.is-active .switch-led-strobe {
    background: #f43f5e;
    box-shadow:
        0 0 8px #f43f5e,
        0 0 14px rgba(244, 63, 94, 0.6);
}

.plinth-hardware-switch.is-45-rpm {
    color: #f59e0b;
}

.plinth-hardware-switch.is-45-rpm i {
    color: #f59e0b;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

/* Separators are implicit borders on each item except the first, so hiding an item
   (e.g. the video-mode control on iOS) removes its border with it — no stray lines. */
.plinth-hardware-bar > * + * {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

/* Plinth Video Mode Dropdown */
.plinth-hardware-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.plinth-switch-chevron {
    font-size: 0.55rem;
    opacity: 0.65;
    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
    margin-left: -2px;
}

.plinth-hardware-dropdown.is-open .plinth-switch-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.plinth-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 18, 28, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.75),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 5px;
    min-width: 155px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: plinthMenuPop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes plinthMenuPop {
    from {
        opacity: 0;
        transform: translate(-50%, 6px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.plinth-dropdown-item {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
    text-align: left;
    width: 100%;
    user-select: none;
    box-sizing: border-box;
}

.plinth-dropdown-item i {
    font-size: var(--fs-lg);
    width: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.15s ease;
}

.plinth-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.plinth-dropdown-item:hover i {
    color: var(--accent-brand-light, #f5cf7e);
}

.plinth-dropdown-item.is-active {
    background: rgba(220, 163, 66, 0.15);
    color: var(--accent-brand-light, #f5cf7e);
    font-weight: 600;
}

.plinth-dropdown-item.is-active i {
    color: var(--accent-brand, #dca342);
}

/* Tonearm Assembly */
.tonearm-assembly {
    position: absolute;
    top: calc(-24px * var(--stage-scale));
    right: calc(-36px * var(--stage-scale));
    width: 160px;
    height: 260px;
    transform-origin: top right;
    transform: scale(var(--stage-scale));
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.3s ease;
}

.vinyl-stage.is-spinning:not(.is-animating) .tonearm-assembly,
.vinyl-stage.is-flipping-disc .tonearm-assembly,
body.is-studio-mode .tonearm-assembly {
    opacity: 1 !important;
    visibility: visible !important;
}

.vinyl-stage:not(.is-spinning):not(.is-flipping-disc) .tonearm-assembly,
.vinyl-stage.is-animating:not(.is-flipping-disc) .tonearm-assembly {
    opacity: 0;
}

body.is-studio-mode .vinyl-stage .tonearm-assembly,
body.is-studio-mode .vinyl-stage:not(.is-spinning) .tonearm-assembly {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 30 !important;
}

.tonearm-base-svg {
    position: absolute;
    top: 16px;
    right: 0px;
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
    display: block;
    object-fit: contain;
    z-index: 11;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
}

.tonearm-wand-wrap {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 240px;
    height: 340px;
    transform-origin: 71.25% 25.2941%;
    transform: rotate(-44deg);
    transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 12;
}

/* Tonearm drag-to-cue: only the head (stylus end) of the arm is grabbable, and only
   while the arm is on the platter (spinning / cued / studio). Slice 1 rotates around
   the base; slice 2 seeks on drop. */
.tonearm-head-hit {
    position: absolute;
    left: 30%;
    top: 85%;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
}

.vinyl-stage.is-spinning .tonearm-head-hit,
.vinyl-stage.is-cued .tonearm-head-hit,
.turntable-platter-well.is-cued .tonearm-head-hit,
body.is-studio-mode .tonearm-head-hit {
    pointer-events: auto;
    cursor: grab;
}

.tonearm-wand-wrap.is-dragging {
    transition: none !important;
}

.tonearm-wand-wrap.is-dragging .tonearm-head-hit {
    cursor: grabbing;
}

.tonearm-wand-wrap.is-dragging .tonearm-wand-svg {
    animation: none !important;
}

.vinyl-stage.is-spinning .tonearm-wand-wrap,
.vinyl-stage.is-cued .tonearm-wand-wrap,
.turntable-platter-well.is-cued .tonearm-wand-wrap {
    transform: rotate(var(--tonearm-play-angle, -10.73deg));
}

.vinyl-stage.is-flipping-disc .tonearm-wand-wrap {
    transform: rotate(-44deg) !important;
    transition: transform 0.55s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.vinyl-stage.is-flipping-disc .tonearm-wand-svg {
    animation: none !important;
}

.tonearm-wand-svg {
    display: block;
    width: 240px;
    height: 340px;
    max-width: 240px;
    max-height: 340px;
    object-fit: contain;
    transform-origin: 71.25% 25.2941%;
}

.vinyl-stage.is-spinning:not(.is-flipping-disc) .tonearm-wand-svg,
.vinyl-stage.is-cued:not(.is-flipping-disc) .tonearm-wand-svg,
.turntable-platter-well.is-cued .tonearm-wand-svg {
    animation: tonearmTracking 4s ease-in-out 1.2s infinite alternate;
}

@keyframes tonearmTracking {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(0.4deg);
    }

    100% {
        transform: rotate(-0.3deg);
    }
}

/* Vinyl Stage */
.vinyl-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    z-index: 2;
    cursor: pointer;
    transition:
        width 0.3s ease,
        height 0.3s ease;
    perspective: 1200px;
    box-sizing: border-box;
}

.vinyl-stage:not(.has-disc) {
    cursor: default;
}

.album-cover-container {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    overflow: hidden;
    box-shadow:
        0 16px 36px rgba(0, 0, 0, 0.85),
        0 0 0 1px var(--border-highlight);
    background: transparent;
    transform-origin: center center;
    transform: translate(0, 0) rotate(0deg) scale(1);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    pointer-events: auto;
    will-change: transform, border-radius, opacity, filter;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.album-cover-img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    border-radius: inherit;
    transition: filter 0.6s ease;
}

/* Hover when paused and not animating */
body:not(.is-studio-mode) .vinyl-stage:not(.is-spinning):not(.is-animating) .album-cover-container {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body:not(.is-studio-mode)
    .vinyl-stage:not(.is-spinning):not(.is-animating):not(.is-hover-suppressed):hover
    .album-cover-container,
body:not(.is-studio-mode)
    .vinyl-stage:not(.is-spinning):not(.is-animating):not(.is-hover-suppressed)
    .album-cover-container:hover {
    transform: translateX(-46px) translateY(6px) rotate(-5deg);
}

.vinyl-stage.is-spinning .album-cover-container {
    pointer-events: none;
}

.vinyl-stage.is-spinning .album-cover-img {
    filter: contrast(1.1) brightness(0.95);
}

.vinyl-peek {
    position: absolute;
    inset: 2%;
    width: 96%;
    height: 96%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
    transition:
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s ease;
    pointer-events: none;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.vinyl-disc {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(closest-side circle at center, #0c0d11 0%, #050608 65%, #010203 100%);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04);
    border: 2px solid #14161d;
    box-sizing: border-box;
    transform-origin: center center;
    transition:
        background 0.4s ease,
        border-color 0.4s ease;
}

/* Picture Disc / Zoetrope Wax Variant */
.vinyl-disc.is-picture-disc {
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.22),
        inset 0 0 24px rgba(0, 0, 0, 0.65),
        0 8px 30px rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.18);
}

/* On picture discs, keep the center label translucent/minimal so the zoetrope design is unobstructed */
.vinyl-stage.has-picture-disc .vinyl-label,
.vinyl-stage.has-video-disc .vinyl-label {
    opacity: 0.82;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.18),
        0 4px 16px rgba(0, 0, 0, 0.7);
}

.vinyl-groove-tracks {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    transition: background 0.8s ease;
}

.vinyl-stage.has-video-disc .vinyl-groove-tracks {
    opacity: 0.85;
}

.vinyl-stage.has-picture-disc .vinyl-groove-tracks {
    opacity: 0.94;
}

.vinyl-stage.has-picture-disc .vinyl-shine,
.vinyl-stage.has-video-disc .vinyl-shine {
    opacity: 0.88;
    mix-blend-mode: screen;
}

/* On video discs, make the underlying vinyl disc background transparent so the video shines through cleanly */
.vinyl-stage.has-video-disc .vinyl-disc {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.15),
        inset 0 0 16px rgba(0, 0, 0, 0.4),
        0 8px 30px rgba(0, 0, 0, 0.85);
}

/* Video Disc Layering */
.vinyl-disc .vinyl-video-disc-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    transform-origin: center center;
    background: #000;
}

.vinyl-disc .vinyl-video-disc-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Scale and center 16:9 video so it covers the square circle completely without black bars */
    width: 178%;
    height: 178%;
    transform: translate(-50%, -50%);
    border: 0;
    pointer-events: none;
}

/* Living Label Video Container */
.vinyl-label .vinyl-video-label-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    background: #000;
}

.vinyl-label .vinyl-video-label-container:empty {
    display: none;
    background: transparent;
}

.vinyl-label .vinyl-video-label-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 178%;
    height: 178%;
    transform: translate(-50%, -50%);
    border: 0;
    pointer-events: none;
}

.vinyl-label.has-video-label .vinyl-label-img {
    opacity: 0;
    visibility: hidden;
}

.vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    z-index: 2;
    width: 38%;
    height: 38%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.7),
        0 2px 10px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    background: #11141c;
}

.vinyl-label-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    filter: contrast(1.1) brightness(0.95);
    pointer-events: none;
    display: block;
}

.vinyl-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #06070a;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 0 4px rgba(0, 0, 0, 0.95),
        inset 0 0 2px rgba(0, 0, 0, 0.85);
    z-index: 5;
    box-sizing: border-box;
    transition:
        width 0.4s ease,
        height 0.4s ease;
}

/* 45 RPM Snap-in Spider / Stabilizer Adapter */
.vinyl-45-adapter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38%;
    height: 38%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-sizing: border-box;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.85));
    transition:
        opacity 0.4s ease,
        visibility 0.4s ease;
}

.vinyl-45-adapter-img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
}

/* 7-inch Single Proportions & 45 RPM Adaptations */
.vinyl-stage[data-disc-format='7in-single'] .vinyl-label {
    width: 51.5%;
    height: 51.5%;
    aspect-ratio: 1 / 1;
    border-width: 2.5px;
}

.vinyl-stage[data-disc-format='7in-single'] .vinyl-hole {
    width: 41.6%;
    height: 41.6%;
    aspect-ratio: 1 / 1;
    background: radial-gradient(circle at center, #0a0c10 0%, #030406 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.9),
        0 0 4px rgba(0, 0, 0, 0.8);
}

.vinyl-stage[data-disc-format='7in-single'] .vinyl-45-adapter {
    width: 41.6%;
    height: 41.6%;
    aspect-ratio: 1 / 1;
}

body:not(.is-studio-mode) .vinyl-stage[data-disc-format='7in-single']:not(.is-spinning) .vinyl-hole {
    background: transparent;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.7);
}

body:not(.is-studio-mode) .vinyl-stage[data-disc-format='7in-single']:not(.is-spinning) .vinyl-peek {
    -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 0, transparent 10.7%, #000 10.8%, #000 100%);
    mask-image: radial-gradient(circle at 50% 50%, transparent 0, transparent 10.7%, #000 10.8%, #000 100%);
}

.vinyl-stage[data-disc-format='7in-single'].is-spinning .vinyl-45-adapter,
body.is-studio-mode .vinyl-stage[data-disc-format='7in-single'] .vinyl-45-adapter {
    opacity: 1;
    visibility: visible;
}

.vinyl-stage.is-flipping-album .vinyl-peek {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Hover Peek: the sleeve slides aside and the record pops out at full size.
   A paused 7" single has already scaled up to the sleeve, so it also uses the
   full-size hover transform instead of snapping back to 7". */
body:not(.is-studio-mode)
    .vinyl-stage:not(.is-spinning):not(.is-animating):not(.is-flipping-disc):not(.is-hover-suppressed):hover
    .vinyl-peek {
    transform: translateX(42%) translateY(-3%) rotate(34deg) scale(1);
}

/* Seated on the platter, or spinning up to the sleeve. */
.vinyl-stage.is-spinning .vinyl-peek,
.vinyl-stage.is-animating .vinyl-peek {
    transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    z-index: 1;
    animation: vinylPulseShadow 2.8s ease-in-out infinite alternate;
}

/* Playing 7" single sits at 7" on the platter. Pausing scales it up to the
   full sleeve so the sleeve and record read as the same object coming closer. */
.vinyl-stage[data-disc-format='7in-single'].is-spinning .vinyl-peek {
    transform: translateX(0) translateY(0) rotate(0deg) scale(0.75);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.88),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

.vinyl-stage.is-flipping-disc .vinyl-peek {
    z-index: 40 !important;
}

@keyframes vinylPulseShadow {
    0% {
        box-shadow:
            0 16px 36px rgba(0, 0, 0, 0.85),
            0 0 16px rgba(212, 147, 56, 0.12);
    }

    100% {
        box-shadow:
            0 22px 50px rgba(0, 0, 0, 0.95),
            0 0 32px rgba(212, 147, 56, 0.32);
    }
}

.vinyl-stage.is-spinning .vinyl-disc,
.turntable-platter-well.is-motor-running .vinyl-disc {
    animation: spinDisc var(--spin-period) linear infinite;
}

.vinyl-stage.is-spinning .vinyl-shine,
.turntable-platter-well.is-motor-running .vinyl-shine {
    animation-play-state: running;
}

.vinyl-stage.is-45-rpm.is-spinning .vinyl-shine,
.turntable-platter-well.is-45-rpm.is-motor-running .vinyl-shine,
.turntable-platter-well.is-motor-running .vinyl-stage.is-45-rpm .vinyl-shine {
    animation-duration: 3.11s;
    animation-play-state: running;
}

@keyframes spinDisc {
    from {
        transform: rotate(0deg);
    }

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

/* Vinyl Shining */

@property --primary-fan-width {
    syntax: '<angle>';
    inherits: false;
    initial-value: 20deg;
}

@property --secondary-fan-width {
    syntax: '<angle>';
    inherits: false;
    initial-value: 35deg;
}

@property --fan-brightness {
    syntax: '<number>';
    inherits: false;
    initial-value: 1;
}

@property --sheen-angle {
    syntax: '<angle>';
    inherits: true;
    initial-value: -10deg;
}

/* =========================================
   VINYL SHINE CONTAINER
========================================= */

.vinyl-shine {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;

    --sheen-angle: -10deg;

    /* Default label radius (Great for 12" LPs where the label is ~33% of the width) */
    --label-radius: 25%;

    /* CSS Mask cuts out the center circle so sheen never touches the label */
    mask-image: radial-gradient(circle, transparent var(--label-radius), black calc(var(--label-radius) + 1.5%));
    -webkit-mask-image: radial-gradient(
        circle,
        transparent var(--label-radius),
        black calc(var(--label-radius) + 1.5%)
    );

    animation: oscillateSheen 6.8s ease-in-out infinite alternate;
    animation-play-state: running;

    transition: opacity 0.5s ease;
}

/* Modifier class for 7" Singles (Label is proportionally larger, ~45%) */
.vinyl-stage[data-disc-format='7in-single'] .vinyl-shine {
    --label-radius: 36%;
}

/* =========================================
   PRIMARY REFLECTION (Tighter, Focused Gloss)
========================================= */

.vinyl-shine::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;

    --sheen-offset: 60deg;
    --fan-brightness: 1;

    background: conic-gradient(
        from 90deg at 50% 50%,
        transparent 0deg,

        transparent calc(90deg - var(--primary-fan-width) * 1.5),
        rgba(255, 255, 255, 0.02) calc(90deg - var(--primary-fan-width)),
        rgba(255, 255, 255, 0.22) calc(90deg - var(--primary-fan-width) * 0.2),
        rgba(255, 255, 255, 0.35) 90deg,
        rgba(255, 255, 255, 0.22) calc(90deg + var(--primary-fan-width) * 0.2),
        rgba(255, 255, 255, 0.02) calc(90deg + var(--primary-fan-width)),
        transparent calc(90deg + var(--primary-fan-width) * 1.5),

        transparent 180deg,

        transparent calc(270deg - var(--primary-fan-width) * 1.5),
        rgba(255, 255, 255, 0.02) calc(270deg - var(--primary-fan-width)),
        rgba(255, 255, 255, 0.22) calc(270deg - var(--primary-fan-width) * 0.2),
        rgba(255, 255, 255, 0.35) 270deg,
        rgba(255, 255, 255, 0.22) calc(270deg + var(--primary-fan-width) * 0.2),
        rgba(255, 255, 255, 0.02) calc(270deg + var(--primary-fan-width)),
        transparent calc(270deg + var(--primary-fan-width) * 1.5),

        transparent 360deg
    );

    mix-blend-mode: overlay;
    opacity: 0.6;
    z-index: 1;

    filter: brightness(var(--fan-brightness)) blur(12px);
    transform: rotate(calc(var(--sheen-offset) + var(--sheen-angle)));

    animation:
        oscillatePrimaryFan 5.2s ease-in-out infinite alternate,
        contrastPulse 4.7s ease-in-out infinite alternate;
    animation-play-state: running;
}

/* =========================================
   SECONDARY REFLECTION (Smooth, Wide Iridescent Sheen)
========================================= */

.vinyl-shine::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;

    --sheen-offset: 110deg;
    --fan-brightness: 1;

    /* Clean, non-overlapping math stops that safely fade out before hitting boundaries */
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,

        /* First color cluster (centered at 45deg) */ transparent calc(45deg - var(--secondary-fan-width)),
        rgba(100, 200, 255, 0.03) calc(45deg - var(--secondary-fan-width) * 0.7),
        rgba(255, 100, 220, 0.1) calc(45deg - var(--secondary-fan-width) * 0.2),
        rgba(100, 255, 200, 0.1) calc(45deg + var(--secondary-fan-width) * 0.2),
        rgba(100, 200, 255, 0.03) calc(45deg + var(--secondary-fan-width) * 0.7),
        transparent calc(45deg + var(--secondary-fan-width)),

        transparent 180deg,

        /* Second color cluster (centered at 225deg) */ transparent calc(225deg - var(--secondary-fan-width)),
        rgba(100, 200, 255, 0.03) calc(225deg - var(--secondary-fan-width) * 0.7),
        rgba(255, 100, 220, 0.1) calc(225deg - var(--secondary-fan-width) * 0.2),
        rgba(100, 255, 200, 0.1) calc(225deg + var(--secondary-fan-width) * 0.2),
        rgba(100, 200, 255, 0.03) calc(225deg + var(--secondary-fan-width) * 0.7),
        transparent calc(225deg + var(--secondary-fan-width)),

        transparent 360deg
    );

    mix-blend-mode: color-dodge;
    opacity: 0.65;
    z-index: 2;

    /* Added a soft blur so the outer boundaries melt away organically */
    filter: brightness(var(--fan-brightness)) blur(8px);
    transform: rotate(calc(var(--sheen-offset) - var(--sheen-angle)));

    animation:
        oscillateSecondaryFan 7.3s ease-in-out infinite alternate-reverse,
        oscillateBrightness 4.1s ease-in-out infinite alternate-reverse;
    animation-play-state: running;
}

/* =========================================
   ANIMATIONS
========================================= */

@keyframes oscillateSheen {
    from {
        --sheen-angle: -12deg;
    }

    to {
        --sheen-angle: 18deg;
    }
}

@keyframes oscillatePrimaryFan {
    from {
        --primary-fan-width: 20deg;
    }

    to {
        --primary-fan-width: 30deg;
    }
}

/* Safe, smooth range that prevents overlap clipping */
@keyframes oscillateSecondaryFan {
    from {
        --secondary-fan-width: 30deg;
    }

    to {
        --secondary-fan-width: 50deg;
    }
}

@keyframes oscillateBrightness {
    from {
        --fan-brightness: 0.75;
    }

    to {
        --fan-brightness: 1.25;
    }
}

@keyframes contrastPulse {
    from {
        opacity: 0.45;
    }

    to {
        opacity: 0.75;
    }
}


/* 4. Media Library & Collection Ledger */
/* ==========================================================================
   MEDIA LIBRARY / LEDGER CATALOGUE — decomposed into feature files (CSS-004).
   Split from a former 4,077-line monolith at verified top-level rule boundaries.
   Import order preserves the original cascade exactly.
   ========================================================================== */

/* ==========================================================================
   DEFAULT LEFT BAY: MEDIA LIBRARY / LEDGER CATALOGUE & TRACK REGISTER
   ========================================================================== */
.console-tracklist-bay {
    --lib-bg: #151418;
    --lib-header-bg: #2a2a2e;
    --lib-card-bg: #2a2a2e;
    --lib-card-hover: #333338;
    --lib-card-active: #333338;
    --lib-artist-color: #f8d092;
    --lib-accent-orange: #ea863a;
    --lib-accent-orange-bg: rgba(234, 134, 58, 0.14);
    --lib-accent-orange-border: rgba(234, 134, 58, 0.4);
    /* --lib-text-primary / -secondary / -muted live in base/variables.css (global). */
    --lib-pill-bg: #23242b;
    --lib-pill-hover: #2b2c34;
    --lib-pill-active-bg: #ebe5dc;
    --lib-pill-active-border: #ebe5dc;
    --lib-pill-active-color: #14151a;
    --lib-row-active-bg: rgba(255, 140, 66, 0.05);
    --lib-search-bg: #1c1b20;
    --lib-search-border: rgba(255, 255, 255, 0.06);

    background: var(--lib-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-left: none;
    grid-column: 1;
    grid-row: 1;
    order: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Above the ambient backdrop/overlay (z-index 1) which are now siblings. */
    z-index: 5;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    container-type: inline-size;
    container-name: tracklist-bay;
}

.tracklist-bay-header {
    padding: 10px 14px 4px 14px;
    border-bottom: none;
    display: flex;
    align-items: center;
    background: #2a2a2e;
    flex-shrink: 0;
    order: 0;
}

/* Full-Width Library Search Bar (Matching Mockup) */
.ledger-library-search-bar {
    display: flex;
    align-items: center;
    background: var(--lib-search-bg);
    border: 1px solid var(--lib-search-border);
    border-radius: var(--radius-full);
    padding: 7px 16px;
    gap: var(--space-4);
    width: 100%;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);

    &:focus-within {
        border-color: rgba(255, 145, 56, 0.5);
        background: #111318;
        box-shadow:
            inset 0 2px 4px rgba(0, 0, 0, 0.4),
            0 0 12px rgba(255, 145, 56, 0.18);
    }
}

.library-search-icon {
    font-size: 0.82rem;
    color: var(--accent-brand-light);
    opacity: 0.85;
    flex-shrink: 0;
}

.library-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    width: 100%;
    min-width: 0;
    line-height: 1.3;

    /* Restore a visible ring for keyboard focus (CSS-001). */
    &:focus-visible {
        outline: 2px solid var(--accent-brand-light);
        outline-offset: 2px;
    }

    &::placeholder {
        color: rgba(169, 181, 199, 0.45);
        font-family: var(--font-mono);
    }
}

.library-search-clear {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-2xs);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
    padding: 0;

    &:hover {
        color: #fff;
        background: rgba(220, 163, 66, 0.5);
    }
}

/* Search Results Category Segment Pills (Matching User Screenshot) */
.library-search-segment-bar {
    display: flex;
    align-items: center;
    background: rgba(14, 18, 26, 0.75);
    border: 1px solid rgba(226, 185, 115, 0.22);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    width: 100%;
    margin-bottom: var(--space-3);
    box-sizing: border-box;
}

.library-search-tab-btn {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;

    &:hover {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.04);
    }

    &.is-active {
        background: rgba(220, 163, 66, 0.16);
        border-color: rgba(220, 163, 66, 0.55);
        color: #f6cf7e;
        box-shadow:
            0 0 10px rgba(220, 163, 66, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }

    .library-search-tab-count {
        background: rgba(220, 163, 66, 0.85);
        color: #0b0e15;
        font-family: var(--font-mono);
        font-size: 0.6rem;
        font-weight: 800;
        padding: 0 5px;
        border-radius: var(--radius-full);
        line-height: 1.35;
        min-width: 14px;
        text-align: center;
    }

    &:not(.is-active) .library-search-tab-count {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-muted);
    }
}

/* Match Highlighting for Search Hits */
.search-matched-track {
    background: rgba(220, 163, 66, 0.14) !important;
    border-left: 3px solid var(--accent-brand) !important;
}

.search-match-badge {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-brand-light);
    background: rgba(220, 163, 66, 0.22);
    border: 1px solid rgba(220, 163, 66, 0.45);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    margin-left: var(--space-2);
    flex-shrink: 0;
}

/* Instant Matches Header Strip */
.library-instant-matches-panel {
    background: transparent;
    padding: 8px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    box-sizing: border-box;

    .library-instant-matches-list {
        display: flex;
        flex-direction: column;
        gap: var(--space-1);
        width: 100%;
    }
}

.library-instant-match-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(220, 163, 66, 0.18);
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
    gap: var(--space-3);

    &:hover {
        background: rgba(220, 163, 66, 0.12);
        border-color: rgba(220, 163, 66, 0.45);
        transform: translateX(2px);
    }

    .library-instant-match-left {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        min-width: 0;
        flex: 1 1 auto;
    }

    .catalog-match-thumb-box {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        border-radius: var(--radius-sm);
        overflow: hidden;
        background: rgba(0, 0, 0, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;

        img.catalog-match-thumb {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
    }

    .library-match-play-icon {
        font-size: 0.7rem;
        color: var(--accent-brand-light);
        width: 14px;
        text-align: center;
        flex-shrink: 0;
    }

    .library-instant-match-title {
        font-size: 0.78rem;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 0;
        max-width: 65%;
    }

    .library-instant-match-meta {
        font-size: var(--fs-xs);
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 2-line layout for song results */
    &.is-track-match {
        padding: 5px 10px;

        .library-match-track-content {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
            flex: 1 1 auto;
        }

        .library-match-track-top {
            display: flex;
            align-items: center;
            gap: var(--space-2);
            min-width: 0;

            .library-instant-match-title {
                max-width: 100%;
                font-size: 0.78rem;
                font-weight: 600;
            }
        }

        .library-match-track-sub {
            display: flex;
            align-items: center;
            gap: var(--space-1);
            font-size: var(--fs-xs);
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;

            .library-match-artist-name {
                color: var(--text-secondary);
                font-weight: 500;
            }

            .library-match-sep {
                color: var(--text-muted);
                opacity: 0.6;
            }

            .library-match-album-name {
                color: var(--text-muted);
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }

    .library-match-duration {
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        color: var(--text-muted);
        margin-right: var(--space-1);
        flex-shrink: 0;
    }

    .btn-search-match-play {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: rgba(220, 163, 66, 0.2);
        border: 1px solid rgba(220, 163, 66, 0.5);
        color: var(--accent-brand-light);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        padding: 0;
        font-size: var(--fs-2xs);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        flex-shrink: 0;

        &:hover {
            background: var(--accent-brand);
            color: #0c0f17;
            border-color: var(--accent-brand);
            transform: scale(1.08);
            box-shadow: 0 0 8px rgba(220, 163, 66, 0.4);
        }
    }

    .btn-search-match-options {
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1px solid transparent;
        color: var(--text-muted);
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-size: 0.7rem;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        flex-shrink: 0;

        &:hover {
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.15);
        }
    }

    .library-match-chevron-hint {
        color: var(--text-muted);
        font-size: 0.7rem;
        padding-right: var(--space-1);
        opacity: 0.6;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        flex-shrink: 0;
    }

    &:hover .library-match-chevron-hint {
        color: var(--accent-brand-light);
        opacity: 1;
        transform: translateX(2px);
    }
}

.library-match-item-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* "All" Tab Overview Styling */
.library-search-all-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: 100%;
}

.library-search-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

.library-search-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.library-search-section-title {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-brand-light);
}

.library-search-see-all-btn {
    background: transparent;
    border: none;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

    &:hover {
        color: var(--accent-brand-light);
        text-decoration: underline;
    }
}

.library-search-section-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    width: 100%;
}

/* Top Result Hero Card */
.library-search-top-card {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(220, 163, 66, 0.14) 0%, rgba(20, 24, 33, 0.6) 100%);
    border: 1px solid rgba(220, 163, 66, 0.35);
    cursor: pointer;
    position: relative;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;

    &:hover {
        background: linear-gradient(135deg, rgba(220, 163, 66, 0.22) 0%, rgba(25, 30, 42, 0.8) 100%);
        border-color: rgba(220, 163, 66, 0.6);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        transform: translateY(-1px);

        .top-result-play {
            opacity: 1;
            transform: scale(1);
        }
    }

    .library-search-top-thumb-box {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        border-radius: var(--radius-sm);
        overflow: hidden;
        background: rgba(0, 0, 0, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);

        img.library-search-top-thumb {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .library-search-top-icon {
            font-size: 1.1rem;
            color: var(--accent-brand-light);
        }
    }

    &.is-artist .library-search-top-thumb-box {
        border-radius: 50%;
    }

    .library-search-top-info {
        display: flex;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .library-search-top-title {
        font-size: 0.92rem;
        font-weight: 700;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .library-search-top-sub {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-size: 0.7rem;
        color: var(--text-muted);
    }

    .library-search-top-type-badge {
        font-family: var(--font-mono);
        font-size: 0.6rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: rgba(220, 163, 66, 0.25);
        color: var(--accent-brand-light);
        padding: 1px 6px;
        border-radius: var(--radius-xs);
        border: 1px solid rgba(220, 163, 66, 0.4);
    }

    .library-search-top-artist {
        color: var(--text-secondary);
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-result-play {
        width: 32px;
        height: 32px;
        font-size: var(--fs-lg);
        border-radius: 50%;
        background: rgba(220, 163, 66, 0.2);
        border: 1.5px solid rgba(220, 163, 66, 0.6);
        color: var(--accent-brand-light);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        cursor: pointer;
        padding: 0;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        flex-shrink: 0;

        &:hover {
            background: var(--accent-brand);
            color: #0c0f17;
            border-color: var(--accent-brand);
            transform: scale(1.08);
            box-shadow: 0 0 12px rgba(220, 163, 66, 0.5);
        }
    }
}

@keyframes trackRowJumpPulse {
    0% {
        background-color: rgba(220, 163, 66, 0.35);
        box-shadow: 0 0 12px rgba(220, 163, 66, 0.4);
    }

    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

.register-track-row.track-just-jumped {
    animation: trackRowJumpPulse 1.5s ease-out;
}

/* Source Segment Switcher: Catalog vs My Library vs Playlists */

.ledger-source-segment {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    padding: 2px 0;
    gap: var(--space-2);
    box-shadow: none;
    width: 100%;
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;

    .ledger-source-btn {
        flex: 1 1 0;
        min-width: 0;
        border: 1.5px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
        background: rgba(220, 163, 66, 0.09);
        color: var(--accent-brand-light);
        font-family: var(--font-mono);
        font-size: var(--fs-sm);
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        white-space: nowrap;
        padding: 6px 12px;
        border-radius: var(--radius-full);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        user-select: none;
        box-sizing: border-box;

        i {
            font-size: 0.76rem;
            color: var(--accent-brand-light);
            opacity: 0.9;
            flex-shrink: 0;
            transition:
                opacity 0.2s ease,
                color 0.2s ease;
        }

        &:hover {
            color: #f0ebe4;
            background: rgba(220, 163, 66, 0.16);

            i {
                color: #f0ebe4;
            }
        }

        &.is-active {
            background: rgba(220, 163, 66, 0.2);
            color: #f4d9a8;
            border: 1.5px solid rgba(220, 163, 66, 0.55);
            box-shadow: 0 0 10px rgba(220, 163, 66, 0.14);

            i {
                opacity: 1;
                color: #f4d9a8;
            }
        }
    }

    .ledger-source-overflow-group {
        flex: 0 0 auto;
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;

        .ledger-source-overflow-btn {
            flex: 0 0 auto;
            /* Invisible touch target: no visible border/background, just the dots. */
            width: 40px;
            height: 40px;
            border: none;
            background: transparent;
            color: #8a8990;
            padding: 0;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: var(--fs-sm);
            box-sizing: border-box;
            transition: color 0.15s ease;
            user-select: none;

            &:hover {
                color: #f0ebe4;
            }

            &.is-open {
                color: #f4d9a8;
            }
        }

        /* The overflow button sits at the far right; anchor the menu to its right edge. */
        .ledger-library-dropdown-menu {
            left: auto;
            right: 0;
        }
    }
}

/* Sub-Header Split Toggle: Scope Search Bars and Scope Controls */
.ledger-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 14px 12px 14px;
    background: #2a2a2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: var(--space-3);
    flex-shrink: 0;
    order: 0;
    position: relative;
    z-index: 40;
    min-width: 0;
}

.ledger-library-controls,
.ledger-playlists-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: var(--space-3);
}

.ledger-playlists-search-row,
.ledger-library-search-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: var(--space-3);
}

.ledger-library-search-row .ledger-scope-search-bar {
    flex: 1 1 auto;
}

/* View Mode Toggle (List vs Grid) */
.ledger-view-toggle-group {
    display: inline-flex;
    align-items: center;
    background: #1c1b20;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    padding: 1px 3px;
    gap: 2px;
    flex-shrink: 0;
    box-sizing: border-box;

    .ledger-view-toggle-btn {
        width: 26px;
        height: 26px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1.5px solid transparent;
        border-radius: var(--radius-full);
        color: #8a8990;
        font-size: 0.74rem;
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        box-sizing: border-box;
        user-select: none;

        svg.ledger-grid-icon-3x3 {
            display: block;
            width: 12px;
            height: 12px;
            flex-shrink: 0;
        }

        &:hover {
            color: #f0ebe4;
            background: rgba(255, 255, 255, 0.05);
        }

        &.is-active {
            background: rgba(212, 154, 106, 0.25);
            color: #f7c49d;
            border-color: #d49a6a;
            box-shadow: 0 0 10px rgba(212, 154, 106, 0.18);
        }
    }
}

/* Grid Density Context Popup (portalled to <body>, so kept as a standalone block) */
.ledger-grid-density-popup {
    min-width: 170px;
    padding: var(--space-2);
    z-index: var(--z-dropdown);

    .playlist-popup-header {
        padding: 4px 8px 6px 8px;
        margin-bottom: var(--space-1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);

        .playlist-popup-header-title {
            font-size: var(--fs-xs);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--lib-text-muted);
        }
    }

    .library-menu-item.is-selected {
        color: #f7c49d;
        background: rgba(212, 154, 106, 0.15);

        i {
            color: #d49a6a;
        }
    }
}

.ledger-playlists-search-bar {
    flex: 1 1 auto;
}

.ledger-scope-search-bar {
    display: flex;
    align-items: center;
    background: #1c1b20;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    padding: 7px 16px;
    gap: var(--space-4);
    width: 100%;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    margin: 0;

    i.fa-magnifying-glass {
        color: #f7c49d;
        font-size: 0.82rem;
        opacity: 0.9;
    }

    &:focus-within {
        border-color: rgba(212, 154, 106, 0.5);
        background: #17161b;
        box-shadow:
            inset 0 2px 4px rgba(0, 0, 0, 0.35),
            0 0 12px rgba(212, 154, 106, 0.15);
    }
}

.ledger-search-stashed-bar {
    display: flex;
    align-items: center;
    background: rgba(212, 154, 106, 0.12);
    border: 1px solid rgba(212, 154, 106, 0.4);
    border-radius: var(--radius-full);
    padding: 3px 6px 3px 14px;
    gap: var(--space-3);
    width: 100%;
    flex: 1 1 auto;
    box-sizing: border-box;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);

    &:hover {
        background: rgba(212, 154, 106, 0.18);
        border-color: rgba(212, 154, 106, 0.6);
    }

    .btn-restore-stashed-search {
        display: inline-flex;
        align-items: center;
        gap: var(--space-3);
        background: transparent;
        border: none;
        color: #d49a6a;
        font-size: var(--fs-xl);
        cursor: pointer;
        flex: 1 1 auto;
        text-align: left;
        padding: 4px 0;
        font-family: inherit;

        i.fa-arrow-left {
            font-size: var(--fs-lg);
            color: #f7c49d;
            transition: transform 0.15s ease;
        }

        &:hover i.fa-arrow-left {
            transform: translateX(-2px);
        }

        .restore-search-label {
            color: rgba(255, 255, 255, 0.7);
            font-size: var(--fs-lg);
        }

        .restore-search-query {
            font-weight: 600;
            color: #fff;
        }
    }

    .btn-dismiss-stashed-search {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: var(--radius-full);
        border: none;
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.6);
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.15s ease;
        flex-shrink: 0;

        &:hover {
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
        }
    }
}

.btn-ledger-new-playlist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(220, 163, 66, 0.25), rgba(245, 207, 126, 0.12));
    border: 1px solid rgba(220, 163, 66, 0.45);
    border-radius: var(--radius-full);
    color: var(--accent-brand-light);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    flex-shrink: 0;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    box-shadow: 0 0 8px rgba(220, 163, 66, 0.15);

    &:hover {
        background: linear-gradient(135deg, rgba(220, 163, 66, 0.4), rgba(245, 207, 126, 0.2));
        border-color: var(--accent-brand);
        color: #fff;
        box-shadow: 0 0 14px rgba(220, 163, 66, 0.35);
    }

    i {
        font-size: var(--fs-2xs);
    }
}

/* Hi-Fi Dropdown Submenu */
.ledger-library-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: max-content;
    min-width: 220px;
    background: #1c1b20;
    border: 1px solid rgba(212, 154, 106, 0.35);
    border-radius: 12px;
    padding: var(--space-2);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.7),
        0 0 16px rgba(0, 0, 0, 0.4);
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    animation: libraryMenuSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);

    &.ledger-playlists-dropdown-menu {
        left: 0;
        right: auto;
    }
}

@keyframes libraryMenuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.library-menu-item.library-menu-toggle {
    white-space: normal;
    line-height: 1.35;
}

.library-menu-item.library-menu-toggle .library-menu-item-text {
    white-space: normal;
}

.library-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #e0dcd5;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-align: left;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.15s ease;
    user-select: none;
    box-sizing: border-box;
    white-space: nowrap;

    i {
        font-size: var(--fs-sm);
        width: 14px;
        text-align: center;
        color: var(--accent-brand-light);
        opacity: 0.85;
    }

    &:hover {
        background: rgba(220, 163, 66, 0.15);
        border-color: rgba(220, 163, 66, 0.3);
        color: var(--text-primary);

        i {
            opacity: 1;
            color: #fff;
        }
    }

    &.is-danger {
        color: #e2b9b9;

        i {
            color: #f87171;
        }

        &:hover {
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.35);
            color: #fca5a5;

            i {
                color: #f87171;
            }
        }
    }
}

.library-menu-divider {
    height: 1px;
    background: rgba(226, 185, 115, 0.15);
    margin: 3px 4px;
}

.ledger-filter-segment {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    padding: 0;
    width: 100%;
    gap: var(--space-2);
}

.ledger-filter-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--lib-text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    white-space: nowrap;

    &:hover {
        color: var(--lib-text-primary);
        background: rgba(255, 255, 255, 0.04);
    }

    &:not(.ledger-filter-btn-split-main).is-active {
        color: var(--lib-text-primary);
        background: var(--lib-pill-bg);
        border: none;
        box-shadow: none;
    }
}

/* Split Filter Pill Group (Playlists "My Lists" Sub-Pills with Chevron Submenus) */
.ledger-filter-split-group {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: stretch;
    justify-content: center;
    position: relative;
    border-radius: var(--radius-full);
    border: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;

    &.is-active,
    &:has(.ledger-filter-btn.is-active) {
        background: var(--lib-pill-bg);
        border: none;
        box-shadow: none;
    }

    &:not(.is-active):not(:has(.ledger-filter-btn.is-active)):hover {
        background: rgba(255, 255, 255, 0.04);
    }
}

.ledger-filter-btn-split-main {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding: 6px 4px 6px 12px;
    justify-content: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.ledger-filter-split-group:has(.ledger-filter-btn.is-active) .ledger-filter-btn-split-main {
    color: var(--lib-text-primary);
}

.ledger-filter-split-group:has(.ledger-filter-btn.is-active) .ledger-filter-btn-split-main i {
    color: var(--lib-text-primary);
}

.ledger-filter-chevron-btn {
    flex: 0 0 32px;
    width: 32px;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0;
    align-self: stretch;
    background: transparent;
    color: var(--lib-text-muted);
    padding: 0 10px;
    border-top-right-radius: var(--radius-full);
    border-bottom-right-radius: var(--radius-full);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-2xs);
    box-sizing: border-box;
    transition:
        color 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease;
    user-select: none;
    z-index: 2;
}

.ledger-filter-chevron-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.ledger-filter-split-group:has(.ledger-filter-btn.is-active) .ledger-filter-chevron-btn {
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--lib-text-primary);
}

.ledger-filter-split-group:has(.ledger-filter-btn.is-active) .ledger-filter-chevron-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ledger-filter-chevron-btn.is-open {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-left-color: rgba(255, 255, 255, 0.16);
}

.ledger-filter-split-group:has(+ :popover-open) .ledger-filter-chevron-btn i,
.ledger-filter-split-group:has(:popover-open) .ledger-filter-chevron-btn i,
.ledger-filter-split-group:has(.ledger-filter-chevron-btn.is-open) .ledger-filter-chevron-btn i,
.ledger-filter-chevron-btn.is-open i {
    transform: rotate(180deg);
}

.ledger-filter-chevron-btn i {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Container Query: When tracklist bay is tighter (e.g. narrow side-panel), tighten padding and font sizes */
@container tracklist-bay (max-width: 380px) {
    .ledger-filter-bar {
        padding: 5px 8px;
    }

    .ledger-filter-btn {
        padding: 4px 5px;
        font-size: 0.58rem;
        gap: var(--space-1);
    }

    .ledger-filter-btn-split-main {
        padding: 4px 2px 4px 5px;
        gap: 3px;
    }

    .ledger-filter-chevron-btn {
        flex: 0 0 15px;
        width: 15px;
        font-size: 0.52rem;
        padding: 0 2px;
    }
}

@container tracklist-bay (max-width: 320px) {
    .ledger-filter-btn {
        padding: 3px 4px;
        font-size: 0.54rem;
        gap: 3px;
    }

    .ledger-filter-btn-split-main {
        padding: 3px 2px 3px 4px;
        gap: 2px;
    }
}

/* Mobile: keep the source-tab pills from overflowing by sizing each pill to its content (no
   equal-width squeeze that spills text outside the pill). The row must NOT use overflow-x:auto
   here — it would clip the absolutely-positioned library overflow dropdown. */
@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    .ledger-source-segment {
        justify-content: flex-start;
    }

    .ledger-source-segment .ledger-source-btn {
        flex: 0 0 auto;
        min-width: auto;
        padding: 6px 10px;
        letter-spacing: 0.02em;
    }
}

.catalogue-album-node {
    margin: 4px 0 8px 0;
    background: var(--lib-card-bg);
    border-radius: 12px;
    border: none;
    scroll-margin-top: calc(var(--ledger-sticky-height) + 12px);
    transition:
        background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;

    &.is-expanded {
        overflow: visible;
        background: var(--lib-card-bg);
    }

    &:hover {
        background: var(--lib-card-hover);
        border: none;
    }

    &.is-active {
        background: var(--lib-card-active);
        border: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .album-node-thumb-wrap {
        position: relative;
        width: 48px;
        height: 48px;
        border-radius: 8px;
        overflow: hidden;
        flex-shrink: 0;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
        border: none;
        background: #090b10;
        transition:
            border-radius 1.05s ease-out,
            box-shadow 1.05s ease,
            border-color 1.05s ease;
        transform-origin: center center;
        will-change: border-radius, transform;

        &::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 8px;
            height: 8px;
            transform: translate(-50%, -50%);
            border-radius: 50%;
            background: #07080b;
            border: 1.5px solid rgba(255, 255, 255, 0.65);
            box-shadow:
                0 0 2px rgba(0, 0, 0, 0.95),
                inset 0 0 2px rgba(0, 0, 0, 0.95);
            opacity: 0;
            transition: opacity 1.05s ease-out;
            pointer-events: none;
            z-index: 3;
        }

        &::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: radial-gradient(
                circle at center,
                transparent 32%,
                rgba(255, 255, 255, 0.09) 52%,
                transparent 72%
            );
            opacity: 0;
            transition: opacity 1.05s ease-out;
            pointer-events: none;
            z-index: 2;
        }
    }

    .album-node-thumb {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border-radius: inherit;
        transition: transform 0.3s ease;
    }

    &:not(.is-playing):hover .album-node-thumb {
        transform: scale(1.06);
    }

    &.is-playing:hover .album-node-thumb-wrap {
        filter: brightness(1.08);
    }

    &.is-45-rpm .album-node-thumb-wrap {
        transition:
            border-radius 0.85s ease-out,
            box-shadow 0.85s ease,
            border-color 0.85s ease;
    }

    &.is-45-rpm .album-node-thumb-wrap::after,
    &.is-45-rpm .album-node-thumb-wrap::before {
        transition: opacity 0.85s ease-out;
    }

    &.is-active.is-playing .album-node-thumb-wrap {
        border-radius: 50%;
        border-color: rgba(212, 147, 56, 0.65);
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.85),
            0 0 12px rgba(212, 147, 56, 0.4);
        transition:
            border-radius 1.05s linear,
            box-shadow 1.05s ease,
            border-color 1.05s ease;
        animation: spinDisc 1.8s linear infinite;
    }

    &.is-active.is-playing.is-45-rpm .album-node-thumb-wrap {
        transition:
            border-radius 0.778s linear,
            box-shadow 0.778s ease,
            border-color 0.778s ease;
        animation: spinDisc 1.3333s linear infinite;
    }

    &.is-active.is-playing .album-node-thumb-wrap::after,
    &.is-active.is-playing .album-node-thumb-wrap::before {
        opacity: 1;
        transition: opacity 1.05s linear;
    }

    &.is-active.is-playing.is-45-rpm .album-node-thumb-wrap::after,
    &.is-active.is-playing.is-45-rpm .album-node-thumb-wrap::before {
        transition: opacity 0.778s linear;
    }

    /* Album Header Row */
    .album-node-header {
        display: flex;
        align-items: center;
        gap: var(--space-5);
        padding: 10px 12px;
        cursor: pointer;
        user-select: none;
        border-radius: 12px;
        transition: background 0.2s ease;
    }

    &.is-expanded .album-node-header {
        position: sticky;
        top: 35px;
        z-index: 8;
        background: var(--lib-card-bg);
        border-bottom: none;
        box-shadow: none;
        border-radius: 12px 12px 0 0;
    }

    &.is-active.is-expanded .album-node-header {
        background: var(--lib-card-active);
        border-bottom: none;
    }

    .album-node-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-1);
    }

    .album-node-title {
        font-size: 0.92rem;
        font-weight: 700;
        color: var(--lib-text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.25;
    }

    &.is-active .album-node-title {
        color: #ffffff;
        text-shadow: none;
    }

    .album-node-meta {
        display: flex;
        align-items: center;
        gap: var(--space-1);
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        color: var(--lib-text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .album-node-year + .album-node-tracks::before,
    .album-node-tracks + .album-node-year::before {
        content: '·';
        opacity: 0.5;
        margin-right: var(--space-1);
    }

    &.is-active .album-node-meta {
        color: var(--lib-text-muted);
    }

    .album-node-tag-turntable {
        display: none;
        align-items: center;
        gap: var(--space-1);
        font-family: var(--font-mono);
        font-size: 0.58rem;
        font-weight: 800;
        color: var(--lib-accent-orange);
        letter-spacing: 0.05em;
    }

    &.is-active .album-node-tag-turntable {
        display: inline-flex;
    }

    &:not(.is-playing) .album-node-tag-turntable .tag-playing-text {
        display: none;
    }

    &.is-playing .album-node-tag-turntable .tag-cued-text {
        display: none;
    }

    /* Expand / Collapse Chevron indicator */
    .album-node-action {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: transparent;
        color: var(--lib-text-muted);
        font-size: 0.7rem;
        flex-shrink: 0;
        cursor: pointer;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.25s ease;

        &:hover {
            background: transparent;
            color: var(--lib-text-primary);
            transform: scale(1.08);
        }
    }

    &.is-expanded .album-node-action {
        background: transparent;
        color: var(--lib-text-primary);
        transform: rotate(180deg);

        &:hover {
            transform: rotate(180deg) scale(1.08);
        }
    }

    /* Accordion Tracks Drawer */
    .album-node-drawer {
        display: grid;
        grid-template-rows: 0fr;
        overflow: hidden;
        transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        background: transparent;
        border-top: none;
        border-radius: 0 0 12px 12px;
    }

    &.is-expanded .album-node-drawer {
        grid-template-rows: 1fr;
        background: transparent;
        border-top: none;
        overflow: visible;
    }

    .ledger-drawer-tracks {
        min-height: 0;
        overflow: hidden;
        padding: 0;
        visibility: hidden;
        transition:
            visibility 0.35s ease,
            padding 0.35s ease;
    }

    &.is-expanded .ledger-drawer-tracks {
        padding: 8px 0 12px 0;
        visibility: visible;
        overflow: visible;
    }
}

#catalogue-feed.is-45-rpm .album-node-thumb-wrap {
    transition:
        border-radius 0.85s ease-out,
        box-shadow 0.85s ease,
        border-color 0.85s ease;
}

#catalogue-feed.is-45-rpm .album-node-thumb-wrap::after,
#catalogue-feed.is-45-rpm .album-node-thumb-wrap::before {
    transition: opacity 0.85s ease-out;
}

#catalogue-feed.is-45-rpm .catalogue-album-node.is-active.is-playing .album-node-thumb-wrap {
    transition:
        border-radius 0.778s linear,
        box-shadow 0.778s ease,
        border-color 0.778s ease;
    animation: spinDisc 1.3333s linear infinite;
}

#catalogue-feed.is-45-rpm .catalogue-album-node.is-active.is-playing .album-node-thumb-wrap::after,
#catalogue-feed.is-45-rpm .catalogue-album-node.is-active.is-playing .album-node-thumb-wrap::before {
    transition: opacity 0.778s linear;
}

/* Skip layout and paint for library cards scrolled out of view. Scoped to cards inside an
   artist group on purpose: PlaylistLedger/queue cards share this class, and the queue's
   open-at-Now-Playing scroll math reads real section heights (content-visibility broke it,
   queue-scroll.spec.js caught it).
   Measured on the 1,000-card library fixture: first render 200ms -> 79ms, with
   contain-intrinsic-size total drift -431px over 1,000 cards (versus -4,331px at 64px and
   +3,473px at 72px). `auto` remembers each card's measured height once rendered, so expanded
   drawers and wrapped titles self-correct. */
.library-artist-node .catalogue-album-node {
    content-visibility: auto;
    contain-intrinsic-size: auto 68px;
}

/* Scrollable Vertical Feed: Albums Grouped by Year */
.console-catalogue-scroll {
    flex: 1;
    order: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 147, 56, 0.3) rgba(255, 255, 255, 0.02);
    padding: 0 0 24px 0;
    scroll-behavior: smooth;

    &::-webkit-scrollbar {
        width: 4px;
    }

    &::-webkit-scrollbar-thumb {
        background: rgba(212, 147, 56, 0.3);
        border-radius: 2px;
    }
}

/* Sticky Year Milestone Divider */
.ledger-year-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    height: 35px;
    box-sizing: border-box;
    padding: 0 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 14, 21, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    .ledger-year-pill {
        font-family: var(--font-mono);
        font-size: var(--fs-2xs);
        font-weight: 800;
        color: var(--accent-brand-light);
        background: rgba(212, 147, 56, 0.12);
        border: 1px solid rgba(212, 147, 56, 0.3);
        padding: 1px 7px;
        border-radius: var(--radius-full);
        letter-spacing: 0.04em;
    }

    .ledger-year-line {
        flex: 1;
        height: 1px;
        background: linear-gradient(90deg, rgba(212, 147, 56, 0.25) 0%, rgba(255, 255, 255, 0.04) 100%);
    }
}

/* Source Badges for Local Master vs Bandcamp Stream */
.album-source-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.album-source-badge-bandcamp {
    background: transparent;
    color: #2da1b8;
    border: 1px solid rgba(45, 161, 184, 0.45);
    text-decoration: none;
    transition: all 0.2s ease;
}

a.album-source-badge-bandcamp:hover {
    background: rgba(45, 161, 184, 0.15);
    color: #4ed3ed;
    border-color: #2da1b8;
    box-shadow: none;
}

.album-source-badge-soundcloud {
    background: transparent;
    color: #ff7728;
    border: 1px solid rgba(255, 119, 40, 0.45);
    text-decoration: none;
    transition: all 0.2s ease;
}

a.album-source-badge-soundcloud:hover {
    background: rgba(255, 119, 40, 0.15);
    color: #ffa366;
    border-color: #ff7728;
    box-shadow: none;
}

.album-source-badge-youtube {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.45);
    text-decoration: none;
    transition: all 0.2s ease;
}

a.album-source-badge-youtube:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: #ef4444;
    box-shadow: none;
}

.album-source-badge-local {
    background: transparent;
    color: var(--lib-text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.album-source-badge-mixed {
    background: transparent;
    color: var(--lib-text-muted);
    border: 1px dashed rgba(255, 255, 255, 0.22);
}

.track-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    border-radius: var(--radius-full);
    font-size: 0.62rem;
    line-height: 1;
    opacity: 0.9;

    &.source-bandcamp {
        color: #2da1b8;
    }

    &.source-soundcloud {
        color: #ff7728;
    }

    &.source-youtube {
        color: #ef4444;
    }
}

.track-source-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 2px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: var(--lib-text-muted);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

    &:hover,
    &.is-open {
        color: var(--accent-brand);
        border-color: rgba(220, 163, 66, 0.45);
        background: rgba(220, 163, 66, 0.12);
    }
}

/* Inline version list: alternates live under their primary row instead of only in a modal. */
.track-row-sources {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 6px 0 2px 28px;
    padding: 6px 8px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.track-row-source,
.track-row-source-manage {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 24px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--lib-text-secondary);
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    line-height: 1.2;
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

    &:hover {
        color: var(--lib-text-primary);
        border-color: rgba(220, 163, 66, 0.4);
        background: rgba(220, 163, 66, 0.1);
    }
}

.track-row-source {
    &.is-selected {
        color: var(--accent-brand-light);
        border-color: rgba(220, 163, 66, 0.55);
        background: rgba(220, 163, 66, 0.16);
    }

    .track-row-source-label {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.track-row-source-tag {
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    color: var(--lib-text-muted);
    font-family: var(--font-mono);
    font-size: 0.52rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.track-row-source-manage {
    color: var(--lib-text-muted);
    border-style: dashed;
}

.register-track-row.track-row-highlighted {
    animation: trackRowJumpPulse 2.4s ease-out;
}

.track-source-item {
    display: flex;
    align-items: center;
    gap: 2px;

    .track-source-select {
        flex: 1;
        min-width: 0;
    }
}

.track-source-remove {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--lib-text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;

    &:hover {
        color: #f87171;
        background: rgba(248, 113, 113, 0.12);
    }
}

/* ==========================================================================
   TRACK ROWS (shared by album drawers, playlists, and the queue)
   ========================================================================== */
.register-track-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    scroll-margin-top: calc(var(--ledger-sticky-height) + 12px);
    padding: 8px 12px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    margin: 0;
    background: #1d1d21;

    &:last-child {
        border-bottom: none;
    }

    &:hover {
        background: #25252a;
    }

    /* Playing Track Row: highlighted in its natural place in the tracklist.
       CSS-010: the queue and the ledger share this one `.is-active` treatment
       (warm amber), so a playing track looks identical in both views. */
    &.is-active {
        background: rgba(220, 163, 66, 0.1);
        padding-left: 9px;
        border-left: 3px solid var(--accent-brand);
        border-bottom: none;
        border-radius: 0;
        box-shadow: none;

        .track-title-text {
            color: var(--accent-brand-light);
            font-weight: 700;
        }
    }

    &.is-active .btn-track-options {
        color: var(--accent-brand);
        opacity: 0.9;
    }

    /* Missing / Unlinked Local Audio File */
    &.is-missing {
        opacity: 0.42;
        filter: grayscale(85%);
        cursor: not-allowed;

        &:hover {
            background: rgba(239, 68, 68, 0.05);
        }

        .register-play-glyph {
            display: none !important;
        }

        .register-num-text {
            opacity: 0.65;
        }

        .register-title-line span:first-of-type {
            text-decoration: line-through;
            text-decoration-color: rgba(239, 68, 68, 0.45);
        }

        .missing-file-tag {
            display: inline-flex;
            align-items: center;
            gap: var(--space-1);
            font-family: var(--font-mono);
            font-size: var(--fs-2xs);
            font-weight: 600;
            color: #f87171;
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.25);
            border-radius: 4px;
            padding: 1px 6px;
            margin-left: var(--space-3);
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }
    }

    .register-num-box {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
    }

    .register-num-text {
        font-family: var(--font-mono);
        font-size: var(--fs-xl);
        font-weight: 500;
        color: #71717a;
        transition: opacity 0.2s ease;
    }

    .register-play-glyph {
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: var(--lib-accent-orange);
        color: #fff;
        display: none;
        align-items: center;
        justify-content: center;
        font-size: var(--fs-sm);
    }

    &:hover .register-num-text {
        display: none;
    }

    &:hover .register-play-glyph {
        display: flex;
    }

    &.is-active .register-num-text {
        display: none;
    }

    &.is-active .register-play-glyph {
        display: flex;
        background: var(--lib-accent-orange);
        color: #101114;
    }

    .register-title-box {
        min-width: 0;
        padding: 0 10px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: var(--space-3);
    }

    .register-title-content {
        min-width: 0;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1px;
    }

    .register-title-line {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-size: 0.94rem;
        font-weight: 600;
        color: #f0ebe4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .register-subtitle-line {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        line-height: 1.15;
    }

    &.is-active .register-title-line {
        color: var(--lib-accent-orange);
        font-weight: 700;
    }
}

/* Multi-Disc / Multi-LP Section Divider Headers: Sticky Level 3 (under album header) */
.register-disc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 24px;
    box-sizing: border-box;
    padding: 0 16px 0 14px;
    position: sticky;
    top: 99px;
    z-index: 7;
    background: rgba(14, 18, 27, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid transparent;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    user-select: none;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.25s ease;

    &:first-child {
        border-top: none;
    }

    .register-disc-title {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-size: 0.62rem;
        font-weight: 700;
        color: #8fa0b5;
        text-transform: uppercase;
        transition: color 0.2s ease;

        i {
            font-size: var(--fs-xs);
            color: #64748b;
            transition: color 0.2s ease;
        }
    }

    .register-disc-count {
        font-size: 0.58rem;
        font-weight: 600;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        background: rgba(255, 255, 255, 0.04);
        padding: 0px 6px;
        line-height: 16px;
        border-radius: var(--radius-full);
        border: 1px solid rgba(255, 255, 255, 0.06);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;
    }

    /* Active Disc Header: Seamlessly highlights and docks with the playing track */
    &.is-active-disc {
        background: linear-gradient(90deg, rgba(22, 28, 42, 0.98) 0%, rgba(14, 18, 27, 0.98) 100%);
        border-left: 3px solid var(--accent-brand-light);
        border-bottom: 1px solid rgba(212, 147, 56, 0.25);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);

        .register-disc-title {
            color: #ffffff;

            i {
                color: var(--accent-brand-light);
            }
        }

        .register-disc-count {
            color: var(--accent-brand-light);
            background: rgba(212, 147, 56, 0.12);
            border-color: rgba(212, 147, 56, 0.3);
        }
    }
}

.tracks-drawer-loading {
    padding: var(--space-6);
    text-align: center;
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

/* ==========================================================================
   LOCAL AUDIO LIBRARY (MY LIBRARY) EMPTY STATE & STYLING
   ========================================================================== */

/* Artist hierarchy accordion & sub-menu (decomposed to a subcomponent).
   Imported at the top so the @import precedes all rules (valid CSS position);
   the build inliner concatenates it in place regardless. Selectors are disjoint
   from the empty-state rules below, so order does not affect the cascade. */
/* ==========================================================================
   LIBRARY ARTIST HIERARCHY ACCORDION & SUB-MENU (NESTED CSS)
   ========================================================================== */

.library-artist-node {
    margin: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0;
    position: relative;
    transition:
        background-color 0.22s ease,
        border-color 0.22s ease,
        margin 0.22s ease,
        box-shadow 0.22s ease;

    &:not(.is-expanded) {
        border-bottom: 1px dotted rgba(255, 255, 255, 0.07);

        &:hover {
            border-bottom-color: transparent;
        }
    }

    /* When followed by an expanded or hovered node, hide the divider line */
    &:has(+ .library-artist-node.is-expanded),
    &:has(+ .library-artist-node:hover) {
        border-bottom-color: transparent;
    }

    &:hover {
        background: transparent;
    }

    &.is-active-artist {
        box-shadow: none;
    }

    /* Collapsed state header hover */
    &:not(.is-expanded) .library-artist-header {
        border-bottom: none;
        border-radius: 8px;
        background: transparent;

        &:hover {
            background: rgba(255, 255, 255, 0.043);
            opacity: 1;

            .library-artist-name {
                color: #ea863a;
            }

            .library-artist-action {
                opacity: 1;
                color: #ea863a;
            }
        }
    }

    /* Expanded state container, header, subbar & drawer */
    &.is-expanded {
        background: #1f1e22;
        border: 1px solid rgba(255, 255, 255, 0.04);
        border-radius: 8px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
        margin: 0 10px 14px 10px;

        .library-artist-header {
            background: #1f1e22;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            padding: 8px 14px;
        }

        .library-artist-action {
            transform: rotate(180deg);
            opacity: 1;
        }

        .library-artist-subbar {
            display: block;
            background: #1f1e22;
            padding: 4px 14px 10px 14px;
        }

        .library-artist-body {
            display: block;
            animation: fadeInDrawer 0.25s ease-out forwards;
        }
    }
}

/* Sticky Artist Header */
.library-artist-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 8px 14px;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border-radius: 8px;
    border-bottom: none;
    box-shadow: none;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        opacity 0.18s ease,
        border-radius 0.18s ease;
    height: 42px;
    box-sizing: border-box;

    &:hover {
        .library-artist-name {
            color: #ea863a;
        }

        .library-artist-action {
            color: #ea863a;
        }

        .library-artist-header-controls .btn-artist-options {
            opacity: 0.8;
        }
    }
}

/* Library-search "jump to artist" landing burst: pulse the sticky group header so the eye
   lands on the revealed artist. Reuses the ledger row pulse keyframes. */
.library-artist-header.track-just-jumped {
    animation: trackRowJumpPulse 1.5s ease-out;
}

.library-artist-name-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
    flex: 1;
}

.library-artist-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--lib-artist-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    transition: color 0.18s ease;
}

.library-artist-now-playing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--lib-accent-orange-bg);
    border: 1px solid var(--lib-accent-orange-border);
    color: var(--lib-accent-orange);
    padding: 2.5px 9px;
    border-radius: var(--radius-full);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    animation: none;

    &::after {
        content: '•';
        margin-left: 3px;
        font-size: var(--fs-md);
        line-height: 1;
        opacity: 0.9;
    }
}

.library-artist-header-controls .btn-artist-options {
    opacity: 0.35;
    color: rgba(255, 255, 255, 0.4);
}

.library-artist-action {
    color: var(--lib-artist-color);
    opacity: 0.9;
    font-size: var(--fs-xl);
    transition:
        transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.2s ease,
        color 0.18s ease;
    padding: 2px 4px;
}

/* Secondary sticky filter sub-bar directly below the artist header */
.library-artist-subbar {
    display: none;
    position: sticky;
    top: 42px;
    z-index: 14;
    background: transparent;
    border-bottom: none;
    padding: 4px 14px 8px 14px;
    box-shadow: none;
    height: 42px;
    box-sizing: border-box;
}

.library-artist-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

.library-artist-menu-btn {
    background: #23242b;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #9ca3af;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 5px 13px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;

    &:hover {
        background: #2b2c34;
        color: #f3ede5;
        border-color: rgba(255, 255, 255, 0.1);
    }

    &.is-active {
        background: #ebe5dc;
        border: 1px solid #ebe5dc;
        color: #14151a;
        box-shadow: none;

        .library-artist-tab-count {
            background: transparent;
            color: #14151a;
        }
    }
}

.library-artist-tab-count {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: var(--fs-xs);
    font-weight: 700;

    &::before {
        content: '(';
    }

    &::after {
        content: ')';
    }
}

.library-artist-body {
    display: none;
    padding: 4px 6px 0px 6px;
    background: transparent;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.library-artist-releases {
    display: flex;
    flex-direction: column;
    gap: 2px;
}


.library-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    gap: var(--space-6);
    margin: 20px 16px;
    border: 2px dashed rgba(220, 163, 66, 0.25);
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at 50% 30%, rgba(220, 163, 66, 0.05) 0%, rgba(7, 9, 14, 0.6) 100%);
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.3s ease;

    &:hover {
        border-color: rgba(220, 163, 66, 0.5);
        background: radial-gradient(circle at 50% 30%, rgba(220, 163, 66, 0.1) 0%, rgba(7, 9, 14, 0.7) 100%);
    }

    .library-empty-icon {
        width: 68px;
        height: 68px;
        border-radius: 50%;
        background: rgba(220, 163, 66, 0.12);
        border: 1px solid rgba(220, 163, 66, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--accent-brand-light);
        font-size: 1.8rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }

    .library-empty-title {
        font-family: var(--font-display);
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
    }

    .library-empty-desc {
        font-family: var(--font-body);
        font-size: var(--fs-xl);
        color: var(--text-secondary);
        max-width: 340px;
        line-height: 1.5;
        margin: 0;
    }
}

.badge-explicit {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
}

.register-time-box {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--lib-text-muted);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-4);
}

.register-track-row.is-active .register-time-box {
    color: var(--lib-accent-orange);
}

/* Soundwave equalizer indicator inside track row */
.register-soundwave {
    display: none;
    align-items: flex-end;
    gap: 2.5px;
    height: 13px;

    .sw-bar {
        width: 2.5px;
        height: 100%;
        background: var(--lib-accent-orange);
        border-radius: 1px;
        animation: waveDance 1.2s ease-in-out infinite alternate;

        &:nth-child(1) {
            animation-delay: 0.1s;
            height: 35%;
        }

        &:nth-child(2) {
            animation-delay: 0.3s;
            height: 90%;
        }

        &:nth-child(3) {
            animation-delay: 0.5s;
            height: 60%;
        }
    }
}

.register-track-row.is-active .register-soundwave {
    display: flex;
}

@keyframes waveDance {
    0% {
        transform: scaleY(0.2);
    }

    100% {
        transform: scaleY(1);
    }
}

/* ==========================================================================
   Dual-View: Grid Layout for Library Album Sleeves & Playlists
   ========================================================================== */
.catalogue-feed-inner.is-grid-layout {
    .library-artist-releases,
    .ledger-playlists-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-5);
        padding: 2px 0;
    }

    &.grid-cols-2 .library-artist-releases,
    &.grid-cols-2 .ledger-playlists-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    &.grid-cols-3 .library-artist-releases,
    &.grid-cols-3 .ledger-playlists-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    &.grid-cols-4 .library-artist-releases,
    &.grid-cols-4 .ledger-playlists-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .catalogue-album-node {
        margin: 0;
        display: flex;
        flex-direction: column;
        background: var(--lib-card-bg);
        border-radius: var(--radius-md, 8px);
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.04);
        transition:
            transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
            box-shadow 0.2s ease,
            border-color 0.2s ease;

        &:hover {
            transform: translateY(-2px);
            border-color: rgba(255, 145, 56, 0.3);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        }

        &.is-active {
            border-color: var(--lib-accent-orange);
            box-shadow: 0 0 16px rgba(255, 145, 56, 0.25);
        }

        &.is-expanded {
            grid-column: 1 / -1;
            content-visibility: visible;
            overflow: visible;
            transform: none !important;
            border: none;
            border-radius: 12px;
            box-shadow: none;
        }

        &.is-active.is-expanded,
        &.is-expanded:hover {
            border: none;
            transform: none !important;
            box-shadow: none;
        }

        &.is-expanded .album-node-header {
            flex-direction: row;
            align-items: center;
            gap: var(--space-5);
            padding: 10px 12px;
            position: sticky;
            top: 0;
            z-index: 12;
            background: var(--lib-card-bg);
            border-radius: 12px 12px 0 0;
            box-shadow: none;
            border-bottom: none;
        }

        &.is-active.is-expanded .album-node-header {
            background: var(--lib-card-active);
        }

        &.is-expanded .album-node-thumb-wrap {
            width: 48px;
            height: 48px;
            aspect-ratio: auto;
            border-radius: 8px;
        }

        &.is-expanded .album-node-info {
            flex: 1;
            min-width: 0;
            gap: var(--space-1);
        }

        &.is-expanded .album-node-title {
            font-size: 0.92rem;
            line-height: 1.25;
        }

        &.is-expanded .album-node-meta {
            font-size: var(--fs-xs);
            flex-wrap: nowrap;
            white-space: nowrap;
        }

        &.is-expanded .album-node-meta .album-source-badge {
            margin-top: 0;
            font-size: 0.6rem;
            padding: 2px 7px;
        }

        &.is-expanded .album-node-header-controls {
            display: flex;
        }
    }

    .album-node-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-3);
        gap: var(--space-3);
        border-radius: 0;
    }

    .album-node-thumb-wrap {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        border-radius: var(--radius-sm, 6px);
        transition:
            border-radius 1.05s ease-out,
            box-shadow 1.05s ease,
            border-color 1.05s ease;
    }

    .catalogue-album-node.is-active.is-playing .album-node-thumb-wrap {
        border-radius: 50%;
        transition:
            border-radius 1.05s linear,
            box-shadow 1.05s ease,
            border-color 1.05s ease;
    }

    .catalogue-album-node.is-active.is-playing.is-45-rpm .album-node-thumb-wrap {
        border-radius: 50%;
        transition:
            border-radius 0.778s linear,
            box-shadow 0.778s ease,
            border-color 0.778s ease;
    }

    .album-node-info {
        width: 100%;
        gap: 2px;
    }

    .album-node-title {
        font-size: 0.78rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .album-node-meta {
        font-size: 0.62rem;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: var(--space-1);
        row-gap: var(--space-1);
        white-space: nowrap;
    }

    .album-node-meta .album-source-badge {
        width: fit-content;
        max-width: 100%;
        margin-top: 2px;
        font-size: 0.54rem;
        padding: 1px 6px;
        box-sizing: border-box;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-flex;
        align-self: flex-start;
    }

    .album-node-header-controls {
        display: none;
    }
}

/* In Library mode, anchor expanded album headers below the Artist Header (42px) + Sub-bar (42px) = 84px */
.catalogue-feed-inner.is-grid-layout .library-artist-releases .catalogue-album-node.is-expanded .album-node-header,
.library-artist-releases .catalogue-album-node.is-expanded .album-node-header {
    top: 84px;
    z-index: 12;
}

.catalogue-feed-inner.is-grid-layout .library-artist-releases .register-disc-header,
.library-artist-releases .register-disc-header {
    top: 136px;
    /* 84px + 52px album header */
    z-index: 10;
}

/* Thumbnail for live library instant-match results */
.catalog-match-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Add-to-Playlist Action Button & Popover Menu
   ========================================================================== */


/* Popover menu */
/* CSS-02 (B.3): dropdown menus position via JS anchor-rect coordinates exposed as custom
   properties (the fallback). Browsers with CSS Anchor Positioning switch to native anchoring,
   eliminating per-frame coordinate math; non-supporting browsers keep the exact current position. */
.vrp-library-options-popup,
.vrp-track-options-popup,
.ledger-grid-density-popup {
    left: var(--vrp-menu-left, 0px);
    top: var(--vrp-menu-top, 0px);
    margin: 0;
}

@supports (anchor-name: --vrp-menu-anchor) {
    .vrp-library-options-popup,
    .vrp-track-options-popup,
    .ledger-grid-density-popup {
        position-anchor: --vrp-menu-anchor;
        position-try-fallbacks: flip-block;
        left: auto;
        right: anchor(right, 10px);
        top: anchor(bottom, var(--vrp-menu-top, 0px));
        bottom: auto;
        margin: 0;
    }
}

.add-to-playlist-popup {
    position: fixed;
    z-index: var(--z-popover);
    width: 230px;
    background: rgba(14, 18, 26, 0.96);
    border: 1px solid rgba(226, 185, 115, 0.35);
    border-radius: var(--radius-md, 8px);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.8),
        0 0 12px rgba(220, 163, 66, 0.15);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: playlistPopupIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);

    .playlist-popup-header {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 10px 12px 8px;
        background: rgba(255, 255, 255, 0.02);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .playlist-popup-header-title {
        font-family: var(--font-mono);
        font-size: 0.62rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--accent-brand-light);
    }

    .playlist-popup-track-name {
        font-size: 0.74rem;
        font-weight: 600;
        color: #e5ebf5;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .playlist-popup-body {
        display: flex;
        flex-direction: column;
        max-height: 180px;
        overflow-y: auto;
        padding: var(--space-1);
        scrollbar-width: thin;
        scrollbar-color: rgba(212, 147, 56, 0.3) rgba(255, 255, 255, 0.02);

        &::-webkit-scrollbar {
            width: 4px;
        }

        &::-webkit-scrollbar-thumb {
            background: rgba(212, 147, 56, 0.3);
            border-radius: 2px;
        }
    }

    .playlist-popup-item {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: 7px 10px;
        border-radius: var(--radius-sm, 6px);
        border: none;
        background: transparent;
        color: #cad5e2;
        font-size: var(--fs-md);
        font-family: var(--font-body);
        font-weight: 500;
        cursor: pointer;
        text-align: left;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        width: 100%;

        &:hover {
            background: rgba(220, 163, 66, 0.15);
            color: #fff;
        }

        i {
            font-size: 0.7rem;
            color: var(--accent-brand-light);
            flex-shrink: 0;
        }

        &.is-in-playlist {
            color: #10b981;

            i {
                color: #10b981;
            }
        }
    }

    .playlist-popup-name {
        flex: 1 1 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .playlist-popup-count {
        font-family: var(--font-mono);
        font-size: 0.62rem;
        color: var(--text-muted);
        background: rgba(255, 255, 255, 0.05);
        padding: 1px 5px;
        border-radius: var(--radius-full);
    }

    .playlist-popup-empty {
        padding: 14px 10px;
        text-align: center;
        font-size: var(--fs-sm);
        color: var(--text-muted);
        font-style: italic;
    }

    .playlist-popup-footer {
        padding: var(--space-2);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(0, 0, 0, 0.2);
    }

    .playlist-popup-create-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        padding: 6px 10px;
        border-radius: var(--radius-sm, 6px);
        border: 1px dashed rgba(220, 163, 66, 0.4);
        background: rgba(220, 163, 66, 0.08);
        color: var(--accent-brand-light);
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        font-weight: 700;
        cursor: pointer;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.18s ease;

        &:hover {
            background: rgba(220, 163, 66, 0.22);
            border-color: var(--accent-brand);
            color: #fff;
        }
    }
}

@keyframes playlistPopupIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Playlist Node Options Action Control */
.btn-playlist-options {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;
    padding: 0;
    opacity: 0.65;

    &:hover {
        background: rgba(220, 163, 66, 0.16);
        color: var(--accent-brand-light);
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Playlist Node In Ledger */
.catalogue-feed-inner:not(.is-grid-layout) .ledger-playlists-grid .catalogue-album-node {
    margin: 4px 0 8px 0;

    &.is-expanded .album-node-header {
        position: relative;
        top: 0;
        z-index: 2;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin-bottom: 0;
    }
}

.ledger-playlists-grid {
    .album-node-drawer {
        position: relative;
        z-index: 1;
        overflow: visible;
    }

    .catalogue-album-node.is-expanded .ledger-drawer-tracks {
        padding: 12px 0 14px 0;
        position: relative;
        z-index: 1;
    }
}

/* Playlist Drag & Drop Track Reordering */
.playlist-track-row {
    cursor: pointer;
    user-select: none;
    transition:
        background 0.18s ease,
        transform 0.22s cubic-bezier(0.2, 0, 0, 1),
        opacity 0.18s ease;
    position: relative;

    &.is-dragging {
        opacity: 0.35;
        background: rgba(220, 163, 66, 0.08) !important;
        pointer-events: none;
    }

    /* Smooth visual displacement creating an interactive drop slot */
    &.drag-shift-down {
        transform: translateY(100%);
    }

    &.drag-shift-up {
        transform: translateY(-100%);
    }

    /* Luminous gold slot guideline where the gap opens */
    &.drag-slot-target-top::before {
        content: '';
        position: absolute;
        top: -2px;
        left: 8px;
        right: 8px;
        height: 3px;
        background: linear-gradient(
            90deg,
            rgba(220, 163, 66, 0) 0%,
            var(--accent-brand-light) 15%,
            var(--accent-brand-light) 85%,
            rgba(220, 163, 66, 0) 100%
        );
        box-shadow: 0 0 10px 2px var(--accent-glow);
        border-radius: 2px;
        pointer-events: none;
        z-index: 20;
    }

    &.drag-slot-target-bottom::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 8px;
        right: 8px;
        height: 3px;
        background: linear-gradient(
            90deg,
            rgba(220, 163, 66, 0) 0%,
            var(--accent-brand-light) 15%,
            var(--accent-brand-light) 85%,
            rgba(220, 163, 66, 0) 100%
        );
        box-shadow: 0 0 10px 2px var(--accent-glow);
        border-radius: 2px;
        pointer-events: none;
        z-index: 20;
    }

    .btn-track-options,
    .register-play-glyph,
    .playlist-drag-handle {
        pointer-events: auto;
    }
}

.playlist-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    opacity: 0;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    cursor: grab;
    flex-shrink: 0;
    transition:
        opacity 0.15s ease,
        color 0.15s ease;

    &:active {
        cursor: grabbing;
    }

    .register-track-row:hover & {
        opacity: 0.7;
    }

    .register-track-row.is-active & {
        opacity: 0.45;
    }

    .register-track-row.is-active:hover & {
        opacity: 0.85;
    }

    &:hover {
        color: var(--accent-brand-light);
        opacity: 1 !important;
    }
}

.playlist-track-artist {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;

    /* Inline credit (e.g. collaborative albums) keeps left spacing */
    .register-title-line & {
        margin-left: var(--space-3);
    }

    /* Dedicated subtitle line fits tight and truncates smoothly */
    .register-subtitle-line & {
        margin-left: 0;
        font-size: var(--fs-sm);
        color: var(--lib-text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .register-track-row.is-active & {
        color: var(--text-secondary);
    }
}

/* =========================================================================
   LIBRARY REMOVAL & SMART PLAYLIST CONFIRMATION MODAL (DESIGN.md TOKENS)
   ========================================================================= */

/* Album Track Reordering */
.album-reorder-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 6px 10px;
    margin: 4px 6px 8px 6px;
    border-radius: 6px;
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
    background: rgba(220, 163, 66, 0.08);
    border: 1px solid rgba(220, 163, 66, 0.28);

    .album-reorder-label {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        color: var(--accent-brand-light);
        font-weight: 600;
    }

    .btn-album-reorder-done {
        border: 1px solid rgba(255, 255, 255, 0.12);
        padding: 3px 9px;
        border-radius: 4px;
        font-size: var(--fs-xs);
        font-family: var(--font-mono);
        font-weight: 600;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
        background: rgba(220, 163, 66, 0.16);
        border-color: var(--accent-brand);
        color: var(--accent-brand-light);

        &:hover {
            background: var(--accent-brand);
            color: #0b0c10;
        }
    }
}

/* Shared rename-form anatomy (track, album, artist, playlist, import modals) */
.rename-track-modal-box {
    max-width: 440px;

    .rename-track-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }

    .rename-track-current {
        color: var(--lib-text-primary);
        font-weight: 600;
    }
}

/* Form primitives shared by the rename modals and the move-track "new album" form */
.rename-track-label {
    color: var(--lib-text-secondary);
    font-size: var(--fs-lg);
    line-height: 1.5;
}

.rename-track-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(220, 163, 66, 0.55);
    background: rgba(0, 0, 0, 0.35);
    color: var(--lib-text-primary);
    font: inherit;
    font-size: 0.9rem;
    outline: none;

    /* Restore a visible ring for keyboard focus (CSS-001). */
    &:focus-visible {
        outline: 2px solid var(--accent-brand-light);
        outline-offset: 2px;
    }

    &:focus {
        border-color: var(--accent-brand-light);
        box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.18);
    }
}

.rename-track-hint,
.rename-artist-audit-note {
    margin: 0;
    color: var(--lib-text-muted);
    font-size: 0.7rem;
    font-family: var(--font-mono);
}

/* Link/Import stream modal helpers (CSS-015: were inline styles). */
.rename-track-hint--source {
    margin: 0 0 8px;
    color: var(--text-secondary);
}

.rename-track-hint--error {
    color: #f87171;
}

.link-source-input-row {
    position: relative;
    display: flex;
    align-items: center;
}

.link-source-provider {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-xl);
    color: var(--text-muted);
}

.link-source-provider--bandcamp {
    color: #1da0c3;
}

.link-source-provider--soundcloud {
    color: #ff5500;
}

.link-source-provider--youtube {
    color: #ff0000;
}

.btn-album-artwork-test--upload {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: 7px 14px;
}

.rename-artist-audit-note code {
    font-size: inherit;
}

/* Move Track Modal */
.move-track-modal-box {
    width: 90%;
    max-width: 520px !important;

    .move-track-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
        min-height: 0;
    }

    .move-track-new-form {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        padding: var(--space-4);
        border: 1px solid rgba(220, 163, 66, 0.35);
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.25);

        .move-track-new-type {
            width: 100%;
            padding: 8px 10px;
            border-radius: 6px;
            border: 1px solid rgba(220, 163, 66, 0.55);
            background: rgba(0, 0, 0, 0.35);
            color: var(--lib-text-primary);
            font: inherit;
            font-size: 0.9rem;

            /* Restore a visible ring for keyboard focus (CSS-001). */
            &:focus-visible {
                outline: 2px solid var(--accent-brand-light);
                outline-offset: 2px;
            }

            &:focus {
                outline: none;
                border-color: var(--accent-brand-light);
                box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.18);
            }
        }
    }

    .btn-move-track-confirm:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }
}

/* Shared track-picker anatomy (move track + rename artist) */
.move-track-search {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(220, 163, 66, 0.55);
    background: rgba(0, 0, 0, 0.35);
    color: var(--lib-text-primary);
    font: inherit;
    font-size: 0.9rem;

    /* Restore a visible ring for keyboard focus (CSS-001). */
    &:focus-visible {
        outline: 2px solid var(--accent-brand-light);
        outline-offset: 2px;
    }

    &:focus {
        outline: none;
        border-color: var(--accent-brand-light);
        box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.18);
    }
}

.move-track-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-height: 300px;
    overflow-y: auto;
    padding: 2px;
}

/* Rename / Merge artist picker: provenance groups, alphabetical inside each. */
.rename-artist-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);

    & + & {
        margin-top: var(--space-3);
        padding-top: var(--space-4);
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .rename-artist-group-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 2px 4px;
        color: var(--lib-text-muted);
        font-family: var(--font-mono);
        font-size: 0.66rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;

        span {
            opacity: 0.7;
        }
    }
}

.rename-artist-track-only-toggle {
    position: relative;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: 2px;
    padding: 2px 4px;
    color: var(--lib-text-secondary);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    line-height: 1.4;
    cursor: pointer;
    user-select: none;

    &:hover {
        color: var(--lib-text-primary);
    }
}

/* The real checkbox covers the label (so it stays clickable and focusable); the visible
   switch is drawn by a sibling span because pseudo-elements do not render on <input>. */
.rename-artist-track-only-check {
    position: absolute;
    inset: 0;
    z-index: 1;
    margin: 0;
    opacity: 0;
    cursor: pointer;

    &:checked + .rename-artist-track-only-switch {
        border-color: var(--accent-brand-light);
        background: rgba(220, 163, 66, 0.3);
        box-shadow: none;
    }

    &:checked + .rename-artist-track-only-switch::after {
        transform: translateX(12px);
        background: var(--accent-brand-light);
    }

    &:focus-visible + .rename-artist-track-only-switch {
        outline: none;
        box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.28);
    }

    &:focus-visible {
        outline: none;
        box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.28);
    }
}

.rename-artist-track-only-switch {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
    transition:
        background 120ms ease,
        border-color 120ms ease,
        box-shadow 120ms ease;

    &::after {
        content: '';
        position: absolute;
        top: 1px;
        left: 1px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--lib-text-secondary);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
        transition:
            transform 120ms ease,
            background 120ms ease;
    }
}

.move-track-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    color: var(--lib-text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;

    &:hover {
        background: rgba(220, 163, 66, 0.1);
    }

    &.is-selected {
        border-color: var(--accent-brand);
        background: rgba(220, 163, 66, 0.16);
    }

    .move-track-option-title {
        font-size: var(--fs-xl);
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .move-track-option-meta {
        color: var(--lib-text-secondary);
        font-size: var(--fs-sm);
    }
}

/* Single-class modifier on purpose: `.is-selected` (0,2,0) must keep winning. */
.move-track-new {
    border-color: rgba(220, 163, 66, 0.35);
    background: rgba(220, 163, 66, 0.08);
}

.move-track-new .move-track-option-title i {
    margin-right: var(--space-2);
}

.move-track-empty {
    margin: 0;
    padding: 16px 8px;
    color: var(--lib-text-muted);
    font-size: var(--fs-lg);
    text-align: center;
}

/* Duplicate Suggestions Modal */
.duplicates-modal-box {
    width: 90%;
    max-width: 620px !important;

    .duplicates-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-5);
    }

    .duplicates-list {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
        max-height: 380px;
        overflow-y: auto;
    }

    .duplicates-empty {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-6);
        border: 1px dashed rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        color: var(--lib-text-secondary);
        font-size: var(--fs-xl);

        i {
            color: var(--accent-brand);
        }
    }

    .duplicates-note {
        margin: 0;
        color: var(--lib-text-muted);
        font-size: var(--fs-sm);
    }
}

.duplicates-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;

    .duplicates-group-header {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: 8px 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(255, 255, 255, 0.02);
    }

    .duplicates-confidence {
        padding: 2px 6px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.06);
        color: var(--lib-text-secondary);
        font-size: var(--fs-xs);
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;

        &.is-high {
            background: var(--accent-brand);
            color: #0b0c10;
        }
    }

    .duplicates-group-reason {
        color: var(--lib-text-muted);
        font-size: var(--fs-sm);
    }
}

.duplicates-track-list {
    display: flex;
    flex-direction: column;

    .duplicates-track {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
        gap: var(--space-3);
        align-items: baseline;
        padding: 7px 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.04);
        font-size: var(--fs-lg);

        &:first-child {
            border-top: none;
        }

        .duplicates-track-album {
            color: var(--lib-text-secondary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .duplicates-track-title {
            color: var(--lib-text-primary);
        }

        .duplicates-track-meta {
            color: var(--lib-text-muted);
            font-size: var(--fs-sm);
            white-space: nowrap;
        }
    }
}

/* Two-column Clean Titles Modal */
.clean-titles-modal-box {
    width: 90%;
    max-width: 640px !important;

    .clean-titles-table-header {
        display: flex;
        align-items: center;
        padding: 6px 10px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 6px 6px 0 0;
        font-family: var(--font-mono);
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--text-muted);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .clean-titles-list {
        max-height: 320px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-top: none;
        border-radius: 0 0 6px 6px;
        background: rgba(0, 0, 0, 0.2);
    }

    .clean-titles-row {
        display: flex;
        align-items: center;
        padding: 7px 10px;
        font-size: 0.76rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);

        &:last-child {
            border-bottom: none;
        }

        &.has-change {
            background: rgba(220, 163, 66, 0.04);
        }

        &.no-change .clean-titles-col-before {
            text-decoration: none;
            opacity: 0.6;
        }
    }

    .clean-titles-col-num {
        width: 28px;
        font-family: var(--font-mono);
        font-size: 0.7rem;
        color: var(--text-muted);
    }

    .clean-titles-col-before {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--text-muted);
        text-decoration: line-through;
        opacity: 0.85;
    }

    .clean-titles-arrow {
        width: 24px;
        text-align: center;
        font-size: var(--fs-xs);
    }

    .clean-titles-col-after {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--text-primary);
        font-weight: 500;

        &.is-changed {
            color: var(--accent-brand-light);
            font-weight: 600;
        }
    }
}

/* Track / album / artist option affordances */
.btn-track-options,
.btn-album-options,
.btn-artist-options {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--lib-text-muted);
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;
    padding: 0;
    opacity: 0.45;
    flex-shrink: 0;

    &:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--lib-text-primary);
        opacity: 1 !important;
        transform: scale(1.08);
    }
}

.register-track-row:hover .btn-track-options {
    opacity: 0.85;
}

/* Shared dialog shell (backdrop + box) */
.library-delete-modal-backdrop {
    /* The dark overlay is painted by the native <dialog>::backdrop in the top layer. This
       wrapper only anchors each modal's stable id and gives the (top-layer) dialog a positioned
       context; it stays a real viewport-sized box so visibility checks and descendant queries in
       the E2E suite keep resolving against it. */
    position: fixed;
    inset: 0;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOutModal {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.library-delete-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight, rgba(240, 205, 145, 0.35));
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    color: var(--text-primary);
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.8),
        0 0 24px rgba(220, 163, 66, 0.15);
    overflow: hidden;

    /* Native <dialog> is display:none while closed; only lay it out (and animate in) when open. */
    &[open] {
        display: flex;
        flex-direction: column;
        animation: scaleInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    &.is-closing {
        animation: fadeOutModal 0.18s ease forwards;
    }

    &::backdrop {
        background: rgba(4, 6, 10, 0.78);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        animation: fadeInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    &.is-closing::backdrop {
        animation: fadeOutModal 0.18s ease forwards;
    }

    .library-delete-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px;
        border-bottom: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
        background: rgba(14, 18, 26, 0.95);
    }

    .library-delete-modal-title {
        display: flex;
        align-items: center;
        gap: var(--space-4);
        font-family: var(--font-display);
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    .library-delete-modal-close {
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 0.9rem;
        cursor: pointer;
        padding: var(--space-1);
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition:
            color 0.15s ease,
            background 0.15s ease;

        &:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.08);
        }
    }

    .library-delete-modal-body {
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .library-delete-modal-subtitle {
        margin: 0;
        font-family: var(--font-body);
        font-size: 0.86rem;
        line-height: 1.45;
        color: var(--text-secondary);
    }

    .library-delete-modal-warning {
        background: rgba(245, 158, 11, 0.08);
        border: 1px solid rgba(245, 158, 11, 0.3);
        border-radius: 8px;
        padding: var(--space-5);
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }

    .library-delete-modal-notice {
        display: flex;
        align-items: flex-start;
        gap: var(--space-3);
        font-size: var(--fs-sm);
        color: var(--text-muted);
        font-family: var(--font-body);
        line-height: 1.35;
        padding: 8px 10px;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 6px;

        i {
            color: var(--accent-emerald);
            margin-top: 2px;
        }
    }
}

@keyframes scaleInModal {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.library-delete-warning-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.library-delete-playlist-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 120px;
    overflow-y: auto;

    li {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(0, 0, 0, 0.3);
        padding: 6px 10px;
        border-radius: 6px;
        font-size: 0.76rem;
        font-family: var(--font-mono);
    }

    .pl-name {
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: var(--space-2);

        i {
            color: var(--accent-brand-light);
            font-size: 0.7rem;
        }
    }

    .pl-count {
        color: var(--accent-amber);
        font-weight: 600;
    }
}

.library-delete-warning-note {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-family: var(--font-body);
}

/* Cancel is shared by dialog headers (artwork close) and footers, so it stays top-level. */
.btn-delete-modal-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

    &:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.25);
    }
}

.library-delete-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    background: rgba(14, 18, 26, 0.95);
    flex-wrap: wrap;

    .btn-album-edit-done {
        background: rgba(220, 163, 66, 0.16);
        border-color: var(--accent-brand);
        color: var(--accent-brand-light);

        &:hover {
            background: var(--accent-brand);
            color: #0b0c10;
        }
    }

    .btn-delete-modal-keep {
        background: rgba(220, 163, 66, 0.16);
        border: 1px solid var(--accent-brand);
        color: var(--accent-brand-light);
        padding: 6px 14px;
        border-radius: 6px;
        font-size: 0.76rem;
        font-family: var(--font-mono);
        font-weight: 700;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

        &:hover {
            background: var(--accent-brand);
            color: #0b0c10;
        }

        &:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }
    }

    .btn-delete-modal-purge {
        background: rgba(239, 68, 68, 0.16);
        border: 1px solid rgba(239, 68, 68, 0.45);
        color: #f87171;
        padding: 6px 14px;
        border-radius: 6px;
        font-size: 0.76rem;
        font-family: var(--font-mono);
        font-weight: 700;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

        &:hover {
            background: #ef4444;
            color: #fff;
            border-color: #ef4444;
        }
    }
}

/* Album Artwork Selection Modal */
.album-artwork-modal-box {
    width: 90%;
    max-width: 580px !important;

    .album-artwork-section-label {
        display: block;
        font-size: var(--fs-sm);
        font-family: var(--font-mono);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: var(--space-3);
    }

    .album-artwork-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
        gap: var(--space-3);
        max-height: 190px;
        overflow-y: auto;
        padding: var(--space-2);
        background: rgba(0, 0, 0, 0.25);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 6px;

        .album-artwork-card {
            position: relative;
            aspect-ratio: 1 / 1;
            border-radius: 4px;
            overflow: hidden;
            cursor: pointer;
            border: 2px solid transparent;
            background: rgba(255, 255, 255, 0.04);
            transition:
                transform 0.15s ease,
                border-color 0.15s ease,
                box-shadow 0.15s ease;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }

            &:hover {
                transform: scale(1.04);
                border-color: rgba(220, 163, 66, 0.5);
                z-index: 2;
            }

            &.is-selected {
                border-color: var(--accent-brand-light);
                box-shadow: 0 0 10px rgba(220, 163, 66, 0.4);
                transform: scale(1.02);
            }

            .album-artwork-card-label {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                padding: 3px 4px;
                background: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
                color: #fff;
                font-family: var(--font-mono);
                font-size: 0.55rem;
                line-height: 1.2;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                pointer-events: none;
            }

            .artwork-badge-current {
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                background: rgba(0, 0, 0, 0.75);
                color: var(--accent-brand-light);
                font-size: 0.58rem;
                font-family: var(--font-mono);
                text-align: center;
                padding: 2px 0;
                backdrop-filter: blur(2px);
                font-weight: 600;
            }
        }
    }

    .album-artwork-url-row {
        display: flex;
        gap: var(--space-2);
        align-items: center;

        .album-artwork-url-input {
            flex: 1;
            background: rgba(0, 0, 0, 0.35);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: var(--text-primary);
            padding: 7px 10px;
            border-radius: 6px;
            font-size: 0.76rem;
            font-family: var(--font-mono);
            outline: none;
            transition: border-color 0.15s ease;

            /* Restore a visible ring for keyboard focus (CSS-001). */
            &:focus-visible {
                outline: 2px solid var(--accent-brand-light);
                outline-offset: 2px;
            }

            &:focus {
                border-color: var(--accent-brand-light);
            }
        }

        .btn-album-artwork-test {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.16);
            color: var(--lib-text-primary);
            padding: 7px 12px;
            border-radius: 6px;
            font-size: var(--fs-sm);
            font-family: var(--font-mono);
            font-weight: 600;
            cursor: pointer;
            transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;
            white-space: nowrap;

            &:hover {
                background: rgba(220, 163, 66, 0.16);
                border-color: var(--accent-brand);
                color: var(--accent-brand-light);
            }
        }
    }

    .album-artwork-preview-container {
        display: flex;
        align-items: center;
        gap: var(--space-5);
        padding: var(--space-4);
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 6px;

        .album-artwork-preview-box {
            width: 64px;
            height: 64px;
            border-radius: 6px;
            overflow: hidden;
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.1);
            flex-shrink: 0;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }
        }

        .album-artwork-preview-meta {
            display: flex;
            flex-direction: column;
            gap: 2px;

            .preview-meta-title {
                font-size: 0.74rem;
                font-weight: 600;
                color: var(--text-primary);
            }

            .preview-meta-status {
                font-size: var(--fs-xs);
                font-family: var(--font-mono);
                color: var(--text-muted);
            }
        }
    }
}

/* ==========================================================================
   React modal layout refinements (Clean Titles, Change Artwork, Track Sources)
   — folded from the former modal-overrides.css (CSS-005). Placed last so these
   same-/higher-specificity rules win without a separate override file.
   ========================================================================== */

.modal-title-icon {
    color: var(--accent-brand-light);
}

.modal-title-icon.is-danger {
    color: #f87171;
}

/* Clean Titles */
.library-delete-modal-body.clean-titles-body {
    padding: 12px 18px 16px;
}
.clean-titles-body .library-delete-modal-subtitle {
    margin-bottom: var(--space-5);
}
.clean-titles-table-header .clean-titles-head-num {
    width: 28px;
}
.clean-titles-table-header .clean-titles-head-arrow {
    width: 24px;
}
.clean-titles-table-header .clean-titles-head-text {
    flex: 1;
}
.clean-titles-row.has-change {
    cursor: pointer;
}
.clean-titles-row.no-change {
    cursor: default;
}
.clean-titles-col-num {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.clean-titles-col-num input[type='checkbox'] {
    accent-color: var(--accent-brand-light);
    cursor: pointer;
}
.clean-titles-arrow i {
    color: var(--text-muted);
}
.clean-titles-arrow i.is-active {
    color: var(--accent-brand-light);
}
.btn-album-edit-done.btn-clean-apply {
    padding: 7px 16px;
}

/* Change Artwork */
.library-delete-modal-header.album-artwork-header {
    justify-content: space-between;
    align-items: flex-start;
}
.album-artwork-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-top: 2px;
}
.btn-delete-modal-cancel.album-artwork-close {
    padding: 2px 8px;
    font-size: 0.9rem;
}
.library-delete-modal-body.album-artwork-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(85vh - 140px);
    overflow-y: auto;
}

/* Track Sources */
.library-delete-modal-box.track-sources-modal-box {
    max-width: 620px;
}
.library-delete-modal-body.track-sources-body {
    padding: 12px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-height: calc(85vh - 140px);
    overflow-y: auto;
}
.track-sources-body .library-delete-modal-subtitle {
    margin-bottom: var(--space-1);
}
.track-source-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.track-source-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
}
.track-source-row.is-primary {
    border-color: rgba(255, 255, 255, 0.14);
}
.track-source-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    flex: 1;
}
.track-source-main > i {
    color: var(--accent-brand-light);
}
.track-source-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.track-source-label {
    font-size: 0.78rem;
    color: var(--text-primary);
}
.track-source-url {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.track-source-primary-badge {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-full);
    padding: 1px 6px;
}
.track-source-kind {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.track-source-video-toggle {
    display: inline-flex;
    gap: 2px;
    margin-left: var(--space-2);
}
.track-source-video-toggle button {
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    font-size: 0.58rem;
    cursor: pointer;
}
.track-source-video-toggle button.is-active {
    color: var(--accent-brand-light);
    border-color: rgba(245, 207, 126, 0.4);
}
.track-source-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}
.track-source-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
}
.track-source-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}
.track-source-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.track-source-btn.is-active {
    color: var(--accent-brand-light);
}
.track-source-btn.is-danger:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}
.track-source-add {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: var(--fs-sm);
}
.track-source-add:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   IMPORT PREVIEW MODAL (Stage 2)
   Centered dialog on desktop and mobile for the unified URL import flow.
   ========================================================================== */

.library-delete-modal-box.import-preview-modal-box {
    width: min(720px, calc(100vw - 32px));
    max-width: 720px;
    max-height: min(86vh, 900px);
    background: var(--bg-card);
}

.import-preview-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    padding: 16px 18px 8px;
    overflow: hidden;
}

.import-preview-hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
}

.import-preview-artwork {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--accent-brand, #dca342);
    font-size: 2rem;
}

.import-preview-artwork-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.import-preview-hero-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.import-preview-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.import-preview-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.25;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-preview-subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.import-preview-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(220, 163, 66, 0.12);
    border: 1px solid rgba(220, 163, 66, 0.24);
    color: var(--accent-brand-light, #f5cf7e);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.import-preview-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.import-preview-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 2px 8px;
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.import-preview-select-all {
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
}

.import-preview-select-all:hover {
    color: var(--text-primary);
    border-color: var(--border-highlight, rgba(240, 205, 145, 0.35));
}

.import-preview-tracklist,
.import-preview-album-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.import-preview-tracklist {
    max-height: 42vh;
}

.import-preview-track-row {
    display: grid;
    grid-template-columns: 22px 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition:
        background-color 0.15s ease,
        opacity 0.15s ease;
}

.import-preview-track-row:hover {
    background: rgba(255, 255, 255, 0.045);
}

.import-preview-track-row.is-unchecked {
    opacity: 0.55;
}

.import-preview-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-brand, #dca342);
    cursor: pointer;
}

.import-preview-track-number {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    text-align: right;
}

.import-preview-track-title {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-sm);
}

.import-preview-track-duration {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.import-preview-discography-hint {
    padding: 0 2px 8px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: 1.45;
}

.import-preview-album {
    border: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.018);
}

.import-preview-album.is-unchecked {
    opacity: 0.62;
}

.import-preview-album.is-partial {
    border-color: rgba(220, 163, 66, 0.42);
    box-shadow: inset 3px 0 0 rgba(220, 163, 66, 0.55);
}

.import-preview-album.is-partial .import-preview-album-meta {
    color: var(--accent-brand-light, #f5cf7e);
}

.import-preview-album-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
}

.import-preview-album-select {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    cursor: pointer;
}

.import-preview-album-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 163, 66, 0.1);
    color: var(--accent-brand, #dca342);
    flex: 0 0 auto;
}

.import-preview-album-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.import-preview-album-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-preview-album-meta {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.import-preview-album-expand {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.import-preview-album-expand:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.import-preview-album-expand:disabled {
    opacity: 0.45;
    cursor: default;
}

.import-preview-album-tracks {
    border-top: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.12));
    padding: 4px 6px 6px;
    max-height: 34vh;
    overflow-y: auto;
}

.import-preview-album-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.import-preview-loading,
.import-preview-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 4px;
    color: var(--text-secondary);
}

.import-preview-loading {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    text-align: center;
}

.import-preview-loading i {
    color: var(--accent-brand, #dca342);
    font-size: 1.4rem;
}

.import-preview-loading-url {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    word-break: break-all;
}

.import-preview-error {
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    border-radius: 10px;
    color: #fecaca;
}

.import-preview-error-title {
    font-weight: 700;
    margin-bottom: 3px;
}

.import-preview-error-detail {
    color: #f3b4b4;
    font-size: var(--fs-sm);
}

.import-preview-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    background: rgba(14, 18, 26, 0.95);
    padding: 12px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.import-preview-queue {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    min-height: 24px;
}

.import-preview-queue-count {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.import-preview-queue-dismiss {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    padding: 4px;
}

.import-preview-play-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    cursor: pointer;
    min-height: 32px;
}

.import-preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.import-preview-actions .btn-delete-modal-cancel,
.import-preview-actions .btn-delete-modal-keep {
    min-height: 40px;
}

/* The shared .btn-delete-modal-keep skin is nested under .library-delete-modal-footer;
   this modal owns .import-preview-footer, so the primary action needs the same skin. */
.import-preview-actions .btn-delete-modal-keep {
    background: rgba(220, 163, 66, 0.16);
    border: 1px solid var(--accent-brand);
    color: var(--accent-brand-light);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.15s ease;
}

.import-preview-actions .btn-delete-modal-keep:hover:not(:disabled) {
    background: var(--accent-brand);
    color: #0b0c10;
}

.import-preview-actions .btn-delete-modal-keep:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    .library-delete-modal-box.import-preview-modal-box {
        /* Centered like desktop (native <dialog> centers via margin: auto), with a small
           horizontal gutter so the rounded corners are not flush to the screen edges. */
        width: calc(100vw - 24px);
        max-width: none;
        max-height: 92vh;
        margin: auto;
        border-radius: 12px;
    }

    .import-preview-body {
        padding: 12px 14px 6px;
    }

    .import-preview-artwork {
        width: 76px;
        height: 76px;
    }

    .import-preview-title {
        font-size: 1.05rem;
    }

    .import-preview-tracklist {
        max-height: 42vh;
    }

    .import-preview-track-row {
        min-height: 46px;
        grid-template-columns: 22px 24px minmax(0, 1fr) auto;
    }

    .import-preview-footer {
        padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .import-preview-play-toggle {
        margin-left: 0;
        width: 100%;
        min-height: 40px;
    }

    .import-preview-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .import-preview-actions .btn-delete-modal-cancel,
    .import-preview-actions .btn-delete-modal-keep {
        width: 100%;
        min-height: 44px;
    }

    .import-preview-album-tracks {
        max-height: 32vh;
    }
}

/* ==========================================================================
   UNIFIED IMPORT LINK MODAL (Phase 2)
   Viewport-neutral manual URL import (replaces MobileImportSheet + ImportStreamModal).
   Also styles the static first-class Import button that sits beside the Library source
   tabs (sibling of the split group, independent of the Library overflow menu).
   ========================================================================== */

/* Static first-class Import action beside the source tabs. Icon-only button (no pill/border),
   same height as the source tabs; the accessible name comes from aria-label/title. */
.btn-ledger-import {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--accent-brand-light);
    cursor: pointer;
    transition:
        background-color,
        color,
        transform 0.2s ease;

    i {
        font-size: 1.15rem;
    }
}

.btn-ledger-import:hover {
    color: #fff;
    background: rgba(220, 163, 66, 0.12);
}

.library-delete-modal-box.import-link-modal-box {
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
    max-height: min(82vh, 760px);
}

.import-link-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 8px;
    min-height: 0;
    overflow-y: auto;
}

.import-link-label {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.import-link-input-row {
    position: relative;
    display: flex;
    align-items: center;
}

.import-link-input {
    width: 100%;
    min-height: 46px;
    /* Right padding reserves room for the provider icon and the clear button. */
    padding: 10px 84px 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    outline: none;
}

.import-link-input:focus {
    border-color: var(--border-highlight, rgba(240, 205, 145, 0.35));
    box-shadow: 0 0 0 2px rgba(220, 163, 66, 0.18);
}

.import-link-input-row .link-source-provider {
    position: absolute;
    right: 44px;
    display: inline-flex;
    align-items: center;
    pointer-events: none;
}

.import-link-clear {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.import-link-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.import-link-paste {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
}

.import-link-paste:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--border-highlight, rgba(240, 205, 145, 0.35));
}

.import-link-paste:disabled {
    opacity: 0.55;
    cursor: default;
}

.import-link-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: #fecaca;
    font-size: var(--fs-sm);
}

.import-link-hint {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: 1.45;
}

.import-link-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px 14px;
    border-top: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
    background: rgba(14, 18, 26, 0.95);
}

.import-link-footer .btn-delete-modal-cancel,
.import-link-footer .btn-delete-modal-keep {
    min-height: 40px;
}

/* .import-link-footer is not .library-delete-modal-footer, so the primary action needs the
   keep-button skin (same shared-skin handling as the preview modal). */
.import-link-footer .btn-delete-modal-keep {
    background: rgba(220, 163, 66, 0.16);
    border: 1px solid var(--accent-brand);
    color: var(--accent-brand-light);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.15s ease;
}

.import-link-footer .btn-delete-modal-keep:hover:not(:disabled) {
    background: var(--accent-brand);
    color: #0b0c10;
}

.import-link-footer .btn-delete-modal-keep:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    .library-delete-modal-box.import-link-modal-box {
        width: calc(100vw - 24px);
        max-width: none;
        max-height: 88vh;
        /* Vertically centered (default dialog centering) rather than a bottom sheet. */
        margin: auto;
        border-radius: 14px;
    }

    .import-link-modal-body {
        padding: 14px 14px 6px;
    }

    .import-link-input,
    .import-link-paste,
    .import-link-clear,
    .import-link-footer .btn-delete-modal-cancel,
    .import-link-footer .btn-delete-modal-keep {
        min-height: 44px;
    }

    .import-link-footer {
        padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .import-link-footer .btn-delete-modal-cancel,
    .import-link-footer .btn-delete-modal-keep {
        flex: 1;
        width: 100%;
    }
}

/* ==========================================================================
   SETTINGS (Phase 1)
   App-level settings surface: confirm-import toggle.
   Reached through the application menu (hamburger) added in Phase 4.
   ========================================================================== */

.library-delete-modal-box.settings-modal-box {
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
    max-height: min(82vh, 760px);
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 8px;
    min-height: 0;
    overflow-y: auto;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle, rgba(226, 185, 115, 0.16));
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.settings-row-label {
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.settings-row-hint {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--fs-xs, 0.75rem);
}

.settings-toggle {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    accent-color: var(--accent-brand);
    cursor: pointer;
}

.settings-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 18px 16px;
}

/* ==========================================================================
   EXTERNAL URL DROP PLATFORM — Media Library
   ==========================================================================
   Shown only while a supported external link is dragged over the library bay.
   Never occupies layout space and never intercepts pointer events when inactive. */

.library-drop-platform {
    position: absolute;
    inset: 0;
    /* The bay is a local stacking context (`container-type: inline-size`). Stay above every
       library-local layer: the filter bar is z-index 40 and an open source menu is 100. */
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 40px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}

body.is-external-drag.is-library-drop-active .library-drop-platform {
    opacity: 1;
    visibility: visible;
}

.library-drop-platform::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 2px dashed rgba(220, 163, 66, 0.62);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 35%, rgba(220, 163, 66, 0.16), transparent 62%),
        linear-gradient(180deg, rgba(21, 18, 14, 0.72), rgba(9, 10, 14, 0.86));
    box-shadow:
        inset 0 0 46px rgba(220, 163, 66, 0.12),
        0 0 34px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.library-drop-platform-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: min(90%, 430px);
    padding: 24px 30px;
    text-align: center;
    border: 1px solid rgba(220, 163, 66, 0.28);
    border-radius: 16px;
    background: rgba(16, 14, 18, 0.84);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

.library-drop-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(220, 163, 66, 0.42);
    border-radius: 50%;
    background: rgba(220, 163, 66, 0.14);
    color: var(--accent-brand-light);
    font-size: 1.3rem;
    animation: bounce-drop-icon 1s ease-in-out infinite alternate;
}

.library-drop-title {
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 2.4vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.library-drop-sub {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.library-drop-providers {
    margin-top: 2px;
    padding: 4px 10px;
    border: 1px solid rgba(220, 163, 66, 0.3);
    border-radius: var(--radius-full);
    background: rgba(220, 163, 66, 0.1);
    color: var(--accent-brand-light);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
    .library-drop-icon {
        animation: none;
    }
}



/* 5. Fixed Bottom Audio Player & Transport Controls */
/* ==========================================================================
   GLOBAL FIXED BOTTOM AUDIO PLAYER DOCK
   ========================================================================== */
.bottom-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 84px;
    background: rgba(9, 12, 18, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.65);
    z-index: var(--z-player);
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr minmax(280px, 340px);
    align-items: center;
    padding: 0 32px;
    gap: 24px;

    /* Subtle metallic top highlight on the bar */
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.2) 20%,
            rgba(212, 147, 56, 0.6) 50%,
            rgba(255, 255, 255, 0.2) 80%,
            transparent 100%
        );
        pointer-events: none;
    }

    /* Equalizer replaced by spinning disc indicator */
    &.is-playing .player-soundwave {
        display: none !important;
    }

    @media (max-width: 1100px) {
        grid-template-columns: 240px 1fr 240px;
        padding: 0 20px;
        gap: var(--space-6);
    }

    @media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
        height: 64px;
        bottom: 56px; /* Sits directly on top of mobile-bottom-app-bar */
        grid-template-columns: 1fr auto;
        grid-template-rows: 1fr;
        padding: 6px 14px;
        gap: var(--space-5);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-bottom: 1px solid rgba(0, 0, 0, 0.4);
        background: rgba(14, 17, 24, 0.95);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);

        .player-track-info {
            grid-column: 1 / 2;
            grid-row: 1;
            overflow: hidden;
            gap: var(--space-4);
        }

        .player-thumb-wrap {
            width: 44px;
            height: 44px;
            flex-shrink: 0;
            border-radius: 6px;
        }

        .player-thumb {
            width: 44px;
            height: 44px;
        }

        .player-meta {
            gap: 1px;
            justify-content: center;
        }

        .player-title-row {
            line-height: 1.15;
            align-items: baseline;
        }

        .player-title {
            font-size: 0.86rem;
            line-height: 1.15;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 190px;
        }

        .btn-player-fav {
            width: 20px;
            height: 20px;
            min-width: 20px;
            font-size: var(--fs-xl);
            align-self: center;
        }

        .player-artist-sub {
            line-height: 1.15;
            margin-top: -1px;
        }

        .player-artist {
            font-size: var(--fs-sm);
            line-height: 1.15;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 190px;
        }

        /* Reveal third line time display on mobile */
        .player-time-mobile {
            display: flex;
            margin-top: 1px;
            line-height: 1.1;
        }

        /* Mini transport in place of full transport on mobile */
        .player-center {
            grid-column: 2 / 3;
            grid-row: 1;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: var(--space-2);
            max-width: none;
        }

        .scrubber-row,
        .btn-transport-toggle,
        .volume-control,
        .btn-player-expand-theater,
        .btn-player-queue {
            display: none !important;
        }

        /* Mobile top-edge scrubber rail: a thin, always-on progress line that REPLACES the
           bar's top border (flush at top:0, no gap). The bar is 64px with 6px top padding and
           a 42px play button centered, so the button's top sits ~11px down — the hit area is
           kept to 10px so it never overlaps the play button. Shares seek logic with desktop. */
        .mobile-scrubber-rail {
            display: block !important;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 10px;
            /* Track flush against the top edge (no top padding → no gap under the border). */
            padding: 0;
            box-sizing: border-box;
            cursor: pointer;
            touch-action: none;
            user-select: none;
            z-index: 2;
        }

        /* The rail is the top edge now, so drop the bar's own top border to avoid a double line. */
        .bottom-player-bar {
            border-top: none;
        }

        .mobile-scrubber-track {
            position: relative;
            width: 100%;
            height: 3px;
            background: rgba(255, 255, 255, 0.14);
            transition: height 0.12s ease;
        }

        .mobile-scrubber-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, var(--accent-brand), var(--accent-brand-light));
            position: relative;

            /* Handle pip revealed while scrubbing. */
            &::after {
                content: '';
                position: absolute;
                right: -5px;
                top: 50%;
                transform: translateY(-50%) scale(0);
                width: 12px;
                height: 12px;
                border-radius: 50%;
                background: #fff;
                box-shadow: 0 0 8px var(--accent-brand-light);
                transition: transform 0.12s ease;
            }
        }

        .mobile-scrubber-rail.is-dragging .mobile-scrubber-track {
            height: 5px;
        }

        .mobile-scrubber-rail.is-dragging .mobile-scrubber-fill::after {
            transform: translateY(-50%) scale(1);
        }

        .transport-controls {
            gap: var(--space-1);
        }

        .btn-transport-secondary {
            width: 34px;
            height: 34px;
            font-size: 0.9rem;
        }

        .btn-transport-master {
            width: 42px;
            height: 42px;
            font-size: 1.05rem;
        }

        .player-right {
            display: none;
        }
    }
}

/* Left Column: Track artwork & Now Playing details */
.player-track-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

/* Rotating vinyl sleeve (static artwork, circular disc while playing) */
.player-thumb-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    cursor: pointer;
    background: #0d1117;
    transition:
        border-radius 1.05s linear,
        box-shadow 1.05s ease,
        border-color 1.05s ease;

    &:hover {
        filter: brightness(1.08);
    }

    .player-thumb {
        width: 100%;
        height: 100%;
        border-radius: inherit;
        object-fit: cover;
        display: block;
        pointer-events: none;
        z-index: 1;
    }

    /* Center spindle hole on the rotating vinyl circle */
    &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 8px;
        height: 8px;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        background: #07080b;
        border: 1.5px solid rgba(255, 255, 255, 0.65);
        box-shadow:
            0 0 2px rgba(0, 0, 0, 0.95),
            inset 0 0 2px rgba(0, 0, 0, 0.95);
        opacity: 0;
        transition: opacity 1.05s ease-out;
        pointer-events: none;
        z-index: 3;
    }

    /* Micro vinyl groove sheen highlight on circular vinyl */
    &::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: radial-gradient(circle at center, transparent 32%, rgba(255, 255, 255, 0.09) 52%, transparent 72%);
        opacity: 0;
        transition: opacity 1.05s ease-out;
        pointer-events: none;
        z-index: 2;
    }

    /* 45 RPM speed synchronization transition adjustments */
    &.is-45-rpm::after,
    &.is-45-rpm::before {
        transition: opacity 0.85s ease-out;
    }

    /* Active & Playing state: Transitions to circular vinyl disc and rotates at turntable RPM */
    &.is-playing {
        border-radius: 50%;
        border-color: rgba(212, 147, 56, 0.65);
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.85),
            0 0 12px rgba(212, 147, 56, 0.4);
        animation: spinDisc 1.8s linear infinite;

        &.is-45-rpm {
            animation: spinDisc 1.3333s linear infinite;
        }

        &::after,
        &::before {
            opacity: 1;
            transition: opacity 1.05s linear;
        }

        &.is-45-rpm::after,
        &.is-45-rpm::before {
            transition: opacity 0.778s linear;
        }
    }

    &.is-paused {
        animation-play-state: paused;
    }
}

/* Meta stack: title row, then artist / album / year subtitle */
.player-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;

    .player-title-row {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        min-width: 0;

        .player-title {
            font-weight: 700;
            font-size: 0.9rem;
            color: #fff;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            letter-spacing: -0.01em;
        }
    }

    .player-artist-sub {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-size: 0.74rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        .player-artist {
            color: var(--text-secondary);
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex-shrink: 0;
        }

        .player-meta-dot {
            color: var(--text-muted);
            opacity: 0.6;
            flex-shrink: 0;
        }

        .player-album {
            color: var(--text-muted);
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
}

/* Mobile third line: 0:00 / 3:19 time display */
.player-time-mobile {
    display: none;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--text-muted, #71717a);
    font-feature-settings: 'tnum';
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1.1;

    .player-time-mobile-current {
        color: var(--text-muted, #71717a);
        font-weight: 400;
    }

    .player-time-mobile-sep {
        opacity: 0.5;
        font-size: 0.62rem;
    }

    .player-time-mobile-total {
        color: var(--text-muted, #71717a);
        font-weight: 400;
    }
}

/* Equalizer live soundwave bars in bottom bar - hidden per request */
.player-soundwave {
    display: none !important;
}

/* Center Column: Master Hi-Fi Transport & Precision Scrubber */
.player-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: var(--space-6);

    .btn-transport-secondary {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: transparent;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;

        &:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.08);
            transform: scale(1.08);
        }

        &:disabled {
            opacity: 0.35;
            cursor: not-allowed;
            pointer-events: none;
            transform: none;
            background: transparent;
        }
    }

    .btn-transport-master {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--accent-brand-light) 0%, var(--accent-brand) 55%, #8f5d16 100%);
        border: 1px solid rgba(255, 255, 255, 0.4);
        color: #0b0d13;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
        box-shadow:
            0 4px 18px var(--accent-glow),
            inset 0 1px 2px rgba(255, 255, 255, 0.4);
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);

        &:hover {
            transform: scale(1.08);
            box-shadow: 0 6px 24px rgba(212, 147, 56, 0.6);
            color: #000;
        }

        &:active {
            transform: scale(0.96);
        }

        &:disabled {
            opacity: 0.38;
            cursor: not-allowed;
            pointer-events: none;
            transform: none;
            box-shadow: none;
            filter: saturate(0.4);
        }
    }

    /* Transport Toggle Buttons (Shuffle & Repeat) */
    .btn-transport-toggle {
        position: relative;
        color: var(--text-muted);

        &:hover {
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.08);
        }

        &.is-active {
            color: var(--accent-brand-light);
            text-shadow: 0 0 10px var(--accent-glow);
            background: rgba(220, 163, 66, 0.12);
            border: 1px solid rgba(220, 163, 66, 0.25);
        }

        .repeat-one-badge {
            position: absolute;
            top: -2px;
            right: -2px;
            font-family: var(--font-mono, monospace);
            font-size: 0.58rem;
            font-weight: 800;
            line-height: 1;
            color: #0b0d13;
            background: var(--accent-brand-light);
            border-radius: 50%;
            width: 12px;
            height: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
        }
    }
}

.scrubber-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

/* Mobile-only top-edge scrubber rail. Hidden by default; shown inside @media (max-width: 767px), (max-width: 1024px) and (pointer: coarse). */
.mobile-scrubber-rail {
    display: none;
}

.time-label {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
    letter-spacing: 0.03em;

    &.current {
        color: var(--accent-brand-light);
        text-align: right;
    }
}

.time-label-toggleable {
    cursor: pointer;
    user-select: none;
    transition:
        color 0.15s ease,
        opacity 0.15s ease;
    padding: 2px 4px;
    border-radius: var(--radius-xs);

    &:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.08);
    }
}

.progress-bar-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: height 0.15s ease;
    touch-action: none;
    user-select: none;

    &:hover,
    &.is-dragging {
        height: 8px;
    }

    .progress-fill {
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, var(--accent-brand), var(--accent-brand-light));
        border-radius: var(--radius-full);
        position: relative;
        transition: width 0.08s linear;

        /* Scrubber handle pip that shines on hover and drag */
        &::after {
            content: '';
            position: absolute;
            right: -4px;
            top: 50%;
            transform: translateY(-50%) scale(0);
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 0 8px var(--accent-brand-light);
            transition: transform 0.15s ease;
        }
    }

    &.is-dragging .progress-fill {
        transition: none; /* Instant feedback while scrubbing/dragging */
    }

    &:hover .progress-fill::after,
    &.is-dragging .progress-fill::after {
        transform: translateY(-50%) scale(1);
    }
}

/* Right Column: Queue, Volume, and Now Playing Theater Trigger */
.player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

/* Now Playing Expand/Contract Diagonal Icon Button (Matching Stem / Juice WRLD Vault Style) */
.btn-player-expand-theater {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    flex-shrink: 0;

    &:hover {
        background: transparent;
        color: #ffffff;
        border: none;
        transform: scale(1.1);
    }

    svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.3;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .theater-icon-expand {
        display: block;
    }

    .theater-icon-collapse {
        display: none;
    }

    /* Active / Open state: Transparent background with bright white icon */
    &.is-active {
        background: transparent;
        color: #ffffff;
        border: none;
        box-shadow: none;

        &:hover {
            background: transparent;
            color: #ffffff;
            transform: scale(1.1);
        }

        .theater-icon-expand {
            display: none;
        }

        .theater-icon-collapse {
            display: block;
        }
    }
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-muted);

    .btn-volume-icon {
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 0.88rem;
        transition: color 0.2s ease;
        padding: var(--space-1);

        &:hover {
            color: #fff;
        }
    }

    .volume-slider {
        -webkit-appearance: none;
        appearance: none;
        width: 80px;
        height: 5px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 3px;
        outline: none;
        cursor: pointer;

        /* Restore a visible ring for keyboard focus (CSS-001). */
        &:focus-visible {
            outline: 2px solid var(--accent-brand-light);
            outline-offset: 3px;
        }

        &::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 13px;
            height: 13px;
            border-radius: 50%;
            background: var(--accent-brand-light);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
            cursor: pointer;
            transition: transform 0.15s ease;
        }
    }
}

/* =========================================================================
   BORDERLESS GHOST PLAYER UTILITY BUTTONS (Heart, Queue)
   ========================================================================= */

.btn-player-fav,
.btn-player-queue {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    transition:
        color 0.18s ease,
        transform 0.18s ease,
        text-shadow 0.18s ease;

    &:hover {
        color: var(--text-primary);
        transform: scale(1.12);
        background: transparent;
        border: none;
        box-shadow: none;
    }

    &:active {
        transform: scale(0.96);
    }

    &:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
        transform: none;
    }
}

/* Favorite Heart Active State */
.btn-player-fav {
    &.is-fav,
    &.is-favorite {
        color: #ef4444 !important;
        text-shadow: 0 0 10px rgba(239, 68, 68, 0.55);
        animation: heartSpringPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

@keyframes heartSpringPop {
    0% {
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.35);
    }
    100% {
        transform: scale(1);
    }
}

/* Queue Button Active / Open State */
.btn-player-queue {
    &.is-active,
    &.is-open {
        color: var(--accent-brand-light) !important;
        text-shadow: 0 0 10px rgba(220, 163, 66, 0.45);
    }

    /* Queue Count Badge on Player Bar */
    .queue-count-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        background: var(--accent-brand);
        color: #0b0d13;
        font-family: var(--font-mono, monospace);
        font-size: 0.55rem;
        font-weight: 800;
        min-width: 14px;
        height: 14px;
        padding: 0 3px;
        border-radius: 7px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
        pointer-events: none;
    }
}

/* =========================================================================
   LEDGER SESSION TIMELINE & QUEUE STYLES (Option 3 Continuous Playlist)
   ========================================================================= */

.queue-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px 14px;
    margin-top: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scroll-margin-top: calc(var(--ledger-sticky-height) + 12px);

    &:first-child {
        margin-top: 0;
    }
}

.queue-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-mono, monospace);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);

    i {
        font-size: var(--fs-md);
    }
}

.queue-section-hint {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.75;
}

.btn-queue-section-action {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    font-size: var(--fs-2xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);

    &:hover {
        color: #ef4444;
        border-color: rgba(239, 68, 68, 0.3);
        background: rgba(239, 68, 68, 0.08);
    }
}

/* Queue Status Pills */
.queue-status-tag {
    font-family: var(--font-mono, monospace);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: var(--space-2);
    vertical-align: middle;

    &.played {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-muted);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    &.now-playing {
        background: rgba(220, 163, 66, 0.18);
        color: var(--accent-brand-light);
        border: 1px solid rgba(220, 163, 66, 0.35);
        box-shadow: 0 0 8px rgba(220, 163, 66, 0.2);
    }

    &.next {
        background: rgba(56, 189, 248, 0.15);
        color: var(--accent-cyan);
        border: 1px solid rgba(56, 189, 248, 0.3);
    }
}

/* Live Pulse Badge */
.queue-live-pulse-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono, monospace);
    font-size: var(--fs-2xs);
    font-weight: 800;
    color: var(--accent-brand-light);
    background: rgba(220, 163, 66, 0.12);
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(220, 163, 66, 0.25);

    .pulse-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--accent-brand);
        box-shadow: 0 0 6px var(--accent-brand);
        animation: livePulseGlow 1.4s infinite ease-in-out;
    }
}

@keyframes livePulseGlow {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.75);
    }
}

.queue-shuffle-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-mono, monospace);
    font-size: var(--fs-2xs);
    color: var(--accent-brand-light);
    opacity: 0.85;
}

/* Register Row States for History & Now Playing */
.register-track-row {
    &.is-history {
        opacity: 0.72;
        transition:
            opacity 0.2s ease,
            background 0.2s ease;

        &:hover {
            opacity: 1;
            background: rgba(255, 255, 255, 0.05);
        }

        .track-title-text {
            color: var(--text-secondary);
        }
    }
}

/* Remove button for Custom Queued tracks */
.btn-track-remove-queue {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 4px;
    opacity: 0;
    transition:
        opacity 0.15s ease,
        color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
        opacity: 1 !important;
        color: #ef4444 !important;
    }

    /* Keyboard: reveal the control while it (or its row) has focus (CSS-002). */
    &:focus-visible,
    .register-track-row:focus-within & {
        opacity: 1 !important;
        color: var(--accent-brand-light) !important;
    }
}

.register-track-row:hover .btn-track-remove-queue {
    opacity: 0.7;
}

/* Touch / no-hover devices: the remove button has no hover to reveal it,
   so keep it visible at all times (CSS-002). */
@media (hover: none) {
    .btn-track-remove-queue {
        opacity: 0.7;
    }
}

/* Track Row Favorite Button in Ledger */
.btn-track-fav {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.75;
    margin-right: var(--space-1);

    &:hover {
        color: #ef4444;
        opacity: 1;
        transform: scale(1.15);
    }

    &.is-favorite,
    &.is-fav {
        color: #ef4444;
        opacity: 1;
        text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    }
}

/* Responsive Breakpoints shared with the chassis neighbours */
@media (max-width: 1100px) {
    .chassis-main-body {
        grid-template-columns: 350px minmax(0, 1fr);
    }
}

@media (max-width: 767px), (max-width: 1024px) and (pointer: coarse) {
    /* Top nav layout adjustments on mobile */
    .site-nav {
        padding: 0 16px;
        height: 52px;
        justify-content: space-between;
    }

    .nav-left {
        display: flex;
        align-items: center;
        gap: var(--space-5);
    }

    /* Hide desktop-only drawer button on mobile */
    .btn-nav-library-toggle {
        display: none !important;
    }

    .nav-logo-xoetic {
        height: 22px;
    }

    /* Full-screen single bay presentation on mobile */
    .chassis-main-body {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr !important;
        overflow: hidden;
    }

    /* Mobile Bottom App Navigation Bar (PWA style: active on mobile <= 767px) */
    .mobile-bottom-app-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: rgba(9, 11, 16, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
        z-index: var(--z-mobile-bar);
        align-items: center;
        justify-content: space-around;
        padding: 0 8px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .btn-mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-1);
        height: 100%;
        background: transparent;
        border: none;
        color: var(--text-muted, #71717a);
        font-size: var(--fs-xs);
        font-weight: 600;
        letter-spacing: 0.01em;
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        padding: 4px 0;

        i {
            font-size: 1.15rem;
            transition:
                transform 0.2s ease,
                color 0.2s ease;
        }

        &:hover {
            color: #fff;
        }

        &.is-active {
            color: var(--accent-brand-light, #fbbf24);

            i {
                transform: translateY(-1px);
                color: var(--accent-brand-light, #fbbf24);
                text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
            }
        }
    }

    /* Content offset on mobile accounts for the mini-player + bottom app bar */
    .chronicle-hero-wrapper {
        margin-bottom: calc(64px + 56px + env(safe-area-inset-bottom, 0px)) !important;
        padding-bottom: 0 !important;
    }

    /* Mobile View State 1: Media Library active (Default) */
    body[data-mobile-view='library'] .console-tracklist-bay,
    body[data-mobile-view='queue'] .console-tracklist-bay {
        display: flex !important;
        flex: 1 1 auto;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border: none;
        overflow: hidden;
    }

    /* The app-shell grid collapses to a single column on mobile; the active bay
       (library or stage) fills it via the data-mobile-view rules. */
    .chronicle-hero-wrapper {
        display: block;
    }

    .app-main {
        width: 100%;
        height: 100%;
    }

    body[data-mobile-view='library'] .console-turntable-bay,
    body[data-mobile-view='queue'] .console-turntable-bay {
        display: none !important;
    }

    /* Mobile View State 2: Turntable Stage active (includes lyrics, sleeve & video slides) */
    body[data-mobile-view='stage'] .console-turntable-bay,
    body[data-mobile-view='lyrics'] .console-turntable-bay,
    body[data-mobile-view='sleeve'] .console-turntable-bay,
    body[data-mobile-view='video'] .console-turntable-bay {
        display: flex !important;
        flex: 1 1 auto;
        width: 100%;
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* No horizontal padding: the carousel track (and the turntable's drop shadow / tonearm
           base) must reach the screen edge. This bay is a scroll container, so any horizontal
           inset here clips the shadow at a hard line. Individual slides (lyrics/sleeve/video)
           carry their own horizontal padding. */
        padding: 8px 0;
    }

    body[data-mobile-view='stage'] .console-tracklist-bay,
    body[data-mobile-view='lyrics'] .console-tracklist-bay,
    body[data-mobile-view='sleeve'] .console-tracklist-bay,
    body[data-mobile-view='video'] .console-tracklist-bay {
        display: none !important;
    }

    /* Turntable Plinth scaling and centering for smaller mobile viewports.
       Use container units so the platter grows to fill the bay on any phone.
       81cqi leaves a symmetric gap on each side equal to the tonearm base
       overhang (~0.115× the platter width), so the record is centered with equal
       room for the base on both sides. 80cqh leaves room for the deck header. */
    .console-turntable-bay {
        --stage-size: clamp(240px, min(80cqh, 81cqi), 560px);
        padding: 6px 10px;
    }

    /* Keep the platter centered on mobile (no horizontal nudge); the stage-size
       width fraction leaves right-edge room for the tonearm base overhang. */
    .turntable-plinth-housing {
        transform: none !important;
        max-width: 100% !important;
        width: 100% !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    .turntable-platter-well {
        margin: 0 auto !important;
    }

    /* --------------------------------------------------------------------------
       MOBILE STAGE CAROUSEL TRACK (Pure CSS Horizontal Snap Carousel)
       -------------------------------------------------------------------------- */
    .stage-carousel-track {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .stage-carousel-track::-webkit-scrollbar {
        display: none !important;
    }

    .stage-carousel-slide {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        scroll-snap-align: center !important;
        scroll-snap-stop: always !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
        padding: 4px 6px !important;
    }

    /* Slide 1: Turntable */
    .slide-stage-turntable {
        align-items: center !important;
        justify-content: flex-start !important;
        /* Edge-to-edge: no horizontal padding (the generic slide adds 6px, which left a gap and
           cropped the plinth drop shadow / tonearm base against a hard line). Overflow is visible
           so the shadow and overhanging tonearm base paint all the way to the track (screen) edge;
           the track itself clips at the viewport. No internal scroll needed for this slide. */
        padding: 4px 0 !important;
        overflow: visible !important;
    }

    .slide-stage-turntable .turntable-plinth-housing {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Slide 2: Synced Lyrics */
    .slide-stage-lyrics {
        align-items: stretch !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        overflow-y: hidden !important;
    }

    .stage-slide-lyrics-inner {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .slide-stage-lyrics .stage-lyrics-header {
        display: none !important;
    }

    .slide-stage-lyrics .stage-lyrics-meta-center,
    .slide-stage-lyrics .lyrics-offset-controller,
    .slide-stage-lyrics .stage-lyrics-meta-right span {
        display: none !important;
    }

    .slide-stage-lyrics .stage-lyrics-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        padding: 0 8px !important;
    }

    .slide-stage-lyrics .stage-synced-lyrics-list {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        /* Top pad mirrors the desktop theater river (small + fixed) so the first
           line starts near the top and only centers once it overflows past the
           midpoint — instead of being pushed to mid-screen on load. */
        padding-top: 20px !important;
        /* Generous bottom pad so the final lines can still scroll up to center. */
        padding-bottom: calc(55vh - 60px) !important;
        padding-left: var(--space-3) !important;
        padding-right: var(--space-3) !important;
        gap: var(--space-6) !important;
    }

    .slide-stage-lyrics .stage-lyric-line {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
        font-size: 1.15rem;
        padding: 10px 14px !important;
    }

    /* Slide 3: Sleeve & Notes */
    .slide-stage-sleeve {
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 10px 80px 10px !important;
    }

    .stage-slide-sleeve-inner {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .slide-stage-sleeve .stage-sleeve-jacket {
        width: clamp(260px, 86vw, 380px) !important;
        max-width: 100% !important;
    }

    /* Slide 4: Video Slide (hidden by default unless explicitly available) */
    .slide-stage-video {
        align-items: center !important;
        justify-content: center !important;
        /* Extra horizontal breathing room so the video's drop shadow can
           diffuse before the slide clips it (straight shadow edges otherwise). */
        padding: 12px 20px 80px 20px !important;
    }

    .slide-stage-video[style*='display: none'] {
        display: none !important;
    }

    .stage-slide-video-inner {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .stage-video-screen-frame {
        position: relative;
        width: 100%;
        max-width: clamp(280px, 92vw, 480px);
        aspect-ratio: var(--video-aspect-ratio, 16 / 9);
        /* Squared-off screen: no rounded corners */
        border-radius: 0;
        overflow: hidden;
        background: #000;
        /* Soft, diffused shadow — layered blur with no crisp ring */
        box-shadow:
            0 2px 6px rgba(0, 0, 0, 0.4),
            0 10px 24px rgba(0, 0, 0, 0.4),
            0 20px 44px rgba(0, 0, 0, 0.22);

        iframe {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            border: 0;
        }
    }

    /* Fullscreen toggle overlaid on the video frame (lower-right) */
    .stage-video-fullscreen-btn {
        position: absolute;
        bottom: 10px;
        right: 10px;
        z-index: 3;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.45);
        color: rgba(255, 255, 255, 0.92);
        cursor: pointer;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        transition:
            background 0.2s ease,
            color 0.2s ease,
            opacity 0.25s ease;

        /* Hidden until the user taps the video to reveal controls */
        opacity: 0;
        visibility: hidden;

        &.is-visible {
            opacity: 1;
            visibility: visible;
        }

        &:active {
            background: rgba(0, 0, 0, 0.7);
        }

        svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 2.3;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
    }

    /* Show expand icon normally, collapse icon while fullscreen */
    .stage-video-icon-collapse {
        display: none;
    }

    .stage-video-screen-frame:fullscreen,
    .stage-video-screen-frame:-webkit-full-screen {
        max-width: none;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
        aspect-ratio: auto;
        background: #000;
    }

    .stage-video-screen-frame:fullscreen .stage-video-fullscreen-btn,
    .stage-video-screen-frame:-webkit-full-screen .stage-video-fullscreen-btn {
        bottom: 16px;
        right: 16px;
    }

    /* Hide the cursor when idle in fullscreen for an unobstructed view */
    .stage-video-screen-frame.is-cursor-idle,
    .stage-video-screen-frame.is-cursor-idle * {
        cursor: none !important;
    }

    .stage-video-screen-frame:fullscreen .stage-video-icon-expand,
    .stage-video-screen-frame:-webkit-full-screen .stage-video-icon-expand,
    .stage-video-screen-frame.is-fullscreen .stage-video-icon-expand {
        display: none;
    }

    .stage-video-screen-frame:fullscreen .stage-video-icon-collapse,
    .stage-video-screen-frame:-webkit-full-screen .stage-video-icon-collapse,
    .stage-video-screen-frame.is-fullscreen .stage-video-icon-collapse {
        display: block;
    }

    /* Plinth hardware bar: compact icon/essential view on mobile (overflow must remain visible for popups) */
    .plinth-hardware-bar {
        max-width: 95vw;
        overflow: visible;
        gap: var(--space-2);
        padding: 4px 10px;

        .plinth-hardware-switch {
            gap: var(--space-1);
            padding: 2px 4px;
            font-size: 0.58rem;
            white-space: nowrap;
        }

        /* Allow dropdown menu to render above the hardware bar without clipping */
        .plinth-hardware-dropdown {
            position: relative;
            z-index: 60;
        }

        .plinth-dropdown-menu {
            z-index: 100;
            bottom: calc(100% + 12px);
        }

        /* Hide auxiliary non-essential switches on narrow mobile screens (accessible via Deck Studio drawer) */
        #plinth-studio-switch,
        #plinth-flip-switch {
            display: none !important;
        }
    }
}


/* 6. Turntable Studio & Hardware Customizer Drawer */
/* ==========================================================================
   TURNTABLE STUDIO: SLIDE-OUT HARDWARE CUSTOMIZER DRAWER
   ========================================================================== */

.studio-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: clamp(
        380px,
        48vw,
        680px
    ); /* Covers only the right-hand ledger / background behind drawer, NEVER the turntable deck! */
    background: linear-gradient(90deg, transparent 0%, rgba(6, 8, 14, 0.45) 20%, rgba(6, 8, 14, 0.75) 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: var(--z-dropdown);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;

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

/* Studio Customizer Preview Mode: Unveil plinth, platter, and 45 adapter */
body.is-studio-mode {
    /* Frosted glass blur & dim exclusively over the right-hand Discography Ledger */
    .console-tracklist-bay {
        filter: blur(14px) brightness(0.65) saturate(1.2);
        pointer-events: none;
        transition: filter 0.4s ease;
    }

    /* Keep the left Turntable Deck 100% crisp, sharp, unobstructed, and above the drawer backdrop */
    .console-turntable-bay {
        filter: none !important;
        position: relative !important;
        z-index: 1000 !important;
    }

    .album-cover-container {
        transform: translateX(-140%) rotate(-8deg) scale(0.85) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition:
            transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.4s ease !important;
    }

    .vinyl-peek {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1) !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 2 !important;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9) !important;
        transition:
            transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.4s ease !important;
    }

    /* 7-Inch Single format scaled authentically to 7" diameter on platter well */
    .vinyl-stage[data-disc-format='7in-single'] .vinyl-peek {
        transform: translateX(0) translateY(0) rotate(0deg) scale(0.75) !important;
    }

    /* Reveal center 45 RPM adapter on 7" Single */
    .vinyl-stage[data-disc-format='7in-single'] .vinyl-45-adapter {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Hide 45 RPM adapter on standard 12" LP */
    .vinyl-stage[data-disc-format='12in-lp'] .vinyl-45-adapter {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Tonearm is always visible in studio mode */
    .tonearm-assembly {
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 30 !important;
    }
}

/* Studio Bare Slipmat View (When user wants to see the bare platter & slipmat) */
body.is-studio-mode.is-bare-platter {
    .vinyl-peek {
        opacity: 0 !important;
        visibility: hidden !important;
        transform: scale(0.6) !important;
        transition:
            transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.3s ease !important;
    }
}

/* Studio Stage View Selector Bar */
.studio-stage-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: var(--radius-md);

    .stage-toggle-label {
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        font-weight: 700;
        color: var(--text-muted);
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .stage-toggle-group {
        display: inline-flex;
        background: rgba(0, 0, 0, 0.4);
        padding: 3px;
        border-radius: var(--radius-full);
        border: 1px solid var(--border-subtle);
        gap: var(--space-1);
    }

    .btn-stage-toggle {
        font-family: var(--font-display);
        font-size: var(--fs-sm);
        font-weight: 600;
        color: var(--text-secondary);
        padding: 4px 10px;
        border-radius: var(--radius-full);
        background: transparent;
        border: none;
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);

        &:hover {
            color: #fff;
        }

        &.is-active {
            background: var(--accent-brand);
            color: #0c0704;
            font-weight: 800;
            box-shadow: 0 2px 8px var(--accent-glow);
        }
    }

    .btn-motor-toggle {
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-secondary);
        padding: 5px 12px;
        border-radius: var(--radius-full);
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-subtle);
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.25s ease;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);

        i {
            font-size: var(--fs-md);
            color: var(--text-muted);
            transition:
                color 0.25s ease,
                transform 0.25s ease;
        }

        &:hover {
            color: #fff;
            border-color: rgba(220, 163, 66, 0.4);
            background: rgba(255, 255, 255, 0.08);

            i {
                color: var(--accent-brand);
            }
        }

        &.is-active {
            background: rgba(34, 197, 94, 0.15);
            border-color: rgba(34, 197, 94, 0.5);
            color: #4ade80;
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);

            i {
                color: #4ade80;
                transform: rotate(360deg);
            }
        }
    }

    .btn-cue-toggle {
        font-family: var(--font-mono);
        font-size: var(--fs-xs);
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-secondary);
        padding: 5px 12px;
        border-radius: var(--radius-full);
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-subtle);
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.25s ease;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);

        i {
            font-size: var(--fs-md);
            color: var(--text-muted);
            transition:
                color 0.25s ease,
                transform 0.25s ease;
        }

        &:hover {
            color: #fff;
            border-color: rgba(220, 163, 66, 0.4);
            background: rgba(255, 255, 255, 0.08);

            i {
                color: var(--accent-brand);
            }
        }

        &.is-active {
            background: rgba(220, 163, 66, 0.18);
            border-color: var(--accent-brand);
            color: var(--accent-brand);
            box-shadow: 0 0 12px rgba(220, 163, 66, 0.25);

            i {
                color: var(--accent-brand);
                transform: translateY(1px);
            }
        }
    }
}

.turntable-studio-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 580px;
    max-width: 95vw;
    background: rgba(14, 18, 26, 0.96);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-left: 1px solid var(--border-highlight);
    box-shadow:
        -20px 0 60px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(220, 163, 66, 0.15);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    /* Defect 3: a closed drawer is only translated off-canvas, so without this its
     * focusable descendants stay in the tab order. visibility:hidden removes them from
     * the a11y/tab order; the delayed transition keeps the slide-out animation visible. */
    visibility: hidden;
    transition:
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s linear 0.4s;

    &.is-open {
        transform: translateX(0);
        visibility: visible;
        transition:
            transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
            visibility 0s;
    }
}

.studio-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);

    .studio-header-title {
        display: flex;
        align-items: center;
        gap: var(--space-5);

        i {
            font-size: 1.25rem;
            color: var(--accent-brand);
            filter: drop-shadow(0 0 10px var(--accent-glow));
        }

        h2 {
            font-family: var(--font-display);
            font-size: 1.15rem;
            font-weight: 800;
            letter-spacing: -0.01em;
            color: var(--text-primary);
        }

        span {
            display: block;
            font-family: var(--font-mono);
            font-size: var(--fs-xs);
            font-weight: 600;
            color: var(--text-muted);
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }
    }

    .btn-close-studio {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--border-subtle);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;

        &:hover {
            color: #fff;
            background: rgba(220, 163, 66, 0.2);
            border-color: var(--accent-brand);
            transform: rotate(90deg);
        }
    }
}

.studio-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 30px;
    display: flex;
    flex-direction: column;
    gap: 28px;

    /* Custom thin scrollbar */
    &::-webkit-scrollbar {
        width: 6px;
    }
    &::-webkit-scrollbar-thumb {
        background: rgba(220, 163, 66, 0.2);
        border-radius: 3px;
    }
}

.studio-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);

    .studio-section-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-family: var(--font-mono);
        font-size: var(--fs-sm);
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-secondary);

        span.count {
            color: var(--accent-brand);
            font-weight: 600;
        }
    }
}

/* Studio Customizer card buttons (defect 2: converted from <div> to <button> for
 * keyboard operability). Neutralize native button chrome the <div>s never had. */
.studio-swatch-card,
.studio-tonearm-card,
.studio-adapter-card {
    font: inherit;
    color: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
}

/* Plinth Finishes Grid */
.studio-plinth-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.studio-swatch-card {
    position: relative;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.25s ease;
    user-select: none;

    &:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(240, 205, 145, 0.35);
        transform: translateY(-2px);
    }

    &.is-active {
        background: rgba(220, 163, 66, 0.12);
        border-color: var(--accent-brand);
        box-shadow:
            0 0 16px rgba(220, 163, 66, 0.2),
            inset 0 0 0 1px var(--accent-brand);

        .swatch-title {
            color: var(--accent-brand-light);
            font-weight: 700;
        }

        .swatch-check {
            opacity: 1;
            transform: scale(1);
        }
    }

    .swatch-preview-disc {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        flex-shrink: 0;
    }

    .swatch-info {
        flex: 1;
        min-width: 0;

        .swatch-title {
            font-family: var(--font-display);
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .swatch-sub {
            font-family: var(--font-mono);
            font-size: var(--fs-2xs);
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    .swatch-check {
        opacity: 0;
        transform: scale(0.6);
        color: var(--accent-brand);
        font-size: var(--fs-md);
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;
    }

    &.studio-swatch-card-full {
        grid-column: 1 / -1;
    }

    &.is-dragover {
        background: rgba(220, 163, 66, 0.2);
        border-color: var(--accent-brand);
        border-style: dashed;
        box-shadow:
            0 0 20px rgba(220, 163, 66, 0.35),
            inset 0 0 0 1px var(--accent-brand);
        transform: translateY(-2px);
    }
}

.studio-section.is-dragover {
    outline: 1px dashed var(--accent-brand);
    outline-offset: 6px;
    border-radius: var(--radius-md);
}

/* Specific Plinth Visual Previews */
.swatch-preview-walnut {
    background: linear-gradient(135deg, #2b1509, #140803);
    border-color: #633315;
}
.swatch-preview-album-blur {
    background: radial-gradient(
        circle at 50% 50%,
        rgba(220, 163, 66, 0.45) 0%,
        rgba(56, 189, 248, 0.35) 45%,
        rgba(14, 165, 233, 0.2) 70%,
        #0c1018 100%
    );
    border-color: rgba(220, 163, 66, 0.6);
    box-shadow: 0 0 10px rgba(220, 163, 66, 0.35);
}
/* PERF-9: these previews are offscreen (the drawer is translated off-canvas while closed),
 * so their background art is only declared once the drawer opens. A closed drawer therefore
 * fetches zero swatch art instead of ~1.4 MB of plinth images on first paint. The borders
 * stay unconditional so a swatch still reads as a card before its image loads. */
.swatch-preview-plinth-1990s-stickers {
    border-color: #64748b;
}
.swatch-preview-plinth-art-school {
    border-color: #f59e0b;
}
.swatch-preview-plinth-autumn-leaves {
    border-color: #ea580c;
}
.swatch-preview-plinth-caution {
    border-color: #eab308;
}
.swatch-preview-plinth-radio-tubes {
    border-color: #f97316;
}
.swatch-preview-plinth-route-66 {
    border-color: #ef4444;
}
.swatch-preview-plinth-rustic-workbench {
    border-color: #78350f;
}
.swatch-preview-plinth-shou-sugi-dark {
    border-color: #334155;
}
.swatch-preview-plinth-shou-sugi-light {
    border-color: #64748b;
}
.swatch-preview-plinth-walnut-timber {
    border-color: #854d24;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-1990s-stickers {
    background: url('../../images/backgrounds/1990s-band-stickers.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-art-school {
    background: url('../../images/backgrounds/art-school-studio-table.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-autumn-leaves {
    background: url('../../images/backgrounds/autumn-concrete-leaves.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-caution {
    background: url('../../images/backgrounds/caution-do-not-operate.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-radio-tubes {
    background: url('../../images/backgrounds/radio-tubes.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-route-66 {
    background: url('../../images/backgrounds/route-66-diner.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-rustic-workbench {
    background: url('../../images/backgrounds/rustic-workbench.webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-shou-sugi-dark {
    background: url('../../images/backgrounds/shou-sugi-ban-[dark].webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-shou-sugi-light {
    background: url('../../images/backgrounds/shou-sugi-ban-[light].webp') center/cover no-repeat;
}
.turntable-studio-drawer.is-open .swatch-preview-plinth-walnut-timber {
    background: url('../../images/backgrounds/walnut.webp') center/cover no-repeat;
}
.swatch-preview-plinth-custom {
    background: radial-gradient(circle at center, #1e293b 0%, #0d121c 100%);
    background-size: cover;
    background-position: center;
    border: 2px dashed rgba(220, 163, 66, 0.6);
    box-shadow: 0 0 8px rgba(220, 163, 66, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}
.swatch-preview-plinth-custom:not(.has-custom-thumb)::after {
    content: '\f03e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.9rem;
    color: var(--accent-brand-light, #f5cf7e);
}
.swatch-preview-plinth-custom.has-custom-thumb {
    border-style: solid;
    border-color: var(--accent-brand);
}

/* Platter & Slipmat Grid */
.studio-platter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

/* Specific Platter & Slipmat Visual Previews */
.swatch-preview-platter-cork {
    background:
        radial-gradient(circle, transparent 40%, rgba(30, 15, 6, 0.45) 100%),
        url('../../images/platters/natural-cork.webp') center/cover no-repeat;
    border: 2px solid #854d24;
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.3);
}
.swatch-preview-platter-tree-stump {
    background:
        radial-gradient(
            circle at center,
            transparent 55%,
            rgba(220, 175, 120, 0.4) 70%,
            rgba(165, 110, 55, 0.7) 85%,
            #24150c 100%
        ),
        radial-gradient(circle at center, #2e1205 0px, #4a1c07 3px, #1a0802 4px, transparent 8px),
        repeating-radial-gradient(
            circle at center,
            transparent 0px,
            transparent 4px,
            rgba(25, 9, 3, 0.45) 5px,
            rgba(225, 165, 95, 0.2) 5.8px,
            transparent 7.5px
        ),
        repeating-radial-gradient(
            circle at center,
            transparent 0px,
            transparent 1.5px,
            rgba(40, 16, 5, 0.3) 2px,
            transparent 3px
        ),
        radial-gradient(circle at center, #9e531b 0%, #6e3a15 70%, #200d04 100%);
    border: 2px solid #24150c;
    box-shadow: 0 0 0 1px #4a2f1b;
}
.swatch-preview-platter-carbon {
    background: repeating-linear-gradient(45deg, #1e293b 0px, #1e293b 2px, #0f172a 2px, #0f172a 4px);
    border: 2px solid #334155;
    box-shadow:
        0 0 8px rgba(239, 68, 68, 0.35),
        inset 0 0 0 1px rgba(239, 68, 68, 0.5);
}
.swatch-preview-record-black {
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 55%, #020408 100%);
    border: 2px solid #334155;
    box-shadow:
        0 0 8px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.swatch-preview-record-raven {
    background: url('../../images/platters/zoetrope-raven-thumb.jpg') center/cover no-repeat;
    border: 2px solid rgba(220, 163, 66, 0.5);
    box-shadow:
        0 0 8px rgba(220, 163, 66, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.swatch-preview-record-kinetic {
    background: url('../../images/platters/zoetrope-kinetic.svg') center/cover no-repeat;
    border: 2px solid rgba(56, 189, 248, 0.5);
    box-shadow:
        0 0 8px rgba(56, 189, 248, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.swatch-preview-record-custom {
    background: radial-gradient(circle at center, #1e293b 0%, #0d121c 100%);
    border: 2px dashed rgba(220, 163, 66, 0.6);
    box-shadow: 0 0 8px rgba(220, 163, 66, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}
.swatch-preview-record-custom::after {
    content: '\f0ee';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.95rem;
    color: var(--accent-brand-light, #f5cf7e);
}
.swatch-preview-platter-zoetrope {
    background: url('../../images/platters/zoetrope-kinetic.svg') center/cover no-repeat;
    border: 2px solid #0284c7;
    box-shadow:
        0 0 8px rgba(56, 189, 248, 0.4),
        inset 0 0 0 1px rgba(56, 189, 248, 0.5);
}
.swatch-preview-platter-raven {
    background: url('../../images/platters/zoetrope-raven-thumb.jpg') center/cover no-repeat;
    border: 2px solid #78716c;
    box-shadow:
        0 0 8px rgba(214, 211, 209, 0.35),
        inset 0 0 0 1px rgba(245, 245, 244, 0.4);
}
.swatch-preview-platter-checkerboard {
    background: url('../../images/platters/technics-checkerboard.svg') center/cover no-repeat;
    border: 2px solid #64748b;
    box-shadow:
        0 0 8px rgba(148, 163, 184, 0.35),
        inset 0 0 0 1px rgba(203, 213, 225, 0.5);
}
.swatch-preview-platter-mandala {
    background: url('../../images/platters/moroccan-mandala.svg') center/cover no-repeat;
    border: 2px solid #854d0e;
    box-shadow:
        0 0 8px rgba(212, 175, 55, 0.4),
        inset 0 0 0 1px rgba(20, 184, 166, 0.6);
}
.swatch-preview-platter-zellij {
    background: url('../../images/platters/moroccan-zellij-knotwork.svg') center/cover no-repeat;
    border: 2px solid #78350f;
    box-shadow:
        0 0 8px rgba(245, 158, 11, 0.4),
        inset 0 0 0 1px rgba(13, 148, 136, 0.6);
}
.swatch-preview-platter-flower {
    background: url('../../images/platters/moroccan-flower-of-life.svg') center/cover no-repeat;
    border: 2px solid #0f766e;
    box-shadow:
        0 0 8px rgba(94, 234, 212, 0.4),
        inset 0 0 0 1px rgba(20, 184, 166, 0.6);
}
.swatch-preview-platter-brass-tray {
    background: url('../../images/platters/moroccan-brass-tray.svg') center/cover no-repeat;
    border: 2px solid #a16207;
    box-shadow:
        0 0 8px rgba(254, 240, 138, 0.4),
        inset 0 0 0 1px rgba(234, 179, 8, 0.6);
}
.swatch-preview-platter-sunburst {
    background: url('../../images/platters/artdeco-sunburst.svg') center/cover no-repeat;
    border: 2px solid #b58739;
    box-shadow:
        0 0 8px rgba(250, 224, 130, 0.4),
        inset 0 0 0 1px rgba(212, 175, 55, 0.6);
}

/* Tonearm Model Selection List */
.studio-tonearm-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.studio-tonearm-card {
    position: relative;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.25s ease;

    &:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(240, 205, 145, 0.35);
        transform: translateX(3px);
    }

    &.is-active {
        background: rgba(220, 163, 66, 0.12);
        border-color: var(--accent-brand);
        box-shadow: 0 0 16px rgba(220, 163, 66, 0.2);

        .tonearm-name {
            color: var(--accent-brand-light);
            font-weight: 700;
        }

        .tonearm-tag {
            background: var(--accent-brand);
            color: #0c0704;
            font-weight: 800;
        }

        .arm-check {
            opacity: 1;
            transform: scale(1);
        }
    }

    .tonearm-info {
        display: flex;
        align-items: center;
        gap: var(--space-5);

        .tonearm-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-subtle);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent-brand);
            font-size: var(--fs-xl);
        }

        .tonearm-name {
            font-family: var(--font-display);
            font-size: var(--fs-xl);
            font-weight: 600;
            color: var(--text-primary);
        }

        .tonearm-era {
            font-family: var(--font-mono);
            font-size: var(--fs-2xs);
            color: var(--text-muted);
        }
    }

    .tonearm-meta {
        display: flex;
        align-items: center;
        gap: var(--space-3);

        .tonearm-tag {
            font-family: var(--font-mono);
            font-size: 0.62rem;
            padding: 2px 7px;
            border-radius: var(--radius-full);
            background: rgba(255, 255, 255, 0.07);
            color: var(--text-secondary);
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .arm-check {
            opacity: 0;
            transform: scale(0.6);
            color: var(--accent-brand);
            font-size: var(--fs-md);
            transition:
                background-color,
                border-color,
                color,
                box-shadow,
                transform,
                opacity,
                border-radius,
                filter,
                outline-color,
                text-shadow 0.2s ease;
        }
    }
}

/* 45 RPM Adapter Grid */
.studio-adapter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.studio-adapter-card {
    position: relative;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.25s ease;

    &:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(240, 205, 145, 0.35);
        transform: translateY(-2px);
    }

    &.is-active {
        background: rgba(220, 163, 66, 0.12);
        border-color: var(--accent-brand);
        box-shadow: 0 0 16px rgba(220, 163, 66, 0.2);

        .adapter-name {
            color: var(--accent-brand-light);
            font-weight: 700;
        }

        .adapter-check {
            opacity: 1;
            transform: scale(1);
        }
    }

    .adapter-thumb {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.4);
        border: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;

        img {
            width: 24px;
            height: 24px;
            object-fit: contain;
        }
    }

    .adapter-info {
        flex: 1;
        min-width: 0;

        .adapter-name {
            font-family: var(--font-display);
            font-size: var(--fs-lg);
            font-weight: 600;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .adapter-sub {
            font-family: var(--font-mono);
            font-size: var(--fs-2xs);
            color: var(--text-muted);
        }
    }

    .adapter-check {
        opacity: 0;
        transform: scale(0.6);
        color: var(--accent-brand);
        font-size: var(--fs-md);
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;
    }
}

/* Studio Drawer Footer */
.studio-drawer-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);

    .btn-reset-studio {
        font-family: var(--font-mono);
        font-size: var(--fs-md);
        color: var(--text-muted);
        background: transparent;
        border: none;
        cursor: pointer;
        transition: color 0.2s ease;

        &:hover {
            color: var(--accent-apple);
        }
    }

    .btn-done-studio {
        font-family: var(--font-display);
        font-size: var(--fs-xl);
        font-weight: 700;
        background: linear-gradient(135deg, var(--accent-brand), #9a651a);
        color: #fff;
        padding: 8px 20px;
        border-radius: var(--radius-full);
        box-shadow: 0 4px 14px var(--accent-glow);
        cursor: pointer;
        transition:
            background-color,
            border-color,
            color,
            box-shadow,
            transform,
            opacity,
            border-radius,
            filter,
            outline-color,
            text-shadow 0.2s ease;

        &:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px var(--accent-glow);
        }
    }
}

/* Top Nav Deck Studio Button */
.studio-layout-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.btn-studio-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 8px);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color,
        border-color,
        color,
        box-shadow,
        transform,
        opacity,
        border-radius,
        filter,
        outline-color,
        text-shadow 0.2s ease;
}

.btn-studio-layout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: var(--border-highlight);
}

.btn-studio-layout.is-active {
    background: rgba(220, 163, 66, 0.14);
    border-color: var(--accent-brand);
    color: var(--accent-brand-light);
    box-shadow: 0 0 12px rgba(220, 163, 66, 0.2);
}

@media (max-width: 620px) {
    .turntable-studio-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .studio-plinth-grid,
    .studio-platter-grid,
    .studio-adapter-grid {
        grid-template-columns: 1fr;
    }
}


/* 7. Active Listening Stage Companion (Sleeve Flip, Liner Notes, Lyrics) */
/* ==========================================================================
   ACTIVE LISTENING STAGE COMPANION (SLEEVE, LINER NOTES, LYRICS, FLIP)
   ========================================================================== */

/* Desktop Stage Carousel Reset */
@media (min-width: 768px) and (pointer: fine) {
    .stage-carousel-track {
        display: block;
        width: 100%;
        height: 100%;
        position: relative;
    }

    .slide-stage-turntable {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

    .slide-stage-lyrics,
    .slide-stage-sleeve,
    .slide-stage-video {
        display: none !important;
    }
}

/* Stage Companion Overlay (Integrated into turntable plinth and table background) */
.turntable-platter-well.has-stage-companion,
.turntable-platter-well[data-platter-style].has-stage-companion {
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    background: transparent !important;
}

.turntable-platter-well.has-stage-companion .turntable-platter-rotator,
.turntable-platter-well.has-stage-companion .turntable-platter-lighting,
.turntable-platter-well.has-stage-companion .vinyl-stage,
.turntable-platter-well.has-stage-companion .tonearm-assembly,
.turntable-platter-well.has-stage-companion .platter-drop-target {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.turntable-platter-well.has-stage-companion::before,
.turntable-platter-well.has-stage-companion::after,
.turntable-platter-well[data-platter-style].has-stage-companion::before,
.turntable-platter-well[data-platter-style].has-stage-companion::after {
    display: none !important;
    opacity: 0 !important;
}

/* When companion (sleeve/lyrics) is active on the turntable plinth, hide the turntable hardware switch bar */
.turntable-plinth-housing:has(.turntable-platter-well.has-stage-companion) .plinth-hardware-bar,
.turntable-plinth-housing:has(.stage-companion-overlay.is-active) .plinth-hardware-bar {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.stage-companion-overlay {
    position: absolute;
    inset: 0;
    z-index: 45;
    background: transparent;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    box-shadow: none;

    &.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Top Companion Action Bar */
    .stage-companion-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 2;
    }

    .stage-companion-tabs {
        display: flex;
        align-items: center;
        gap: var(--space-2);
    }

    .stage-tab-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--text-muted, #94a3b8);
        padding: 5px 12px;
        border-radius: var(--radius-full, 9999px);
        font-size: var(--fs-sm);
        font-weight: 700;
        letter-spacing: 0.03em;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;

        &:hover {
            color: #fff;
            border-color: rgba(255, 255, 255, 0.25);
            background: rgba(255, 255, 255, 0.06);
        }
    }

    &[data-view='sleeve'] .stage-tab-btn[data-mode='sleeve'],
    &[data-view='lyrics'] .stage-tab-btn[data-mode='lyrics'] {
        background: var(--accent-gold-gradient, linear-gradient(135deg, #dca342, #b8862d));
        color: #0b0c10;
        border-color: transparent;
        box-shadow: 0 2px 8px rgba(220, 163, 66, 0.3);
    }

    .stage-companion-close {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--text-muted, #94a3b8);
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: var(--fs-lg);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;

        &:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.15);
            transform: scale(1.05);
        }
    }




}

/* 3D 12" Vinyl Jacket Flip Experience */
.stage-sleeve-perspective {
    width: 100%;
    height: 100%;
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theater-sleeve-jacket {
    width: var(--theater-jacket-size);
    height: var(--theater-jacket-size);
    max-width: 100%;
    margin: 0 auto;
}

.stage-sleeve-jacket {
    width: clamp(280px, min(86%, calc(100vh - 340px)), 460px);
    aspect-ratio: 1 / 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;

    &.is-flipped {
        transform: rotateY(180deg);
    }

    &:hover .stage-sleeve-flip-hint {
        opacity: 1;
        transform: scale(1.05);
    }
}

.stage-sleeve-front,
.stage-sleeve-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0;
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.stage-sleeve-front {
    background: #000;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
}

.stage-sleeve-flip-hint {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.85;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

/* Back Cover / Gatefold Liner Notes Card */
.stage-sleeve-back {
    transform: rotateY(180deg);
    position: relative;
    background-color: #0f1218;
    background-image:
        linear-gradient(160deg, rgba(10, 14, 22, 0.84) 0%, rgba(6, 8, 12, 0.94) 100%), var(--jacket-art-url, none);
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
    overflow: hidden;

    /* Mirrored (horizontally flipped) blurred cover art layer */
    &::after {
        content: '';
        position: absolute;
        inset: -15px; /* Slight bleed to avoid edge cutoffs when blurred */
        background-image: var(--jacket-art-url, none);
        background-size: cover;
        background-position: center;
        transform: scaleX(-1); /* Horizontally flipped to match physical back cover perspective */
        filter: blur(0) saturate(140%) brightness(0.4);
        -webkit-filter: blur(0) saturate(140%) brightness(0.4);
        z-index: 0;
        pointer-events: none;
    }

    &::before {
        content: '';
        position: absolute;
        inset: 0;
        background:
            linear-gradient(160deg, rgba(10, 14, 22, 0.75) 0%, rgba(6, 8, 12, 0.88) 100%),
            radial-gradient(circle at 50% 20%, rgba(220, 163, 66, 0.08) 0%, transparent 60%);
        pointer-events: none;
        z-index: 1;
    }

    > * {
        position: relative;
        z-index: 2;
    }

    .stage-sleeve-back-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: var(--space-4);
        margin-bottom: var(--space-5);
    }

    .stage-sleeve-eyebrow {
        font-size: var(--fs-2xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--accent-gold, #dca342);
        display: block;
        margin-bottom: 3px;
    }

    .stage-sleeve-title {
        font-size: 1.05rem;
        font-weight: 800;
        color: #fff;
        margin: 0;
        line-height: 1.25;
    }

    .stage-sleeve-artist {
        font-size: 0.78rem;
        color: var(--text-muted, #94a3b8);
        display: block;
        margin-top: 2px;
    }

    .stage-sleeve-notes-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        font-size: var(--fs-lg);
        line-height: 1.55;
        color: rgba(255, 255, 255, 0.82);
        padding-right: var(--space-2);

        p {
            margin: 0 0 10px 0;
        }
    }

    /* Back-face hint participates in the card flow instead of overlaying the notes. */
    .stage-sleeve-flip-hint {
        position: static;
        margin-top: var(--space-3);
        align-self: flex-end;
    }
}

/* Custom Scrollbar for Notes & Lyrics */
.stage-sleeve-notes-body,
.stage-lyrics-body {
    &::-webkit-scrollbar {
        width: 5px;
    }

    &::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.16);
        border-radius: 4px;
    }
}

/* Empty Notes Placeholder */
.stage-empty-notes {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 24px;
    color: var(--text-muted, #94a3b8);

    i {
        font-size: 1.8rem;
        margin-bottom: var(--space-4);
        color: rgba(255, 255, 255, 0.25);
    }

    p {
        font-size: 0.84rem;
        margin: 0 0 6px 0;
        color: rgba(255, 255, 255, 0.7);
    }
}

.stage-sub-hint {
    font-size: var(--fs-sm);
    color: rgba(255, 255, 255, 0.4);
    max-width: 260px;
}

/* Lyrics & Track Commentary View */
.stage-lyrics-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: var(--space-4);
    margin-bottom: 14px;
}

.stage-lyrics-track-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 2px 0;
}

.stage-lyrics-track-artist {
    font-size: var(--fs-lg);
    color: var(--text-muted, #94a3b8);
}

.stage-lyrics-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    padding: 10px 4px 60px 4px;
    scroll-behavior: smooth;
}

/* Synced LRC Lyrics List */
.stage-synced-lyrics-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    padding: 36px 10px 60px 10px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;

    /* Individual Lyric Line */
    .stage-lyric-line {
        font-size: 1.05rem;
        font-weight: 600;
        line-height: 1.45;
        text-align: center;
        color: rgba(255, 255, 255, 0.35);
        cursor: pointer;
        padding: 8px 16px;
        border-radius: 8px;
        transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        user-select: none;
        -webkit-user-select: none;
        max-width: 90%;

        &:hover {
            color: rgba(255, 255, 255, 0.75);
            background: rgba(255, 255, 255, 0.05);
        }

        /* Active Center Spotlight (Option A) */
        &.is-active {
            font-size: 1.15rem;
            font-weight: 800;
            color: #fff;
            text-shadow:
                0 1px 3px rgba(0, 0, 0, 0.8),
                0 0 12px rgba(0, 0, 0, 0.35);
            background: rgba(0, 0, 0, 0.6);
            border: 1px solid rgba(220, 163, 66, 0.35);
            transform: none;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);

            &::before {
                content: '';
                position: absolute;
                left: -12px;
                top: 50%;
                transform: translateY(-50%);
                width: 4px;
                height: 18px;
                background: var(--accent-gold, #dca342);
                border-radius: 4px;
                box-shadow: 0 0 8px #dca342;
            }
        }

        /* Past lines fade to 30% opacity */
        &.is-past {
            color: rgba(255, 255, 255, 0.25);
        }
    }
}

/* Lyric fetch / sync status bar */
.stage-lyrics-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: var(--space-3);
    padding: 0 4px;
    gap: var(--space-3);

    .stage-lyrics-meta-left {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        flex-wrap: wrap;
    }

    .stage-lyrics-meta-right {
        display: flex;
        align-items: center;
        gap: var(--space-3);
    }

    .stage-lyrics-source-tag {
        font-size: var(--fs-2xs);
        color: rgba(255, 255, 255, 0.4);
        letter-spacing: 0.02em;
    }

    .stage-lyrics-refresh-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--text-muted, #94a3b8);
        font-size: var(--fs-2xs);
        font-weight: 600;
        padding: 2px 7px;
        border-radius: 4px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;

        &:hover {
            color: var(--accent-gold, #dca342);
            border-color: rgba(220, 163, 66, 0.4);
            background: rgba(220, 163, 66, 0.1);
        }
    }

    .stage-lyrics-badge {
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);
        padding: 2px 8px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.06);
        font-size: var(--fs-2xs);
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;

        &.is-synced {
            background: rgba(220, 163, 66, 0.15);
            color: var(--accent-gold, #dca342);
            border: 1px solid rgba(220, 163, 66, 0.3);
        }
    }
}

/* Lyrics Timing Offset Controller (Stage & Theater) */
.stage-lyrics-meta-center,
.theater-lyrics-meta-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lyrics-offset-controller {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(20, 20, 20, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2px 5px;
    backdrop-filter: blur(4px);
    user-select: none;

    .lyrics-offset-btn {
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.65);
        width: 20px;
        height: 20px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.62rem;
        cursor: pointer;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

        &:hover {
            background: rgba(255, 255, 255, 0.15);
            color: #fff;
        }

        &:active {
            transform: scale(0.9);
        }
    }

    .lyrics-offset-pill {
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.65);
        font-size: var(--fs-xs);
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        padding: 2px 6px;
        border-radius: 12px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.15s ease;

        i {
            font-size: 0.62rem;
            opacity: 0.75;
        }

        &:hover {
            background: rgba(255, 255, 255, 0.1);
            color: #fff;
        }

        &.has-offset {
            color: var(--accent-gold, #dca342);
            background: rgba(220, 163, 66, 0.15);
            border: 1px solid rgba(220, 163, 66, 0.3);

            &:hover {
                background: rgba(220, 163, 66, 0.25);
                color: #fff;
            }
        }
    }
}

.stage-lyrics-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--fs-xl);

    i {
        font-size: 1.8rem;
        color: var(--accent-gold, #dca342);
    }
}

.stage-lyrics-text {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #fff;
    font-family: var(--font-body, system-ui, -apple-system, sans-serif);
    font-weight: 500;
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

.stage-track-note-card {
    background: rgba(220, 163, 66, 0.08);
    border: 1px solid rgba(220, 163, 66, 0.25);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: var(--space-6);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;

    .stage-note-badge {
        font-size: var(--fs-2xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--accent-gold, #dca342);
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);
        margin-bottom: var(--space-2);
    }

    p {
        font-size: 0.82rem;
        color: rgba(255, 255, 255, 0.88);
        line-height: 1.5;
        margin: 0;
    }
}

/* ==========================================================================
   FOCUS MODE (app-shell): the stage full-bleed — the single "theater" presentation.
   ========================================================================== */

/* FOCUS MODE (app-shell step 4a): the stage full-bleed — site nav + library hidden,
   the stage fills the viewport above the player bar. This is "theater" expressed as a
   presentation of the SAME stage (no plinth move, no second content copy). The expand
   button toggles it; a close button (in the stage top bar) exits. */
body.is-stage-focus {
    overflow: hidden !important;

    .site-nav {
        display: none !important;
    }

    .chronicle-hero-wrapper {
        display: block !important;
        margin-bottom: var(--player-bar-height) !important;
    }

    .console-tracklist-bay {
        display: none !important;
    }

    .app-main {
        width: 100% !important;
        height: 100% !important;
    }
}

/* SHARED COMPANION CONTENT: applies to the side companion bay, so the content
   (pane switcher, views, meta bar, lyrics river, lines) is defined once. */
.console-companion-bay {
    /* Wing Content: Pane Switcher (Lyrics vs Album Sleeve) */
    .theater-stage-nav {
        display: inline-flex;
        align-items: center;
        align-self: center;
        flex-shrink: 0;
        margin-top: 18px;
        background: rgba(18, 22, 32, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: var(--space-1);
        border-radius: var(--radius-full);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.08);
        gap: var(--space-1);
    }

    .theater-nav-pill {
        display: inline-flex;
        align-items: center;
        gap: var(--space-3);
        padding: 7px 18px;
        border-radius: var(--radius-full);
        background: transparent;
        border: 1px solid transparent;
        color: rgba(255, 255, 255, 0.65);
        font-size: 0.82rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        cursor: pointer;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        white-space: nowrap;
        user-select: none;

        i {
            font-size: var(--fs-xl);
            opacity: 0.8;
            transition:
                transform 0.2s ease,
                opacity 0.2s ease;
        }

        &:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.12);

            i {
                transform: scale(1.1);
                opacity: 1;
            }
        }

        &.is-active {
            background: var(--accent-gold-gradient, linear-gradient(135deg, #dca342, #b8862d));
            color: #0b0c10;
            border-color: rgba(255, 255, 255, 0.25);
            font-weight: 700;
            box-shadow:
                0 3px 12px rgba(220, 163, 66, 0.38),
                inset 0 1px 1px rgba(255, 255, 255, 0.4);

            i {
                color: #0b0c10;
                opacity: 1;
            }
        }
    }

    /* Wing Content: Views */
    .theater-view-lyrics {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 18px 36px;
        overflow: hidden;
        width: 100%;
        max-width: 860px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .theater-view-sleeve {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        overflow: hidden;
        width: 100%;
    }

    .theater-view-video {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px;
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
        /* Query container so the frame can size itself against the available
           height (cqh) as well as the width. */
        container-type: size;
        overflow: visible; /* so box-shadow doesn't get clipped */
    }

    .theater-video-screen-frame {
        position: relative;
        flex: none;
        /* Fallback for engines without container query units. */
        width: 100%;
        /* Size the frame against the container height (cqh) so taller ratios
           (4:3) shrink in width instead of overflowing into the tonearm/plinth
           area, while remaining capped by the container width and the 960px
           design maximum. */
        width: min(960px, 100%, calc(100cqh * var(--video-aspect-number, 1.7778)));
        aspect-ratio: var(--video-aspect-ratio, 16 / 9);
        max-height: 100%;
        /* Squared-off screen: no rounded corners (also keeps the shadow from
           filling in the corners and reading as a hard rectangle). */
        border-radius: 0;
        overflow: hidden;
        background: #000;
        /* Soft, diffused shadow — layered blur with no crisp ring */
        box-shadow:
            0 2px 6px rgba(0, 0, 0, 0.45),
            0 10px 26px rgba(0, 0, 0, 0.45),
            0 22px 50px rgba(0, 0, 0, 0.26);

        iframe {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            border: 0;
        }
    }

    /* Fullscreen toggle overlaid on the theater video frame (lower-right, auto-hide) */
    .theater-video-fullscreen-btn {
        position: absolute;
        bottom: 12px;
        right: 12px;
        z-index: 3;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.45);
        color: rgba(255, 255, 255, 0.92);
        cursor: pointer;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        transition:
            background 0.2s ease,
            color 0.2s ease,
            opacity 0.25s ease;

        /* Hidden until mouse activity reveals it (JS-driven, not :hover —
           :hover is permanently true in fullscreen where the frame fills the viewport) */
        opacity: 0;

        &.is-visible {
            opacity: 1;
        }

        &:hover {
            background: rgba(0, 0, 0, 0.7);
        }

        &:active {
            background: rgba(0, 0, 0, 0.85);
        }

        svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 2.3;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
    }

    .theater-video-screen-frame:fullscreen,
    .theater-video-screen-frame:-webkit-full-screen {
        max-width: none;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
        aspect-ratio: auto;
        background: #000;
    }

    .theater-video-screen-frame:fullscreen .theater-video-fullscreen-btn,
    .theater-video-screen-frame:-webkit-full-screen .theater-video-fullscreen-btn {
        bottom: 16px;
        right: 16px;
    }

    /* Hide the cursor when idle in fullscreen for an unobstructed view */
    .theater-video-screen-frame.is-cursor-idle,
    .theater-video-screen-frame.is-cursor-idle * {
        cursor: none !important;
    }

    /* Show expand icon normally, collapse icon while fullscreen */
    .theater-video-icon-collapse {
        display: none;
    }

    .theater-video-screen-frame:fullscreen .theater-video-icon-expand,
    .theater-video-screen-frame:-webkit-full-screen .theater-video-icon-expand,
    .theater-video-screen-frame.is-fullscreen .theater-video-icon-expand {
        display: none;
    }

    .theater-video-screen-frame:fullscreen .theater-video-icon-collapse,
    .theater-video-screen-frame:-webkit-full-screen .theater-video-icon-collapse,
    .theater-video-screen-frame.is-fullscreen .theater-video-icon-collapse {
        display: block;
    }
}

/* CSS faux fullscreen (iOS Safari has no element fullscreen API). Toggled by
   toggleVideoFullscreen when requestFullscreen is unavailable or rejects. */
.stage-video-screen-frame.is-faux-fullscreen,
.theater-video-screen-frame.is-faux-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    aspect-ratio: auto !important;
    background: transparent !important;
    z-index: 100000 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Opaque black backdrop BEHIND the iframe (the frame background itself paints
   over the absolute iframe on iOS, so use a ::before at z-index 0 and keep the
   iframe at z-index 1 above it). */
.stage-video-screen-frame.is-faux-fullscreen::before,
.theater-video-screen-frame.is-faux-fullscreen::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #000;
    z-index: 0;
}

/* Keep the iframe at the video's aspect ratio, centered (letterbox) so the full
   content is visible in portrait — the YouTube widget sizes it to the video ratio. */
.stage-video-screen-frame.is-faux-fullscreen > iframe,
.theater-video-screen-frame.is-faux-fullscreen > iframe {
    position: absolute !important;
    inset: 0 !important;
    margin: auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: var(--video-aspect-ratio, 16 / 9) !important;
    border: 0 !important;
    z-index: 1 !important;
}

/* The faux frame is position:fixed but nested inside the carousel track/slide,
   which are overflow scroll containers. iOS clips a fixed descendant to the
   scrollport, so the slide/track background peeks through as thin strips at the
   top/bottom edges. Neutralize their overflow (and the slide padding) while faux
   is active so the fixed frame bleeds to the exact viewport edges. */
body.is-video-faux-fullscreen .stage-carousel-track,
body.is-video-faux-fullscreen .stage-carousel-slide {
    overflow: visible !important;
    padding: 0 !important;
}

/* iOS Safari paints fixed layers (the faux video with its cross-origin iframe)
   below the fixed bars regardless of z-index / backdrop-filter. Hide the bars
   outright while faux fullscreen is active so they can't paint over the video. */
body.is-video-faux-fullscreen .site-nav,
body.is-video-faux-fullscreen .deck-title-row,
body.is-video-faux-fullscreen .bottom-player-bar,
body.is-video-faux-fullscreen .mobile-bottom-app-bar {
    display: none !important;
}

/* The faux frame is fixed/full-viewport, but the hero wrapper keeps its
   player-bar-height bottom margin (the bar is hidden in faux) — zero it so there's
   no 120px gap under the stage. */
body.is-video-faux-fullscreen .chronicle-hero-wrapper {
    margin-bottom: 0 !important;
}

/* Transparent tap-capture over the inline iframe: YouTube's own center play/pause
   button is dead to taps (cross-origin), so this layer toggles playback through our
   transport instead. Disabled in faux fullscreen (the video plays there; the contract
   control is the exit). */
.stage-video-tap-capture {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
}

/* Full screen covers everything (header + player bar). The exit is the contract
   control in the lower-right; it auto-hides after inactivity and reappears on tap
   (via the .is-visible class). */
body.is-video-faux-fullscreen .stage-video-screen-frame.is-faux-fullscreen .stage-video-fullscreen-btn,
body.is-video-faux-fullscreen .theater-video-screen-frame.is-faux-fullscreen .theater-video-fullscreen-btn {
    z-index: 2 !important;
    top: auto !important;
    right: 16px !important;
    bottom: 16px !important;
    left: auto !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.is-video-faux-fullscreen .stage-video-screen-frame.is-faux-fullscreen .stage-video-fullscreen-btn.is-visible,
body.is-video-faux-fullscreen .theater-video-screen-frame.is-faux-fullscreen .theater-video-fullscreen-btn.is-visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

    .theater-lyrics-meta-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        font-size: var(--fs-md);
        color: rgba(255, 255, 255, 0.5);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding-bottom: var(--space-5);
    }

    .theater-lyrics-meta-left,
    .theater-lyrics-meta-right {
        display: flex;
        align-items: center;
        gap: var(--space-5);
    }

    .theater-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 3px 10px;
        border-radius: 10px;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.8);

        &.is-synced {
            background: rgba(220, 163, 66, 0.16);
            color: var(--accent-gold, #dca342);
            border: 1px solid rgba(220, 163, 66, 0.3);
        }
    }

    .theater-source-tag {
        font-size: var(--fs-sm);
        color: rgba(255, 255, 255, 0.4);
    }

    .theater-cue-tip {
        font-size: var(--fs-sm);
        color: rgba(255, 255, 255, 0.45);
    }

    .theater-refresh-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.14);
        color: rgba(255, 255, 255, 0.7);
        padding: 3px 10px;
        border-radius: 6px;
        font-size: var(--fs-sm);
        cursor: pointer;
        transition: background-color, border-color, color, box-shadow, transform, opacity, border-radius, filter, outline-color, text-shadow 0.2s ease;

        &:hover {
            color: #fff;
            border-color: rgba(255, 255, 255, 0.35);
            background: rgba(255, 255, 255, 0.08);
        }
    }

    /* --------------------------------------------------------------------------
       KINETIC LYRIC FLOW & JUICE WRLD VAULT SWIPE REVEAL
       -------------------------------------------------------------------------- */
    .theater-lyrics-river {
        flex: 1;
        min-height: 0;
        position: relative;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
        padding: 85px 16px 180px 16px;
        display: flex;
        flex-direction: column;
        gap: 24px;
        mask-image: linear-gradient(180deg, transparent 0%, black 8%, black 88%, transparent 100%);
        -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 8%, black 88%, transparent 100%);

        &::-webkit-scrollbar {
            width: 6px;
        }

        &::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.14);
            border-radius: 3px;
        }
    }

    /* Individual Kinetic Lyric Line (Juice WRLD Vault Clean Flow) */
    .theater-lyric-line {
        font-family: var(--font-body, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
        font-size: clamp(1.4rem, 2.2vw, 1.85rem);
        font-weight: 700;
        line-height: 1.45;
        letter-spacing: -0.015em;
        cursor: pointer;
        color: rgba(255, 255, 255, 0.28); /* default dimmed state */
        user-select: none;
        padding: 4px 0;
        position: relative;
        transition:
            color 0.25s ease,
            opacity 0.25s ease;

        &:hover {
            color: rgba(255, 255, 255, 0.65);
        }

        /* Active Line: Clean, Crisp Solid White Transition (No multi-line wrap clipping or premature highlight) */
        &.is-active {
            font-size: clamp(1.4rem, 2.2vw, 1.85rem);
            font-weight: 800;
            color: #ffffff;
            opacity: 1;
            transform: none;
            text-shadow: none;
            background: none;
            -webkit-text-fill-color: initial;
            animation: none;
        }

        /* Past lines fade smoothly */
        &.is-past {
            color: rgba(255, 255, 255, 0.22);
            font-size: clamp(1.4rem, 2.2vw, 1.85rem);
            opacity: 0.6;
            background: none;
            -webkit-text-fill-color: initial;
        }
    }
}

/* Calibration Mode: Visual cues when Shift is held to align lyrics */
body.is-lyrics-shift-held {
    .stage-lyric-line,
    .theater-lyric-line {
        cursor: crosshair;
    }

    .stage-lyric-line:hover,
    .theater-lyric-line:hover {
        color: var(--accent-gold, #dca342);
        text-shadow: 0 0 12px rgba(220, 163, 66, 0.4);
        background: rgba(220, 163, 66, 0.08);
        border-radius: 6px;
    }
}



/* 8. React ledger component styles (empty states, catalogue search, playlists).
   Loads after the media-library manifest so a few same-specificity rules win
   by source order. (CSS-005: former ledger-overrides.css.) */
/* ==========================================================================
   REACT LEDGER COMPONENT STYLES (CSS-005)
   Styles for the React ledger UI (empty states, catalogue search, playlist
   cards, queue timeline, options menus) authored in src/components/ledger/*.
   These classes have no vanilla-CSS counterpart; they live here so all
   React-ledger styling is discoverable in one place. Loaded after the
   media-library manifest so a few same-specificity rules (e.g. queue section
   accents) win by source order without needing `!important`.
   ========================================================================== */

.ledger-empty-pad-xl {
    padding: 48px 16px;
}
.ledger-empty-pad-md {
    padding: 36px 16px;
}

/* ---- Ledger empty state: leading glyph ---- */
.ledger-empty-badge {
    display: block;
    margin-bottom: var(--space-5);
    font-size: 1.8rem;
    opacity: 0.8;
}

.ledger-empty-badge.is-online {
    color: #38bdf8;
}
.ledger-empty-badge.is-local {
    color: var(--accent-brand-light);
}

.ledger-empty-badge.is-search {
    color: var(--accent-brand-light);
    font-size: 1.6rem;
    opacity: 0.7;
}

/* ---- Ledger empty state: heading + copy ---- */
.ledger-empty-heading {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: var(--space-2);
}

.ledger-empty-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: var(--space-6);
}

.ledger-empty-copy.is-constrained {
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

/* ---- Ledger empty state: pill action buttons ---- */
.ledger-empty-action {
    background: rgba(220, 163, 66, 0.15);
    border: 1px solid rgba(220, 163, 66, 0.35);
    color: var(--accent-brand-light);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: var(--fs-md);
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
}

.ledger-empty-action.is-folder {
    padding: 6px 16px;
}


/* ---- Catalogue library options menu ---- */
.add-to-playlist-popup .ledger-options-body {
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.ledger-options-divider {
    margin: 4px 0;
}

.playlist-popup-item.ledger-options-online {
    color: #38bdf8;
}
.playlist-popup-item.ledger-options-online i {
    color: #38bdf8;
}

.playlist-popup-item.ledger-options-danger {
    color: #f87171;
}
.playlist-popup-item.ledger-options-danger i {
    color: #f87171;
}

/* Disabled "file missing" row (CSS-015: was inline style). */
.playlist-popup-item.is-missing {
    opacity: 0.6;
    cursor: default;
    font-size: var(--fs-md);
    color: #f87171;
    pointer-events: none;
}

/* Active-state icon colours (CSS-015: were conditional inline styles). */
.playlist-popup-item i.is-favorite {
    color: #ef4444;
}
.playlist-popup-item i.is-locked {
    color: var(--accent-brand-light);
}

.ledger-options-link {
    text-decoration: none;
}

.vrp-track-options-popup .playlist-popup-body,
.vrp-library-options-popup .playlist-popup-body {
    max-height: min(420px, calc(100vh - 40px));
}




.ledger-search-note {
    padding: 24px 16px;
    font-size: 0.76rem;
}


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

.pl-empty-actions {
    margin-top: 14px;
}

.pl-btn-compact {
    padding: 7px 18px;
    font-size: var(--fs-md);
}

.pl-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
}

/* Drawer notes (padding/font-size vary by empty reason) */
.pl-note-session {
    padding: 24px 16px;
    font-size: 0.76rem;
}
.pl-note-query {
    padding: 18px 16px;
    font-size: var(--fs-md);
}
.pl-note-liked {
    padding: 20px 16px;
    font-size: var(--fs-md);
}
.pl-note-empty {
    padding: var(--space-5);
}

.pl-note-icon {
    margin-right: var(--space-2);
    color: var(--accent-brand);
}
.pl-note-icon-heart {
    margin-right: var(--space-2);
    color: #f43f5e;
}

/* Queue history / now-playing accents */
.pl-history-icon {
    font-size: 0.7rem;
    opacity: 0.7;
}
.pl-history-time {
    font-size: var(--fs-xs);
    opacity: 0.6;
    margin-right: var(--space-1);
}
.pl-dim {
    opacity: 0.6;
}
.pl-accent {
    color: var(--accent-brand);
}
.pl-accent-strong {
    color: var(--accent-brand);
    font-weight: 700;
}
.pl-flex {
    display: flex;
}

.ledger-row-gap8 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.ledger-row-gap6 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.pl-queue-num {
    font-size: var(--fs-2xs);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.pl-icon-gap-sm {
    margin-right: var(--space-1);
}

/* Playlist header badges */
.pl-fav-icon {
    color: #f43f5e;
    font-size: var(--fs-lg);
}
.pl-queue-icon {
    color: var(--accent-cyan);
    font-size: var(--fs-lg);
}

.pl-badge {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.pl-badge-fav {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #f43f5e;
}

.pl-badge-live {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent-cyan);
}

.ledger-no-pointer {
    pointer-events: none;
}

/* Artist group: the ACTIVE/PLAYING tag is hidden for inactive library artists */
.library-artist-now-playing.is-hidden {
    display: none;
}

/* Queue section header modifiers (now-playing accent, cyan Up-Next icon) */
.queue-section-title.is-accent {
    color: var(--accent-brand-light);
}
.queue-section-title i.is-cyan {
    color: var(--accent-cyan);
}

