* {
    -webkit-user-drag: none; /* For Safari */
    -moz-user-drag: none;     /* For Firefox */
    -ms-user-drag: none;      /* For IE/Edge */
    -user-drag: none;          /* Standard for other browsers */
}

/* Enable dragging for drag handles */
[draggable="true"] {
    -webkit-user-drag: element !important;
    -moz-user-drag: element !important;
    -ms-user-drag: element !important;
    user-drag: element !important;
    cursor: move !important;
}

.fade-out {
    @apply transition-all duration-500 ease-in-out opacity-0 scale-90;
}

.hide {
    opacity: 0;
    max-height: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
}
.move-center {
    margin-left: auto;
    margin-right: auto;
}

@keyframes spin {
    100% { transform: rotate(360deg); } 
}

.record {
    background: 
        linear-gradient(30deg, transparent 47%, rgba(42, 41, 40, .85) 50%) no-repeat 100% 0,
        linear-gradient(70deg, rgba(42, 41, 40, .85) 55%, transparent 60%) no-repeat 0 100%,
        repeating-radial-gradient(#2a2928, #2a2928 4px, #ada9a0 5px, #2a2928 6px);
    background-size: 100% 100%, 100% 50%, 100% 100%;
    animation: spin 3.2s linear infinite;
}

/*animation: spin 3.2s linear infinite;*/

/* original
.record {
    background: 
        linear-gradient(30deg, transparent 40%, rgba(42, 41, 40, .85) 40%) no-repeat 100% 0,
        linear-gradient(60deg, rgba(42, 41, 40, .85) 50%, transparent 60%) no-repeat 0 100%,
        repeating-radial-gradient(#2a2928, #2a2928 4px, #ada9a0 5px, #2a2928 6px);
    background-size: 50% 100%, 100% 50%, 100% 100%;
    
}*/

/* best prototype
.record {
    background: 
        linear-gradient(30deg, transparent 47%, rgba(42, 41, 40, .85) 50%) no-repeat 100% 0,
        linear-gradient(70deg, rgba(42, 41, 40, .85) 55%, transparent 60%) no-repeat 0 100%,
        repeating-radial-gradient(#2a2928, #2a2928 4px, #ada9a0 5px, #2a2928 6px);
    background-size: 100% 100%, 100% 50%, 100% 100%;
    animation: spin 3.2s linear infinite;
}
*/

/* ==========================================
   EDITABLE TITLE STYLES
   ========================================== */

.editable-title {
    position: relative;
    outline: none;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 4px 8px;
    margin-left: calc(4rem - 8px); /* Compensate for padding */
}

/* Responsive adjustments for album title */
@media (max-width: 1300px) and (orientation: landscape) {
    #albumTitle {
        margin-left: 2rem !important; /* Reduce left margin */
    }
}

@media (max-width: 1100px) and (orientation: landscape) {
    #albumTitle {
        margin-left: 1.5rem !important;
        margin-top: 80px !important; /* Reduce top margin */
        font-size: 2rem !important; /* Reduce from text-4xl to text-3xl equivalent */
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    #albumTitle {
        margin-left: 1rem !important;
        margin-top: 64px !important;
        font-size: 1.75rem !important; /* Further reduce size */
    }
}

@media (max-width: 800px) and (orientation: landscape) {
    #albumTitle {
        margin-left: 0.75rem !important;
        margin-top: 48px !important;
        font-size: 1.5rem !important; /* text-2xl equivalent */
    }
}

.editable-title:hover:not([contenteditable="true"]) {
    background-color: rgba(255, 255, 255, 0.05);
}

.editable-title[contenteditable="true"] {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: text;
}

