/* TorraAI - Точная копия Flutter дизайна */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Запрет выделения и копирования на всем сайте */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Разрешаем выделение в сообщениях чата */
.message-bubble .message-content,
.message-text,
.message-image,
code,
pre {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* Разрешаем выделение в полях ввода */
input,
textarea,
.message-input,
[contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
    /* Разрешаем нормальные touch-действия для выделения текста */
    touch-action: auto !important;
    -webkit-touch-callout: default !important;
    /* Разрешаем стандартные жесты для выделения */
    -webkit-user-drag: auto;
    cursor: text;
}

/* Дополнительные стили для textarea для корректной работы на мобильных */
textarea.message-input,
#messageInput,
#imagePromptInput {
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    -webkit-overflow-scrolling: touch;
    /* Разрешаем выделение текста на iOS */
    -webkit-touch-callout: default !important;
    -webkit-tap-highlight-color: transparent;
}

/* Запрет выделения в погоде */
#weatherFrame,
#weatherFrame *,
#weatherModal,
#weatherModal * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Разрешаем выделение в браузере (Фуллка) */
#browserFrame,
#browserFrame *,
.browser-container,
.browser-container * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #f1f5f9;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
    --success: #22c55e;
    --error: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
    --radius-lg: 12px;
    --spacing: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    
    /* Базовый отступ (средние экраны) */
    --app-top-offset: 20px;
    --modal-top-offset: 40px;
}

/* Очень большие экраны (планшеты, десктопы > 1000px) - safe-area = 0, максимальный отступ */
@media (min-height: 1000px) {
    :root {
        --app-top-offset: 48px;
        --modal-top-offset: 68px;
    }
}

/* Большие экраны с чуть большей высотой (900-999px) - увеличенный отступ для 2712x1220 */
@media (min-height: 900px) and (max-height: 999px) {
    :root {
        --app-top-offset: 56px;
        --modal-top-offset: 76px;
    }
}

/* Средне-большие экраны (850-899px) - идеальный отступ для iPhone 14 Pro Max */
@media (min-height: 850px) and (max-height: 899px) {
    :root {
        --app-top-offset: 24px;
        --modal-top-offset: 44px;
    }
}

/* Экраны (800-849px) - немного больше отступ */
@media (min-height: 800px) and (max-height: 849px) {
    :root {
        --app-top-offset: 28px;
        --modal-top-offset: 48px;
    }
}

/* Средние экраны (700-799px) - больше отступ */
@media (min-height: 700px) and (max-height: 799px) {
    :root {
        --app-top-offset: 32px;
        --modal-top-offset: 52px;
    }
}

/* Маленькие экраны (600-699px) - еще больше отступ для компенсации системной панели */
@media (min-height: 600px) and (max-height: 699px) {
    :root {
        --app-top-offset: 44px;
        --modal-top-offset: 64px;
    }
}

/* Очень маленькие экраны (< 600px) - максимальный отступ */
@media (max-height: 599px) {
    :root {
        --app-top-offset: 52px;
        --modal-top-offset: 72px;
    }
}

/* Dark Theme */
body.dark-theme {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #a5b4fc;
    --secondary: #334155;
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-light: #cbd5e1;
    --success: #22c55e;
    --error: #ef4444;
    --info: #3b82f6;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body.dark-theme .drawer-header {
    background: rgba(30, 41, 59, 0.1);
}

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

html, body, #app {
    max-width: 100vw;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Dynamic viewport height */
}

html {
    touch-action: pan-x pan-y;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

/* Фоллбэк для старых браузеров без поддержки inset */
@supports not (inset: 0) {
    [style*="inset"] {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}

/* Фоллбэк для backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
    .modal-overlay,
    .drawer-overlay,
    .modal,
    .confirm-modal,
    .tnx-welcome-backdrop {
        background: rgba(0, 0, 0, 0.85) !important;
    }
}

/* Когда клавиатура открыта - уменьшаем верхний отступ, но оставляем комфортный */
body[data-keyboard-visible] .app-container,
body[data-keyboard-visible] .chat-drawer,
body[data-keyboard-visible] .image-gen-container,
body[data-keyboard-visible] .image-history-container {
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px) !important;
}

/* Для модальных окон тоже уменьшаем отступ при открытой клавиатуре */
body[data-keyboard-visible] .modal-overlay,
body[data-keyboard-visible] .modal,
body[data-keyboard-visible] .confirm-modal {
    padding-top: calc(env(safe-area-inset-top, 0px) + 20px) !important;
}

/* Splash Screen */
/* ==================== ЗАСТАВКА В СТИЛЕ FLUTTER ==================== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, 
        #000000 0%,
        #0D1117 30%,
        #161B22 70%,
        #000000 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
    overflow: hidden;
    transition: opacity 0.5s ease-out;
}

/* Анимированные частицы (15 штук как в Flutter) */
.splash-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.splash-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(99, 102, 241, 0.5);
    animation: floatParticle 3s ease-in-out infinite;
}

.splash-particle:nth-child(1) { left: 10%; top: 15%; width: 2px; height: 2px; animation-duration: 3.0s; animation-delay: 0.0s; }
.splash-particle:nth-child(2) { left: 47%; top: 32%; width: 3px; height: 3px; animation-duration: 3.1s; animation-delay: 0.2s; }
.splash-particle:nth-child(3) { left: 84%; top: 49%; width: 4px; height: 4px; animation-duration: 3.2s; animation-delay: 0.4s; }
.splash-particle:nth-child(4) { left: 21%; top: 66%; width: 2px; height: 2px; animation-duration: 3.3s; animation-delay: 0.6s; }
.splash-particle:nth-child(5) { left: 58%; top: 83%; width: 3px; height: 3px; animation-duration: 3.4s; animation-delay: 0.8s; }
.splash-particle:nth-child(6) { left: 95%; top: 10%; width: 4px; height: 4px; animation-duration: 3.5s; animation-delay: 1.0s; }
.splash-particle:nth-child(7) { left: 32%; top: 27%; width: 2px; height: 2px; animation-duration: 3.6s; animation-delay: 1.2s; }
.splash-particle:nth-child(8) { left: 69%; top: 44%; width: 3px; height: 3px; animation-duration: 3.7s; animation-delay: 1.4s; }
.splash-particle:nth-child(9) { left: 6%; top: 61%; width: 4px; height: 4px; animation-duration: 3.8s; animation-delay: 1.6s; }
.splash-particle:nth-child(10) { left: 43%; top: 78%; width: 2px; height: 2px; animation-duration: 3.9s; animation-delay: 1.8s; }
.splash-particle:nth-child(11) { left: 80%; top: 95%; width: 3px; height: 3px; animation-duration: 4.0s; animation-delay: 2.0s; }
.splash-particle:nth-child(12) { left: 17%; top: 22%; width: 4px; height: 4px; animation-duration: 4.1s; animation-delay: 2.2s; }
.splash-particle:nth-child(13) { left: 54%; top: 39%; width: 2px; height: 2px; animation-duration: 4.2s; animation-delay: 2.4s; }
.splash-particle:nth-child(14) { left: 91%; top: 56%; width: 3px; height: 3px; animation-duration: 4.3s; animation-delay: 2.6s; }
.splash-particle:nth-child(15) { left: 28%; top: 73%; width: 4px; height: 4px; animation-duration: 4.4s; animation-delay: 2.8s; }

