/* Космические переменные и стили */
:root {
    /* Космическая цветовая палитра */
    --space-black: #000000;
    --space-dark: #0a0a0f;
    --space-deep: #1a1a2e;
    --space-purple: #2d1b69;
    --space-blue: #1e3a8a;
    --space-indigo: #4338ca;
    
    /* Космические акценты */
    --star-blue: #3b82f6;
    --star-cyan: #06b6d4;
    --star-purple: #8b5cf6;
    --star-pink: #ec4899;
    --star-gold: #fbbf24;
    --star-silver: #e5e7eb;
    --nebula-orange: #f97316;
    --nebula-red: #ef4444;
    --planet-green: #10b981;
    
    /* Галактические градиенты */
    --gradient-space: linear-gradient(135deg, #000000 0%, #0a0a0f 25%, #1a1a2e 50%, #2d1b69 75%, #1e3a8a 100%);
    --gradient-nebula: linear-gradient(135deg, #8b5cf6 0%, #ec4899 25%, #f97316 50%, #ef4444 75%, #3b82f6 100%);
    --gradient-stars: linear-gradient(135deg, #3b82f6 0%, #06b6d4 25%, #8b5cf6 50%, #ec4899 75%, #fbbf24 100%);
    --gradient-planet: linear-gradient(135deg, #1e3a8a 0%, #4338ca 25%, #8b5cf6 50%, #ec4899 75%, #f97316 100%);
    --gradient-glass: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    
    /* Космический текст */
    --text-star: #ffffff;
    --text-nebula: #e5e7eb;
    --text-planet: #9ca3af;
    --text-muted: #6b7280;
    --text-accent: #3b82f6;
    
    /* Космические состояния */
    --success-color: #10b981;
    --warning-color: #fbbf24;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Космические эффекты */
    --border-color: rgba(59, 130, 246, 0.2);
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-fast: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.8);
    --shadow-star: 0 0 30px rgba(59, 130, 246, 0.6);
    --shadow-nebula: 0 0 30px rgba(236, 72, 153, 0.6);
    --shadow-planet: 0 0 30px rgba(139, 92, 246, 0.6);
    
    /* Космический glassmorphism */
    --glass-bg: rgba(59, 130, 246, 0.05);
    --glass-border: rgba(59, 130, 246, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Fallback для старых браузеров */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Космические базовые стили */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 60% 60%, rgba(249, 115, 22, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #000000 0%, #0a0a0f 25%, #1a1a2e 50%, #2d1b69 75%, #1e3a8a 100%);
    background-attachment: fixed;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Звездное поле */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #ffffff, transparent),
                radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #ffffff, transparent),
                radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #ffffff, transparent),
        radial-gradient(1px 1px at 200px 60px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 240px 20px, #ffffff, transparent),
        radial-gradient(2px 2px at 280px 70px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 320px 40px, #ffffff, transparent),
        radial-gradient(1px 1px at 360px 80px, rgba(255,255,255,0.8), transparent);
    background-repeat: repeat;
    background-size: 400px 100px;
    animation: starfieldMove 100s linear infinite;
    z-index: -2;
}

/* Космические туманности */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 40% 40%, rgba(236, 72, 153, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 60%, rgba(249, 115, 22, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(239, 68, 68, 0.06) 0%, transparent 60%);
    animation: nebulaShift 30s ease-in-out infinite;
    z-index: -1;
}

@keyframes starfieldMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-400px); }
}

@keyframes nebulaShift {
    0%, 100% { 
        opacity: 0.8; 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        opacity: 1; 
        transform: scale(1.1) rotate(1deg); 
    }
    50% { 
        opacity: 0.9; 
        transform: scale(0.95) rotate(-1deg); 
    }
    75% { 
        opacity: 1.1; 
        transform: scale(1.05) rotate(0.5deg); 
    }
}

#app {
    min-height: 100vh;
    position: relative;
}

/* Страницы */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.page.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95); 
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1); 
    }
}

/* Экран "только для Telegram" - Космический */
#telegram-required {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, #000000 0%, #0a0a0f 25%, #1a1a2e 50%, #2d1b69 75%, #1e3a8a 100%);
    min-height: 100vh;
    position: relative;
}

.telegram-required-container {
    text-align: center;
    max-width: 450px;
    width: 100%;
    padding: 40px 20px;
    background: rgba(59, 130, 246, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 32px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.telegram-required-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    animation: cosmicShimmer 3s ease-in-out infinite;
}

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

.telegram-required-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-quantum);
    animation: shimmer 3s ease-in-out infinite;
}

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

.telegram-message {
    color: #3b82f6;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: cosmicMessageGlow 3s ease-in-out infinite;
}

@keyframes cosmicMessageGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
    }
    50% { 
        filter: drop-shadow(0 0 15px rgba(236, 72, 153, 0.5));
    }
}

