/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #050508;
    --glass-bg: rgba(10, 10, 18, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #8a2be2;
    /* Electric Purple */
    --accent-secondary: #00f2ff;
    /* Neon Cyan */
    --accent-tertiary: #ff00ff;
    /* Neon Magenta */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --neon-glow: 0 0 15px rgba(138, 43, 226, 0.5), 0 0 30px rgba(138, 43, 226, 0.2);
    --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --font: 'Outfit', 'Inter', -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Canvas ===== */
#gl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ===== Splash Screen ===== */
.splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(138, 43, 226, 0.12) 0%, var(--bg-dark) 80%);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), visibility 1s;
}

.splash.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-card {
    background: var(--glass-bg);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 60px 50px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 100px rgba(0, 0, 0, 0.8), var(--neon-glow);
    animation: cardEntrance 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.splash-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.splash-title span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, 0.3));
}

.splash-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 40px;
}

/* ===== Source Selection ===== */
.source-selection {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    justify-content: center;
}

.source-option input {
    display: none;
}

.source-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.source-option input:checked+.source-card {
    border-color: var(--accent-primary);
    background: rgba(138, 43, 226, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 25px rgba(138, 43, 226, 0.3), inset 0 0 15px rgba(138, 43, 226, 0.2);
    transform: scale(1.05);
}

.source-option input:checked+.source-card svg {
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 8px var(--accent-secondary));
}

.source-card:hover:not(.checked) {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

/* ===== File Upload ===== */
.file-upload-area {
    margin-bottom: 24px;
    animation: fadeIn 0.5s ease;
}

.file-upload-area input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-label {
    display: block;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.file-label:hover {
    border-color: var(--accent-secondary);
    background: rgba(0, 242, 255, 0.05);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

/* ===== Quality Selector ===== */
.quality-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quality-selector select {
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 42px 12px 20px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300f2ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.quality-selector select:hover {
    border-color: var(--accent-secondary);
    background-color: rgba(10, 10, 20, 0.8);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.15);
}

.quality-selector select option {
    background: #0a0a0f;
    color: #fff;
    padding: 10px;
    font-size: 0.9rem;
}

.quality-selector select:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.2);
}

/* ===== Start Button ===== */
.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 48px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 30px rgba(138, 43, 226, 0.4), 0 0 20px rgba(255, 0, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.start-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.start-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(138, 43, 226, 0.6), 0 0 40px rgba(255, 0, 255, 0.4);
}

.start-btn:hover::after {
    opacity: 1;
}

.start-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* ===== Controls Overlay ===== */
.controls {
    position: fixed;
    top: 24px;
    left: 24px;
    right: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
    transition: opacity 1s ease;
}

.controls.hidden {
    opacity: 0;
}

.controls>* {
    pointer-events: auto;
}

.controls-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.fps-display {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-secondary);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.control-select {
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 8px 16px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.control-select:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.2);
}

/* ===== Audio Player ===== */
.audio-player {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), var(--neon-glow);
    color: var(--text-primary);
    min-width: 420px;
    transition: transform 0.3s var(--transition), opacity 0.5s ease;
}

.audio-player:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.ap-btn {
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.2);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--transition);
}

.ap-btn:hover {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 0 15px var(--accent-primary);
    transform: scale(1.1);
}

.ap-time {
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    min-width: 40px;
}

/* Range Inputs */
.ap-seek,
.ap-volume {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    height: 20px;
}

.ap-seek {
    flex-grow: 1;
}

.ap-volume {
    width: 80px;
}

/* Track styling */
.ap-seek::-webkit-slider-runnable-track,
.ap-volume::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.08);
    height: 6px;
    border-radius: 3px;
    transition: background 0.3s;
}

.ap-seek:hover::-webkit-slider-runnable-track,
.ap-volume:hover::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.15);
}

/* Thumb styling */
.ap-seek::-webkit-slider-thumb,
.ap-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    margin-top: -5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
    border: 2px solid var(--accent-primary);
}

.ap-seek:hover::-webkit-slider-thumb,
.ap-volume:hover::-webkit-slider-thumb {
    transform: scale(1.2);
    background: var(--accent-secondary);
    box-shadow: 0 0 15px var(--accent-secondary);
    border-color: white;
}

.ap-vol-icon {
    color: var(--text-secondary);
    opacity: 0.8;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.1));
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .splash-card {
        padding: 40px 30px;
    }

    .splash-title {
        font-size: 1.8rem;
    }

    .audio-player {
        min-width: calc(100vw - 48px);
        flex-wrap: wrap;
        justify-content: center;
    }
}