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

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: #1a1a3a;
    --text-primary: #ffffff;
    --text-secondary: #aab;
    --accent-green: #00ff88;
    --accent-blue: #0088ff;
    --accent-red: #ff5e5e;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0;
}

#app {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-card));
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* شاشة البداية */
#startScreen {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 24px;
}

.logo {
    font-size: 80px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(0, 255, 136, 0.2));
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

#startScreen h1 {
    font-size: 32px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

#startScreen p {
    color: var(--text-secondary);
    font-size: 16px;
}

.btn-primary {
    padding: 16px 48px;
    border: none;
    border-radius: 60px;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #00c88a, #00a06e);
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 200, 120, 0.35);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:active {
    transform: scale(0.94);
}

.footer {
    margin-top: 30px;
    color: #556;
    font-size: 14px;
}

.footer a {
    color: var(--accent-green);
    text-decoration: none;
}

/* هيدر المكالمة */
.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.room-title {
    font-size: 17px;
    font-weight: 600;
    color: #eee;
    background: rgba(255, 255, 255, 0.04);
    padding: 5px 14px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.participants-badge {
    background: rgba(0, 255, 200, 0.08);
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 200, 0.08);
    white-space: nowrap;
}

.menu-dots {
    width: 40px;
    height: 40px;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    color: #aaa;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.menu-dots:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.92);
}

/* قائمة المشاركين */
.participants-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.participant-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 60px;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.participant-item:active {
    background: rgba(255, 255, 255, 0.04);
    transform: scale(0.98);
}

.participant-item.admin-item {
    cursor: pointer;
}

.participant-item.admin-item:active {
    background: rgba(255, 255, 255, 0.06);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 44px;
    background: linear-gradient(135deg, #2a2a5a, #4a4a7a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.04);
    background-size: cover;
    background-position: center;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.username {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #eef;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.username .admin-badge {
    font-size: 14px;
    margin-right: 4px;
}

.mic-indicator {
    width: 34px;
    height: 34px;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

.mic-on {
    background: rgba(0, 255, 120, 0.10);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 120, 0.10);
}

.mic-off {
    background: rgba(255, 70, 70, 0.06);
    color: var(--accent-red);
    border: 1px solid rgba(255, 70, 70, 0.05);
}

.mic-speaking {
    background: rgba(0, 255, 120, 0.25);
    color: var(--accent-green);
    box-shadow: 0 0 25px rgba(0, 255, 120, 0.15);
    animation: speakPulse 0.6s infinite alternate;
}

@keyframes speakPulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(0, 255, 120, 0.05); }
    100% { transform: scale(1.10); box-shadow: 0 0 30px rgba(0, 255, 120, 0.25); }
}

.voice-wave {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 38px;
    height: 38px;
    border-radius: 38px;
    border: 2px solid transparent;
    animation: waveRing 1.2s infinite;
    pointer-events: none;
}

.voice-wave:nth-child(2) { animation-delay: 0.4s; }

@keyframes waveRing {
    0% { transform: scale(1); opacity: 0.8; border-color: rgba(0, 255, 120, 0.3); }
    100% { transform: scale(1.4); opacity: 0; border-color: rgba(0, 255, 120, 0); }
}

/* شريط التحكم */
.control-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 14px 12px 24px;
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
    gap: 4px;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.02);
    color: #aaa;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:active { transform: scale(0.88); }

.mic-btn {
    width: 72px;
    height: 72px;
    background: linear-gradient(145deg, #2a2a5a, #1a1a3a);
    border: 2px solid rgba(255, 255, 255, 0.03);
    font-size: 32px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}

.mic-btn.active {
    background: linear-gradient(145deg, #00c88a, #00a06e);
    border-color: rgba(0, 255, 180, 0.3);
    box-shadow: 0 8px 40px rgba(0, 200, 120, 0.25);
    color: #fff;
}

.mic-btn .pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 80px;
    height: 80px;
    border-radius: 80px;
    border: 2px solid rgba(0, 255, 120, 0.1);
    animation: none;
    pointer-events: none;
}

.mic-btn.active .pulse-ring {
    animation: pulseRing 2s infinite;
}

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

.share-btn.active {
    background: rgba(255, 200, 0, 0.10);
    color: #ffd866;
    border-color: rgba(255, 200, 0, 0.10);
}

.leave-btn {
    background: rgba(255, 60, 60, 0.06);
    color: var(--accent-red);
    border-color: rgba(255, 60, 60, 0.04);
}

.leave-btn:active { background: rgba(255, 60, 60, 0.15); }

/* مودال */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: #1a1a36;
    border-radius: 32px;
    padding: 28px 24px;
    width: 92%;
    max-width: 380px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-card { transform: scale(1) translateY(0); }

.modal-card h3 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 18px;
    color: #fff;
    font-weight: 600;
}

.modal-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 60px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    color: #ddd;
}

.modal-item:active {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(0.97);
}

.modal-item .icon {
    font-size: 20px;
    width: 34px;
    text-align: center;
    flex-shrink: 0;
}

.modal-item .label { flex: 1; font-size: 15px; }

.modal-close {
    margin-top: 18px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 60px;
    text-align: center;
    color: #999;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
}

.modal-close:active {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(0.96);
}

/* شاشة الاتصال */
.connecting-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 60;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.connecting-screen.show {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--accent-green);
    animation: spin 1s linear infinite;
}

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

.connecting-screen p { color: var(--text-secondary); font-size: 16px; }

/* Toast */
.toast {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 24px;
    border-radius: 40px;
    font-size: 14px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 50;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    bottom: 120px;
}

/* سكرول */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 20px; }