@keyframes floatParticle {
    0%, 100% {
        opacity: 0;
        transform: translate(0, 0);
    }
    50% {
        opacity: 0.3;
        transform: translate(10px, -15px);
    }
}

/* Контейнер контента */
.splash-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Спиннер в стиле Flutter - многослойный с пульсацией */
.splash-spinner {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 50px;
    transform-style: preserve-3d;
    will-change: transform;
}

/* Внешний пульсирующий круг */
.spinner-orbit-1 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, 0.4);
    transform: translate(-50%, -50%) scale(0.8);
    -webkit-transform: translate(-50%, -50%) scale(0.8);
    animation: pulsateOuter 1.5s ease-in-out infinite;
    -webkit-animation: pulsateOuter 1.5s ease-in-out infinite;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Средний вращающийся круг */
.spinner-orbit-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, 0.6);
    transform: translate(-50%, -50%) rotate(0deg);
    -webkit-transform: translate(-50%, -50%) rotate(0deg);
    animation: rotateMiddle 3s linear infinite;
    -webkit-animation: rotateMiddle 3s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Внутренний спиннер (50px как в Flutter) */
.spinner-orbit-3 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    transform: translate(-50%, -50%) rotate(0deg);
    -webkit-transform: translate(-50%, -50%) rotate(0deg);
    animation: spinInner 1.2s linear infinite;
    -webkit-animation: spinInner 1.2s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Центральная точка */
.spinner-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #6366f1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    box-shadow: 
        0 0 10px rgba(99, 102, 241, 0.8),
        0 0 20px rgba(99, 102, 241, 0.4);
    will-change: transform;
}

@keyframes pulsateOuter {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        -webkit-transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        -webkit-transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.6;
    }
}

@-webkit-keyframes pulsateOuter {
    0%, 100% {
        -webkit-transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }
    50% {
        -webkit-transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.6;
    }
}

@keyframes rotateMiddle {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        -webkit-transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        -webkit-transform: translate(-50%, -50%) rotate(360deg);
    }
}

@-webkit-keyframes rotateMiddle {
    0% {
        -webkit-transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        -webkit-transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes spinInner {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        -webkit-transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        -webkit-transform: translate(-50%, -50%) rotate(360deg);
    }
}

@-webkit-keyframes spinInner {
    0% {
        -webkit-transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        -webkit-transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Анимированный заголовок в стиле Flutter */
.splash-title {
    font-size: 32px;
    font-weight: 300;
    color: white;
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-align: center;
    background: linear-gradient(90deg, #ffffff, #6366f1, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 1.2s ease-out forwards;
    opacity: 0;
    position: relative;
}

.splash-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
    animation: expandUnderline 1.2s ease-out 0.5s forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes expandUnderline {
    0% {
        width: 0;
    }
    100% {
        width: 120px;
    }
}

/* Пульсирующий подзаголовок в стиле Flutter */
.splash-subtitle {
    font-size: 14px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 60px;
    letter-spacing: 2px;
    text-align: center;
    animation: fadeInSubtitle 1s ease-out 0.5s forwards;
    opacity: 0;
}

@keyframes fadeInSubtitle {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 0.7;
    }
}

/* Загрузочные точки в стиле Flutter */
.splash-loading-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.splash-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6366f1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
    animation: pulseDot 1.4s ease-in-out infinite;
    -webkit-animation: pulseDot 1.4s ease-in-out infinite;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.splash-dot:nth-child(1) { 
    animation-delay: 0s; 
    -webkit-animation-delay: 0s;
}
.splash-dot:nth-child(2) { 
    animation-delay: 0.2s; 
    -webkit-animation-delay: 0.2s;
}
.splash-dot:nth-child(3) { 
    animation-delay: 0.4s; 
    -webkit-animation-delay: 0.4s;
}

@keyframes pulseDot {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
        -webkit-transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.4);
        -webkit-transform: scale(1.4);
    }
}

@-webkit-keyframes pulseDot {
    0%, 100% {
        opacity: 0.4;
        -webkit-transform: scale(1);
    }
    50% {
        opacity: 1;
        -webkit-transform: scale(1.4);
    }
}

/* Статус загрузки в стиле Flutter */
.splash-status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 1px;
    text-align: center;
    animation: fadeStatus 2s ease-in-out infinite;
}

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

/* Версионный бейдж */
.splash-version {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
    .splash-spinner {
        width: 100px;
        height: 100px;
        margin-bottom: 40px;
    }
    
    .spinner-orbit-1 { 
        width: 100px; 
        height: 100px; 
    }
    
    .spinner-orbit-2 { 
        width: 65px; 
        height: 65px; 
    }
    
    .spinner-orbit-3 { 
        width: 40px; 
        height: 40px; 
    }
    
    .spinner-core { 
        width: 6px; 
        height: 6px; 
    }
    
    .splash-title {
        font-size: 26px;
        letter-spacing: 3px;
    }
    
    .splash-subtitle {
        font-size: 12px;
        letter-spacing: 1.5px;
    }
    
    .splash-version {
        bottom: 20px;
        right: 20px;
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .splash-loading-dots {
        gap: 6px;
    }
    
    .splash-dot {
        width: 6px;
        height: 6px;
    }
}

/* Старые стили для совместимости (скрыты) */
.splash-logo { display: none; }
.splash-loading { display: none; }
.splash-progress { display: none; }

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Login Screen */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 15, 35, 0.85), rgba(26, 26, 46, 0.85), rgba(22, 33, 62, 0.85));
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    overflow-y: hidden;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: max(20px, env(safe-area-inset-top, 0px));
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
}

.login-screen.register-mode {
    overflow-y: auto;
    align-items: flex-start;
}

.login-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
    margin: auto;
}

.login-screen.register-mode .login-container {
    align-items: flex-start;
    min-height: auto;
    padding-top: max(40px, 5vh);
    padding-bottom: max(40px, 5vh);
}