.editable-title[contenteditable="true"]:focus {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* Prevent text selection when not editing */
.editable-title[contenteditable="false"] {
    user-select: none;
}

/* ==========================================
   EDITABLE AUTHOR STYLES
   ========================================== */

.editable-author {
    position: relative;
    outline: none;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 2px 6px;
}

.editable-author:hover:not([contenteditable="true"]) {
    background-color: rgba(255, 255, 255, 0.05);
}

.editable-author[contenteditable="true"] {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: text;
}

.editable-author[contenteditable="true"]:focus {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* Prevent text selection when not editing */
.editable-author[contenteditable="false"] {
    user-select: none;
}

/* ==========================================
   MARQUEE ANIMATION FOR OVERFLOWING TEXT
   ========================================== */

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Marquee animation for now playing title when text overflows */
#playablename.marquee {
    display: inline-block;
    animation: marquee 20s linear infinite;
    white-space: nowrap;
    padding-right: 50px; /* Add space before text loops */
}

/* Marquee animation for playlist task names when text overflows */
.task-name.marquee {
    display: inline-block;
    animation: marquee 20s linear infinite;
    white-space: nowrap;
    padding-right: 50px; /* Add space before text loops */
}

/* ==========================================
   DRAG AND DROP STYLES
   ========================================== */

/* Smooth transitions for all playlist tasks */
.playlist-items > div {
    transition: transform 0.4s ease-in-out;
    position: relative;
    will-change: transform;
}

/* Dragging state - keep fully visible, just elevate */
.dragging {
    z-index: 1000 !important;
    cursor: grabbing !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Drag handle visual enhancement */
[draggable="true"] {
    transition: color 0.2s ease-in-out;
}

[draggable="true"]:hover {
    color: #1f2937 !important;
}

[draggable="true"]:active {
    cursor: grabbing;
}

/* ==========================================
   MODERN INPUT STYLES
   ========================================== */

/* Color palette animation */
#colorPalette {
    animation: slideUp 0.2s ease-out;
    transform-origin: bottom left;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Color square hover effects */
#colorSquare:hover #squareContent {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(59, 130, 246, 0.3);
}

/* Input field focus glow */
#queuebar:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Add button pressed effect */
#addTaskBtn:active {
    transform: scale(0.95);
}

/* Color grid button hover effects */
#colorGrid button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Image preview hover effect */
#imagePreview:hover img {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Custom scrollbar for palette */
#colorPalette::-webkit-scrollbar {
    width: 4px;
}

#colorPalette::-webkit-scrollbar-track {
    background: transparent;
}

#colorPalette::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 2px;
}

#colorPalette::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8);
}

/* Pulse animation for palette indicator */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   VINYL CONTROL BUTTON STYLES
   ========================================== */

/* Vinyl record player power button - 1.5x more 3D, 20% larger, dynamic theme color */
#vinylControlBtn {
    font: inherit;
    background-color: var(--color, #B8D576);
    border: 0;
    color: #242424;
    border-radius: 50%;
    font-size: 0.9rem;
    width: 2.25rem;
    height: 2.25rem;
    font-weight: 600;
    text-shadow: 0 0.045em 0 rgba(255, 255, 255, 0.3);
    box-shadow:
        inset 0 0.045em 0 0 rgba(255, 255, 255, 0.2),
        0 0.045em 0 0 rgba(0, 0, 0, 0.1),
        0 0.09375em 0 0 rgba(0, 0, 0, 0.15),
        0 0.1875em 0 0 rgba(0, 0, 0, 0.2),
        0 0.234375em 0 0 rgba(0, 0, 0, 0.25),
        0 0.28125em 0 0 rgba(0, 0, 0, 0.3),
        0 0.1875em 0.375em 0 rgba(0, 0, 0, 0.35);
    transition: 0.15s ease;
    cursor: pointer;
    position: absolute;
    bottom: 1.625rem;
    left: 1.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15; /* Above thumbnail (z-10) but below modals */
}

/* Hidden state - ensure button is completely invisible when vinyl mode is off */
#vinylControlBtn.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Power on state - dynamic theme color */
#vinylControlBtn.power-on {
    background-color: var(--color, #B8D576);
    color: #2a2a2a;
    text-shadow: 0 0.045em 0 rgba(255, 255, 255, 0.3);
    box-shadow:
        inset 0 0.045em 0 0 rgba(255, 255, 255, 0.2),
        0 0.045em 0 0 rgba(0, 0, 0, 0.1),
        0 0.09375em 0 0 rgba(0, 0, 0, 0.15),
        0 0.1875em 0 0 rgba(0, 0, 0, 0.2),
        0 0.234375em 0 0 rgba(0, 0, 0, 0.25),
        0 0.28125em 0 0 rgba(0, 0, 0, 0.3),
        0 0.1875em 0.375em 0 rgba(0, 0, 0, 0.35);
}

#vinylControlBtn svg {
    transition: transform 0.15s ease;
}

#vinylControlBtn:hover svg {
    transform: scale(1.05);
}

/* ==========================================
   TONE ARM STYLES FOR RECORD PLAYER
   ========================================== */

