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

html {
    overflow-x: hidden;
    width: 100%;
    position: fixed;
    height: 100%;
    touch-action: pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --bg-color: rgba(255, 255, 255, 0.85);
    --surface-color: rgba(255, 255, 255, 0.7);
    --text-color: #1d1d1f;
    --text-secondary: rgba(60, 60, 67, 0.8);
    --border-color: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.45);
    /* ЯРКИЙ и заметный градиент для всех устройств */
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #f093fb 25%, #4facfe 50%, #00f2fe 75%, #43e97b 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
    overflow-y: hidden;
    width: 100%;
    position: fixed;
    height: 100%;
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    /* Предотвращаем прокрутку body */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    /* Красивый анимированный градиент */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 15%, #f093fb 30%, #4facfe 50%, #00f2fe 70%, #43e97b 90%);
    background-size: 300% 300%;
    background-repeat: no-repeat;
    background-position: center center;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { 
        background-position: 0% 50%; 
    }
    50% { 
        background-position: 100% 50%; 
    }
    100% { 
        background-position: 0% 50%; 
    }
}

/* Легкая анимация градиента - опционально */
@keyframes gradientShift {
    0% { 
        background-position: 0% 0%; 
    }
    50% { 
        background-position: 0% 100%; 
    }
    100% { 
        background-position: 0% 0%; 
    }
}

#app {
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    /* Обеспечиваем, что градиент всегда виден */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 15%, #f093fb 30%, #4facfe 50%, #00f2fe 70%, #43e97b 90%);
    background-size: 300% 300%;
    background-repeat: no-repeat;
    background-position: center center;
    animation: gradientShift 15s ease infinite;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    padding-bottom: 80px;
}

.screen.active {
    display: flex;
}

.header {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    color: white;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Компактная шапка для большинства разделов */
.header-compact {
    padding: 0.75rem 1rem;
}

.header-compact h1 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.header-compact .subtitle {
    font-size: 0.75rem;
}

/* Скрытая шапка для чата */
.header-hidden {
    display: none;
}

.header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
    transition: all 0.3s ease;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.section {
    display: none;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.section.active {
    display: block;
}

.section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.4);
    font-weight: 700;
}

.cards-list {
    display: grid;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-title, .card-description {
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.35);
}