@media (max-height: 800px) {
    .login-container {
        padding: 15px;
        min-height: auto;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    .login-screen.register-mode .login-container {
        padding-top: max(30px, 4vh);
        padding-bottom: max(30px, 4vh);
    }
}

@media (max-height: 700px) {
    .login-container {
        padding: 10px;
        min-height: auto;
        padding-top: 15px;
        padding-bottom: 15px;
    }
    
    .login-screen.register-mode .login-container {
        padding-top: max(20px, 3vh);
        padding-bottom: max(20px, 3vh);
    }
}

.login-card {
    background: #1A1A2E;
    border: 1px solid #2A2A4A;
    border-radius: 16px;
    padding: 24px 20px 20px 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    width: 100%;
}

@media (min-width: 481px) {
    .login-card {
        padding: 32px 24px 24px 24px;
    }
}

@media (max-height: 700px) {
    .login-card {
        padding: 20px 16px 16px 16px;
    }
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: #16213E;
    border: 1px solid #2A2A4A;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--primary);
}

@media (max-height: 700px) {
    .login-logo {
        width: 48px;
        height: 48px;
        margin: 0 auto 8px;
        font-size: 28px;
    }
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
    margin-top: 0;
    letter-spacing: 1.2px;
}

@media (max-height: 700px) {
    .login-title {
        font-size: 20px;
        margin-bottom: 6px;
    }
}

.login-subtitle {
    font-size: 14px;
    color: #8B949E;
    text-align: center;
    margin-bottom: 24px;
}

@media (max-height: 700px) {
    .login-subtitle {
        font-size: 13px;
        margin-bottom: 16px;
    }
}

.login-error {
    background: #16213E;
    border: 1px solid #F97316;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #F97316;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-height: 700px) {
    .login-form {
        gap: 10px;
    }
}

/* Дополнительные отступы для полей регистрации */
#registerFields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 4px;
}

@media (max-height: 700px) {
    #registerFields {
        gap: 10px;
        margin-top: 2px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@media (max-height: 700px) {
    .form-group {
        gap: 4px;
    }
}

/* Двухколоночный layout для формы */
.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row-2col {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-height: 700px) {
    .form-row-2col {
        gap: 10px;
    }
}

/* Label только для select (Язык и Пол) */
.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 4px;
    display: block;
}

@media (max-height: 700px) {
    .form-group label {
        font-size: 12px;
        margin-bottom: 3px;
    }
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 12px;
    color: #64748b;
    font-size: 16px;
}

@media (max-height: 700px) {
    .input-wrapper i {
        left: 10px;
        font-size: 14px;
    }
}

.input-wrapper input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    background: #16213E;
    border: 1px solid #2A2A4A;
    border-radius: 8px;
    color: #f8fafc;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

@media (max-height: 700px) {
    .input-wrapper input {
        padding: 8px 8px 8px 32px;
        font-size: 13px;
    }
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper input::placeholder {
    color: #64748b;
}

/* Select dropdown */
.input-wrapper select {
    width: 100%;
    padding: 10px 10px 10px 36px;
    background: #16213E;
    border: 1px solid #2A2A4A;
    border-radius: 8px;
    color: #f8fafc;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
}

@media (max-height: 700px) {
    .input-wrapper select {
        padding: 8px 28px 8px 32px;
        font-size: 13px;
    }
}

.input-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper select option {
    background: #1A1A2E;
    color: #f8fafc;
    padding: 8px;
}

/* Required field marker */
.required {
    color: #DC2626;
    margin-left: 4px;
}

/* Field hint */
.field-hint {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    margin-top: 4px;
    padding-left: 4px;
}

@media (max-height: 700px) {
    .field-hint {
        font-size: 11px;
        margin-top: 2px;
    }
}

/* Agreement box */
.agreement-box {
    background: #16213E;
    border: 1px solid #2A2A4A;
    border-radius: 8px;
    padding: 10px;
    margin-top: 4px;
}

@media (max-height: 700px) {
    .agreement-box {
        padding: 8px;
        margin-top: 2px;
    }
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

@media (max-height: 700px) {
    .checkbox-label {
        gap: 8px;
    }
}

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

.checkbox-label > span:not(.checkbox-custom) {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.4;
}

@media (max-height: 700px) {
    .checkbox-label > span:not(.checkbox-custom) {
        font-size: 12px;
    }
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex-shrink: 0;
    border: 2px solid #2A2A4A;
    border-radius: 4px;
    background: #0F0F23;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

@media (max-height: 700px) {
    .checkbox-custom {
        width: 18px;
        height: 18px;
        min-width: 18px;
    }
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

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

.agreement-text {
    display: inline;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.4;
}

.agreement-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.agreement-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    height: 44px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

@media (max-height: 700px) {
    .login-btn {
        height: 40px;
        font-size: 14px;
    }
}

.login-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Кнопка "Забыли пароль?" */
.login-btn-telegram {
    width: 100%;
    height: 44px;
    background: #0088cc;
    border: 1px solid #0088cc;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

@media (max-height: 700px) {
    .login-btn-telegram {
        height: 40px;
        font-size: 14px;
        margin-top: 8px;
    }
}

.login-btn-telegram:hover {
    background: #0077b3;
    border-color: #0077b3;
}

.login-btn-telegram i {
    font-size: 18px;
}

.login-btn-forgot {
    width: 100%;
    height: 40px;
    background: #21262D;
    border: 1px solid #30363D;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}

@media (max-height: 700px) {
    .login-btn-forgot {
        height: 36px;
        font-size: 13px;
        margin-top: 8px;
    }
}

.login-btn-forgot:hover {
    background: #2A2F3A;
    border-color: #3E4451;
}

/* Текстовая ссылка переключения режима */
.text-center {
    text-align: center;
    margin-top: 20px;
}

@media (max-height: 700px) {
    .text-center {
        margin-top: 12px;
    }
}

.text-link-btn {
    background: none;
    border: none;
    color: #8b5cf6;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s;
    border-radius: 8px;
}

@media (max-height: 700px) {
    .text-link-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}

.text-link-btn:hover {
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.1);
}

.login-btn-dev {
    width: 100%;
    height: 40px;
    background: rgba(168, 85, 247, 0.15);
    border: 1.5px solid rgba(168, 85, 247, 0.4);
    border-radius: 8px;
    color: #a855f7;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn-dev:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: translateY(-1px);
}

/* Password Recovery Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--modal-top-offset));
}

.modal-dialog {
    background: #0D1117;
    border: 1px solid #30363D;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #30363D;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 20px;
}

.modal-title {
    flex: 1;
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: #8B949E;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #21262D;
    color: white;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

/* Встроенный браузер (WebView) */
.browser-container {
    position: relative;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

#browserFrame {
    -webkit-overflow-scrolling: touch !important;
    overflow-y: auto !important;
    scroll-behavior: smooth;
}

.browser-nav {
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.browser-btn {
    transition: all 0.2s ease;
}

.browser-btn:hover:not(:disabled) {
    background: var(--bg) !important;
    transform: scale(1.05);
}

.browser-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.browser-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed !important;
}

.browser-btn:disabled i,
.browser-btn:disabled span {
    color: var(--text-light) !important;
}

.browser-btn i {
    transition: transform 0.2s ease;
}

.browser-btn:hover:not(:disabled) i {
    transform: scale(1.1);
}

/* Панель вкладок браузера */
#browserTabsBar {
    -webkit-overflow-scrolling: touch;
}

#browserTabsBar::-webkit-scrollbar {
    display: none;
}

.browser-tab {
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.browser-tab.active {
    z-index: 1;
}

.browser-tab:hover:not(.active) {
    background: var(--bg-hover) !important;
}

.browser-tab button {
    flex-shrink: 0;
}

.browser-tab button:hover {
    background: rgba(255, 0, 0, 0.1) !important;
    color: #ef4444 !important;
}

#browserFramesContainer {
    position: relative;
}

.modal-icon-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #21262D;
    border: 1px solid #30363D;
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.modal-text {
    color: #E6EDF3;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.modal-subtext {
    color: #8B949E;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.modal-footer {
    padding: 0 24px 24px 24px;
}

.modal-btn-support {
    width: 100%;
    height: 44px;
    background: #238636;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-support:hover {
    background: #2ea043;
}

.modal-btn-icon {
    font-size: 16px;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height для учета клавиатуры */
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
}

.hidden { display: none !important; }

/* Drawer Overlay */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease-out;
    will-change: opacity;
}

.drawer-overlay.swiping {
    transition: none !important;
}

/* Chat Drawer */
.chat-drawer {
    width: 320px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
}

.drawer-header {
    padding: 24px 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    border-radius: 0 0 16px 16px;
    position: relative;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.drawer-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.drawer-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.drawer-title::before {
    content: '✨';
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.drawer-btn-outline {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.drawer-btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Красная кнопка только в темной теме */
body.dark-theme .drawer-btn-outline {
    border: 1.5px solid rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

body.dark-theme .drawer-btn-outline:hover {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Weather Widget */
.weather-widget {
    margin: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.weather-widget:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.12));
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.weather-icon-small { font-size: 32px; }
.weather-temp-small { font-size: 18px; font-weight: 700; color: var(--text); }
.weather-desc-small { font-size: 13px; color: var(--text-light); font-weight: 500; }


/* Chats Header */
.chats-header {
    padding: 16px 16px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    position: relative;
}

.chats-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0.3;
}

/* Chats List */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-card:hover {
    border-color: var(--primary);
    background: var(--secondary);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.chat-card.active {
    background: var(--secondary);
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

.chat-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.1);
}

.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-meta {
    font-size: 12px;
    color: var(--text-light);
}

.chat-mode {
    font-size: 11px;
    color: var(--primary);
    margin-top: 4px;
    font-weight: 500;
    opacity: 0.8;
}

.chat-delete {
    color: var(--error);
    cursor: pointer;
    padding: 4px;
}

.chat-delete:hover {
    color: #dc2626;
}

/* Drawer Footer */
.drawer-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.settings-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.settings-card:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.12));
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.settings-card i:first-child {
    color: #667eea;
    font-size: 18px;
}

.settings-card span {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.settings-card i:last-child {
    color: var(--text-light);
    font-size: 14px;
}

.user-card {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.1));
    border: 1.5px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 8px;
    box-shadow: 0 2px 12px rgba(251, 191, 36, 0.15);
    transition: all 0.2s ease;
    position: relative;
}

.user-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.6), transparent);
}