.telegram-subtitle {
    color: #e5e7eb;
    font-size: 1rem;
    margin-bottom: 30px;
    line-height: 1.5;
}

.qr-container {
    margin: 30px 0;
    padding: 20px;
    background: rgba(59, 130, 246, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    text-align: center;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.qr-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    opacity: 0.6;
}

.qr-code {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.qr-text {
    color: #e5e7eb;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

.telegram-info {
    margin-top: 30px;
    text-align: left;
    background: rgba(59, 130, 246, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.telegram-info p {
    color: #e5e7eb;
    margin: 8px 0;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.telegram-info p::before {
    content: '✨';
    font-size: 1rem;
}

/* Страница авторизации - УДАЛЕНА */
/* В Telegram WebApp авторизация нативная и автоматическая */

.quantum-logo {
    margin-bottom: 40px;
    position: relative;
}

.atom-symbol {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
    filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.4));
}

.nucleus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 40px rgba(59, 130, 246, 0.8),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
    animation: cosmicNucleusPulse 4s ease-in-out infinite;
}

.orbit {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899, #f97316);
    background-clip: padding-box;
    opacity: 0.9;
}

.orbit::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899, #f97316);
    border-radius: 50%;
    z-index: -1;
    animation: cosmicOrbitGlow 5s ease-in-out infinite;
}

.orbit-1 {
    top: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    animation: cosmicRotate 8s linear infinite;
}

.orbit-2 {
    top: 10px;
    left: 10px;
    width: 140px;
    height: 140px;
    animation: cosmicRotate 12s linear infinite reverse;
}

.electron {
    position: absolute;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 20px rgba(59, 130, 246, 0.9),
        inset 0 0 8px rgba(255, 255, 255, 0.4);
    animation: cosmicElectronGlow 3s ease-in-out infinite alternate;
}

.electron-1 {
    top: 20px;
    left: 60px;
    animation: cosmicOrbit 8s linear infinite, cosmicElectronGlow 3s ease-in-out infinite alternate;
}

.electron-2 {
    top: 10px;
    left: 50px;
    animation: cosmicOrbit 12s linear infinite reverse, cosmicElectronGlow 3s ease-in-out infinite alternate;
}

@keyframes cosmicNucleusPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.8);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.4); 
        box-shadow: 0 0 60px rgba(236, 72, 153, 0.9);
    }
}

@keyframes cosmicOrbitGlow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes cosmicElectronGlow {
    0% { 
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.9);
        transform: scale(1);
    }
    100% { 
        box-shadow: 0 0 35px rgba(236, 72, 153, 0.9);
        transform: scale(1.3);
    }
}

@keyframes cosmicRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes cosmicOrbit {
    from { transform: rotate(0deg) translateX(60px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(60px) rotate(-360deg); }
}

.app-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    animation: cosmicTitleGlow 4s ease-in-out infinite;
    letter-spacing: -0.02em;
}

@keyframes cosmicTitleGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
    }
    50% { 
        filter: drop-shadow(0 0 20px rgba(236, 72, 153, 0.5));
    }
}

.app-subtitle {
    color: #e5e7eb;
    font-size: 1.1rem;
    margin-bottom: 40px;
    line-height: 1.6;
    font-weight: 400;
}

.telegram-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 24px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.telegram-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.telegram-btn:hover::before {
    left: 100%;
}

.telegram-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 16px 64px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(59, 130, 246, 0.4);
}

.telegram-btn:active {
    transform: translateY(-1px) scale(1.01);
}

/* Главная страница */
.main-container {
    max-width: 500px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 24px;
    background: rgba(59, 130, 246, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    opacity: 0.6;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
}

.user-avatar-container {
    position: relative;
    width: 70px;
    height: 70px;
}

.user-avatar-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    background-clip: padding-box;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.user-avatar-fallback {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    animation: cosmicAvatarGlow 3s ease-in-out infinite;
}

@keyframes cosmicAvatarGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
    }
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 6px 0;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-username {
    font-size: 0.95rem;
    color: #e5e7eb;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
}

.status-icon {
    font-size: 0.9rem;
    animation: statusPulse 2s ease-in-out infinite;
}