.card.selected {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.card-description {
    font-size: 0.85rem;
    color: #2d2d2f;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.875rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.chat-header-info {
    flex: 1;
}

.chat-header-info h2 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

.chat-context {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.context-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 122, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0a0a0a;
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.chat-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

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

.chat-messages {
    min-height: 300px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.625rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    margin-bottom: 60px; /* Отступ для поля ввода (которое теперь fixed) */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    /* Предотвращаем сдвиг окна miniapp при прокрутке */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    will-change: scroll-position;
}

.chat-section.keyboard-visible .chat-messages {
    margin-bottom: 60px; /* Отступ когда клавиатура открыта и меню скрыто */
}

.message {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    animation: messageAppear 0.3s ease-out;
}

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

.message.user {
    flex-direction: row;
    justify-content: flex-end;
    align-items: flex-end;
}

.message.assistant {
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-end;
}

.message-meta-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    width: 36px;
    margin-bottom: 0.25rem;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.message.user .message-avatar {
    background: rgba(0, 122, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.3);
}

.message-bubble {
    flex: 1 1 auto;
    width: auto;
    max-width: calc(100vw - 5rem);
    min-width: 220px;
    padding: 0.875rem 1.25rem;
    border-radius: 16px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.6;
    position: relative;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .message-bubble {
        max-width: calc(100vw - 4.5rem);
        min-width: 200px;
        padding: 0.75rem 1.125rem;
    }
}

.message.user .message-bubble {
    background: rgba(0, 122, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0a0a0a;
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 0.6rem;
    color: rgba(60, 60, 67, 0.6);
    padding: 0.1rem 0;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.system-notification {
    text-align: center;
    padding: 0.7rem 0.875rem;
    margin: 0.875rem 0;
    background: rgba(0, 122, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0a0a0a;
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 14px;
    font-size: 0.8rem;
    font-style: italic;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.typing-indicator {
    display: flex !important;
    align-items: flex-end;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    animation: messageAppear 0.3s ease-out;
    justify-content: flex-start;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    transition: opacity 0.3s ease;
}

/* Гарантируем видимость когда не скрыт явно */
.typing-indicator:not([style*="display: none"]) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Стили для режима "изучает" */
.typing-indicator.studying .typing-bubble {
    background: rgba(255, 255, 255, 0.95);
}

.typing-indicator.studying .typing-text {
    font-weight: 500;
}

/* Стили для режима "печатает" */
.typing-indicator.typing .typing-bubble {
    background: rgba(255, 255, 255, 0.9);
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
    flex: 1 1 auto;
    width: auto;
    max-width: calc(100vw - 5rem);
    min-width: 220px;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .typing-bubble {
        max-width: calc(100vw - 4.5rem);
        min-width: 200px;
        padding: 0.75rem 1.125rem;
    }
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: rgba(0, 122, 255, 0.8);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

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

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

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-text {
    font-size: 0.8rem;
    color: #2d2d2f;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--glass-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    align-items: center;
    flex-shrink: 0;
    z-index: 1500;
    transition: bottom 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.chat-input-container:not(.keyboard-visible) {
    bottom: 65px; /* Высота нижнего меню, когда клавиатура закрыта */
}

.chat-input-container.keyboard-visible {
    bottom: 0 !important;
}

#chat-input {
    flex: 1;
    min-width: 0;
    padding: 0.7rem 0.875rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
    box-sizing: border-box;
    max-width: calc(100vw - 70px);
    color: #0a0a0a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#chat-input::placeholder {
    color: rgba(60, 60, 67, 0.7);
}

#chat-input:focus {
    border-color: rgba(0, 122, 255, 0.5);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-send {
    padding: 0;
    background: rgba(0, 122, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-send:hover {
    background: rgba(0, 122, 255, 0.9);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

.resume-content, .profile-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 20px;
    line-height: 1.6;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    color: #0a0a0a;
}

.profile-item {
    margin-bottom: 1.25rem;
}

.profile-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #2d2d2f;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.profile-item .value {
    font-size: 1rem;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.65rem 0.5rem calc(0.65rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.bottom-nav.keyboard-visible {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    min-width: 56px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
}

.nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.nav-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-label {
    font-size: 0.73rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.nav-item.active .nav-label {
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.error {
    color: white;
    background: rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 20px;
    text-align: center;
    margin: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.no-data {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 2rem;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Экран анкетирования */
.survey-form {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #0a0a0a;
    font-size: 1rem;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}

.gender-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.gender-btn {
    padding: 1.25rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
    color: #0a0a0a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}

.gender-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.75);
}

.gender-btn.active {
    border-color: rgba(0, 122, 255, 0.5);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 40px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.age-input {
    width: 100%;
    padding: 0.875rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    font-size: 1rem;
    outline: none;
    color: #0a0a0a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.age-input::placeholder {
    color: rgba(60, 60, 67, 0.6);
}

.age-input:focus {
    border-color: rgba(0, 122, 255, 0.5);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: rgba(0, 122, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: rgba(0, 122, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

.btn-secondary {
    width: 100%;
    padding: 0.875rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0a0a0a;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.btn-secondary:hover {
    border-color: rgba(0, 122, 255, 0.4);
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #007AFF;
}

/* Главный экран */
.welcome-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.welcome-card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.6rem;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 700;
}

.welcome-text {
    font-size: 0.9rem;
    color: #2d2d2f;
    margin-bottom: 1.25rem;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.mood-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.mood-btn {
    padding: 0.75rem 0.4rem;
    min-height: 80px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mood-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.mood-btn.selected {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.mood-btn.mood-good.selected {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mood-btn.mood-neutral.selected {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.3);
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mood-btn.mood-bad.selected {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.3);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mood-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.35);
}

.mood-btn.mood-good:hover {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.25);
}

.mood-btn.mood-neutral:hover {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.25);
}

.mood-btn.mood-bad:hover {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.25);
}

.mood-icon {
    font-size: 2rem;
    line-height: 1;
}

.mood-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}

.mood-suggestion {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-in;
}

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

.suggestion-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    word-wrap: break-word;
}

.suggestion-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

.suggestion-card p {
    font-size: 1rem;
    color: #2d2d2f;
    margin-bottom: 1.25rem;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.suggestion-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Улучшаем видимость кнопок в suggestion-buttons */
.suggestion-buttons .btn-primary {
    background: rgba(0, 122, 255, 0.85);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.suggestion-buttons .btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    color: #0a0a0a;
    border: 1px solid rgba(0, 122, 255, 0.3);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.suggestion-buttons .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 122, 255, 0.5);
    color: #007AFF;
}

.suggestion-good {
    border-left: 4px solid #10b981;
}

.suggestion-neutral {
    border-left: 4px solid #f59e0b;
}

.suggestion-bad {
    border-left: 4px solid #ef4444;
}

/* Дыхательные практики */
.breathing-section {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    justify-content: flex-start;
}

.breathing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
    padding: 0 0.5rem;
}

.breathing-header h2 {
    color: white;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 0, 0, 0.5);
    font-size: 1.15rem;
    font-weight: 700;
}

.breathing-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    padding: 0.5rem;
    padding-top: 1rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.breathing-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    flex-grow: 0;
}

.breathing-circle {
    width: 180px;
    height: 180px;
    max-width: 180px;
    max-height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 40px rgba(0, 0, 0, 0.2);
    position: relative;
    transition: transform 0.1s linear;
    box-sizing: border-box;
    transform: scale(1);
}

.breathing-circle.pulsing {
    /* Анимация управляется через JavaScript для синхронизации с фазами дыхания */
    transition: transform 0.1s linear;
}

.breathing-text {
    color: white;
    font-size: clamp(1rem, 4.5vw, 1.25rem);
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    z-index: 1;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.7), 0 1px 3px rgba(0, 0, 0, 0.9);
    padding: 0 0.75rem;
}

.breathing-timer {
    color: white;
    font-size: clamp(0.7rem, 3vw, 0.85rem);
    font-weight: 700;
    opacity: 1;
    z-index: 1;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 1);
}

.breathing-controls {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
    padding: 0 1rem;
    max-width: 100%;
}

.breathing-btn-start {
    width: 100%;
    max-width: 240px;
    padding: 0.875rem 1.25rem;
    background: rgba(0, 122, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(0, 122, 255, 0.5);
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.breathing-btn-start:hover {
    background: rgba(0, 122, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

.breathing-btn-stop {
    width: 100%;
    max-width: 240px;
    padding: 0.75rem 1.25rem;
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.breathing-btn-stop:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.breathing-info {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    color: rgba(255, 255, 255, 1);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    flex-shrink: 0;
    max-width: 85%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

/* Модальное окно опроса после дыхательной практики */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-content {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #0a0a0a;
    text-align: center;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

.modal-body {
    padding: 1.25rem;
}

.feedback-question {
    text-align: center;
    font-size: 1rem;
    color: #0a0a0a;
    margin-bottom: 1.25rem;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}

.feedback-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-btn {
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #0a0a0a;
}

.feedback-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.35);
}

.feedback-btn.feedback-yes:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.feedback-btn.feedback-no:hover {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.3);
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.feedback-btn.feedback-neutral:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.3);
}

.feedback-emoji {
    font-size: 2rem;
}

.feedback-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #0a0a0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.5);
}
