/* ============================================
   FREDI — ПОЛНЫЕ СТИЛИ
   Совместимость: Chrome, Firefox, Safari, Edge, iOS Safari, Android Chrome
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --black-obsidian: #0a0a0a;
    --black-matte: #111111;
    --carbon-fiber: #1a1a1a;
    --chrome: #e0e0e0;
    --silver-metallic: #c0c0c0;
    --silver-brushed: #b0b0b0;
    --platinum: #a0a0a0;
    --amg-red: #ff3b3b;
    --amg-orange: #ff6b3b;
    --amg-blue: #3b82ff;
    --amber: #ffb83b;
    --text-primary: #ffffff;
    --text-secondary: #a0a3b0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

/* ===== BASE ===== */
html {
    /* iOS Safari — учитываем адресную строку */
    height: -webkit-fill-available;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--black-obsidian);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    /* Запрещаем выделение — разрешим точечно */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Разрешаем выделение текста там где нужно */
.content-body,
.test-message-text,
.intervention-text,
.analysis-paragraph,
.loop-desc,
.key-desc,
input,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

@supports (height: 100dvh) {
    body, .app, .chat-panel, .screen-container, .test-chat-container {
        height: 100dvh !important;
        min-height: 100dvh !important;
    }
}

body::before {
    content: '';
    position: fixed;
    inset: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(224, 224, 224, 0.03) 0%, transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(255, 59, 59, 0.02) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
    background: repeating-linear-gradient(45deg,
        rgba(224, 224, 224, 0.008) 0px, rgba(224, 224, 224, 0.008) 2px,
        transparent 2px, transparent 8px);
    pointer-events: none;
    z-index: 0;
}

.app {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ===== ЛЕВАЯ ПАНЕЛЬ ===== */
.chats-panel {
    width: 280px;
    background: rgba(10, 10, 10, 0.85);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    border-right: 1px solid rgba(224, 224, 224, 0.15);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: left 0.3s ease;
    z-index: 20;
    position: relative;
    min-height: 0; /* Flex overflow fix */
}

@media (max-width: 768px) {
    .chats-panel {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: 260px;
        background: rgba(10, 10, 10, 0.95);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        z-index: 1000;
    }
    .chats-panel.open {
        left: 0;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5);
    }
}

.chats-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(224, 224, 224, 0.1);
    flex-shrink: 0;
}

.chats-title {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--chrome); /* фолбэк */
    color: transparent;
}

.chats-search {
    padding: 12px 16px;
    flex-shrink: 0;
}

.chats-search input {
    width: 100%;
    padding: 10px 16px;
    background: rgba(224, 224, 224, 0.05);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.2s;
}

.chats-search input:focus {
    border-color: rgba(255, 107, 59, 0.4);
}

.chats-search input::placeholder {
    color: var(--text-secondary);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
}

@supports (padding: max(0px)) {
    .chats-list {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

.menu-divider {
    height: 1px;
    background: rgba(224, 224, 224, 0.1);
    margin: 12px 16px;
    flex-shrink: 0;
}

.menu-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 20px;
    text-transform: uppercase;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    gap: 12px;
    border: 1px solid transparent;
    min-height: 44px;
    touch-action: manipulation;
}

.chat-item:hover {
    background: rgba(224, 224, 224, 0.08);
    border-color: rgba(224, 224, 224, 0.2);
}

.chat-item.active {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.1), rgba(192, 192, 192, 0.05));
    border-color: rgba(224, 224, 224, 0.3);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    flex-shrink: 0;
    line-height: 1;
}

.chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px; right: 2px;
    width: 10px; height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--black-obsidian);
}

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

.chat-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-time {
    font-size: 10px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chats-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(224, 224, 224, 0.1);
    flex-shrink: 0;
}

.user-mini-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(224, 224, 224, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.user-mini-profile:hover {
    background: rgba(224, 224, 224, 0.1);
}

.user-mini-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--black-obsidian);
    flex-shrink: 0;
    line-height: 1;
}