.status-text {
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 600;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.settings-btn {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #e5e7eb;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.settings-btn:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #ec4899 50%, #f97316 75%, #3b82f6 100%);
    color: white;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Панель управления */
.control-panel {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#message-input {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: var(--transition);
    box-shadow: var(--glass-shadow);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

#message-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 
        var(--glass-shadow),
        0 0 0 3px rgba(0, 212, 255, 0.1),
        0 0 20px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

#message-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.action-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 18px 24px;
    border-radius: var(--border-radius-lg);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--glass-shadow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    background: var(--gradient-quantum);
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        var(--shadow-lg),
        0 0 30px rgba(0, 212, 255, 0.3);
}

.action-btn.primary {
    background: var(--gradient-secondary);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-pink);
}

.action-btn.primary:hover {
    background: var(--gradient-quantum);
    box-shadow: 
        var(--shadow-lg),
        0 0 30px rgba(255, 107, 157, 0.4);
}

/* Визуализация модуляции */
.modulation-visual {
    margin-bottom: 30px;
}

.oscilloscope {
    position: relative;
    height: 220px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.photon-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.photon {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: photonMove 2s linear infinite;
    filter: blur(0.5px);
}

.photon.bit-1 {
    background: var(--gradient-quantum);
    box-shadow: 
        0 0 20px rgba(0, 212, 255, 0.8),
        inset 0 0 5px rgba(255, 255, 255, 0.3);
}

.photon.bit-0 {
    background: var(--gradient-secondary);
    box-shadow: 
        0 0 20px rgba(255, 107, 157, 0.8),
        inset 0 0 5px rgba(255, 255, 255, 0.3);
}

@keyframes photonMove {
    0% { 
        left: -15px; 
        opacity: 0; 
        transform: scale(0.5);
    }
    10% { 
        opacity: 1; 
        transform: scale(1);
    }
    90% { 
        opacity: 1; 
        transform: scale(1);
    }
    100% { 
        left: 100%; 
        opacity: 0; 
        transform: scale(0.5);
    }
}

/* Статистика */
.stats-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-quantum);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 
        var(--glass-shadow),
        0 0 20px rgba(0, 212, 255, 0.2);
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    color: var(--text-accent);
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--gradient-quantum);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Бинарный вывод */
.binary-output {
    margin-bottom: 30px;
}

.binary-output h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--gradient-quantum);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.binary-display {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    min-height: 80px;
    word-break: break-all;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.binary-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-quantum);
    opacity: 0.3;
}

.binary-bit {
    display: inline-block;
    padding: 3px 6px;
    margin: 2px;
    border-radius: 6px;
    font-weight: 700;
    transition: var(--transition-fast);
    position: relative;
}

.binary-bit.bit-1 {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.binary-bit.bit-1:hover {
    background: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    transform: scale(1.1);
}

.binary-bit.bit-0 {
    background: rgba(255, 107, 157, 0.2);
    color: var(--accent-pink);
    box-shadow: 0 0 10px rgba(255, 107, 157, 0.3);
}

.binary-bit.bit-0:hover {
    background: rgba(255, 107, 157, 0.3);
    box-shadow: 0 0 15px rgba(255, 107, 157, 0.5);
    transform: scale(1.1);
}

/* Страница передачи */
.transfer-container {
    max-width: 500px;
    margin: 0 auto;
}

.transfer-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.back-btn {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.back-btn:hover {
    background: var(--accent-blue);
    color: white;
}

.transfer-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.camera-preview {
    position: relative;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 30px;
    height: 300px;
}

#camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.flash-indicator {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid var(--accent-blue);
    margin-bottom: 20px;
    transition: var(--transition);
}

.flash-indicator.active {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.8);
}

.transmission-status {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.transmission-controls {
    margin-bottom: 30px;
}

.transmission-btn {
    background: linear-gradient(135deg, var(--accent-pink), #e91e63);
    color: white;
    border: none;
    padding: 20px;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 20px;
}

.transmission-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 77, 141, 0.4);
}

.transmission-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--secondary-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 40px;
}

.transmission-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-item {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
}

.info-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.info-value {
    display: block;
    color: var(--accent-blue);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
}

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

.modal-content {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.setting-item select,
.setting-item input[type="range"] {
    width: 100%;
    padding: 10px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius);
}

.setting-item input[type="range"] {
    padding: 0;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.logout-btn:hover {
    background: #d32f2f;
}

/* Адаптивность */
@media (max-width: 480px) {
    .page {
        padding: 15px;
    }
    
    .app-title {
        font-size: 2rem;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .transmission-info {
        grid-template-columns: 1fr;
    }
    
    .camera-preview {
        height: 250px;
    }
}

/* Анимации загрузки */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(52, 194, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Эффекты квантового свечения */
.quantum-glow {
    position: relative;
    overflow: hidden;
}

.quantum-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(52, 194, 255, 0.1), transparent);
    animation: glow 3s linear infinite;
}

@keyframes glow {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Анимации уведомлений */
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(-100%); opacity: 0; }
}

/* Стили уведомлений */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    z-index: 10000;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease-out;
    max-width: 90%;
    text-align: center;
}

.notification-success {
    background: var(--success-color);
    color: white;
}

.notification-error {
    background: var(--error-color);
    color: white;
}

.notification-warning {
    background: var(--warning-color);
    color: white;
}

.notification-info {
    background: var(--accent-blue);
    color: white;
}
