/* ============================================
   MOBILE-ONLY UI - TrackWall
   Optimized for touch, thumb-zone, and mobile patterns
   Only applies on mobile devices (checked via JS + media query)
   ============================================ */

/* Match src/utils/mobileDevice.js detectMobileDevice() (viewport ≤1024 + touch / mobile UA) */
@media (max-width: 1024px) {

/* Mobile Root Variables */
:root {
    --m-bg-dark: #0a0a0f;
    --m-bg-panel: #121218;
    --m-bg-card: #1a1a24;
    --m-bg-elevated: #222230;
    --m-primary: #f97316;
    --m-primary-hover: #ea580c;
    --m-primary-glow: rgba(249, 115, 22, 0.3);
    --m-text-main: #ffffff;
    --m-text-muted: #a0a0b0;
    --m-text-subtle: #6b6b7b;
    --m-border: #2a2a3a;
    --m-success: #22c55e;
    --m-danger: #ef4444;
    --m-warning: #eab308;
    --m-info: #3b82f6;

    --m-focus-ring: rgba(249, 115, 22, 0.75);
    --m-focus-ring-width: 2px;
    --m-focus-offset: 2px;

    --m-player-height: 72px;
    --m-nav-height: 64px;
    --m-tab-height: 48px;
    --m-safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --m-header-height: 56px;

    --m-space-xs: 4px;
    --m-space-sm: 8px;
    --m-space-md: 12px;
    --m-space-lg: 16px;
    --m-space-xl: 20px;
    --m-space-2xl: 24px;
    --m-space-3xl: 32px;

    --m-radius-sm: 8px;
    --m-radius-md: 12px;
    --m-radius-lg: 16px;
    --m-radius-xl: 24px;
    --m-radius-full: 9999px;

    --m-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --m-shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --m-shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --m-font-xs: 0.6875rem;
    --m-font-sm: 0.75rem;
    --m-font-base: 0.875rem;
    --m-font-lg: 1rem;
    --m-font-xl: 1.25rem;
    --m-font-2xl: 1.5rem;
    --m-font-3xl: 1.875rem;
    --m-content-max: 860px;
}

/* Base Mobile Reset */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--m-font-base);
    line-height: 1.4;
    background: var(--m-bg-dark);
    color: var(--m-text-main);
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    padding-top: env(safe-area-inset-top, 0px);
}

/* Hide Desktop Elements */
#sidebar,
#landing-header .header-actions,
#license-footer,
.modal-overlay .desktop-only {
    display: none !important;
}

/* ============================================
   AUTH SCREEN - MOBILE
   ============================================ */
#auth-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--m-bg-dark);
    display: flex;
    flex-direction: column;
    padding: var(--m-space-lg);
    padding-top: calc(var(--m-space-3xl) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--m-space-lg) + var(--m-safe-area-bottom));
}

#auth-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50vh;
    background: radial-gradient(ellipse at 50% -20%, rgba(249, 115, 22, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

#landing-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--m-space-lg);
    margin-bottom: var(--m-space-2xl);
}

#landing-header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: var(--m-space-sm);
}

#landing-header .logo img {
    width: 36px;
    height: 36px;
    border-radius: var(--m-radius-sm);
}

#landing-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-content {
    text-align: center;
}

.hero-content h1 {
    font-size: var(--m-font-3xl);
    font-weight: 800;
    margin-bottom: var(--m-space-md);
    background: linear-gradient(135deg, #fff 0%, #a0a0b0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text {
    color: var(--m-text-muted);
    font-size: var(--m-font-base);
    margin-bottom: var(--m-space-xl);
    line-height: 1.5;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--m-space-md);
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--m-space-sm);
    margin-top: var(--m-space-xl);
}

.pill {
    background: var(--m-bg-panel);
    padding: var(--m-space-xs) var(--m-space-md);
    border-radius: var(--m-radius-full);
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    border: 1px solid var(--m-border);
    display: flex;
    align-items: center;
    gap: var(--m-space-xs);
}

.pill i {
    color: var(--m-primary);
}

/* Auth Card - Mobile Sheet */
.auth-card {
    background: var(--m-bg-panel);
    border-radius: var(--m-radius-xl) var(--m-radius-xl) 0 0;
    padding: var(--m-space-xl);
    width: 100%;
    border: 1px solid var(--m-border);
    border-bottom: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-card::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--m-border);
    border-radius: 2px;
    margin: 0 auto var(--m-space-lg);
    display: block;
}

#auth-screen:has(#auth-forms-container:not(.hidden)) #landing-hero {
    opacity: 0.35;
    pointer-events: none;
}

/* ============================================
   APP CONTAINER - MOBILE
   ============================================ */
#app-container {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--m-safe-area-bottom));
    background: var(--m-bg-dark);
    padding-top: env(safe-area-inset-top, 0px);
}

/* Mobile Header */
#mobile-header {
    min-height: var(--m-header-height);
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 0 var(--m-space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

#mobile-header-chat-btn {
    position: relative;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
}

#mobile-header-chat-btn i {
    font-size: 1.35rem;
}

#mobile-header-chat-btn.active {
    color: var(--m-primary);
}

.header-actions {
    display: flex;
    gap: var(--m-space-sm);
}

#mobile-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

#mobile-header-notifications-btn {
    position: relative;
}

.mobile-header-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--m-radius-full);
    background: var(--m-danger);
    color: white;
    font-size: var(--m-font-xs);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main View - Mobile */
#main-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: var(--m-space-lg) !important;
    padding-bottom: calc(var(--m-player-height) + var(--m-nav-height) + var(--m-space-3xl) + var(--m-safe-area-bottom)) !important;
    background: linear-gradient(180deg, var(--m-bg-dark) 0%, #0c0c12 100%);
    scroll-behavior: smooth;
    max-width: var(--m-content-max);
    width: 100%;
    margin: 0 auto;
    content-visibility: auto;
    contain-intrinsic-size: 800px;
}