.user-mini-info { flex: 1; min-width: 0; }
.user-mini-name { font-weight: 600; font-size: 14px; }
.user-mini-status { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

/* ===== ПРАВАЯ ПАНЕЛЬ ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(10, 10, 10, 0.5);
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(10, 10, 10, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(224, 224, 224, 0.1);
    flex-shrink: 0;
}

@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.mobile-menu-btn {
    display: none;
    background: rgba(224, 224, 224, 0.1);
    border: none;
    font-size: 20px;
    color: var(--chrome);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    z-index: 1001;
    position: relative;
    touch-action: manipulation;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    outline: none;
    transition: background 0.2s;
}

.mobile-menu-btn:hover { background: rgba(224, 224, 224, 0.2); }
.mobile-menu-btn:focus-visible { outline: 2px solid rgba(255, 107, 59, 0.5); }

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
}

.chat-header-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.chat-header-name {
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-status {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.mode-indicator {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ff6b3b;
    flex-shrink: 0;
}

.screen-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(224, 224, 224, 0.2) transparent;
}

.screen-container::-webkit-scrollbar { width: 4px; }
.screen-container::-webkit-scrollbar-track { background: transparent; }
.screen-container::-webkit-scrollbar-thumb { background: rgba(224, 224, 224, 0.2); border-radius: 4px; }

@supports (padding: max(0px)) {
    .screen-container {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ===== ДАШБОРД ===== */
.dashboard-container { max-width: 800px; margin: 0 auto; }

.hero-section {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.05), rgba(192, 192, 192, 0.02));
    border-radius: 28px;
    padding: 28px 24px 22px;
    margin-bottom: 20px;
    border: 1px solid rgba(224, 224, 224, 0.15);
    text-align: center;
}

/* Центрированный hero */
.hero-greeting { margin-bottom: 18px; }

.hero-mode-emoji {
    font-size: 36px;
    line-height: 1.2;
    margin-bottom: 10px;
    display: block;
}

.hero-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.hero-name {
    background: linear-gradient(135deg, #a8c4e0, #c8dff0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Профиль-бейдж */
.profile-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(224, 224, 224, 0.06);
    border-radius: 30px;
    padding: 8px 20px;
    border: 1px solid rgba(224, 224, 224, 0.18);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.profile-badge:hover {
    background: rgba(224, 224, 224, 0.12);
    border-color: rgba(224, 224, 224, 0.3);
}

/* CTA-состояние — нет профиля */
.profile-badge--cta {
    background: rgba(168, 196, 224, 0.1);
    border-color: rgba(168, 196, 224, 0.35);
    animation: pulse-badge 2.5s ease-in-out infinite;
}
.profile-badge--cta:hover {
    background: rgba(168, 196, 224, 0.18);
    border-color: rgba(168, 196, 224, 0.5);
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 196, 224, 0); }
    50% { box-shadow: 0 0 0 6px rgba(168, 196, 224, 0.12); }
}

.profile-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 2px;
}

.profile-status {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

/* Legacy */
.user-greeting { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.greeting-text h2 { font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.greeting-text p { color: var(--text-secondary); font-size: 13px; }

/* ===== РЕЖИМЫ ===== */
.mode-selector {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: rgba(10, 10, 10, 0.5);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 50px;
    padding: 4px;
    border: 1px solid rgba(224, 224, 224, 0.2);
}

.mode-btn {
    flex: 1;
    padding: 10px 8px;
    border-radius: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    touch-action: manipulation;
    font-family: inherit;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
}

.mode-btn:focus-visible { outline: 2px solid rgba(255, 107, 59, 0.5); }

.mode-btn.active {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.2), rgba(192, 192, 192, 0.1));
    color: var(--text-primary);
}

/* ===== ГОЛОСОВАЯ КНОПКА ===== */
.voice-section { margin-bottom: 24px; }

@supports (padding: max(0px)) {
    .voice-section {
        margin-bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
    }
}

.voice-card {
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.7), rgba(26, 26, 26, 0.6));
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 60px;
    padding: 6px;
    border: 1px solid rgba(224, 224, 224, 0.2);
}

.voice-record-btn-premium {
    width: 100%;
    padding: 20px 24px;
    border-radius: 54px;
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.1), rgba(192, 192, 192, 0.05));
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.15s;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 64px;
    outline: none;
    -webkit-touch-callout: none;
}

.voice-record-btn-premium:active { transform: scale(0.98); }

.voice-record-btn-premium.recording {
    background: linear-gradient(135deg, rgba(255, 59, 59, 0.25), rgba(239, 68, 68, 0.15));
    animation: pulseRed 1s infinite;
}

@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.3); }
    50% { box-shadow: 0 0 0 15px rgba(255, 59, 59, 0); }
}