/* Tone arm container - positioned under vinyl, stationary */
.tone-arm-container {
    position: absolute;
    transform: scale(0.759) rotate(90deg); /* Base state - lifted off vinyl */
    transform-origin: 411.5px 147.5px; /* Center of arm-base - fixed pivot point */
    left: -125px;
    top: 143px; /* Start position moved down 10px */
    z-index: 10;
    visibility: hidden;
    transition: top 0.5s ease-in-out, transform 0.3s ease-in-out;
    width: 451px;
    height: 200px;
}

/* Final position when vinyl mode is active */
.tone-arm-container.deployed {
    top: 203px !important; /* Move down by exactly 60px (143px + 60px) */
    visibility: visible !important;
}

/* Tone arm tilted to touch vinyl when playing */
.tone-arm-container.playing {
    transform: scale(0.759) rotate(115deg); /* 90deg + 25deg to tilt toward vinyl */
    transform-origin: 411.5px 147.5px; /* Same fixed pivot point as base state */
    transition: transform 0.3s ease-in-out; /* Smooth tilt animation */
}

/* Original tone arm CSS - unchanged */
.arm-base {
    width: 79px;
    height: 79px;
    background: black;
    position: absolute;
    left: 372px;
    top: 108px;
    border-radius: 50%;
}

.arm-base::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: lightgray;
    top: 52px;
    left: 56px;
}

.pivot-base {
    width: 40px;
    height: 40px;
    background: lightgray;
    position: absolute;
    left: 392px;
    top: 127px;
    border-radius: 50%;
}

.pivot-mech {
    width: 14px;
    height: 40px;
    background: white;
    position: absolute;
    left: 412px;
    top: 117px;
    transform: rotate(-44deg);
    transform-origin: bottom left;
    border-radius: 15px 15px 30px 30px;
}

.weight-arm {
    width: 13px;
    height: 48px;
    background: darkgray;
    position: absolute;
    left: 412px;
    top: 82px;
    transform: rotate(20deg);
    transform-origin: bottom;
    border-radius: 4px 4px 0px 0px;
}

.weight {
    width: 27px;
    height: 35px;
    background: dimgray;
    position: absolute;
    left: 408px;
    top: 87px;
    transform: rotate(20deg);
    transform-origin: bottom;
    border-radius: 4px;
}

.weight::before {
    content: "";
    width: 27px;
    height: 12px;
    background: lightgray;
    position: absolute;
    left: 0px;
    top: 9px;
}

/* Tone arm */
.tone-arm {
    width: 14px;
    height: 159px;
    background: darkgray;
    position: absolute;
    left: 406px;
    top: 165px;
    border-radius: 0px 0px 2px 0px;
}

.tone-arm::before {
    content: "";
    width: 14px;
    height: 60px;
    background: darkgray;
    position: absolute;
    left: 5px;
    top: 152px;
    transform: rotate(38deg);
    transform-origin: top;
    border-radius: 0px 9px 0px 0px;
}

.headshell {
    width: 22px;
    height: 40px;
    background: black;
    position: absolute;
    left: 345px;
    top: 350px;
    transform: rotate(44deg);
    transform-origin: bottom;
    border-radius: 30px 30px 15px 15px;
}

.headshell::after {
    content: "";
    width: 17px;
    height: 5px;
    background: gray;
    position: absolute;
    left: 22px;
    top: 17px;
    transform: rotate(0deg);
    transform-origin: bottom;
    border-radius: 0px 5px 5px 0px;
}

/* ==========================================
   RESPONSIVE DESIGN - DESKTOP SCALING
   Priority: Shrink playlist FIRST, keep playbox full size as long as possible
   Total width calculated: playbox + gap + playlist + padding must fit screen
   ========================================== */

/* 1200-1300px: Playbox 480px (full), Playlist 680px - Total ~1200px */
@media (min-width: 1200px) and (max-width: 1300px) and (orientation: landscape) {
    body > div.flex {
        gap: 1.5rem;
        padding: 0 1rem;
    }

    #playbox {
        width: 480px !important;
    }

    #playlist, #donelist {
        width: 680px !important;
    }

    body > div.flex > div:last-child,
    body > div.flex > div:last-child > div {
        width: 680px !important;
    }
}

/* 1100-1199px: Playbox 480px (full), Playlist 580px - Total ~1100px */
@media (min-width: 1100px) and (max-width: 1199px) and (orientation: landscape) {
    body > div.flex {
        gap: 1.5rem;
        padding: 0 1rem;
    }

    #playbox {
        width: 480px !important;
    }

    #playlist, #donelist {
        width: 580px !important;
    }

    body > div.flex > div:last-child,
    body > div.flex > div:last-child > div {
        width: 580px !important;
    }
}

