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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#container {
    max-width: 800px;
    width: 100%;
}

#header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

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

#status {
    text-align: center;
    margin-bottom: 3rem;
}

.button {
    padding: 1rem 2.5rem;
    border: 2px solid #4a4a4a;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
}

.button.primary {
    background: #2a2a2a;
    border-color: #5a5a5a;
}

.button:hover {
    border-color: #7a7a7a;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.button:active {
    transform: translateY(0);
}

.status-message {
    font-size: 0.85rem;
    color: #666;
    margin-top: 1rem;
    letter-spacing: 0.03em;
}

#controls {
    /* Controls are now in dialog, no opacity transitions needed */
}

.controls-section {
    margin-bottom: 3rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.controls-section h2 {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffffff;
}

.section-description {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 1.5rem;
    font-style: italic;
}

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

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.9rem;
    color: #b0b0b0;
    margin-bottom: 0.75rem;
    font-weight: 400;
}

.label-text {
    letter-spacing: 0.03em;
}

.label-freq {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.2rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: normal;
}

.control-group input[type="range"],
.control-group select {
    width: 100%;
    outline: none;
    margin: 0.5rem 0;
}

.control-group input[type="range"] {
    height: 6px;
    background: #2a2a2a;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
}

.chord-select {
    background: #2a2a2a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    padding: 0.5rem;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.chord-select:hover {
    border-color: #7a7a7a;
}

.chord-select:focus {
    border-color: #9a9a9a;
    outline: none;
}

.chord-select option {
    background: #1a1a1a;
    color: #e0e0e0;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #ffffff;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.value {
    display: inline-block;
    font-size: 0.85rem;
    color: #888;
    font-variant-numeric: tabular-nums;
    min-width: 4ch;
    text-align: right;
    font-family: 'Monaco', 'Menlo', monospace;
}

.param-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #777;
    cursor: pointer;
    white-space: nowrap;
}

.param-toggle input[type="checkbox"] {
    accent-color: #888;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

#visualizer {
    margin: 2rem 0;
    width: 100%;
    height: 200px;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

#visualizer.visible {
    opacity: 1;
}

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

#ambient-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#ambient-indicator.visible {
    opacity: 1;
}

.indicator-dot {
    width: 10px;
    height: 10px;
    background: #4a7bc8;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.hidden {
    display: none !important;
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dialog-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.dialog-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.dialog-overlay.visible .dialog-content {
    transform: scale(1);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dialog-header h2 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: #ffffff;
    margin: 0;
}

.close-button {
    background: transparent;
    border: none;
    color: #888;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    border-radius: 4px;
}

.close-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.dialog-body {
    padding: 2rem;
}

#main-controls {
    text-align: center;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    #container {
        padding: 0;
    }
    
    .controls-section {
        padding: 1.5rem;
    }
    
    #ambient-indicator {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}