/* ===== МОДУЛИ 2×2 ===== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.module-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    border: 1px solid transparent;
    min-height: 88px;
    touch-action: manipulation;
    outline: none;
}

.module-card:hover { background: rgba(224,224,224,0.1); border-color: rgba(224,224,224,0.25); transform: translateY(-2px); }
.module-card:active { transform: scale(0.98); }

.module-icon { font-size: 28px; margin-bottom: 8px; display: block; line-height: 1.2; }
.module-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.module-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

/* ===== БЫСТРЫЕ ДЕЙСТВИЯ ===== */
.quick-actions { margin-bottom: 24px; }
.quick-actions-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.quick-action {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 12px;
    padding: 12px 6px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    min-height: 80px;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    outline: none;
}

.quick-action:hover {
    background: rgba(224, 224, 224, 0.1);
    transform: translateY(-2px);
    border-color: rgba(224, 224, 224, 0.22);
}

.quick-action:active { transform: scale(0.96); }

.action-icon { font-size: 22px; line-height: 1.2; display: block; }
.action-name { font-size: 10px; color: var(--text-secondary); line-height: 1.3; word-break: break-word; }

/* ===== КОНТЕНТНЫЕ СТРАНИЦЫ ===== */
.full-content-page {
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(26, 26, 26, 0.85));
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 24px;
    padding-bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
    border: 1px solid rgba(224, 224, 224, 0.2);
    animation: contentAppear 0.3s ease-out;
}

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

@media (prefers-reduced-motion: reduce) {
    .full-content-page { animation: none; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(224, 224, 224, 0.1);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 40px;
    padding: 10px 20px;
    color: var(--chrome);
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 20px;
    transition: background 0.2s, transform 0.15s;
    font-size: 14px;
    min-height: 44px;
    touch-action: manipulation;
    font-family: inherit;
    outline: none;
}

.back-btn:hover { background: rgba(224, 224, 224, 0.2); }
.back-btn:active { transform: scale(0.98); }
.back-btn:focus-visible { outline: 2px solid rgba(255, 107, 59, 0.5); }

/* ===== КНОПКА "ВЕРНУТЬСЯ В МЕЙСТЕРСКУЮ" ===== */
.back-to-site-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(224, 224, 224, 0.07);
    border: 1px solid rgba(224, 224, 224, 0.18);
    border-radius: 30px;
    padding: 7px 14px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
    min-height: 36px;
    font-family: inherit;
}
.back-to-site-btn:hover {
    background: rgba(224, 224, 224, 0.14);
    border-color: rgba(224, 224, 224, 0.3);
    color: var(--chrome);
}
@media (max-width: 480px) {
    .back-to-site-label { display: none; }
    .back-to-site-btn { padding: 7px 10px; }
}

.content-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(224, 224, 224, 0.2);
}

.content-emoji { font-size: 48px; margin-bottom: 12px; display: block; line-height: 1.2; }

/* Поддержка и h1 и .content-title */
.content-header h1,
.content-title {
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    -webkit-background-clip: text;
    background-clip: text;
    color: var(--chrome);
    color: transparent;
    word-break: break-word;
}

.content-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    overflow-y: auto;
    padding-right: 8px;
    padding-bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 16px));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(224, 224, 224, 0.3) transparent;
    /* Ограничение только на десктопе */
    max-height: 60vh;
}

.content-body::-webkit-scrollbar { width: 4px; }
.content-body::-webkit-scrollbar-track { background: transparent; }
.content-body::-webkit-scrollbar-thumb { background: rgba(224, 224, 224, 0.3); border-radius: 4px; }

.content-body p { margin-bottom: 12px; }
.content-body ul, .content-body .styled-list { margin: 8px 0 12px 16px; }
.content-body li { margin-bottom: 6px; }
.content-body strong { color: var(--text-primary); }

/* ===== ПРОФИЛЬ / МЫСЛИ ===== */
.thoughts-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--chrome);
    margin-top: 20px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(224, 224, 224, 0.1);
}
.thoughts-section-title:first-child { margin-top: 0; }

/* ===== МЕТА-БЛОК ПРОФИЛЯ ===== */
.profile-meta-block {
    background: linear-gradient(135deg, rgba(224,224,224,0.06), rgba(192,192,192,0.02));
    border: 1px solid rgba(224,224,224,0.15);
    border-radius: 18px;
    padding: 4px 16px;
    margin-bottom: 22px;
}
.profile-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(224,224,224,0.08);
}
.profile-meta-row:last-of-type { border-bottom: none; }
.profile-meta-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 80px;
}
.profile-meta-value {
    font-size: 13px;
    color: var(--chrome);
    font-weight: 500;
    text-align: right;
    line-height: 1.4;
}
.profile-vectors-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid rgba(224,224,224,0.08);
    margin-top: 4px;
    justify-content: center;
}
.profile-vector {
    background: rgba(224,224,224,0.07);
    border: 1px solid rgba(224,224,224,0.14);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Секции профиля */
.profile-section-title {
    margin-top: 20px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(224,224,224,0.1);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--chrome);
}
.profile-section-title:first-of-type { margin-top: 0; }