html.is-mobile #main-view.tw-dawson-embed {
    padding: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    content-visibility: visible !important;
    contain-intrinsic-size: unset !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    min-height: 0 !important;
}

/* DAWson: immersive fullscreen + landscape (orientation lock is best-effort in JS) */
html.is-mobile.tw-dawson-fullscreen.tw-dawson-page {
    overflow: hidden;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page body {
    overflow: hidden;
    touch-action: none;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #app-container {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    padding-top: 0 !important;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #mobile-header,
html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #bottom-nav {
    display: none !important;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #tw-dawson-player-reveal {
    display: none !important;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #player-bar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    transform: none !important;
    pointer-events: none !important;
    overflow: hidden !important;
    border: none !important;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #main-view.tw-dawson-embed {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #main-view.tw-dawson-embed .tw-dawson-iframe {
    position: fixed !important;
    /* Explicit dynamic viewport: avoids iframe height collapsing to ~150px with height:auto on Android */
    top: env(safe-area-inset-top, 0px) !important;
    left: env(safe-area-inset-left, 0px) !important;
    width: calc(100dvw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-width: none !important;
    max-height: none !important;
    right: auto !important;
    bottom: auto !important;
    border: 0 !important;
    z-index: 40 !important;
}

@supports not (width: 100dvw) {
    html.is-mobile.tw-dawson-fullscreen.tw-dawson-page #main-view.tw-dawson-embed .tw-dawson-iframe {
        width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
        height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    }
}

#main-view.tw-dawson-embed .tw-dawson-exit-zone--mobile-touch {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: env(safe-area-inset-left, 0px);
    z-index: 50;
    width: 56px;
    height: 56px;
    pointer-events: auto;
}

#main-view.tw-dawson-embed .tw-dawson-exit-zone--mobile-touch .tw-dawson-exit-fab {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    position: absolute;
    top: 8px;
    left: 8px;
    width: 46px;
    height: 46px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md, 10px);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(12, 12, 18, 0.9);
    color: #fff;
    font-size: 1.25rem;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.35));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#main-view.tw-dawson-embed .tw-dawson-rotate-hint {
    display: none;
}

@media (orientation: portrait) {
    html.is-mobile.tw-dawson-fullscreen #main-view.tw-dawson-embed .tw-dawson-rotate-hint {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 24px);
        padding: 10px 16px;
        border-radius: 999px;
        background: rgba(12, 12, 18, 0.94);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--m-text-main, #f4f4f5);
        font-size: var(--m-font-sm, 0.875rem);
        font-weight: 600;
        z-index: 45;
        pointer-events: none;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        text-align: center;
        line-height: 1.3;
    }

    html.is-mobile.tw-dawson-fullscreen #main-view.tw-dawson-embed .tw-dawson-rotate-hint__icon {
        font-size: 1.25rem;
        flex-shrink: 0;
    }
}

@media (orientation: landscape) {
    html.is-mobile.tw-dawson-fullscreen #main-view.tw-dawson-embed .tw-dawson-rotate-hint {
        display: none !important;
    }
}

/* View Header */
.view-header {
    display: flex;
    flex-direction: column;
    gap: var(--m-space-md);
    margin-bottom: var(--m-space-xl);
}

.view-header .flex {
    flex-wrap: wrap;
}

.view-title {
    font-size: var(--m-font-2xl);
    font-weight: 700;
    margin-bottom: var(--m-space-xs);
    letter-spacing: -0.02em;
}

.view-subtitle {
    font-size: var(--m-font-sm);
    color: var(--m-text-muted);
    margin-top: -2px;
}

/* ============================================
   BOTTOM NAVIGATION - MOBILE
   ============================================ */
#bottom-nav {
    position: fixed;
    bottom: var(--m-safe-area-bottom);
    left: 0;
    right: 0;
    height: var(--m-nav-height);
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    z-index: 100;
    padding: 0 var(--m-space-sm);
    will-change: transform;
    contain: layout paint;
}

/* Avoid double top hairline / bright gradient from base stylesheet */
#bottom-nav::before {
    display: none !important;
    content: none !important;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--m-text-subtle);
    font-size: var(--m-font-xs);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.15s ease;
    position: relative;
    min-height: 52px;
    min-width: 52px;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item i {
    font-size: 1.4rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.nav-item span {
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--m-primary);
}

.nav-item.active i {
    transform: scale(1.12);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--m-primary);
    border-radius: 0 0 2px 2px;
    animation: navIndicatorIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#bottom-nav .nav-item.active::before {
    display: none !important;
}

@keyframes navIndicatorIn {
    from { width: 0; opacity: 0; }
    to { width: 28px; opacity: 1; }
}

.nav-item:active {
    transform: scale(0.92);
}

/* ============================================
   PLAYER BAR - MOBILE
   ============================================ */
#player-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--m-nav-height) + var(--m-safe-area-bottom)) !important;
    height: var(--m-player-height) !important;
    background: rgba(10, 10, 15, 0.95) !important;
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding-left: max(var(--m-space-md), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--m-space-md), env(safe-area-inset-right, 0px)) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    gap: var(--m-space-sm) !important;
    box-sizing: border-box !important;
    z-index: 150 !important;
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    contain: layout paint;
}

/* Hide desktop elements from mobile player bar */
.player-controls,
#player-bar > .flex.justify-end,
.track-info > .player-inline-actions {
    display: none !important;
}

.track-info {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: var(--m-space-sm);
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.track-info .flex-col,
.track-info .player-track-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.track-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--m-radius-sm);
    object-fit: cover;
    background: var(--m-bg-card);
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.track-thumb:active {
    transform: scale(0.95);
}

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