.user-card:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.15));
    border-color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.25);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-avatar.dev {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.user-avatar.admin {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.user-avatar.moder {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.user-avatar.support {
    background: linear-gradient(135deg, #86efac, #4ade80);
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.user-role {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 18px; /* Увеличили размер иконки */
}

.logout-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1); /* Небольшое увеличение при наведении */
}

.app-version {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    padding: 8px;
    background: var(--card);
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    position: relative;
}

.main-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.75);
    z-index: 0;
    pointer-events: none;
}

body.dark-theme .main-wrapper::before {
    background: rgba(15, 23, 42, 0.8);
}

.main-wrapper > * {
    position: relative;
    z-index: 1;
}

/* AppBar */
.app-bar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.appbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-start;
}

.appbar-center { /* Центрирование Сервер номер и TorraNox AI */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: absolute;
    left: 45%;
    transform: translateX(-50%);
}

.appbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: flex-end;
}

/* Server Badge */
.server-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.server-badge.server-1 {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}

.server-badge.server-2 {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.server-badge.server-3 {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
}

.server-badge:hover {
    transform: scale(1.05);
}

.server-emoji {
    font-size: 14px;
}

.server-number {
    font-size: 12px;
    font-weight: bold;
}

.server-badge.server-1 .server-number {
    color: rgba(34, 197, 94, 0.9);
}

.server-badge.server-2 .server-number {
    color: rgba(59, 130, 246, 0.9);
}

.server-badge.server-3 .server-number {
    color: rgba(168, 85, 247, 0.9);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn i {
    font-size: 18px;
}

.icon-btn:hover {
    background: var(--secondary);
}

/* Светлая иконка мусорки в тёмной теме */
body.dark-theme .icon-btn .fa-trash-alt {
    color: #94a3b8;
}

body.dark-theme .icon-btn:hover .fa-trash-alt {
    color: #cbd5e1;
}

/* Компактная кнопка меню с синим свечением */
.menu-badge {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4),
                0 0 25px rgba(102, 126, 234, 0.2);
}

.menu-badge:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: #764ba2;
    color: #764ba2;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
                0 0 35px rgba(102, 126, 234, 0.3),
                0 0 45px rgba(118, 75, 162, 0.2);
    transform: translateY(-1px);
}

.menu-badge:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5),
                0 0 20px rgba(102, 126, 234, 0.3);
}

/* Индикатор свайпа меню */
.swipe-indicator {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px;
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15), transparent);
    border-radius: 0 8px 8px 0;
    opacity: 0.4;
    transition: all 0.3s ease;
    cursor: pointer;
}

.swipe-indicator:hover {
    opacity: 0.8;
    padding-left: 8px;
}

.swipe-line {
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.swipe-indicator:hover .swipe-line {
    width: 4px;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
}

body.dark-theme .swipe-indicator {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2), transparent);
}

body.dark-theme .swipe-line {
    background: linear-gradient(180deg, #818cf8, #a78bfa);
}

.appbar-title {
    display: flex;
    flex-direction: column;
}

.title-text {
    font-weight: 600;
    font-size: 16px;
}

.title-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    padding: 20px 16px;
    overflow-y: auto;
}

.welcome-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 8px;
    text-align: center;
    color: var(--text);
    letter-spacing: -0.5px;
    width: 100%;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 24px;
    text-align: center;
    width: 100%;
}

.welcome-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
}

/* Категории промптов */
.prompt-category {
    width: 100%;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.category-icon {
    color: var(--primary);
    font-size: 16px;
}

.category-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.category-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Элементы промптов */
.prompt-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    border: 0.5px solid var(--border);
    background: var(--bg);
    transition: all 0.2s ease;
    text-align: left;
}

.prompt-item.clickable {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    cursor: pointer;
}

.prompt-item.clickable:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.prompt-item.clickable:active {
    transform: translateY(0);
}