.content-body p {
    margin-bottom: 10px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.content-body .styled-list {
    margin: 4px 0 12px 0;
    padding: 0;
    list-style: none;
}

.content-body .styled-list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 14px;
}

.content-body .styled-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--silver-brushed);
}

.content-body .styled-list li strong {
    color: var(--chrome);
    font-weight: 600;
}


/* ===== ПРОФИЛЬ — КАРТОЧКИ СЕКЦИЙ ===== */
.profile-card {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 3px solid var(--chrome);
    transition: background 0.2s;
}
.profile-card:hover {
    background: rgba(255,255,255,0.05);
}
.profile-card-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-card-body {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}
.profile-card-body p {
    margin: 0 0 8px 0;
}
.profile-card-body p:last-child {
    margin-bottom: 0;
}
.profile-list {
    margin: 4px 0 0 0;
    padding: 0;
    list-style: none;
}
.profile-list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 6px;
    line-height: 1.6;
    font-size: 14px;
}
.profile-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: currentColor;
    opacity: 0.6;
}
.profile-intro {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
}
.profile-forming {
    color: var(--text-secondary);
    font-size: 14px;
    opacity: 0.7;
    text-align: center;
    padding: 20px;
}

/* ===== ЗАГРУЗКА ===== */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    font-size: 48px;
    animation: spin 1s linear infinite;
    display: block;
    line-height: 1;
}

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

/* ===== TOAST ===== */
.floating-message {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: none;
    bottom: 20px;
    pointer-events: auto;
    max-width: calc(100vw - 32px);
}

@supports (padding: max(0px)) {
    .floating-message {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    }
}

.floating-message-content {
    background: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(224, 224, 224, 0.2);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.floating-message-text {
    font-size: 13px;
    white-space: normal;
    max-width: 250px;
}

.floating-message-close {
    cursor: pointer;
    opacity: 0.7;
    font-size: 16px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.floating-message-close:hover { opacity: 1; }

/* ===== ЧАТ ТЕСТА ===== */
.test-chat-container {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
}

.test-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(224, 224, 224, 0.15) transparent;
}

.test-chat-messages::-webkit-scrollbar { width: 3px; }
.test-chat-messages::-webkit-scrollbar-track { background: transparent; }
.test-chat-messages::-webkit-scrollbar-thumb { background: rgba(224, 224, 224, 0.2); border-radius: 3px; }

@supports (padding: max(0px)) {
    .test-chat-messages {
        padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 60px));
    }
}

/* Строка сообщения — с аватаром для бота */
.test-message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    animation: messageAppear 0.25s ease-out;
    flex-shrink: 0;
}

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

.test-message-bot { justify-content: flex-start; }
.test-message-user { justify-content: flex-end; }

/* Аватар бота — маленький, как на дашборде */
.test-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chrome), var(--silver-brushed));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
    border: 1px solid rgba(224, 224, 224, 0.2);
    /* Чуть приподнимаем над нижним краем пузыря */
    margin-bottom: 4px;
}

/* Пользовательский аватар — справа, но не отображаем */
.test-message-user .test-message-avatar { display: none; }

.test-message-bubble {
    max-width: 95%;
    padding: 14px 18px;
    border-radius: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Пузырь бота — стекло в стиле дашборда */
.test-message-bubble-bot {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.07), rgba(192, 192, 192, 0.03));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(224, 224, 224, 0.15);
    border-bottom-left-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Пузырь пользователя — хромово-серебристый, не оранжевый */
.test-message-bubble-user {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.18), rgba(192, 192, 192, 0.1));
    border: 1px solid rgba(224, 224, 224, 0.3);
    border-bottom-right-radius: 6px;
}

.test-message-text {
    font-size: 15px;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text-primary);
}

/* Акцент в боте — хромовый, не оранжевый и не красный */
.test-message-bubble-bot .test-message-text strong,
.test-message-bubble-bot .test-message-text b { color: var(--chrome); }

