:root {
    --bg: #060608;
    --panel: #0d0f14;
    --accent: #00ffe5;
    --accent2: #ff2d78;
    --accent3: #ffe600;
    --glow: 0 0 12px var(--accent), 0 0 30px rgba(0, 255, 229, 0.3);
    --glow2: 0 0 12px var(--accent2), 0 0 30px rgba(255, 45, 120, 0.3);
    --mid: #1a1d26;
    --text: #c8d8e8;
    --dim: #445566;
}

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

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Share Tech Mono', monospace;
    overflow-x: hidden;
}

/* Scanline overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.15) 2px,
            rgba(0, 0, 0, 0.15) 4px);
    pointer-events: none;
    z-index: 9999;
}

/* CRT vignette */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
    z-index: 9998;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    gap: 0;
}

/* ─── HEADER ─── */
.header {
    width: 100%;
    max-width: 960px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #222;
}

.logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(32px, 6vw, 56px);
    letter-spacing: 4px;
    color: var(--accent);
    text-shadow: var(--glow);
    line-height: 1;
}

.logo span {
    color: var(--accent2);
    text-shadow: var(--glow2);
}

.tagline {
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ─── MAIN UNIT ─── */
.unit {
    width: 100%;
    max-width: 960px;
    background: var(--panel);
    border: 1px solid #1e2230;
    border-radius: 4px;
    padding: 22px 20px 18px;
    position: relative;
    box-shadow: 0 0 80px rgba(0, 255, 229, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* corner brackets */
.unit::before,
.unit::after,
.unit>.corner-br,
.unit>.corner-bl {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--accent);
    border-style: solid;
    opacity: 0.6;
}

.unit::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
}

.unit::after {
    top: 8px;
    right: 8px;
    border-width: 2px 2px 0 0;
}

.unit>.corner-br {
    bottom: 8px;
    right: 8px;
    border-width: 0 2px 2px 0;
}

.unit>.corner-bl {
    bottom: 8px;
    left: 8px;
    border-width: 0 0 2px 2px;
}

/* ─── CONTROLS ROW ─── */
.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ctrl-label {
    font-size: 9px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--dim);
}

/* Wave buttons */
.wave-btns {
    display: flex;
    gap: 6px;
}

.wavebtn {
    background: transparent;
    border: 1px solid #2a2f40;
    color: #556;
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    width: 40px;
    height: 36px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

.wavebtn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.15s;
}

.wavebtn.active {
    border-color: var(--accent);
    color: var(--accent);
    text-shadow: var(--glow);
    box-shadow: inset 0 0 10px rgba(0, 255, 229, 0.15), var(--glow);
}

.wavebtn:hover:not(.active) {
    border-color: #445;
    color: #778;
}

/* Sliders */
.slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-track {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-val {
    font-size: 11px;
    color: var(--accent);
    min-width: 36px;
    text-align: right;
    font-family: 'Space Mono', monospace;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 130px;
    height: 4px;
    background: #1a1f2e;
    border-radius: 0;
    outline: none;
    border: none;
    cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 24px;
    background: var(--accent);
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent);
    clip-path: polygon(0 20%, 100% 0, 100% 100%, 0 80%);
}

input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 24px;
    background: var(--accent);
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent);
}

input[type=range].pink::-webkit-slider-thumb {
    background: var(--accent2);
    box-shadow: 0 0 8px var(--accent2);
}

input[type=range].pink::-moz-range-thumb {
    background: var(--accent2);
    box-shadow: 0 0 8px var(--accent2);
}

input[type=range].yellow::-webkit-slider-thumb {
    background: var(--accent3);
    box-shadow: 0 0 8px var(--accent3);
}

input[type=range].yellow::-moz-range-thumb {
    background: var(--accent3);
    box-shadow: 0 0 8px var(--accent3);
}

/* ─── VU METERS ─── */
.vu-section {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 40px;
    margin-left: auto;
}

.vu-bar {
    width: 6px;
    background: #111;
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    position: relative;
}

