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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0;
}

@media (min-width: 768px) {
    #app {
        margin: 20px auto;
        border-radius: 20px;
    }
}

.header {
    background: #2196F3;
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.channel-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    opacity: 0.9;
}

.main {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

.channel-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-weight: 500;
    width: 100%;
    max-width: 280px;
    justify-content: center;
}

.channel-selector label {
    color: #495057;
    font-size: 0.9rem;
}

.channel-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    outline: none;
    transition: all 0.3s ease;
}

.channel-input:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.join-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.join-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.join-btn:active:not(:disabled) {
    transform: translateY(0);
}

.join-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.status-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status.connected {
    background: #e8f5e8;
    color: #2e7d2e;
}

.status.disconnected {
    background: #ffeaea;
    color: #d32f2f;
}

.status.error {
    background: #fff3cd;
    color: #856404;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.speaking-indicator {
    padding: 15px 20px;
    background: #f0f4ff;
    border: 2px solid #e3f2fd;
    border-radius: 25px;
    color: #1565c0;
    font-weight: 500;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.speaking-indicator.active {
    opacity: 1;
    transform: scale(1);
    background: #e3f2fd;
    border-color: #2196f3;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.ptt-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
}

.ptt-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.4);
}

.ptt-button:active:not(:disabled),
.ptt-button.recording {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    transform: scale(0.95);
    box-shadow: 0 2px 15px rgba(244, 67, 54, 0.4);
}

.ptt-button.recording::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: ripple 1s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.ptt-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.ptt-button .ptt-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.ptt-button .ptt-text {
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.2;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 200px;
}

.volume-control label {
    font-weight: 500;
    color: #555;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196f3;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196f3;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.beep-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #2196f3;
    border-color: #2196f3;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label:hover .checkmark {
    border-color: #2196f3;
    transform: scale(1.05);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark:hover {
    background: #1976d2;
}

.instructions {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 300px;
}

.instructions p {
    margin-bottom: 8px;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.8rem;
    border-top: 1px solid #eee;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .main {
        padding: 20px 15px;
        gap: 20px;
    }

    .ptt-button {
        width: 100px;
        height: 100px;
    }

    .ptt-button .ptt-icon {
        font-size: 1.5rem;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.3rem;
    }
}

/* Focus styles for accessibility */
.ptt-button:focus-visible {
    outline: 3px solid #2196f3;
    outline-offset: 3px;
}

input[type="range"]:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Service Worker Update Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}