:root {
    --bg-deep: #0d0d1a;
    --bg-card: rgba(26, 26, 46, 0.7);
    --purple: #7b2ff7;
    --pink: #ff2e97;
    --cyan: #00f5d4;
    --yellow: #ffe156;
    --accent: #ff2e97;
    --accent2: #ffe156;
}
body[data-mode="sparta"] { --accent: #d90429; --accent2: #f4c430; }
body[data-mode="finger"] { --accent: #e63946; --accent2: #ffd166; }
body[data-mode="midi"] { --accent: #ff2e97; --accent2: #00f5d4; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: var(--bg-deep);
    color: #e0e0f0;
    font-family: 'Bricolage Grotesque', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}
body::before {
    content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(123,47,247,0.09) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(0,245,212,0.05) 0%, transparent 50%);
    transition: background 0.6s;
}
#root { position: relative; z-index: 1; }
.font-mono { font-family: 'JetBrains Mono', monospace !important; }
.font-bungee { font-family: 'Bungee', cursive; }

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(123,47,247,0.2);
    border-radius: 16px;
}
.neon-glow { box-shadow: 0 0 20px rgba(123,47,247,0.4), 0 0 60px rgba(123,47,247,0.1); }
.neon-glow-cyan { box-shadow: 0 0 15px rgba(0,245,212,0.3), 0 0 40px rgba(0,245,212,0.1); }
.accent-glow { box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 60px color-mix(in srgb, var(--accent) 20%, transparent); }

.drop-zone { border: 2px dashed rgba(123,47,247,0.5); transition: all 0.3s ease; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--cyan); box-shadow: 0 0 30px rgba(0,245,212,0.2); }

.glitch-title {
    font-family: 'Bungee', cursive;
    text-shadow: 3px 0 var(--accent), -3px 0 var(--cyan);
    animation: glitch 3s infinite;
}
@keyframes glitch {
    0%, 90%, 100% { text-shadow: 3px 0 var(--accent), -3px 0 var(--cyan); }
    92% { text-shadow: -4px 1px var(--accent), 4px -1px var(--cyan); transform: skewX(-3deg); }
    94% { text-shadow: 4px -2px var(--accent), -4px 2px var(--cyan); transform: skewX(2deg); }
    96% { text-shadow: -1px 3px var(--accent), 1px -3px var(--cyan); transform: none; }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 45%, transparent); transform: scale(1); }
    50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 100px color-mix(in srgb, var(--accent2) 25%, transparent); transform: scale(1.03); }
}
.pulse-btn { animation: pulse-glow 1.6s ease-in-out infinite; }

.scanlines::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
}
.crt { border-radius: 22px / 18px; overflow: hidden; }

.clip-thumb { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.clip-thumb:hover { transform: scale(1.04); box-shadow: 0 0 20px rgba(123,47,247,0.3); }

.mode-card {
    transition: transform 0.35s cubic-bezier(.2,.9,.3,1.4), box-shadow 0.3s, border-color 0.3s;
    transform-style: preserve-3d; perspective: 600px; cursor: pointer;
}
.mode-card:hover { transform: perspective(600px) rotateX(6deg) rotateY(-6deg) translateY(-4px); }
.mode-card.active { border-color: var(--accent2) !important; box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }

.fader { writing-mode: vertical-lr; direction: rtl; width: 22px; height: 110px; accent-color: var(--accent2); }
.led { width: 6px; border-radius: 2px; transition: height 0.1s; }
.channel { background: linear-gradient(180deg, rgba(40,40,60,.9), rgba(15,15,28,.9)); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.fade-slide-in { animation: fadeSlideIn 0.5s ease-out forwards; }
.toast-enter { animation: fadeSlideIn 0.3s ease-out; }

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
.confetti-piece { position: fixed; top: 0; z-index: 9999; pointer-events: none; animation: confetti-fall 3s ease-in forwards; }

@keyframes sparta-shake {
    0%,100% { transform: none; filter: none; }
    10% { transform: translate(-14px, 6px) scale(1.03); filter: invert(1); }
    20% { transform: translate(12px, -8px); filter: none; }
    35% { transform: translate(-8px, 4px) scale(1.02); filter: hue-rotate(90deg); }
    50% { transform: translate(6px, -3px); }
    70% { transform: translate(-3px, 2px); }
}
.sparta-shake #root { animation: sparta-shake 0.6s ease-out; }

.piano-roll-container, .timeline-container { overflow-x: auto; }
.piano-roll-container::-webkit-scrollbar, .timeline-container::-webkit-scrollbar { height: 8px; }
.piano-roll-container::-webkit-scrollbar-thumb, .timeline-container::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

@keyframes wave { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.wave-bar { width: 5px; border-radius: 3px; background: var(--accent2); animation: wave 0.8s ease-in-out infinite; }

.banner { cursor: pointer; user-select: none; background: repeating-linear-gradient(90deg, #e63946 0 20px, #fff 20px 40px); color: #1a1a2e; }

select, input[type=number] { background: rgba(13,13,26,0.85); color: #fff; border: 1px solid rgba(123,47,247,0.35); border-radius: 8px; }

@media (max-width: 768px) {
    .glitch-title { font-size: 1.7rem !important; }
}