.music-player-wrapper {
    position: fixed;
    top: 0px;
    left: 0px;
    width: fit-content;      /* tightly wraps floating player */
    height: fit-content;
    overflow: visible;       /* keep collapse button clickable */
    z-index: 1001;
    transition: transform 0.3s ease, width 0.3s ease;
}

/* Music Player Background (covers iPod + right controls) */
.music-player-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;        /* full width of floating container */
    height: 100%;       /* full height */
    background: linear-gradient(
        180deg,
        rgba(226, 226, 226, 0.155) 0%,
        rgba(180, 180, 180, 0.5) 100%
    );
    box-shadow: 0px 4px 4px rgba(0,0,0,0.25);
    border-radius: 0 0 5% 0;
    z-index: 1;
}

/* Collapse button with gradient and shadow */
.collapse-btn {
    position: absolute;   
    top: 25%;
    right: -7%;
    padding: 5px 10px;
    font-size: 12px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 999;
    background: linear-gradient(to top, #a0a0a077, #f7f7f7); /* dark bottom, light top */
    box-shadow: 0 2px 6px rgba(0,0,0,0.35); /* subtle shadow */
    transition: all 0.3s ease;
}

/* hover effect */
.collapse-btn:hover {
    filter: brightness(1.1);
}

/* Tooltip */
.collapse-btn::after {
    content: "<<<< [hide music player]"; /* default */
    position: absolute;
    top: -20px;
    right: 50%;
    transform: translateX(30%);
    background: rgba(0, 0, 0, 0.37);
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Show tooltip on hover */
.collapse-btn:hover::after {
    opacity: 1;
}



.collapse-btn.show-tooltip::after {
    opacity: 1;
}

/* Collapsed state tooltip: "show music player" (different position) */
.music-player-wrapper.collapsed .collapse-btn::after {
    content: "show music player -->";
    right: 50%;        /* you can keep same reference */
    transform: translateX(90%); /* slightly more to the right */
}

/* collapsed state */
.music-player-wrapper.collapsed {
    width: 50px;       /* shrink wrapper */
    transform: translateX(-15vw); /* slide partially offscreen */
    overflow: visible; /* important! keep collapse button visible */
}

/* Floating music player overlay */
.music-player-floating {
    position: relative;  /* relative to wrapper for scaling */
    width: 351px;        /* original design width */
    height: 186px;       /* original design height */
    transform-origin: top left; /* scale from top-left corner */
    transition: transform 0.2s ease;
}

.music-player-wrapper.scaled {
    transform: scale(0.7); /* example: 70% size */
}

/* optional: responsive scaling based on viewport */
@media (max-width: 1200px) {
    .music-player-floating {
        transform: scale(0.6);
    }
}

@media (max-width: 800px) {
    .music-player-floating {
        transform: scale(0.5);
    }
}

/* iPod frame keeps aspect ratio */
.ipod-frame {
    position: absolute;
    width: 291px;
    aspect-ratio: 291/120; /* original ratio */
    left: 20px;             /* space from left of floating container */
    top: 50px;              /* space from top */
    background: url('/assets/images/ipod.png') no-repeat center / contain;
    z-index: 3;
}
/* Song cover inside iPod */
.song-cover {
    position: absolute;
    width: 44%;       /* % relative to ipod-frame */
    height: 85%;
    left: 10%;
    top: 8%;
    border-radius: 10px;
    background-color: black;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index: 2;
    box-shadow: inset 1px 2px 6px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Glow animation while playing */
.song-cover.playing {
    animation: glowPulse 1.5s infinite alternate;
}

@keyframes glowPulse {
    0% {
        box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4),
                    0 0 8px rgba(255, 255, 255, 0.2);
        filter: brightness(1.0);
    }
    100% {
        box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4),
                    0 0 18px rgba(255, 255, 255, 0.5);
        filter: brightness(1.1);
    }
}

.song-cover:hover {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4),
                0 0 15px rgba(255, 255, 255, 0.5); /* soft white glow */
    filter: brightness(1.1); /* optional: slight screen brightness boost */
}

.song-cover.playing:hover {
    animation: none;
    cursor: pointer;
    filter: brightness(1.15); /* optional: slight screen brightness boost */
    transform: scale(1.00); /* optional: slightly bigger on hover */
}

.cover-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    z-index: 6;
    image-rendering: pixelated;
}

.cover-loading.hidden {
    display: none;
}

/* optional pulse animation to make it feel alive */
.cover-loading {
    animation: softPulse 1.2s ease-in-out infinite;
}

@keyframes softPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Power message wrapper (centered) */
.power-msg {
    position: absolute;
    top: 44%;
    left: 33%;
    transform: translate(-50%, -50%); /* center properly */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;        /* space between text and gif */
    z-index: 7;      /* below pointer-gif */
    pointer-events: none; /* clicks pass through */
}

.power-msg-text {
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    width: 0;
    border-right: 2px solid white; /* cursor */

    /* Typing animation + cursor blink animation */
    animation: 
        typingPower 1.5s steps(18) forwards,
        blinkCursor 1s step-end infinite;
    animation-delay: 0s, 1.5s;  /* blink starts after typing */
    animation-fill-mode: forwards;
}

/* Typing keyframes */
@keyframes typingPower {
    from { width: 0; }
    to { width: 110px; } /* adjust to match text length */
}

/* Cursor blinking keyframes */
@keyframes blinkCursor {
    0%, 100% { border-color: transparent; }
    50% { border-color: white; }
}

.pointer-gif {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    cursor: pointer; /* clickable */
    z-index: 8; /* above song cover */
}

.pointer-gif.powered-on {
    pointer-events: none;
    display: none; /* optional */
}