.prompt-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.prompt-item.clickable .prompt-text {
    color: var(--primary);
}

.prompt-item:not(.clickable) .prompt-text {
    color: var(--text);
}

.prompt-arrow {
    font-size: 14px;
    color: var(--primary);
    margin-left: 8px;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
}

/* Message Bubble */
.message-bubble {
    display: flex;
    gap: 8px;
    max-width: 85%;
    min-width: 0;
    overflow: hidden;
    width: fit-content;
    margin-bottom: 4px;
}

.message-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble.assistant {
    align-self: flex-start;
}

/* Скрываем аватарки */
.message-avatar {
    display: none;
}

.message-content {
    background: var(--card);
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative;
}

.message-bubble.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.message-bubble.assistant .message-content {
    background: var(--card);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Улучшенный вид для тёмной темы */
body.dark-theme .message-bubble.assistant .message-content {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-theme .message-bubble.user .message-content {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.message-role {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 8px;
}

.message-bubble.user .message-role {
    color: rgba(255,255,255,0.9);
}

.message-bubble.assistant .message-role {
    color: var(--primary);
}

.message-text {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
}

/* Обеспечиваем, что все дочерние элементы не выходят за пределы */
.message-text * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Исключения для элементов со скроллом - они могут быть шире */
.message-text table,
.message-text pre code,
.message-text .code-block-content code {
    max-width: none;
}

/* Markdown стили внутри сообщений */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.message-text h1 { font-size: 1.5em; }
.message-text h2 { font-size: 1.3em; }
.message-text h3 { font-size: 1.1em; }

.message-text p {
    margin: 8px 0;
}

.message-text code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-bubble.user .message-text code {
    background: rgba(255, 255, 255, 0.2);
}

.message-text pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 12px 0;
    position: relative;
    max-width: 100%;
    white-space: pre;
}

.message-bubble.user .message-text pre {
    background: rgba(255, 255, 255, 0.15);
}

.message-text pre code {
    background: none;
    padding: 0;
    display: block;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

/* ===================================
   БЛОКИ КОДА (КАК В TELEGRAM/FLUTTER)
   =================================== */

/* Контейнер блока кода */
.code-block-container {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #1e1e1e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 100%;
}

/* Заголовок блока кода с языком и кнопкой копирования */
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.code-language {
    font-size: 12px;
    font-weight: 500;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #858585;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.code-copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.code-copy-btn:active {
    transform: scale(0.95);
}

/* Содержимое блока кода */
.code-block-content {
    margin: 0;
    padding: 16px;
    background-color: #1e1e1e;
    overflow-x: auto;
    overflow-y: hidden;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    max-width: 100%;
}

.code-block-content code {
    background-color: transparent;
    padding: 0;
    color: #d4d4d4;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

/* Скроллбар для блока кода */
.code-block-content::-webkit-scrollbar {
    height: 8px;
}

.code-block-content::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.code-block-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Темная тема */
.dark-theme .code-block-container {
    background-color: #0d1117;
}

.dark-theme .code-block-header {
    background-color: #161b22;
    border-bottom-color: #21262d;
}

.dark-theme .code-block-content {
    background-color: #0d1117;
}

.dark-theme .code-language {
    color: #8b949e;
}

.dark-theme .code-copy-btn {
    color: #8b949e;
}

.dark-theme .code-copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #c9d1d9;
}

/* Кнопка копирования кода */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s;
}

.message-text pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-copy-btn:active {
    transform: scale(0.95);
}

.message-bubble.user .code-copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Таблицы */
.message-text .table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 12px 0;
    -webkit-overflow-scrolling: touch;
    /* Добавляем границу и тень для визуального указания скролла */
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    display: block;
}

.message-text table {
    border-collapse: collapse;
    width: auto;
    min-width: 100%;
    margin: 0;
    border: none;
    display: table;
    white-space: nowrap;
    table-layout: auto;
    max-width: none;
}

.message-text th,
.message-text td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.message-text th {
    background: var(--bg);
    font-weight: 600;
}

.message-bubble.user .message-text th {
    background: rgba(255, 255, 255, 0.1);
}

.message-text tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.message-bubble.user .message-text tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

/* Списки */
.message-text ul,
.message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 4px 0;
}

/* Цитаты */
.message-text blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 12px 0;
    opacity: 0.8;
    font-style: italic;
}

.message-bubble.user .message-text blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
}

/* Ссылки */
.message-text a {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
    overflow-wrap: break-word;
}

.message-bubble.user .message-text a {
    color: rgba(255, 255, 255, 0.9);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.message-bubble.user .message-actions {
    justify-content: flex-start;
}

.message-action-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: all 0.2s;
    border-radius: 4px;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-bubble.user .message-action-btn {
    color: rgba(255,255,255,0.9);
}

.message-action-btn:hover {
    opacity: 0.8;
    background: var(--bg);
}

.message-action-btn:active {
    transform: scale(0.95);
}

/* Спиннер для кнопки отправки */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Chat Input */
.chat-input-wrapper {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 6px 16px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(0,0,0,0.05);
}

.tools-bar {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    min-height: 28px;
}

.mode-selector {
    flex-shrink: 0;
}

.admin-mode-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: var(--radius);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    flex-shrink: 0;
}

.admin-mode-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.admin-mode-btn:active {
    transform: translateY(0);
}

.admin-mode-btn.hidden {
    display: none;
}

.mode-btn {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    transition: all 0.2s;
    line-height: 1;
}

.mode-btn span,
.mode-btn i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
}

.mode-btn #currentModeIcon {
    font-size: 14px;
}

.mode-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.tool-btn {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    transition: all 0.2s;
    line-height: 1;
}

.tool-btn span,
.tool-btn i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
}

.tool-btn i {
    font-size: 14px;
}

.tool-btn:hover {
    background: var(--primary);
    color: white;
}

.tools-spacer {
    flex: 1;
}