.vu-fill {
    width: 100%;
    background: linear-gradient(to top, var(--accent), var(--accent3), var(--accent2));
    height: 0%;
    transition: height 0.06s ease-out;
}

/* ─── STRIP ─── */
.strip-section {
    margin-bottom: 18px;
}

.strip-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--dim);
    margin-bottom: 6px;
}

.strip {
    background: #08090d;
    border: 1px solid #151820;
    height: 68px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    padding: 4px;
    gap: 2px;
    overflow: hidden;
    position: relative;
}

.strip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 255, 229, 0.03) 0%, transparent 20%, transparent 80%, rgba(0, 255, 229, 0.03) 100%);
    pointer-events: none;
}

.stnote {
    flex: 1;
    height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.05s;
    user-select: none;
    -webkit-user-select: none;
}

.stnote:hover {
    background: rgba(0, 255, 229, 0.06);
}

.stnote.active {
    background: rgba(0, 255, 229, 0.15) !important;
}

.stnote .note-line {
    width: 1px;
    height: 28px;
    background: linear-gradient(to bottom, var(--accent), rgba(0, 255, 229, 0.1));
    margin-bottom: 4px;
    transition: height 0.05s, background 0.05s;
}

.stnote.active .note-line {
    height: 40px;
    background: linear-gradient(to bottom, #fff, var(--accent));
}

.stnote .note-num {
    font-size: 9px;
    color: #333;
    letter-spacing: 0;
    transition: color 0.05s;
}

.stnote.active .note-num {
    color: var(--accent);
}

/* ─── KEYBOARD ─── */
.keyboard-section {
    margin-bottom: 10px;
}

.keyboard-label {
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--dim);
    margin-bottom: 6px;
}

.keyboard {
    position: relative;
    height: 160px;
    display: flex;
    border: 1px solid #1a1d26;
    overflow: hidden;
}

.white-key {
    flex: 1;
    background: linear-gradient(to bottom, #d8dce0, #f0f4f8);
    border-right: 1px solid #bbb;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 7px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.04s;
}

.white-key:last-child {
    border-right: none;
}

.white-key.active {
    background: linear-gradient(to bottom, #b0ffe8, #e0fff6);
    box-shadow: inset 0 -4px 0 rgba(0, 255, 229, 0.5);
}

.white-key .k-label {
    font-size: 9px;
    color: #aaa;
    font-family: 'Share Tech Mono', monospace;
}

.white-key.active .k-label {
    color: var(--accent);
}

.black-key {
    position: absolute;
    width: 36px;
    height: 96px;
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    top: 0;
    z-index: 2;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 8px;
    border-radius: 0 0 3px 3px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.8);
    transition: background 0.04s;
}

.black-key.active {
    background: linear-gradient(to bottom, #004040, #003333);
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.8), inset 0 -2px 0 var(--accent);
}

.black-key .k-label {
    font-size: 8px;
    color: #444;
    font-family: 'Share Tech Mono', monospace;
}

.black-key.active .k-label {
    color: var(--accent);
}

/* ─── KEY HINT BAR ─── */
.keyhints {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
}

.hint {
    font-size: 9px;
    color: #334;
    letter-spacing: 1px;
    border: 1px solid #1e2230;
    padding: 2px 6px;
}

.hint span {
    color: var(--accent);
    margin-right: 3px;
}

/* ─── FOOTER ─── */
.footer {
    width: 100%;
    max-width: 960px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 9px;
    color: #1e2230;
    letter-spacing: 2px;
}

/* Active pulse on pressed notes */
@keyframes notePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 229, 0.5);
    }

    100% {
        box-shadow: 0 0 0 8px rgba(0, 255, 229, 0);
    }
}

/* Intro animation */
.unit {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 600px) {
    .keyboard {
        height: 120px;
    }

    .black-key {
        height: 72px;
        width: 28px;
    }

    .controls-row {
        gap: 14px 18px;
    }

    input[type=range] {
        width: 100px;
    }

    .vu-section {
        display: none;
    }
}