* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.controls label {
    font-weight: 600;
    color: #495057;
}

#micSelect {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

#micSelect:hover:not(:disabled) {
    border-color: #667eea;
}

#micSelect:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

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

/* Status */
.status {
    text-align: center;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    border-radius: 5px;
    margin-bottom: 30px;
    font-weight: 500;
    color: #0c5293;
}

.status.error {
    background: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
}

.status.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
    color: #2e7d32;
}

/* Microphone Level Indicator */
.mic-level-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 30px;
}

.mic-level-label {
    font-weight: 600;
    color: #495057;
    min-width: 130px;
}

.mic-level-bar {
    flex: 1;
    height: 25px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mic-level-fill {
    height: 100%;
    width: 0%;
    background: #4caf50;
    transition: width 0.1s ease-out, background 0.3s;
    border-radius: 12px;
}

.mic-level-text {
    font-weight: bold;
    color: #495057;
    min-width: 45px;
    text-align: right;
}

/* Tuner Display */
.tuner-container {
    margin-bottom: 40px;
}

.tuner-display {
    position: relative;
    height: 150px;
    margin-bottom: 30px;
}

.indicator-bar {
    display: flex;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.zone {
    flex: 1;
    transition: opacity 0.3s;
}

.zone-red-left {
    background: linear-gradient(to right, #dc3545, #ff6b6b);
}

.zone-orange-left {
    background: linear-gradient(to right, #ff8c42, #ffa726);
}

.zone-green {
    background: linear-gradient(to right, #66bb6a, #4caf50, #66bb6a);
    flex: 1.5;
}

.zone-orange-right {
    background: linear-gradient(to right, #ffa726, #ff8c42);
}

.zone-red-right {
    background: linear-gradient(to right, #ff6b6b, #dc3545);
}

.needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 120px;
    background: #212529;
    transform: translateX(-50%) rotate(0deg);
    transform-origin: center bottom;
    transition: transform 0.1s ease-out;
    z-index: 10;
}

.needle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #212529;
}

.needle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: #212529;
    border-radius: 50%;
    border: 3px solid white;
}

/* Note Information */
.note-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.note-display,
.frequency-display,
.cents-display {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

.label {
    display: block;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.note-value {
    display: block;
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
}

.frequency-value,
.cents-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #495057;
}

/* Tuning Reference */
.tuning-reference {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.tuning-reference h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.5em;
}

.strings {
    display: grid;
    gap: 10px;
}

.string {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.string-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 15px;
}

.string-note {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
    margin-right: auto;
    min-width: 50px;
}

.string-freq {
    color: #6c757d;
    font-weight: 500;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    #micSelect {
        width: 100%;
    }

    button {
        width: 100%;
    }

    .note-value {
        font-size: 2.5em;
    }

    .frequency-value,
    .cents-value {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    main {
        padding: 20px;
    }

    .tuner-display {
        height: 120px;
    }

    .indicator-bar {
        height: 60px;
    }

    .needle {
        height: 100px;
    }
}
