/* ============ CherryChat: вишнёвая тема ============
   Фон #0D0509, панели #1C0C13, акцент #FF2D55→#C2185B,
   розовый #FF8FA8, кремовый #F3D9A4. Фирменный приём —
   «хвостик вишни»: нижний левый угол почти острый. */
:root {
    --tg-theme-bg-color: #0D0509;
    --tg-theme-secondary-bg-color: rgba(255, 255, 255, 0.055);
    --tg-theme-text-color: #F6ECEF;
    --tg-theme-hint-color: #BC9BA3;
    --tg-theme-button-color: #FF2D55;
    --tg-theme-button-text-color: #F6ECEF;
    --crystal-color: #FF8FA8;
    --border-radius: 14px;
    --card-border-radius: 16px;
    --tab-border-radius: 16px;
    /* хвостик вишни: TL TR BR BL */
    --cherry-radius: 14px 14px 14px 4px;
    --cherry-radius-lg: 16px 16px 16px 3px;
    --cherry-radius-sm: 8px 8px 8px 2px;
    --primary-color: #FF2D55;
    --secondary-color: #C2185B;
    --background-color: #0D0509;
    --card-bg-color: #1C0C13;
    --secondary-background-color: rgba(255, 255, 255, 0.055);
    --text-color: #F6ECEF;
    --muted-color: #8A6A74;
    --cream-color: #F3D9A4;
    --border-color: rgba(255, 255, 255, 0.09);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --neon-pink: #FF8FA8;
    --neon-blue: #FF2D55;
    --neon-purple: #C2185B;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.09);
    --gradient-primary: linear-gradient(135deg, #FF2D55 0%, #C2185B 100%);
    --gradient-secondary: linear-gradient(135deg, #FF8FA8 0%, #FF4D6D 100%);
    --gradient-accent: linear-gradient(140deg, rgba(122, 18, 51, 0.42), rgba(28, 12, 19, 0.92));
    --cover-stripes: repeating-linear-gradient(104deg, rgba(234, 134, 164, 0.13) 0px, rgba(234, 134, 164, 0.13) 3px, transparent 3px, transparent 9px);
    --cover-fade: linear-gradient(rgba(0, 0, 0, 0) 48%, rgba(13, 5, 9, 0.93));
    --tg-safe-area-top: 0px;
}

/* Safe area отступ для fullscreen режима */
.page-container {
    padding-top: var(--tg-safe-area-top) !important;
}

/* Шрифты CherryChat. Семейство оставлено под именем TildaSans, чтобы не
   трогать 5000 строк ниже: физически это Manrope (кириллица + латиница).
   CherryDisplay — Bricolage Grotesque для лого/латинских заголовков,
   CherryMono — JetBrains Mono для меток и цифр. */
@font-face { font-family: 'TildaSans'; font-weight: 400; font-display: swap;
    src: url('../fonts/manrope-cyrillic-400-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'TildaSans'; font-weight: 400; font-display: swap;
    src: url('../fonts/manrope-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'TildaSans'; font-weight: 500; font-display: swap;
    src: url('../fonts/manrope-cyrillic-600-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'TildaSans'; font-weight: 500; font-display: swap;
    src: url('../fonts/manrope-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'TildaSans'; font-weight: 600; font-display: swap;
    src: url('../fonts/manrope-cyrillic-600-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'TildaSans'; font-weight: 600; font-display: swap;
    src: url('../fonts/manrope-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'TildaSans'; font-weight: 700; font-display: swap;
    src: url('../fonts/manrope-cyrillic-700-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'TildaSans'; font-weight: 700; font-display: swap;
    src: url('../fonts/manrope-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'TildaSans'; font-weight: 800; font-display: swap;
    src: url('../fonts/manrope-cyrillic-800-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'TildaSans'; font-weight: 800; font-display: swap;
    src: url('../fonts/manrope-latin-800-normal.woff2') format('woff2'); }

@font-face { font-family: 'CherryDisplay'; font-weight: 800; font-display: swap;
    src: url('../fonts/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); }

@font-face { font-family: 'CherryMono'; font-weight: 400; font-display: swap;
    src: url('../fonts/jetbrains-mono-cyrillic-400-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'CherryMono'; font-weight: 400; font-display: swap;
    src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'CherryMono'; font-weight: 700; font-display: swap;
    src: url('../fonts/jetbrains-mono-cyrillic-700-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'CherryMono'; font-weight: 700; font-display: swap;
    src: url('../fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }

/* Применение шрифта TildaSans к заголовкам и именам */
h1, h2, h3, 
.character-name, 
.model-name, 
.header h1, 
.character-badge, 
.tab, 
.section-title,
.chat-title {
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Применение шрифта TildaSans к элементам с менее жирным шрифтом */
.character-description, 
.model-description, 
.crystal-counter, 
.nav-item {
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
}

/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Современные стили для всех кнопок */
button, .btn, input[type="submit"], input[type="button"] {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover, .btn:hover, input[type="submit"]:hover, input[type="button"]:hover {
    background: var(--gradient-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 45, 85, 0.3);
    border-color: var(--neon-blue);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--gradient-secondary);
    box-shadow: 0 8px 24px rgba(255, 143, 168, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--gradient-accent);
    box-shadow: 0 8px 24px rgba(79, 172, 254, 0.3);
}

/* Глобальное скрытие скроллбара для всех элементов с прокруткой */
* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    background: transparent !important;
}

*::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
}

*::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

body {
    background: var(--background-color);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 45, 85, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 143, 168, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(194, 24, 91, 0.05) 0%, transparent 50%);
    color: var(--text-color);
    height: 100%; /* Заменено с min-height: 100vh */
    position: relative;
    padding-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
}

/* Современный анимированный фон */
body::before, body::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: -1;
    pointer-events: none;
}

/* Первый слой - статичные градиенты */
body::before {
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 45, 85, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 143, 168, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(194, 24, 91, 0.05) 0%, transparent 50%);
}

/* Второй слой - статичные световые эффекты */
body::after {
    background: 
        conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(255, 45, 85, 0.03) 90deg, transparent 180deg, rgba(255, 143, 168, 0.03) 270deg, transparent 360deg);
    filter: blur(40px);
    opacity: 0.6;
}

/* Плавающие пузырьки */
#background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent);
    box-shadow: 0 0 10px rgba(255, 45, 85, 0.2);
    backdrop-filter: blur(1px);
    opacity: 0;
    animation: floatBubble ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes floatBubble {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    20% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.1;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

@keyframes floatingGradients {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    33% {
        transform: translate(30px, -20px) scale(1.1);
        opacity: 0.6;
    }
    66% {
        transform: translate(-20px, 30px) scale(0.9);
        opacity: 0.7;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
}

@keyframes rotatingLight {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Анимация появления элементов */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Select for AI Models - Styled like Top Bar Tabs */
.model-selector-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    z-index: 100;
}

.model-selector-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: transparent; /* Transparent like tabs */
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.model-selector-trigger:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Glow/Underline effect similar to tabs */
.model-selector-trigger::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #FF2D55, #A165E3); /* Purple gradient */
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 -2px 10px rgba(255, 45, 85, 0.5);
}

.model-selector-trigger.active::after,
.model-selector-trigger:hover::after {
    width: 100%;
}

.model-selector-trigger .selected-value {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800; /* Bold */
    font-size: 16px;
    color: #ffffff;
    font-family: 'TildaSans', sans-serif;
    text-transform: uppercase; /* Uppercase like tabs */
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(255, 45, 85, 0.3);
}

.model-selector-trigger .model-cost {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
    color: #F3D9A4; /* Crystal Cyan */
    font-weight: 800;
    border: none;
    text-shadow: 0 0 10px rgba(66, 192, 251, 0.6);
    display: flex;
    align-items: center;
    gap: 4px;
}

.model-selector-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: rgba(20, 15, 35, 0.98); /* почти непрозрачный: сквозь 0.90 просвечивал контент под выпадашкой */
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 45, 85, 0.2); /* Subtle purple border */
    border-radius: 16px;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
    max-height: 0;
}

.model-selector-options.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 500px;
    overflow-y: auto;
}

/* Scrollbar for the dropdown */
.model-selector-options::-webkit-scrollbar {
    width: 4px;
}

.model-selector-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.model-selector-options::-webkit-scrollbar-thumb {
    background: rgba(255, 45, 85, 0.3);
    border-radius: 2px;
}

.model-option {
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03); /* Very subtle separator */
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.model-option:last-child {
    border-bottom: none;
}

.model-option:hover {
    background: linear-gradient(90deg, rgba(255, 45, 85, 0.15), transparent);
}

.model-option.selected {
    background: linear-gradient(90deg, rgba(255, 45, 85, 0.3), transparent);
}

/* Accent line for selected item */
.model-option.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #FF2D55;
    box-shadow: 0 0 10px #FF2D55;
}

.model-option-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1; /* Allow this section to grow and push price to the right */
    padding-right: 16px; /* Space between text and price */
}

.model-option-name {
    font-weight: 800; /* Bold matches tabs */
    color: #fff;
    font-family: 'TildaSans', sans-serif;
    font-size: 14px;
    text-transform: uppercase; /* Match uppercase style */
    letter-spacing: 0.5px;
}

.model-option.selected .model-option-name {
    text-shadow: 0 0 10px rgba(255, 45, 85, 0.5);
}

.model-option-desc {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    text-transform: none; /* Keep description normal case */
}

.model-option-cost {
    font-weight: 800;
    color: #F3D9A4; /* Crystal color */
    white-space: nowrap;
    font-size: 14px;
    text-shadow: 0 0 8px rgba(66, 192, 251, 0.4);
    text-align: right; /* Ensure text alignment inside the block */
    min-width: 50px; /* Optional: Ensure minimum width for alignment if not flexed to edge */
}

.arrow-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
}

.model-selector-trigger.active .arrow-icon {
    transform: rotate(180deg);
    color: #FF2D55;
}


/* Заголовок */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 4px 16px !important;
    background-color: transparent;
    position: relative;
    z-index: 10;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.back-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
    background: var(--gradient-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 45, 85, 0.3);
}

.crystal-counter {
    background: #341421;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: white;
}

.crystal-counter .crystal-icon {
    color: var(--crystal-color);
    text-shadow: 0 0 10px rgba(66, 192, 251, 0.5);
}

/* Чат */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px - var(--tg-safe-area-top, 0px));
    padding: 0 16px;
    margin-bottom: 0;
    position: relative;
    padding-bottom: 200px;
    /* Убираем overflow: hidden - это мешало прокрутке сообщений */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.chat-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    background: transparent !important;
}

.chat-container::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
}

.chat-container::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

/* Стили для контейнера кнопок управления чатом */
.chat-controls {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 6px;
}

/* Стили для контейнера кнопки очистки чата */
.clear-chat-container {
    display: none;
}

/* Обновленные стили для кнопки очистки чата */
.clear-chat-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px);
    margin-top: -2px !important;
    margin-bottom: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.clear-chat-btn:hover {
    background: var(--gradient-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 143, 168, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px;
    margin-bottom: 0;
    padding-bottom: 100px;
    scroll-padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
    scroll-behavior: auto;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    position: relative;
    z-index: 5;
    justify-content: flex-start;
    overscroll-behavior: contain;
    contain: layout paint;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    background: transparent !important;
}

.chat-messages::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
}

.chat-messages::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

.message {
    display: flex;
    margin-bottom: 16px;
    max-width: 100%;
    animation: fadeIn 0.3s ease-in-out;
    will-change: transform, opacity;
    position: relative;
    z-index: 10;
}

.message:last-child {
    margin-bottom: 80px;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    margin-right: 0;
    margin-left: 12px;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-avatar-inline {
    width: 40px;
    height: 40px;
    float: left;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 12px 8px 0;
    shape-outside: inset(0 round 12px);
}

.message-avatar-inline img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-avatar-inline .emoji-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background-color: rgba(255, 45, 85, 0.12);
}

.message-content {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.message-content { min-height: 40px; display: flow-root; min-width: 220px; }

.message-content.editing .message-avatar-inline { display: none; }

.message.user .message-content {
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.4), rgba(255, 45, 85, 0.2));
    border-color: rgba(255, 45, 85, 0.3);
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.2);
}

