body {
    padding-top: 0;
    background: #050710;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
}

html {
    background: #050710;
    height: 100%;
    overflow: hidden;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
    pointer-events: none;
}

.header-nav {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(62, 76, 102, 0.88);
    backdrop-filter: blur(14px);
    z-index: 2;
    padding: 10px 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: none;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.header-logo {
    height: 60px;
    width: auto;
    padding-left: 75px;
    display: flex;
    align-items: center;
}

.header-logo-link {
    display: flex;
    align-items: center;
    height: 100%;
}

.sequencer-logo {
    width: 280px;
    max-width: 100%;
    height: auto;
    display: block;
}

.shader-selector-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    padding-right: 75px;
}

.shader-selector-container label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    text-align: right;
}

.shader-selector-container select {
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid #4b5563;
    background: rgba(2, 6, 23, 0.9);
    color: #e5e7eb;
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 180px;
}

.modules-container {
    display: flex;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 12px 40px 80px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    height: calc(var(--app-height, 100dvh) - 70px);
    min-height: 0;
    overflow: hidden;
}

.module {
    background: rgba(62, 76, 102, 0.88);
    backdrop-filter: blur(14px);
    border: none;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
}

.module h2 {
    color: #e5e7eb;
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 1px;
}

.playlist-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.stream-filter-trigger {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.65);
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.stream-filter-trigger:hover {
    background: rgba(30, 41, 59, 0.9);
    transform: scale(1.06);
}

.stream-filter-trigger:focus-visible {
    outline: 2px solid rgba(243, 138, 184, 0.7);
    outline-offset: 2px;
}

.stream-filter-trigger-icon {
    width: 17px;
    height: 17px;
}

.playlist-controls-wrapper {
    position: relative;
    margin: 0;
    padding: 12px;
    border-radius: 10px;
    background: rgba(210, 214, 220, 0.2);
}

.playlist-progress-container + .playlist-controls-wrapper {
    margin-top: 0;
}

.playlist-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.playlist-main-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.playlist-main-btn {
    background: #f38ab8;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s, transform 0.2s;
    padding: 0;
}

.playlist-main-btn#playlistPrevBtn,
.playlist-main-btn#playlistNextBtn {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.playlist-main-btn .play-pause-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.playlist-main-btn:hover {
    background: #e06a9a;
    transform: scale(1.08);
}

.playlist-main-btn:disabled {
    background: rgba(2, 6, 23, 0.5);
    cursor: not-allowed;
    transform: none;
}

.playlist-now-playing {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.playlist-now-playing-text {
    flex: 1;
    min-width: 0;
}

.playlist-now-playing-title {
    color: #e5e7eb;
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-now-playing-artist {
    color: #cbd5f5;
    font-size: 12px;
    margin: 0;
}

.playlist-now-playing-media {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-right: 2px;
}

.playlist-now-playing-pack-art {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.35);
    cursor: pointer;
}

.playlist-now-playing-artist-photo,
.playlist-now-playing-artist-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.45);
    overflow: hidden;
    cursor: pointer;
}

.playlist-now-playing-artist-fallback svg {
    width: 16px;
    height: 16px;
    color: #cbd5f5;
}

.playlist-volume-control {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.playlist-volume-btn {
    background: #d2d6dc;
    color: #334155;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.playlist-volume-btn .playlist-volume-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.playlist-volume-btn:hover {
    background: #b8c0c8;
    transform: scale(1.05);
}

.playlist-volume-slider-wrapper {
    flex: 1;
    min-width: 0;
}

.playlist-volume-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #d2d6dc;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.playlist-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d2d6dc;
    cursor: pointer;
}

.playlist-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d2d6dc;
    cursor: pointer;
    border: none;
}

.playlist-volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: #d2d6dc;
}

.playlist-progress-container {
    margin: 12px 0;
    padding: 0 2px;
}

.playlist-progress-bar {
    width: 100%;
    height: 4px;
    background: #d2d6dc;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
    cursor: pointer;
}

.playlist-progress-fill {
    height: 100%;
    background: #f38ab8;
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 2px;
}

.playlist-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #cbd5f5;
}