/* В пузыре пользователя — тоже хромовый */
.test-message-bubble-user .test-message-text strong,
.test-message-bubble-user .test-message-text b { color: var(--chrome); }

.test-message-time {
    font-size: 10px;
    opacity: 0.4;
    margin-top: 8px;
    text-align: right;
    letter-spacing: 0.3px;
}

/* Кнопки ответов — стиль module-card, не оранжевые пилюли */
.test-message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.test-message-button {
    background: rgba(224, 224, 224, 0.07);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--chrome);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
    font-family: inherit;
    min-height: 44px;
    touch-action: manipulation;
    outline: none;
    line-height: 1.4;
    text-align: left;
}

.test-message-button:hover {
    background: rgba(224, 224, 224, 0.14);
    border-color: rgba(224, 224, 224, 0.35);
    color: var(--text-primary);
}

.test-message-button:active { transform: scale(0.97); }
.test-message-button:disabled { opacity: 0.35; cursor: default; transform: none; }
.test-message-button:focus-visible { outline: 2px solid rgba(224, 224, 224, 0.4); }

/* Форма контекста внутри чата */
.test-context-form {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.05), rgba(192, 192, 192, 0.02));
    border: 1px solid rgba(224, 224, 224, 0.15);
    border-radius: 20px;
    padding: 20px;
    margin-top: 4px;
}

.test-context-form label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.test-context-form input[type="text"],
.test-context-form input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(224, 224, 224, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.test-context-form input:focus {
    border-color: rgba(224, 224, 224, 0.4);
}

.test-context-form input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.test-context-radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.test-context-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid rgba(224, 224, 224, 0.15);
    background: rgba(224, 224, 224, 0.05);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    min-height: 44px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    margin-bottom: 0;
}

.test-context-radio-label:hover {
    background: rgba(224, 224, 224, 0.1);
    border-color: rgba(224, 224, 224, 0.3);
    color: var(--text-primary);
}

.test-context-radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--chrome);
    cursor: pointer;
    flex-shrink: 0;
}

.test-context-submit {
    width: 100%;
    padding: 15px;
    border-radius: 40px;
    border: none;
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.2), rgba(192, 192, 192, 0.1));
    border: 1px solid rgba(224, 224, 224, 0.3);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
    touch-action: manipulation;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.3px;
}

.test-context-submit:hover {
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.28), rgba(192, 192, 192, 0.16));
}

.test-context-submit:active { transform: scale(0.98); }


/* ===== БЕЙДЖ СООБЩЕНИЙ В МЕНЮ ===== */
.msg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--amg-red);
    color: #fff;
    border-radius: 30px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* ===== АНАЛИЗ ===== */
.analysis-content {
    background: rgba(224, 224, 224, 0.03);
    border-radius: 24px;
    padding: 28px;
}

.analysis-header {
    margin: 28px 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--amg-orange);
    border-left: 3px solid var(--amg-orange);
    padding-left: 12px;
}

.analysis-header:first-child { margin-top: 0; }

.analysis-paragraph {
    margin: 12px 0;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 14px;
}

.analysis-list { margin: 10px 0; list-style: none; padding: 0; }

.analysis-list-item {
    margin: 6px 0 6px 20px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 14px;
    position: relative;
}

.analysis-list-item::before {
    content: '•';
    color: var(--amg-orange);
    font-weight: bold;
    position: absolute;
    left: -14px;
}

.analysis-block {
    margin: 12px 0;
    padding: 8px 12px;
    background: rgba(255, 107, 59, 0.05);
    border-radius: 8px;
    border-left: 2px solid rgba(255, 107, 59, 0.3);
}