/* 1000-1099px: Playbox 440px, Playlist 520px, Thumbnail 320px - Total ~1000px */
@media (min-width: 1000px) and (max-width: 1099px) and (orientation: landscape) {
    body > div.flex {
        gap: 1.25rem;
        padding: 0 1rem;
    }

    #playbox {
        width: 440px !important;
    }

    /* Thumbnail scales down to fit */
    #thumbnailcase {
        margin-top: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    #thumbnailcase, #thumbnail {
        width: 320px !important;
        height: 320px !important;
    }

    /* Vinyl scales proportionally (320/350 = 0.914 scale) */
    #vinylProgressBar {
        width: 256px !important;
        height: 256px !important;
    }

    #vinyl {
        width: 238px !important;
        height: 238px !important;
    }

    #vinylmiddle {
        width: 62px !important;
        height: 62px !important;
    }

    /* Tone arm: 0.914 * 0.759 = 0.694 scale */
    .tone-arm-container {
        transform: scale(0.694) rotate(90deg) !important;
        left: -107px !important;
        top: 131px !important;
    }

    .tone-arm-container.deployed {
        top: 186px !important;
    }

    .tone-arm-container.playing {
        transform: scale(0.694) rotate(115deg) !important;
    }

    #playlist, #donelist {
        width: 520px !important;
    }

    body > div.flex > div:last-child,
    body > div.flex > div:last-child > div {
        width: 520px !important;
    }
}

/* 900-999px: Playbox 400px, Playlist 460px, Thumbnail 290px - Total ~900px */
@media (min-width: 900px) and (max-width: 999px) and (orientation: landscape) {
    body > div.flex {
        gap: 1.25rem;
        padding: 0 1rem;
    }

    #playbox {
        width: 400px !important;
    }

    #thumbnailcase {
        margin-top: 2rem !important;
        margin-bottom: 0.5rem !important;
    }

    #thumbnailcase, #thumbnail {
        width: 290px !important;
        height: 290px !important;
    }

    /* Vinyl scales proportionally (290/350 = 0.829 scale) */
    #vinylProgressBar {
        width: 232px !important;
        height: 232px !important;
    }

    #vinyl {
        width: 216px !important;
        height: 216px !important;
    }

    #vinylmiddle {
        width: 56px !important;
        height: 56px !important;
    }

    /* Tone arm: 0.829 * 0.759 = 0.629 scale */
    .tone-arm-container {
        transform: scale(0.629) rotate(90deg) !important;
        left: -102px !important;
        top: 118px !important;
    }

    .tone-arm-container.deployed {
        top: 169px !important;
    }

    .tone-arm-container.playing {
        transform: scale(0.629) rotate(115deg) !important;
    }

    #playlist, #donelist {
        width: 460px !important;
    }

    body > div.flex > div:last-child,
    body > div.flex > div:last-child > div {
        width: 460px !important;
    }

    #colorPalette {
        width: 340px !important;
    }

    #playablename {
        font-size: 1.375rem !important;
    }
}

/* 800-899px: Playbox 360px, Playlist 400px, Thumbnail 260px - Total ~800px */
@media (min-width: 800px) and (max-width: 899px) and (orientation: landscape) {
    body > div.flex {
        gap: 1rem;
        padding: 0 1rem;
    }

    #playbox {
        width: 360px !important;
    }

    #thumbnailcase {
        margin-top: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    #thumbnailcase, #thumbnail {
        width: 260px !important;
        height: 260px !important;
    }

    /* Vinyl scales proportionally (260/350 = 0.743 scale) */
    #vinylProgressBar {
        width: 208px !important;
        height: 208px !important;
    }

    #vinyl {
        width: 193px !important;
        height: 193px !important;
    }

    #vinylmiddle {
        width: 50px !important;
        height: 50px !important;
    }

    /* Tone arm: 0.743 * 0.759 = 0.564 scale */
    .tone-arm-container {
        transform: scale(0.564) rotate(90deg) !important;
        left: -95px !important;
        top: 106px !important;
    }

    .tone-arm-container.deployed {
        top: 152px !important;
    }

    .tone-arm-container.playing {
        transform: scale(0.564) rotate(115deg) !important;
    }

    #playlist, #donelist {
        width: 400px !important;
    }

    body > div.flex > div:last-child,
    body > div.flex > div:last-child > div {
        width: 400px !important;
    }

    #colorPalette {
        width: 320px !important;
    }

    #playablename {
        font-size: 1.25rem !important;
    }

    .px-6 {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }
}

