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

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevent scrolling, pure full-screen experience */
    background-color: #000000;
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    user-select: none;
}

/* 3D Canvas */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Overlay Layer */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to the canvas by default */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

/* Header Aesthetics */
.header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.8);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.titles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Language Toggle */
.lang-toggle {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    pointer-events: auto; /* Allow clicking through UI layer */
}

.lang-btn {
    cursor: pointer;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.lang-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.lang-btn.active {
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin: 0;
    color: #ffffff;
}

.subtitle {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.4em;
    color: rgba(255, 255, 255, 0.5);
}

/* Playlist Panel */
.playlist-panel {
    position: absolute;
    top: 50%;
    right: 3rem;
    transform: translateY(-50%);
    width: 380px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    /* Enable interaction with the list */
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.7) 40%, rgba(0, 0, 0, 0.9) 100%);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.playlist-title {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.tracklist {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 1rem;
}

/* Custom Scrollbar for Tracklist */
.tracklist::-webkit-scrollbar {
    width: 2px;
}

.tracklist::-webkit-scrollbar-track {
    background: transparent;
}

.tracklist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.track-item {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.8rem 0;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: color 0.3s ease, padding-left 0.3s ease, text-shadow 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.track-item:hover {
    color: #ffffff;
    padding-left: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1.0);
}

.track-item.active {
    color: #ffffff;
    font-style: italic;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 1.0);
}

/* Footer & Controls */
.footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: auto;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    color: #ffffff;
}

.playing-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.playing-indicator.active {
    background-color: #ffffff;
    box-shadow: 0 0 10px #ffffff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover:not(:disabled) {
    border-color: #ffffff;
    color: #ffffff;
}

.control-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.guide-text {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.05em;
}

/* Tablet / iPad Portrait Optimization */
@media screen and (max-width: 1024px) {
    .ui-layer {
        padding: 2rem;
    }
    .title {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 0.7rem;
    }
    .lang-toggle {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    .playlist-panel {
        width: 320px;
        right: 2rem;
    }
}

/* Mobile Optimization */
@media screen and (max-width: 768px) {
    .ui-layer {
        padding: 1.5rem;
    }
    .header-top {
        align-items: center; /* Keep toggle on same line */
    }
    .title {
        font-size: 1.5rem;
    }
    .subtitle {
        font-size: 0.6rem;
    }
    .playlist-panel {
        width: calc(100% - 3rem);
        right: 1.5rem;
        height: 50vh;
        top: 55%;
    }
    .track-item {
        font-size: 0.9rem;
    }
    .now-playing {
        font-size: 1rem;
    }
}