:root {
    --blur-amount: 40px;
    --border-radius: 20px;
    --primary-color: #fff;
    --secondary-color: rgba(255, 255, 255, 0.6);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Mobile feel: disable text selection */
    background-color: #111;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* The blurred background layer */
.bg-layer {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(var(--blur-amount)) brightness(0.7);
    z-index: -1;
    transition: opacity 0.4s ease-in-out;
}

/* The main player container */
.player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 85%;
    max-width: 350px;
    z-index: 1;
}

.artwork {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    margin-bottom: 2rem;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    transition: opacity 0.4s ease-in-out;
}

.player-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.track-info {
    text-align: center;
    margin-bottom: 2rem;
}

.song-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.artist-name {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin: 0;
    font-weight: 400;
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.time-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-variant-numeric: tabular-nums;
    min-width: 35px;
}

#progressBar {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#progressBar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}
#progressBar::-webkit-slider-thumb:hover { transform: scale(1.2); }

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.play-btn {
    background: #ffffff;
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s;
}

.play-btn:active {
    transform: scale(0.95);
    background: #f0f0f0;
}

.play-btn .material-icons {
    font-size: 40px;
}

.menu-btn {
    position: absolute;
    bottom: 2rem;
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 10px;
}

.next-btn, .shuffle-btn, .timer-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}
.next-btn:hover, .shuffle-btn:hover, .timer-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Tooltips */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
    backdrop-filter: blur(4px);
    margin-bottom: 5px;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: rgba(28, 28, 30, 0.8);
    padding: 2rem;
    border-radius: 24px;
    width: 85%;
    max-width: 400px;
    text-align: left;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.active .modal-content {
    transform: translateY(0) scale(1);
}
.modal-content h3 {
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.modal-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1.5rem;
}
.modal-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
.close-btn {
    background: #3a3a3c;
    border: none;
    color: white;
    padding: 12px 0;
    border-radius: 12px;
    font-size: 1rem;
    width: 100%;
    font-weight: 600;
    margin-top: 1rem;
    cursor: pointer;
}

/* Timer Modal Specifics */
.timer-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
}
.timer-option {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.timer-option:hover, .timer-option.active {
    background: rgba(255,255,255,0.3);
}

/* Desktop Layout */
@media (min-width: 768px) {
    .player-container {
        flex-direction: row;
        max-width: 800px;
        align-items: center;
        gap: 3rem;
    }

    .artwork {
        width: 320px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .player-details {
        align-items: flex-start;
        flex: 1;
    }

    .track-info {
        text-align: left;
        margin-bottom: 1rem;
    }

    .controls {
        flex-direction: row;
        justify-content: flex-start;
        margin-bottom: 0;
        gap: 1.5rem;
    }
}