/* ==========================================
   PORTRAIT MODE PLAYLIST BUTTON
   ========================================== */

/* Hide playlist icon by default (shown only in portrait mode) */
#playlistIcon {
    display: none;
}

/* ==========================================
   RESPONSIVE DESIGN - MOBILE & PORTRAIT
   ========================================== */

/* Playlist collapse toggle - hidden by default, shown in portrait */
.playlist-collapse-toggle {
    display: none;
}

/* Portrait mode - inline layout with collapsible playlist */
@media (orientation: portrait) {
    /* Hide playlist items in portrait - only shown in playboxPlaylistContainer */
    .playlist-items {
        display: none !important;
    }

    /* Allow scrolling and fill viewport */
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 100vh !important;
        height: auto !important;
        margin-top: 0 !important;
        padding-bottom: 2rem;
    }

    /* Ensure playbox fills available space */
    #playbox {
        min-height: 100vh !important;
    }

    /* Album title - centered with reduced margins */
    #albumTitle {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: 0.5rem !important; /* Half of 1rem */
        margin-bottom: 0.5rem !important; /* Half of 1rem */
        font-size: 6.75rem !important; /* 1.5x larger than previous 4.5rem */
    }

    /* Main container - vertical stack with minimal gap */
    body > div.flex {
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        height: auto !important;
        margin-top: 0 !important;
        padding: 0 !important;
        gap: 1rem !important;
    }

    /* Playbox - full width edge to edge, no fixed height */
    #playbox {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        overflow: visible !important; /* Allow content to show without being cut off */
        padding-bottom: 0 !important; /* Remove playbox bottom padding */
    }

    /* Keep bottom padding of playbox controls section in portrait */
    #playbox > .px-6.py-8 {
        padding-bottom: 2rem !important; /* Keep py-8 (2rem) bottom padding for controls */
    }

    /* Playlist section - below playbox, full width */
    #listmenu {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #playlist,
    #donelist {
        width: 100% !important;
        margin-top: 0 !important;
    }

    /* Input section - full width with same spacing as between playbox and playlist */
    body > div.flex > div:last-child {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    body > div.flex > div:last-child > div {
        width: 100% !important;
        margin-top: 0 !important;
    }

    /* Hide collapse toggle in portrait - using playlist button in playbox instead */
    .playlist-collapse-toggle {
        display: none !important;
    }

    /* Fullscreen button becomes playlist button in portrait */
    #fullscr #enlarge,
    #fullscr #shrink {
        display: none !important;
    }

    #fullscr #playlistIcon {
        display: block !important;
    }

    /* Ensure playlist icon is hidden in landscape/desktop */
    @media (orientation: landscape) {
        #fullscr #playlistIcon {
            display: none !important;
        }

        #fullscr #enlarge {
            display: block !important;
        }
    }

    /* Portrait playlist mode - minimized header with smooth transitions */

    /* Hide large thumbnail container when minimized */
    #thumbnailcase {
        transition: opacity 0.5s ease-in-out, height 0.5s ease-in-out, margin 0.5s ease-in-out, transform 0.5s ease-in-out, background-color 0.5s ease-in-out;
        transform: translateY(0);
        opacity: 1;
    }

    .portrait-playlist-minimized #thumbnailcase {
        opacity: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        pointer-events: none;
        transform: translateY(-20px) !important;
        background-color: transparent !important;
    }

    /* Make all children of thumbnailcase invisible when minimized */
    .portrait-playlist-minimized #thumbnailcase * {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Hide vinyl progress bar and thumbnail when minimized */
    .portrait-playlist-minimized #vinylProgressBar,
    .portrait-playlist-minimized #thumbnail {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Header section styling */
    #playboxHeader {
        transition: padding 0.4s ease-in-out;
    }

    /* Mini thumbnail (hidden by default, shown when minimized) */
    #thumbnailMini {
        transition: opacity 0.3s ease-in-out;
    }

    .portrait-playlist-minimized #thumbnailMini {
        display: block !important;
        opacity: 1 !important;
    }

    /* Music icon transitions - completely hide when minimized */
    #musicicon {
        transition: opacity 0.3s ease-in-out, width 0.3s ease-in-out, height 0.3s ease-in-out, margin 0.3s ease-in-out;
    }

    .portrait-playlist-minimized #musicicon {
        display: none !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        pointer-events: none;
    }

    /* Title container - no special margin changes needed */
    #titleContainer {
        transition: margin 0.3s ease-in-out;
    }

    /* Text size transitions */
    #playablename {
        transition: font-size 0.4s ease-in-out, line-height 0.4s ease-in-out;
    }

    #authorName {
        transition: font-size 0.4s ease-in-out, line-height 0.4s ease-in-out;
    }

    .portrait-playlist-minimized #playablename {
        font-size: 1.125rem !important; /* text-lg */
        line-height: 1.5rem !important;
        font-weight: 500 !important;
    }

    .portrait-playlist-minimized #authorName {
        font-size: 0.875rem !important; /* text-sm */
        line-height: 1.25rem !important;
    }

    /* Playlist container - positioned BETWEEN header and controls */
    #playboxPlaylistContainer {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        padding: 0;
        margin: 0;
        transform: translateY(-20px);
        transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out, padding 0.5s ease-in-out, margin 0.5s ease-in-out, transform 0.5s ease-in-out;
        flex-shrink: 0; /* Prevent container from shrinking playbox */
    }

    .portrait-playlist-minimized #playboxPlaylistContainer {
        max-height: 60vh; /* Use viewport height for better responsiveness */
        opacity: 1;
        padding: 0.5rem 1.5rem;
        margin: 0;
        transform: translateY(0);
        overflow-y: auto;
        overflow-x: hidden;
        flex-shrink: 0; /* Prevent container from shrinking playbox */
    }

    /* Collapsible playlist content */
    #playlist.collapsed .playlist-items {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    #playlist .playlist-items {
        max-height: 2000px;
        overflow: visible;
        transition: max-height 0.3s ease-in;
    }

    /* Rotate chevron when collapsed */
    #playlist.collapsed .playlist-collapse-toggle svg {
        transform: rotate(-90deg);
        transition: transform 0.3s ease;
    }

    .playlist-collapse-toggle svg {
        transform: rotate(0deg);
        transition: transform 0.3s ease;
    }

    /* Color palette positioning */
    #colorPalette {
        position: fixed !important;
        bottom: auto !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 380px !important;
        z-index: 60 !important;
    }

    /* Tone arm positioning for general portrait mode (tablets) */
    .tone-arm-container {
        transform: scale(0.759) rotate(90deg) !important;
        transform-origin: 411.5px 147.5px !important;
        left: -205px !important; /* Moved 10px to the right from -215px */
        top: 123px !important; /* Moved 20px up from 143px */
    }

    .tone-arm-container.deployed {
        top: 183px !important; /* Adjusted 20px up from 203px */
    }

    .tone-arm-container.playing {
        transform: scale(0.759) rotate(115deg) !important;
        transform-origin: 411.5px 147.5px !important;
    }

    /* Vinyl mode thumbnail extension in portrait (same as landscape) */
    /* Maintain the thumbnail extension when vinyl mode is active */
    #thumbnailcase[style*="height: 406px"],
    #thumbnail[style*="height: 406px"] {
        height: 406px !important;
        align-items: flex-start !important;
        padding-top: 40px !important;
    }

    /* Fix vinyl middle visibility in portrait mode */
    #vinylmiddle {
        z-index: 20 !important;
        position: absolute !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Small screens (phones) - additional scaling */