.playlist-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: none;
    padding-right: 6px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(2, 6, 23, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(75, 85, 99, 0.5);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.playlist-item:hover,
.playlist-item.playing {
    background: rgba(2, 6, 23, 0.8);
    border-color: rgba(75, 85, 99, 0.75);
}

.playlist-item-art {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.playlist-item-avatar-wrap {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.playlist-item-avatar,
.playlist-item-avatar-fallback {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.45);
}

.playlist-item-avatar {
    object-fit: cover;
}

.playlist-item-avatar-icon {
    width: 20px;
    height: 20px;
    color: #cbd5f5;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-title {
    color: #e5e7eb;
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-artist {
    color: #cbd5f5;
    font-size: 12px;
    margin: 0;
}

.playlist-item-controls {
    display: flex;
    align-items: center;
}

.playlist-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
}

.playlist-meta-field {
    color: #cbd5f5;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(100, 116, 139, 0.45);
    border-radius: 6px;
    padding: 6px 8px;
    white-space: nowrap;
}

.playlist-item-actions {
    margin-right: 4px;
}

.playlist-remix-btn {
    background: rgba(100, 116, 139, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: rgba(203, 213, 245, 0.65);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: not-allowed;
}

.playlist-play-btn {
    background: #f38ab8;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s, transform 0.2s;
}

.playlist-play-btn .playlist-item-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.playlist-play-btn:hover {
    background: #e06a9a;
    transform: scale(1.08);
}

.playlist-play-btn.playing {
    background: #34459b;
}

.playlist-empty {
    text-align: center;
    padding: 40px 20px;
    color: #cbd5f5;
}

.media-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 20px;
    box-sizing: border-box;
}

.media-preview-modal.is-open {
    display: flex;
}

.stream-filter-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11100;
    padding: 20px;
    box-sizing: border-box;
}

.stream-filter-modal.is-open {
    display: flex;
}

.stream-filter-dialog {
    width: min(420px, 94vw);
    background: rgba(62, 76, 102, 0.97);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    padding: 16px;
}

.stream-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.stream-filter-header h3 {
    margin: 0;
    color: #e5e7eb;
    font-size: 18px;
    font-weight: 700;
}

.stream-filter-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.65);
    color: #e5e7eb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.stream-filter-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stream-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stream-filter-field label {
    color: #cbd5f5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.stream-filter-field select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(2, 6, 23, 0.85);
    color: #e5e7eb;
    padding: 10px 12px;
    font-size: 14px;
}

.stream-filter-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding-top: 4px;
}

.stream-filter-toggle-label {
    color: #cbd5f5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.stream-filter-toggle-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #f38ab8;
}

.media-preview-dialog {
    width: min(760px, 96vw);
    background: rgba(62, 76, 102, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    padding: 18px;
    position: relative;
}

.media-preview-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.65);
    color: #e5e7eb;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.media-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 12px;
}

.media-preview-item {
    background: rgba(15, 23, 42, 0.45);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.media-preview-label {
    color: #cbd5f5;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
}

.media-preview-pack-art {
    width: min(280px, 32vw);
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.media-preview-artist-photo,
.media-preview-artist-fallback {
    width: min(280px, 32vw);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.45);
    overflow: hidden;
}

.media-preview-artist-fallback svg {
    width: 64px;
    height: 64px;
    color: #cbd5f5;
}

.media-preview-artist-frame {
    width: min(280px, 32vw);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.media-preview-artist-frame .media-preview-artist-photo,
.media-preview-artist-frame .media-preview-artist-fallback {
    width: 100%;
    height: 100%;
}

.media-preview-artist-username {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 33%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 12px 10px;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.15) 0%, rgba(2, 6, 23, 0.78) 55%, rgba(2, 6, 23, 0.92) 100%);
    color: #f8fafc;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
    .header-nav {
        height: 32px;
        min-height: 32px;
        padding: 0;
        justify-content: center;
    }

    .header-logo {
        padding-left: 0;
        width: 100%;
        height: 40px;
        justify-content: center;
    }

    .header-logo-link {
        height: 40px;
        justify-content: center;
    }

    .sequencer-logo {
        width: 220px;
        margin-top: -10px;
        margin-bottom: -10px;
    }

    .shader-selector-container {
        display: none;
    }

    .modules-container {
        padding: 10px 12px 50px;
        height: calc(var(--app-height, 100dvh) - 32px);
    }

    .module {
        padding: 14px;
        min-height: 0;
    }

    .module h2 {
        font-size: 24px;
    }

    .stream-filter-trigger {
        width: 32px;
        height: 32px;
    }

    .playlist-controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .playlist-main-controls {
        width: 100%;
    }

    .playlist-now-playing {
        width: 100%;
    }

    .playlist-container {
        max-height: none;
    }

    .playlist-item-desktop-only {
        display: none !important;
    }

    .media-preview-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .media-preview-pack-art,
    .media-preview-artist-frame {
        width: min(260px, 72vw);
    }

    .media-preview-artist-username {
        font-size: 16px;
    }
}
