/* ============================================
   AI-Репетитор — Style.css
   Современный dark-mode дизайн с glassmorphism
   ============================================ */

/* CSS-переменные */
:root {
    /* Цвета */
    --bg-primary: #0a0e1a;
    --bg-secondary: #0d1321;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    /* Неоновые акценты */
    --accent-cyan: #00f0ff;
    --accent-cyan-soft: rgba(0, 240, 255, 0.15);
    --accent-cyan-glow: rgba(0, 240, 255, 0.4);
    --accent-teal: #00d4aa;
    --accent-teal-soft: rgba(0, 212, 170, 0.15);
    --accent-teal-glow: rgba(0, 212, 170, 0.4);
    --accent-blue: #4facfe;
    --accent-purple: #a855f7;

    /* Текст */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --text-dark: #0a0e1a;

    /* Размеры */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Тени */
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow-cyan: 0 0 40px rgba(0, 240, 255, 0.15);
    --shadow-glow-teal: 0 0 40px rgba(0, 212, 170, 0.15);

    /* Переходы */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Шрифт */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Сброс и базовые стили */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Фоновые элементы
   ============================================ */

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-cyan-soft), transparent 70%);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-teal-soft), transparent 70%);
    top: 30%;
    right: -15%;
    animation-delay: -5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1), transparent 70%);
    bottom: 10%;
    left: -5%;
    animation-delay: -10s;
}

.orb-4 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.1), transparent 70%);
    bottom: -5%;
    right: 10%;
    animation-delay: -15s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ============================================
   Glassmorphism
   ============================================ */

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all var(--transition-smooth);
}

.glass:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
}

/* ============================================
   Главный контейнер
   ============================================ */

.main-container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* ============================================
   Hero секция
   ============================================ */

.hero {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    border: 1px solid var(--border-glass);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-cyan);
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 12px var(--accent-cyan-glow);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
}

.title-gradient {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.hero-desc {
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: var(--text-muted);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================
   Карточки ввода
   ============================================ */

.input-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    animation: fadeInUp 0.8s ease-out 0.15s both;
}

.card {
    position: relative;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(0, 212, 170, 0.1), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-smooth);
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-glow-cyan), var(--shadow-lg);
}

.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.03) 45%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 55%,
        transparent 60%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.card:hover .card-shine {
    transform: translateX(100%);
}

.card-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    transition: all var(--transition-smooth);
}

.card:hover .card-icon {
    background: linear-gradient(135deg, var(--accent-cyan-soft), rgba(0, 240, 255, 0.2));
    box-shadow: 0 0 24px var(--accent-cyan-glow);
    transform: scale(1.1);
}

.card-icon svg {
    width: 28px;
    height: 28px;
    color: var(--accent-cyan);
    transition: color var(--transition-smooth);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================
   АКТИВНАЯ КАРТОЧКА (новое)
   ============================================ */

.card.card-active {
    background: linear-gradient(135deg, 
        rgba(0, 240, 255, 0.08), 
        rgba(0, 212, 170, 0.05)
    );
    border-color: var(--accent-cyan);
    box-shadow: 
        0 0 30px var(--accent-cyan-glow),
        0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.card.card-active::before {
    opacity: 1;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal), transparent 70%);
}

.card.card-active .card-icon {
    background: linear-gradient(135deg, var(--accent-cyan-soft), rgba(0, 240, 255, 0.25));
    box-shadow: 0 0 24px var(--accent-cyan-glow);
}

/* ============================================
   РЕЖИМ ВВОДА ТЕКСТА (новое)
   ============================================ */

.text-input-section {
    animation: fadeInUp 0.5s ease-out;
}

.text-input-box {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Обертка textarea */
.textarea-wrapper {
    position: relative;
    width: 100%;
}

/* Поле ввода задачи */
.task-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 400px;
    padding: 20px 24px;
    font-family: var(--font-main);
    font-size: 1rem; /* >= 16px для предотвращения зума на iOS */
    line-height: 1.7;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    resize: vertical;
    outline: none;
    transition: all var(--transition-smooth);

    /* Поддержка математических символов */
    font-variant-numeric: tabular-nums;
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
}