@media (orientation: portrait) and (max-width: 767px) {
    /* Smaller playbox on phones - no fixed height */
    #playbox {
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important; /* Allow natural height */
    }

    /* Thumbnail case - smaller on phones */
    #thumbnailcase {
        width: 280px !important;
        height: 280px !important;
        margin-top: 2rem !important;
    }

    #thumbnail {
        width: 280px !important;
        height: 280px !important;
    }

    /* Vinyl mode thumbnail extension for phones */
    #thumbnailcase[style*="height: 406px"] {
        height: 336px !important; /* 280px + 56px proportional extension */
    }

    #thumbnail[style*="height: 406px"] {
        height: 336px !important; /* 280px + 56px proportional extension */
    }

    #vinylProgressBar {
        width: 220px !important;
        height: 220px !important;
    }

    #vinyl {
        width: 200px !important;
        height: 200px !important;
    }

    #vinylmiddle {
        width: 54px !important;
        height: 54px !important;
    }

    /* Tone arm scaling for portrait phones - recalculated based on 280px thumbnail */
    /* 280px thumbnail: scale = 280/350 = 0.8
       vinyl arm base scale: 0.759
       combined: 0.8 * 0.759 = 0.607 */
    .tone-arm-container {
        transform: scale(0.607) rotate(90deg) !important;
        transform-origin: 411.5px 147.5px !important;
        left: -181px !important; /* Moved 10px to the right from -191px */
        top: 95px !important; /* Moved 20px up from 115px */
    }

    .tone-arm-container.deployed {
        top: 143px !important; /* Adjusted 20px up from 163px */
    }

    .tone-arm-container.playing {
        transform: scale(0.607) rotate(115deg) !important;
        transform-origin: 411.5px 147.5px !important;
    }

    #albumTitle {
        font-size: 1.5rem !important; /* text-2xl for phones */
    }
}

