#reviews {
    padding: 60px 0 80px;
    border-top: 1px solid var(--border-color);
}

#reviews h2 {
    font-size: 1.8rem;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    #reviews h2 { font-size: 2.5rem; }
}

/* ====================================================================
   ОБЁРТКА
   ==================================================================== */
.chat-feed-wrapper {
    position: relative;
    width: 100%;
}

/* ====================================================================
   ХАОТИЧНОЕ ПОЛЕ ПУЗЫРЕЙ — абсолютное позиционирование
   ==================================================================== */
.chat-feed {
    position: relative;
    min-height: 640px;
    overflow: visible;
    padding: 0;
}

/* ====================================================================
   ОДНО СООБЩЕНИЕ — общие стили
   ==================================================================== */
.chat-message {
    display: none;
    position: absolute;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    /* адаптивная ширина: не превышает ~28% экрана, но не уже 190px */
    max-width: clamp(190px, 28vw, 260px);
}

/* Шаг 1: занять место но остаться невидимым */
.chat-message.is-queued {
    display: flex;
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    will-change: opacity, transform;
}

/* Шаг 2: анимировать */
@keyframes bubble-in {
    0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0)    scale(1);    }
}

.chat-message.is-visible {
    animation: bubble-in 0.48s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* ---- Правосторонний пузырь ---- */
.chat-message--right {
    align-items: flex-end;
}

.chat-message--right .chat-bubble {
    border-radius: 18px 18px 4px 18px;
}

.chat-message--right .chat-bubble::before {
    left: auto;
    right: -6px;
    border-right-color: transparent;
    border-right: 0;
    border-left: 6px solid #ffffff;
    border-bottom: 0;
}

/* ====================================================================
   ЧАТ-ПУЗЫРЬ
   ==================================================================== */
.chat-bubble {
    background: #ffffff;
    border-radius: 18px 18px 18px 4px;
    padding: 13px 16px 11px;
    position: relative;
    width: fit-content;
    max-width: 100%;
    min-width: 80px;
    box-sizing: border-box;
}

/* треугольный хвостик */
.chat-bubble::before {
    content: '';
    position: absolute;
    left: -6px;
    bottom: 9px;
    border: 6px solid transparent;
    border-right-color: #ffffff;
    border-left: 0;
    border-bottom: 0;
}

.chat-bubble-text {
    font-size: 1rem;
    color: #111;
    line-height: 1.55;
    margin-bottom: 7px;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-reactions {
    display: flex;
    gap: 4px;
    font-size: 1rem;
    line-height: 1;
}

.chat-time {
    font-size: 0.7rem;
    color: #999;
    flex-shrink: 0;
    margin-left: auto;
}


/* ====================================================================
   ФОТО-СООБЩЕНИЕ (скриншот / благодарственное письмо)
   ==================================================================== */
.chat-photo-bubble {
    border-radius: 18px 18px 18px 4px;
    overflow: hidden;
    max-width: 320px;
    position: relative;
}

.chat-photo-bubble img {
    width: 100%;
    display: block;
    border-radius: inherit;
}

/* ====================================================================
   КАРУСЕЛЬ БЛАГОДАРСТВЕННЫХ ПИСЕМ
   ==================================================================== */
.letters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 48px;
    margin-bottom: 20px;
}

.letters-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.letters-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 0;
    margin-top: -8px;
    align-items: stretch;
}

.letters-track::-webkit-scrollbar { display: none; }

.letter-card {
    flex-shrink: 0;
    width: calc((100% - 48px) / 4);   /* 4 фото в ряд */
    scroll-snap-align: start;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    aspect-ratio: 3 / 4;              /* вертикальный формат письма */
    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.letter-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.letter-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
}

.letter-card:hover img {
    transform: scale(1.04);
}

/* Плейсхолдер если фото ещё нет */
.letter-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
}

/* ====================================================================
   ЛАЙТБОКС
   ==================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
    user-select: none;
}

.lightbox-img.is-switching {
    opacity: 0;
    transform: scale(0.96);
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 1;
}

.lightbox-btn:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.4);
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
}

/* ====================================================================
   АДАПТИВ
   ==================================================================== */
@media (max-width: 900px) {
    .letter-card { width: calc((100% - 32px) / 3); }
}

@media (max-width: 767px) {
    .letter-card { width: calc((100% - 16px) / 2); }
}

/* На экранах уже 700px — вертикальная лента */
@media (max-width: 699px) {
    .chat-feed {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: unset;
        overflow: visible;
        padding: 8px 0;
    }

    .chat-message,
    .chat-message--right {
        position: static;
        max-width: 85%;
    }

    .chat-message--right {
        align-self: flex-end;
    }
}
