.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Полоса с информацией о персонаже */
.chat-character-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(214, 51, 132, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}
.back-btn:hover {
    background: var(--accent);
    color: white;
}
.char-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    flex-shrink: 0;
}
.char-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}
.char-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.char-age {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}
.char-status {
    font-size: 0.8rem;
    color: #48BB78;
    position: relative;
    padding-left: 12px;
}
.char-status::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #48BB78;
}

/* Счётчик сообщений */
.char-messages-left {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(214, 51, 132, 0.08);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}
.char-messages-left i {
    font-size: 1rem;
}
.char-messages-left .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Область сообщений */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Сообщения */
.message {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.message p {
    margin: 0;
    word-break: break-word;
    white-space: pre-wrap;
}
.message.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}
.message.partner {
    align-self: flex-start;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}
.msg-time {
    font-size: 0.65rem;
    color: inherit;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* Стилизация диалогов */
.message.partner p { display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.dialogue {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(214, 51, 132, 0.14), rgba(233, 30, 99, 0.06));
    border-left: 3px solid var(--accent);
    padding: 7px 11px;
    border-radius: 4px 12px 12px 4px;
    line-height: 1.45;
}
.action {
    display: block;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0 2px;
}

/* Индикатор печати */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border-light);
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Поле ввода */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.delete-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(214, 51, 132, 0.1);
    color: var(--accent);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.delete-btn:hover {
    background: rgba(214, 51, 132, 0.2);
}
.chat-input {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: "Inter", sans-serif;
    resize: none;
    max-height: 150px;
    outline: none;
    transition: border-color 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.chat-input:focus {
    border-color: var(--accent);
}
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.send-btn:hover {
    background: var(--accent-hover);
}

/* Попап подтверждения */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.popup-card {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 32px 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(214, 51, 132, 0.3);
    border: 1px solid var(--border-light);
    animation: scaleIn 0.3s ease;
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.popup-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 12px;
}
.popup-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.popup-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.4;
}
.popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.popup-btn {
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}
.popup-btn-cancel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}
.popup-btn-cancel:hover {
    background: rgba(214, 51, 132, 0.12);
}
.popup-btn-confirm {
    background: linear-gradient(135deg, #D63384, #E91E63);
    color: white;
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.3);
}
.popup-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(214, 51, 132, 0.4);
}

/* Адаптив */
@media (max-width: 768px) {
    .chat-character-bar {
        flex-wrap: nowrap;
        gap: 10px;
    }
    .char-messages-left {
        order: 0;
        padding: 4px 10px;
        font-size: 0.8rem;
    }
    .char-messages-left .label {
        display: none;
    }
    .char-messages-left i {
        font-size: 0.9rem;
    }
    .char-age {
        display: block;
    }
}
/* Память персонажа */
.memory-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(214, 51, 132, 0.08);
    color: var(--accent);
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.memory-btn:hover { background: var(--accent); color: #fff; }
@media (max-width: 480px) { .memory-btn-label { display: none; } }
.memory-card { position: relative; max-width: 460px; width: 92%; text-align: left; max-height: 80vh; overflow-y: auto; }
.memory-card .popup-icon, .memory-card .popup-title { text-align: center; }
.memory-icon { color: var(--accent); }
.memory-sub { text-align: center; font-size: 0.85rem; }
.memory-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 1.6rem; color: var(--text-secondary); cursor: pointer; }
.memory-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.memory-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border-light); }
.memory-item.pinned { border-color: var(--accent); background: rgba(214, 51, 132, 0.08); }
.memory-text { flex: 1; font-size: 0.9rem; color: var(--text-primary); line-height: 1.35; }
.memory-act { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.memory-act:hover { color: var(--accent); }
.memory-item.pinned [data-act="pin"] { color: var(--accent); }
.memory-empty { text-align: center; color: var(--text-secondary); font-size: 0.9rem; padding: 14px 6px; }

/* Действия под сообщением, ветки, уведомления */
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-act {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(214, 51, 132, 0.08);
    color: var(--accent);
    border: none;
    border-radius: 14px;
    padding: 6px 11px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 32px;
}
.msg-act:hover { background: var(--accent); color: #fff; }
.branch-item { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border-light); cursor: pointer; }
.branch-item.active { border-color: var(--accent); background: rgba(214, 51, 132, 0.08); }
.branch-name { flex: 1; font-weight: 600; color: var(--text-primary); }
.branch-count { font-size: 0.78rem; color: var(--text-secondary); }
.branch-check { color: var(--accent); }
.chat-toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 10px);
    background: rgba(30, 30, 36, 0.96);
    color: #fff;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 0.88rem;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 10050;
    max-width: 90vw;
    text-align: center;
    pointer-events: none;
}
.chat-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Режим ИИ: Обычный / Улучшенный */
.mode-bar { display: flex; gap: 8px; padding: 8px 0 0; flex-shrink: 0; }
.mode-chip {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 6px 13px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 34px;
}
.mode-chip.active {
    color: #fff;
    background: linear-gradient(135deg, #D63384, #E91E63);
    border-color: transparent;
}
.mode-chip .fa-gem { font-size: 0.72rem; }

/* Групповой чат */
.msg-speaker { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.msg-speaker img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent); }
.ai-add-btn {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(135deg, #D63384, #E91E63);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
}
.parts-add { margin-top: 12px; }
.parts-add .form-input { width: 100%; box-sizing: border-box; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 12px; padding: 10px 12px; color: var(--text-primary); }
.parts-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border-light); }
.parts-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.parts-row .parts-name { flex: 1; font-weight: 600; color: var(--text-primary); }
.parts-row .parts-tag { font-size: 0.72rem; color: var(--text-secondary); }
.parts-row.candidate { cursor: pointer; }
.parts-row.candidate:hover { border-color: var(--accent); }

