/* Убираем стандартные отступы у всего */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Настройки для всей страницы */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    height: 100vh; /* высота = 100% экрана */
    overflow: hidden;
}

/* Главный контейнер — вертикальная колонка */
.page {
    display: flex;
    flex-direction: column; /* располагаем элементы сверху вниз */
    height: 100vh;
}

/* ====== ШАПКА ====== */
.header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 12px 20px;
    text-align: center;
    flex-shrink: 0; /* чтобы шапка не сжималась */
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

/* ====== ОСНОВНАЯ ОБЛАСТЬ (меню + контент) ====== */
.main-area {
    display: flex; /* Включаем Flexbox для горизонтального расположения */
    flex: 1; /* занимаем всё оставшееся место */
    overflow: hidden; /* чтобы ничего не вылазило */
}

/* ====== ДЕСКТОПНАЯ БОКОВАЯ ПАНЕЛЬ (слева) ====== */
.menu {
    background-color: #2c3e50;
    color: white;
    width: 250px;
    padding: 30px 20px;
    flex-shrink: 0;
    overflow-y: auto;
    transition: width 0.3s ease, padding 0.3s ease;
}

.main-area:not(.home-mode) .menu {
    display: none;
}

/* ====== КОНТЕНТ (справа) ====== */
.content {
    flex: 1 1 auto; /* занимаем всё оставшееся место */
    min-width: 0; /* чтобы flex-ребёнок не ломал сетку по ширине */
    min-height: 0; /* чтобы flex-ребёнок мог сжиматься и давать скролл внутри */
    padding: 30px;
    background-color: white;
    overflow-y: auto; /* добавляем скролл, если контент не помещается */
}

.content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.content p {
    line-height: 1.6; /* межстрочный интервал */
    margin-bottom: 15px;
    color: #333;
}

.content-status {
    min-height: 1.2em;
    margin-bottom: 12px;
    color: #666;
    font-size: 14px;
}

.characters-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 0 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c8e6c9 transparent;
    padding-bottom: 4px;
}

.characters-toolbar::-webkit-scrollbar {
    height: 6px;
}

.characters-toolbar::-webkit-scrollbar-thumb {
    background: #c8e6c9;
    border-radius: 999px;
}

.characters-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 16px;
    border: 1px solid #c8e6c9;
    border-radius: 999px;
    background: #fff;
    color: #2e7d32;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.characters-tab:hover {
    background: #f1f8e9;
}

.characters-tab.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.characters-search-box {
    margin: 0 0 16px;
}

.characters-search-input {
    width: 100%;
    max-width: 520px;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
}

.characters-search-input:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 1px;
    border-color: #4CAF50;
}

.characters-recommended-pane {
    margin-bottom: 20px;
}

.characters-recommended-placeholder {
    margin: 0;
    padding: 24px;
    border: 1px dashed #c8e6c9;
    border-radius: 12px;
    background: #f9fff9;
    color: #558b2f;
}

.characters-search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 640px;
}

.character-search-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
}

.character-search-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4CAF50;
    cursor: pointer;
    flex-shrink: 0;
    background: #fff;
}

.character-search-avatar:hover {
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.35);
}

.character-search-info {
    min-width: 0;
}

.character-search-name {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.character-search-brief {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.characters-search-empty {
    margin: 0;
    padding: 16px 0;
    color: #888;
    font-style: italic;
}

.characters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    align-items: flex-start;
}

.character-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 124px;
    width: 124px;
    text-align: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.character-card:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.character-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.character-card-avatar-wrap img,
.character-card-avatar-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: 8px;
    border: 2px solid #4CAF50;
    background: #fff;
    display: block;
}

.character-card-avatar-wrap {
    position: relative;
    width: 100px;
    height: 178px;
    flex-shrink: 0;
}

