/* ==========================================================================
   1. GLOBAL CUSTOM SCROLLBAR (Fixes Chrome/Safari/Edge/Firefox glitches)
   ========================================================================== */
#trackList::-webkit-scrollbar {
    width: 6px; /* Super thin, discrete track width */
}

#trackList::-webkit-scrollbar-track {
    background: transparent; /* Obliterates the ugly white background block */
}

#trackList::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25); /* Elegant translucent pill shape */
    border-radius: 10px;
}

#trackList::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   2. MAIN APPLICATION STYLES
   ========================================================================== */
body {
    background: #0b0b0b;
    color: #fff;
    font-family: "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

/* BODY STYLE D */
.ipod {
    width: 340px;
    background: linear-gradient(145deg, #d0d3d8, #e6e8ec);
    border-radius: 40px;
    padding: 25px;
    box-shadow:
        0 0 60px rgba(255,255,255,0.14),
        inset 0 0 10px rgba(255,255,255,0.45);
    text-align: center;
    border: 3px solid #c4c7cd;
    position: relative;
}

/* SCREEN */
.screen {
    background: linear-gradient(#dfe8f5, #b7c7d8);
    border-radius: 12px;
    padding: 15px;
    height: 200px;
    color: #000;
    margin-bottom: 20px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
    z-index: 2;
}

/* Reflection overlay */
.screen::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.18) 0%,
        rgba(255,255,255,0.05) 40%,
        rgba(255,255,255,0) 75%
    );
    border-radius: 12px;
    opacity: 0.25;
    transition: opacity 250ms ease-out;
    pointer-events: none;
}

.screen.shimmer::after {
    opacity: 0.45;
}

/* BOOT SCREEN */
#bootScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(#dfe8f5, #b7c7d8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 600ms ease-out;
    z-index: 3;
}

#bootScreen img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

#bootScreen.fadeOut {
    opacity: 0;
    pointer-events: none;
}

/* PLAYLIST FADE-IN */
#trackList,
#playlistProgressBar {
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.screen.ready #trackList,
.screen.ready #playlistProgressBar {
    opacity: 1;
}

/* PLAYLIST MENU SCREEN */
#trackList {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 20px);
    overflow-y: auto;
    z-index: 2;
    box-sizing: border-box;
    padding: 10px 0;
    scrollbar-width: thin; /* Firefox Support */
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent; /* Firefox Support */
}

.track {
    padding: 8px 12px;
    border-bottom: 1px solid #999;
    cursor: pointer;
    color: #000;
    font-size: 14px;
    text-align: left;
    overflow: hidden; /* Masking window for scrolling horizontal ticker */
    position: relative;
}

/* Inner layout for active running track rows */
.track-inner-text {
    display: inline-block;
    white-space: nowrap;
    width: max-content;
}

/* Inactive track items collapse to normal ellipsis (...) formatting safely */
.track:not(.active) .track-inner-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.track.active {
    background: #4a90e2;
    color: #fff;
    font-weight: 600;
}

/* Dynamic automatic animation engine class for playlist menu rows only */
.scroll-active {
    animation: ipodScroll 7s ease-in-out infinite alternate;
}

@keyframes ipodScroll {
    0%, 15% {
        transform: translateX(0);
    }
    85%, 100% {
        transform: translateX(var(--scroll-distance, 0px));
    }
}

/* PROGRESS BAR */
#playlistProgressBar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: #aab7c8;
    border-radius: 3px;
    z-index: 2;
}

#playlistProgress {
    height: 100%;
    width: 0%;
    background: #4a90e2;
}

/* NOW PLAYING SCREEN */
#nowPlayingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Multi-line title layout styling with plenty of room */
.np-title-container {
    width: 100%;
    max-height: 70px;
    overflow-y: auto;
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
}

.np-title {
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    line-height: 1.35;
    color: #000;
    word-break: break-word; /* Soft breaks overly long words if necessary */
}

.np-bar {
    width: 220px;
    height: 6px;
    background: #aab7c8;
    border-radius: 3px;
    overflow: hidden;
}

.np-progress {
    height: 100%;
    width: 0%;
    background: #4a90e2;
}

.np-times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 6px;
    width: 220px;
}

.np-footer {
    font-size: 12px;
    color: #aab7c8;
    margin-top: 14px;
}

/* WHEEL */
.wheel {
    width: 220px;
    height: 220px;
    background: #f2f3f6;
    border-radius: 50%;
    margin: auto;
    position: relative;
    box-shadow:
        inset 0 0 16px rgba(0,0,0,0.18),
        0 4px 10px rgba(0,0,0,0.22);
    border: 3px solid #c7cad0;
}

.wheel::before {
    content: "";
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    height: 40%;
    border-radius: 50%;
    background: radial-gradient(circle at top, rgba(255,255,255,0.5), transparent 65%);
}

/* BUTTONS BASE */
.button {
    position: absolute;
    font-size: 15px;
    color: #444;
    cursor: pointer;
    user-select: none;
    font-weight: bold;
    transition: transform 80ms ease-out, opacity 80ms ease-out;
}

/* MENU BUTTON */
.button.menu {
    top: 25px;
    left: 50%;
    transform: translate(-50%, 0);
}
.button.menu.pressed {
    transform: translate(-50%, 1px);
    opacity: 0.85;
}

/* PLAY BUTTON */
.button.play {
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 0);
}
.button.play.pressed {
    transform: translate(-50%, 1px);
    opacity: 0.85;
}

/* PURE CSS REWIND VECTOR (Left Button) */
.button.left {
    top: 50%;
    left: 25px;
    transform: translate(0, -50%);
    width: 20px;
    height: 14px;
    display: flex;
    font-size: 0 !important;      /* Instantly forces old text/emojis to size 0 */
    color: transparent !important; /* Makes old text completely invisible */
}
.button.left::before,
.button.left::after {
    content: "";
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 9px solid #444; /* Clean solid dark gray arrow */
}
.button.left::after {
    margin-left: -1px; /* Overlaps nicely for seamless double arrow icon */
}
.button.left.pressed {
    transform: translate(0, -49%);
    opacity: 0.7;
}

/* PURE CSS FAST-FORWARD VECTOR (Right Button) */
.button.right {
    top: 50%;
    right: 25px;
    transform: translate(0, -50%);
    width: 20px;
    height: 14px;
    display: flex;
    font-size: 0 !important;      /* Instantly forces old text/emojis to size 0 */
    color: transparent !important; /* Makes old text completely invisible */
}
.button.right::before,
.button.right::after {
    content: "";
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 9px solid #444; /* Clean solid dark gray arrow */
}
.button.right::after {
    margin-left: -1px;
}
.button.right.pressed {
    transform: translate(0, -49%);
    opacity: 0.7;
}

/* CENTER BUTTON */
.center {
    width: 90px;
    height: 90px;
    background: #e0e0e0;
    border-radius: 50%;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 80ms ease-out, opacity 80ms ease-out;
}

.center.pressed {
    transform: translate(-50%, -49%);
    opacity: 0.85;
}

/* EASTER EGG */
#easterEgg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(#dfe8f5, #b7c7d8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 4;
    opacity: 1;
    transition: opacity 400ms ease-out;
}

#easterEgg img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

#easterEgg.fadeOut {
    opacity: 0;
    pointer-events: none;
}