/* === Firefly: На одной волне — Основные стили === */

:root {
    --primary: #7C3AED;
    --primary-light: #A78BFA;
    --primary-bg: #EDE9FE;
    --accent: #F59E0B;
    --success: #10B981;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-600: #4B5563;
    --gray-800: #1F2937;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 10px -6px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #EDE9FE 0%, #F3E8FF 50%, #FCE7F3 100%);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 700px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-lg);
}

/* === Кнопки === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: #6D28D9;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    border-radius: var(--radius);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--primary-bg);
}

.btn-back {
    display: block;
    text-align: center;
    margin: 20px auto;
    color: var(--primary);
    font-weight: 600;
}

.btn-next {
    width: 100%;
    margin-top: 20px;
}

.btn-send {
    padding: 12px 20px;
    border-radius: var(--radius);
}

/* === Приветственная страница === */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    text-align: center;
}

.firefly-logo {
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 80px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.firefly-logo h1 {
    font-size: 42px;
    color: var(--primary);
    margin: 10px 0 0;
}

.tagline {
    color: var(--accent);
    font-size: 18px;
    font-weight: 500;
}

.welcome-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    max-width: 500px;
    width: 100%;
}

.welcome-text {
    font-size: 16px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.welcome-highlight {
    font-size: 17px;
    color: var(--primary);
    font-weight: 600;
    margin: 20px 0;
}

/* === Опросник === */
.register-container {
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.progress-bar {
    position: relative;
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    transition: width 0.4s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-800);
}

.question-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.question-emoji {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.question-text {
    font-size: 20px;
    text-align: center;
    color: var(--gray-800);
    margin-bottom: 24px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-card {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.option-card:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

.option-card input[type="radio"] {
    margin-right: 12px;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.option-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.text-input-wrapper {
    margin-bottom: 10px;
}

.text-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}

.text-input:focus {
    border-color: var(--primary);
}

/* === Чат === */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: var(--white);
    gap: 12px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.firefly-icon {
    font-size: 28px;
}

.chat-title {
    font-size: 20px;
    font-weight: 700;
}

.mode-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--gray-50);
}

.message {
    display: flex;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user .message-content {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input textarea:focus {
    border-color: var(--primary);
}

/* === Меню === */
.menu-container, .modes-container, .my-world-container {
    padding: 30px 20px;
    text-align: center;
    min-height: 100vh;
}

.menu-greeting {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.menu-subtitle, .modes-subtitle, .my-world-subtitle {
    color: var(--gray-600);
    margin-bottom: 24px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.menu-card {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--gray-800);
    transition: all 0.2s;
    gap: 14px;
}

.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
}

.menu-card-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-icon, .mode-icon, .world-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.menu-label {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: left;
}

.menu-arrow {
    font-size: 18px;
}

/* === Режимы === */
.modes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto 20px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--gray-800);
    transition: all 0.2s;
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--primary-bg);
}

.mode-name {
    font-size: 14px;
    font-weight: 600;
}

/* === Мой мир === */
.world-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.world-card {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--gray-800);
    gap: 14px;
    transition: all 0.2s;
    text-align: left;
}

.world-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.world-card-disabled {
    opacity: 0.5;
}

.world-label {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.world-hint {
    font-size: 12px;
    color: var(--gray-600);
}

/* === Модальные окна === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 16px;
    color: var(--primary);
}

.modal-content input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 16px;
    margin-bottom: 16px;
    outline: none;
}

.modal-content input:focus {
    border-color: var(--primary);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.instructions-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-600);
    margin-bottom: 16px;
}

.instructions-text p {
    margin-bottom: 8px;
}

/* === Адаптивность === */
@media (max-width: 480px) {
    .modes-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .mode-name {
        font-size: 13px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .welcome-card {
        padding: 20px;
    }
    
    .firefly-logo h1 {
        font-size: 32px;
    }
    
    .question-text {
        font-size: 18px;
    }
}

/* === Скроллбар === */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}