/* ===============================================
   RESET & VARIABLES
   =============================================== */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --background-dark: #0f0f1e;
    --background-medium: #1a1a2e;
    --background-light: #25253e;
    --text-primary: #ffffff;
    --text-secondary: #b4b4b4;
    --text-muted: #6b6b8c;
    --border-color: #2a2a3e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --player-height: 120px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-medium) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: var(--player-height);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===============================================
   HEADER
   =============================================== */

.header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 2px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: var(--transition);
    border-radius: 3px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ===============================================
   HERO SECTION
   =============================================== */

.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    opacity: 0.1;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.1; }
    50% { transform: scale(1.1); opacity: 0.15; }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ===============================================
   BUTTONS
   =============================================== */

.btn {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===============================================
   SECTIONS
   =============================================== */

.section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    text-align: center;
}

/* ===============================================
   ALBUMS GRID
   =============================================== */

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.album-card {
    background: var(--background-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.album-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.album-cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--background-medium);
}

.album-info {
    padding: 1.5rem;
}

.album-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.album-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===============================================
   FILTER BUTTONS
   =============================================== */

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.6rem 1.5rem;
    background: var(--background-light);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-color: transparent;
}

/* ===============================================
   TRACKS LIST
   =============================================== */

.tracks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.track-item {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.track-item:hover {
    background: var(--background-medium);
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.track-item.playing {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* Track card: artwork wrapper and play overlay */
.track-cover-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.track-cover {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.track-play-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

/* SVG inside overlay should be sized */
.track-play-overlay svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Show overlay when hovering the whole card */
.track-item:hover .track-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Make sure overlay doesn't capture pointer when hidden */
.track-play-overlay[aria-hidden="true"] {
    pointer-events: none;
}

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

.track-title {
    width: min-content;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-title.hoverable {
    cursor: pointer;
}

.track-title.hoverable:hover {
    text-decoration: underline;
}

.track-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.track-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Fix info button appearance inside track-actions (round compact button) */
.track-actions .track-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--transition) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.track-actions .track-btn svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
}

.track-actions .track-btn:hover {
    background: rgba(255,255,255,0.02) !important;
    color: var(--primary-color) !important;
    transform: translateY(-2px) !important;
}

/* Player track actions (icons for current track: links + info) */
.player-track-actions {
    display: flex;
    align-items: end;
    margin-left: 12px;
    /*justify-content: center;*/
    /*justify-content: flex-end;*/
}

.player-track-actions .track-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.player-track-actions .track-action-btn svg {
    width: 18px;
    height: 18px;
}

.player-track-actions .track-action-btn:hover {
    background: rgba(255,255,255,0.03);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Info button styling to stand out slightly */
.player-track-actions .info-btn {
    background: linear-gradient(135deg, var(--background-light), rgba(255,255,255,0.02));
    border-radius: 8px;
}

/* ===============================================
   AUDIO PLAYER
   =============================================== */

.player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 30, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 1001;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.player-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.player-cover {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--background-medium);
}

.player-details {
    min-width: 0;
    flex: 1;
}

.player-title {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.player-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    color: var(--primary-color);
    background: var(--background-light);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn-play {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.control-btn-play:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.control-btn-play svg {
    width: 28px;
    height: 28px;
}

.player-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    grid-column: 1 / -1;
}

.player-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 45px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--background-light);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    width: 0;
    transition: width 0.1s linear;
    pointer-events: none; /* CRITICAL: allow clicks to pass through to .progress-bar */
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none; /* CRITICAL: allow clicks to pass through to .progress-bar */
}

.progress-bar:hover .progress-handle {
    opacity: 1;
}

.player-extra {
    display: flex;
    /*width: 100%;*/
    /*margin: 0 auto;*/
    gap: 0.5rem;
    align-items: center;
    /*justify-content: flex-end;*/

    grid-column: 1 / -1;
    justify-content: center;
}

.control-btn-small svg {
    width: 20px;
    height: 20px;
}

.control-btn.active {
    color: var(--primary-color);
}

.volume-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--background-light);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ===============================================
   MODAL
   =============================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--background-medium);
    border-radius: var(--border-radius);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--background-dark);
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--primary-color);
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
}

.modal-cover {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--background-dark);
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

.modal-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modal-info h2 {
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
}

.modal-info p {
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.modal-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.5rem 0.8rem !important;
    background: var(--background-light) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    transition: var(--transition) !important;
    font-weight: 500 !important;
    max-width: 260px !important; /* prevent gigantic buttons */
    overflow: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important; /* don't grow */
}