/* Карточка «лимит исчерпан» */
.limit-card {
    align-self: stretch;
    background: linear-gradient(135deg, rgba(214, 51, 132, 0.16), rgba(156, 39, 176, 0.1));
    border: 1px solid rgba(214, 51, 132, 0.4);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.limit-card p { margin: 0; color: var(--text-primary); }
.limit-card .limit-hint { color: var(--text-secondary); font-size: 0.88rem; }
.limit-btn {
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 14px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 46px;
}
.limit-btn.primary { background: linear-gradient(135deg, #D63384, #E91E63); color: #fff; border-color: transparent; }

/* Proactive: «Может писать первым» */
.proactive-box { margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(214, 51, 132, 0.08); border: 1px solid rgba(214, 51, 132, 0.3); }
.proactive-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; color: var(--text-primary); }
.proactive-row small { color: var(--text-secondary); }
.proactive-row input { width: 22px; height: 22px; accent-color: #D63384; flex-shrink: 0; }
.proactive-cta { display: block; margin-top: 10px; text-align: center; background: linear-gradient(135deg, #D63384, #E91E63); color: #fff; border-radius: 12px; padding: 11px; font-weight: 700; text-decoration: none; }

/* Фото от персонажа в чате */
.photo-offer-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    background: linear-gradient(135deg, #D63384, #E91E63);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 36px;
}
.photo-offer-btn:disabled { opacity: 0.75; cursor: default; }
.chat-photo-wrap { display: block; margin-top: 8px; border-radius: 14px; overflow: hidden; max-width: 220px; }
.chat-photo { display: block; width: 100%; height: auto; border-radius: 14px; }

/* Подсказка после создания персонажа */
.new-char-hint {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 2px 4px;
}
.new-char-hint-text { font-size: 0.85rem; color: var(--text-secondary); }
.new-char-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.starter-chip {
    background: rgba(214, 51, 132, 0.1);
    color: var(--accent);
    border: 1px solid rgba(214, 51, 132, 0.35);
    border-radius: 16px;
    padding: 8px 13px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
}
.starter-chip:active { background: var(--accent); color: #fff; }

.photo-offer-wrap { position: relative; display: inline-block; }
.photo-hint-bubble {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 10, 20, 0.96);
    color: #fff;
    border: 1px solid rgba(214, 51, 132, 0.5);
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.78rem;
    max-width: 220px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    animation: hintPop 0.25s ease;
}
@keyframes hintPop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.photo-hint-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1rem; cursor: pointer; line-height: 1; flex-shrink: 0; }

/* ===== Дразнящая стена фото ===== */
.ph-tease { position: fixed; inset: 0; z-index: 10040; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(8,2,12,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: phFade .25s ease; }
@keyframes phFade { from { opacity: 0; } }
.ph-card { position: relative; width: min(92vw, 360px); padding: 18px 18px 20px; border-radius: 24px; text-align: center; color: #fff;
    background: linear-gradient(160deg, #2a0d2e, #140816); border: 1px solid rgba(214,51,132,.5); box-shadow: 0 30px 60px rgba(0,0,0,.6), 0 0 40px rgba(214,51,132,.25);
    animation: phPop .45s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes phPop { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.ph-x { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 1.4rem; cursor: pointer; z-index: 2; }
.ph-photo { position: relative; aspect-ratio: 3 / 4; width: 70%; margin: 6px auto 14px; border-radius: 18px; overflow: hidden;
    background: linear-gradient(135deg, #ff5fa2, #8a2be2); box-shadow: 0 12px 28px rgba(214,51,132,.35); }
.ph-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; filter: blur(18px) saturate(1.3) brightness(.9); transform: scale(1.2); }
.ph-lock { position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: #fff; background: rgba(214,51,132,.85); box-shadow: 0 0 0 8px rgba(214,51,132,.25); animation: phPulse 1.4s ease-in-out infinite; }
@keyframes phPulse { 50% { transform: scale(1.1); box-shadow: 0 0 0 14px rgba(214,51,132,.1); } }
.ph-badge { position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: 8px; font-size: .72rem; font-weight: 900; background: #ff3b30; }
.ph-title { font-size: 1.15rem; font-weight: 900; line-height: 1.25; }
.ph-sub { margin: 6px 0 14px; font-size: .9rem; color: rgba(255,255,255,.8); }
.ph-buy { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 16px; font-weight: 900; font-size: 1.02rem;
    color: #fff; text-decoration: none; background: linear-gradient(135deg, #ff5fa2, #D63384 55%, #8a2be2); box-shadow: 0 10px 24px rgba(214,51,132,.45); }
.ph-promo { margin-top: 10px; font-size: .8rem; color: #ffd66b; }
@media (prefers-reduced-motion: reduce) { .ph-lock, .ph-card, .ph-tease { animation: none; } }

/* первое фото — в подарок */
.photo-free { background: linear-gradient(135deg, #ffb020, #ff6a1a 55%, #ff3b30) !important; color: #fff !important; box-shadow: 0 6px 16px rgba(255,106,26,.4); animation: phFree 1.6s ease-in-out infinite; }
@keyframes phFree { 50% { transform: scale(1.04); } }

/* кнопка «Попросить фото» в строке режимов */
.mode-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photo-ask { margin-left: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 0; cursor: pointer;
    font: inherit; font-size: .82rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff5fa2, #D63384 55%, #8a2be2); box-shadow: 0 4px 12px rgba(214,51,132,.35); }
.photo-ask.free { background: linear-gradient(135deg, #ffb020, #ff6a1a 55%, #ff3b30); box-shadow: 0 4px 12px rgba(255,106,26,.45); animation: phFree 1.6s ease-in-out infinite; }
.photo-ask:active { transform: scale(.96); }

/* окно «Память»: не ловит нажатия первые 0.5 с; ссылка на бота — скромная, внизу */
.popup-overlay.just-opened, .popup-overlay.just-opened * { pointer-events: none !important; }
.proactive-cta { display: inline-flex !important; align-items: center; gap: 6px; margin-top: 10px; padding: 0; background: none !important; box-shadow: none !important;
    color: var(--accent, #D63384) !important; font-size: .82rem; font-weight: 700; text-decoration: underline; }
.proactive-cta[style*="display: none"] { display: none !important; }

/* кнопка фото в сообщении — отдельной строкой под текстом, не налезает на время */
.message .photo-offer-wrap { display: flex; width: 100%; margin: 8px 0 4px; }
.message .photo-offer-btn { max-width: 100%; }
.pa-short { display: none; }
@media (max-width: 520px) {
    .mode-bar { flex-wrap: nowrap; }
    .mode-bar .mode-chip { white-space: nowrap; }
    .photo-ask { padding: 7px 11px; font-size: .78rem; flex: 0 0 auto; }
    .photo-ask .pa-long { display: none; }
    .photo-ask .pa-short { display: inline; }
}

/* просмотр фото поверх чата */
.chat-lb { position: fixed; inset: 0; z-index: 10060; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(6,2,10,.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: lbIn .2s ease; touch-action: none; }
.chat-lb.out { animation: lbOut .2s ease forwards; }
@keyframes lbIn { from { opacity: 0; } }
@keyframes lbOut { to { opacity: 0; } }
.chat-lb img { max-width: 100%; max-height: calc(100svh - 110px); border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.6); transition: transform .15s; animation: lbZoom .25s cubic-bezier(.2,1.2,.4,1); }
@keyframes lbZoom { from { transform: scale(.9); } }
.chat-lb-x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255,255,255,.14); color: #fff; font-size: 1.8rem; line-height: 1; }
.chat-lb-hint { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.6); font-size: .82rem; }
body.chat-lb-open { overflow: hidden; }

/* ожидание фото */
.photo-wait { width: min(100%, 300px); margin: 8px 0 4px; padding: 12px 14px; border-radius: 16px; background: rgba(214,51,132,.1); border: 1px solid rgba(214,51,132,.35); }
.pw-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pw-head b { display: block; font-size: .9rem; color: var(--text-primary); line-height: 1.25; }
.pw-head small { color: var(--text-secondary); font-size: .76rem; font-variant-numeric: tabular-nums; }
.pw-cam { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff;
    background: linear-gradient(135deg, #ff5fa2, #D63384 55%, #8a2be2); animation: pwFlash 1.6s ease-in-out infinite; }
@keyframes pwFlash { 0%, 80%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } 88% { box-shadow: 0 0 0 6px rgba(255,255,255,.6); } }
.pw-bar { height: 5px; border-radius: 99px; background: rgba(214,51,132,.18); overflow: hidden; }
.pw-bar i { display: block; height: 100%; transform-origin: left; transform: scaleX(.05); transition: transform .25s linear; background: linear-gradient(90deg, #ff5fa2, #D63384, #8a2be2); }
.pw-stage { margin-top: 8px; font-size: .8rem; color: var(--text-secondary); font-style: italic; }

/* 30.09: на 360 px кнопка «Фото» вылезала за край на 9 px (режимы в одну строку без переноса) */
@media (max-width: 400px) {
    .mode-bar { gap: 5px; max-width: 100%; min-width: 0; }
    .mode-bar .mode-chip { padding: 6px 9px; font-size: .76rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .photo-ask { padding: 6px 10px; margin-left: auto; }
}