.message-text {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
    margin: 0;
    padding: 0;
    word-wrap: break-word;
}

.message-content.editing {
    min-width: 360px;
    max-width: 760px;
}

.message-edit-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--glass-bg);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
    resize: vertical;
}

@media (max-width: 480px) {
    .message-content.editing { min-width: 90%; max-width: 99%; }
    .message-edit-textarea { min-height: 150px; }
}

@media (max-width: 360px) {
    .message-avatar-inline { width: 36px; height: 36px; }
    .message-content { min-width: 180px; }
}

@media (max-width: 330px) {
    .message-avatar-inline { display: none; }
}

.message-text .action {
    font-style: italic;
    color: rgba(66, 192, 251, 0.8);
}

.message.user .message-text .action {
    color: rgba(255, 255, 255, 0.8);
}

/* Индикатор загрузки */
.loading {
    background-color: transparent !important;
    padding: 8px !important;
}

.loading-text {
    display: inline-block;
}

.shining-text {
    background: linear-gradient(110deg, #3A2530 35%, #ffffff 50%, #3A2530 75%, #3A2530);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 15px;
    font-weight: 500;
    animation: shineGradient 2s linear infinite;
}

@keyframes shineGradient {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
    box-shadow: 0 0 10px var(--neon-purple);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
    opacity: 0.7;
}

.reveal-word {
    opacity: 0;
    filter: blur(10px);
}

.reveal-word.revealed {
    opacity: 1;
    filter: blur(0);
}

/* Поле ввода */
.chat-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(20, 20, 30, 0.85);
    border: 1px solid transparent;
    outline: none;
    border-radius: 20px;
    width: auto;
    max-width: none;
    padding: 6px;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    left: 8px;
    right: 8px;
    transform: none;
    box-sizing: border-box;
    z-index: 20;
    overflow: visible;
    transition: bottom 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chat-input:focus-within {
    border-color: rgba(64, 169, 255, 0.8);
    box-shadow: 0 0 20px rgba(64, 169, 255, 0.5), 0 4px 30px rgba(0, 0, 0, 0.3);
}

.chat-input .input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input input { flex: 1; padding: 10px 14px; border: none; font-size: 15px; background-color: transparent; color: var(--text-color); outline: none; border-radius: 0; transition: none; }

.chat-input textarea { 
    flex: 1; 
    padding: 10px 14px; 
    padding-right: 10px; 
    border: none; 
    font-size: 15px; 
    background-color: transparent; 
    color: var(--text-color); 
    outline: none; 
    border-radius: 0; 
    transition: none; 
    min-height: 44px; 
    max-height: 140px; 
    resize: none; 
    overflow-y: auto; 
    box-sizing: border-box; 
    min-width: 0; 
    line-height: 1.4; 
    margin-right: 0; 
    z-index: 1; 
}

.chat-input textarea:focus { 
    background-color: transparent; 
    border-color: transparent; 
    box-shadow: none; 
}

.chat-input textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.chat-input input:focus { 
    background-color: transparent; 
    border-color: transparent; 
    box-shadow: none; 
}

.chat-input input::placeholder {
    color: var(--tg-theme-hint-color);
    font-weight: 400;
}

.chat-input .input-row button { display: none; }
/* Кнопка отправки теперь в нижней панели */
#send-button { background: transparent; color: var(--neon-blue); border: none; padding: 0; border-radius: 50%; cursor: pointer; font-weight: 600; font-size: 26px; transition: transform 0.2s ease, color 0.2s ease; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: auto; }

#send-button::before { content: "➤"; opacity: 1; transform: rotate(-90deg); display: inline-block; margin-top: -2px; }

#send-button:hover { background: transparent; transform: scale(1.1); }

#send-button:active { transform: scale(0.96); }

#send-button:disabled { background: transparent; color: var(--tg-theme-hint-color); opacity: 0.5; }

.chat-controls .image-btn { background: transparent; border: none; width: 32px; height: 32px; border-radius: 6px; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--tg-theme-hint-color); }

.chat-controls .image-btn img { width: 20px; height: 20px; opacity: 0.8; filter: grayscale(0%); }

.chat-controls .image-btn:hover { background: rgba(255,255,255,0.08); }

.chat-controls .image-btn::before {
    content: none;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 4px 8px;
}

.model-select-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: none; color: var(--text-color); padding: 6px 8px; border-radius: 6px; font-size: 13px; font-weight: 500; transition: background 0.2s; }
.model-select-btn:hover { background: rgba(255,255,255,0.08); }

.model-select-btn .sparkle { display: none; }
.model-select-btn .model-icon-text { font-size: 16px; line-height: 1; display: inline-block; transform: translateY(1px); font-family: 'Segoe UI Emoji','Apple Color Emoji','Noto Color Emoji',sans-serif; opacity: 0.9; }

.model-select-btn .model-cost { display: none; }

.model-select-btn .caret {
    opacity: 0.5;
    font-size: 10px;
    margin-left: 2px;
}

.model-dropdown { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 8px; background: rgba(16,16,24,0.8); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; z-index: 200; padding: 6px; backdrop-filter: blur(20px); max-height: 260px; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

.model-dropdown.hidden { display: none; }

.model-option { width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 12px; border: none; border-radius: 8px; background: transparent; color: var(--text-color); cursor: pointer; font-size: 14px; position: relative; min-height: 36px; transition: background 0.2s; }

.model-option:hover { background: rgba(255,255,255,0.08); }

.model-option.active { background: rgba(255,255,255,0.12); font-weight: 600; }

.model-option .model-option-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.model-option .model-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-option .model-badge { display: none; }
.model-option .model-icon { font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-family: 'Segoe UI Emoji','Apple Color Emoji','Noto Color Emoji',sans-serif; }

.model-option .model-price {
    display: inline-block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: auto;
    margin-right: 24px;
    font-weight: 500;
}

.model-option.active::after { content: '✓'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--neon-blue); font-size: 16px; font-weight: bold; }

@media (max-width: 480px) {
    .model-select-btn { font-size: 13px; padding: 8px 10px; }
    .chat-controls { gap: 8px; }
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(28, 12, 19, 0.4);
    backdrop-filter: blur(25px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-around;
    padding: 12px 8px;
    z-index: 100;
    margin: 0 8px 8px 8px;
    border-radius: 20px;
}

/* Мобильная подстройка нижнего бара */
@media (max-width: 480px) {
    .chat-input { gap: 10px; padding: 10px; }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--tg-theme-hint-color);
    text-decoration: none;
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 12px;
    min-width: 0;
    flex: 1;
}

.nav-item.active {
    color: var(--text-color);
    background: var(--gradient-primary);
    box-shadow: 0 4px 20px rgba(255, 45, 85, 0.4);
    border-radius: 16px;
    transform: translateY(-2px);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    display: block;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Предлоадер */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(420px 300px at 78% 18%, rgba(255, 141, 168, 0.12), transparent 58%), #0D0509;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: white;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #FF2D55;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.loader-subtext {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Магазин */
.shop-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.shop-item {
    background-color: rgba(30, 10, 60, 0.7);
    border-radius: 15px;
    padding: 20px;
    margin: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.shop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 255, 0.2);
}

.shop-item-image {
    margin-bottom: 10px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crystal-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(0, 150, 255, 0.7));
}

.shop-item:hover .crystal-image {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 15px rgba(0, 200, 255, 0.9));
}

.shop-item-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 16px;
}

.shop-item-amount {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 10px;
}

.shop-item-price {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #4a00e0;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Настройки */
.model-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-container .model-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(28, 12, 19, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.model-container .model-card:hover {
    background: rgba(49, 43, 93, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 45, 85, 0.2);
}

.model-container .model-card.selected {
    background: rgba(255, 45, 85, 0.15);
    border: 2px solid var(--neon-purple);
    box-shadow: 
        0 0 20px rgba(255, 45, 85, 0.3),
        inset 0 0 10px rgba(255, 45, 85, 0.2);
    animation: selectedPulse 2s infinite;
}

.model-container .model-card.selected::after {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #FF2D55;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: popIn 0.3s ease-out;
}

.model-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--card-border-radius);
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(28, 12, 19, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.model-info {
    flex: 1;
    min-width: 200px;
    width: 100%;
}

.model-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    white-space: nowrap;
}

.model-name .crystal-icon {
    color: var(--crystal-color);
}

.model-name .model-cost {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 14px;
    color: var(--crystal-color);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.model-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    word-break: break-word;
}

/* Контейнер приложения */
#app {
    max-width: 600px;
    margin: 0 auto;
    padding-top: 10px;
    padding-bottom: 80px;
}

/* Стили для страницы входа и регистрации */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-form {
    background-color: var(--secondary-background-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: center;
}

.login-form p {
    color: var(--tg-theme-hint-color);
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    background-color: var(--secondary-background-color);
    color: var(--text-color);
}

.login-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.login-btn:hover {
    background-color: #C2185B;
}

.error-message {
    background-color: rgba(229, 57, 53, 0.2);
    color: #FF4D6D;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.register-link, .telegram-login {
    text-align: center;
    margin-top: 20px;
}

.register-link a, .telegram-login a {
    color: var(--crystal-color);
    text-decoration: none;
}

.register-link a:hover, .telegram-login a:hover {
    text-decoration: underline;
}

.telegram-login p {
    margin-top: 25px;
    margin-bottom: 5px;
    color: var(--tg-theme-hint-color);
    position: relative;
}

.telegram-login p:before, .telegram-login p:after {
    content: "";
    display: block;
    width: 30%;
    height: 1px;
    background-color: var(--border-color);
    position: absolute;
    top: 50%;
}

.telegram-login p:before {
    left: 0;
}

.telegram-login p:after {
    right: 0;
}

.telegram-btn {
    display: inline-flex;
    align-items: center;
    background-color: #0088cc;
    color: white;
    border-radius: var(--border-radius);
    padding: 8px 15px;
    text-decoration: none;
    font-weight: 500;
    margin-top: 10px;
}

.telegram-btn img {
    height: 20px;
    margin-right: 10px;
}

.user-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.logout-btn {
    display: inline-block;
    background-color: rgba(255, 45, 85, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 5px 15px;
    text-decoration: none;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Контейнер персонажей */
.characters-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px;
    margin-bottom: 70px;
    position: relative;
    z-index: 1;
    will-change: transform;
}

/* Добавим эффект размытия и фон */
.characters-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at center,
        rgba(255, 45, 85, 0.05) 0%,
        transparent 70%
    );
    z-index: -1;
    pointer-events: none;
}

@keyframes smoothReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.character-card {
    border-radius: var(--card-border-radius);
    overflow: hidden;
    position: relative;
    border: none;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    transform: translateZ(0);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 240px;
    aspect-ratio: 4/5;
    box-shadow: 0px 4px 4px 0px #923FE425;
    animation: smoothReveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
    contain: paint layout; /* Оптимизация рендеринга */
}

.character-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.character-image {
    display: none;
}

.character-card:hover .character-image {
    filter: brightness(1.1);
}

.character-info {
    padding: 16px;
    background: linear-gradient(180deg,rgba(74, 41, 122, 0) 1%, rgba(0, 0, 0, 0.85) 80%);
    transition: all 0.3s ease;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 var(--card-border-radius) var(--card-border-radius);
    z-index: 5;
}

.character-card:hover .character-info {
    background: linear-gradient(180deg,rgba(74, 41, 122, 0) 1%, rgba(0, 0, 0, 0.95) 80%);
}

.character-name {
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 4px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Упрощенная тень */
    transition: all 0.3s ease;
}

.character-card:hover .character-name {
    color: #ffffff;
}

.character-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    /* text-shadow убран для производительности */
    line-height: 1.6;
    margin-top: 8px;
    padding: 0 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.character-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: gentle-pulse 3s infinite alternate;
    z-index: 2;
}

.character-badge.female {
    background: linear-gradient(135deg, #FF76C8, #FF4DC4);
    color: white;
}

.character-badge.male {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

@keyframes gentle-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    }
}

