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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #f0f0f0;
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.header h1 {
    font-size: 3em;
    background: linear-gradient(45deg, #FFD700, #00FFFF);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
    font-weight: bold;
}

.subtitle {
    font-size: 1.4em;
    color: #00FFFF;
    margin-bottom: 15px;
    font-style: italic;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.live-math-display {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    margin: 10px auto;
    max-width: 500px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #FFD700;
    backdrop-filter: blur(10px);
}

.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.mode-selector-group, .level-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mode-selector-group label, .level-toggle label {
    font-size: 12px;
    color: #00FFFF;
    text-transform: uppercase;
    font-weight: bold;
}

.mode-selector-group select, .level-toggle select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.mode-selector-group select:focus, .level-toggle select:focus {
    outline: none;
    border-color: #00FFFF;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.circle-of-fifths-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.widget-label {
    font-size: 12px;
    color: #00FFFF;
    text-transform: uppercase;
    font-weight: bold;
}

.circle-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.circle-key {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.circle-key:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.1);
}

.circle-key.active {
    background: linear-gradient(45deg, #FFD700, #FF8C00);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.main-container {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.left-panel, .right-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.panel:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 255, 0.3);
}

.panel h3 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

#canvas {
    border: 3px solid rgba(0, 255, 255, 0.4);
    border-radius: 20px;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 1));
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    transition: box-shadow 0.3s ease;
}

#canvas:hover {
    box-shadow: 0 0 60px rgba(0, 255, 255, 0.5);
}

.main-btn {
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.3), rgba(255, 215, 0, 0.3));
    border: 2px solid rgba(0, 255, 255, 0.6);
    color: #f0f0f0;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-btn:hover {
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.5), rgba(255, 215, 0, 0.5));
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}

.main-btn:active {
    transform: translateY(0);
}

button {
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.2), rgba(255, 215, 0, 0.2));
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

button:hover {
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.4), rgba(255, 215, 0, 0.4));
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateY(-1px);
}

.slider-group {
    margin: 15px 0;
}

.slider-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #f0f0f0;
    font-weight: bold;
}

.math-ratio {
    font-size: 12px;
    color: #FFD700;
    font-style: italic;
    margin-top: 4px;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    transition: all 0.3s ease;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.3);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00FFFF, #FFD700);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

.tuning-system select, .formula-selector select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    margin-bottom: 10px;
}

.toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.toggle-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00FFFF;
}

.toggle-item span {
    font-size: 12px;
    color: #f0f0f0;
}

.formula-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.virtual-piano {
    position: relative;
    height: 100px;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
}

.piano-key {
    position: absolute;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    font-size: 10px;
    font-weight: bold;
    user-select: none;
    transition: all 0.2s ease;
    border-radius: 0 0 4px 4px;
}

.white-key {
    width: 26px;
    height: 70px;
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    border: 1px solid #ccc;
    color: #333;
}

.black-key {
    width: 18px;
    height: 45px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border: 1px solid #000;
    color: #fff;
    z-index: 2;
}

.note-name {
    font-weight: bold;
}

.frequency-label {
    font-size: 8px;
    color: #666;
}

.piano-key:active, .piano-key.active {
    transform: scale(0.95);
}

.white-key:active, .white-key.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
}

.black-key:active, .black-key.active {
    background: linear-gradient(to bottom, #555 0%, #222 100%);
}

.frequency-display {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #00FFFF;
    text-align: center;
}

.interval-calc {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-selectors {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.note-selectors select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.note-selectors span {
    color: #FFD700;
    font-weight: bold;
}

.interval-result {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #FFD700;
    text-align: center;
}

.chord-builder {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chord-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chord-btn {
    padding: 8px 4px;
    font-size: 11px;
    text-align: center;
    line-height: 1.2;
}

.chord-btn small {
    display: block;
    font-size: 9px;
    color: #FFD700;
    margin-top: 2px;
}

.chord-analysis {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: 10px;
    font-size: 11px;
    color: #00FFFF;
    line-height: 1.4;
    min-height: 60px;
}

.lesson-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.lesson-selector select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
}

.lesson-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    font-size: 12px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

.lesson-content h4 {
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 14px;
}

.lesson-content ul {
    margin: 10px 0 10px 20px;
}

.lesson-content li {
    margin-bottom: 4px;
}

.lesson-content strong {
    color: #00FFFF;
}

.bottom-panel {
    margin: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.sequencer-container h3 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
}

.sequencer-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 4px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.sequencer-step {
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequencer-step:hover {
    background: rgba(0, 255, 255, 0.3);
    border-color: #00FFFF;
}

.sequencer-step.active {
    background: linear-gradient(45deg, #FFD700, #FF8C00);
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.sequencer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sequencer-controls select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: #f0f0f0;
    padding: 8px;
    border-radius: 8px;
    font-size: 14px;
}

@media (max-width: 1400px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    
    .left-panel, .right-panel {
        width: 100%;
        max-width: 900px;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .panel {
        min-width: 280px;
        flex-shrink: 0;
    }
    
    #canvas {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2.2em;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .circle-keys {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .left-panel, .right-panel {
        flex-direction: column;
    }
    
    #canvas {
        width: 100%;
        max-width: 600px;
    }
    
    .sequencer-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .sequencer-step {
        width: 30px;
        height: 30px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #00FFFF, #FFD700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #FFD700, #00FFFF);
}

/* Animation classes */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(0, 255, 255, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.6); }
    100% { box-shadow: 0 0 5px rgba(0, 255, 255, 0.3); }
}

.glow {
    animation: glow 3s ease-in-out infinite;
}