.icon-btn-small {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-small i {
    font-size: 16px;
}

.icon-btn-small:hover {
    background: var(--secondary);
}

/* Превью вложений */
.attachment-preview-container {
    padding: 12px 0 8px 0;
    border-bottom: 1px solid var(--border);
}

.attachment-preview-container.hidden {
    display: none;
}

.attachment-preview-item {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 120px;
}

.preview-thumbnail {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.preview-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-thumbnail .preview-icon {
    font-size: 48px;
    color: var(--primary);
}

.preview-thumbnail .preview-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--error);
    color: white;
    border: 2px solid var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.preview-delete-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.preview-delete-btn:active {
    transform: scale(0.95);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
}

.icon-btn-input {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.icon-btn-input i {
    font-size: 18px;
}

.icon-btn-input:hover {
    background: var(--secondary);
}

.icon-btn-input.primary {
    background: var(--primary);
    color: white;
}

.icon-btn-input.primary:hover {
    background: var(--primary-hover);
}

/* Анимация для кнопки микрофона при записи */
.icon-btn-input.recording {
    animation: pulse-recording 1.5s ease-in-out infinite;
    background: rgba(239, 68, 68, 0.1) !important;
}

@keyframes pulse-recording {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    max-height: 120px;
    color: var(--text);
    padding: 8px 0;
    display: flex;
    align-items: center;
    /* Разрешаем выделение и скролл */
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

.message-input::placeholder {
    color: var(--text-light);
}

.input-disclaimer {
    text-align: center;
    font-size: 10px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Mobile */
@media (max-width: 768px) {
    .chat-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
        will-change: transform;
        -webkit-transform: translateX(-100%);
        -webkit-transition: -webkit-transform 0.3s ease-out;
    }
    
    .chat-drawer.open {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }
    
    /* Класс для отключения transition во время свайпа */
    .chat-drawer.swiping {
        transition: none !important;
        -webkit-transition: none !important;
    }
    
    .message-bubble {
        max-width: 90%;
    }
    
    /* Уменьшаем размер шрифта в коде для мобильных */
    .message-text pre,
    .code-block-content {
        font-size: 12px;
    }
    
    /* Улучшаем отображение таблиц на мобильных */
    .message-text .table-wrapper {
        font-size: 13px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--modal-top-offset));
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--secondary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Confirm Modal */
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--modal-top-offset));
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.confirm-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* Media buttons */
.media-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-lg);
    color: white;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    user-select: none;
}

.media-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.media-btn:active {
    transform: translateY(0);
}

.media-btn i {
    width: 24px;
    text-align: center;
}

.media-btn span {
    font-size: 16px;
    font-weight: 600;
}

/* Bottom Sheet для медиа - простая версия */
.media-bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.media-bottom-sheet-overlay.show {
    opacity: 1;
}

.media-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 12px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.media-bottom-sheet.show {
    transform: translateY(0);
}

.media-bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 12px;
    opacity: 0.4;
}

.media-bottom-sheet-title {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    margin: 0 0 16px 0;
    letter-spacing: -0.01em;
    opacity: 0.85;
}

.media-bottom-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.media-bottom-sheet-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.media-bottom-sheet-btn:hover {
    background: var(--hover);
    transform: translateY(-2px);
}

.media-bottom-sheet-btn:active {
    transform: translateY(0);
    background: var(--border);
}

.media-bottom-sheet-btn i {
    font-size: 24px;
    color: var(--primary);
}

.media-bottom-sheet-btn span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
}

/* Адаптивность */
@media (min-width: 768px) {
    .media-bottom-sheet {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
        width: 100%;
        max-width: 600px;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
    
    .media-bottom-sheet.show {
        transform: translateX(-50%) translateY(0);
    }
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    transition: all 0.3s ease-out;
    min-width: 300px;
    max-width: 500px;
}

.toast-notification.show {
    top: 80px; /* Чуть ниже app-bar (64px + 16px отступ) */
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.toast-icon i {
    font-size: 18px;
}

.toast-message {
    flex: 1;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

/* Typing indicator (три точки) */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.4;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Message images */
.message-image {
    margin-bottom: 12px;
    max-width: 200px;
}

.message-image img {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    cursor: pointer;
}

.message-image img:hover {
    transform: scale(1.02);
}

.confirm-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.confirm-icon.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: #ef4444;
}

.confirm-icon.warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.1));
    color: #f59e0b;
}

.confirm-icon.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    color: #3b82f6;
}

.confirm-text {
    flex: 1;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
}

.confirm-buttons {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.confirm-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.confirm-btn-cancel {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.confirm-btn-cancel:hover {
    background: var(--bg);
}

.confirm-btn-confirm {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.confirm-btn-confirm:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.confirm-btn-confirm:active {
    transform: translateY(0);
}

.profile-section {
    margin-bottom: 24px;
}

.profile-header {
    text-align: center;
    padding: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin: -24px -24px 24px -24px;
    background: var(--card);
    position: relative;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    margin: 0 auto 16px;
}

.profile-avatar-large.dev {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.profile-avatar-large.admin {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.profile-avatar-large.moder {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.profile-avatar-large.support {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Fullscreen Image Viewer */
.fullscreen-image-viewer {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
}

.fullscreen-image-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.fullscreen-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    user-select: none;
    transition: transform 0.2s ease-out;
    transform-origin: center center;
    touch-action: none;
    will-change: transform;
}

.fullscreen-close-btn {
    position: absolute;
    top: 40px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.fullscreen-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.fullscreen-close-btn:active {
    transform: scale(0.95);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Image Generator Fullscreen */
.image-gen-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
}

.image-gen-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.8);
    z-index: 0;
    pointer-events: none;
}

body.dark-theme .image-gen-container::before {
    background: rgba(15, 23, 42, 0.85);
}

.image-gen-container > * {
    position: relative;
    z-index: 1;
}

.image-gen-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.image-gen-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), #8b5cf6, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.image-gen-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--bg) 0%, rgba(99, 102, 241, 0.1) 100%);
    pointer-events: none;
    z-index: -1;
}

.image-gen-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.image-gen-content-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.mode-selector::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.gen-mode-btn {
    padding: 10px 16px;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gen-mode-btn.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.gen-mode-btn:hover {
    transform: translateY(-2px);
}

/* Image Viewer */
.image-gen-viewer {
    min-height: 300px;
    max-height: 450px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-gen-placeholder {
    width: 100%;
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.placeholder-magic-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.7), rgba(139, 92, 246, 0.7));
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotate-magic 20s linear infinite;
}

.placeholder-magic-icon i {
    font-size: 40px;
    color: white;
}

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

.placeholder-title {
    color: var(--primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.placeholder-subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin: 0;
}

.image-gen-loading {
    width: 100%;
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
}

.loading-spinner {
    display: grid;
    grid-template-columns: repeat(3, 24px);
    grid-template-rows: repeat(3, 24px);
    gap: 6px;
}

.loading-spinner .grid-item {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 4px;
    animation: pulse-grid-item 1.2s ease-in-out infinite;
}

.loading-spinner .grid-item:nth-child(1) { animation-delay: 0s; }
.loading-spinner .grid-item:nth-child(2) { animation-delay: 0.1s; }
.loading-spinner .grid-item:nth-child(3) { animation-delay: 0.2s; }
.loading-spinner .grid-item:nth-child(4) { animation-delay: 0.3s; }
.loading-spinner .grid-item:nth-child(5) { animation-delay: 0.4s; }
.loading-spinner .grid-item:nth-child(6) { animation-delay: 0.5s; }
.loading-spinner .grid-item:nth-child(7) { animation-delay: 0.6s; }
.loading-spinner .grid-item:nth-child(8) { animation-delay: 0.7s; }
.loading-spinner .grid-item:nth-child(9) { animation-delay: 0.8s; }

@keyframes pulse-grid-item {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.5); opacity: 0.3; }
}

.loading-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), #8b5cf6, var(--secondary), var(--primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1.5px;
    animation: gradient-move 3s ease-in-out infinite;
}