.character-card-avatar-video {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.character-card-avatar-video[hidden] {
    display: none;
}

.character-card-brief {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 8px 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    line-height: 1.35;
    border-radius: 0 0 6px 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.character-card-avatar-wrap:hover .character-card-brief,
.character-card-avatar-wrap:focus-within .character-card-brief {
    opacity: 1;
}

.character-card .character-name {
    margin-top: 10px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.3;
}

.characters-loading,
.characters-error {
    color: #666;
    width: 100%;
}

.characters-error {
    color: #c0392b;
}

.content.chat-mode {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #b8b8b8;
    position: relative;
    overflow: hidden;
}

.chat-view[hidden] {
    display: none !important;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
    background: #b8b8b8;
    overflow: hidden;
}

.chat-scene-panel {
    flex: 0 0 auto;
    width: var(--chat-scene-panel-width, 280px);
    min-width: 0;
    max-width: 48%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #2e2e2e;
    border-right: 1px solid #999;
    overflow: hidden;
}

.chat-scene-frame {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    background: #252525;
}

.chat-scene-toolbar {
    flex: 0 0 auto;
    padding: 8px 10px;
    background: #3a3a3a;
    border-top: 1px solid #555;
}

.chat-scene-toolbar[hidden] {
    display: none !important;
}

.chat-scene-video-btn {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.chat-scene-video-btn:hover:not(:disabled) {
    background: #43a047;
}

.chat-scene-video-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.chat-scene-video-btn.is-busy {
    background: #666;
}

.chat-scene-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    opacity: 0;
    transition: opacity 0.65s ease;
    pointer-events: none;
}

.chat-scene-img.active {
    opacity: 1;
}

.chat-scene-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    background: #252525;
}

.chat-scene-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    line-height: 1.5;
}

.chat-scene-placeholder[hidden] {
    display: none !important;
}

.chat-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    position: relative;
    background: #b8b8b8;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    min-height: 44px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.chat-back-btn {
    border: none;
    background: #f0f0f0;
    color: #2c3e50;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-back-btn:hover {
    background: #e4e4e4;
}

.chat-header-title {
    flex: 1;
    font-weight: bold;
    color: #2c3e50;
    font-size: 16px;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: #4a4a4a;
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.chat-header-btn:hover {
    background: #3a3a3a;
}

.chat-header-btn[hidden] {
    display: none;
}

.chat-reset-btn {
    border: 1px solid #e74c3c;
    background: #fff;
    color: #e74c3c;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    align-self: center;
}

.chat-reset-btn:hover {
    background: #fdecea;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #b8b8b8;
    -webkit-overflow-scrolling: touch;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Comic Sans MS", "Comic Sans", cursive;
}

.chat-msg-wrap {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    gap: 4px;
}

.chat-msg-wrap .chat-message {
    max-width: 100%;
}

.chat-msg-wrap-character {
    align-self: flex-start;
}

.chat-msg-wrap-user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg-wrap-user .chat-msg-actions {
    justify-content: flex-end;
}

.chat-msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.chat-msg-wrap:hover .chat-msg-actions,
.chat-msg-wrap:focus-within .chat-msg-actions,
.chat-msg-actions:has(.is-active) {
    opacity: 1;
}

.chat-msg-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #333;
    cursor: pointer;
}

.chat-msg-action svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.chat-msg-action:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
}

.chat-msg-action.is-active {
    color: #2e7d32;
    background: rgba(76, 175, 80, 0.18);
}

.chat-msg-action[data-action="dislike"].is-active {
    color: #c62828;
    background: rgba(198, 40, 40, 0.14);
}

.chat-msg-action:disabled {
    opacity: 0.4;
    cursor: default;
}

.chat-msg-wrap.is-busy {
    opacity: 0.65;
}

.chat-msg-wrap.is-editing {
    align-self: stretch;
    max-width: 100%;
    width: 100%;
    align-items: stretch;
}

.chat-msg-edit {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-msg-edit-input {
    width: 100%;
    min-height: 80px;
    resize: none;
    overflow-y: hidden;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #888;
    font: inherit;
    font-family: "Comic Sans MS", "Comic Sans", cursive;
    line-height: 1.5;
    box-sizing: border-box;
}

.chat-msg-edit-actions {
    display: flex;
    gap: 8px;
}

.chat-msg-edit-save,
.chat-msg-edit-cancel {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #777;
    background: #f3f3f3;
    cursor: pointer;
    font-size: 13px;
}

.chat-msg-edit-save {
    background: #4CAF50;
    border-color: #388e3c;
    color: #fff;
}

.chat-msg-wrap-intro {
    align-self: stretch;
    max-width: 100%;
}

.chat-message-intro {
    max-width: 100%;
    align-self: stretch;
    background: #efe6d4;
    border: 1px solid #d7c7a8;
    color: #3d3428;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    border-radius: 12px;
    padding: 12px 16px;
}

.chat-intro-label {
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7a6a4f;
    margin-bottom: 6px;
}

.chat-intro-text {
    font-size: 15px;
    line-height: 1.55;
}

.chat-message-intro .chat-msg-aside {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    color: #5a4d3a;
}

.chat-message-user {
    align-self: flex-end;
    background: #4CAF50;
    color: #fff;
}

.chat-message-character .chat-msg-aside {
    font-family: "Candara Light", Candara, sans-serif;
    font-style: bold italic;
    font-size: 14px;
    color: #000;
}

.chat-message-user .chat-msg-aside {
    font-family: "Candara Light", Candara, sans-serif;
    font-style: bold italic;
    font-size: 14px;
    color: #000;
}

/* Изображения сцен — только в левой панели, не в ленте сообщений */
.chat-messages .chat-message-image {
    display: none !important;
}

.chat-message-image {
    align-self: flex-start;
    max-width: min(280px, 80%);
    padding: 0;
    background: transparent;
    border: none;
}

.chat-message-image img {
    display: block;
    width: 100%;
    max-width: 280px;
    border-radius: 10px;
    border: 2px solid #4CAF50;
}

.chat-composer {
    flex-shrink: 0;
    background: #a8a8a8;
    border-top: 1px solid #909090;
    position: relative;
    z-index: 5;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: transparent;
    border-top: none;
    flex-shrink: 0;
    align-items: flex-end;
    position: relative;
}

.chat-send-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-items: stretch;
}

