* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
}

.player-container {
    background: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    width: 100%;
    max-width: 500px;
    min-height: 460px;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: clamp(20px, 5vw, 24px);
    font-weight: 600;
}

h4 {
    color: #555;
}

.status {
    margin: 15px 0;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: clamp(12px, 3vw, 14px);
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.status.disconnected {
    background: #ffebee;
    color: #c62828;
}

.status.connecting {
    background: #fff3e0;
    color: #ef6c00;
}

.status.connected {
    background: #e8f5e9;
    color: #2e7d32;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0;
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 130px;
    max-width: 200px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

button:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.vu-meter-container {
    margin: 25px 0;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 12px;
    flex-shrink: 0;
}

.vu-meter-label {
    font-size: clamp(13px, 3vw, 15px);
    color: #666;
    margin-bottom: 12px;
    font-weight: 600;
}

.vu-meter {
    width: 100%;
    height: 32px;
    background: #2c2c2c;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.vu-meter-fill {
    height: 100%;
    width: 0%;
    transition: width 0.05s ease-out, background 0.1s ease-out;
    border-radius: 3px;
    position: relative;
}

.vu-meter-fill.too-quiet {
    background: linear-gradient(to right, #666, #999, #ffeb3b);
}

.vu-meter-fill.good {
    background: linear-gradient(to right, #4caf50, #66bb6a, #81c784);
}

.vu-meter-fill.too-loud {
    background: linear-gradient(to right, #ff9800, #ff5722, #f44336);
}

.vu-meter-peak {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: white;
    box-shadow: 0 0 5px rgba(255,255,255,0.8);
}

.vu-meter-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: clamp(8px, 2vw, 10px);
    color: #999;
}

.vu-db-value {
    margin-top: 10px;
    font-size: clamp(14px, 3.5vw, 17px);
    font-weight: 700;
    transition: color 0.2s ease-out, opacity 0.4s ease-in-out;
    min-height: 26px;
}

.vu-db-value.too-quiet {
    color: #f57c00;
}

.vu-db-value.good {
    color: #4caf50;
}

.vu-db-value.too-loud {
    color: #f44336;
}

.modulation-indicator {
    margin-top: 12px;
    padding: 12px 10px;
    border-radius: 8px;
    font-weight: 600;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: opacity 0.4s ease-in-out, background 0.3s ease, color 0.3s ease;
}

.modulation-indicator.fade {
    opacity: 0;
}

.modulation-status {
    font-size: clamp(13px, 3.2vw, 15px);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.modulation-message {
    font-size: clamp(10px, 2.5vw, 12px);
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.3;
}

.modulation-indicator.too-quiet {
    background: #fff3e0;
    color: #f57c00;
}

.modulation-indicator.good {
    background: #e8f5e9;
    color: #4caf50;
}

.modulation-indicator.too-loud {
    background: #ffebee;
    color: #f44336;
}

.volume-control {
    margin: 0px 0 auto 0;
    flex-shrink: 0;
}

.volume-control label {
    font-size: clamp(13px, 3vw, 15px);
    font-weight: 600;
    color: #666;
}

input[type="range"] {
    width: 100%;
    margin: 10px 0;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #667eea 0%, #667eea var(--value), #ddd var(--value), #ddd 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#volumeValue {
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 700;
    color: #667eea;
}

/* Responsive breakpoints */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    .player-container {
        padding: 20px 15px;
        min-height: 440px;
    }
    .vu-meter {
        height: 28px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .player-container {
        padding: 25px 20px;
        min-height: 450px;
    }
}

@media (min-width: 769px) {
    .player-container {
        padding: 35px 30px;
    }
}

footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(11px, 2.5vw, 13px);
    max-width: 500px;
    width: 100%;
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff;
}