.block-label { color: #ff8c4a; font-weight: 600; margin-right: 6px; }

.analysis-content strong,
.analysis-content b { color: var(--amg-orange); font-weight: 600; }

.analysis-tab {
    background: transparent;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
    outline: none;
    min-height: 44px;
    touch-action: manipulation;
}

.analysis-tab.active {
    background: linear-gradient(135deg, var(--amg-orange), var(--amg-red));
    color: white;
}

.analysis-tab:hover:not(.active) {
    background: rgba(255, 107, 59, 0.2);
    color: var(--text-primary);
}

.analysis-section { margin-bottom: 28px; }
.analysis-section h3 { color: var(--amg-orange); margin-bottom: 14px; font-size: 16px; }

.analysis-quote {
    background: rgba(255, 107, 59, 0.08);
    border-radius: 20px;
    padding: 20px;
    font-style: italic;
    margin: 20px 0;
    border-left: 3px solid var(--amg-orange);
    line-height: 1.7;
}

@keyframes analysisPulse {
    0% { opacity: 0.6; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.analysis-loading { animation: analysisPulse 1s ease-in-out infinite alternate; }

/* ===== МЫСЛИ ПСИХОЛОГА ===== */
.psychologist-thought {
    background: linear-gradient(135deg, rgba(255, 107, 59, 0.05), rgba(255, 59, 59, 0.02));
    border-radius: 24px;
    padding: 28px;
}

.psychologist-thought-icon { font-size: 32px; margin-bottom: 16px; display: block; line-height: 1.2; }
.psychologist-thought-title { font-size: 12px; color: var(--text-secondary); letter-spacing: 1px; margin-bottom: 8px; }

.psychologist-thought-text {
    font-size: 16px;
    line-height: 1.7;
    font-style: italic;
    color: var(--text-secondary);
}

/* ===== КОНФАЙНМЕНТ ===== */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.confinement-element {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 16px;
    padding: 12px;
    border: 1px solid rgba(224, 224, 224, 0.1);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    min-height: 44px;
    touch-action: manipulation;
    outline: none;
}

.confinement-element:hover {
    transform: translateY(-3px);
    border-color: var(--chrome);
    box-shadow: 0 5px 20px rgba(224, 224, 224, 0.1);
}

.element-number { font-size: 18px; font-weight: bold; color: var(--chrome); margin-bottom: 6px; }
.element-name { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.element-desc { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4; }
.element-meta { display: flex; gap: 8px; font-size: 10px; color: var(--text-secondary); flex-wrap: wrap; }
.element-strength, .element-vak { font-size: 10px; color: var(--text-secondary); }

.key-confinement {
    background: linear-gradient(135deg, rgba(255, 107, 59, 0.15), rgba(255, 59, 59, 0.1));
    border: 1px solid var(--amg-orange);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.key-icon { font-size: 36px; margin-bottom: 8px; display: block; line-height: 1.2; }
.key-title { font-size: 16px; font-weight: bold; margin-bottom: 8px; color: var(--amg-orange); }
.key-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ===== ПЕТЛИ ===== */
.loop-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.loop-type { font-weight: bold; color: var(--chrome); font-size: 12px; margin-bottom: 6px; }
.loop-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.5; }
.loop-strength { font-size: 11px; color: var(--text-secondary); }

/* ===== ИНТЕРВЕНЦИЯ ===== */
.intervention-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 20px;
    padding: 16px;
    margin: 16px 0;
}

.intervention-text { font-size: 14px; line-height: 1.7; margin-bottom: 12px; color: var(--text-secondary); }

.daily-practice {
    background: rgba(224, 224, 224, 0.03);
    border-radius: 16px;
    padding: 12px;
    margin: 12px 0;
    border-left: 3px solid rgba(224, 224, 224, 0.3);
}

/* ===== ПРАКТИКИ ===== */
.practice-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 20px;
    padding: 16px;
    margin: 12px 0;
}

.practice-card h3 { font-size: 14px; font-weight: 600; color: var(--amg-orange); margin-bottom: 10px; }

.quote-card {
    background: rgba(224, 224, 224, 0.03);
    border-radius: 16px;
    padding: 16px;
    font-style: italic;
    text-align: center;
    margin: 12px 0;
    line-height: 1.7;
}

.quote-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--amg-orange);
    margin-bottom: 10px;
    font-style: normal;
}

/* ===== СКАЗКИ ===== */
.tale-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 16px;
    padding: 12px;
    margin: 8px 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    min-height: 44px;
    touch-action: manipulation;
    outline: none;
}

.tale-card:hover { background: rgba(224, 224, 224, 0.1); transform: translateX(5px); }
.tale-card:active { transform: scale(0.98); }

/* ===== ЯКОРЯ ===== */
.anchor-card {
    background: rgba(224, 224, 224, 0.05);
    border-radius: 16px;
    padding: 12px;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 44px;
}

.anchor-phrase { font-size: 13px; font-weight: 500; font-style: italic; color: var(--text-secondary); flex: 1; min-width: 0; }

.fire-anchor {
    background: rgba(255, 107, 59, 0.15);
    border: 1px solid rgba(255, 107, 59, 0.3);
    border-radius: 20px;
    padding: 8px 14px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
    touch-action: manipulation;
    transition: background 0.2s;
    outline: none;
}