#player-title {
    font-size: var(--m-font-sm);
    font-weight: 600;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    max-height: 2.6em;
    width: 100%;
}

#player-artist {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.player-controls-mobile {
    display: flex !important;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
    grid-column: auto !important;
    grid-row: auto !important;
}

.player-controls-mobile .btn-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
}

.player-controls-mobile .btn-icon i {
    font-size: 1.15rem;
}

.player-controls-mobile .play-pause-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 1rem;
}

.player-actions {
    display: flex;
    align-items: center;
    gap: var(--m-space-xs);
}

.play-pause-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--m-primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.35);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.play-pause-btn:active {
    transform: scale(0.88);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

/* Progress Bar - Mobile Mini */
.progress-mini {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.08);
}

.progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--m-primary), #fb923c);
    transition: width 0.3s linear;
    border-radius: 0 1px 1px 0;
}

/* ============================================
   EXPANDED PLAYER - MOBILE
   ============================================ */
.expanded-player {
    position: fixed;
    inset: 0;
    background: var(--m-bg-dark);
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding: var(--m-space-lg);
    padding-top: calc(var(--m-space-lg) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--m-player-height) + var(--m-space-xl) + var(--m-safe-area-bottom));
    animation: slideUpFull 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

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

.expanded-player .drag-handle {
    width: 40px;
    height: 4px;
    background: var(--m-border);
    border-radius: 2px;
    margin: 0 auto var(--m-space-xl);
}

.expanded-player .cover-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--m-space-xl);
}

.expanded-player .cover-art {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    border-radius: var(--m-radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.expanded-player .cover-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.expanded-player .track-details {
    text-align: center;
    margin-bottom: var(--m-space-xl);
}

.expanded-player .track-title {
    font-size: var(--m-font-xl);
    font-weight: 700;
    margin-bottom: var(--m-space-xs);
}

.expanded-player .track-artist {
    font-size: var(--m-font-base);
    color: var(--m-text-muted);
}

.expanded-player .expanded-controls {
    display: flex;
    flex-direction: column;
    gap: var(--m-space-lg);
}

.expanded-player .progress-section {
    width: 100%;
}

.expanded-player .time-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    margin-top: var(--m-space-sm);
}

.expanded-player input[type="range"] {
    width: 100%;
    height: 32px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

.expanded-player input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}

.expanded-player input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    margin-top: -6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease;
}

.expanded-player input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.3);
}

.expanded-player .main-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--m-space-xl);
}

.expanded-player .control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--m-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.expanded-player .control-btn.primary {
    width: 64px;
    height: 64px;
    background: var(--m-primary);
    font-size: 1.6rem;
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.expanded-player .control-btn.primary:active {
    transform: scale(0.9);
    box-shadow: 0 2px 12px rgba(249, 115, 22, 0.3);
}

.expanded-player .control-btn:active {
    transform: scale(0.85);
    color: var(--m-primary);
}

.expanded-player .secondary-controls {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--m-space-lg);
}

/* ============================================
   SONG CARDS - MOBILE GRID
   ============================================ */
.song-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: var(--m-space-md);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.song-card {
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
    padding: var(--m-space-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
    will-change: transform;
    min-width: 0;
    overflow: hidden;
    contain: content;
}

.song-card:active {
    transform: scale(0.96);
    background: var(--m-bg-elevated);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.15);
}

.song-card .cover-art {
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important;
    aspect-ratio: unset !important;
    border-radius: var(--m-radius-sm);
    margin-bottom: var(--m-space-sm);
    background: var(--m-bg-elevated);
    overflow: hidden;
    position: relative;
    box-shadow: none;
}

.song-card .cover-art img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.song-card:active .cover-art img {
    transform: scale(1.03);
}

.song-card .song-title {
    font-size: var(--m-font-sm);
    font-weight: 600;
    line-height: 1.25;
    white-space: normal;
    overflow: hidden;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.5em;
    max-height: 2.5em;
}

.song-card .song-artist {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.3em;
    max-height: 1.3em;
}

/* ============================================
   SONG ROWS - MOBILE LIST
   ============================================ */
.song-row {
    display: flex !important;
    align-items: center;
    gap: var(--m-space-md);
    padding: var(--m-space-md) !important;
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
    margin-bottom: var(--m-space-sm);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    will-change: transform;
    border: 1px solid transparent;
    contain: content;
}

.song-row > * {
    display: flex !important;
}

.song-row .row-info {
    display: flex !important;
    flex-direction: column;
}

.song-row:active {
    transform: scale(0.98);
    background: var(--m-bg-elevated);
}

.song-row.active {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.15);
}

.song-row.active .song-title {
    color: var(--m-primary) !important;
}

.song-row .row-cover {
    display: block !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: var(--m-radius-sm);
    flex-shrink: 0;
    background: var(--m-bg-elevated);
    overflow: hidden;
}