.modal-link svg,
.modal-link img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.modal-link span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.modal-link:hover {
    background: var(--background-medium) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.modal-link.share-link {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1)) !important;
    border-color: var(--primary-color) !important;
    cursor: pointer;
}

.modal-link.share-link:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2)) !important;
}

/* detail body: two columns on desktop: left = video, right = lyrics */

.modal-video {
    width: 100%;
    aspect-ratio: 16 / 9; /* ensure correct height based on width */
    min-height: 220px;
    max-height: calc(100vh - 360px);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 16px;
    background: var(--background-dark);
}

.modal-video iframe {
    display: block; /* remove inline-block gaps */
    width: 100%;
    height: 100%;
    border: none;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
    .modal-video {
        position: relative !important;
        width: 100% !important;
        padding-top: 56.25% !important; /* 16:9 */
        min-height: 0 !important;
    }

    .modal-video iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/*.modal-lyrics {*/
/*    color: var(--text-secondary);*/
/*    background: rgba(0,0,0,0.03);*/
/*    padding: 1rem;*/
/*    border-radius: 8px;*/
/*    max-height: calc(100vh - 300px);*/
/*    overflow: auto;*/
/*}*/

.modal-lyrics {
    margin-top: 16px;
}

.modal-lyrics pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

.detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    /* top/bottom задаются динамически из JS */
    display: none; /* toggled via .active */
    z-index: 1002;
    background: rgba(0,0,0,0.55); /* dim backdrop */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 6px;/*  small padding around */
}

.detail-panel.active {
    display: block;
}

.detail-container {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(26,26,46,0.98), rgba(15,15,30,0.99));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: auto; /* scroll inside panel */
    position: relative; /* for absolute-close button */
}

/* make header inside panel NOT sticky (so it scrolls) */
.detail-header {
    position: relative; /* allow it to scroll with content */
    background: transparent;
    padding-top: 8px;
}


/* Stronger rules to prevent oversized link buttons and ensure close button stays fixed */
.detail-close {
    position: fixed !important;
    right: 16px !important;
    top: 16px !important; /* JS may override top, but CSS enforces sane default */
    background: rgba(10,10,20,0.95);
    color: var(--text-primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* Prevent modal-link from stretching due to large SVGs or long text */
.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.modal-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.5rem 0.8rem !important;
    background: var(--background-light) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    transition: var(--transition) !important;
    font-weight: 500 !important;
    max-width: 260px !important; /* prevent gigantic buttons */
    overflow: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important; /* don't grow */
}

.modal-link svg,
.modal-link img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.modal-link span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.modal-link:hover {
    background: var(--background-medium) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.modal-link.share-link {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1)) !important;
    border-color: var(--primary-color) !important;
    cursor: pointer;
}

.modal-link.share-link:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2)) !important;
}

/* detail body: two columns on desktop: left = video, right = lyrics */

.modal-video {
    width: 100%;
    aspect-ratio: 16 / 9; /* ensure correct height based on width */
    min-height: 220px;
    max-height: calc(100vh - 360px);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 16px;
    background: var(--background-dark);
}

.modal-video iframe {
    display: block; /* remove inline-block gaps */
    width: 100%;
    height: 100%;
    border: none;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
    .modal-video {
        position: relative !important;
        width: 100% !important;
        padding-top: 56.25% !important; /* 16:9 */
        min-height: 0 !important;
    }

    .modal-video iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/*.modal-lyrics {*/
/*    color: var(--text-secondary);*/
/*    background: rgba(0,0,0,0.03);*/
/*    padding: 1rem;*/
/*    border-radius: 8px;*/
/*    max-height: calc(100vh - 300px);*/
/*    overflow: auto;*/
/*}*/

.modal-lyrics {
    margin-top: 16px;
}

.modal-lyrics pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

.detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    /* top/bottom задаются динамически из JS */
    display: none; /* toggled via .active */
    z-index: 1002;
    background: rgba(0,0,0,0.55); /* dim backdrop */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 6px;/*  small padding around */
}

.detail-panel.active {
    display: block;
}

.detail-container {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(26,26,46,0.98), rgba(15,15,30,0.99));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: auto; /* scroll inside panel */
    position: relative; /* for absolute-close button */
}

/* make header inside panel NOT sticky (so it scrolls) */
.detail-header {
    position: relative; /* allow it to scroll with content */
    background: transparent;
    padding-top: 8px;
}


