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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.title-section {
    text-align: left;
}

.title-with-wave {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#toneWave {
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.8;
}

.header-controls {
    flex-shrink: 0;
    display: flex;
    gap: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.2rem;
    background: linear-gradient(135deg, #4a9eff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    font-weight: 300;
}

.subtitle-inline {
    font-size: 1.2rem;
    color: #888;
    font-weight: 300;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #888;
    background-clip: unset;
}

.version {
    font-size: 0.9rem;
    color: #666;
    font-family: monospace;
}

.version a {
    color: #666;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
    transition: all 0.2s ease;
}

.version a:hover {
    color: #00d4aa;
    border-bottom-color: #00d4aa;
    margin-top: 0.5rem;
}

main {
    height: calc(100vh - 150px);
}

.display-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

.side-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

canvas {
    background: rgb(20, 20, 30);
}

#spectrum {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#waveform {
    width: 100%;
    height: 300px;
}


button {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4a9eff, #00ff88);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(74, 158, 255, 0.4);
}

.btn-secondary {
    background: #333;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #444;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.piano {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    height: 60px;
    background: rgba(20, 20, 30, 0.9);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.key-group {
    position: relative;
    display: flex;
}

.piano-key {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
    border-radius: 3px;
}

.piano-key.white {
    width: 32px;
    height: 60px;
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    z-index: 1;
}

.piano-key.black {
    width: 14px;
    height: 60px;
    background: #222;
    border: 1px solid #111;
    color: #fff;
    z-index: 2;
}

.piano-key.white:hover {
    background: #f0f0f0;
}

.piano-key.black:hover {
    background: #444;
}

.piano-key:active {
    transform: translateY(1px);
}

.piano-key.white:active {
    background: #e0e0e0;
}

.piano-key.black:active {
    background: #111;
}

.info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    margin-top: auto;
}

.frequency-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

#peakFreq, #dominantNote {
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #4a9eff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.synth-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(20, 20, 30, 0.95);
    padding: 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 50;
    max-width: 320px;
}

.control-section {
    margin-bottom: 1.5rem;
}

.control-section h3 {
    color: #4a9eff;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(74, 158, 255, 0.3);
    padding-bottom: 0.5rem;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.control label {
    font-size: 0.8rem;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.control input[type="range"] {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #4a9eff, #00ff88);
    border-radius: 50%;
    cursor: pointer;
}

.control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #4a9eff, #00ff88);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.4rem;
    font-size: 0.8rem;
}

.control .value {
    font-size: 0.7rem;
    color: #4a9eff;
    text-align: right;
    font-family: monospace;
}

@media (max-width: 768px) {
    .synth-controls {
        position: relative;
        top: auto;
        left: auto;
        margin: 1rem 0;
        max-width: 100%;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .title-section {
        text-align: center;
    }

    .title-with-wave {
        flex-direction: column;
        gap: 0.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .display-container {
        flex-direction: column;
        height: calc(100vh - 300px);
    }

    .side-panel {
        width: 100%;
        flex-direction: row;
        height: auto;
    }

    #waveform {
        height: 120px;
        flex: 1;
    }

    button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}