.song-row .row-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.song-row .song-title {
    font-size: var(--m-font-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-row .song-artist {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-row .row-actions {
    display: flex !important;
    gap: var(--m-space-xs);
    flex-shrink: 0;
    padding-left: var(--m-space-sm);
    margin-left: auto;
}

#main-view .song-row {
    padding-left: var(--m-space-md) !important;
    padding-right: var(--m-space-md) !important;
}

#main-view .song-row,
#main-view .mobile-song-row,
.library-section .mobile-song-row,
.library-section .song-row {
    margin-bottom: var(--m-space-sm);
}

#main-view .song-row:last-child,
#main-view .mobile-song-row:last-child,
.library-section .mobile-song-row:last-child,
.library-section .song-row:last-child {
    margin-bottom: 0;
}

/* ============================================
   HORIZONTAL SCROLL SECTIONS
   ============================================ */
.section-scroll {
    display: flex;
    gap: var(--m-space-md);
    overflow-x: auto;
    overflow-y: hidden;
    padding: var(--m-space-xs) 0;
    margin: 0 calc(-1 * var(--m-space-lg));
    padding-left: var(--m-space-lg);
    padding-right: var(--m-space-lg);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-padding-left: var(--m-space-lg);
    scroll-padding-right: var(--m-space-lg);
    --tw-scroll-fade: var(--m-space-lg);
    mask-image: linear-gradient(to right, transparent 0, black var(--tw-scroll-fade), black calc(100% - var(--tw-scroll-fade)), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black var(--tw-scroll-fade), black calc(100% - var(--tw-scroll-fade)), transparent 100%);
}

.section-scroll::-webkit-scrollbar {
    display: none;
}

.section-scroll .scroll-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: transform 0.2s ease;
}

.section-scroll .scroll-item:active {
    transform: scale(0.96);
}

.section-scroll .card-small {
    width: 120px;
}

.section-scroll .card-small .cover-art {
    width: 120px;
    height: 120px;
    border-radius: var(--m-radius-md);
    margin-bottom: var(--m-space-sm);
    background: var(--m-bg-card);
    overflow: hidden;
}

.section-scroll .card-small .cover-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.section-scroll .card-small .title {
    font-size: var(--m-font-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-scroll .card-small .subtitle {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
}

/* ============================================
   CHARTS - MOBILE
   ============================================ */
.chart-card {
    width: 140px;
    height: 140px;
    border-radius: var(--m-radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.chart-card:active {
    transform: scale(0.96);
}

.chart-card .chart-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--m-bg-card);
}

.chart-card .chart-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--m-space-md);
}

.chart-card .chart-name {
    font-size: var(--m-font-sm);
    font-weight: 700;
    color: white;
}

.chart-card .chart-count {
    font-size: var(--m-font-xs);
    color: rgba(255,255,255,0.7);
}

/* ============================================
   MODALS / BOTTOM SHEETS - MOBILE
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--m-bg-panel);
    width: 100%;
    max-width: 100%;
    border-radius: var(--m-radius-xl) var(--m-radius-xl) 0 0;
    padding: var(--m-space-xl);
    padding-left: max(var(--m-space-xl), env(safe-area-inset-left, 0px));
    padding-right: max(var(--m-space-xl), env(safe-area-inset-right, 0px));
    padding-bottom: calc(var(--m-space-xl) + var(--m-safe-area-bottom));
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
}

/* Base stylesheet sets `.modal--dynamic { width:auto; max-width:90vw; }` — override for mobile sheets */
.modal--dynamic {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.modal::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--m-border);
    border-radius: 2px;
    margin: 0 auto var(--m-space-lg);
    display: block;
}

.modal h2 {
    font-size: var(--m-font-xl);
    font-weight: 700;
    margin-bottom: var(--m-space-lg);
}

.modal-section {
    margin-bottom: var(--m-space-xl);
}

/* Booking detail — full-width bottom sheet, no horizontal clip (dynamic modal) */
#dynamic-modal-overlay.modal-overlay:has(.modal--booking-sheet) {
    padding: 0;
    align-items: flex-end;
    justify-content: center;
}

.modal--booking-sheet.modal--dynamic {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-left: max(var(--m-space-lg), env(safe-area-inset-left, 0px));
    padding-right: max(var(--m-space-lg), env(safe-area-inset-right, 0px));
}

.modal--booking-sheet.modal--dynamic > .btn-icon {
    right: max(var(--m-space-md), env(safe-area-inset-right, 0px));
}

/* Watched artists modal: prevent clipping on narrow screens */
.modal--watched-sheet.modal--dynamic {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

.modal--watched-sheet .tw-watch-modal {
    max-height: min(68vh, 520px);
}

.modal--watched-sheet .tw-watch-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.modal--watched-sheet .tw-watch-row__actions {
    justify-content: flex-start;
}

.modal--watched-sheet .tw-watch-row__actions .btn {
    min-width: 76px;
}

.tw-booking-detail .tw-booking-grid-2 {
    grid-template-columns: 1fr;
}

.tw-booking-detail .tw-booking-detail-loc {
    text-align: left;
    width: 100%;
}

.tw-booking-detail-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
    padding-left: var(--m-space-sm);
    padding-right: var(--m-space-sm);
    white-space: normal;
}

.tw-booking-detail-actions .btn.btn-primary {
    flex: 1 1 100%;
}

/* ============================================
   BUTTONS - MOBILE
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--m-space-sm);
    padding: 0 var(--m-space-xl);
    height: 48px;
    border-radius: var(--m-radius-full);
    font-weight: 600;
    font-size: var(--m-font-base);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--m-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(249, 115, 22, 0.3);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.15s ease;
}

.btn-primary:active {
    transform: scale(0.95);
    background: var(--m-primary-hover);
    box-shadow: 0 1px 4px rgba(249, 115, 22, 0.2);
}

.btn-secondary {
    background: var(--m-bg-card);
    color: white;
    border: 1px solid var(--m-border);
}

.btn-secondary:active {
    background: var(--m-bg-elevated);
}

.btn-ghost {
    background: transparent;
    color: var(--m-text-muted);
}

.btn-ghost:active {
    background: var(--m-bg-card);
    color: white;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--m-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease, color 0.15s ease;
}

.btn-icon:active {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: scale(0.85);
}

.btn-icon i {
    font-size: 1.3rem;
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORM ELEMENTS - MOBILE
   ============================================ */
input, textarea, select {
    background: var(--m-bg-card);
    border: 1px solid var(--m-border);
    color: var(--m-text-main);
    padding: var(--m-space-md) var(--m-space-lg);
    border-radius: var(--m-radius-md);
    width: 100%;
    font-size: max(var(--m-font-base), 16px);
    min-height: 48px;
    outline: none;
    transition: border-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--m-primary);
}

