/* === Firefly: На одной волне — Тёмная тема === */

:root {
    --bg-primary: #1A1030;
    --bg-card: #1E1B4B;
    --bg-input: #2D2A5E;
    --accent: #2DD4BF;
    --accent-hover: #14B8A6;
    --accent-blue: #60A5FA;
    --accent-warm: #F59E0B;
    --text-primary: #F5F3FF;
    --text-secondary: #C4B5FD;
    --text-muted: #8B82B5;
    --success: #10B981;
    --danger: #EF4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(45, 212, 191, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 700px;
    margin: 0 auto;
    min-height: 100vh;
}

/* === Кнопки === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-outline:hover {
    background: rgba(45, 212, 191, 0.1);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}


.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(--bg-input);
}

.btn-back {
    display: block;
    text-align: center;
    margin: 20px auto;
    color: var(--accent);
    font-weight: 600;
}

.btn-next {
    width: 100%;
    margin-top: 20px;
}

/* === Главная страница === */
.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: 40px;
}

.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(--accent);
    margin: 10px 0 0;
    font-weight: 800;
    letter-spacing: 4px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
    margin-top: 4px;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Фишка-секция */
.fishka-section {
    display: none;
    margin-top: 12px;
    flex-direction: column;
    gap: 10px;
}

.fishka-section.show {
    display: flex;
}

.fishka-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.fishka-input:focus {
    border-color: var(--accent);
}

.fishka-input::placeholder {
    color: var(--text-muted);
}

/* === Опросник === */
.register-container {
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.5);
}

.progress-text {
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.question-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.question-emoji {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.question-text {
    font-size: 20px;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-card {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    color: var(--text-primary);
}

.option-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.option-card input[type="radio"] {
    margin-right: 12px;
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

.option-card:has(input:checked) {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.text-input-wrapper {
    margin-bottom: 10px;
}

.text-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}

.text-input:focus {
    border-color: var(--accent);
}

.text-input::placeholder {
    color: var(--text-muted);
}

/* === Чат === */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 6px;
    min-height: 52px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.firefly-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: inline-block;
}

.chat-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
}

.mode-badge {
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    color: var(--text-secondary);
    white-space: normal;
    flex-shrink: 1;
    display: inline-block;
    min-width: 0;
    max-width: 45vw;
    overflow: visible;
    line-height: 1.2;
    text-align: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.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(--accent);
    color: var(--bg-primary);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom-left-radius: 4px;
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    min-height: 48px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

.chat-input textarea:focus {
    border-color: var(--accent);
}

.chat-input textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    padding: 12px 20px;
    border-radius: var(--radius);
    width: auto;
}

/* === Меню === */
.menu-container, .modes-container, .my-world-container {
    padding: 30px 20px;
    text-align: center;
    min-height: 100vh;
}

.menu-greeting {
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 8px;
}

.menu-subtitle, .modes-subtitle, .my-world-subtitle {
    color: var(--text-secondary);
    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(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    gap: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.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;
    color: var(--text-muted);
}

/* === Режимы === */
.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(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.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(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    gap: 14px;
    transition: all 0.2s;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.world-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.world-label {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.world-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* === Модальные окна === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-content h3 {
    margin-bottom: 16px;
    color: var(--accent);
}

.modal-content input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 16px;
    outline: none;
}

.modal-content input:focus {
    border-color: var(--accent);
}

.modal-content input::placeholder {
    color: var(--text-muted);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* === Страница фишки === */
.token-box {
    background: var(--bg-input);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.token-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.token-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-warm);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    margin: 10px 0;
    user-select: all;
}

.token-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === Сокровища === */
.achievements-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 450px;
    margin: 0 auto;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.achievement-card.earned {
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
}

.achievement-card.locked {
    background: var(--bg-card);
    opacity: 0.4;
    border-left: 3px solid var(--text-muted);
}

.ach-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.ach-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    flex: 1;
}

.ach-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.ach-badge {
    font-size: 20px;
    flex-shrink: 0;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: var(--bg-primary);
    padding: 14px 24px;
    border-radius: 50px;
    box-shadow: var(--shadow-glow);
    z-index: 9999;
    transition: transform 0.4s ease;
    font-size: 16px;
    font-weight: 600;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 28px;
}

/* === Адаптивность === */
@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%;
    }
    
    .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(--bg-input);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Кнопка прикрепления фото */
.btn-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-input);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-attach:hover {
    background: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* Превью загруженного фото */
.image-preview {
    position: relative;
    display: inline-block;
    margin: 4px 0;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-preview .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
