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

:root {
    --bg-deep: #0a0a1a;
    --bg-surface: #111128;
    --bg-card: #1a1a3e;
    --neon-pink: #ff2d95;
    --neon-cyan: #00f0ff;
    --neon-purple: #b44dff;
    --neon-yellow: #ffe44d;
    --text-primary: #e8e8f0;
    --text-muted: #8888aa;
    --border: #2a2a5a;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'IBM Plex Sans', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(180, 77, 255, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(255, 45, 149, 0.06) 0%, transparent 60%);
}

#app {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header */
#header {
    text-align: center;
    margin-bottom: 28px;
}

.title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(18px, 5vw, 28px);
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 45, 149, 0.4));
    margin-bottom: 8px;
    line-height: 1.4;
}

.mic {
    -webkit-text-fill-color: initial;
    filter: none;
    display: inline-block;
    animation: micBounce 2s ease-in-out infinite;
}

@keyframes micBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(-5deg); }
    75% { transform: translateY(-2px) rotate(5deg); }
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-surface);
    margin-bottom: 24px;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.04);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1) inset;
}

.drop-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.drop-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.drop-text .highlight {
    color: var(--neon-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.file-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.file-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
    font-family: 'IBM Plex Sans', sans-serif;
}

.cdg-btn {
    background: rgba(255, 45, 149, 0.12);
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.cdg-btn:hover {
    background: rgba(255, 45, 149, 0.25);
    box-shadow: 0 0 16px rgba(255, 45, 149, 0.3);
}

.mp3-btn {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.mp3-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}

.demo-btn {
    background: rgba(180, 77, 255, 0.15);
    border: 1px solid var(--neon-purple);
    color: var(--neon-purple);
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'IBM Plex Sans', sans-serif;
}

.demo-btn:hover {
    background: rgba(180, 77, 255, 0.3);
    box-shadow: 0 0 16px rgba(180, 77, 255, 0.4);
    transform: scale(1.03);
}

.file-info {
    margin-top: 10px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--neon-yellow);
    min-height: 18px;
}

/* CRT Display */
.display-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.crt-frame {
    background: #1c1c1c;
    border-radius: 20px;
    padding: 16px;
    box-shadow:
        0 0 0 2px #333,
        0 0 0 4px #1a1a1a,
        0 8px 40px rgba(0, 0, 0, 0.6),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

.crt-bezel {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    line-height: 0;
}

#cdg-canvas {
    width: min(600px, calc(100vw - 100px));
    height: auto;
    aspect-ratio: 300 / 216;
    background: #000;
    display: block;
    image-rendering: pixelated;
    border-radius: 4px;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 4px;
}

.crt-glare {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 60%
    );
    border-radius: 4px;
}

/* Controls */
.controls {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.transport {
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.ctrl-btn.play {
    width: 48px;
    height: 48px;
    font-size: 20px;
    border-color: var(--neon-pink);
    background: rgba(255, 45, 149, 0.12);
}

.ctrl-btn.play:hover {
    background: rgba(255, 45, 149, 0.25);
    box-shadow: 0 0 16px rgba(255, 45, 149, 0.3);
}

.ctrl-btn.play.playing {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.12);
}

.progress-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 36px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}

.progress-bar:hover {
    height: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-handle {
    display: none;
}

.volume-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vol-icon {
    font-size: 16px;
    cursor: pointer;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    border: none;
}

/* Info Panel */
.info-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.info-panel summary {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    user-select: none;
    transition: color 0.2s;
}

.info-panel summary:hover {
    color: var(--text-primary);
}

.info-content {
    padding: 0 20px 16px;
}

.info-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.palette-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.palette-display {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

.palette-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s;
}

.palette-swatch:hover {
    transform: scale(1.3);
    z-index: 1;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-style: italic;
}

.footer a {
    font-size: 12px;
    color: var(--neon-purple);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--neon-pink);
}

/* Mobile tweaks */
@media (max-width: 480px) {
    #app {
        padding: 16px 10px;
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .transport {
        justify-content: center;
    }
    .volume-wrapper {
        justify-content: center;
    }
    .crt-frame {
        padding: 10px;
    }
}