input::placeholder, textarea::placeholder {
    color: var(--m-text-subtle);
}

.field-password input[type="password"],
.field-password input[type="text"] {
    padding-right: max(44px, var(--m-space-xl));
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ============================================
   SEARCH - MOBILE (single outer chrome — no double border with input)
   ============================================ */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--m-space-sm);
    margin-bottom: var(--m-space-xl);
    background: var(--m-bg-card);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-full);
    padding: 0 var(--m-space-md);
    min-height: 48px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-container:focus-within {
    border-color: var(--m-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.search-input {
    flex: 1;
    min-width: 0;
    width: auto;
    height: auto;
    min-height: 44px;
    margin: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    padding: 0;
    box-shadow: none !important;
    font-size: max(var(--m-font-base), 16px);
    color: var(--m-text-main);
    -webkit-appearance: none;
    appearance: none;
}

.search-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

.search-input::placeholder {
    color: var(--m-text-subtle);
}

.search-icon {
    position: static;
    transform: none;
    flex-shrink: 0;
    color: var(--m-text-muted);
    font-size: 1.15rem;
}

.search-clear {
    position: static;
    transform: none;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--m-bg-elevated);
    color: var(--m-text-muted);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.15s ease, transform 0.15s ease;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.search-clear.visible {
    display: inline-flex;
    opacity: 1;
}

.search-clear:active {
    transform: scale(0.94);
}

/* ============================================
   LIBRARY - MOBILE
   ============================================ */
.library-section {
    margin-bottom: var(--m-space-2xl);
}

/* Library page vertical rhythm + full-width cards */
.tw-library-mobile .section-heading {
    margin-top: var(--m-space-2xl);
    margin-bottom: var(--m-space-md);
    font-size: var(--m-font-lg);
    font-weight: 700;
}

.tw-library-mobile .section-heading:first-of-type {
    margin-top: var(--m-space-lg);
}

.tw-library-mobile .chart-scroll-container {
    margin-left: calc(-1 * var(--m-space-lg));
    margin-right: calc(-1 * var(--m-space-lg));
    padding-left: var(--m-space-lg);
    padding-right: var(--m-space-lg);
    margin-bottom: var(--m-space-xl) !important;
    box-sizing: border-box;
    width: calc(100% + 2 * var(--m-space-lg));
    max-width: none;
}

.tw-library-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.tw-library-card .tw-library-card-row {
    gap: var(--m-space-md);
    align-items: center;
}

.tw-library-card .tw-library-card-row .ph-caret-right {
    flex-shrink: 0;
    margin-left: var(--m-space-xs);
    padding: var(--m-space-xs);
    opacity: 0.85;
}

.library-row {
    display: flex;
    align-items: center;
    gap: var(--m-space-md);
    padding: var(--m-space-md);
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
    margin-bottom: var(--m-space-sm);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    will-change: transform;
}

.library-row:active {
    transform: scale(0.98);
    background: var(--m-bg-elevated);
}

.library-row .library-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--m-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.library-row .library-icon.gradient-1 {
    background: linear-gradient(135deg, #7c3aed, #22c55e);
}

.library-row .library-icon.gradient-2 {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.library-row .library-icon.gradient-3 {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
}

.library-row .library-icon i {
    color: white;
}

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

.library-row .library-title {
    font-size: var(--m-font-sm);
    font-weight: 600;
}

.library-row .library-count {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
}

/* ============================================
   PROFILE - MOBILE
   ============================================ */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: var(--m-space-2xl);
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--m-primary);
    margin-bottom: var(--m-space-md);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.profile-name {
    font-size: var(--m-font-xl);
    font-weight: 700;
    margin-bottom: var(--m-space-xs);
}

.profile-handle {
    font-size: var(--m-font-sm);
    color: var(--m-text-muted);
}

.profile-stats {
    display: flex;
    gap: var(--m-space-2xl);
    margin-top: var(--m-space-lg);
    padding: var(--m-space-md) var(--m-space-xl);
    background: var(--m-bg-card);
    border-radius: var(--m-radius-lg);
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: var(--m-font-xl);
    font-weight: 700;
}

.profile-stat-label {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
}

/* ============================================
   TABS - MOBILE (artist dashboard strip — equal slots, line indicator)
   ============================================ */
.tabs {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 0;
    background: var(--m-bg-card);
    padding: 6px 8px;
    border-radius: var(--m-radius-full);
    margin-bottom: var(--m-space-xl);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}

.tabs .tab {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border-radius: var(--m-radius-full);
    font-size: var(--m-font-sm);
    font-weight: 600;
    color: var(--m-text-muted);
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
}

.tabs .tab i {
    font-size: 1.15rem;
    line-height: 1;
}

.tabs .tab.active {
    background: rgba(249, 115, 22, 0.14);
    color: var(--m-primary);
    box-shadow: none;
}

.tabs .tab.active::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    background: var(--m-primary);
    border-radius: 0 0 2px 2px;
}

.tabs .tab:active:not(.active) {
    background: var(--m-bg-elevated);
    transform: scale(0.97);
}

/* Top tracks — tighter rhythm on small viewports */
.tw-dash-track-row {
    gap: 0.5rem;
}

.tw-dash-track-tail {
    padding-left: 4px;
    gap: 6px;
}

.tw-dash-track-btn.btn-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}

.tw-dash-track-btn.btn-icon i {
    font-size: 1.05rem;
}

/* ============================================
   TOAST - MOBILE
   ============================================ */
#toast-container {
    position: fixed;
    bottom: calc(var(--m-player-height) + var(--m-nav-height) + var(--m-space-lg) + var(--m-safe-area-bottom));
    left: var(--m-space-lg);
    right: var(--m-space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--m-space-sm);
    z-index: 500;
    pointer-events: none;
}