.task-textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.task-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 
        0 0 0 1px var(--accent-cyan),
        0 0 24px var(--accent-cyan-glow);
    background: rgba(0, 0, 0, 0.3);
}

.task-textarea:hover:not(:focus) {
    border-color: var(--border-glass-hover);
}

/* Кнопки под полем ввода */
.text-input-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============================================
   Секции
   ============================================ */

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.section-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-cyan);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ============================================
   Диалог
   ============================================ */

.dialog-section {
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.dialog-box {
    padding: 24px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dialog-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: 400px;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: messageIn 0.5s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dark);
    box-shadow: 0 0 20px var(--accent-cyan-glow);
}

/* Аватар пользователя (новое) */
.message-avatar.user-avatar {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.message-bubble {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(0, 212, 170, 0.05));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    border-top-left-radius: 4px;
    padding: 16px 20px;
    max-width: 80%;
}

/* Сообщение пользователя (новое) */
.message.user-message {
    flex-direction: row-reverse;
}

.message.user-message .message-bubble {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(79, 172, 254, 0.05));
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: 4px;
}

.message-bubble p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.message-bubble p + p {
    margin-top: 8px;
}

/* Метка отправителя (новое) */
.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message.user-message .message-sender {
    text-align: right;
}

.dialog-input-area {
    margin-top: auto;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 4px 20px;
    border-radius: var(--radius-xl);
}

.dialog-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 12px 0;
}

.dialog-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    opacity: 0.5;
    transition: all var(--transition-fast);
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Ход решения
   ============================================ */

.solution-section {
    animation: fadeInUp 0.8s ease-out 0.45s both;
}

.solution-box {
    padding: 48px 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solution-placeholder {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.placeholder-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    margin-bottom: 4px;
}

.placeholder-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-cyan);
    opacity: 0.7;
}

.placeholder-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.placeholder-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   Блок действий
   ============================================ */

.actions-section {
    animation: fadeInUp 0.8s ease-out 0.6s both;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.action-group {
    display: none !important;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
}

.action-icon {
    font-size: 1.2rem;
}

.action-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    transition: all var(--transition-smooth);
    border: 1px solid var(--border-glass);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateY(-50%) translateX(22px);
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan-glow);
}

/* Кнопки */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn:hover::after {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
    color: var(--text-dark);
    box-shadow: 0 4px 24px var(--accent-cyan-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-cyan-glow), 0 0 60px rgba(0, 240, 255, 0.2);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   TOAST-УВЕДОМЛЕНИЯ (новое)
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.15), rgba(255, 59, 48, 0.05));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: var(--radius-lg);
    color: #ff6b6b;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 59, 48, 0.1);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: auto;
    max-width: 90vw;
    min-width: 280px;
    justify-content: center;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast.hide {
    animation: toastOut 0.3s ease-out forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
}

/* ============================================
   Футер
   ============================================ */

/* ============================================
   КОНТЕНТ РЕШЕНИЯ (ответ AI)
   ============================================ */

.solution-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeInUp 0.5s ease-out;
}

.solution-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.solution-text p {
    margin-bottom: 12px;
}

.solution-text p:last-child {
    margin-bottom: 0;
}

.solution-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
}

/* ============================================
   КНОПКА ОЗВУЧИВАНИЯ (TTS)
   ============================================ */

.btn-tts {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-glass);
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    color: var(--accent-cyan);
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn-tts:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 212, 170, 0.15));
    border-color: var(--accent-cyan);
    box-shadow: 0 4px 20px var(--accent-cyan-glow);
    transform: translateY(-2px);
}

.btn-tts:active {
    transform: scale(0.97);
}

/* === АКТИВНОЕ СОСТОЯНИЕ (чтение) === */
.btn-tts.speaking {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(0, 212, 170, 0.2));
    border-color: var(--accent-cyan);
    color: var(--text-primary);
    animation: ttsPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px var(--accent-cyan-glow), 0 0 40px rgba(0, 240, 255, 0.1);
}