/* Portrait mode - two-row input layout with space-between */
@media (orientation: portrait) {
    /* Remove listmenu width constraint - let it be full width like playbox */
    #listmenu {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Input section container - stretch to full width like playbox */
    body > div.flex > div:last-child {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body > div.flex > div:last-child > div {
        width: 100% !important;
        max-width: none !important;
    }

    /* Outer input container */
    body > div.flex > div:last-child > div.relative {
        width: 100% !important;
        max-width: none !important;
    }

    /* Main Input Container - TWICE THE HEIGHT (320px total - double the original ~160px) */
    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 {
        flex-wrap: wrap !important;
        padding: 2rem !important;
        min-height: 240px !important; /* MUCH taller - twice the original height */
        justify-content: space-between !important;
        align-items: center !important;
        gap: 2rem !important; /* Larger vertical gap between rows */
    }

    /* Top row: Color square and time input - space between */
    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 > .relative.mr-3 {
        flex: 0 0 auto !important;
        margin: 0 !important;
        order: 1 !important;
    }

    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 > .ml-3.flex.items-center {
        flex: 0 0 auto !important;
        margin: 0 !important;
        margin-left: auto !important; /* Push to the right edge */
        order: 2 !important;
    }

    /* Bottom row: Input field and submit button - side by side, aligned */
    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 > .flex-1.relative {
        flex: 1 1 auto !important;
        margin: 0 0.75rem 0 0 !important;
        order: 3 !important;
        min-width: 0 !important; /* Allow input to shrink */
    }

    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 > button {
        flex: 0 0 auto !important;
        margin: 0 !important;
        order: 4 !important;
    }

    /* Color square - keep original size */
    #colorSquare {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }

    #colorSquare #squareContent {
        width: 2rem !important;
        height: 2rem !important;
    }

    /* Time input - keep original size */
    .bg-white.dark\:bg-zinc-900.rounded-xl.shadow-lg > .flex.items-center.p-3 > .ml-3.flex.items-center > div {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        height: 2.5rem !important;
    }

    /* Input field - MUCH TALLER for easier typing */
    #queuebar {
        height: 3.5rem !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        font-size: 1rem !important;
    }

    /* Submit button - taller to match input */
    #addTaskBtn {
        padding: 1rem 1.25rem !important;
        height: 3.5rem !important;
    }

    #addTaskBtn svg {
        width: 1.5rem !important;
        height: 1.5rem !important;
    }
}

/* Tablet portrait mode adjustments */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
    #playbox {
        max-width: 540px;
    }

    #thumbnailcase,
    #thumbnail {
        width: 320px !important;
        height: 320px !important;
    }

    #vinylProgressBar {
        width: 250px !important;
        height: 250px !important;
    }

    #vinyl {
        width: 230px !important;
        height: 230px !important;
    }
}