.chat-camera-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 48px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: #4a4a4a;
    color: #fff;
    cursor: pointer;
}

.chat-camera-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.chat-camera-btn:hover:not(:disabled) {
    background: #333;
}

.chat-camera-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.chat-camera-btn[hidden] {
    display: none !important;
}

.chat-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
    min-height: 48px;
    max-height: 160px;
}

.chat-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.chat-send-btn {
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 20px;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

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

.chat-loading {
    color: #666;
    text-align: center;
    padding: 24px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.confirm-modal-top {
    z-index: 1200;
}

.modal-card {
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    max-width: 420px;
    width: 90%;
}

.modal-card h2 {
    margin: 0 0 12px;
    color: #2c3e50;
}

.modal-text {
    color: #555;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-danger {
    flex: 1;
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-secondary {
    flex: 1;
    background: #999;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary {
    flex: 1;
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

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

.modal-card-wide {
    max-width: 520px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.language-menu-wrap {
    position: relative;
}

.language-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s, border-color 0.2s;
}

.language-menu-btn:hover,
.language-menu-btn:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.7);
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    padding: 6px;
    z-index: 1200;
}

.language-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.language-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #222;
    cursor: pointer;
    font-size: 14px;
}

.language-option:hover {
    background: #f2f7f2;
}

.language-option.active {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.user-menu-wrap {
    position: relative;
}

.user-menu-trigger {
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}

.user-menu-wrap:hover .user-menu-trigger,
.user-menu-wrap:focus-within .user-menu-trigger {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
}

.user-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 6px;
    z-index: 1100;
}

.user-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: #2c3e50;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.user-menu-item:hover {
    background: #f0f4f0;
}

.persona-field {
    margin-bottom: 16px;
}

.persona-label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
}

.persona-input,
.persona-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}

