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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Language Selection Screen */
.language-selection {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    .language-selection {
        padding: 30px 20px;
        border-radius: 15px;
    }
}

.language-selection h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 32px;
}

@media (max-width: 768px) {
    .language-selection h1 {
        font-size: 24px;
    }
}

.language-selection p {
    color: #666;
    margin-bottom: 40px;
    font-size: 16px;
}

.language-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.language-btn {
    padding: 20px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.language-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.language-btn .flag {
    font-size: 28px;
}

/* Connecting Screen */
.connecting-screen {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 60px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.connecting-screen h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

.connecting-screen p {
    color: #666;
    font-size: 14px;
}

/* Transcription Screen */
.transcription-screen {
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    padding: 0;
}

.transcription-header {
    background: rgba(255, 255, 255, 0.98);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 768px) {
    .transcription-header {
        padding: 15px;
    }
}

.transcription-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.connection-indicator {
    width: 12px;
    height: 12px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.transcription-header h2 {
    color: #333;
    font-size: 20px;
    margin: 0;
}

@media (max-width: 768px) {
    .transcription-header h2 {
        font-size: 16px;
    }
}

.status-message {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin: 20px;
    transition: opacity 0.3s ease;
}

.status-message.hidden {
    display: none;
}

.status-message.waiting {
    background: #fff3cd;
    color: #856404;
}

.status-message.ready {
    background: #d4edda;
    color: #155724;
}

.close-btn {
    padding: 10px 25px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.transcription-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    margin: 20px;
    border-radius: 15px;
    padding: 40px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .transcription-content {
        margin: 10px;
        padding: 20px;
        border-radius: 10px;
    }
}

.transcription-text {
    font-size: 28px;
    line-height: 1.8;
    color: #333;
    font-family: 'Georgia', serif;
}

@media (max-width: 768px) {
    .transcription-text {
        font-size: 20px;
        line-height: 1.6;
    }
}

.transcription-text.rtl {
    direction: rtl;
    text-align: right;
}

.transcription-text:empty::before {
    content: 'Waiting for transcriptions...';
    color: #999;
    font-style: italic;
}