.fire-anchor:hover { background: rgba(255, 107, 59, 0.3); }

.anchor-preset {
    background: rgba(224, 224, 224, 0.08);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 30px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
    min-height: 44px;
    touch-action: manipulation;
    outline: none;
}

.anchor-preset:hover { background: rgba(255, 107, 59, 0.2); border-color: rgba(255, 107, 59, 0.4); }

/* ===== СТАТИСТИКА ===== */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }

.stat-card { background: rgba(224, 224, 224, 0.05); border-radius: 16px; padding: 16px; text-align: center; }
.stat-value { font-size: 28px; font-weight: bold; color: var(--chrome); line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ===== ГИПНОЗ ===== */
.hypno-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(224, 224, 224, 0.05);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 20px;
    color: var(--text-primary);
    margin-bottom: 12px;
    resize: vertical;
    min-height: 80px;
    font-size: 16px; /* Предотвращает zoom на iOS */
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s;
    -webkit-user-select: text;
    user-select: text;
}

.hypno-input:focus { border-color: rgba(255, 107, 59, 0.5); }
.hypno-input::placeholder { color: var(--text-secondary); }

.hypno-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.topic-btn {
    padding: 8px 16px;
    background: rgba(224, 224, 224, 0.1);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 30px;
    color: var(--chrome);
    cursor: pointer;
    font-size: 13px;
    min-height: 44px;
    touch-action: manipulation;
    font-family: inherit;
    outline: none;
    transition: background 0.2s, border-color 0.2s;
}

.topic-btn:hover { background: rgba(255, 107, 59, 0.2); border-color: rgba(255, 107, 59, 0.4); }
.topic-btn:active { transform: scale(0.96); }

/* ===== ОБЩИЕ КНОПКИ ===== */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(224, 224, 224, 0.1);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 40px;
    color: var(--chrome);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, transform 0.15s;
    margin: 6px 6px 6px 0;
    min-height: 44px;
    touch-action: manipulation;
    font-family: inherit;
    outline: none;
    line-height: 1.3;
}

.action-btn:hover { background: rgba(224, 224, 224, 0.2); }
.action-btn:active { transform: scale(0.98); }
.action-btn:focus-visible { outline: 2px solid rgba(255, 107, 59, 0.5); }