/* Tabs Redesign - Modern & Sleek */
.tabs {
    display: flex;
    margin: 0 16px 16px;
    border-radius: 24px;
    /* Removed old background/shadow */
    background: transparent;
    box-shadow: none;
    overflow: visible;
    position: relative;
    backdrop-filter: none;
    padding: 0;
    border: none;
    will-change: transform;
    gap: 10px;
}

.tab {
    flex: 1;
    padding: 8px 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5); /* Dimmed text */
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase; /* Modern look */
    letter-spacing: 0.5px;
}

.tab.active {
    color: #ffffff;
    box-shadow: none;
    transform: none;
}

.tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
}

/* Remove old specific tab colors */
.tab[data-tab="female"].active,
.tab[data-tab="male"].active,
.tab[data-tab="community"].active,
.tab[data-tab="world"].active {
    background: transparent;
}

.tab-indicator {
    display: none;
}

/* Custom Width Tabs - Main Navigation */
.custom-width-tabs {
    display: flex;
    gap: 0;
    padding: 0 16px 0 16px; /* Remove bottom padding to align with border */
    justify-content: space-between;
    background: transparent;
    border-radius: 0;
    margin: 0 0 20px 0; /* Full width, no side margins */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    scrollbar-width: none;
    height: 54px; /* Slightly taller for double line text */
    align-items: center;
}

.custom-width-tabs::-webkit-scrollbar {
    display: none;
}

.custom-width-tabs .small-tab,
.custom-width-tabs .large-tab {
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    min-width: auto;
    text-align: center;
    height: 100%; /* Fill container height */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    flex: 1; /* Distribute width equally */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.custom-width-tabs .small-tab:hover,
.custom-width-tabs .large-tab:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}

.custom-width-tabs .small-tab.active,
.custom-width-tabs .large-tab.active {
    background: transparent;
    color: #ffffff;
    font-weight: 800;
}

/* Underline Effect for Main Tabs - Base Style */
.custom-width-tabs .small-tab.active::after,
.custom-width-tabs .large-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    width: 80%;
    height: 4px;
    border-radius: 4px 4px 0 0;
    animation: fadeInWidth 0.3s ease;
}

