* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 35px, rgba(255,255,255,.03) 35px, rgba(255,255,255,.03) 70px),
        repeating-linear-gradient(90deg, transparent, transparent 35px, rgba(255,255,255,.03) 35px, rgba(255,255,255,.03) 70px);
    pointer-events: none;
}

body.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.header {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.tagline {
    background: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 12px;
    color: #667eea;
    margin-left: 15px;
}

.nav {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}

.nav a:hover {
    opacity: 0.8;
}

.container {
    max-width: 500px;
    margin: 5px auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.breadcrumb {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-bottom: 5px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 15px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body.dark-theme .card {
    background: #2d3748;
}

h1 {
    color: #4a5568;
    font-size: 20px;
    margin-bottom: 8px;
}

body.dark-theme h1 {
    color: #e2e8f0;
}

.intro {
    color: #718096;
    line-height: 1.3;
    margin-bottom: 12px;
    font-size: 12px;
}

body.dark-theme .intro {
    color: #a0aec0;
}

.intro a {
    color: #667eea;
    text-decoration: none;
}

.section-title {
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 15px;
}

.section-title:first-of-type {
    margin-top: 0;
}

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 5px;
}

/* Мобильная адаптация - уменьшаем высоту карточки для телефонов */
@media (max-width: 768px) {
    .header {
        padding: 6px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .header > div:first-child {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .logo {
        font-size: 16px;
    }
    
    .tagline {
        display: none; /* Скрываем tagline на мобильных */
    }
    
    .nav {
        width: 100%;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .nav a {
        font-size: 11px;
        white-space: nowrap;
        padding: 4px 8px;
    }
    
    .card {
        padding: 10px 15px;
    }
    
    h1 {
        font-size: 16px;
        margin-bottom: 4px;
    }
    
    .intro {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .section-title {
        font-size: 11px;
        margin-bottom: 4px;
        margin-top: 8px;
    }
    
    .section-title:first-of-type {
        margin-top: 0;
    }
    
    .two-column-layout {
        gap: 15px;
        margin-top: 2px;
    }
    
    .button-group {
        gap: 5px;
        margin-bottom: 3px;
    }
    
    .btn {
        padding: 6px;
        font-size: 11px;
    }
    
    .column-label {
        font-size: 9px;
        margin-bottom: 1px;
        margin-top: 1px;
    }
    
    .start-button {
        padding: 8px;
        font-size: 12px;
        margin-top: 8px;
    }
    
    .stats {
        font-size: 10px;
        margin-top: 8px;
    }
    
    .stats strong {
        font-size: 13px;
    }
    
    .breadcrumb {
        margin-bottom: 2px;
        font-size: 11px;
    }
    
    .container {
        margin: 2px auto;
        padding: 0 12px;
    }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .header {
        padding: 5px 10px;
        gap: 6px;
    }
    
    .logo {
        font-size: 15px;
    }
    
    .nav {
        gap: 6px;
    }
    
    .nav a {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .card {
        padding: 8px 12px;
    }
    
    h1 {
        font-size: 15px;
        margin-bottom: 3px;
    }
    
    .intro {
        font-size: 9px;
        margin-bottom: 5px;
    }
    
    .section-title {
        font-size: 10px;
        margin-top: 6px;
        margin-bottom: 3px;
    }
    
    .btn {
        padding: 5px;
        font-size: 10px;
    }
    
    .start-button {
        padding: 7px;
        font-size: 11px;
        margin-top: 6px;
    }
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

.column-label {
    font-style: italic;
    color: #a0aec0;
    font-size: 11px;
    text-align: center;
    margin-bottom: 4px;
    margin-top: 4px;
}

.btn {
    padding: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #4a5568;
    transition: all 0.3s;
    text-align: center;
}

body.dark-theme .btn {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

.btn:hover {
    border-color: #667eea;
    background: #f7fafc;
}

body.dark-theme .btn:hover {
    background: #2d3748;
}

.btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

body.dark-theme .btn.active {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5), 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.start-button {
    width: 100%;
    padding: 10px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.start-button::before {
    content: '📞';
    font-size: 20px;
}

.start-button:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
}

.stats {
    text-align: center;
    margin-top: 12px;
    color: #718096;
    font-size: 12px;
}

body.dark-theme .stats {
    color: #a0aec0;
}

.stats strong {
    color: #4a5568;
    font-size: 16px;
}

body.dark-theme .stats strong {
    color: #e2e8f0;
}

.loading-screen {
    display: none;
    text-align: center;
}

.loading-screen.active {
    display: block;
}

.main-screen.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto 20px;
}

body.dark-theme .spinner {
    border-color: #4a5568;
    border-top-color: #667eea;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    text-align: center;
    color: #4a5568;
    font-size: 16px;
    margin-bottom: 20px;
}

body.dark-theme .loading-text {
    color: #e2e8f0;
}

.stop-button {
    width: 200px;
    margin: 0 auto;
    display: block;
    padding: 15px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

body.dark-theme .stop-button {
    background: #2d3748;
    color: #667eea;
}

.stop-button:hover {
    background: #667eea;
    color: white;
}

.action-button {
    padding: 12px 24px;
    margin: 5px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 200px;
    margin: 10px auto;
    display: block;
}

.end-button {
    background-color: #ef4444;
    color: white;
}

.end-button:hover {
    background-color: #dc2626;
}

.mute-button {
    background-color: #f59e0b;
    color: white;
}

.mute-button:hover {
    background-color: #d97706;
}

.mute-button.muted {
    background-color: #6b7280;
}

/* Экран завершения разговора */
.conversation-ended-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 40px;
}

.conversation-ended-text {
    font-size: 24px;
    font-weight: 600;
    color: #4a5563;
    margin-bottom: 16px;
}

body.dark-theme .conversation-ended-text {
    color: #e0e0e0;
}

.report-link {
    color: #4b5563;
    text-decoration: underline;
    font-size: 14px;
    margin-bottom: 32px;
    cursor: pointer;
    transition: color 0.2s;
}

body.dark-theme .report-link {
    color: #9ca3af;
}

.report-link:hover {
    color: #1e3a8a;
}

body.dark-theme .report-link:hover {
    color: #60a5fa;
}

.start-new-button,
.change-settings-button {
    width: 100%;
    max-width: 320px;
    padding: 16px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.start-new-button {
    background-color: #48bb78;
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.start-new-button:hover {
    background-color: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
}

.change-settings-button {
    background-color: #667eea;
    color: white;
}

.change-settings-button:hover {
    background-color: #5568d3;
}

.button-icon {
    font-size: 20px;
}

#remoteAudio {
    display: none;
}

/* Аватарка собеседника */
.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 20px auto;
    display: none;
}

.avatar-container.visible {
    display: block;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.avatar svg {
    width: 60px;
    height: 60px;
    color: white;
}

body.dark-theme .avatar {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Пульсация при разговоре */
.avatar-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

.avatar-container.talking .avatar-pulse {
    animation: pulse-ring 1.5s ease-out infinite;
}

.avatar-container.talking .avatar {
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.6);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(72, 187, 120, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(72, 187, 120, 0.5), 0 0 40px rgba(72, 187, 120, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(72, 187, 120, 0.8), 0 0 60px rgba(72, 187, 120, 0.5);
    }
}

/* Мобильная адаптация аватарки */
@media (max-width: 768px) {
    .avatar-container {
        width: 100px;
        height: 100px;
        margin: 15px auto;
    }
    
    .avatar {
        width: 100px;
        height: 100px;
    }
    
    .avatar svg {
        width: 50px;
        height: 50px;
    }
    
    .avatar-pulse {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .avatar-container {
        width: 80px;
        height: 80px;
        margin: 10px auto;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
    }
    
    .avatar svg {
        width: 40px;
        height: 40px;
    }
    
    .avatar-pulse {
        width: 80px;
        height: 80px;
    }
}

/* ========================================
   БЛОКИРОВКА НЕСКОЛЬКИХ ВКЛАДОК
   ======================================== */

#tabBlockOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.tab-blocked-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: tabBlockedIn 0.3s ease;
}

body.dark-theme .tab-blocked-content {
    background: #2d3748;
}

@keyframes tabBlockedIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tab-blocked-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.tab-blocked-text {
    font-size: 16px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 30px;
}

body.dark-theme .tab-blocked-text {
    color: #e2e8f0;
}

.tab-blocked-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tab-blocked-btn {
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.tab-blocked-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-blocked-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tab-blocked-btn.secondary {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.tab-blocked-btn.secondary:hover {
    background: #667eea;
    color: white;
}

body.dark-theme .tab-blocked-btn.secondary {
    color: #a0aec0;
    border-color: #4a5568;
}

body.dark-theme .tab-blocked-btn.secondary:hover {
    background: #4a5568;
    color: white;
}

@media (max-width: 480px) {
    .tab-blocked-content {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .tab-blocked-icon {
        font-size: 48px;
    }
    
    .tab-blocked-text {
        font-size: 14px;
    }
    
    .tab-blocked-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ========================================
   ЧАТ ВО ВРЕМЯ ЗВОНКА
   ======================================== */

/* Кнопка показа/скрытия чата */
.chat-toggle-button {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 12px;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-toggle-button:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

body.dark-theme .chat-toggle-button {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    color: #a0aec0;
}

body.dark-theme .chat-toggle-button:hover {
    background: rgba(102, 126, 234, 0.25);
}

.chat-icon {
    font-size: 18px;
}

/* Панель чата */
.chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    max-height: 35vh;
    height: 35vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    transition: height 0.2s ease;
}

/* На ПК поднимаем чат выше */
@media (min-width: 769px) {
    .chat-panel {
        bottom: 20px;
        border-radius: 20px;
        max-width: 100%;
    }
}

/* Узкий вариант чата */
.chat-panel.narrow {
    left: auto;
    right: 20px;
    width: 400px;
    max-width: calc(100% - 40px);
}

@media (max-width: 768px) {
    .chat-panel.narrow {
        right: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* Ручка для изменения высоты */
.chat-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; /* Предотвращает прокрутку при touch */
    -webkit-touch-callout: none; /* Отключает контекстное меню на iOS */
    -webkit-user-select: none;
    user-select: none;
}

.chat-resize-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 2px;
    transition: background 0.2s;
}

.chat-resize-handle:hover::before,
.chat-resize-handle:active::before {
    background: #667eea;
}

body.dark-theme .chat-resize-handle::before {
    background: #4a5568;
}

body.dark-theme .chat-resize-handle:hover::before,
body.dark-theme .chat-resize-handle:active::before {
    background: #667eea;
}

/* На мобильных увеличиваем область для удобства */
@media (max-width: 768px) {
    .chat-resize-handle {
        height: 16px; /* Увеличиваем для удобства touch */
    }
    
    .chat-resize-handle::before {
        width: 60px;
        height: 5px;
    }
}

body.dark-theme .chat-panel {
    background: #2d3748;
    border-top-color: #4a5568;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    color: #2d3748;
}

body.dark-theme .chat-header {
    border-bottom-color: #4a5568;
    color: #e2e8f0;
}

.chat-close-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #718096;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.chat-close-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2d3748;
}

body.dark-theme .chat-close-button {
    color: #a0aec0;
}

body.dark-theme .chat-close-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(35vh - 140px);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

body.dark-theme .chat-messages::-webkit-scrollbar-track {
    background: #4a5568;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

body.dark-theme .chat-messages::-webkit-scrollbar-thumb {
    background: #718096;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.chat-message {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlideIn 0.2s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.remote {
    background: #f7fafc;
    color: #2d3748;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

body.dark-theme .chat-message.remote {
    background: #4a5568;
    color: #e2e8f0;
}

.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: center;
}

body.dark-theme .chat-input-container {
    border-top-color: #4a5568;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: white;
    color: #2d3748;
}

body.dark-theme .chat-input {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-input::placeholder {
    color: #a0aec0;
}

body.dark-theme .chat-input::placeholder {
    color: #718096;
}

.chat-send-button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 24px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-send-button:active {
    transform: scale(0.95);
}

.chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Кнопка медиа */
.chat-media-button {
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    border-radius: 24px;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-media-button:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

body.dark-theme .chat-media-button {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    color: #a0aec0;
}

body.dark-theme .chat-media-button:hover {
    background: rgba(102, 126, 234, 0.25);
}

/* Изображения в сообщениях */
.chat-message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-message-image:hover {
    transform: scale(1.02);
}

.chat-message-text {
    margin-top: 4px;
}

.chat-message.has-image {
    padding: 8px;
}

.chat-message.has-image .chat-message-text {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.chat-message.own.has-image .chat-message-text {
    background: rgba(255, 255, 255, 0.25);
}

.chat-message.remote.has-image .chat-message-text {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .chat-message.remote.has-image .chat-message-text {
    background: rgba(255, 255, 255, 0.1);
}

/* Модальное окно для просмотра изображения */
.chat-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.chat-image-modal.active {
    display: flex;
}

.chat-image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    animation: imageModalIn 0.3s ease;
}

@keyframes imageModalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Адаптивность для чата */
@media (max-width: 768px) {
    .chat-panel {
        max-height: 45vh;
    }
    
    .chat-message {
        max-width: 85%;
    }
    
    .chat-input-container {
        padding: 12px 16px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-messages {
        padding: 12px;
        max-height: calc(45vh - 120px);
    }
    
    /* Предотвращает автоматический зум на мобильных */
    .chat-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .chat-panel {
        max-height: 50vh;
        border-radius: 16px 16px 0 0;
    }
    
    .chat-message {
        max-width: 90%;
        font-size: 13px;
        padding: 8px 12px;
    }
    
    /* Предотвращает автоматический зум на мобильных */
    .chat-input {
        font-size: 16px;
    }
}

/* ========================================
   VISUAL REFRESH (MAIN SCREENS)
   ======================================== */
:root {
    --accent: #7c3aed;
    --accent-2: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.08);
    --success: #22c55e;
    --text-main: #0f172a;
    --text-muted: #6b7280;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: rgba(255, 255, 255, 0.78);
    --border: rgba(255, 255, 255, 0.35);
    --card-shadow: 0 22px 80px rgba(15, 23, 42, 0.35);
}

body.dark-theme {
    --surface: rgba(26, 32, 44, 0.94);
    --surface-strong: rgba(15, 23, 42, 0.9);
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #e5e7eb;
    --text-muted: #cbd5e1;
    --card-shadow: 0 22px 80px rgba(0, 0, 0, 0.55);
    --accent-soft: rgba(99, 102, 241, 0.12);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(900px at 10% 10%, rgba(124, 58, 237, 0.24), transparent 45%),
        radial-gradient(800px at 85% 20%, rgba(52, 211, 153, 0.25), transparent 45%),
        linear-gradient(135deg, #0b1021 0%, #0f172a 55%, #111827 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(500px at 20% 70%, rgba(99, 102, 241, 0.12), transparent 50%),
        radial-gradient(620px at 80% 80%, rgba(124, 58, 237, 0.15), transparent 55%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
    opacity: 0.9;
    z-index: 0;
}

body.dark-theme::before {
    opacity: 0.6;
}

.header {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 18px;
    margin: 18px auto 10px;
    max-width: 1100px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(16px);
}

.logo {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.tagline {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.nav a {
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
}

.nav a:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.09);
}

.container {
    max-width: 1100px;
    margin: 10px auto 30px;
    z-index: 1;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(14px);
    position: relative;
}

.card.main-screen {
    overflow: hidden;
}

.card.main-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.05));
    pointer-events: none;
}

h1 {
    color: var(--text-main);
    letter-spacing: -0.02em;
    font-size: 22px;
}

.intro {
    background: var(--accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-muted);
}

.section-title {
    color: var(--accent-2);
    letter-spacing: 0.02em;
    font-size: 13px;
    text-transform: uppercase;
}

.two-column-layout {
    gap: 20px;
    margin-top: 12px;
}

.button-group {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.btn {
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: linear-gradient(145deg, var(--surface-strong), rgba(255, 255, 255, 0.75));
    color: var(--text-main);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.07);
}

body.dark-theme .btn {
    background: linear-gradient(145deg, #1f2937, #111827);
    border-color: rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.35);
}

.btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 16px 36px rgba(99, 102, 241, 0.35);
    border-color: transparent;
}

.start-button {
    background: linear-gradient(120deg, #22c55e, #16a34a);
    border: 0;
    box-shadow: 0 16px 40px rgba(22, 163, 74, 0.45);
    letter-spacing: 0.01em;
}

.start-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 50px rgba(22, 163, 74, 0.5);
}

.stats {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.stats strong {
    color: var(--accent);
    font-size: 18px;
}

.loading-text {
    color: var(--text-main);
}

.stop-button {
    background: var(--surface);
    border-color: var(--accent-2);
    color: var(--accent-2);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
}

.stop-button:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(124, 58, 237, 0.1));
    color: var(--text-main);
}

.conversation-ended-container {
    background: radial-gradient(120% 120% at 10% 10%, rgba(99, 102, 241, 0.06), transparent),
                radial-gradient(120% 120% at 90% 90%, rgba(34, 197, 94, 0.08), transparent),
                var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    border-radius: 18px;
}

@media (max-width: 768px) {
    body {
        padding-bottom: 96px; /* место под фиксированную кнопку */
    }
    
    .header {
        max-width: calc(100% - 24px);
    }
    
    .container {
        max-width: calc(100% - 24px);
        margin-top: 0;
    }
    
    .button-group {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .card.main-screen {
        padding: 10px 12px 16px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .intro {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .section-title {
        margin-top: 10px;
        margin-bottom: 6px;
        font-size: 12px;
    }
    
    .btn {
        padding: 9px 10px;
        font-size: 12px;
    }
    
    .start-button {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 13px;
        font-size: 15px;
        margin-top: 0;
        box-shadow: 0 16px 36px rgba(22, 163, 74, 0.5);
        border-radius: 14px;
        z-index: 20;
    }
    
    .stats {
        margin-top: 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .card.main-screen {
        padding: 10px 12px 74px;
    }
    
    .btn {
        padding: 8px 9px;
        font-size: 11px;
    }
    
    .start-button {
        bottom: 10px;
        padding: 12px;
        font-size: 14px;
    }
}