/* Album Replay Modal Responsive - Portrait Mode */
@media (orientation: portrait) {
    #albumReplayModal {
        padding: 0 !important;
    }

    #albumReplayContent {
        grid-template-rows: auto 1fr auto;
        height: 100vh;
        max-height: 100vh;
    }

    /* Header section - larger for portrait */
    #albumReplayContent > div:first-child {
        padding: 2rem 1.5rem !important;
        flex-shrink: 0;
    }

    #albumReplayContent > div:first-child > div {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1.5rem !important;
    }

    #albumReplayContent > div:first-child > div > div:first-child {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1.5rem !important;
        width: 100%;
    }

    /* Main content area - scrollable */
    #albumReplayContent > div:nth-child(2) {
        padding: 1rem !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    #albumReplayContent > div:nth-child(2) > div {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Larger album cover for portrait */
    #replayAlbumCover {
        width: 220px !important;
        height: 220px !important;
    }

    /* Larger typography for portrait */
    #replayAlbumTitle {
        font-size: 2.5rem !important;
        text-align: center !important;
        margin-bottom: 0.5rem !important;
    }

    #replayDateTime {
        font-size: 1rem !important;
        text-align: center !important;
    }

    #replayStars {
        justify-content: center !important;
    }

    #replayStars span {
        font-size: 2rem !important;
    }

    #replayScore {
        font-size: 1.5rem !important;
    }

    #replayPerfTitle {
        font-size: 1.75rem !important;
        text-align: center !important;
    }

    #replayPerfMessage {
        font-size: 1rem !important;
        text-align: center !important;
    }

    #replayPerformanceMsg {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 2rem 1.5rem !important;
    }

    /* Stats section headings */
    #albumReplayContent h3 {
        font-size: 1.25rem !important;
    }

    /* Total focus time - responsive text size */
    #replayTotalTime {
        font-size: 2.5rem !important;
    }

    /* Stats grid - responsive numbers */
    #replayTracksComplete,
    #replayPauseCount,
    #replayPerfectPlays,
    #replaySkipCount {
        font-size: 1.5rem !important;
    }

    /* Achievements grid - smaller on portrait */
    #replayAchievements {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Footer actions - compact */
    #albumReplayContent > div:last-child {
        padding: 1rem !important;
        flex-shrink: 0;
        justify-content: center !important;
    }

    #albumReplayContent > div:last-child {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    #albumReplayContent > div:last-child button {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
        flex: 1 1 auto;
        min-width: 100px;
    }
}

/* Small portrait screens (phones) - more compact */
@media (orientation: portrait) and (max-width: 767px) {
    #albumReplayContent > div:first-child {
        padding: 1rem 0.75rem !important;
    }

    #albumReplayContent > div:first-child > div {
        gap: 0.75rem !important;
    }

    #replayAlbumCover {
        width: 80px !important;
        height: 80px !important;
    }

    #replayAlbumTitle {
        font-size: 1.375rem !important;
    }

    #replayDateTime {
        font-size: 0.75rem !important;
    }

    #replayScore {
        font-size: 1rem !important;
    }

    #replayPerfTitle {
        font-size: 1.125rem !important;
    }

    #replayPerfMessage {
        font-size: 0.8125rem !important;
    }

    #replayPerformanceMsg {
        padding: 1rem !important;
    }

    #albumReplayContent > div:nth-child(2) {
        padding: 0.75rem !important;
    }

    #albumReplayContent h3 {
        font-size: 1.125rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Total focus time - smaller on phones */
    #replayTotalTime {
        font-size: 2rem !important;
    }

    /* Stats grid - smaller numbers */
    #replayTracksComplete,
    #replayPauseCount,
    #replayPerfectPlays,
    #replaySkipCount {
        font-size: 1.25rem !important;
    }

    /* Stats grid - better spacing */
    #albumReplayContent > div:nth-child(2) .grid.grid-cols-2.gap-4 {
        gap: 0.5rem !important;
    }

    #albumReplayContent > div:nth-child(2) .grid.grid-cols-2.gap-4 > div {
        padding: 0.75rem !important;
    }

    /* Stats section spacing */
    #albumReplayContent > div:nth-child(2) .space-y-6 {
        gap: 1rem !important;
    }

    #replayAchievements {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* Achievement cards - compact */
    .achievement-card-inner {
        height: 100px !important;
    }

    .achievement-card-front,
    .achievement-card-back {
        padding: 0.75rem !important;
    }

    /* Footer buttons - stack on very small screens */
    #albumReplayContent > div:last-child {
        padding: 0.75rem !important;
    }

    #albumReplayContent > div:last-child button {
        padding: 0.625rem 1.25rem !important;
        min-width: 90px;
    }
}

/* Extra small phones (< 400px) - ultra compact */
@media (orientation: portrait) and (max-width: 400px) {
    #replayAlbumCover {
        width: 70px !important;
        height: 70px !important;
    }

    #replayAlbumTitle {
        font-size: 1.25rem !important;
    }

    #replayTotalTime {
        font-size: 1.75rem !important;
    }

    #albumReplayContent > div:last-child button {
        font-size: 0.8125rem !important;
        padding: 0.5rem 1rem !important;
    }
}