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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #ffffff;
    min-height: 100vh;
}

.app-container {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 2px solid rgba(0, 245, 255, 0.3);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #00f5ff, #ffd700);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

.nav-tabs {
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid rgba(0, 245, 255, 0.3);
    color: #00f5ff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.tab-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: #00f5ff;
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(0, 245, 255, 0.3);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-control label {
    font-size: 0.9rem;
    color: #ffd700;
}

.volume-control input[type="range"] {
    width: 100px;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px 250px;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 120px);
}

/* Canvas Section */
.canvas-section {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 245, 255, 0.2);
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.formula-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #90ee90;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Times New Roman', serif;
    font-size: 1.1rem;
    border: 1px solid rgba(144, 238, 144, 0.3);
}

/* Controls Panel */
.controls-panel {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 1rem;
    overflow-y: auto;
}

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

.control-group h3 {
    color: #ffd700;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 0.3rem;
}

.frequency-inputs label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

#freqValue {
    color: #00f5ff;
    font-weight: bold;
}

.frequency-inputs input[type="range"] {
    width: 100%;
    margin-bottom: 1rem;
}

.interval-buttons, .waveform-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.interval-btn, .wave-btn {
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid rgba(0, 245, 255, 0.3);
    color: #ffffff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    text-align: left;
}

.interval-btn:hover, .wave-btn:hover {
    background: rgba(0, 245, 255, 0.2);
}

.interval-btn.active, .wave-btn.active {
    background: #00f5ff;
    color: #1a1a2e;
    font-weight: bold;
}

.audio-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audio-buttons button {
    background: linear-gradient(45deg, #ff6b6b, #ffd700);
    border: none;
    color: #1a1a2e;
    padding: 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.9rem;
}

.audio-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* Info Sidebar */
.info-sidebar {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 1rem;
    overflow-y: auto;
}

.math-display h3, .theory-panel h3 {
    color: #ffd700;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 0.3rem;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.3rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.ratio-item .label {
    font-size: 0.8rem;
    color: #cccccc;
}

.ratio-item .value {
    font-size: 0.9rem;
    color: #00f5ff;
    font-weight: bold;
}

.theory-panel {
    margin-top: 1.5rem;
}

.theory-panel p {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    color: #e0e0e0;
}

#consonanceLevel {
    color: #90ee90;
    font-weight: bold;
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 245, 255, 0.3);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00f5ff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00f5ff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto auto;
    }
    
    .controls-panel, .info-sidebar {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        text-align: center;
        gap: 1rem;
    }
    
    .nav-tabs {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .tab-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .app-title {
        font-size: 1.4rem;
    }
}

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

.tab-btn.active {
    animation: glow 2s infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 245, 255, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 245, 255, 0.7);
}