.btn-tts.speaking .tts-icon {
    animation: ttsWave 1s ease-in-out infinite;
}

.btn-tts.speaking .tts-label::after {
    content: '...';
    animation: ttsDots 1.5s steps(4, end) infinite;
}

@keyframes ttsPulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--accent-cyan-glow), 0 0 40px rgba(0, 240, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 30px var(--accent-cyan-glow), 0 0 60px rgba(0, 240, 255, 0.2);
    }
}

@keyframes ttsWave {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes ttsDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
    animation: fadeInUp 0.8s ease-out 0.75s both;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Анимации
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* ============================================
   РЕЖИМ ЗАГРУЗКИ ФОТО (восстановлен)
   ============================================ */

.photo-input-section {
    animation: fadeInUp 0.5s ease-out;
}

.photo-input-box {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Область превью фото */
.photo-preview-area {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: all var(--transition-smooth);
}

.photo-preview-area.has-image {
    border-style: solid;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px var(--accent-cyan-glow);
}

/* Плейсхолдер когда нет фото */
.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 32px;
}

.photo-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.photo-placeholder p {
    font-size: 0.9rem;
}

/* Изображение превью */
.photo-preview-img {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
}

/* Кнопки выбора источника */
.photo-source-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Область отправки */
.photo-submit-area {
    display: flex;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-glass);
}

/* Кнопка на всю ширину */
.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================
   ИСПРАВЛЕНИЕ: textarea всегда доступна
   ============================================ */

/* Убедимся, что textarea реально принимает ввод */
.task-textarea {
    /* pointer-events гарантированно включены */
    pointer-events: auto !important;
    /* Убедимся, что элемент видим и доступен */
    opacity: 1 !important;
    visibility: visible !important;
    /* Отключаем любые трансформации, которые могут мешать */
    transform: none !important;
    /* z-index выше фоновых элементов */
    position: relative;
    z-index: 2;
}

/* Убедимся, что обёртка textarea не блокирует ввод */
.textarea-wrapper {
    pointer-events: auto !important;
    position: relative;
    z-index: 2;
}

/* Убедимся, что text-input-section доступна когда видима */
.text-input-section {
    position: relative;
    z-index: 2;
}

.text-input-section[style*="display: block"] {
    display: block !important;
}

/* ============================================
   ИСПРАВЛЕНИЕ: карточки кликабельны
   ============================================ */

/* Убедимся, что карточки перехватывают клики */
.card {
    pointer-events: auto !important;
    cursor: pointer !important;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Отключаем 3D-эффект на touch-устройствах — он мешает клику */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: translateY(-4px) scale(1.01) !important;
    }

    .card:active {
        transform: scale(0.98) !important;
    }
}

/* ============================================
   Адаптивность
   ============================================ */



/* ============================================
   ФИКС: textarea на мобильных устройствах
   ============================================ */

/* Гарантируем, что textarea и её родители не блокируют touch-события */
.text-input-section,
.text-input-box,
.textarea-wrapper,
.task-textarea {
    -webkit-touch-callout: default !important;
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: auto !important;
    -webkit-tap-highlight-color: transparent;
}

/* Убираем backdrop-filter с text-input-box — он мешает textarea на iOS */
.text-input-box {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(13, 19, 33, 0.85) !important;
}

/* Гарантируем, что textarea реально редактируема */
.task-textarea {
    -webkit-appearance: none !important;
    appearance: none !important;
    -webkit-user-modify: read-write !important;
    user-modify: read-write !important;
}

/* iOS: предотвращаем зум при фокусе (уже 16px, но на всякий случай) */
@supports (-webkit-touch-callout: none) {
    .task-textarea {
        font-size: 16px !important;
        transform: translateZ(0);
    }
}

/* Android: фикс для клавиатуры */
@supports not (-webkit-touch-callout: none) {
    .task-textarea {
        font-size: 16px !important;
    }
}



/* ============================================
   РЕЖИМ ГОЛОСОВОГО ВВОДА
   ============================================ */


/* ============================================
   voice-textarea — авторасширение по высоте
   ============================================ */

