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

body {
    background-color: #050510;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    overflow: hidden; /* Hide scrollbars */
    width: 100vw;
    height: 100vh;
}

/* Babylon.js Canvas fills the screen completely */
#renderCanvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1; /* behind UI layer */
}

/* UI Overlay container */
#ui-overlay {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none; /* Let clicks pass through the container... */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90%;
    max-width: 800px;
    transition: opacity 0.5s ease;
}

/* The floating, translucent control panel */
.glass-panel {
    background: rgba(20, 20, 40, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 1rem 2.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: auto; /* ...but catch clicks here */
    overflow: hidden; /* Guarantee nothing escapes the glass boundary */
    flex-wrap: wrap; /* allow wrapping on smaller screens */
}

.glass-panel:hover {
    box-shadow: 0 12px 48px rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0;
    color: #fff;
    white-space: nowrap;
}

h1 span {
    background: linear-gradient(135deg, #00f2fe, #4facfe, #00f2fe);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

p {
    display: none; /* Hidden on horizontal bar */
}

.controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    flex-grow: 1;
    flex-wrap: wrap; /* Prevent overlap if screen is tight */
    justify-content: center; /* Center the items if they wrap */
}

input[type="file"] {
    display: none;
}

.custom-file-upload, .custom-btn {
    cursor: pointer;
    background: linear-gradient(45deg, #ee0979, #ff6a00);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(238, 9, 121, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-file-upload:hover, .custom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 9, 121, 0.6);
}

.custom-file-upload:active, .custom-btn:active {
    transform: translateY(1px);
}

.playback-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    margin-top: 0;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeIn 0.5s ease forwards;
}

.playback-controls .buttons {
    display: flex;
    gap: 1rem;
}

.btn-action {
    background: transparent;
    border: 2px solid #00f2fe;
    color: #00f2fe;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action:hover:not(:disabled) {
    background: #00f2fe;
    color: #050510;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
    color: #a0a0c0 !important;
    border-color: #a0a0c0 !important;
    box-shadow: none !important;
}

.track-marquee {
    width: 250px;
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.track-info {
    position: absolute;
    font-size: 1rem;
    font-weight: 500;
    color: #00f2fe;
    white-space: nowrap;
    transform: translateX(250px);
    animation: marquee 10s linear infinite;
}

@keyframes marquee {
    0%   { transform: translateX(250px); }
    100% { transform: translateX(-100%); }
}

/* Animations */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* UI Fading */
.fade-out {
    opacity: 0;
    pointer-events: none !important;
}

.fade-transition {
    transition: opacity 0.5s ease-in-out, transform 0.4s ease;
}

/* --- Right Side Settings Palette --- */
#settings-panel {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.vertical-panel {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #00f2fe;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.setting-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.8rem;
}

.setting-group label {
    font-size: 0.9rem;
    font-weight: 300;
    color: #a0a0c0;
    text-align: left;
}

.color-options {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.styled-select {
    width: 100%;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.styled-select option {
    background: #141428;
    color: #fff;
}

.auto-effect-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem !important;
    color: #00f2fe !important;
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
    accent-color: #00f2fe;
}

.interval-wrapper {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #a0a0c0;
}

.styled-number {
    width: 45px;
    padding: 0.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    font-family: inherit;
    text-align: center;
    outline: none;
}

.styled-slider {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
}

.styled-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #00f2fe;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

.styled-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}