/* Auth sheet is fixed to the bottom; toasts in the thumb zone sit under it or off-screen — pin to top while sign-in / reset is open */
body:has(#auth-forms-container:not(.hidden)) #toast-container {
    bottom: auto;
    top: max(var(--m-space-lg), env(safe-area-inset-top, 0px));
    z-index: 12000;
}

.toast {
    background: var(--m-bg-panel);
    color: white;
    padding: var(--m-space-md) var(--m-space-lg);
    border-radius: var(--m-radius-md);
    border-left: 4px solid var(--m-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: var(--m-space-md);
    font-size: var(--m-font-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast.success {
    border-left-color: var(--m-success);
}

.toast.error {
    border-left-color: var(--m-danger);
}

@keyframes toastSlide {
    from {
        transform: translateY(16px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ============================================
   EMPTY STATES - MOBILE
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--m-space-3xl) var(--m-space-xl);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--m-text-subtle);
    margin-bottom: var(--m-space-lg);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: var(--m-font-lg);
    font-weight: 600;
    margin-bottom: var(--m-space-sm);
}

.empty-state p {
    font-size: var(--m-font-sm);
    color: var(--m-text-muted);
    margin-bottom: var(--m-space-lg);
}

/* ============================================
   LOADING - MOBILE
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--m-bg-card) 25%, var(--m-bg-elevated) 37%, var(--m-bg-card) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.8s ease infinite;
    border-radius: var(--m-radius-sm);
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.skeleton-card {
    aspect-ratio: 1;
    border-radius: var(--m-radius-md);
}

.skeleton-text {
    height: 14px;
    margin-top: var(--m-space-sm);
    width: 80%;
}

.skeleton-text-sm {
    height: 10px;
    margin-top: var(--m-space-xs);
    width: 50%;
}

/* ============================================
   PLAYING INDICATOR
   ============================================ */
.playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.playing-indicator .bar {
    width: 3px;
    background-color: var(--m-primary);
    border-radius: 2px;
    animation: soundWave 1s ease-in-out infinite;
}

.playing-indicator .bar:nth-child(1) { height: 6px; animation-delay: 0.0s; }
.playing-indicator .bar:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.playing-indicator .bar:nth-child(3) { height: 8px; animation-delay: 0.4s; }

@keyframes soundWave {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--m-radius-full);
    font-size: var(--m-font-xs);
    font-weight: 600;
}

.badge-primary {
    background: var(--m-primary);
    color: white;
}

.badge-pro {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: black;
}

.badge-admin {
    background: var(--m-danger);
    color: white;
}

/* ============================================
   LIKED PLAYLIST SPECIAL CARD
   ============================================ */
.liked-card {
    background: linear-gradient(135deg, #7c3aed 0%, #22c55e 100%);
    border-radius: var(--m-radius-lg);
    padding: var(--m-space-lg);
    margin-bottom: var(--m-space-xl);
    display: flex;
    align-items: center;
    gap: var(--m-space-lg);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.2), 0 2px 8px rgba(34, 197, 94, 0.15);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.liked-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.15);
}

.liked-card .liked-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--m-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.liked-card .liked-icon i {
    font-size: 1.6rem;
    color: white;
}

.liked-card .liked-info {
    flex: 1;
}

.liked-card .liked-title {
    font-size: var(--m-font-lg);
    font-weight: 700;
    color: white;
}

.liked-card .liked-count {
    font-size: var(--m-font-sm);
    color: rgba(255,255,255,0.8);
}

/* ============================================
   ARTIST VERIFICATION BADGE
   ============================================ */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--m-primary);
}

.verified-badge i {
    font-size: 0.9em;
}

/* ============================================
   OFFLINE INDICATOR
   ============================================ */
.offline-banner {
    background: var(--m-warning);
    color: black;
    padding: var(--m-space-sm) var(--m-space-lg);
    text-align: center;
    font-size: var(--m-font-sm);
    font-weight: 600;
    display: none;
}

.offline-banner.visible {
    display: block;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--m-space-sm); }
.gap-md { gap: var(--m-space-md); }
.gap-lg { gap: var(--m-space-lg); }
.mt-sm { margin-top: var(--m-space-sm); }
.mt-md { margin-top: var(--m-space-md); }
.mt-lg { margin-top: var(--m-space-lg); }
.mb-sm { margin-bottom: var(--m-space-sm); }
.mb-md { margin-bottom: var(--m-space-md); }
.mb-lg { margin-bottom: var(--m-space-lg); }
.text-center { text-align: center; }
.text-muted { color: var(--m-text-muted); }
.text-primary { color: var(--m-primary); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile Song Context Menu */
.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--m-space-md);
    width: 100%;
    padding: var(--m-space-md) var(--m-space-lg);
    background: transparent;
    border: none;
    color: var(--m-text-main);
    font-size: var(--m-font-base);
    font-weight: 500;
    border-radius: var(--m-radius-md);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    text-align: left;
    min-height: 48px;
}

.mobile-menu-item:active {
    background: var(--m-bg-card);
    transform: scale(0.97);
}

.mobile-menu-item i {
    font-size: 1.3rem;
    width: 24px;
    text-align: center;
    color: var(--m-text-muted);
}

/* Mobile stat cards grid */
.stats-cards,
.stat-card {
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--m-space-md);
}

.stat-card {
    padding: var(--m-space-lg);
}

.stat-card .stat-value {
    font-size: var(--m-font-xl);
    font-weight: 700;
}

/* Mobile bg-panel helper */
.bg-panel {
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
}

/* Gap utilities */
.gap-1 { gap: var(--m-space-xs); }
.gap-2 { gap: var(--m-space-sm); }
.gap-3 { gap: var(--m-space-md); }
.gap-4 { gap: var(--m-space-lg); }

/* Rank Badge for Charts */
.rank-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