/* Specific Color Accents for Tabs */
.custom-width-tabs .tab[data-tab="female"].active::after {
    background: linear-gradient(90deg, #FF0055, #FF00AA); /* Vivid Pink to Magenta */
    box-shadow: 0 -2px 10px rgba(255, 0, 85, 0.5);
}

.custom-width-tabs .tab[data-tab="male"].active::after {
    background: linear-gradient(90deg, #00c6ff, #0072ff); /* Cyan to Blue */
    box-shadow: 0 -2px 10px rgba(0, 198, 255, 0.5);
}

.custom-width-tabs .tab[data-tab="community"].active::after,
.custom-width-tabs .tab[data-tab="world"].active::after {
    background: linear-gradient(90deg, #ae00ff, #5b247a); /* Purple to Dark Purple */
    box-shadow: 0 -2px 10px rgba(174, 0, 255, 0.5);
}

@keyframes fadeInWidth {
    from { width: 0; opacity: 0; left: 50%; }
    to { width: 80%; opacity: 1; left: 10%; }
}

/* Crystal Counter */
.crystal-counter {
    background: #2D1B4E; /* Dark Purple Box */
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Community Page Filters (Text & Glow style) - Redesigned V2 */
.tabs:not(.custom-width-tabs) {
    justify-content: flex-start;
    gap: 24px;
    overflow-x: auto;
    padding: 8px 16px 16px 16px; /* Reduced top padding */
    margin: 0;
    width: 100%;
    scrollbar-width: none;
    align-items: center; /* Align items vertically */
}

/* ... existing scrollbar styles ... */

.tabs:not(.custom-width-tabs)::-webkit-scrollbar {
    display: none;
}

.tabs:not(.custom-width-tabs) .tab {
    /* ... existing tab styles ... */
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    flex: 0 0 auto;
    height: auto;
    border: none;
    text-transform: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

/* ... existing tab margins ... */

.tabs:not(.custom-width-tabs) .tab:first-child {
    margin-left: 8px;
}

/* Search Styles */
.community-search-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto; /* Push to the right if possible, or just sit there */
    margin-right: 16px;
}

.search-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.search-input-container {
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    margin-left: 0;
    opacity: 0;
}

.search-input-container.active {
    width: 160px;
    margin-left: 8px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 1;
    backdrop-filter: blur(10px);
}

.search-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    width: 100%;
    padding: 6px 0;
    outline: none;
    font-family: 'TildaSans', sans-serif;
    font-weight: 500;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Hide last-child margin for tabs if search is present? */
/* Actually, let's just let flex gap handle it, but I added margin-right to last-child tab previously. */
/* I might need to adjust that if search is appended. */

/* Active State - Glowing Text Only */
.tabs:not(.custom-width-tabs) .tab.active {
    background: transparent;
    color: #ffffff;
    border: none;
    box-shadow: none;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

/* Узкие экраны: шапка — ужимаем группу подарок+баланс+колокольчик,
   заголовок сжимается с многоточием, чтобы группа не уезжала за край */
@media (max-width: 400px) {
    .header h1 {
        font-size: 22px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .header-actions {
        gap: 4px;
    }
    .header-actions .crystal-counter {
        padding: 6px 10px;
        gap: 5px;
        font-size: 14px;
    }
    .header-actions .daily-bonus-btn {
        padding: 6px 10px;
    }
    .header-actions .bonus-text {
        font-size: 13px;
    }
    .header-actions .notification-bell-container {
        width: 32px;
        height: 32px;
    }
    .header-actions .notification-bell-icon {
        width: 20px;
        height: 20px;
    }
}
.tabs:not(.custom-width-tabs) .tab:hover:not(.active) {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}



/* Страница персонажей */
.filter-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.filter-btn {
    background-color: var(--secondary-background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--text-color);
}

.character-avatar {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: var(--card-border-radius) var(--card-border-radius) 0 0;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.select-character-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary-color), rgba(255, 45, 85, 0.7));
    color: white;
    border: none;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0 0 var(--card-border-radius) var(--card-border-radius);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.2);
    backdrop-filter: blur(5px);
    letter-spacing: 0.5px;
}

.select-character-btn:hover {
    background: linear-gradient(135deg, #8175e4, #6355d3);
    box-shadow: 0 6px 20px rgba(255, 45, 85, 0.4);
}

.select-character-btn:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.select-character-btn:hover:before {
    opacity: 1;
    left: 100%;
    top: 100%;
    transition: all 0.5s ease;
}

.empty-state {
    text-align: center;
    padding: 30px 0;
    color: var(--tg-theme-hint-color);
}

/* Страница чата */
.chat-header {
    display: flex !important;
    align-items: center !important;
    padding: 2px 15px !important;
    background-color: var(--secondary-background-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
}

.chat-header .back-btn {
    background: none !important;
    border: none !important;
    color: var(--text-color) !important;
    font-size: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 11 !important;
    line-height: 1 !important;
}

.chat-header .character-info {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.character-avatar-small {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
    object-fit: cover !important;
    margin-top: 0 !important;
}

.chat-header h2 {
    font-size: 13px !important;
    margin: 0 !important;
    color: var(--text-color) !important;
    text-align: center !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

.chat-header .crystals-counter {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 12px !important;
}

.crystals-counter {
    display: flex;
    align-items: center;
    color: var(--crystal-color);
    font-weight: 600;
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-radius: var(--border-radius) 0 var(--border-radius) var(--border-radius);
}

.assistant-message {
    background-color: var(--secondary-background-color);
    color: var(--text-color);
    align-self: flex-start;
    border-radius: 0 var(--border-radius) var(--border-radius) var(--border-radius);
}

.system-message {
    background-color: rgba(255, 193, 7, 0.2);
    color: #F3D9A4;
    text-align: center;
    margin: 10px auto;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    max-width: 80%;
}

.message-time {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
    margin-top: 5px;
}



/* Скрываем нижнюю навигацию на странице чата */
.chat-page .bottom-nav {
    display: none;
}

/* Увеличиваем отступ снизу для чата */
.chat-page .chat-container {
    padding-bottom: 0;
    margin-bottom: 0;
    height: calc(100vh - 140px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingAnimation {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@media (min-width: 500px) {
    .characters-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .shop-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Настройки */
.settings-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 12px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header h1 {
    font-size: 24px;
    color: #fff;
    margin: 0;
}

.crystal-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #341421;
    border-radius: 12px;
    border: none;
}

.model-container {
    display: grid;
    gap: 16px;
}

.models-grid {
    display: grid;
    gap: 16px;
}

.model-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(28, 12, 19, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.model-card:hover {
    background: rgba(49, 43, 93, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 45, 85, 0.2);
}

.model-card.selected {
    background: rgba(255, 45, 85, 0.15);
    border: 2px solid var(--neon-purple);
    box-shadow: 
        0 0 20px rgba(255, 45, 85, 0.3),
        inset 0 0 10px rgba(255, 45, 85, 0.2);
    animation: selectedPulse 2s infinite;
}

.model-card.selected::after {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #FF2D55;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: popIn 0.3s ease-out;
}

.model-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--card-border-radius);
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(28, 12, 19, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.model-info {
    flex: 1;
    min-width: 200px;
    width: 100%;
}

.model-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
}

.model-name .crystal-icon {
    color: var(--crystal-color);
}

.model-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    word-break: break-word;
}

/* Удаляем старый стиль для бейджа "выбрано" */
.model-selected {
    display: none;
}

/* Страница настроек */
.profile-card {
    background-color: var(--secondary-background-color);
    border-radius: var(--card-border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.profile-info p {
    margin-bottom: 10px;
    font-size: 16px;
    color: var(--text-color);
}

.crystal-amount {
    color: var(--crystal-color);
    font-weight: 600;
}

.models-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .models-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.model-selected-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
}

.select-model-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
}

.referral-card {
    background-color: var(--secondary-background-color);
    border-radius: var(--card-border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.referral-description {
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-theme-hint-color);
}

.referral-code-section {
    margin-bottom: 20px;
}

.referral-code-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-color);
}

.referred-friends h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.referral-list {
    list-style: none;
    padding-left: 0;
}

.referral-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 14px;
}

.navigation {
    margin-top: 30px;
    text-align: center;
}

.back-btn {
    display: inline-block;
    background-color: var(--secondary-background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 20px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: var(--border-color);
}

.referral-section {
    background: rgba(28, 12, 19, 0.5);
    border-radius: var(--card-border-radius);
    padding: 20px;
    margin-top: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.referral-info p {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.referral-code {
    background: rgba(28, 12, 19, 0.7);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.referral-code-text {
    flex: 1;
    color: var(--text-color);
    font-size: 14px;
    word-break: break-all;
}

.copy-btn {
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.copy-btn:hover {
    background-color: #C2185B;
}

.copy-btn.copied {
    background-color: #43a047;
}

@media screen and (max-width: 480px) {
    .model-card {
        padding: 12px;
    }
    
    .model-card.selected {
        border-width: 1.5px;
    }
    
    .model-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .model-name {
        font-size: 14px;
    }
    
    .model-description {
        font-size: 12px;
    }
    
    .crystal {
        font-size: 12px;
        padding: 2px 6px;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 45, 85, 0.3),
                   inset 0 0 10px rgba(255, 45, 85, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 45, 85, 0.4),
                   inset 0 0 15px rgba(255, 45, 85, 0.3);
    }
}

/* Стили для кнопки ежедневного бонуса */
/* Правая группа шапки: подарок, баланс, колокольчик одним рядом с равным зазором */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.daily-bonus-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, var(--neon-pink), var(--neon-purple));
    border-radius: 20px;
    padding: 10px 14px;
    margin: 0;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.25);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.daily-bonus-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
}

.daily-bonus-btn:active {
    transform: scale(0.98);
}

.daily-bonus-btn.claimed {
    background: linear-gradient(45deg, #28a745, #20c997);
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
    animation: none;
}

.bonus-icon {
    font-size: 16px;
    margin-right: 6px;
}

/* Награда забрана: остаётся только 🎁 без суммы — убираем лишний отступ */
.daily-bonus-btn .bonus-icon:only-child {
    margin-right: 0;
}

.bonus-text {
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    color: white;
    font-size: 14px;
}

.bonus-claimed {
    font-size: 18px;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-3px);
    }
}

@keyframes shine {
    0% {
        left: -100%;
    }
    20% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

/* Стили для уведомлений */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 1000;
    font-weight: 500;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    animation: fadeInOut 3s forwards;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 400px;
    max-width: 90vw;
    min-width: 280px;
}

.notification.success {
    background: rgba(40, 167, 69, 0.8);
}

.notification.error {
    background: rgba(220, 53, 69, 0.8);
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Стили для уведомления о ежедневной награде */
.daily-reward-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    width: 300px;
    background: rgba(30, 27, 44, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(255, 45, 85, 0.5),
                0 0 40px rgba(66, 192, 251, 0.3);
    border: 1px solid rgba(255, 45, 85, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.3s ease;
}

.daily-reward-notification.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.notification-icon {
    font-size: 40px;
    margin-right: 15px;
    animation: floating 2s ease-in-out infinite alternate;
}

.notification-text h3 {
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    font-size: 18px;
    margin: 0 0 5px 0;
    background: linear-gradient(45deg, var(--neon-pink), var(--crystal-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.notification-text p {
    font-size: 14px;
    margin: 0;
    color: var(--tg-theme-hint-color);
}

.notification-buttons {
    display: flex;
    gap: 10px;
}

.notification-buttons button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.claim-btn {
    background: linear-gradient(45deg, var(--neon-purple), var(--crystal-color));
    color: white;
    box-shadow: 0 0 10px rgba(255, 45, 85, 0.4);
}

.claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.6);
}

.later-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tg-theme-hint-color);
    backdrop-filter: blur(5px);
}

.later-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

@keyframes floating {
    0% {
        transform: translateY(0) rotate(0);
    }
    50% {
        transform: translateY(-5px) rotate(5deg);
    }
    100% {
        transform: translateY(0) rotate(-5deg);
    }
}

/* Стили для списка чатов */
.chat-list-container {
    padding: 0 12px;
    margin: 10px 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Стили для страницы чатов */
.history-container {
    margin-top: 10px;
    padding: 0 10px;
}

.history-card {
    position: relative;
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    background-color: rgba(28, 12, 19, 0.6);
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.2);
    border: 1px solid rgba(255, 45, 85, 0.2);
    backdrop-filter: blur(5px);
    min-height: 72px;
}

.history-card:hover {
    background-color: rgba(28, 12, 19, 0.8);
    box-shadow: 0 0 20px rgba(255, 45, 85, 0.4);
    transform: translateY(-2px);
    animation: chatGlow 2s infinite alternate;
}

.history-card .character-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.history-card .character-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.history-card .character-name {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}



.history-card .message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.history-card .last-message {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    opacity: 0.8;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.history-card .last-message-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    opacity: 0.6;
    flex-shrink: 0;
}

.history-card .delete-chat-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.history-card .delete-chat-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 45, 85, 0.4);
}

.history-card .delete-chat-btn:active {
    transform: scale(0.95);
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    animation: pulse 1.5s infinite;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color);
    font-size: 16px;
}

.history-card .nav-arrow {
    font-size: 20px;
    color: var(--tg-theme-hint-color);
    opacity: 0.6;
    margin-left: 12px;
    flex-shrink: 0;
}

.history-card.fade-out {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes chatGlow {
    0% {
        box-shadow: 0 0 15px rgba(255, 45, 85, 0.3);
    }
    100% {
        box-shadow: 0 0 25px rgba(255, 45, 85, 0.6), 0 0 40px rgba(66, 192, 251, 0.2);
    }
}

.create-character-btn {
    display: block;
    margin: 15px auto 20px;
    padding: 14px 28px;
    background: linear-gradient(45deg, #7A1233, #C2185B);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(160, 68, 255, 0.4);
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    width: 90%;
    max-width: 400px;
    position: relative;
    overflow: hidden;
}

.create-character-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(160, 68, 255, 0.6);
}

.create-character-btn:before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, #C2185B, #7A1233, #C2185B);
    background-size: 200% 200%;
    animation: shine 3s infinite;
    opacity: 0;
    z-index: -1;
    border-radius: 60px;
    transition: opacity 0.3s ease;
}

.create-character-btn:hover:before {
    opacity: 0.7;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.create-character-card {
    border: 2px dashed rgba(160, 68, 255, 0.5);
    background: rgba(88, 65, 139, 0.3);
    transition: all 0.3s ease;
}

.create-character-card:hover {
    transform: translateY(-5px);
    border-color: rgba(160, 68, 255, 0.9);
    background: rgba(106, 48, 147, 0.5);
    box-shadow: 0 10px 25px rgba(160, 68, 255, 0.3);
}

.create-character-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #7A1233, #C2185B);
    margin-right: 15px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.create-character-avatar-content {
    font-size: 36px;
    font-weight: bold;
    color: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.create-character-card:hover .create-character-avatar-content {
    animation: pulse 2s infinite;
}

.add-badge {
    background: linear-gradient(45deg, #7A1233, #C2185B);
    color: white;
    font-size: 18px;
    font-weight: bold;
}

/* Стили для индикатора ежедневной награды на пустой странице чатов */
.daily-reward-indicator {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: pulse 2s infinite;
}

.daily-reward-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.daily-reward-text {
    font-size: 14px;
    line-height: 1.5;
    color: #fff;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Улучшаем стили для сообщения о пустой истории */
.empty-message {
    margin: 30px 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    text-align: center;
}

.empty-message-text {
    font-size: 18px;
    margin-bottom: 10px;
}

.empty-message-tip {
    font-size: 14px;
    opacity: 0.7;
}

.buy-character-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #E8B96A, #ff5e5e);
    color: white;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    border-radius: 0 0 var(--card-border-radius) var(--card-border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 94, 94, 0.3);
    backdrop-filter: blur(5px);
    letter-spacing: 0.5px;
}

.buy-character-btn:hover {
    background: linear-gradient(135deg, #ffae30, #ff7070);
    box-shadow: 0 6px 20px rgba(255, 94, 94, 0.5);
    transform: translateY(-2px);
}

.buy-character-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(255, 94, 94, 0.3);
}

.buy-character-btn:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.buy-character-btn:hover:before {
    opacity: 1;
    left: 100%;
    top: 100%;
    transition: all 0.5s ease;
}

.character-price {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.price-value {
    margin-right: 5px;
    font-size: 18px;
    color: #F3D9A4;
}

.price-currency {
    font-size: 20px;
    filter: drop-shadow(0 0 3px rgba(255, 204, 0, 0.5));
    animation: gentle-shine 2s infinite alternate;
}

@keyframes gentle-shine {
    0% {
        filter: drop-shadow(0 0 3px rgba(255, 204, 0, 0.3));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 6px rgba(255, 204, 0, 0.6));
        transform: scale(1.05);
    }
}

.premium-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #F3D9A4, #E8B96A);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(255, 157, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    animation: pulsate 2s infinite alternate;
}

@keyframes pulsate {
    0% {
        box-shadow: 0 2px 10px rgba(255, 157, 0, 0.5);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 157, 0, 0.8);
        transform: scale(1.05);
    }
}

/* Изменим отображение карточек на мобильных устройствах */
@media (max-width: 500px) {
    .characters-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    /* Мобильная адаптация для заголовка чата */
    .header {
        padding: 6px 12px 2px 12px !important;
    }
    
    .header-center {
        margin-top: -8px !important;
    }
    
    .chat-title {
        font-size: 16px !important;
        margin-bottom: 1px !important;
    }
    
    .clear-chat-btn {
        padding: 4px 10px !important;
        font-size: 10px !important;
        margin-top: -3px !important;
    }
}

/* Адаптация для планшетов и небольших десктопов */
@media (min-width: 768px) {
    .characters-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
        padding: 24px;
    }
    
    .character-card {
        max-width: 220px;
    }
}

/* Дополнительная адаптация чата для планшетов */
@media (max-width: 768px) {
    .chat-container .chat-header {
        padding: 2px 12px !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .chat-container .chat-header .back-btn {
        font-size: 17px !important;
        left: 10px !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .chat-container .chat-header .character-info {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .chat-container .chat-header h2 {
        font-size: 13px !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    
    .chat-container .character-avatar-small {
        width: 22px !important;
        height: 22px !important;
        margin-right: 7px !important;
        margin-top: 0 !important;
    }
    
    .chat-container .chat-header .crystals-counter {
        right: 10px !important;
        font-size: 12px !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
}

/* Адаптация для больших экранов */
@media (min-width: 1200px) {
    .characters-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 30px;
        padding: 30px 40px;
        max-width: 1400px;
        margin: 0 auto 70px auto;
    }
    
    .character-card {
        max-width: 250px;
    }
}

.character-card.selected {
    border: 2px solid transparent;
    background-image: 
        linear-gradient(rgba(28, 12, 19, 0.6), rgba(28, 12, 19, 0.6)),
        linear-gradient(135deg, rgba(255, 105, 180, 0.7) 0%, rgba(255, 45, 85, 0.7) 50%, rgba(66, 192, 251, 0.7) 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 25px rgba(255, 45, 85, 0.5);
    position: relative;
    transform: translateY(-3px);
}

.character-card.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #F3D9A4, #FF2D55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(66, 192, 251, 0.5);
    z-index: 10;
    animation: selected-pulse 2s infinite alternate;
}

.character-card.selected .character-image {
    filter: brightness(1.1) contrast(1.05);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.character-card.selected .character-name {
    background: linear-gradient(90deg, #ffffff, #F3D9A4);
    -webkit-background-clip: text;
    background-clip: text;
}

.character-card.selected .select-character-btn {
    background: linear-gradient(135deg, #F3D9A4, #FF2D55);
    box-shadow: 0 4px 15px rgba(66, 192, 251, 0.3);
}

.character-card.selected .select-character-btn:hover {
    background: linear-gradient(135deg, #54d0ff, #8378e4);
    box-shadow: 0 6px 20px rgba(66, 192, 251, 0.5);
}

@keyframes selected-pulse {
    0% {
        box-shadow: 0 0 5px rgba(66, 192, 251, 0.5);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 15px rgba(66, 192, 251, 0.8);
        transform: scale(1.1);
    }
}

/* Стили для модального окна оплаты */
.payment-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8) !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.payment-modal-content {
    background: linear-gradient(135deg, rgba(28, 12, 19, 0.9), rgba(30, 27, 44, 0.95)) !important;
    border: 1px solid rgba(255, 45, 85, 0.3) !important;
    padding: 30px !important;
    border-radius: var(--card-border-radius) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    text-align: center;
    max-width: 450px !important;
    width: 90% !important;
    position: relative;
    overflow: hidden;
}

.payment-modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: linear-gradient(45deg, 
        rgba(255, 45, 85, 0.03) 0%, 
        rgba(66, 192, 251, 0.03) 25%, 
        rgba(255, 105, 180, 0.03) 50%, 
        rgba(66, 192, 251, 0.03) 75%, 
        rgba(255, 45, 85, 0.03) 100%);
    z-index: -1;
    animation: rotatingGradients 15s linear infinite;
    opacity: 0.7;
}

.payment-modal-content h3 {
    font-size: 24px !important;
    margin-bottom: 20px !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.payment-modal-content p {
    font-size: 16px !important;
    margin-bottom: 25px !important;
    color: var(--tg-theme-hint-color) !important;
    line-height: 1.5 !important;
}

.payment-modal-content a {
    display: inline-block !important;
    padding: 14px 30px !important;
    background: linear-gradient(135deg, var(--neon-purple), var(--primary-color)) !important;
    color: white !important;
    border: none !important;
    border-radius: 28px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.payment-modal-content a:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(255, 45, 85, 0.5) !important;
}

.payment-modal-content a:active {
    transform: translateY(1px) !important;
    box-shadow: 0 3px 10px rgba(255, 45, 85, 0.4) !important;
}

#payment-status {
    font-size: 15px !important;
    margin: 20px 0 !important;
    padding: 12px !important;
    background-color: rgba(28, 12, 19, 0.7) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 45, 85, 0.15) !important;
    color: var(--tg-theme-hint-color) !important;
}

.payment-modal-content button {
    background: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 10px 20px !important;
    border-radius: 24px !important;
    color: var(--tg-theme-hint-color) !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin: 0 5px !important;
    backdrop-filter: blur(5px);
}

.payment-modal-content button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.payment-modal-content .cancel-btn {
    background: rgba(244, 67, 54, 0.1) !important;
    border: 1px solid rgba(244, 67, 54, 0.3) !important;
}

.payment-modal-content .cancel-btn:hover {
    background: rgba(244, 67, 54, 0.2) !important;
}

.payment-modal-content a::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.1) 20%, 
        rgba(255, 255, 255, 0.2) 40%, 
        rgba(255, 255, 255, 0.1) 60%, 
        rgba(255, 255, 255, 0) 80%);
    transform: rotate(25deg);
    animation: payment-shine 4s infinite ease-in-out;
    pointer-events: none;
}

@keyframes payment-shine {
    0% {
        left: -100%;
    }
    20%, 100% {
        left: 100%;
    }
}

.payment-modal-content a:hover::before {
    animation-duration: 2s;
}

.payment-modal-content a:active::before {
    opacity: 0.4;
}

/* Стили для раздела рефералов */
.referred-friends-section {
    margin-top: 20px;
    background-color: rgba(30, 10, 60, 0.7);
    border-radius: 15px;
    padding: 20px;
}

.referred-friends-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffffff;
}

.referrals-list {
    margin-top: 10px;
}

.referrals-table {
    width: 100%;
    border-collapse: collapse;
    color: #ffffff;
}

.referrals-table th,
.referrals-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.referrals-table th {
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.2);
}

.referrals-table tr:last-child td {
    border-bottom: none;
}

.referrals-table tr:hover td {
    background-color: rgba(0, 0, 0, 0.1);
}

.empty-referrals {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
}

/* Стили для контейнера потенциального баланса */
.potential-balance-container {
    background-color: rgba(25, 15, 50, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(113, 89, 193, 0.5);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

.potential-balance-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(66, 192, 251, 0.1), rgba(113, 89, 193, 0.1));
    pointer-events: none;
    z-index: -1;
}

.potential-balance-container h3 {
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 15px;
    font-weight: 500;
}

.potential-balance-value {
    font-size: 48px;
    font-weight: bold;
    color: #F3D9A4;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(66, 192, 251, 0.4);
    animation: glow 2s ease-in-out infinite alternate;
}

.potential-balance-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(66, 192, 251, 0.4);
    }
    to {
        text-shadow: 0 0 20px rgba(66, 192, 251, 0.7), 0 0 30px rgba(113, 89, 193, 0.5);
    }
}

/* Стили для реферальной системы */
.referral-section {
    margin-top: 30px;
    background-color: rgba(30, 10, 60, 0.7);
    border-radius: 15px;
    padding: 25px;
}

.section-title {
    font-size: 20px;
    color: #ffffff;
    margin-bottom: 20px;
    font-weight: 600;
}

.referral-info {
    margin-bottom: 20px;
}

.referral-info p {
    color: #ffffff;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Добавляем стили для корректного отображения чата */
.chat-page {
    /* Используем height: 100% вместо 100vh, чтобы избежать проблем с мобильными браузерами */
    height: 100%;
    /* Убираем overflow: hidden - это было причиной проблемы с прокруткой */
    display: flex;
    flex-direction: column;
    padding-bottom: 20px; /* Увеличиваем отступ снизу для всей страницы чата */
}

.page-container.chat-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%; /* Ограничиваем максимальную высоту */
    /* Убираем overflow: hidden - это блокировало прокрутку */
}

.chat-page .header {
    flex-shrink: 0; /* Запрещаем сжиматься */
    position: sticky; /* Делаем заголовок зафиксированным */
    top: 0;
    z-index: 10;
    background: transparent; /* Убрали градиент, сделали прозрачным */
    /* backdrop-filter: blur(10px); - убрали эффект размытия */
}

/* Стиль для контейнера с кнопками действий над сообщениями */
.message-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

/* При наведении делаем кнопки более яркими для лучшего UX */
.message:hover .message-actions {
    opacity: 0.9;
}

/* Стиль для отдельных кнопок */
.message-action-btn {
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-hint-color);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transform: scale(1.1);
}

.message-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Специфичные стили для кнопок */
.regenerate-btn:hover {
    color: var(--neon-blue);
}

/* Кнопка озвучки: пульс при загрузке, подсветка при проигрывании */
.voice-btn.loading {
    animation: tts-pulse 1s ease-in-out infinite;
}

.voice-btn.playing {
    color: #ff3b5c;
    opacity: 1;
}

@keyframes tts-pulse {
    50% { opacity: 0.15; }
}

.delete-btn:hover {
    color: var(--neon-pink);
}

/* Стили для центральной части заголовка */
.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin-top: -5px !important;
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px !important;
    margin-top: 0 !important;
}

.image-generator-form textarea:focus {
    border-color: #FF8FA8;
    box-shadow: 0 0 8px rgba(106, 136, 255, 0.3);
}

/* Стили для выбора модели */
.model-selector {
    position: relative;
    margin-bottom: 20px;
}

.selected-model-button {
    width: 100%;
    background-color: #241018;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
    font-size: 1em;
}

.selected-model-button:hover {
    background-color: #2E1620;
    border-color: #555;
}

.model-arrow {
    transition: transform 0.2s ease-in-out;
}

.model-arrow.up {
    transform: rotate(180deg);
}

.model-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #241018;
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out forwards;
    transform-origin: top center;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: scaleY(0.9);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

.model-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #2E1620;
}