/* Stronger rules to prevent oversized link buttons and ensure close button stays fixed */
.detail-close {
    position: fixed !important;
    right: 16px !important;
    top: 16px !important; /* JS may override top, but CSS enforces sane default */
    background: rgba(10,10,20,0.95);
    color: var(--text-primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* Prevent modal-link from stretching due to large SVGs or long text */
.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.modal-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.5rem 0.8rem !important;
    background: var(--background-light) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    transition: var(--transition) !important;
    font-weight: 500 !important;
    max-width: 260px !important; /* prevent gigantic buttons */
    overflow: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important; /* don't grow */
}

.modal-link svg,
.modal-link img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.modal-link span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.modal-link:hover {
    background: var(--background-medium) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.modal-link.share-link {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1)) !important;
    border-color: var(--primary-color) !important;
    cursor: pointer;
}

.modal-link.share-link:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2)) !important;
}

/* detail body: two columns on desktop: left = video, right = lyrics */

.modal-video {
    width: 100%;
    aspect-ratio: 16 / 9; /* ensure correct height based on width */
    min-height: 220px;
    max-height: calc(100vh - 360px);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 16px;
    background: var(--background-dark);
}

.modal-video iframe {
    display: block; /* remove inline-block gaps */
    width: 100%;
    height: 100%;
    border: none;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
    .modal-video {
        position: relative !important;
        width: 100% !important;
        padding-top: 56.25% !important; /* 16:9 */
        min-height: 0 !important;
    }

    .modal-video iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/*.modal-lyrics {*/
/*    color: var(--text-secondary);*/
/*    background: rgba(0,0,0,0.03);*/
/*    padding: 1rem;*/
/*    border-radius: 8px;*/
/*    max-height: calc(100vh - 300px);*/
/*    overflow: auto;*/
/*}*/

.modal-lyrics {
    margin-top: 16px;
}

.modal-lyrics pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

.detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    /* top/bottom задаются динамически из JS */
    display: none; /* toggled via .active */
    z-index: 1002;
    background: rgba(0,0,0,0.55); /* dim backdrop */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 6px;/*  small padding around */
}

.detail-panel.active {
    display: block;
}

.detail-container {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(26,26,46,0.98), rgba(15,15,30,0.99));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: auto; /* scroll inside panel */
    position: relative; /* for absolute-close button */
}

/* make header inside panel NOT sticky (so it scrolls) */
.detail-header {
    position: relative; /* allow it to scroll with content */
    background: transparent;
    padding-top: 8px;
}


/* Stronger rules to prevent oversized link buttons and ensure close button stays fixed */
.detail-close {
    position: fixed !important;
    right: 16px !important;
    top: 16px !important; /* JS may override top, but CSS enforces sane default */
    background: rgba(10,10,20,0.95);
    color: var(--text-primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

@media (max-width: 480px) {
    .detail-close {
        right: 10px;
        top: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
}

/* Small polish: make modal-links items not stretch full width */
.modal-links .modal-link {
    white-space: nowrap;
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

@media (max-width: 1024px) {
    .player-container {
        grid-template-columns: 1fr auto;
        gap: 1rem;
    }

    .player-extra {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .player-progress {
        order: -1;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background-medium);
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-menu li {
        text-align: center;
        padding: 0.5rem 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-cover {
        width: 150px;
        height: 150px;
    }

    .player-container {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .player-info {
        order: 2;
    }

    .player-controls {
        order: 1;
    }

    .player-track-actions {
        order: 5;
        justify-content: center;
    }

    .player-progress {
        order: 3;
    }

    .player-extra {
        order: 4;
    }

    .volume-slider {
        width: 80px;
    }

    .track-item {
        padding: 0.8rem;
    }

    .track-cover {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 0.8rem 2rem;
    }

    .section {
        padding: 3rem 0;
    }

    .player {
        padding: 0.8rem;
    }

    .player-cover {
        width: 50px;
        height: 50px;
    }

    .control-btn-play {
        width: 45px;
        height: 45px;
    }

    .modal {
        padding: 1rem;
    }

    .modal-header,
    .modal-body {
        padding: 1.5rem;
    }

    .modal-links {
        justify-content: center;
    }
}

/* ===============================================
   SCROLLBAR STYLING
   =============================================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--background-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.track-item,
.album-card {
    animation: fadeIn 0.5s ease-out;
}