.primary-btn {
    background: linear-gradient(135deg, var(--amg-orange), var(--amg-red));
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.primary-btn:hover { background: linear-gradient(135deg, #ff7d4d, #ff4d4d); }

.speak-btn,
.speak-tale-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(224, 224, 224, 0.08);
    border: 1px solid rgba(224, 224, 224, 0.2);
    border-radius: 30px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    margin-top: 10px;
    transition: background 0.2s;
    min-height: 44px;
    touch-action: manipulation;
    outline: none;
}

.speak-btn:hover, .speak-tale-btn:hover { background: rgba(224, 224, 224, 0.15); }

/* ===== ГОЛОСОВЫЕ СООБЩЕНИЯ ===== */
.chat-messages { display: flex; flex-direction: column; gap: 12px; padding: 16px; }

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background: rgba(224, 224, 224, 0.08);
    border: 1px solid rgba(224, 224, 224, 0.15);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #ff6b3b, #ff3b3b);
    border-bottom-right-radius: 4px;
}

.message.system {
    align-self: center;
    background: rgba(255, 107, 59, 0.1);
    border: 1px solid rgba(255, 107, 59, 0.2);
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 30px;
    padding: 6px 14px;
    max-width: 90%;
    text-align: center;
}

/* ===== СЕКЦИИ ===== */
.section-header { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.section-emoji { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.section-title { color: var(--amg-orange); font-size: 15px; font-weight: 600; }

/* ===== СВАЙП-ИНДИКАТОР ===== */
.swipe-indicator { display: none; }

/* ===== МЕДИАЗАПРОСЫ ===== */

/* Мобильные */
@media (max-width: 768px) {
    .mode-btn { font-size: 11px; padding: 8px 4px; gap: 3px; }

    .quick-actions-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .action-icon { font-size: 20px; }
    .action-name { font-size: 9px; }
    .modules-grid { gap: 8px; }
    .hero-section { padding: 16px; }
    .greeting-text h2 { font-size: 18px; }
    .full-content-page {
        padding: 16px;
        padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 24px));
        border-radius: 20px;
    }
    .test-message-bubble { max-width: 97%; }
    .test-message-button { padding: 8px 12px; font-size: 13px; }
    .test-message-text { font-size: 14px; }

    .analysis-content { padding: 16px; border-radius: 20px; }
    .analysis-header { font-size: 15px; margin: 16px 0 10px; }
    .analysis-tab { padding: 6px 12px; font-size: 12px; }
    .psychologist-thought { padding: 16px; }
    .psychologist-thought-text { font-size: 14px; }
    .elements-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stats-grid { grid-template-columns: 1fr; }

    .content-body {
        max-height: none; /* Без ограничения на мобилке */
        padding-right: 0;
    }

    .voice-section {
        position: sticky;
        bottom: 0;
        background: linear-gradient(to top, var(--black-obsidian) 70%, transparent);
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        margin: 0 -16px -16px;
        z-index: 10;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }

    .voice-card { margin-bottom: 6px; }
    .voice-record-btn-premium { padding: 18px 20px; font-size: 16px; }
    .dashboard-container { padding-bottom: max(120px, calc(env(safe-area-inset-bottom, 0px) + 100px)); }

    .screen-container {
        padding: 16px;
        padding-bottom: max(40px, calc(env(safe-area-inset-bottom, 0px) + 32px));
    }

    .swipe-indicator {
        display: block;
        text-align: center;
        padding: 8px;
        font-size: 12px;
        color: var(--text-secondary);
        animation: bounce 1.5s infinite;
    }

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

    .voice-record-btn-premium.recording {
        animation: mobilePulse 0.6s infinite;
    }

    @keyframes mobilePulse {
        0%   { transform: scale(1);    box-shadow: 0 0 0 0    rgba(255, 59, 59, 0.6); }
        50%  { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(255, 59, 59, 0); }
        100% { transform: scale(1);    box-shadow: 0 0 0 0    rgba(255, 59, 59, 0); }
    }
}

/* Маленькие телефоны */
@media (max-width: 375px) {
    .voice-record-btn-premium { padding: 16px; font-size: 14px; }
    .quick-actions-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .quick-action { padding: 8px 4px; min-height: 70px; }
    .action-icon { font-size: 18px; }
    .action-name { font-size: 8px; }
    .mode-btn { font-size: 10px; }
    .test-message-bubble { max-width: 98%; }
}

/* Очень маленькие телефоны (320px) */
@media (max-width: 340px) {
    .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
    .mode-selector { gap: 4px; }
    .mode-btn { font-size: 9px; padding: 8px 6px; }
    .voice-record-btn-premium { padding: 14px 12px; font-size: 13px; min-height: 56px; }
    .action-name { font-size: 7px; }
    .dashboard-container { padding: 12px; }
}

/* До 480px */
@media (max-width: 480px) {
    .elements-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Планшеты */
@media (max-width: 1024px) and (min-width: 769px) {
    .test-chat-container { max-width: 90%; width: 90%; margin: 0 auto; }
    .dashboard-container { max-width: 90%; }
}

/* 4K */
@media (min-width: 1920px) {
    .dashboard-container { max-width: 1000px; }
    .full-content-page { max-width: 1000px; }
    .analysis-content { max-width: 900px; margin: 0 auto; }
    .test-chat-container { max-width: 70%; width: 70%; margin: 0 auto; }
}

/* Ландшафтная ориентация на мобильных */
@media (max-height: 500px) and (orientation: landscape) {
    .voice-section { position: relative; padding: 8px 16px; }
    .voice-record-btn-premium { min-height: 48px; padding: 12px 16px; }
    .dashboard-container { padding-bottom: 24px; }
    .mode-selector { margin-bottom: 8px; }
    .mode-btn { min-height: 36px; padding: 6px 12px; font-size: 11px; }
    .modules-grid { gap: 8px; }
    .module-card { padding: 12px 10px; }
    .quick-action { min-height: 60px; padding: 8px 4px; }
    .chat-header { padding: 8px 16px; }
    .screen-container { padding-top: 8px; }
}

/* ===== БРАУЗЕРНЫЕ ФИКСЫ ===== */

/* Firefox — убираем красную тень невалидных полей */
input:invalid, textarea:invalid { box-shadow: none; }

/* iOS — zoom на input */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px !important;
    }
}

/* Flex overflow fix для Edge/Firefox */
.app, .chat-panel, .chats-panel, .test-chat-container {
    min-height: 0;
}

/* Предотвращение горизонтального скролла */
html, body { overflow-x: hidden; }

/* Глобальный box-sizing для input'ов */
input, textarea, select, button { box-sizing: border-box; }