.voice-textarea {
    min-height: 60px;
    max-height: 300px;
    resize: vertical;
    line-height: 1.6;
    padding: 14px 18px;
    overflow-y: auto;
    field-sizing: content; /* Современный CSS для авто-высоты (Chrome 123+) */
}

/* Fallback для браузеров без field-sizing */
@supports not (field-sizing: content) {
    .voice-textarea {
        height: auto;
    }
}

.voice-input-section {
    animation: fadeInUp 0.5s ease-out;
}

.voice-input-box {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(13, 19, 33, 0.85) !important;
}

/* Поле ввода с микрофоном */
.voice-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.voice-input {
    flex: 1;
    padding: 16px 20px;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    outline: none;
    transition: all var(--transition-smooth);
    -webkit-appearance: none;
    appearance: none;
}

.voice-input::placeholder {
    color: var(--text-muted);
}

.voice-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 1px var(--accent-cyan), 0 0 24px var(--accent-cyan-glow);
    background: rgba(0, 0, 0, 0.3);
}

/* Кнопка микрофона */
.mic-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    border: 2px solid var(--border-glass);
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    color: var(--accent-cyan);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.mic-btn:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(0, 212, 170, 0.2));
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px var(--accent-cyan-glow);
    transform: scale(1.08);
}

.mic-btn:active {
    transform: scale(0.95);
}

/* === АНИМАЦИЯ ЗАПИСИ (.recording) === */
.mic-btn.recording {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.2), rgba(255, 59, 48, 0.1));
    border-color: #ff3b30;
    color: #ff6b6b;
    animation: micPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.3), 0 0 40px rgba(255, 59, 48, 0.15);
}

.mic-btn.recording .mic-icon {
    animation: micShake 0.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 59, 48, 0.3), 0 0 40px rgba(255, 59, 48, 0.15);
    }
    50% {
        transform: scale(1.12);
        box-shadow: 0 0 30px rgba(255, 59, 48, 0.5), 0 0 60px rgba(255, 59, 48, 0.25);
    }
}

@keyframes micShake {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    75% { transform: translateY(2px); }
}

/* Статус записи */
.voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 42px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition-smooth);
}

.voice-status.recording .status-dot {
    background: #ff3b30;
    animation: statusBlink 1s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 59, 48, 0.6);
}

.voice-status.recording .status-text {
    color: #ff6b6b;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Кнопки управления голосом */
.voice-input-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============================================
   КНОПКА МИКРОФОНА В ДИАЛОГЕ (inline)
   ============================================ */

.mic-btn-inline {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: linear-gradient(135deg, var(--accent-cyan-soft), var(--accent-teal-soft));
    color: var(--accent-cyan);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.mic-btn-inline:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(0, 212, 170, 0.2));
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px var(--accent-cyan-glow);
    transform: scale(1.1);
}

.mic-btn-inline.recording {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.2), rgba(255, 59, 48, 0.1));
    border-color: #ff3b30;
    color: #ff6b6b;
    animation: micPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 16px rgba(255, 59, 48, 0.3);
}