.power-screen {
    display: none; /* hidden initially */
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    pointer-events: none; /* allow clicks to pass through except GIF */
}


.loading-gif {
    width: 16px;
    height: 16px;
}

.power-text {
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid #00ff00;
}

/* typing animation class */
.power-text.animated {
    animation: typing 2s steps(15) forwards;
}

@keyframes typing {
    from { width: 0; }
    to { width: 15ch; } /* match the number of characters in "... powering on" */
}

/* Controls */
.player-controls {
    position: absolute;
    left: 160px;
    top: 46px;
    z-index: 20;
    pointer-events: auto;
}

.control-button {
    width: 24px;
    height: 24px;
    margin: 0 13px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}
#scOpenBtn {
    position: absolute;
    left: 4%;
    bottom: -24%;

    display: none;        /* ensures background wraps content */
    width: auto;                  /* make sure width fits content */
    min-width: max-content;       /* ensures button always expands to fit text */
    white-space: nowrap;          /* prevents text from wrapping */

    font-family: 'doto', 'Verdana', sans-serif;
    font-size: 14px;
    font-weight: bold;
    padding: 1px 6px;

    background: linear-gradient(140deg, #ffa77bd5, #b4472fb7);
    color: #fff;
    border: none;
    border-radius: 6px;

    box-shadow: 2px 4px 10px rgba(0,0,0,0.4);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.3s ease, box-shadow 0.3s ease;

    z-index: 40;
}

/* Hover effect */
#scOpenBtn:hover {
    transform: scale(1.05);
    box-shadow: 3px 6px 14px rgba(0,0,0,0.5);
}


/* Optional: hover effect */
#scOpenBtn:hover {
    transform: scale(1.05);
    box-shadow: 3px 6px 14px rgba(0,0,0,0.5);
}

/* Disabled state for buttons */
.control-button.disabled,

#scOpenBtn.disabled {
    opacity: 0;           /* visually faded */
}

/* Enabled state */
#scOpenBtn.enabled {
    opacity: 1;
    pointer-events: auto;
}

/* Play button in powered-off state */
.play-button.power-off {
    background: url('/assets/images/ipodpowerbutton.png') no-repeat center center;
    background-size: contain;

    opacity: 0.2;                 /* less opacity */
    transform: translateX(-2.1px) translateY(-1.5px);  /* nudge left */
    animation: powerPulse 2.2s ease-in-out infinite;
}


@keyframes powerPulse {
    0%, 100% {
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
    50% {
        filter: drop-shadow(0 0 6px rgb(34, 240, 255));
    }
}

.play-button {
    position: absolute; /* now relative to .ipod-bg */
    width: 32px;
    height: 31px;
    left: 188px; /* tweak this to match controller location */
    top: 47px;   /* tweak this to match controller location */
    background: url('/assets/images/ipodplaybutton.png') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    margin-left: 10px;
    z-index: 21;
}

.play-button.pause {
    background: url('/assets/images/ipodpausebutton.png') no-repeat center center;
    background-size: contain;
}

.power-screen, .power-msg {
    pointer-events: none; /* so controls underneath are clickable */
}

/* Mute button (bottom) */
.mute-button {
    width: 20px;
    height: 20px;
    background: url("/assets/images/icon_sound_on.png") no-repeat center;
    background-size: contain;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mute-button.muted {
    background-image: url("/assets/images/icon_sound_off.png");
}


.volume-container {
    position: absolute;
    right: -20px; /* offset to the right of the iPod */
    top: 3px;
    height: 120px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;

    z-index: 10;
}

#volumeSlider {
    width: 20px;  /* thickness */
    height: 75%; /* full height */
    cursor: pointer;

    writing-mode: vertical-lr;
    direction: rtl;
}

.music-note {
    position: absolute;
    width: 44px;
    height: 41px;
    left: 331px;
    top: 150px;
    background: url('/assets/images/gifs/musicnote2.gif') no-repeat center center;
    background-size: contain;
    z-index: 2;

}

.hidden-sc-player {
    position: absolute;
    width: 1px;      /* minimal width */
    height: 1px;     /* minimal height */
    left: -9999px;   /* move it offscreen */
    top: -9999px;    /* move it offscreen */
    overflow: hidden;
}

#loadHint {
  margin-top: 8px;
  padding: 1px;
  margin-left: 3px;
  font-size: 10px;
  color: #baebff;
  opacity: 0.85;
  font-family: monospace;
}


@media (max-width: 480px) {

  /* Wrapper tightly wraps the floating player */
  #musicPlayerWrapper {
    position: fixed;
    top: 60%;               /* small margin from top */
    left: -33px;
    width: fit-content;       /* wrap floating player tightly */
    height: fit-content;
    overflow: visible;        /* keep collapse button clickable */
    z-index: 1001;
    transition: transform 0.3s ease;
    
  }

  /* Collapsed: slide wrapper fully offscreen to left */
  #musicPlayerWrapper.collapsed {
    transform: translateX(calc(-94%)); 
    /* move wrapper width + small extra so collapse button remains visible */
  }

  /* Floating player scales down */
  .music-player-floating {
    width: 351px;             /* original design width */
    height: 186px;            /* original design height */
    transform: scale(1.1);   /* smaller on iPhones */
    transform-origin: top left;
    transition: transform 0.3s ease;
  }

  /* Collapse button outside wrapper */
  .collapse-btn {
    position: absolute;
    top: 25%;
    right: -25px;            /* outside wrapper */
    z-index: 999;
    cursor: pointer;
  }

  /* Keep all buttons and controls clickable */
  .music-player-floating button,
  .music-player-floating input {
    pointer-events: auto;
  }

  /* Optional: adjust music note or other overlays if needed */
  .music-note {
    transform: scale(0.65);
    transform-origin: top left;
  }
}