.model-item:last-child {
    border-bottom: none;
}

.model-item:hover {
    background-color: #2E1620;
}

.model-item.selected {
    background-color: #FF8FA8;
    color: #fff;
    font-weight: bold;
}

.model-item-name {
    font-size: 1em;
}

.prompt-tips {
    margin-top: 20px;
    background-color: rgba(255, 255, 255, 0.05);
}

/* === НОВЫЕ СТИЛИ ДЛЯ УЛУЧШЕНИЙ === */

/* Контекстное меню с правилами */
.rules-context-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.rules-context-menu.show {
    display: flex;
}

.rules-menu-content {
    background: var(--card-bg-color);
    border-radius: var(--card-border-radius);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.rules-menu-content h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
}

.rules-list {
    margin-bottom: 20px;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.rule-icon {
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.rule-text {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.4;
}

.rules-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.rules-close-btn {
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.rules-close-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.rules-guide-link {
    color: var(--primary-color);
    text-decoration: none;
    padding: 12px 24px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.rules-guide-link:hover {
    background: var(--primary-color);
    color: var(--text-color);
}

/* Кнопки в карточке создания персонажа */
.create-character-card .character-info {
    padding: 16px 16px 60px 16px;
    background: transparent !important;
    pointer-events: none;
    z-index: 10;
}

.create-character-card:hover .character-info {
    background: transparent !important;
}

.create-character-actions {
    display: flex;
    gap: 6px;
    position: absolute;
    bottom: 16px;
    left: 12px;
    right: 12px;
    justify-content: space-between;
    z-index: 20;
}

.rules-btn, .guide-btn {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-btn:hover, .guide-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Страница сообщества */
.community-container {
    padding: 0 16px;
    margin-bottom: 80px;
}

.community-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-color);
}

.community-characters-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.community-character-card {
    background: var(--card-bg-color);
    border-radius: var(--card-border-radius);
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.community-character-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

/* Убраны избыточные стили для community-character-card, используются общие стили .character-image */

.community-character-card .character-info {
    margin-bottom: 12px;
}

.community-character-card .character-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.community-character-card .character-description {
    font-size: 14px;
    color: var(--secondary-color);
    line-height: 1.4;
    margin-bottom: 8px;
}

.community-character-card .character-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.community-character-card .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--secondary-color);
}

.community-character-card .stat-icon {
    font-size: 14px;
}

.community-character-card .character-actions {
    display: flex;
    gap: 8px;
}

.community-character-card .view-btn,
.community-character-card .chat-btn,
.community-character-card .buy-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.community-character-card .view-btn {
    background: var(--card-bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.community-character-card .view-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.community-character-card .chat-btn {
    background: var(--primary-color);
    color: var(--text-color);
}

.community-character-card .chat-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.community-character-card .buy-btn {
    background: var(--neon-pink);
    color: var(--text-color);
}

.community-character-card .buy-btn:hover {
    background: var(--neon-purple);
    transform: translateY(-1px);
}

/* Лайтбокс для изображений */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.image-lightbox.show {
    opacity: 1;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

/* Стили для страницы деталей персонажа */
.character-details-container {
    padding: 20px;
    margin-bottom: 80px;
    background: linear-gradient(135deg, rgba(30, 27, 44, 0.95) 0%, rgba(28, 12, 19, 0.95) 100%);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    margin: 20px;
    position: relative;
    overflow: hidden;
}

.character-details-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at center,
        rgba(255, 45, 85, 0.1) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

.character-details-container > * {
    position: relative;
    z-index: 1;
}

.character-details-image-container {
    text-align: center;
    margin-bottom: 24px;
}

.character-details-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 20px;
    object-fit: cover;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.character-details-image:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 35px rgba(255, 45, 85, 0.4);
    border-color: rgba(255, 45, 85, 0.5);
}

.character-details-info {
    margin-bottom: 24px;
}

.character-details-description {
    font-size: 16px;
    line-height: 1.6;
    color: #FFFFFF;
    margin-bottom: 16px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.character-details-detailed-description {
    font-size: 14px;
    line-height: 1.6;
    color: #B09098;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.character-details-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.character-details-likes {
    display: flex;
    align-items: center;
    gap: 12px;
}

.character-details-like-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.character-details-like-btn:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.3);
}

.character-details-like-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.character-details-like-btn .like-icon {
    font-size: 20px;
}

.character-details-like-btn .like-count {
    color: #FFFFFF;
    font-weight: bold;
}

.character-details-tags {
    margin-bottom: 24px;
}

.character-details-tags-title {
    color: #FFFFFF;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.character-details-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.character-details-tag {
    background: rgba(255, 45, 85, 0.3);
    color: #FFFFFF;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(255, 45, 85, 0.5);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.character-details-tag:hover {
    background: rgba(255, 45, 85, 0.5);
    transform: translateY(-1px);
}

.character-details-main-action {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.character-details-main-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.character-details-main-action:hover::before {
    left: 100%;
}

.character-details-main-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.character-details-main-action.chat-available {
    background: linear-gradient(45deg, #FF2D55, #C2185B);
    color: #FFFFFF;
}

.character-details-main-action.purchase-needed {
    background: linear-gradient(45deg, #FF4D6D, #ff8e8e);
    color: #FFFFFF;
}

.character-details-creator-info {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.character-details-creator-text {
    color: #B09098;
    font-size: 14px;
    margin: 0;
}

/* Адаптивные стили */
@media (max-width: 600px) {
    .community-characters-container {
        grid-template-columns: 1fr;
    }
    
    .rules-menu-content {
        width: 95%;
        padding: 16px;
    }
    
    /* Улучшения для мобильного чата */
    .chat-page {
        height: 100vh;
        padding-bottom: 10px;
    }
    
    .chat-container {
        height: calc(100vh - 120px - var(--tg-safe-area-top, 0px));
        padding-bottom: 60px;
    }
    
    .chat-messages {
        padding: 12px;
        padding-bottom: 100px;
    }
    
    /* Улучшаем заголовок на мобильных */
    .chat-page .header {
        padding: 12px 16px;
    }
    
    .chat-container .chat-header {
        padding: 1px 10px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .chat-container .chat-header .back-btn {
        font-size: 16px !important;
        left: 8px !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .chat-container .chat-header .character-info {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .chat-container .chat-header h2 {
        font-size: 12px !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    
    .chat-container .character-avatar-small {
        width: 20px !important;
        height: 20px !important;
        margin-right: 6px !important;
        margin-top: 0 !important;
    }
    
    .chat-container .chat-header .crystals-counter {
        right: 8px !important;
        font-size: 11px !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    /* Адаптация навигационных кнопок */
    .custom-width-tabs {
        margin: 10px;
        padding: 3px;
        gap: 2px;
    }
    
    .custom-width-tabs .small-tab,
    .custom-width-tabs .large-tab {
        padding: 6px 12px;
        font-size: 12px;
        height: 36px;
        min-width: 80px;
    }
    
    .custom-width-tabs .large-tab {
        min-width: 120px;
    }
    
    /* Адаптация карточек персонажей */
    .characters-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    
    .character-card {
        min-height: 180px;
    }
    
    .character-info {
        padding: 12px;
    }
    
    .character-name {
        font-size: 14px;
    }
    
    .character-description {
        font-size: 11px;
        max-height: 45px;
        -webkit-line-clamp: 2;
    }
    
    /* Адаптация нижней навигации */
    .bottom-nav {
        margin: 0 4px 4px 4px;
        padding: 8px 4px;
    }
    
    .nav-item {
        padding: 4px 6px;
    }
    
    .nav-item span {
        font-size: 9px;
    }
    
    .nav-item .nav-icon {
        width: 18px;
        height: 18px;
        margin-bottom: 2px;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    /* Адаптивность для деталей персонажа */
    .character-details-container {
        margin: 10px;
        padding: 16px;
    }
    
    .character-details-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .character-details-like-btn {
        justify-content: center;
    }
}

/* Модальные окна создания персонажа */
.create-character-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.create-character-modal.show {
    opacity: 1;
    visibility: visible;
}

.create-character-modal .modal-content {
    background: linear-gradient(135deg, #241018 0%, #1C0C13 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90%;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.create-character-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #FFFFFF;
    font-size: 20px;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #B09098;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #FFFFFF;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #FFFFFF;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(28, 12, 19, 0.5);
    color: #FFFFFF;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FF2D55;
    box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group small {
    display: block;
    color: #B09098;
    font-size: 12px;
    margin-top: 5px;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-top: 2px;
}

.checkbox-label {
    color: #FFFFFF;
    font-size: 14px;
    cursor: pointer;
}

/* Секция "Сделать публичным" */
.make-public-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.make-public-section .private-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 12px;
}

.make-public-section small {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 8px;
}

.btn-make-public {
    background: linear-gradient(135deg, #FF2D55 0%, #C2185B 100%);
    color: #FFFFFF;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.3);
}

.btn-make-public:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 45, 85, 0.4);
}

/* Статус публичного персонажа */
.public-status-info {
    text-align: center;
    padding: 12px;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.approved {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #F3D9A4;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-badge.rejected {
    background: rgba(255, 107, 107, 0.2);
    color: #FF4D6D;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
    margin-top: 10px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #FF2D55, #B09098);
    color: #FFFFFF;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8276F4, #A199CC);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: #B09098;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Модальное окно оплаты */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.payment-modal.show {
    opacity: 1;
    visibility: visible;
}

.payment-modal .modal-content {
    background: linear-gradient(135deg, #241018 0%, #1C0C13 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.payment-modal.show .modal-content {
    transform: scale(1);
}

.character-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.character-preview img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.character-preview .character-info {
    position: static;
    background: none;
    padding: 0;
    z-index: 1;
}

.character-preview .character-info h3 {
    color: #FFFFFF;
    margin: 0 0 5px 0;
    font-size: 16px;
}

.character-preview .character-info p {
    color: #B09098;
    margin: 0;
    font-size: 14px;
}

.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.confirm-modal .modal-content {
    background: linear-gradient(135deg, #241018 0%, #1C0C13 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    width: 90%;
    max-width: 420px;
    transform: scale(0.96);
    transition: transform 0.25s ease;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.confirm-modal.show .modal-content {
    transform: scale(1);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confirm-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 67, 54, 0.12);
    color: #F44336;
    font-size: 18px;
}

.confirm-title {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 600;
}

.confirm-text {
    color: var(--tg-theme-hint-color);
    font-size: 15px;
    line-height: 1.6;
}

.confirm-action {
    background: linear-gradient(135deg, #FF2D55, #B09098);
}

@media (max-width: 600px) {
    .confirm-modal .modal-content {
        width: 92%;
        max-width: 92%;
        border-radius: 18px;
    }
    .confirm-title {
        font-size: 16px;
    }
    .confirm-text {
        font-size: 14px;
    }
}

.payment-info {
    margin-bottom: 20px;
}

.cost-breakdown {
    background: rgba(28, 12, 19, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: #FFFFFF;
    font-size: 14px;
}

.cost-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cost-item.total {
    font-weight: 600;
    font-size: 16px;
    color: #FF2D55;
}

.user-crystals {
    text-align: center;
    color: #B09098;
    font-size: 14px;
}

/* Адаптив для мобильных устройств */
@media (max-width: 600px) {
    .create-character-modal .modal-content,
    .payment-modal .modal-content {
        width: 95%;
        max-height: 95%;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-secondary,
    .btn-primary {
        width: 100%;
        padding: 14px;
    }
}

/* Стили для кнопок управления персонажами */
.character-controls {
    display: flex;
    gap: 8px;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    pointer-events: none; /* Контейнер пропускает клики */
}

.edit-character-btn,
.delete-character-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%; /* Идеальный круг */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(8px);
    pointer-events: auto; /* Кнопки кликабельны */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: rgba(255, 255, 255, 0.9);
}

.edit-character-btn {
    background: rgba(30, 30, 35, 0.6);
}

.edit-character-btn:hover {
    background: rgba(255, 45, 85, 0.8);
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.4);
}

.delete-character-btn {
    background: rgba(30, 30, 35, 0.6);
}

.delete-character-btn:hover {
    background: rgba(255, 107, 107, 0.8);
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.edit-character-btn svg,
.delete-character-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Стили для rich text editor */
.rich-text-editor {
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(28, 12, 19, 0.5);
    overflow: hidden;
}

.formatting-toolbar {
    display: flex;
    gap: 2px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.format-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #FFFFFF;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.format-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.format-btn:active {
    background: rgba(255, 45, 85, 0.3);
}

.rich-text-editor textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: none;
    background: transparent;
    color: #FFFFFF;
    font-size: 14px;
    resize: vertical;
    outline: none;
    font-family: inherit;
}

.rich-text-editor textarea::placeholder {
    color: #8a8a8a;
    opacity: 1;
}

.rich-text-editor:focus-within {
    border-color: #FF2D55;
    box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.2);
}

/* Анимации для уведомлений */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}
  
.chat-input:focus-within {
    border-color: rgba(79, 76, 250, 0.555);
    box-shadow: 0 0 10px rgba(83, 108, 250, 0.5), 0 4px 30px rgba(0, 0, 0, 0.3);
}

.chat-input button { z-index: 0; }

/* Quill Alignment Classes Global Support */
.ql-align-center {
    text-align: center;
}
.ql-align-right {
    text-align: right;
}
.ql-align-justify {
    text-align: justify;
}

/* Notification Center Styles */
.notification-bell-container {
    position: relative;
    cursor: pointer;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.notification-bell-container:hover {
    background: rgba(255, 255, 255, 0.2);
}

.notification-bell-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--gradient-secondary);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    max-height: 80vh;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--card-border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

@media (max-width: 480px) {
    .notification-dropdown {
        position: fixed;
        top: 70px;
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        max-height: 70vh;
    }
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header span:first-child {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color);
}

.clear-all {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-all:hover {
    color: var(--text-color);
}

.notification-list {
    overflow-y: auto;
    max-height: 400px;
    padding: 10px;
}

/* Notification Item - Revised */
.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.notification-item:last-child {
    margin-bottom: 0;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.notification-item.unread {
    background: rgba(255, 45, 85, 0.1);
    border-color: rgba(255, 45, 85, 0.3);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    display: none; /* Hidden because we use background color for unread */
}

/* Icon Styles */
.notification-item .notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    /* Reset global styles */
    animation: none;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
}

.notification-item .notification-icon svg {
    width: 20px;
    height: 20px;
    fill: none; /* Reset fill */
    stroke: currentColor;
}

/* Specific colors for icon backgrounds */
.notification-item .notification-icon.info { color: #FF2D55; background: rgba(255, 45, 85, 0.15); }
.notification-item .notification-icon.success { color: #48bb78; background: rgba(72, 187, 120, 0.15); }
.notification-item .notification-icon.warning { color: #ed8936; background: rgba(237, 137, 54, 0.15); }
.notification-item .notification-icon.error { color: #f56565; background: rgba(245, 101, 101, 0.15); }

/* Content Layout */
.notification-content {
    flex: 1;
    min-width: 0; /* Enable truncation */
    display: flex;
    flex-direction: column;
    margin-left: 0;
}

.notification-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    margin-bottom: 0;
}

.notification-time {
    font-size: 11px;
    color: var(--tg-theme-hint-color);
    white-space: nowrap;
    opacity: 0.7;
    margin-top: 0;
}

.notification-message {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    line-height: 1.4;
    word-break: break-word;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

/* ==================================================================
   CherryChat: фирменные приёмы поверх базовых стилей.
   «Хвостик вишни» — нижний левый угол почти острый (var(--cherry-radius)),
   обложки тонируются в вишнёвую температуру, метки — моноширинные.
   ================================================================== */

/* Кнопки: алый градиент, хвостик вишни, жирная гарнитура */
.btn-primary,
.buy-character-btn,
.character-details-main-action,
.daily-bonus-btn,
.send-button,
button[type="submit"] {
    border-radius: var(--cherry-radius) !important;
    background: var(--gradient-primary);
    color: var(--text-color);
    font-weight: 800;
    border: none;
}
.btn-primary:active,
.buy-character-btn:active {
    filter: brightness(0.85);
    transform: translateY(1px);
}
.btn-secondary {
    border-radius: var(--cherry-radius) !important;
    background: var(--secondary-background-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

/* Карточки и панели: вишнёвая панель, тонкая рамка, хвостик */
.character-card,
.profile-card,
.shop-item,
.chat-list-container .chat-item,
.modal-content,
.settings-container .settings-section {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--cherry-radius-lg) !important;
    overflow: hidden;
}

/* Тонировка обложек в вишнёвый — все карточки в одной температуре */
.character-card img,
.character-image,
.character-details-image,
.character-avatar,
.chat-item img {
    filter: sepia(0.18) hue-rotate(-18deg) saturate(1.12);
}

/* Чипы, бейджи, теги */
.character-badge,
.character-details-tag,
.character-price {
    border-radius: var(--cherry-radius-sm) !important;
    background: rgba(255, 141, 168, 0.1);
    border: 1px solid rgba(255, 141, 168, 0.28);
    color: var(--neon-pink);
}

/* Валюта: счётчик вишен кремово-моноширинный */
.crystal-counter,
.crystals-counter,
.crystal-amount {
    font-family: 'CherryMono', monospace;
    font-weight: 700;
}

/* Нижняя навигация: вишнёвая панель с хвостиком, без неонового стекла */
.bottom-nav {
    background: rgba(28, 12, 19, 0.94);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--cherry-radius-lg);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}
.nav-item.active {
    border-radius: var(--cherry-radius);
    box-shadow: 0 4px 18px rgba(255, 45, 85, 0.35);
}

/* Сообщения чата: реплика юзера — алая с хвостиком справа,
   ответ персонажа — панель с хвостиком слева */
.user-message {
    background: var(--gradient-primary) !important;
    border-radius: 14px 14px 4px 14px !important;
}
.assistant-message {
    background: var(--card-bg-color) !important;
    border: 1px solid var(--border-color);
    border-radius: 14px 14px 14px 4px !important;
}

/* Заголовки-метки секций — моноширинные разрядкой, как в макете */
.character-details-tags-title,
.shop-container h2,
.section-label {
    font-family: 'CherryMono', monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    color: var(--muted-color);
}

/* Выделение текста и скроллбар в тон */
::selection { background: rgba(255, 45, 85, 0.35); }
::-webkit-scrollbar-thumb { background: rgba(255, 141, 168, 0.25); border-radius: 4px; }

/* Кремовый бейдж «выгодно» */
.badge-best,
.shop-item .bonus-label {
    background: rgba(243, 217, 164, 0.14);
    border: 1px solid rgba(243, 217, 164, 0.32);
    color: var(--cream-color);
}

/* ==================================================================
   CherryChat: слой плавности. Все микро-движения на CSS —
   без фреймворков и лишнего JS.
   ================================================================== */

/* Базовая плавность интерактивных элементов */
button, a, .nav-item, .character-card, .shop-item, .tab,
.chat-item, .btn-primary, .btn-secondary, .character-details-tag,
input, textarea, select {
    transition: background-color 0.22s ease, color 0.22s ease,
                border-color 0.22s ease, box-shadow 0.25s ease,
                transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.2s ease, opacity 0.22s ease;
}

/* Появление экрана: мягкий подъём с растворением */
/* Только opacity: transform на контейнере ломает fixed-навигацию
   (анимация transform делает контейнер containing block) */
@keyframes cherry-screen-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
/* Контейнеры с fixed-навигацией внутри НЕ анимируем:
   filled-анимация делает их containing block для fixed (Chrome) */
.characters-container, .shop-container,
.settings-container, .profile-card {
    animation: cherry-screen-in 0.32s ease both;
}

/* Каскад карточек каталога: каждая чуть позже предыдущей */
@keyframes cherry-card-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.character-card, .shop-item, .chat-item {
    animation: cherry-card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.character-card:nth-child(1), .shop-item:nth-child(1), .chat-item:nth-child(1) { animation-delay: 0.03s; }
.character-card:nth-child(2), .shop-item:nth-child(2), .chat-item:nth-child(2) { animation-delay: 0.07s; }
.character-card:nth-child(3), .shop-item:nth-child(3), .chat-item:nth-child(3) { animation-delay: 0.11s; }
.character-card:nth-child(4), .shop-item:nth-child(4), .chat-item:nth-child(4) { animation-delay: 0.15s; }
.character-card:nth-child(5), .shop-item:nth-child(5), .chat-item:nth-child(5) { animation-delay: 0.19s; }
.character-card:nth-child(6), .shop-item:nth-child(6), .chat-item:nth-child(6) { animation-delay: 0.23s; }
.character-card:nth-child(n+7), .shop-item:nth-child(n+7), .chat-item:nth-child(n+7) { animation-delay: 0.27s; }

/* Карточки: живой отклик на касание */
.character-card:active, .shop-item:active, .chat-item:active {
    transform: scale(0.97);
    filter: brightness(1.06);
}

/* Кнопки: пружинка на нажатие, свечение на активной */
.btn-primary:active, .buy-character-btn:active,
.daily-bonus-btn:active, .send-button:active {
    transform: scale(0.96);
}

/* Таббар: пружинистый переход активного таба */
.nav-item { transform-origin: center bottom; }
.nav-item.active { animation: cherry-tab-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes cherry-tab-pop {
    0%   { transform: translateY(0) scale(0.9); }
    60%  { transform: translateY(-4px) scale(1.05); }
    100% { transform: translateY(-2px) scale(1); }
}

/* Сообщения чата: въезжают со своей стороны */
@keyframes cherry-msg-user {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes cherry-msg-char {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}
.user-message      { animation: cherry-msg-user 0.3s ease both; }
.assistant-message { animation: cherry-msg-char 0.3s ease both; }

/* Модалки: подъём из глубины */
@keyframes cherry-modal-in {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content { animation: cherry-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Пульс вишенки у баланса при изменении (вешается из JS классом) */
@keyframes cherry-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    100% { transform: scale(1); }
}
.crystal-counter.updated { animation: cherry-pulse 0.45s ease; }

/* Уважение к reduce-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Лого CherryChat_AI в шапке: двойная вишня + Bricolage */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.brand-cherries { display: flex; gap: 3px; }
.brand-cherries i {
    width: 9px; height: 9px; border-radius: 50%; display: block;
}
.brand-cherries i:first-child { background: #FF2D55; }
.brand-cherries i:last-child { background: #C2185B; }
.brand-name {
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 22px; font-weight: 800; letter-spacing: -0.04em;
    color: var(--text-color);
}
.brand-name i { font-style: normal; color: #FF4D6D; }

/* Чип баланса вишен — как в макете */
.crystal-counter {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 13px 7px 10px;
    border-radius: 11px 11px 11px 3px;
    background: rgba(255, 141, 168, 0.1);
    border: 1px solid rgba(255, 141, 168, 0.28);
    font-variant-numeric: tabular-nums;
}

/* Эмодзи-иконка в таббаре */
.nav-icon-emoji {
    font-size: 15px; line-height: 20px; height: 20px;
    margin-bottom: 4px; display: block;
    filter: grayscale(0.5) opacity(0.85);
}
.nav-item.active .nav-icon-emoji { filter: none; }

/* ============ Каталог по макету: hero-кадр + сетка ============ */
/* Контейнер каталога больше не сам является сеткой — внутри hero и .characters-grid.
   Сообщество продолжает класть карточки прямо в контейнер, поэтому grid-правила
   сохраняются, а прямые дети-блоки hero/метка растягиваются на всю ширину. */
.characters-container > .hero-wrap,
.characters-container > .catalog-section-label,
.characters-container > .characters-grid {
    grid-column: 1 / -1;
}
.characters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 700px) {
    .characters-grid { grid-template-columns: repeat(3, 1fr); }
}

.hero-wrap { margin-bottom: 6px; }
.hero-frame {
    height: 372px;
    border-radius: 26px 26px 26px 4px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background-color: #3D0A1D;
    background-size: cover;
    background-position: center top;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.hero-fade {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 46%, rgba(13, 5, 9, 0.92));
}
.hero-side {
    position: absolute; right: 14px; top: 96px; bottom: 104px; width: 26px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'CherryMono', monospace; font-size: 10px;
    letter-spacing: 0.28em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    writing-mode: vertical-rl;
}
.hero-text { position: absolute; left: 18px; right: 56px; bottom: 18px; }
.hero-name {
    margin: 0 0 8px;
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 38px; line-height: 0.98; letter-spacing: -0.045em; font-weight: 800;
    color: var(--text-color);
}
.hero-desc {
    margin: 0; font-size: 13.5px; line-height: 1.45; color: #E0C9CF;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 9px; margin-top: 12px; }
.hero-start {
    flex: 1; height: 50px; border: none;
    border-radius: 14px 14px 14px 4px;
    background: linear-gradient(135deg, #FF2D55, #C2185B);
    color: var(--text-color); font-size: 14.5px; font-weight: 800;
    font-family: inherit; cursor: pointer;
}
.hero-shuffle {
    width: 50px; height: 50px; flex: none;
    border-radius: 14px 14px 14px 4px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #B09098; font-size: 15px; cursor: pointer;
}
.catalog-section-label {
    margin: 4px 2px 0;
    text-align: left;
}

/* Карточка в сетке: кадр 4:5, подпись поверх нижнего затемнения */
.characters-grid .character-card {
    aspect-ratio: 4 / 5;
    background-size: cover;
    background-position: center top;
    position: relative;
}
.characters-grid .character-card .character-info {
    position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 0;
    background: none;
}
.characters-grid .character-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 48%, rgba(13, 5, 9, 0.93));
    pointer-events: none;
}
.characters-grid .character-name {
    font-size: 13.5px; font-weight: 800; letter-spacing: -0.015em;
}
.characters-grid .character-description {
    font-size: 10.5px; color: #BC9BA3; margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============ Адаптация остальных экранов под стиль CherryChat ============ */

/* Магазин: карточки пакетов и слайды тарифов */
.shop__card {
    border-radius: var(--cherry-radius-lg) !important;
    background: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
}
.shop__card-emoji { font-size: 34px; line-height: 1; display: block; margin: 6px auto 8px; }
.shop__card-cost-count { font-family: 'CherryMono', monospace; font-weight: 700; }
.shop__slide {
    border-radius: 18px 18px 18px 5px !important;
    border: 1px solid var(--border-color) !important;
}
.shop__slide-btn { border-radius: var(--cherry-radius) !important; }

/* Формы: инпуты, селекты, текстовые поля */
input[type="text"], input[type="password"], input[type="number"],
input[type="search"], textarea, select {
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--border-color);
    border-radius: var(--cherry-radius);
    color: var(--text-color);
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(255, 141, 168, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.15);
}
::placeholder { color: var(--muted-color); }

/* Табы разделов (Девушки/Парни/Сообщество) */
.tabs {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 18px 18px 18px 5px;
}
.tab.active {
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.7), rgba(194, 24, 91, 0.5));
    border-radius: var(--cherry-radius);
}

/* Пейджер слайдера и прогресс-элементы */
.swiper-pagination-bullet { background: rgba(255, 143, 168, 0.4); }
.swiper-pagination-bullet-active { background: #FF2D55; }

/* Бейджи цены на карточках */
.character-price-tag {
    border-radius: 9px 9px 9px 2px !important;
    background: rgba(13, 5, 9, 0.65) !important;
    border: 1px solid rgba(255, 141, 168, 0.35) !important;
    backdrop-filter: blur(8px);
    font-family: 'CherryMono', monospace;
}

/* Карточка «создать персонажа» — пунктир, как слот персоны в макете */
.create-character-card {
    background: rgba(255, 255, 255, 0.035) !important;
    border: 1px dashed rgba(255, 255, 255, 0.18) !important;
}

/* Всплывашки/тосты/дропдауны */
.notification-dropdown, .dropdown-menu, .toast {
    background: #1C0C13 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--cherry-radius-lg) !important;
}

/* ============ Чат по макету ============ */
.chat-header {
    background: rgba(13, 5, 9, 0.92) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(14px);
}
.chat-header .character-name,
.chat-header h2, .chat-header h3 {
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.chat-header .character-avatar,
.chat-header img {
    border-radius: 12px 12px 12px 3px !important;
}

/* Панель контролов чата: чипы моноширинные с хвостиком */
.chat-controls button,
.chat-controls .control-chip,
.model-selector-btn, .persona-chip {
    border-radius: 11px 11px 11px 3px !important;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: #BC9BA3;
    font-family: 'CherryMono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.chat-controls button.active,
.model-selector-btn.active {
    background: rgba(255, 141, 168, 0.14);
    border-color: rgba(255, 141, 168, 0.34);
    color: #FFC0CE;
}

/* Поле ввода */
.chat-input {
    background: linear-gradient(180deg, rgba(13, 5, 9, 0), #0D0509 24%) !important;
}
.chat-input input, .chat-input textarea {
    background: rgba(255, 255, 255, 0.055) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 16px 16px 16px 4px !important;
}
.send-button {
    width: 38px; height: 38px;
    border-radius: 12px 12px 12px 3px !important;
}

/* Ремарки и метки в сообщениях (кремовый mono, как в макете) */
.assistant-message em, .assistant-message i,
.message-action, .rp-action {
    font-style: normal;
    color: #BC9BA3;
}
.message-label {
    font-family: 'CherryMono', monospace;
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--cream-color);
}

/* Кнопки озвучки/кадра под сообщением */
.tts-btn, .frame-btn, .message-tools button {
    border-radius: 9px 9px 9px 2px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: none;
    font-family: 'CherryMono', monospace;
    font-size: 10.5px;
    color: var(--text-color);
}

/* Индикатор набора: вишнёвые точки */
.typing-indicator span, .typing-dots span {
    background: #FF8FA8 !important;
}

/* ============ Окно ежедневной награды по макету ============ */
.streak-modal {
    max-width: 400px;
    border-radius: 30px 30px 30px 6px !important;
    background: #1C0C13 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 24px 22px 26px !important;
}
.streak-label {
    font-family: 'CherryMono', monospace;
    font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--cream-color);
}
.streak-close {
    width: 26px; height: 26px; border: none; cursor: pointer;
    border-radius: 9px 9px 9px 2px;
    background: rgba(255, 255, 255, 0.07);
    color: #B09098; font-size: 13px; line-height: 1;
}
.streak-amount {
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 46px; line-height: 1; letter-spacing: -0.05em; font-weight: 800;
    margin-bottom: 8px; color: var(--text-color);
}
.streak-hint { margin: 0; font-size: 13.5px; line-height: 1.45; color: #B09098; }
.streak-claim {
    width: 100%; height: 52px; border: none; cursor: pointer;
    border-radius: 16px 16px 16px 4px !important;
    background: linear-gradient(135deg, #FF2D55, #C2185B);
    font-size: 15px; font-weight: 800; color: var(--text-color);
}
.streak-next {
    text-align: center; margin: 0;
    font-family: 'CherryMono', monospace;
    font-size: 10.5px; letter-spacing: 0.1em; color: var(--muted-color);
}

/* ============ Финальная полировка ============ */

/* Заголовки страниц (Магазин, Настройки, Чаты) — Bricolage как в макете */
.header h1:not(.brand-logo), .shop__title {
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-weight: 800;
    letter-spacing: -0.04em;
}

/* Сетка сообщества: карточки прямо в контейнере — тот же кадр 4:5 */
.characters-container > .character-card {
    aspect-ratio: 4 / 5;
    background-size: cover;
    background-position: center top;
    position: relative;
}
.characters-container > .character-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 48%, rgba(13, 5, 9, 0.93));
    pointer-events: none;
    border-radius: inherit;
}
.characters-container > .character-card .character-info {
    position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 0;
    background: none;
}
.characters-container > .character-card .character-name {
    font-size: 13.5px; font-weight: 800; letter-spacing: -0.015em;
}
.characters-container > .character-card .character-description {
    font-size: 10.5px; color: #BC9BA3; margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Кнопка ежедневного подарка в шапке — чип с хвостиком */
.daily-bonus-btn {
    border-radius: 11px 11px 11px 3px !important;
    background: rgba(243, 217, 164, 0.14) !important;
    border: 1px solid rgba(243, 217, 164, 0.32) !important;
}

/* Пустые состояния и лоадеры */
.empty-message, .loading-indicator {
    font-family: 'CherryMono', monospace;
    font-size: 12px; letter-spacing: 0.08em;
    color: var(--muted-color);
    text-align: center;
}

/* ============ Десктоп по макету: сайдбар + широкая сетка ============ */
@media (min-width: 1000px) {
    /* Нижняя навигация становится левым сайдбаром */
    .bottom-nav {
        top: 0; bottom: 0; left: 0; right: auto;
        width: 216px;
        margin: 0;
        flex-direction: column;
        justify-content: flex-start;
        gap: 6px;
        padding: 86px 18px 24px;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(255, 255, 255, 0.07);
        background: rgba(13, 5, 9, 0.97);
        box-shadow: none;
    }
    .nav-item {
        flex: none;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        width: 100%;
        padding: 11px 12px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 12px 12px 12px 3px;
    }
    .nav-item .nav-icon { margin-bottom: 0; }
    .nav-item > span:not(.nav-icon) { font-size: 14px; }
    .nav-item.active {
        transform: none;
        background: linear-gradient(135deg, rgba(255, 45, 85, 0.6), rgba(194, 24, 91, 0.36));
        box-shadow: none;
    }
    .nav-item.active { animation: none; }

    /* Контент отъезжает от сайдбара и не растягивается бесконечно */
    .page-container {
        margin-left: 216px;
        padding-left: 30px;
        padding-right: 30px;
        max-width: 1240px;
    }
    .chat-page .page-container,
    .chat-container { margin-left: 216px; }

    /* Каталог: hero выше и типографика крупнее, сетка 4:5 в 4 колонки */
    .hero-frame { height: 560px; border-radius: 26px 26px 26px 5px; }
    .hero-name { font-size: 52px; letter-spacing: -0.05em; }
    .hero-desc { font-size: 16px; max-width: 420px; }
    .hero-text { left: 26px; right: 80px; bottom: 26px; }
    .characters-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .characters-container { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .characters-grid .character-name,
    .characters-container > .character-card .character-name { font-size: 14px; }

    /* Шапка в одну линию с контентом */
    .header { padding-left: 0; padding-right: 0; }

    /* Магазин и настройки — колонкой разумной ширины */
    .shop-container, .shop__cards, .settings-container { max-width: 900px; }

    /* Чат: сообщения не на всю ширину экрана */
    .user-message, .assistant-message { max-width: 60%; }
}

@media (min-width: 1400px) {
    .characters-grid { grid-template-columns: repeat(5, 1fr); }
}

/* Фиксы по скринам: лого белое с алым подчёркиванием, карточка «создать» */
.header h1.brand-logo { background: none !important; -webkit-text-fill-color: initial; }
.brand-logo .brand-name { color: #F6ECEF !important; }
.brand-logo .brand-name i { color: #FF4D6D !important; }

.create-character-card .character-info { bottom: 44px !important; }
.create-character-actions {
    position: absolute; left: 8px; right: 8px; bottom: 8px;
    display: flex; gap: 6px; justify-content: center;
}
.create-character-actions button {
    flex: 1; padding: 6px 4px;
    border-radius: 9px 9px 9px 2px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 10.5px; font-family: 'CherryMono', monospace;
}

/* Десктоп: приложение на всю ширину, а не колонка 600px */
@media (min-width: 1000px) {
    #app { max-width: none; margin: 0; }
}

/* Прелоадер и заголовки экранов — CherryChat */
.loader-text {
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-weight: 800; letter-spacing: -0.03em; font-size: 18px;
}
.loader-subtext {
    font-family: 'CherryMono', monospace;
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted-color);
}
.loader-spinner { border-top-color: #FF2D55 !important; }

/* Заголовки страниц белые (не градиентные), как в макете */
.header h1 {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-color) !important;
}

/* Карточка «Создать своего» — плюс в фирменном чипе вместо круга с вопросом */
.create-character-card { display: block; }
.create-character-card .create-character-avatar { display: none; }
.create-character-inner {
    position: absolute; inset: 0 0 40px;
    display: grid; align-content: center; justify-items: center; gap: 8px;
    text-align: center; padding: 0 10px;
}
.create-plus {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px 14px 14px 4px;
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.7), rgba(194, 24, 91, 0.5));
    border: 1px solid rgba(255, 141, 168, 0.4);
    font-size: 28px; font-weight: 400; line-height: 1;
    color: var(--text-color);
}
.create-title {
    font-size: 13.5px; font-weight: 800; letter-spacing: -0.015em;
    color: var(--text-color);
}
.create-sub {
    font-size: 10.5px; color: #BC9BA3;
}

/* ============ Таббар: ровный сегментный контрол по макету ============ */
@media (max-width: 999px) {
    .bottom-nav {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr);
        align-items: stretch;
        gap: 4px;
        height: 60px;
        padding: 4px !important;
        margin: 0 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 18px 18px 18px 5px !important;
    }
    .bottom-nav .nav-item {
        display: grid !important;
        grid-template-rows: auto auto;
        align-content: center;
        justify-items: center;
        gap: 3px !important;
        padding: 0 2px !important;
        min-width: 0;
        border-radius: 14px 14px 14px 4px !important;
        overflow: hidden;
    }
    .bottom-nav .nav-item .nav-icon {
        width: 18px; height: 18px;
        margin: 0 !important;
    }
    .bottom-nav .nav-item .nav-icon-emoji {
        font-size: 14px; line-height: 18px; height: 18px;
        margin: 0 !important;
    }
    .bottom-nav .nav-item > span:not(.nav-icon) {
        display: block !important;
        font-size: 9px !important;
        font-weight: 700;
        margin: 0 !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .bottom-nav .nav-item.active {
        transform: none !important;
        animation: none !important;
        box-shadow: 0 4px 14px rgba(255, 45, 85, 0.3);
    }
}

/* ============ Магазин по макету: строки пакетов и подписок ============ */
.shop-cherry { padding: 0 16px 90px; }
.shop-cherry-title {
    margin: 0 0 4px;
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 26px; font-weight: 800; letter-spacing: -0.04em;
    color: var(--text-color);
}
.shop-cherry-sub {
    margin: 0 0 18px;
    font-family: 'CherryMono', monospace;
    font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--muted-color);
}
.shop-pack-list { display: grid; gap: 10px; margin-bottom: 24px; }
.shop-pack-row {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 16px; cursor: pointer;
    border-radius: 18px 18px 18px 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.shop-pack-row.best {
    background: linear-gradient(140deg, rgba(243, 217, 164, 0.14), rgba(255, 255, 255, 0.02));
    border-color: rgba(243, 217, 164, 0.42);
}
.shop-pack-cherry { font-style: normal; font-size: 17px; flex: none; }
.shop-pack-info { flex: 1; min-width: 0; }
.shop-pack-info b {
    font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums;
    color: var(--text-color);
}
.shop-pack-info i {
    display: block; font-style: normal; margin-top: 3px;
    font-family: 'CherryMono', monospace;
    font-size: 10.5px; letter-spacing: 0.08em;
    color: var(--muted-color);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shop-pack-row.best .shop-pack-info i { color: var(--cream-color); }
.shop-pack-price {
    padding: 9px 15px; flex: none;
    border-radius: 11px 11px 11px 3px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    font-size: 13px; font-weight: 800;
}
.shop-pack-row.best .shop-pack-price { background: var(--cream-color); color: #3A2A05; }

.shop-subs-title {
    margin: 0 0 12px;
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 18px; font-weight: 800; letter-spacing: -0.03em;
    color: var(--text-color);
}
.shop-subs-list { display: grid; gap: 10px; }
.shop-sub-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 16px; cursor: pointer; position: relative;
    border-radius: 18px 18px 18px 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.shop-sub-row.featured {
    padding: 17px 16px;
    background: linear-gradient(140deg, rgba(255, 45, 85, 0.3), rgba(243, 217, 164, 0.08));
    border-color: rgba(255, 141, 168, 0.45);
}
.shop-sub-badge {
    position: absolute; top: -9px; left: 16px;
    padding: 3px 10px;
    border-radius: 7px 7px 7px 2px;
    background: var(--cream-color); color: #3A2A05;
    font-family: 'CherryMono', monospace;
    font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
}
.shop-sub-info b { font-size: 15px; color: var(--text-color); }
.shop-sub-row.featured .shop-sub-info b { font-size: 16px; }
.shop-sub-info i {
    display: block; font-style: normal; margin-top: 3px;
    font-size: 12px; color: #B09098;
}
.shop-sub-row.featured .shop-sub-info i { color: #FFC0CE; }
.shop-sub-price { font-size: 14px; font-weight: 800; color: var(--text-color); }

/* ============ Предупреждение 18+ ============ */
.age-gate-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(13, 5, 9, 0.8);
    backdrop-filter: blur(8px);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 18px;
}
.age-gate {
    width: 100%; max-width: 400px;
    border-radius: 30px 30px 30px 6px;
    background: #1C0C13;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 26px 22px;
    text-align: left;
    animation: cherry-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.age-gate-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 14px; margin-bottom: 14px;
    border-radius: 11px 11px 11px 3px;
    background: linear-gradient(135deg, #FF2D55, #C2185B);
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 20px; font-weight: 800;
    color: var(--text-color);
}
.age-gate-title {
    margin: 0 0 8px;
    font-family: 'CherryDisplay', 'TildaSans', sans-serif;
    font-size: 24px; font-weight: 800; letter-spacing: -0.04em;
    color: var(--text-color);
}
.age-gate-text {
    margin: 0 0 20px;
    font-size: 13.5px; line-height: 1.5; color: #B09098;
}
.age-gate-yes {
    width: 100%; height: 52px; border: none; cursor: pointer;
    border-radius: 16px 16px 16px 4px;
    background: linear-gradient(135deg, #FF2D55, #C2185B);
    font-size: 15px; font-weight: 800; font-family: inherit;
    color: var(--text-color);
    margin-bottom: 10px;
}
.age-gate-no {
    width: 100%; height: 44px; border: none; cursor: pointer;
    border-radius: 14px 14px 14px 4px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
    font-size: 13.5px; font-family: inherit;
    color: #B09098;
}
