:root {
    --tg-theme-bg-color: #0a0a0a;
    --tg-theme-secondary-bg-color: rgba(255, 255, 255, 0.08);
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #a0a0a0;
    --tg-theme-button-color: #667eea;
    --tg-theme-button-text-color: #ffffff;
    --crystal-color: #f093fb;
    --border-radius: 16px;
    --card-border-radius: 20px;
    --tab-border-radius: 28px;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --background-color: #0a0a0a;
    --card-bg-color: rgba(255, 255, 255, 0.08);
    --secondary-background-color: rgba(255, 255, 255, 0.08);
    --text-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --neon-pink: #f093fb;
    --neon-blue: #667eea;
    --neon-purple: #764ba2;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Подключаем шрифт TildaSans */

/* Подключаем шрифт TildaSans */
@font-face {
    font-family: 'TildaSans';
    font-weight: 400;
    src: url('../TildaSans.07Web/TildaSans-Regular/TildaSans-Regular.woff2') format('woff2'),
         url('../TildaSans.07Web/TildaSans-Regular/TildaSans-Regular.woff') format('woff');
    font-display: swap;
}

@font-face {
    font-family: 'TildaSans';
    font-weight: 500;
    src: url('../TildaSans.07Web/TildaSans-Medium/TildaSans-Medium.woff2') format('woff2'),
         url('../TildaSans.07Web/TildaSans-Medium/TildaSans-Medium.woff') format('woff');
    font-display: swap;
}

@font-face {
    font-family: 'TildaSans';
    font-weight: 600;
    src: url('../TildaSans.07Web/TildaSans-Semibold/TildaSans-Semibold.woff2') format('woff2'),
         url('../TildaSans.07Web/TildaSans-Semibold/TildaSans-Semibold.woff') format('woff');
    font-display: swap;
}

@font-face {
    font-family: 'TildaSans';
    font-weight: 700;
    src: url('../TildaSans.07Web/TildaSans-Bold/TildaSans-Bold.woff2') format('woff2'),
         url('../TildaSans.07Web/TildaSans-Bold/TildaSans-Bold.woff') format('woff');
    font-display: swap;
}

@font-face {
    font-family: 'TildaSans';
    font-weight: 800;
    src: url('../TildaSans.07Web/TildaSans-ExtraBold/TildaSans-ExtraBold.woff2') format('woff2'),
         url('../TildaSans.07Web/TildaSans-ExtraBold/TildaSans-ExtraBold.woff') format('woff');
    font-display: swap;
}

/* Применение шрифта 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(102, 126, 234, 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(240, 147, 251, 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(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(240, 147, 251, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(118, 75, 162, 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(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(240, 147, 251, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(118, 75, 162, 0.05) 0%, transparent 50%);
}

/* Второй слой - статичные световые эффекты */
body::after {
    background: 
        conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(102, 126, 234, 0.03) 90deg, transparent 180deg, rgba(240, 147, 251, 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(114, 101, 227, 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, #7265E3, #A165E3); /* Purple gradient */
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 -2px 10px rgba(114, 101, 227, 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(114, 101, 227, 0.3);
}

.model-selector-trigger .model-cost {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
    color: #42C0FB; /* 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.90); /* Dark purple glass */
    backdrop-filter: blur(25px);
    border: 1px solid rgba(114, 101, 227, 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(114, 101, 227, 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(114, 101, 227, 0.15), transparent);
}

.model-option.selected {
    background: linear-gradient(90deg, rgba(114, 101, 227, 0.3), transparent);
}

/* Accent line for selected item */
.model-option.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #7265E3;
    box-shadow: 0 0 10px #7265E3;
}

.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(114, 101, 227, 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: #42C0FB; /* 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: #7265E3;
}


/* Заголовок */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    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(102, 126, 234, 0.3);
}

.crystal-counter {
    background: #402750;
    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);
    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(240, 147, 251, 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: 120px;
    scroll-padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
    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(114, 101, 227, 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(114, 101, 227, 0.4), rgba(114, 101, 227, 0.2));
    border-color: rgba(114, 101, 227, 0.3);
    box-shadow: 0 4px 15px rgba(114, 101, 227, 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, #404040 35%, #ffffff 50%, #404040 75%, #404040);
    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(39, 33, 83, 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(102, 126, 234, 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: linear-gradient(135deg, #1a0d2e 0%, #16213e 50%, #0f3460 100%);
    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 #7265E3;
    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(39, 33, 83, 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(114, 101, 227, 0.2);
}

.model-container .model-card.selected {
    background: rgba(114, 101, 227, 0.15);
    border: 2px solid var(--neon-purple);
    box-shadow: 
        0 0 20px rgba(114, 101, 227, 0.3),
        inset 0 0 10px rgba(114, 101, 227, 0.2);
    animation: selectedPulse 2s infinite;
}

.model-container .model-card.selected::after {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #7265E3;
    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(39, 33, 83, 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: #5b50c0;
}

.error-message {
    background-color: rgba(229, 57, 53, 0.2);
    color: #ff6b6b;
    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(114, 101, 227, 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(114, 101, 227, 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 {
    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 {
    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);
}

.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(114, 101, 227, 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(114, 101, 227, 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(114, 101, 227, 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: #ffc107;
    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: #402750;
    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(39, 33, 83, 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(114, 101, 227, 0.2);
}

.model-card.selected {
    background: rgba(114, 101, 227, 0.15);
    border: 2px solid var(--neon-purple);
    box-shadow: 
        0 0 20px rgba(114, 101, 227, 0.3),
        inset 0 0 10px rgba(114, 101, 227, 0.2);
    animation: selectedPulse 2s infinite;
}

.model-card.selected::after {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #7265E3;
    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(39, 33, 83, 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(39, 33, 83, 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(39, 33, 83, 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: #5b50c0;
}

.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(114, 101, 227, 0.3),
                   inset 0 0 10px rgba(114, 101, 227, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(114, 101, 227, 0.4),
                   inset 0 0 15px rgba(114, 101, 227, 0.3);
    }
}

/* Стили для кнопки ежедневного бонуса */
.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: 6px 15px;
    margin: 0 12px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
    animation: pulse 1.5s infinite alternate;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.daily-bonus-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 40%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    animation: shine 3s infinite;
}

.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: 18px;
    margin-right: 8px;
    animation: bounce 1s infinite alternate;
}

.bonus-text {
    font-family: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    color: white;
    font-size: 16px;
}

.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(114, 101, 227, 0.5),
                0 0 40px rgba(66, 192, 251, 0.3);
    border: 1px solid rgba(114, 101, 227, 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(114, 101, 227, 0.4);
}

.claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(114, 101, 227, 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(39, 33, 83, 0.6);
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(114, 101, 227, 0.2);
    border: 1px solid rgba(114, 101, 227, 0.2);
    backdrop-filter: blur(5px);
    min-height: 72px;
}

.history-card:hover {
    background-color: rgba(39, 33, 83, 0.8);
    box-shadow: 0 0 20px rgba(114, 101, 227, 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: 2;
    transition: all 0.2s ease;
}

.history-card .delete-chat-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 0 12px rgba(114, 101, 227, 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(114, 101, 227, 0.3);
    }
    100% {
        box-shadow: 0 0 25px rgba(114, 101, 227, 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, #6a3093, #a044ff);
    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, #a044ff, #6a3093, #a044ff);
    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, #6a3093, #a044ff);
    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, #6a3093, #a044ff);
    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, #ff9d00, #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: #ffcc00;
}

.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, #ffcc00, #ff9d00);
    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(39, 33, 83, 0.6), rgba(39, 33, 83, 0.6)),
        linear-gradient(135deg, rgba(255, 105, 180, 0.7) 0%, rgba(114, 101, 227, 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(114, 101, 227, 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, #42C0FB, #7265E3);
    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, #42C0FB);
    -webkit-background-clip: text;
    background-clip: text;
}

.character-card.selected .select-character-btn {
    background: linear-gradient(135deg, #42C0FB, #7265E3);
    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(39, 33, 83, 0.9), rgba(30, 27, 44, 0.95)) !important;
    border: 1px solid rgba(114, 101, 227, 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(114, 101, 227, 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(114, 101, 227, 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(114, 101, 227, 0.4) !important;
    position: relative;
    overflow: hidden;
}

.payment-modal-content a:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(114, 101, 227, 0.5) !important;
}

.payment-modal-content a:active {
    transform: translateY(1px) !important;
    box-shadow: 0 3px 10px rgba(114, 101, 227, 0.4) !important;
}

#payment-status {
    font-size: 15px !important;
    margin: 20px 0 !important;
    padding: 12px !important;
    background-color: rgba(39, 33, 83, 0.7) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(114, 101, 227, 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: #42c0fb;
    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);
}

.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: #6a88ff;
    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: #2a2d3a;
    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: #353849;
    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: #2a2d3a;
    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 #353849;
}

.model-item:last-child {
    border-bottom: none;
}

.model-item:hover {
    background-color: #353849;
}

.model-item.selected {
    background-color: #6a88ff;
    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(39, 33, 83, 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(114, 101, 227, 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(114, 101, 227, 0.4);
    border-color: rgba(114, 101, 227, 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: #9088BB;
    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(114, 101, 227, 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(114, 101, 227, 0.3);
    color: #FFFFFF;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(114, 101, 227, 0.5);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.character-details-tag:hover {
    background: rgba(114, 101, 227, 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, #7265E3, #a044ff);
    color: #FFFFFF;
}

.character-details-main-action.purchase-needed {
    background: linear-gradient(45deg, #ff6b6b, #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: #9088BB;
    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);
        padding-bottom: 60px;
    }
    
    .chat-messages {
        padding: 12px;
        padding-bottom: 16px;
    }
    
    /* Улучшаем заголовок на мобильных */
    .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, #2B2440 0%, #1E1B2C 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: #9088BB;
    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(39, 33, 83, 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: #7265E3;
    box-shadow: 0 0 0 3px rgba(114, 101, 227, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group small {
    display: block;
    color: #9088BB;
    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, #667eea 0%, #764ba2 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(102, 126, 234, 0.3);
}

.btn-make-public:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 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: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-badge.rejected {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    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, #7265E3, #9088BB);
    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: #9088BB;
    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, #2B2440 0%, #1E1B2C 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: #9088BB;
    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, #2B2440 0%, #1E1B2C 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, #7265E3, #9088BB);
}

@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(39, 33, 83, 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: #7265E3;
}

.user-crystals {
    text-align: center;
    color: #9088BB;
    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(114, 101, 227, 0.8);
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(114, 101, 227, 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(39, 33, 83, 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(114, 101, 227, 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: #7265E3;
    box-shadow: 0 0 0 3px rgba(114, 101, 227, 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: 15px;
    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(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 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: #667eea; background: rgba(102, 126, 234, 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;
}