/* Guest Banner */
.guest-banner {
    background: linear-gradient(135deg, rgba(249,115,22,0.15), rgba(249,115,22,0.05));
    padding: 1rem;
    border-radius: var(--m-radius-lg);
    border: 1px solid rgba(249,115,22,0.3);
    margin-bottom: 1.5rem;
}

.guest-banner h4 {
    color: var(--m-primary);
    margin-bottom: 4px;
}

.guest-banner p {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
    margin-bottom: 12px;
}

/* ============================================
   DASHBOARD (Artist) - MOBILE
   ============================================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--m-space-md);
    margin-bottom: var(--m-space-xl);
}

.dashboard-stat-card {
    background: var(--m-bg-card);
    border-radius: var(--m-radius-md);
    padding: var(--m-space-lg);
}

.dashboard-stat-card .stat-value {
    font-size: var(--m-font-2xl);
    font-weight: 700;
    margin-bottom: var(--m-space-xs);
}

.dashboard-stat-card .stat-label {
    font-size: var(--m-font-xs);
    color: var(--m-text-muted);
}

.dashboard-stat-card.highlight {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.05));
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Better keyboard focus visibility on mobile */
a:focus-visible,
button:focus-visible,
.btn-icon:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
.field-password__toggle:focus-visible,
[tabindex]:focus-visible {
    outline: var(--m-focus-ring-width) solid var(--m-focus-ring);
    outline-offset: var(--m-focus-offset);
}

input[type="range"]:focus-visible {
    outline: var(--m-focus-ring-width) solid var(--m-focus-ring);
    outline-offset: var(--m-focus-offset);
}

.search-input:focus-visible,
.search-clear:focus-visible {
    outline: none;
}

/* Constrain heavy blur on lower-end devices */
@media (max-width: 480px) {
    #mobile-header,
    #bottom-nav,
    #player-bar {
        backdrop-filter: blur(14px) saturate(140%);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
    }

    .song-grid {
        gap: var(--m-space-sm);
    }
}

/* Respect reduced motion user preference and cut costly animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .nav-item.active i,
    .song-card:active,
    .song-row:active,
    .play-pause-btn:active,
    .expanded-player .control-btn.primary:active {
        transform: none !important;
    }
}

/* ============================================
   ANDROID-SPECIFIC FIXES
   ============================================ */
@supports (-webkit-touch-callout: none) {
    #main-view {
        padding-bottom: calc(var(--m-player-height) + var(--m-nav-height) + env(safe-area-inset-bottom) + 20px);
    }
}

/* ============================================
   SAFE AREA ADJUSTMENTS
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    #bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .expanded-player {
        padding-bottom: calc(var(--m-player-height) + var(--m-space-xl) + env(safe-area-inset-bottom));
    }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */
@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --m-player-height: 60px;
        --m-nav-height: 48px;
    }

    .expanded-player .cover-container {
        padding: var(--m-space-md);
    }

    .expanded-player .cover-art {
        max-width: 180px;
    }
}

/* ============================================
   SMALL HEIGHT PHONES
   ============================================ */
@media (max-height: 600px) {
    .expanded-player .cover-container {
        flex: none;
        padding: var(--m-space-sm);
    }

    .expanded-player .cover-art {
        max-width: 200px;
    }
}

/* ============================================
   DOWNLOAD PROGRESS BAR - MOBILE
   ============================================ */
#global-download-bar {
    bottom: calc(var(--m-player-height) + var(--m-nav-height) + var(--m-space-lg) + var(--m-safe-area-bottom)) !important;
    right: var(--m-space-lg) !important;
    left: var(--m-space-lg) !important;
    width: auto !important;
    max-width: none !important;
}

/* ============================================
   DASHBOARD MOBILE OVERRIDES
   ============================================ */
.stat-card .text-xs {
    font-size: var(--m-font-xs);
}

.stat-card .text-2xl {
    font-size: var(--m-font-xl);
}

/* Fix song-row grid layout on mobile */
.song-row {
    grid-template-columns: none !important;
}

/* Keep spacing rhythm consistent across all mobile song lists */
.mobile-song-row {
    gap: var(--m-space-md) !important;
    padding: var(--m-space-md) !important;
    border-radius: var(--m-radius-md) !important;
    background: var(--m-bg-card) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    min-height: 72px;
    margin-bottom: var(--m-space-sm) !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-song-row:last-child {
    margin-bottom: 0 !important;
}

/* Shared wrapper for all mobile songlists (home/chart/album/etc.) */
.mobile-song-list {
    display: flex;
    flex-direction: column;
    gap: var(--m-space-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-song-list .mobile-song-row,
.mobile-song-list .song-row {
    margin-bottom: 0 !important;
}

/* Fullscreen player: safe areas + readable titles on narrow phones */
.fullscreen-player-panel {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

#fullscreen-player-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

.fullscreen-player-artist {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Lyrics overlay: clear player + bottom nav + home indicator */
#lyrics-overlay {
    padding: var(--m-space-lg);
    padding-top: calc(var(--m-space-lg) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--m-player-height) + var(--m-nav-height) + var(--m-space-lg) + var(--m-safe-area-bottom));
    padding-left: max(var(--m-space-lg), env(safe-area-inset-left, 0px));
    padding-right: max(var(--m-space-lg), env(safe-area-inset-right, 0px));
}

#lyrics-overlay .lyric-line {
    font-size: clamp(1rem, 4.2vw, 1.35rem);
    padding-left: var(--m-space-sm);
    padding-right: var(--m-space-sm);
}

/* Profile CTAs: respect safe area + match main padding */
.profile-visitor-actions {
    padding-left: max(var(--m-space-md), env(safe-area-inset-left, 0px));
    padding-right: max(var(--m-space-md), env(safe-area-inset-right, 0px));
}

/* Very narrow phones: single-column discovery grid */
@media (max-width: 360px) {
    .song-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: var(--m-space-md);
    }

    .hero-content h1 {
        font-size: clamp(1.5rem, 7vw, 1.75rem);
    }

    #main-view {
        padding-left: max(var(--m-space-md), env(safe-area-inset-left, 0px)) !important;
        padding-right: max(var(--m-space-md), env(safe-area-inset-right, 0px)) !important;
    }
}