.sex-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sex-option {
    flex: 1;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.sex-option:hover {
    border-color: #4CAF50;
    background: #f5fff5;
}

.sex-option.selected {
    border-color: #4CAF50;
    background: #e8f5e9;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.sex-icon {
    font-size: 28px;
    line-height: 1;
}

.sex-label {
    font-size: 13px;
    color: #444;
}

.persona-message {
    min-height: 18px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.persona-message.error {
    color: #c0392b;
}

.persona-message.success {
    color: #2e7d32;
}

.persona-profiles-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.persona-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.persona-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    max-width: 100%;
}

.persona-chip:hover {
    border-color: #4CAF50;
}

.persona-chip.selected {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.persona-chip.active {
    font-weight: 600;
}

.persona-chip-badge {
    font-size: 10px;
    text-transform: uppercase;
    color: #2e7d32;
    letter-spacing: 0.03em;
}

.persona-new-btn {
    flex-shrink: 0;
    background: transparent;
    border: 2px dashed #4CAF50;
    color: #4CAF50;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

.persona-new-btn:hover {
    background: #e8f5e9;
}

.persona-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.persona-delete-btn {
    color: #c0392b;
    border-color: #e74c3c;
}

.persona-delete-btn:hover {
    background: #fdecea;
}

/* ====== МОБИЛЬНОЕ НИЖНЕЕ МЕНЮ (отключено) ====== */
.mobile-bottom-menu {
    display: none !important;
}

.mobile-bottom-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    color: #999;
    text-decoration: none;
    font-size: 10px;
    transition: all 0.3s;
    min-width: 60px;
    position: relative;
}

.mobile-bottom-menu a i {
    font-size: 22px;
    margin-bottom: 2px;
}

.mobile-bottom-menu a span {
    font-size: 10px;
}

.mobile-bottom-menu a.active {
    color: #667eea;
}

.mobile-bottom-menu a.active i {
    transform: scale(1.1);
}

.mobile-bottom-menu a.add-button {
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.mobile-bottom-menu a.add-button i {
    font-size: 28px;
    margin: 0;
}

.mobile-bottom-menu a.add-button span {
    display: none;
}

/* ====== АДАПТИВНОСТЬ ====== */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 1024px) {
    .menu {
        width: 200px;
    }
}

/* Телефоны (менее 768px) */
@media (max-width: 768px) {
    /* Боковая панель скрыта на мобильных */
    .menu {
        display: none !important;
    }

    .chat-main {
        flex-direction: column;
        position: relative;
    }

    /* Сцена — фон на весь блок между шапкой и строкой ввода */
    .chat-scene-panel {
        position: absolute;
        inset: 0;
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: none;
        min-height: 0;
        max-height: none;
        z-index: 0;
        border: none;
        background: #1a1a1a;
    }

    .chat-scene-frame {
        position: absolute;
        inset: 0;
    }

    .chat-scene-img {
        object-fit: cover;
        object-position: top center;
    }

    .chat-scene-placeholder {
        font-size: 13px;
        color: rgba(255, 255, 255, 0.35);
    }

    /* Диалог поверх фона */
    .chat-body {
        position: relative;
        z-index: 1;
        flex: 1;
        min-height: 0;
        background: transparent;
    }

    .chat-messages {
        background: transparent;
    }

    .chat-message {
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    .chat-message-character {
        background: rgba(255, 255, 255, 0.42);
        border: 1px solid rgba(255, 255, 255, 0.38);
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    }

    .chat-message-user {
        background: rgba(76, 175, 80, 0.48);
        border: 1px solid rgba(255, 255, 255, 0.28);
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
    }

    .chat-message-character .chat-msg-aside,
    .chat-message-user .chat-msg-aside {
        color: rgba(0, 0, 0, 0.85);
        text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    }

    .chat-loading {
        color: rgba(255, 255, 255, 0.85);
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .content:not(.chat-mode) {
        padding: 20px 15px;
    }

    .content.chat-mode {
        padding: 0;
    }

    .chat-view .chat-composer {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .chat-header {
        padding: 4px 8px;
        min-height: 40px;
        gap: 6px;
    }

    .chat-header-title {
        font-size: 15px;
    }

    .chat-header-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    .chat-back-btn {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    /* Уменьшаем шапку */
    .header h1 {
        font-size: 18px;
    }
    
    .header p {
        font-size: 11px;
    }

    .auth-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Логотип меньше */
    .header img {
        height: 30px !important;
    }

    /* Кнопки авторизации компактнее */
    .login-btn {
        margin-right: 5px;
    }
}

/* Очень маленькие телефоны (менее 400px) */
@media (max-width: 400px) {
    .header h1 {
        font-size: 16px;
    }
    
    .header p {
        display: none; /* Скрываем подзаголовок */
    }

    .auth-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .mobile-bottom-menu a {
        min-width: 50px;
        padding: 5px 8px;
    }

    .mobile-bottom-menu a i {
        font-size: 18px;
    }

    .mobile-bottom-menu a.add-button {
        width: 48px;
        height: 48px;
        margin-top: -15px;
    }

    .mobile-bottom-menu a.add-button i {
        font-size: 22px;
    }
}

/* Анимация появления мобильного меню */
.mobile-bottom-menu {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Активная ссылка подсвечивается */
.mobile-bottom-menu a.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #667eea;
    border-radius: 0 0 3px 3px;
}

/* Toast-уведомление */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 2000;
    background: #444;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    max-width: min(90vw, 480px);
    text-align: center;
}

.toast.toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Модалка подробностей персонажа в чате */
.character-detail-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: #f7f8fa;
    flex-direction: column;
    overflow: hidden;
    display: none;
}

.character-detail-overlay:not([hidden]) {
    display: flex;
}

.character-detail-panel {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.character-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.character-detail-close:hover {
    background: #fff;
}

.character-detail-avatar-col {
    flex: 0 0 38%;
    max-width: 320px;
    min-width: 180px;
    background: #e8e8e8;
    display: flex;
    align-items: stretch;
}

.character-detail-avatar-col img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.character-detail-content {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.character-detail-name {
    margin: 0;
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.character-detail-brief {
    margin: 0;
    color: #555;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.character-detail-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-detail-editor[hidden] {
    display: none;
}

.character-detail-editor .persona-textarea {
    min-height: 140px;
    max-height: 280px;
}

.character-detail-tabs {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.character-detail-tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f3f3f3;
    color: #444;
    font-size: 13px;
    cursor: pointer;
}

.character-detail-tab.is-active {
    background: #4CAF50;
    border-color: #388e3c;
    color: #fff;
}

.character-detail-tab[hidden] {
    display: none;
}

.character-detail-scenarios {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.character-detail-scenarios[hidden] {
    display: none;
}

.character-detail-scenarios-empty {
    color: #777;
    font-size: 14px;
    padding: 8px 2px;
}

.character-detail-scenario-item {
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
}

.character-detail-scenario-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.character-detail-scenario-text {
    font-size: 13px;
    color: #444;
    line-height: 1.45;
    white-space: pre-wrap;
    margin-bottom: 8px;
}

.scenario-option-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scenario-option-manage,
.character-detail-scenario-item .scenario-option-manage {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.scenario-manage-btn {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #bbb;
    background: #f7f7f7;
    color: #333;
    cursor: pointer;
    font-size: 12px;
}

.scenario-manage-btn:hover {
    background: #eee;
}

.scenario-manage-delete {
    border-color: #e57373;
    color: #c62828;
}

.scenario-manage-delete:hover {
    background: #ffebee;
}

.scenario-create-title {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.scenario-picker-overlay {
    z-index: 1100;
}

.scenario-picker-overlay[hidden],
.scenario-create-overlay[hidden] {
    display: none;
}

.scenario-create-overlay {
    z-index: 1150;
}

.scenario-picker-card {
    max-width: 480px;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.scenario-picker-random {
    flex: 0 0 auto;
    margin-bottom: 10px;
}

.scenario-picker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 42vh;
    overflow-y: auto;
    padding: 2px;
}

.scenario-option {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    text-align: left;
    border: 2px solid #d5d5d5;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
    color: #2c3e50;
    box-sizing: border-box;
}

.scenario-option:hover {
    border-color: #81c784;
}

.scenario-option.is-selected {
    border-color: #2e7d32;
    background: #e8f5e9;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.22);
}

.scenario-option-title {
    font-weight: 600;
}

.scenario-option-text {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    color: #444;
    line-height: 1.45;
    white-space: pre-wrap;
}

.scenario-option.is-selected .scenario-option-text {
    display: block;
}

.scenario-picker-random .scenario-option-text {
    display: block;
}

.scenario-picker-actions {
    flex-wrap: wrap;
    margin-top: 4px;
}

.scenario-create-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.character-detail-gallery {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    padding: 2px;
    align-content: start;
}

.character-detail-gallery[hidden] {
    display: none !important;
}

.character-detail-gallery:empty {
    display: none;
}

.character-detail-gallery-item {
    aspect-ratio: 3 / 4;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #e8e8e8;
}

.character-detail-gallery-item img,
.character-detail-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.15s ease;
}

.character-detail-gallery-item:hover img,
.character-detail-gallery-item:hover video {
    transform: scale(1.04);
}

.gallery-context-menu {
    position: fixed;
    z-index: 2100;
    min-width: 240px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    padding: 4px;
}

.gallery-context-menu[hidden] {
    display: none;
}

.gallery-context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #2c3e50;
    font-size: 14px;
}

.gallery-context-menu button:hover {
    background: #e8f5e9;
}

.character-detail-meta {
    color: #555;
    font-size: 14px;
}

.character-detail-meta-label {
    font-weight: bold;
    color: #2c3e50;
}

.character-detail-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.character-detail-label {
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

.character-detail-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.image-lightbox {
    position: absolute;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.image-lightbox:not([hidden]) {
    display: flex;
}

.image-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.image-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.baseline-sliders {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 4px;
}

.baseline-slider-title {
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 8px;
}

.baseline-track-wrap {
    position: relative;
    height: 28px;
    display: flex;
    align-items: flex-end;
}

.baseline-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #e74c3c, #4CAF50);
}

.baseline-marker {
    position: absolute;
    bottom: 12px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid #2c3e50;
    transform: translateX(-50%);
    pointer-events: none;
    transition: left 0.05s ease;
}

.baseline-range {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 28px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.baseline-desc {
    margin-top: 6px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    min-height: 1.4em;
}

.character-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-save-changes {
    flex: 1 1 100%;
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-save-changes:hover {
    background: #2980b9;
}

.btn-save-changes:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-start-over {
    flex: 1;
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-start-over:hover {
    background: #43a047;
}

.btn-delete-dialog {
    flex: 1;
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-delete-dialog:hover {
    background: #c0392b;
}

.btn-delete-character {
    flex: 1 1 100%;
    background: #8e44ad;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-delete-character:hover {
    background: #7d3c98;
}

.character-detail-textarea:read-only {
    background: #f5f5f5;
    color: #444;
    cursor: default;
    resize: none;
}

.characters-view-link {
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 6px;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.characters-view-link:hover {
    color: #2980b9;
}

@media (max-width: 700px) {
    .character-detail-panel {
        flex-direction: column;
    }

    .character-detail-avatar-col {
        flex: 0 0 200px;
        max-width: none;
        width: 100%;
    }
}

/* Карточка создания персонажа и групповых сценариев */
.character-card-group .character-name {
    color: #1565c0;
}

.character-card-group-create .character-name {
    color: #6a1b9a;
}

.create-group-card {
    max-width: 720px;
}

.create-group-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.create-group-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
}

.create-group-search-item:hover {
    background: #f1f8e9;
}

.create-group-search-item img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4CAF50;
}

.create-group-search-item-name {
    font-weight: 600;
}

.create-group-participants-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 48px;
}

.create-group-participants-empty {
    margin: 0;
    color: #888;
    font-style: italic;
}

.create-group-participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    background: #f9fff9;
}

.create-group-participant-item img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.create-group-participant-remove {
    margin-left: auto;
    border: none;
    background: transparent;
    color: #c0392b;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.character-card-create .character-name {
    color: #4CAF50;
}

.character-detail-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.character-detail-participant-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f8e9;
    border: 1px solid #c8e6c9;
    font-size: 14px;
}

.create-character-card {
    position: relative;
    max-width: 560px;
    width: 90%;
}

.create-character-card.create-character-step2-layout {
    display: flex;
    flex-direction: row;
    max-width: min(920px, 96vw);
    width: 96vw;
    min-height: min(640px, 88vh);
    padding: 0;
    overflow: hidden;
}

.create-character-main {
    flex: 1;
    min-width: 0;
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.create-character-step2-layout .create-character-main {
    overflow-y: auto;
}

.create-char-preview-col {
    flex: 0 0 42%;
    min-width: 240px;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.create-char-preview-col[hidden] {
    display: none !important;
}

.create-char-preview-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
}

.create-char-preview-placeholder[hidden] {
    display: none !important;
}

.create-char-preview-upload {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 24px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
    cursor: pointer;
    font: inherit;
}

.create-char-preview-upload:hover,
.create-char-preview-upload:focus-visible {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.92);
    outline: none;
}

.create-char-preview-upload[hidden] {
    display: none !important;
}

.create-char-preview-plus {
    width: 72px;
    height: 72px;
    border: 2px dashed rgba(255, 255, 255, 0.38);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.8);
}

.create-char-preview-upload-label {
    max-width: 240px;
    font-size: 14px;
    line-height: 1.45;
}

.create-char-preview-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

.create-char-preview-frame[hidden] {
    display: none !important;
}

.create-char-preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.create-char-preview-col .create-char-portrait-hint {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.35);
    font-size: 12px;
}

.create-char-preview-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.create-char-preview-loading[hidden] {
    display: none !important;
}

.create-character-step[hidden],
.create-character-loading[hidden] {
    display: none !important;
}

.create-character-actions {
    flex-wrap: wrap;
}

.create-character-actions .btn-primary,
.create-character-actions .btn-secondary {
    flex: 1;
    min-width: 120px;
}

.create-char-generate-btn {
    width: 100%;
    margin-bottom: 12px;
}

.create-char-portrait-hint {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.create-char-description::placeholder {
    color: rgba(0, 0, 0, 0.38);
}

.create-character-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: 10px;
    z-index: 5;
}

.create-character-loading p {
    margin: 0;
    color: #2c3e50;
    font-size: 15px;
}

.create-character-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: create-char-spin 0.9s linear infinite;
}

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

@media (max-width: 700px) {
    .create-character-card.create-character-step2-layout {
        flex-direction: column;
        min-height: auto;
        max-height: 92vh;
    }

    .create-char-preview-col {
        flex: 0 0 auto;
        min-height: 240px;
        max-height: 40vh;
    }
}