@keyframes gradient-move {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.generated-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
}

.image-gen-error {
    width: 100%;
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--error);
}

.image-gen-error i {
    font-size: 48px;
}

.error-title {
    font-size: 18px;
    font-weight: 600;
}

.error-text {
    font-size: 14px;
    color: var(--text-light);
}

/* Image Controls */
.image-gen-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px 0;
    margin: 0 auto;
    max-width: 600px;
}

.control-btn-secondary {
    padding: 12px 20px;
    background: var(--secondary);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.control-btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.control-btn-primary {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.control-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.control-btn-icon {
    width: 48px;
    height: 48px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.control-btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Input Area */
.image-gen-input {
    background: var(--card);
    padding: 16px;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.enhance-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.enhance-checkbox:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.enhance-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
    flex-shrink: 0;
    border-radius: 4px;
}

.enhance-checkbox span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.input-group {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.input-group textarea {
    flex: 1;
    padding: 16px;
    border: 1.5px solid var(--primary);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    resize: none;
    min-height: 56px;
    max-height: 120px;
    line-height: 24px;
    /* Разрешаем выделение и скролл */
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

.input-group textarea:focus {
    outline: none;
}

.generate-btn {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.generate-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.generation-status-text {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.profile-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-role {
    color: var(--primary);
    font-weight: 500;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-light);
    font-size: 14px;
}

.info-value {
    font-weight: 500;
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.setting-info {
    flex: 1;
}

.setting-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.setting-desc {
    font-size: 13px;
    color: var(--text-light);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle-switch.active .toggle-knob {
    left: 27px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.weather-modal-body {
    padding: 24px;
}

.weather-current {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.weather-icon-large {
    font-size: 64px;
    margin-bottom: 16px;
}

.weather-temp-large {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.weather-desc-large {
    font-size: 18px;
    opacity: 0.9;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.weather-detail {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.weather-detail-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.weather-detail-value {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.weather-detail-label {
    font-size: 12px;
    color: var(--text-light);
}

/* Radio items для выбора сервера */
.radio-item {
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid transparent;
}

.radio-item:hover {
    background: var(--secondary);
}

.radio-item.active {
    border-color: var(--primary);
    background: var(--secondary);
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.radio-item.active .radio-circle {
    border-color: var(--primary);
}

.radio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.2s;
}

.radio-item.active .radio-dot {
    background: var(--primary);
}

/* Downloadable Image Modal - разрешаем контекстное меню */
.download-image-modal img {
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -webkit-touch-callout: default !important;
    pointer-events: auto !important;
    -webkit-user-drag: auto !important;
}

/* Birth Date Picker Styles */
.calendar-picker-btn {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

@media (max-height: 700px) {
    .calendar-picker-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

.calendar-picker-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.calendar-picker-btn:active {
    transform: scale(0.95);
}

.date-picker-container {
    padding: 16px 0;
}

.date-picker-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.date-picker-col {
    flex: 1;
    max-width: 120px;
}

.date-picker-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 8px;
    text-align: center;
}

.date-picker-select {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.date-picker-select:hover {
    border-color: var(--primary);
}

.date-picker-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-btn-cancel {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--secondary);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel:hover {
    background: var(--border);
}

.modal-btn-confirm {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-confirm:hover {
    background: var(--primary-hover);
}

.modal-btn-confirm:active,
.modal-btn-cancel:active {
    transform: scale(0.98);
}

/* Спиннер для анализа изображения */
.spinner-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner-icon {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ============================================================
   IMAGE HISTORY SCREEN
   ============================================================ */

.image-history-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset));
    overflow: hidden;
}

.image-history-body {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom !important;
    /* Принудительный скролл для мобильных */
    -ms-overflow-style: -ms-autohiding-scrollbar;
    scrollbar-width: thin;
}

/* Loading */
.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 24px;
}

/* Empty state */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    padding: 32px;
    text-align: center;
}

.empty-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 8px;
}

.empty-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.empty-text {
    font-size: 15px;
    color: var(--text-light);
    margin: 0;
    max-width: 320px;
}

/* Grid */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding-bottom: 20px;
    /* Разрешаем скролл через grid */
    touch-action: pan-y !important;
}

@media (max-width: 768px) {
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    /* Принудительный скролл на мобильных */
    .image-history-body {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }
}

/* Image Card */
.history-image-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* Разрешаем скролл при свайпе по карточкам */
    touch-action: pan-y !important;
}

.history-image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.history-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Квадратное соотношение сторон */
    overflow: hidden;
    cursor: pointer;
    background: var(--secondary);
}

.history-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.history-image-card:hover .history-image {
    transform: scale(1.05);
}

.history-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.history-image-wrapper:hover .history-image-overlay {
    opacity: 1;
}

.history-image-overlay i {
    font-size: 32px;
    color: white;
}

.history-image-info {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-image-date {
    flex: 1;
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-image-date i {
    font-size: 10px;
}

.history-image-action {
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.history-image-action:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.history-image-action:active {
    transform: scale(0.95);
}

/* Анимация для эмодзи при распознавании */
@keyframes bounce-emoji {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    25% {
        transform: scale(1.1) translateY(-5px);
    }
    50% {
        transform: scale(1) translateY(0);
    }
    75% {
        transform: scale(0.9) translateY(3px);
    }
}

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

@keyframes pulse-emoji {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.loading-emoji {
    display: inline-block;
    font-size: 20px;
    animation: bounce-emoji 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.loading-emoji-world {
    display: inline-block;
    font-size: 20px;
    animation: rotate-emoji 2s linear infinite;
    flex-shrink: 0;
}

.loading-message {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row;
    gap: 8px;
    padding: 12px 16px;
}

.loading-message-text {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* ==========================================
   ЭКРАН ЗВОНКА (СОВРЕМЕННЫЙ ДИЗАЙН)
   ========================================== */

.call-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
}

.call-screen.active {
    opacity: 1;
    visibility: visible;
}

/* Анимированный фон */
.call-screen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 1;
}

.call-screen-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: calc(env(safe-area-inset-top, 0px) + var(--app-top-offset)) 20px 40px;
    max-width: 500px;
}

/* Proximity Overlay (черный экран когда у уха) */
.call-proximity-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.call-proximity-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === ВЕРХНЯЯ ЧАСТЬ === */
.call-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
}

/* Аватар с анимированными кольцами */
.call-avatar-container {
    position: relative;
    margin-bottom: 24px;
}

.call-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-avatar-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.call-avatar-letter {
    font-size: 64px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
}

/* Анимированные кольца */
.call-avatar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: ring-pulse 2s ease-out infinite;
}

.call-avatar-ring.ring-1 {
    width: 160px;
    height: 160px;
    animation-delay: 0s;
}

.call-avatar-ring.ring-2 {
    width: 180px;
    height: 180px;
    animation-delay: 0.4s;
}

.call-avatar-ring.ring-3 {
    width: 200px;
    height: 200px;
    animation-delay: 0.8s;
}

@keyframes ring-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Информация о звонке */
.call-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.call-name {
    font-size: 32px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.call-status {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* === СРЕДНЯЯ ЧАСТЬ === */
.call-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: center;
}

.call-timer-large {
    font-size: 56px;
    font-weight: 300;
    color: white;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
}

.call-quality {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.call-quality i {
    color: #4ade80;
}

/* === НИЖНЯЯ ЧАСТЬ === */
.call-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    padding-bottom: 20px;
}

/* Действия (микрофон, динамик) */
.call-actions {
    display: flex;
    justify-content: center;
    gap: 40px;
    width: 100%;
}

.call-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.call-action-btn i {
    font-size: 24px;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.call-action-btn span {
    position: absolute;
    bottom: -24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.call-action-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.25);
}

.call-action-btn:active {
    transform: scale(0.95);
}

.call-action-btn.active {
    background: rgba(74, 222, 128, 0.3);
}

.call-action-btn.muted {
    background: rgba(239, 68, 68, 0.3);
}

/* Кнопка завершения */
.call-end-container {
    display: flex;
    justify-content: center;
}

.call-end-btn-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.call-end-btn-large:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.5);
}

.call-end-btn-large:active {
    transform: scale(0.95);
}

.call-end-btn-large i {
    transform: rotate(135deg);
}

/* Темная тема для звонка */
body.dark-theme .call-screen-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

body.dark-theme .call-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

body.dark-theme .call-avatar-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.dark-theme .call-avatar-ring {
    border-color: #667eea;
}

/* Светлая тема для звонка */
body:not(.dark-theme) .call-screen-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

body:not(.dark-theme) .call-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 8px 32px rgba(240, 147, 251, 0.4);
}

body:not(.dark-theme) .call-avatar-text {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body:not(.dark-theme) .call-avatar-ring {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Адаптивность для маленьких экранов */
@media (max-height: 700px) {
    .call-top {
        padding-top: 20px;
    }
    
    .call-avatar-container {
        margin-bottom: 16px;
    }
    
    .call-avatar {
        width: 100px;
        height: 100px;
    }
    
    .call-avatar-letter {
        font-size: 48px;
    }
    
    .call-avatar-ring.ring-1 {
        width: 120px;
        height: 120px;
    }
    
    .call-avatar-ring.ring-2 {
        width: 140px;
        height: 140px;
    }
    
    .call-avatar-ring.ring-3 {
        width: 160px;
        height: 160px;
    }
    
    .call-name {
        font-size: 24px;
    }
    
    .call-status {
        font-size: 14px;
    }
    
    .call-timer-large {
        font-size: 42px;
    }
    
    .call-action-btn {
        width: 56px;
        height: 56px;
    }
    
    .call-action-btn i {
        font-size: 20px;
    }
    
    .call-end-btn-large {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
    
    .call-bottom {
        gap: 24px;
    }
}

/* ============================================
   WOW Welcome Modal - Инновационное окно с эмодзи
   ============================================ */

.wow-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wow-modal.hidden {
    display: none;
}

/* Backdrop */
.wow-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: wowFadeIn 0.4s ease;
}

@keyframes wowFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Container */
.wow-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    animation: wowBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes wowBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-50px);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Success Ring with Emojis */
.wow-success-ring {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 28px;
}

.wow-ring-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    animation: wowPulseRing 2s ease-in-out infinite;
}

@keyframes wowPulseRing {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.1;
    }
}

.wow-emoji-burst {
    position: absolute;
    top: -10px;
    right: -5px;
    font-size: 32px;
    animation: wowSparkle 1.5s ease-in-out infinite;
}

@keyframes wowSparkle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(15deg) scale(1.2);
        opacity: 0.8;
    }
}

.wow-check-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: wowCheckPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.3s backwards;
}

@keyframes wowCheckPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-45deg);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Card */
.wow-card {
    background: var(--card);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

/* Header */
.wow-header {
    text-align: center;
    margin-bottom: 24px;
}

.wow-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wow-emoji-wave {
    display: inline-block;
    font-size: 28px;
    animation: wowWave 2s ease-in-out infinite;
    transform-origin: 70% 70%;
}

@keyframes wowWave {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    40%, 60% { transform: rotate(0deg); }
}

.wow-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* Features */
.wow-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.wow-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--secondary) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: wowSlideIn 0.5s ease backwards;
}

@keyframes wowSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wow-feature:hover {
    transform: translateX(5px) scale(1.02);
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(99, 102, 241, 0.15) 100%);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.wow-feature-emoji {
    font-size: 32px;
    flex-shrink: 0;
    animation: wowFloat 3s ease-in-out infinite;
}

.wow-feature:nth-child(1) .wow-feature-emoji { animation-delay: 0s; }
.wow-feature:nth-child(2) .wow-feature-emoji { animation-delay: 0.2s; }
.wow-feature:nth-child(3) .wow-feature-emoji { animation-delay: 0.4s; }
.wow-feature:nth-child(4) .wow-feature-emoji { animation-delay: 0.6s; }

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

.wow-feature-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wow-feature-text strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.wow-feature-text span {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.3;
}

/* Button */
.wow-button {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    position: relative;
    overflow: hidden;
    animation: wowButtonAppear 0.5s ease 1s backwards;
}

@keyframes wowButtonAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.wow-button:hover::before {
    left: 100%;
}

.wow-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

.wow-button:active {
    transform: translateY(-1px);
}

/* Dark theme */
body.dark-theme .wow-backdrop {
    background: rgba(0, 0, 0, 0.85);
}

body.dark-theme .wow-card {
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

body.dark-theme .wow-feature {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(99, 102, 241, 0.08) 100%);
}

body.dark-theme .wow-feature:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.2) 100%);
}

/* Responsive */
@media (max-width: 600px) {
    .wow-container {
        max-width: 380px;
    }
    
    .wow-success-ring {
        width: 90px;
        height: 90px;
    }
    
    .wow-ring-pulse {
        width: 90px;
        height: 90px;
    }
    
    .wow-check-emoji {
        font-size: 42px;
    }
    
    .wow-emoji-burst {
        font-size: 28px;
    }
    
    .wow-card {
        padding: 24px 20px;
    }
    
    .wow-title {
        font-size: 24px;
    }
    
    .wow-emoji-wave {
        font-size: 26px;
    }
    
    .wow-subtitle {
        font-size: 13px;
    }
    
    .wow-feature {
        padding: 12px 14px;
    }
    
    .wow-feature-emoji {
        font-size: 28px;
    }
    
    .wow-feature-text strong {
        font-size: 14px;
    }
    
    .wow-feature-text span {
        font-size: 12px;
    }
    
    .wow-button {
        height: 48px;
        font-size: 15px;
    }
}

/* Safe area */
@supports (padding-top: env(safe-area-inset-top)) {
    .wow-modal {
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