@media (max-width: 768px) {
    .main-container {
        padding: 32px 16px 24px;
        gap: 36px;
    }

    .input-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card {
        padding: 24px 20px;
        flex-direction: row;
        text-align: left;
        gap: 16px;
    }

    .card-icon {
        width: 52px;
        height: 52px;
        min-width: 52px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-desc {
        font-size: 0.8rem;
    }


    /* === Режим голосового ввода (адаптив) === */
    .voice-input-box {
        padding: 20px 16px;
    }

    .voice-input-wrapper {
        gap: 10px;
    }

    .voice-input {
        padding: 14px 16px;
        font-size: 1rem;
    }

    .mic-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 1.2rem;
    }

    .voice-input-actions {
        flex-direction: column;
    }

    .voice-input-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .mic-btn-inline {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 1rem;
    }

    /* === Режим загрузки фото (адаптив) === */
    .photo-input-box {
        padding: 20px 16px;
    }

    .photo-preview-area {
        min-height: 160px;
    }

    .photo-source-buttons {
        flex-direction: column;
    }

    .photo-source-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .photo-placeholder svg {
        width: 40px;
        height: 40px;
    }

    /* === Режим ввода текста (адаптив) === */
    .text-input-box {
        padding: 20px 16px;
    }

    .task-textarea {
        padding: 16px 18px;
        font-size: 1rem;
        min-height: 100px;
    }

    .text-input-actions {
        flex-direction: column;
    }

    .text-input-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .dialog-box {
        padding: 16px;
        min-height: 260px;
    }

    .message-bubble {
        max-width: 90%;
        padding: 12px 16px;
    }

    .message-bubble p {
        font-size: 0.9rem;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .solution-box {
        padding: 32px 16px;
    }

    .btn-tts {
        width: 100%;
        justify-content: center;
    }



    .btn-tts {
        width: 100%;
        justify-content: center;
    }



    .toast {
        min-width: auto;
        width: calc(100vw - 32px);
        padding: 14px 18px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 20px 16px;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 0.65rem;
    }

    .task-textarea {
        padding: 14px 16px;
    }
}

/* Предпочтения пользователя */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-orb {
        animation: none;
    }
}
/* Анимация пульсации для индикатора записи */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    background: #ccc;
    transition: all 0.3s ease;
}

.status-dot.recording {
    background: #ff4444;
}

  /* Стили для сквозной шапки сайта EgryLuck */
  .site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 20px;
    font-family: Arial, sans-serif;
    position: relative;
    z-index: 9999;
  }
  .header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .site-logo a {
    font-size: 20px;
    font-weight: bold;
    color: #111827;
    text-decoration: none;
  }
  .site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
  }
  .site-nav li {
    position: relative;
    padding: 10px 0;
  }
  .site-nav a {
    text-decoration: none;
    color: #374151;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
  }
  .site-nav a:hover {
    color: #2563eb;
  }
  
  /* Выпадающее подменю */
  .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    border: 1px solid #f3f4f6;
  }
  .dropdown-menu li {
    padding: 0;
  }
  .dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: #4b5563;
    white-space: nowrap;
  }
  .dropdown-menu a:hover {
    background-color: #f3f4f6;
    color: #2563eb;
  }
  
  /* Показ подменю при наведении */
  .has-dropdown:hover .dropdown-menu {
    display: block;
  }
/* ================= МЕНЮ СЕКЦИЯ ================= */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 20px;
  font-family: Arial, sans-serif;
  position: relative;
  z-index: 9999;
}
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-logo a {
  font-size: 20px;
  font-weight: bold;
  color: #111827;
  text-decoration: none;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
}
.site-nav li {
  position: relative;
  padding: 10px 0;
}
.site-nav a {
  text-decoration: none;
  color: #374151;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover {
  color: #2563eb;
}

/* ================= ПРИНУДИТЕЛЬНОЕ ИСПРАВЛЕНИЕ МЕНЮ ================= */

/* Общие стили для выпадашек */
.site-header .dropdown-menu {
  display: none !important;
  position: absolute !important;
  top: 100% !important;
  background-color: #ffffff !important;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05) !important;
  border-radius: 8px !important;
  padding: 8px 0 !important;
  min-width: 220px !important;
  border: 1px solid #f3f4f6 !important;
  z-index: 999999 !important;
  list-style: none !important;
  margin: 0 !important;
}

/* Принудительное выпадание при наведении */
.site-header .has-dropdown:hover .dropdown-menu {
  display: block !important;
}

/* Нейросети — выпадают влево */
.site-header .dropdown-menu.dropdown-left {
  left: 0 !important;
  right: auto !important;
}

/* Мои АИ сервисы — выпадают вправо */
.site-header .dropdown-menu.dropdown-right {
  right: 0 !important;
  left: auto !important;
}

/* Пункты списков */
.site-header .dropdown-menu li {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

.site-header .dropdown-menu a {
  display: block !important;
  padding: 10px 18px !important;
  color: #4b5563 !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  text-align: left !important;
  text-decoration: none !important;
  background: transparent !important;
}

.site-header .dropdown-menu a:hover {
  background-color: #f3f4f6 !important;
  color: #2563eb !important;
}