html.is-mobile #tw-dawson-player-reveal.tw-dawson-player-reveal {
    bottom: calc(var(--m-nav-height) + var(--m-safe-area-bottom) + 10px);
}

/* ========= Trackwall Music Awards — mobile (layout-safe; class set in awardsView) ========= */
html.is-mobile #main-view.tw-main-awards {
    content-visibility: visible;
    contain-intrinsic-size: unset;
}

html.is-mobile .tma-view {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-bottom: var(--m-space-md);
}

html.is-mobile .tma-ceremony-hero {
    padding: var(--m-space-lg) var(--m-space-md) var(--m-space-xl);
    margin-bottom: var(--m-space-lg);
    border-radius: var(--m-radius-lg);
    background: linear-gradient(
        165deg,
        rgba(251, 191, 36, 0.12) 0%,
        rgba(249, 115, 22, 0.06) 45%,
        rgba(18, 18, 24, 0.92) 100%
    );
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow: var(--m-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.is-mobile .tma-ceremony-medallion {
    width: 4rem;
    height: 4rem;
    margin-bottom: var(--m-space-md);
}

html.is-mobile .tma-ceremony-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
    margin-bottom: var(--m-space-md);
}

/* No sticky tabs: they shared top:0 with .tma-cat-nav and fought overflow-x:hidden on #main-view. */
html.is-mobile .tma-tabs {
    position: relative;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 4px;
    padding: 6px;
    margin-bottom: var(--m-space-lg);
    border-radius: var(--m-radius-lg);
    background: rgba(12, 12, 18, 0.95) !important;
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow: var(--m-shadow-sm);
    scrollbar-width: none;
}

html.is-mobile .tma-tabs::-webkit-scrollbar {
    display: none;
}

html.is-mobile #main-view button.tma-tab,
html.is-mobile button.tma-tab {
    flex: 1 1 0;
    min-width: 0;
    scroll-snap-align: start;
    min-height: 44px;
    padding: 0.5rem 0.4rem;
    font-size: var(--m-font-xs);
}

html.is-mobile .tma-controls-strip {
    max-width: none;
    width: 100%;
    margin-bottom: var(--m-space-lg);
    padding: var(--m-space-md) var(--m-space-lg);
    border-radius: var(--m-radius-lg);
    background: rgba(0, 0, 0, 0.28);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Scroll in flow only — sticky + parent overflow-x:hidden caused jumpy overlap on phones. */
html.is-mobile .tma-cat-nav {
    position: relative;
    top: auto;
    z-index: 1;
    margin: 0 0 var(--m-space-md);
    padding: var(--m-space-sm) 0;
    margin-left: 0;
    margin-right: 0;
    gap: var(--m-space-sm);
}

html.is-mobile #main-view button.tma-cat-nav__chip,
html.is-mobile button.tma-cat-nav__chip {
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    font-size: var(--m-font-sm);
    border-radius: var(--m-radius-full);
}

html.is-mobile .tma-cat-card--race,
html.is-mobile .tma-cat-card--results {
    margin-bottom: var(--m-space-lg) !important;
    padding: var(--m-space-lg) !important;
    border-radius: var(--m-radius-lg) !important;
}

html.is-mobile .tma-hero--live,
html.is-mobile .tma-hero--final {
    padding: var(--m-space-lg);
    margin-bottom: var(--m-space-lg);
}

html.is-mobile .tma-row {
    min-height: 48px;
    padding: 0.65rem 0.55rem;
}

html.is-mobile .tma-row-meta {
    min-width: 0;
}

html.is-mobile .tma-name {
    overflow-wrap: anywhere;
}

html.is-mobile .tma-metric {
    overflow-wrap: anywhere;
}

html.is-mobile .tma-row .tma-pace-badge,
html.is-mobile .tma-row .tma-tier-badge {
    font-size: 0.55rem;
    padding: 0.28rem 0.42rem;
    max-width: 36%;
    text-align: center;
    line-height: 1.2;
}

html.is-mobile .tma-cat-title {
    flex-wrap: wrap;
    min-width: 0;
    gap: var(--m-space-sm);
}

html.is-mobile .tma-cat-title span {
    min-width: 0;
    overflow-wrap: anywhere;
}

html.is-mobile .tma-podium {
    gap: 0.35rem;
    padding-left: 0;
    padding-right: 0;
}

html.is-mobile .tma-podium-slot {
    min-width: 0;
    padding: 0.55rem 0.3rem 0.65rem;
}

html.is-mobile .tma-fan-vote--cta {
    border-radius: var(--m-radius-lg) !important;
    padding: var(--m-space-lg) !important;
}

html.is-mobile .tma-fan-vote__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--m-space-sm);
}

html.is-mobile .tma-fan-vote__pill {
    min-width: 0;
    text-align: center;
    align-items: center;
}

html.is-mobile .tma-rules-details__summary {
    padding: var(--m-space-md) var(--m-space-lg);
    font-size: var(--m-font-base);
    min-height: 48px;
}

html.is-mobile .tma-rules-details .tma-rules-card {
    padding: var(--m-space-lg) !important;
}

@media (max-width: 380px) {
    html.is-mobile .tma-podium-name {
        font-size: 0.68rem;
    }

    html.is-mobile .tma-podium-metric {
        font-size: 0.58rem;
    }

    html.is-mobile .tma-fan-vote__stats {
        grid-template-columns: 1fr;
    }
}

} /* End media query */
