body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #000000;
    overflow: hidden;
}

#main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#bottom-bar {
    width: 100%;
    min-height: 60px;
    height: 60px;
    background-color: #000;
     /* Changed from rgba(0, 0, 0, 0.75) to solid color */
    padding: 0;
    box-sizing: border-box;
    color: white;
    border-top: solid 1px #1c1b1b;
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1005;
    transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: height;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

#bottom-bar.expanded {
    height: 70vh;
}

#drag-handle {
    width: 40px;
    height: 4px;
    background-color: #555;
    border-radius: 2px;
    cursor: ns-resize;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#drag-handle:hover {
    background-color: #777;
    transform: translateX(-50%) scaleY(1.2);
}

#drag-handle:active {
    background-color: #999;
}

#bottom-bar-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 12px 12px 0 12px;
    box-sizing: border-box;
}

/* Track current - always at the top */
#track-current {
    position: absolute;
    top: 7px;
    left: 12px;
    right: 120px; /* Leave space for controls */
    height: 48px;
    font-size: 13px;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    line-height: 16px;
    z-index: 10;
    flex-shrink: 0;
}

#track-code {
    color: #a7a7a7;
}

/* Controls - always at the top right */
#bottom-bar-controls {
    position: absolute;
    top: 5px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
    height: 48px;
}

#code-icon,
#play-pause-button,
#cc-icon {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#code-icon:hover,
#play-pause-button:hover,
#cc-icon:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

#code-icon:active,
#play-pause-button:active,
#cc-icon:active {
    background-color: rgba(255, 255, 255, 0.2);
}

#play-pause-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: transparent;
    color: #888;
}

#track-list-container {
    position: absolute;
    top: 72px; /* Below track info (48px + 12px margin + 12px padding) */
    left: 12px;
    right: 12px;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#track-list {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: auto;
    flex-grow: 1;
    flex-direction: column;
    padding: 0;
    width: 100%;
    /* Hide scrollbar while maintaining functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer and Edge */
}

#track-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

#bottom-bar.expanded #track-list-container {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#bottom-bar:not(.expanded) #track-list-container {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#logo {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1004;
}

.small-header {
    margin-right: 12px;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #646464;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 400;
    color: #f0f0f0;
    text-decoration: none;
    white-space: nowrap;
    min-width: 120px;
    position: relative;
    z-index: 1003;
    border-bottom: solid 1px #1c1b1b;
    line-height: 1.5;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.track-item:first-child {
    padding-top: 0;
}

#bottom-bar.expanded .track-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

#main-column {
    flex: 1;
    height: calc(100vh - 60px);
    position: relative;
}

#track-player {
    width: 100%;
    height: calc(100vh - 60px);
    border: 0;
}

#click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}

#tray-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    display: none;
    background-color: transparent;
    cursor: pointer;
}

#code-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    border-radius: 8px;
    background-color: #1a1919;
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    z-index: 1000;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

#code-button:hover {
    background-color: #2a2929;
}

#track-current > div:first-of-type {
    font-weight: 500;
    color: #f0f0f0;
}

#track-current > div:first-of-type > div:last-child {
    color: #d0d0d0;
    font-size: 12px;
    font-weight: 400;
}

#track-photo {
    background-color: #363636;
    height: 32px;
    width: 32px;
    border-radius: 0;
    object-fit: cover;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#track-photo svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.track-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-item-number {
    margin-right: 8px;
    color: #888;
    font-variant-numeric: tabular-nums;
    min-width: 20px;
}

.track-item-play-icon {
    opacity: 1;
    transition: opacity 0.2s ease;
    margin-left: 8px;
    color: #888;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.track-item:hover .track-item-play-icon {
    opacity: 1;
}

.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    box-sizing: border-box;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.modal-content {
    background-color: #000;
    color: #f0f0f0;
    padding: 32px;
    border-radius: 0;
    max-width: 480px;
    width: 85%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 8px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 24px;
        margin: 0;
        max-height: 80vh;
    }
    
    .modal {
        padding: 20px;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    color: #ccc;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 600;
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.modal p {
    font-size: 16px;
    line-height: 1.4;
    margin: 0;
    color: #d0d0d0;
    font-weight: 400;
}

@media (max-width: 768px) {
    .modal h2 {
        font-size: 22px;
        margin-bottom: 16px;
        letter-spacing: 0;
    }
    
    .modal p {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
        top: 12px;
        right: 16px;
    }
}

.code-modal-content {
    max-width: 80vw;
    width: 90%;
    display: flex;
    flex-direction: column;
    /* overflow-y: auto; */ /* This is the culprit. It's on the wrong element. */
}

@media (max-width: 768px) {
    .code-modal-content {
        max-width: 95vw;
        width: 95%;
        padding: 20px;
        max-height: 70%; /* Add this to constrain the height on mobile */
    }
}

.code-modal-content pre {
    flex-grow: 1;
    overflow-y: auto;
    margin: 16px 0 0 0;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.code-modal-content pre::-webkit-scrollbar {
    width: 8px;
}

.code-modal-content pre::-webkit-scrollbar-track {
    background: transparent;
}

.code-modal-content pre::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.code-modal-content pre::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.code-modal-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #f0f0f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .code-modal-content pre {
        padding: 12px;
        margin: 12px 0 0 0;
    }
    
    .code-modal-content code {
        font-size: 11px;
        line-height: 1.3;
    }
    
    /* Remove hover effects on mobile devices */
    #code-icon:hover,
    #play-pause-button:hover,
    #cc-icon:hover {
        color: #888;
        background-color: transparent;
    }
    
    .track-item:hover {
        color: #f0f0f0;
        background-color: transparent;
    }
    
    .track-item:hover .track-item-play-icon {
        opacity: 1;
    }
    
    .track-item-play-icon:hover {
        color: #888;
        background-color: transparent;
    }
    
    #drag-handle:hover {
        background-color: #555;
        transform: translateX(-50%);
    }
    
    .modal-close:hover {
        color: #ccc;
        background: rgba(255, 255, 255, 0.1);
        border-color: transparent;
        transform: scale(1);
    }
    
    #code-button:hover {
        background-color: #1a1919;
    }
}

#video-play-pause-button {
    position: absolute;
    top: calc(50dvh - 30px); /* 50% of dynamic viewport height minus half of bottom bar */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 101px;
    height: 101px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}


#video-play-pause-button svg {
    width: 51px;
    height: 51px;
}

/* Social Links Styles */
#social-links {
    margin-top: auto;
    border-top: 1px solid #1c1b1b;
    padding: 8px 0;
}

.social-links-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 320px;
    margin: auto;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: #888;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.social-link:hover {
    color: #fff;
}

.social-link svg {
    flex-shrink: 0;
}

#flashing-warning {
    position: absolute;
    top: calc(50dvh + 34px); /* Position below the play button using dynamic viewport */
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 9px;
    letter-spacing: 0.5px;
    z-index: 1000;
    opacity: 0.8;
}

/* Full mode styles - when ?full query param is used */
.full-mode #main-column {
    height: 100vh;
}

.full-mode #track-player {
    height: 100vh;
}
