/* ============================================
   SoulSync Mobile Responsive Styles
   Loaded after style.css - overrides for ≤768px
   ============================================ */

/* ======================================
   HAMBURGER BUTTON (hidden on desktop)
   ====================================== */

.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animated X state */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ======================================
   MOBILE OVERLAY (hidden on desktop)
   ====================================== */

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ======================================
   MOBILE BREAKPOINT (≤768px)
   ====================================== */

@media (max-width: 768px) {

    /* --- Phase 0: Foundation --- */

    body {
        overflow: hidden;
        height: 100vh;
    }

    .main-container {
        flex-direction: column;
        height: 100vh;
        width: 100%;
    }

    .enhanced-dropdown-content {
        max-width: 100% !important;
    }

    .dashboard-container {
        gap: 15px;
        margin: 15px;
        padding: 15px;
    }

    .dashboard-header {
        margin: -15px -15px 15px -15px;
        padding: 15px;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    #artist-hero-section #artist-detail-image {
        width: 100% !important
    }

    #media-player {
        min-height: fit-content;
    }

    .tool-help-button {
        height: 35px;
        width: 35px;
    }

    .discover-carousel,
    #genre-tabs {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .enh-compact-item.artist-card {
        width: calc(50% - 8px);
        height: 200px;
    }

    .sidebar-header {
        text-align: right;
    }

    .main-content {
        width: 100%;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* --- Phase 1: Sidebar → Off-canvas --- */

    .hamburger-btn {
        display: flex;
    }

    .mobile-overlay {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 10001;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        border-top-right-radius: 24px;
        border-bottom-right-radius: 24px;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .page {
        padding: 70px 20px 20px 20px;
        height: auto;
        min-height: 0;
        overflow: visible;
        flex-shrink: 0;
    }

    .page.active {
        display: block;
    }

    .nav-button {
        width: 100%;
    }

    /* --- Phase 2: Dashboard --- */

    .dashboard-content {
        flex-direction: column;
        height: auto;
        gap: 20px;
    }

    .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    /* MusicBrainz tooltip - reposition for mobile */
    .musicbrainz-tooltip {
        left: 0;
        right: auto;
        transform: translateY(-5px);
    }

    .musicbrainz-button:hover+.musicbrainz-tooltip {
        transform: translateY(0);
    }

    /* AudioDB tooltip - reposition for mobile */
    .audiodb-tooltip {
        left: 0;
        right: auto;
        transform: translateY(-5px);
    }

    .audiodb-button:hover+.audiodb-tooltip {
        transform: translateY(0);
    }

    /* Deezer tooltip - reposition for mobile */
    .deezer-tooltip {
        left: 0;
        right: auto;
        transform: translateY(-5px);
    }

    .deezer-button:hover+.deezer-tooltip {
        transform: translateY(0);
    }

    .tooltip-content {
        min-width: auto;
        width: calc(100vw - 60px);
        max-width: 280px;
    }

    .tooltip-content::before,
    .tooltip-content::after {
        left: 24px;
        transform: none;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        padding: 20px 16px;
    }

    .tool-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tool-card-title {
        font-size: 15px;
    }

    .tool-card-info {
        font-size: 12px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .tool-card-controls {
        flex-direction: column;
        gap: 8px;
    }

    .tool-card-controls select,
    .tool-card-controls button {
        width: 100%;
        min-height: 44px;
        box-sizing: border-box;
    }

    /* --- Phase 3: Downloads (Search) --- */

    .downloads-content {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0 12px 16px 12px;
        overflow: hidden;
    }

    .downloads-main-panel {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .downloads-side-panel {
        max-height: 400px;
        margin-top: 0;
    }

    .search-bar-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .search-bar-container button {
        width: 100%;
        min-height: 44px;
    }

    #downloads-search-input {
        width: 100%;
    }

    .enhanced-search-bar-container {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .enhanced-search-wrapper {
        width: 100%;
    }

    .enhanced-search-bar-container button {
        width: 100%;
        min-height: 44px;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .filter-btn {
        font-size: 13px;
        padding: 8px 14px;
        min-height: 36px;
    }

    .sort-order-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .enhanced-dropdown {
        position: relative;
        margin-top: 12px;
        border-radius: 0;
        z-index: 1;
        overflow: visible;
        max-height: none;
    }

    .search-mode-btn {
        min-height: 44px;
    }

    .enh-artists-wrapper {
        flex-direction: column;
        gap: 16px;
    }

    /* Artist cards — center and wrap */
    .enh-compact-list.enh-artists-grid {
        justify-content: center;
    }

    /* Album cards — wrap and fill space, 2 per row */
    .enh-compact-list.enh-albums-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        overflow-x: hidden;
    }

    .enh-compact-item.album-card {
        width: calc(50% - 8px);
        flex-shrink: 0;
    }

    .enh-compact-item.album-card .enh-item-name {
        font-size: 12px;
    }

    .enh-compact-item.album-card .enh-item-meta {
        font-size: 11px;
    }

    /* --- Enhanced Search Results --- */

    .track-result-card {
        padding: 14px;
        margin: 8px 4px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .track-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

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

    .track-result-card .track-title {
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
    }

    .track-details {
        white-space: normal;
        word-break: break-word;
    }

    .track-result-card .track-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .album-result-card {
        padding: 16px;
        margin: 8px 4px;
    }

    .album-card-header {
        gap: 12px;
        flex-wrap: wrap;
    }

    .album-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .album-info {
        min-width: 0;
        flex: 1;
    }

    .album-title {
        font-size: 14px;
        white-space: normal;
        word-break: break-word;
    }

    .album-details {
        white-space: normal;
        word-break: break-word;
    }

    .album-actions {
        width: auto;
    }

    .album-track-list {
        margin-top: 12px;
        padding-top: 12px;
    }

    /* Standard search results */
    .search-result-item {
        padding: 12px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .result-item__main-content {
        flex: 1;
        min-width: 0;
        gap: 10px;
    }

    .result-item__title {
        white-space: normal;
        word-break: break-word;
        font-size: 12px;
    }

    .result-item__secondary-info {
        white-space: normal;
        word-break: break-word;
    }

    .result-item__actions {
        width: auto;
        flex-shrink: 0;
    }

    .action-btn {
        width: 40px;
        height: 40px;
        border-radius: 20px;
    }

    /* Enhanced search artist/album grids */
    /* Enhanced search — tablet/mobile responsive */
    .enh-compact-list.enh-artists-grid {
        gap: 10px;
    }

    .enh-compact-item.artist-card {
        width: calc(50% - 8px);
        height: 200px;
    }

    .enh-compact-item.artist-card .enh-item-info {
        padding: 10px;
    }

    .enh-compact-item.artist-card .enh-item-name {
        font-size: 13px;
    }

    /* Track items — larger touch targets */
    .enh-compact-item.track-item {
        padding: 10px 12px;
        min-height: 56px;
    }

    .enh-item-image.track-cover,
    .enh-item-image-placeholder.track-placeholder {
        width: 44px;
        height: 44px;
    }

    /* Always show play button on touch devices */
    .enh-item-play-btn {
        opacity: 1 !important;
        transform: translateY(-50%) !important;
        position: static !important;
        transform: none !important;
        padding: 6px 10px;
        flex-shrink: 0;
    }

    .enh-item-duration {
        font-size: 12px;
        gap: 8px;
    }

    /* Source tabs — horizontal scroll on small screens */
    .enh-source-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .enh-source-tabs::-webkit-scrollbar {
        display: none;
    }

    .enh-source-tab {
        flex-shrink: 0;
        min-height: 36px;
        padding: 8px 14px;
    }

    /* --- Phase 4: Sync --- */

    .sync-content {
        max-width: 100%;
    }

    .sync-tabs {
        flex-wrap: wrap;
    }

    .sync-tab-button {
        min-width: calc(50% - 2px);
        font-size: 13px;
        padding: 10px 8px;
    }

    /* Spotify playlist cards - stack vertically on mobile */
    .playlist-card {
        padding: 16px;
        margin: 8px 4px;
        border-radius: 14px;
    }

    .playlist-card-main {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .playlist-card-content {
        min-width: 0;
        width: 100%;
    }

    .playlist-card-name {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .playlist-card-info {
        font-size: 13px;
    }

    .playlist-card-actions {
        margin-left: 0;
        display: flex;
        gap: 8px;
    }

    .playlist-card-actions button {
        flex: 1;
        padding: 10px 14px;
        font-size: 12px;
    }

    .beatport-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }

    .beatport-tab-button {
        flex: 0 0 calc(50% - 4px);
        padding: 10px 12px;
        font-size: 12px;
    }

    .beatport-genre-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .beatport-top10-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .beatport-top10-title {
        font-size: 24px;
    }

    .beatport-top10-card,
    .beatport-hype10-card {
        padding: 12px;
        min-height: 70px;
        max-height: none;
    }

    .beatport-top10-card-rank,
    .beatport-hype10-card-rank {
        font-size: 16px;
        min-width: 30px;
        margin-right: 10px;
    }

    .beatport-top10-card-artwork,
    .beatport-hype10-card-artwork {
        width: 44px;
        height: 44px;
        margin-right: 10px;
    }

    .beatport-top10-card-title,
    .beatport-hype10-card-title {
        font-size: 13px;
    }

    /* --- Beatport rebuild hero slider --- */
    .beatport-rebuild-slider {
        height: 280px;
    }

    .beatport-rebuild-slider-container {
        padding: 12px;
    }

    .beatport-rebuild-slide-content {
        padding: 16px 12px;
    }

    .beatport-rebuild-track-title {
        font-size: 20px;
    }

    .beatport-rebuild-artist-name {
        font-size: 14px;
    }

    .beatport-rebuild-slider-nav {
        display: none;
    }

    /* --- Beatport card sliders: convert from absolute stacking to show/hide --- */

    /* All slider tracks: auto height */
    .beatport-releases-slider-track,
    .beatport-hype-picks-slider-track,
    .beatport-charts-slider-track,
    .beatport-dj-slider-track {
        height: auto;
        min-height: auto;
    }

    /* All slides: position relative, hidden by default */
    .beatport-releases-slide,
    .beatport-hype-picks-slide,
    .beatport-charts-slide,
    .beatport-dj-slide {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        display: none;
        opacity: 0;
        transform: none;
    }

    /* Active slide: visible */
    .beatport-releases-slide.active,
    .beatport-hype-picks-slide.active,
    .beatport-charts-slide.active,
    .beatport-dj-slide.active {
        display: block;
        opacity: 1;
        transform: none;
    }

    /* Prev/next slides: hidden */
    .beatport-releases-slide.prev,
    .beatport-releases-slide.next,
    .beatport-hype-picks-slide.prev,
    .beatport-hype-picks-slide.next,
    .beatport-charts-slide.prev,
    .beatport-charts-slide.next,
    .beatport-dj-slide.prev,
    .beatport-dj-slide.next {
        display: none;
    }

    /* All slider containers: reduced padding */
    .beatport-releases-slider-container,
    .beatport-hype-picks-slider-container,
    .beatport-charts-slider-container,
    .beatport-dj-slider-container {
        padding: 12px;
    }

    /* All card grids: 2 columns, auto rows */
    .beatport-releases-grid,
    .beatport-hype-picks-grid,
    .beatport-charts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
        gap: 10px;
        padding: 10px;
    }

    .beatport-dj-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 10px;
        padding: 10px;
    }

    /* Card heights: auto instead of fixed */
    .beatport-chart-card {
        height: auto;
        min-height: 120px;
        max-height: none;
    }

    .beatport-dj-card {
        height: auto;
        min-height: 120px;
        max-height: none;
    }

    /* Release/hype card compact */
    .beatport-release-card,
    .beatport-hype-pick-card {
        padding: 10px;
    }

    .beatport-release-artwork,
    .beatport-hype-pick-artwork {
        width: 50px;
        height: 50px;
    }

    .beatport-release-title,
    .beatport-hype-pick-title {
        font-size: 12px;
    }

    .beatport-release-artist,
    .beatport-hype-pick-artist {
        font-size: 11px;
    }

    /* Slider nav buttons (prev/next arrows) */
    .beatport-releases-slider-nav,
    .beatport-hype-picks-slider-nav,
    .beatport-charts-slider-nav,
    .beatport-dj-slider-nav {
        position: relative;
        top: auto;
        display: flex;
        justify-content: center;
        gap: 16px;
        padding: 10px 0;
        z-index: 1;
    }

    /* Slider indicators */
    .beatport-releases-slider-indicators,
    .beatport-hype-picks-slider-indicators,
    .beatport-charts-slider-indicators,
    .beatport-dj-slider-indicators {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        display: flex;
        justify-content: center;
        padding: 8px 0;
    }

    /* Section titles */
    .beatport-releases-title,
    .beatport-hype-picks-title,
    .beatport-charts-title {
        font-size: 20px;
    }

    /* Nav buttons */
    .beatport-nav-buttons-container {
        flex-direction: column;
        gap: 12px;
    }

    .beatport-nav-button {
        max-width: none;
        width: 100%;
    }

    .genre-chart-types-grid {
        grid-template-columns: 1fr;
    }

    /* --- Phase 5A: Artists --- */

    .artists-content {
        height: auto;
        overflow-y: visible;
    }

    .artists-search-state {
        min-height: auto;
        padding: 20px 16px;
        gap: 20px;
    }

    .artists-welcome-title {
        font-size: 24px;
    }

    .artists-welcome-subtitle {
        font-size: 14px;
    }

    .artists-results-state {
        padding: 16px;
    }

    .artists-results-header {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }

    .artists-cards-container {
        flex-wrap: wrap;
        overflow-x: visible;
        overflow-y: visible;
        justify-content: center;
        padding: 16px 0;
    }

    .artist-card {
        width: 100%;
        max-width: 280px;
        height: 300px;
    }

    .artist-detail-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .album-cards-container,
    .singles-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .album-card-content {
        padding: 10px;
    }

    .album-card-name {
        font-size: 12px;
    }

    /* Artists page hero — mobile */
    .artists-hero-section {
        border-radius: 12px;
    }

    .artists-hero-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }

    .artists-hero-image {
        width: 140px;
        height: 175px;
        border-radius: 10px;
    }

    .artists-hero-name {
        font-size: 1.5em;
    }

    .artists-hero-genres {
        justify-content: center;
    }

    .artists-hero-badges {
        justify-content: center;
    }

    .artists-hero-content {
        padding: 16px 14px 20px;
    }

    .artists-hero-actions {
        position: static;
        justify-content: center;
        margin-top: 8px;
    }

    .artists-hero-bio {
        text-align: left;
    }

    .artists-hero-stats {
        justify-content: center;
    }

    .artists-hero-stat strong {
        font-size: 15px;
    }

    /* --- Phase 5B: Library --- */

    .library-container {
        height: auto;
        padding: 16px;
    }

    .library-controls {
        flex-direction: column;
    }

    .library-search-container {
        max-width: 100%;
    }

    .watchlist-filter {
        flex-wrap: wrap;
    }

    .library-watchlist-all-btn {
        font-size: 12px;
        padding: 5px 12px;
    }

    .library-card-watchlist-btn {
        opacity: 1;
    }

    .alphabet-selector-inner {
        flex-wrap: wrap;
        min-width: 0;
        gap: 4px;
    }

    .alphabet-btn {
        min-width: 32px;
        min-height: 32px;
    }

    .library-artists-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* Artist Detail (Library) — Hero section */
    .artist-hero-section {
        margin: 10px;
        padding: 16px;
        border-radius: 12px;
    }

    .artist-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }

    .artist-image-container {
        width: 100px;
        height: 100px;
    }

    .artist-image,
    .artist-image-fallback {
        width: 100px;
        height: 100px;
    }

    .artist-info h1,
    .artist-name {
        font-size: 24px !important;
        white-space: normal;
        text-align: center;
    }

    .artist-hero-badges {
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }

    .artist-hero-badge {
        width: 22px;
        height: 22px;
    }

    .artist-genres-container {
        justify-content: center;
        flex-wrap: wrap;
    }

    .artist-hero-bio {
        font-size: 12px;
        -webkit-line-clamp: 3;
        max-height: 54px;
    }

    .artist-hero-numbers {
        justify-content: center;
        gap: 20px;
    }

    .hero-stat-value {
        font-size: 18px;
    }

    .hero-stat-label {
        font-size: 10px;
    }

    .collection-overview {
        gap: 6px;
    }

    .category-label {
        font-size: 0.65em;
        min-width: 42px;
    }

    .category-stats {
        font-size: 0.65em;
    }

    /* Top tracks sidebar — stack below on mobile */
    .artist-hero-right {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        padding-top: 12px;
    }

    .hero-top-tracks {
        max-height: 200px;
        overflow-y: auto;
    }

    .releases-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* --- Phase 6: Discover --- */

    .discover-hero-content {
        padding: 16px;
    }

    .discover-hero-bottom-actions {
        bottom: 12px;
        right: 12px;
        gap: 6px;
    }

    .discover-hero-watch-all,
    .discover-hero-view-all {
        padding: 6px 12px;
        font-size: 11px;
    }

    /* Recommended Artists Modal - Mobile */
    .recommended-modal {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .recommended-artists-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
        padding: 12px 16px;
    }

    .recommended-actions-bar {
        padding: 12px 16px 0;
        flex-wrap: wrap;
    }

    .recommended-add-all-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    .recommended-card-watchlist-btn {
        opacity: 1;
    }

    .discover-section-header {
        flex-direction: column;
        gap: 12px;
    }

    .discover-section-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .discover-section-actions .action-button {
        flex: 1;
        min-height: 44px;
        justify-content: center;
    }

    .discover-card {
        width: 160px;
    }

    /* Horizontal scroll tabs */
    .decade-tabs,
    .genre-tabs,
    .listenbrainz-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .decade-tabs::-webkit-scrollbar,
    .genre-tabs::-webkit-scrollbar,
    .listenbrainz-tabs::-webkit-scrollbar {
        display: none;
    }

    .discover-download-sidebar {
        width: 60px;
        top: auto;
        bottom: 16px;
        right: 16px;
        height: auto;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* --- Phase 7: Settings --- */

    .settings-columns {
        flex-direction: column;
    }

    .settings-left-column,
    .settings-right-column,
    .settings-third-column {
        min-width: 0;
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .page-header button {
        width: 100%;
        min-height: 44px;
    }

    .api-test-buttons {
        flex-direction: column;
    }

    .api-test-buttons .test-button {
        width: 100%;
        min-width: 0;
    }

    .server-toggle-btn {
        flex: 1;
        min-height: 44px;
    }

    .path-input-group {
        flex-direction: column;
    }

    .path-input-group input {
        width: 100%;
    }

    .preset-button {
        flex: 1;
    }

    /* --- Phase 8: All Modals Responsive --- */

    .modal-overlay {
        padding: 8px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .matching-modal {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 95vh;
        border-radius: 16px;
    }

    .matching-modal-content {
        padding: 16px;
    }

    .matching-modal-actions {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .matching-modal-actions button {
        width: 100%;
        min-height: 44px;
    }

    .version-modal {
        width: 95vw;
    }

    .add-to-wishlist-modal {
        width: 100%;
        max-width: 100%;
    }

    .download-missing-modal-content {
        width: 100%;
        max-width: 100%;
        height: 95vh;
        max-height: 95vh;
        border-radius: 16px;
    }

    /* Download modal hero - compact */
    .download-missing-modal-hero {
        padding: 12px 14px;
        gap: 10px;
        min-height: auto;
    }

    .download-missing-modal-hero-content {
        gap: 10px;
    }

    .download-missing-modal-hero-images {
        gap: 8px;
    }

    .download-missing-modal-hero-image {
        width: 48px;
        height: 48px;
    }

    .download-missing-modal-hero-image.artist {
        width: 44px;
        height: 44px;
    }

    .download-missing-modal-hero-image.album {
        width: 48px;
        height: 48px;
    }

    .download-missing-modal-hero-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .download-missing-modal-hero-title {
        font-size: 15px;
        white-space: normal;
        line-height: 1.2;
    }

    .download-missing-modal-hero-subtitle {
        font-size: 12px;
        white-space: normal;
    }

    .download-missing-modal-hero-details {
        gap: 6px;
        flex-wrap: wrap;
    }

    .download-missing-modal-hero-detail {
        font-size: 10px;
        padding: 2px 5px;
    }

    .download-missing-modal-header-actions {
        padding: 10px 14px 0 0;
    }

    /* Download modal body */
    .download-missing-modal-body {
        padding: 10px 12px 14px 12px;
        gap: 12px;
    }

    /* Download stats grid */
    .download-dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .dashboard-stat-number {
        font-size: 20px;
    }

    .dashboard-stat-label {
        font-size: 10px;
    }

    /* Download tracks table - compact on mobile */
    .download-tracks-header {
        padding: 10px 12px;
    }

    .download-tracks-title {
        font-size: 13px;
    }

    .track-selection-count {
        font-size: 10px;
    }

    .download-tracks-table {
        table-layout: auto;
    }

    .download-tracks-table th,
    .download-tracks-table td {
        padding: 6px 4px;
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Checkbox column sizing on mobile */
    .track-select-header,
    .track-select-cell {
        width: auto;
        padding: 6px 4px !important;
    }

    .track-select-header input[type="checkbox"],
    .track-select-cell input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    /* Hide # and Duration columns on mobile */
    .download-tracks-table td.track-number {
        display: none;
    }

    .download-tracks-table td.track-duration {
        display: none;
    }

    /* Hide matching th headers — different positions depending on checkbox column */
    .download-tracks-table:has(.track-select-header) th:nth-child(2),
    .download-tracks-table:not(:has(.track-select-header)) th:nth-child(1) {
        display: none;
    }

    .download-tracks-table:has(.track-select-header) th:nth-child(5) {
        display: none;
    }

    .track-name {
        width: auto;
        max-width: 120px;
        font-size: 11px;
    }

    .track-artist {
        width: auto;
        max-width: 80px;
        font-size: 11px;
    }

    .track-match-status {
        width: auto;
        font-size: 10px;
    }

    .track-download-status {
        width: auto;
        font-size: 10px;
    }

    .download-tracks-table .track-actions {
        width: auto;
        font-size: 10px;
    }

    .cancel-track-btn {
        padding: 3px 6px;
        font-size: 10px;
    }

    /* Download modal footer - stack everything vertically */
    .download-missing-modal-footer {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .download-phase-controls {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    /* Toggle container - stack vertically, prevent overflow */
    .force-download-toggle-container {
        width: 100%;
        padding: 8px 12px;
        box-sizing: border-box;
    }

    .force-download-toggle {
        gap: 8px;
    }

    .force-download-toggle span {
        font-size: 11px;
        line-height: 1.3;
        word-break: break-word;
    }

    .force-download-toggle input[type="checkbox"] {
        width: 40px;
        height: 20px;
        flex-shrink: 0;
    }

    .force-download-toggle input[type="checkbox"]:before {
        width: 14px;
        height: 14px;
    }

    .force-download-toggle input[type="checkbox"]:checked:before {
        transform: translateX(20px);
    }

    /* All download control buttons - full width stacked */
    .download-control-btn {
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 10px 14px;
        font-size: 12px;
        text-align: center;
        box-sizing: border-box;
    }

    .modal-close-section {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .modal-close-section .download-control-btn {
        width: 100%;
    }

    .youtube-discovery-modal {
        width: 100%;
        max-width: 100%;
    }

    .artist-download-modal-content {
        width: 100%;
        max-width: 100%;
    }

    .confirmation-modal {
        width: 90vw;
        max-width: 90vw;
        padding: 24px;
    }

    .confirmation-modal button {
        width: 100%;
        min-height: 44px;
    }

    .genre-browser-modal-container {
        width: 100%;
        max-width: 100%;
    }

    .tool-help-modal-content {
        width: 95vw;
        max-width: 95vw;
    }

    /* Wishlist & Watchlist modals (playlist-modal based) */
    .playlist-modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .playlist-modal-header {
        padding: 16px;
        flex-wrap: wrap;
        gap: 8px;
        flex-shrink: 0;
    }

    .playlist-header-content h2 {
        font-size: 18px;
    }

    .playlist-quick-info {
        flex-direction: column;
        gap: 4px;
    }

    /* Critical fix: allow modal body to scroll */
    .playlist-modal-body {
        padding: 0 16px;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        min-height: 0;
    }

    /* Wishlist category tracks view */
    .wishlist-category-tracks {
        height: auto;
        padding: 0 16px;
        overflow: visible;
    }

    /* Tracks scroll container - fit within modal */
    .playlist-tracks-scroll {
        max-height: none;
        overflow-y: visible;
        flex: none;
    }

    /* Album grid needs to be able to grow */
    .wishlist-album-grid {
        overflow: visible;
    }

    .playlist-modal-footer {
        padding: 16px;
        flex-direction: column;
        gap: 10px;
        flex-shrink: 0;
    }

    .playlist-modal-footer-left,
    .playlist-modal-footer-right {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    /* Footer/action buttons - full width stacked */
    .playlist-modal-footer .playlist-modal-btn,
    .watchlist-actions .playlist-modal-btn {
        width: 100%;
        min-height: 44px;
        text-align: center;
    }

    /* Watchlist fullscreen modal on mobile */
    .watchlist-fullscreen {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Watchlist card grid on mobile */
    .watchlist-artists-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
        padding: 16px;
    }

    .watchlist-card-info {
        padding: 0 12px 6px;
        margin-top: -28px;
    }

    .watchlist-card-name {
        font-size: 13px;
    }

    .watchlist-card-meta {
        font-size: 10px;
    }

    /* Show checkbox, remove, and gear always on mobile (no hover) */
    .watchlist-card-checkbox,
    .watchlist-artist-card .watchlist-card-remove,
    .watchlist-artist-card .watchlist-card-gear {
        opacity: 1;
    }

    .watchlist-detail-hero {
        flex-direction: column;
        text-align: center;
    }

    .watchlist-detail-hero-stats {
        justify-content: center;
    }

    .watchlist-detail-hero-genres {
        justify-content: center;
    }

    .watchlist-detail-actions {
        flex-direction: column;
    }

    .watchlist-detail-actions button {
        width: 100%;
    }

    .watchlist-search-container {
        padding: 0 16px;
    }

    /* Retag modal on mobile — fullscreen */
    .retag-modal-container {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .retag-modal-header {
        padding: 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .retag-modal-body {
        padding: 16px;
    }

    .retag-batch-bar {
        margin: 0 16px 12px;
    }

    .retag-group-header {
        padding: 12px;
        gap: 10px;
    }

    .retag-group-image,
    .retag-group-image-placeholder {
        width: 44px;
        height: 44px;
    }

    .retag-group-album {
        font-size: 13px;
    }

    .retag-search-container {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Watchlist live activity - stack on mobile */
    #watchlist-live-activity {
        flex-direction: column;
        align-items: center;
    }

    /* Wishlist category grid */
    .wishlist-category-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }

    .wishlist-category-card {
        min-height: 140px;
    }

    /* Wishlist track items */
    .wishlist-track-item {
        padding: 10px 12px;
        padding-right: 50px;
        gap: 8px;
    }

    .wishlist-track-number {
        width: 24px;
        font-size: 12px;
    }

    .wishlist-track-name {
        font-size: 13px;
    }

    .wishlist-track-artists {
        font-size: 12px;
    }

    .wishlist-delete-btn {
        padding: 6px 8px;
        font-size: 13px;
        right: 8px;
    }

    .wishlist-delete-album-btn {
        padding: 6px 8px;
        font-size: 13px;
        right: 8px;
    }

    .wishlist-delete-btn-small {
        padding: 4px 8px;
        font-size: 12px;
    }

    .wishlist-back-btn {
        min-height: 36px;
        font-size: 13px;
    }

    /* Modal footer buttons */
    .modal-footer button,
    .modal-actions button {
        flex: 1;
        min-height: 44px;
    }

    /* --- Phase 9: Touch & Hover Adaptations --- */

    /* Global touch targets - only standalone/action buttons, not inline */
    button:not(.watchlist-card-remove):not(.wishlist-delete-btn):not(.wishlist-delete-album-btn):not(.wishlist-delete-btn-small):not(.wishlist-back-btn):not(.alphabet-btn):not(.filter-btn):not(.playlist-modal-close) {
        min-height: 38px;
    }

    /* Range slider thumbs */
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"] {
        min-height: 12px;
    }

    /* Fix hover-only invisible elements */
    .wishlist-delete-btn {
        opacity: 1;
        pointer-events: auto;
    }

    .wishlist-delete-album-btn {
        opacity: 1;
        pointer-events: auto;
    }

    /* --- Phase 10: Typography & Spacing --- */

    /* Prevent iOS zoom on focus */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* Font size floors */
    .app-subtitle,
    .stat-label,
    .stat-value-small {
        font-size: 12px;
    }

    /* Scale down oversized headings */
    .discover-hero-title {
        font-size: 32px;
    }

    .page-header h2 {
        font-size: 22px;
    }

    /* Spacing reductions */
    .page {
        padding: 70px 16px 16px 16px;
    }

    .activity-section {
        padding: 16px;
    }

    /* --- Chart slideshow grids (fixed 4-col → responsive) --- */
    .new-charts-grid,
    .dj-charts-grid,
    .featured-charts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- Media player compact --- */
    .media-player {
        margin: 8px 10px;
        padding: 14px;
        border-radius: 12px;
    }

    .media-header {
        gap: 10px;
        margin-bottom: 6px;
    }

    .media-player .track-title {
        font-size: 13px;
    }

    .media-player .artist-name {
        font-size: 11px;
    }

    .media-expanded {
        margin-top: 6px;
        padding-top: 6px;
    }

    .media-controls {
        gap: 8px;
    }

    .volume-control {
        gap: 6px;
    }

    .volume-slider {
        width: 80px;
    }

    /* --- Settings form inputs full width --- */
    .form-group select {
        width: 100%;
    }

    .form-group input[type="number"] {
        width: 100%;
    }

    .form-group input[type="text"],
    .form-group input[type="url"],
    .form-group input[type="password"] {
        width: 100%;
        box-sizing: border-box;
    }

    /* --- Toast container mobile adjustment --- */
    .toast-container {
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: none;
        width: auto;
        z-index: 10003;
    }

    .toast {
        max-width: 100%;
    }
}

/* ======================================
   EXTRA SMALL SCREENS (≤480px)
   ====================================== */

@media (max-width: 480px) {

    .page {
        padding: 70px 12px 12px 12px;
    }

    .stats-grid-dashboard {
        grid-template-columns: 1fr;
    }

    .discover-card {
        width: 140px;
    }

    .discover-hero-title {
        font-size: 26px;
    }

    .artist-card {
        width: 100%;
        max-width: 280px;
    }

    .header-button {
        font-size: 13px;
        padding: 10px 14px;
    }

    .sync-tab-button {
        min-width: 100%;
    }

    .matching-modal-actions {
        padding: 12px;
    }

    /* Tool cards tighter on small screens */
    .tool-card {
        padding: 16px 12px;
    }

    .tool-card-title {
        font-size: 14px;
    }

    /* Enhanced search - smaller cards on small screens */
    /* Enhanced search — small phone */
    .enh-compact-list.enh-artists-grid {
        gap: 8px;
    }

    .enh-compact-item.artist-card {
        width: calc(50% - 6px);
        height: 170px;
    }

    .enh-compact-item.artist-card .enh-item-info {
        padding: 8px;
    }

    .enh-compact-item.artist-card .enh-item-name {
        font-size: 11px;
    }

    .enh-compact-item.album-card {
        width: calc(50% - 6px);
    }

    .enh-compact-item.album-card .enh-item-name {
        font-size: 11px;
    }

    .enh-compact-item.album-card .enh-item-info {
        padding: 8px 10px 10px;
    }

    .enh-compact-item.track-item {
        padding: 10px 8px;
        gap: 10px;
    }

    .enh-compact-item.track-item .enh-item-name {
        font-size: 13px;
    }

    .enh-compact-item.track-item .enh-item-meta {
        font-size: 11px;
    }

    .enh-item-image.track-cover,
    .enh-item-image-placeholder.track-placeholder {
        width: 38px;
        height: 38px;
    }

    .enh-section-title {
        font-size: 11px;
    }

    /* Beatport tighter */
    .beatport-tab-button {
        flex: 0 0 100%;
        font-size: 12px;
    }

    .beatport-rebuild-slider {
        height: 220px;
    }

    .beatport-rebuild-track-title {
        font-size: 16px;
    }

    .beatport-rebuild-artist-name {
        font-size: 12px;
    }

    .beatport-top10-card,
    .beatport-hype10-card {
        padding: 10px;
    }

    .beatport-top10-card-artwork,
    .beatport-hype10-card-artwork {
        width: 36px;
        height: 36px;
    }

    /* Beatport card grids: single column at 480px */
    .beatport-releases-grid,
    .beatport-hype-picks-grid,
    .beatport-charts-grid,
    .beatport-dj-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
    }

    .beatport-release-card,
    .beatport-hype-pick-card {
        padding: 8px;
    }

    .beatport-release-artwork,
    .beatport-hype-pick-artwork {
        width: 40px;
        height: 40px;
    }

    .beatport-chart-card,
    .beatport-dj-card {
        min-height: 100px;
    }

    /* Playlist modal footer tighter */
    .playlist-modal-header {
        padding: 12px;
    }

    .playlist-modal-footer {
        padding: 12px;
    }

    .playlist-modal-footer .playlist-modal-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* Watchlist cards — tighter grid on small screens */
    .watchlist-artists-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
        padding: 12px;
    }

    .watchlist-card-name {
        font-size: 12px;
    }

    .watchlist-card-info {
        padding: 0 10px 4px;
        margin-top: -24px;
    }

    .watchlist-pill {
        font-size: 8px;
        padding: 2px 5px;
    }

    .watchlist-card-pills {
        padding: 2px 10px 8px;
    }

    .watchlist-detail-content {
        padding: 20px 16px;
    }

    .watchlist-detail-hero img {
        width: 80px;
        height: 80px;
    }

    .watchlist-detail-hero-name {
        font-size: 22px;
    }

    .watchlist-detail-releases {
        grid-template-columns: 1fr;
    }

    /* Download modal - even more compact */
    .download-missing-modal-hero {
        padding: 10px 12px;
    }

    .download-missing-modal-hero-image,
    .download-missing-modal-hero-image.artist,
    .download-missing-modal-hero-image.album {
        width: 40px;
        height: 40px;
    }

    .download-missing-modal-hero-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .download-missing-modal-hero-title {
        font-size: 14px;
    }

    .download-missing-modal-hero-subtitle {
        font-size: 11px;
    }

    .download-missing-modal-body {
        padding: 8px 10px 12px 10px;
    }

    /* Hide Library Match column too at 480px */
    .download-tracks-table td.track-match-status {
        display: none;
    }

    .download-tracks-table:has(.track-select-header) th:nth-child(6),
    .download-tracks-table:not(:has(.track-select-header)) th:nth-child(4) {
        display: none;
    }

    .track-name {
        max-width: 100px;
    }

    .track-artist {
        max-width: 70px;
    }

    .download-tracks-table th,
    .download-tracks-table td {
        padding: 5px 3px;
        font-size: 9px;
    }

    .download-control-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    .force-download-toggle span {
        font-size: 10px;
    }

    .download-missing-modal-footer {
        padding: 10px;
    }

    .dashboard-stat-number {
        font-size: 18px;
    }

    /* Chart grids single column at small screens */
    .new-charts-grid,
    .dj-charts-grid,
    .featured-charts-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Media player even more compact */
    .media-player {
        margin: 6px 8px;
        padding: 10px;
    }

    .media-player .track-title {
        font-size: 12px;
    }

    .volume-slider {
        width: 60px;
    }
}

/* ======================================
   TOUCH DEVICE ADAPTATIONS
   ====================================== */

@media (hover: none) {

    /* Disable alphabet-btn scale hover effect for touch */
    .alphabet-btn:hover {
        transform: none;
    }

    /* Make hover-reveal elements always visible */
    .wishlist-delete-btn,
    .wishlist-delete-album-btn {
        opacity: 1;
        pointer-events: auto;
    }

    /* Active feedback states */
    button:active,
    .nav-button:active,
    .filter-btn:active,
    .header-button:active {
        opacity: 0.7;
        transition: opacity 0.1s ease;
    }

    /* Import Page - Touch fallback */
    .import-page-file-chip {
        cursor: pointer;
    }

    .import-page-match-row {
        cursor: pointer;
    }
}

/* Import Page — small screen */
@media (max-width: 768px) {
    .import-page-container {
        padding: 16px;
    }

    .import-page-title {
        font-size: 22px;
    }

    .import-page-album-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .import-page-album-hero {
        flex-direction: column;
        text-align: center;
    }

    .import-page-album-hero img {
        width: 100px;
        height: 100px;
    }

    .import-page-match-row {
        grid-template-columns: 28px 1fr;
        gap: 8px;
    }

    .import-page-match-file {
        grid-column: 1 / -1;
        padding-left: 28px;
    }

    .import-page-match-unmatch {
        grid-column: 1 / -1;
        justify-self: end;
    }

    .import-page-singles-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .import-page-singles-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .import-page-single-item {
        grid-template-columns: 28px 1fr;
    }

    .import-page-single-actions {
        grid-column: 1 / -1;
        justify-self: end;
    }

    .import-page-single-search-panel {
        padding-left: 0;
    }

    .import-page-staging-bar {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    /* Profile Picker - Mobile */
    .profile-picker-grid {
        gap: 20px;
    }

    .profile-avatar {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }

    .profile-manage-content {
        width: calc(100vw - 32px);
        max-width: 400px;
    }

    .profile-pin-content {
        width: calc(100vw - 32px);
        max-width: 340px;
    }

    /* Enhanced Library Management - Mobile */
    .enhanced-artist-meta-grid {
        grid-template-columns: 1fr;
    }
    .enhanced-meta-field.wide {
        grid-column: span 1;
    }
    .enhanced-album-row {
        padding: 10px 12px;
        gap: 10px;
    }
    .enhanced-album-grid {
        grid-template-columns: 1fr;
    }
    .enhanced-album-type-badge {
        display: none;
    }
    .enhanced-album-track-count {
        font-size: 11px;
        min-width: 40px;
    }
    .enhanced-track-table .col-path,
    .enhanced-track-table .col-bpm,
    .enhanced-track-table .col-format,
    .enhanced-track-table .col-match,
    .enhanced-track-table .col-disc {
        display: none;
    }
    .enhanced-manual-match-modal {
        width: 95vw;
    }
    .enhanced-album-meta-row {
        grid-template-columns: 1fr 1fr;
    }
    .enhanced-bulk-bar {
        left: 0;
        padding: 0 16px;
    }
    .enhanced-bulk-modal {
        width: calc(100vw - 32px);
    }

    /* Discography filter bar */
    .discography-filters {
        gap: 6px;
        padding: 8px 0 12px;
    }
    .filter-group {
        gap: 4px;
        flex-wrap: wrap;
    }
    .filter-label {
        font-size: 10px;
        width: 100%;
    }
    .discography-filter-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    .filter-divider {
        display: none;
    }
    .enhanced-view-toggle-btn {
        padding: 5px 12px;
        font-size: 11px;
    }

    /* Enhanced view — artist meta header */
    .enhanced-artist-meta-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 12px;
    }
    .enhanced-artist-meta-header-left {
        width: 100%;
        gap: 10px;
    }
    .enhanced-artist-meta-image {
        width: 48px;
        height: 48px;
    }
    .enhanced-artist-meta-name {
        font-size: 18px;
    }
    .enhanced-artist-meta-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }
    .enhanced-artist-meta-actions button,
    .enhanced-meta-save-btn,
    .enhanced-meta-cancel-btn {
        flex: 1;
        min-width: 80px;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Enhanced view — artist meta fields grid */
    .enhanced-artist-meta-panel {
        padding: 12px;
    }
    .enhanced-meta-input {
        font-size: 12px;
        padding: 6px 8px;
    }

    /* Enhanced view — album expanded header */
    .enhanced-expanded-header {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }
    .enhanced-expanded-thumb {
        width: 80px;
        height: 80px;
        align-self: center;
    }
    .enhanced-expanded-info {
        width: 100%;
    }
    .enhanced-expanded-title {
        font-size: 16px;
        text-align: center;
    }
    .enhanced-expanded-actions {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    .enhanced-expanded-actions button {
        width: 100%;
        font-size: 12px;
        padding: 8px;
    }

    /* Enhanced view — album expanded rows */
    .enhanced-album-row {
        flex-wrap: wrap;
    }
    .enhanced-album-thumb {
        width: 40px;
        height: 40px;
    }
    .enhanced-album-title {
        font-size: 13px;
    }
    .enhanced-album-meta-line {
        font-size: 11px;
        white-space: normal;
    }
    .enhanced-album-meta-row {
        grid-template-columns: 1fr !important;
        gap: 8px;
        padding: 10px;
    }
    .enhanced-album-meta-input {
        font-size: 11px;
        padding: 5px 8px;
    }
    .enhanced-album-actions {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    .enhanced-album-actions button {
        font-size: 11px;
        padding: 5px 10px;
        flex: 1;
        min-width: 80px;
    }
    .enhanced-album-save-btn {
        width: 100%;
    }

    /* Enhanced view — track table */
    .enhanced-track-table {
        table-layout: auto;
        font-size: 12px;
    }
    .enhanced-track-table th,
    .enhanced-track-table td {
        padding: 6px 3px;
        font-size: 11px;
    }
    .enhanced-track-table .col-num {
        width: 24px;
    }
    .enhanced-track-table .col-title {
        word-break: break-word;
    }
    .enhanced-track-table .col-duration {
        width: 42px;
        font-size: 10px;
    }
    .enhanced-track-table .col-bitrate {
        display: none;
    }
    .enhanced-track-table .col-actions {
        width: 32px;
    }
    .enhanced-track-table .col-play {
        width: 26px;
    }
    /* Hide less essential columns on mobile */
    .enhanced-track-table .col-path,
    .enhanced-track-table .col-bpm,
    .enhanced-track-table .col-format,
    .enhanced-track-table .col-match,
    .enhanced-track-table .col-disc {
        display: none;
    }

    /* Collapse queue/writetag/delete into single ⋯ actions column on mobile */
    .enhanced-track-table .col-queue,
    .enhanced-track-table .col-writetag,
    .enhanced-track-table .col-delete,
    .enhanced-track-table .col-report {
        display: none;
    }
    .enhanced-track-table .col-mobile-actions {
        display: table-cell;
        width: 36px;
        text-align: center;
    }

    /* Mobile actions popover */
    .enhanced-mobile-actions-popover {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(20, 20, 20, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 16px 16px 0 0;
        padding: 16px;
        z-index: 10001;
        display: flex;
        flex-direction: column;
        gap: 4px;
        animation: slideUpPopover 0.25s ease-out;
    }
    .enhanced-mobile-actions-popover .popover-title {
        font-size: 13px;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.5);
        padding: 0 4px 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .enhanced-mobile-actions-popover button {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 14px 16px;
        background: none;
        border: none;
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.85);
        font-size: 14px;
        cursor: pointer;
        transition: background 0.15s;
    }
    .enhanced-mobile-actions-popover button:active {
        background: rgba(255, 255, 255, 0.08);
    }
    .enhanced-mobile-actions-popover button .popover-icon {
        font-size: 16px;
        width: 24px;
        text-align: center;
    }
    .enhanced-mobile-actions-popover button.popover-delete {
        color: rgba(255, 80, 80, 0.8);
    }
    .enhanced-mobile-actions-popover button.popover-cancel {
        color: rgba(255, 255, 255, 0.4);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: 4px;
    }
    .mobile-popover-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10000;
    }

    @keyframes slideUpPopover {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Bulk bar */
    .enhanced-bulk-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .enhanced-bulk-bar .enhanced-bulk-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    /* Now Playing Modal */
    .np-modal {
        width: 100vw;
        max-width: none;
        max-height: none;
        height: 100vh;
        border-radius: 0;
    }
    .np-body {
        flex-direction: column;
        padding: 48px 24px 24px;
        gap: 24px;
        overflow-y: auto;
        max-height: 100vh;
    }
    .np-album-art-container {
        width: 220px;
        height: 220px;
        margin: 0 auto;
    }
    .np-track-info {
        width: 100%;
    }
    .np-track-title {
        font-size: 18px;
    }
    .np-volume-slider-container {
        width: 120px;
    }
}

/* ======================================
   STATS PAGE — Mobile
   ====================================== */

@media (max-width: 768px) {
    .stats-container {
        padding: 12px !important;
        margin: 8px !important;
        gap: 14px;
        border-radius: 16px;
    }

    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px !important;
        margin: -12px -12px 0 -12px !important;
        gap: 10px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    .stats-header-title {
        gap: 8px;
    }

    .stats-header-title .page-header-icon {
        width: 24px;
        height: 24px;
    }

    .stats-header-title h1 {
        font-size: 18px;
    }

    .stats-header-controls {
        width: 100%;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }

    .stats-time-range {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .stats-range-btn {
        padding: 6px 12px;
        font-size: 11px;
        flex: 1;
        text-align: center;
    }

    .stats-sync-controls {
        width: 100%;
        justify-content: space-between;
    }

    .stats-last-synced {
        font-size: 11px;
    }

    .stats-sync-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Overview cards — 2 columns */
    .stats-overview {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }

    .stats-card {
        padding: 12px 10px;
        border-radius: 10px;
    }

    .stats-card-value {
        font-size: 18px !important;
    }

    .stats-card-label {
        font-size: 9px;
        letter-spacing: 0.04em;
    }

    /* Main grid — single column */
    .stats-main-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .stats-left-col,
    .stats-right-col {
        width: 100% !important;
        gap: 14px;
    }

    .stats-section-card {
        padding: 12px;
        border-radius: 12px;
    }

    .stats-section-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    /* Timeline chart — shrink height */
    .stats-section-card > div[style*="height:220px"],
    .stats-section-card > div[style*="height: 220px"] {
        height: 160px !important;
    }

    /* Genre chart — stack vertically, shrink canvas */
    .stats-genre-chart-container {
        flex-direction: column !important;
        align-items: center;
        gap: 12px;
    }

    .stats-genre-chart-container canvas {
        width: 130px !important;
        height: 130px !important;
    }

    .stats-genre-legend {
        width: 100%;
    }

    .stats-genre-legend-item {
        font-size: 11px;
    }

    /* Top artists bubbles */
    .stats-artist-bubbles {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-artist-bubble {
        max-width: 60px;
    }

    .stats-bubble-img {
        width: 44px !important;
        height: 44px !important;
    }

    .stats-bubble-name {
        font-size: 9px;
    }

    .stats-bubble-count {
        font-size: 9px;
    }

    .stats-bubble-bar-container {
        height: 3px;
    }

    /* Ranked lists */
    .stats-ranked-item {
        padding: 8px 8px;
        gap: 6px;
    }

    .stats-ranked-num {
        font-size: 11px;
        min-width: 18px;
    }

    .stats-ranked-img {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }

    .stats-ranked-info {
        min-width: 0;
    }

    .stats-ranked-name {
        font-size: 12px;
    }

    .stats-ranked-meta {
        font-size: 10px;
    }

    .stats-ranked-count {
        font-size: 10px;
        white-space: nowrap;
    }

    .stats-play-btn {
        width: 24px;
        height: 24px;
        font-size: 8px;
        opacity: 1;
    }

    .stats-play-btn-sm {
        width: 20px;
        height: 20px;
        font-size: 7px;
        opacity: 1;
    }

    /* Recent plays */
    .stats-recent-item {
        padding: 6px 8px;
        gap: 6px;
    }

    .stats-recent-title {
        font-size: 12px;
    }

    .stats-recent-artist {
        font-size: 11px;
    }

    .stats-recent-time {
        font-size: 10px;
    }

    /* Library health */
    .stats-full-width {
        padding: 12px;
    }

    .stats-health-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .stats-health-label {
        font-size: 11px;
    }

    .stats-health-value {
        font-size: 16px;
    }

    .stats-format-bar {
        min-height: 20px;
        border-radius: 6px;
    }

    .stats-format-segment {
        font-size: 9px;
    }

    /* Enrichment coverage bars */
    .stats-enrichment {
        gap: 6px;
    }

    .stats-enrich-item {
        gap: 6px;
    }

    .stats-enrich-name {
        font-size: 10px;
        min-width: 55px;
    }

    .stats-enrich-pct {
        font-size: 10px;
        min-width: 28px;
    }

    /* DB storage chart */
    .stats-db-storage-wrap {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .stats-db-chart-container {
        width: 140px;
        height: 140px;
    }

    .stats-db-chart-container canvas {
        width: 140px !important;
        height: 140px !important;
    }

    .stats-db-total-value {
        font-size: 16px;
    }

    .stats-db-legend {
        width: 100%;
    }

    /* Empty state */
    .stats-empty-icon {
        font-size: 40px;
    }

    .stats-empty h3 {
        font-size: 16px;
    }

    .stats-empty p {
        font-size: 13px;
    }
}

/* ======================================
   ARTIST ENRICHMENT RINGS — Mobile
   ====================================== */

@media (max-width: 768px) {
    .artist-enrichment-coverage {
        margin-top: 12px;
    }

    .artist-enrich-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px 4px;
    }

    .artist-enrich-ring {
        width: 36px;
        height: 36px;
    }

    .artist-enrich-ring svg {
        width: 36px;
        height: 36px;
    }

    .artist-enrich-ring .ring-pct {
        font-size: 8px;
    }

    .artist-enrich-label {
        font-size: 0.5em;
    }
}

@media (max-width: 480px) {
    .artist-enrich-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px 8px;
    }
}

/* ======================================
   AUTOMATIONS PAGE — Mobile
   ====================================== */

@media (max-width: 768px) {
    .automations-container {
        padding: 16px;
    }

    .automations-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .automations-header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .automations-header-actions button {
        flex: 1;
        min-width: 120px;
    }

    .automations-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    .automations-stat {
        font-size: 12px;
    }

    /* Builder view */
    .builder-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }

    .builder-name-input,
    .builder-group-input {
        width: 100%;
        font-size: 14px;
    }

    .builder-header-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .builder-header-actions button {
        flex: 1;
        font-size: 12px;
        padding: 8px;
    }

    .builder-content {
        flex-direction: column;
    }

    .builder-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        overflow-y: auto;
    }

    .builder-canvas {
        width: 100%;
        flex: 1;
    }

    .block-item {
        padding: 10px;
    }

    .block-inputs label {
        font-size: 12px;
    }

    .block-inputs input,
    .block-inputs select {
        font-size: 13px;
        padding: 6px 8px;
    }

    .condition-builder {
        flex-direction: column;
        gap: 6px;
    }

    .condition-builder select,
    .condition-builder input {
        width: 100%;
    }

    /* Automation cards */
    .automation-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .automation-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ======================================
   HYDRABASE PAGE — Mobile
   ====================================== */

@media (max-width: 768px) {
    .hydrabase-container {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    .hydrabase-panel {
        width: 100%;
        min-height: 200px;
    }

    .hydrabase-card {
        padding: 12px;
    }

    .hydrabase-card > div {
        flex-direction: column;
        gap: 8px;
    }

    .hydrabase-card input,
    .hydrabase-card select {
        width: 100%;
        box-sizing: border-box;
    }

    .hydra-payload {
        width: 100%;
        min-height: 80px;
    }

    .hydrabase-response-area {
        max-height: 250px;
        font-size: 12px;
    }
}

/* ======================================
   ISSUES PAGE — Mobile (supplement)
   ====================================== */

@media (max-width: 768px) {
    .issues-header-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .issues-filter-select {
        flex: 1;
        min-width: 0;
    }

    .issues-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .issues-stat-card {
        min-width: 0;
        padding: 10px;
    }

    .issues-stat-value {
        font-size: 18px;
    }

    .issue-card-right {
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* ======================================
   HELP / DOCS PAGE — Mobile
   ====================================== */

@media (max-width: 768px) {
    .docs-layout {
        flex-direction: column;
        overflow: visible;
    }

    .docs-sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        max-height: 200px;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .docs-sidebar-header {
        padding: 16px;
    }

    .docs-sidebar-header h3 {
        font-size: 16px;
    }

    .docs-content {
        width: 100%;
        padding: 16px;
        overflow-y: auto;
    }

    .docs-content h1 {
        font-size: 22px;
    }

    .docs-content h2 {
        font-size: 18px;
    }

    .docs-content pre {
        font-size: 12px;
        overflow-x: auto;
    }
}

/* ======================================
   WATCHLIST / ENHANCE BUTTONS — Mobile
   ====================================== */

@media (max-width: 768px) {
    .library-artist-watchlist-btn,
    .library-artist-enhance-btn {
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
    }

    .library-artist-watchlist-btn .watchlist-icon,
    .library-artist-enhance-btn .enhance-icon {
        font-size: 12px;
    }
}