.carousel {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.board {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.card {
    position: absolute;
    top: 20vw;
    left: 3vw;
    right: 3vw;
    aspect-ratio: 3 / 4;
    max-height: 80vh;
    background: none !important;
    border-radius: 5vw;
    z-index: 5;
    overflow: hidden;
}

/* 🔹 Обёртка для изоляции transform */
.card-inner {
    width: 100%;
    height: 100%;
    background-color: white;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 5vw;
    transform-origin: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.card-inner {
    width: 100%;
    height: 100%;
    background-color: white;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 5vw;
    /* Плавная анимация масштаба */
    transform-origin: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.end-card {
    background-image: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
    font-size: 1.2em;
    pointer-events: none;
    border: 2px dashed #ccc;
    background-color: #fafafa;
    box-sizing: border-box;
}

.card.ontop {
    z-index: 30;
}

.description-container {
    position: absolute;
    left: 2vw;
    right: 2vw;
    border-radius: 5vw;
    background: white;
    padding: 3vw;
    overflow: hidden;
    transition: top 0.5s ease;
    z-index: 10;
    box-sizing: border-box;
    transform: translateX(0) scale(1);
    opacity: 1;
    will-change: transform, opacity;
    min-height: 100vh;
}

.description-container.expanded {
    overflow: auto;
    z-index: 20;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    height: auto;
    max-height: 100vh;
    left: 0;
    right: 0;
    border-radius: 0;
    padding: 3vw 5vw; 
}

.description-container h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #333;
}

.description-container p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 12px;
}

.description-container .more_description {
    transition: opacity 0.5s ease;
    opacity: 0;
}

.description-container .more_description.visible {
    opacity: 1;
}

.description-container .wrap {
    display: block;
    padding-top: 4vw;
}

.description-container .label {
    display: block;
    position: relative;
    width: 100%;
    margin-bottom: 1vw;
    font-weight: bold;
    font-size: 5vw;
}

.description-container .text {
    display: flex;
    width: auto;
    height: auto;
    font-size: 5vw;
}

.description-container .text.bold {
    font-weight: bold;
}

.description-container .gender {
    display: flex;
    width: 5vw;
    height: 5vw;
    margin: 1vw;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.description-container .confirmed {
    display: flex;
    width: 5vw;
    height: 5vw;
    margin: 1vw;
    background-image: url('../img/carousel_confirmed.svg');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.description-container .location {
    display: flex;
    width: 3vw;
    height: 5vw;
    margin: 1vw;
    background-image: url('../img/carousel_location.svg');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.description-container .zodiac {
    display: flex;
    width: 5vw;
    height: 5vw;
    margin: 1vw;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.description-container .interests-group {
    display: flex;
    flex-wrap: wrap; /* 🔥 Перенос на новую строку */
    width: 100%;
    box-sizing: border-box;
    gap: 1vw; /* Отступы между чекбоксами */
}

.description-container .interests-item {
    display: flex;
    align-items: center;
    user-select: none;
    max-width: 50vw;
    min-height: 4vw;
    flex: 1 1 0%;
    box-sizing: border-box;
    text-align: left;
    padding-left: 0.9vw;
}

.description-container .interests-label {
    font-size: 3.9vw;
    color: #333;
    font-weight: 500;
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    padding: 0.8vw 1.2vw;
    border-radius: 1.6vw;
    box-shadow: inset 0 0 0 0.3vw #ffbe79;
    background-color: #ffe7cd;
    flex-grow: 1;
    text-align: left;
    line-height: 1.3;
    box-sizing: border-box;
}

.description-container .interests-label.similar {
    box-shadow: inset 0 0 0 0.3vw #ff6464;
    background-color: #f7d4af;
}

.carousel .back_button {
    position: fixed;
    left: 3vw;
    top: 3vw;
    width: 15vw;
    height: 15vw;
    background-image: url("../img/carousel_back.svg");
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    touch-action: manipulation;
}

.carousel .back_button.pressed {
    transform: scale(0.95);
    opacity: 0.8;
}

.carousel .back_button.rotating {
    animation: rotateBack 0.3s ease-out;
    pointer-events: none;
}

@keyframes rotateBack {
    from { transform: rotate(0deg) scale(0.95); }
    to   { transform: rotate(-360deg) scale(0.95); }
}

.carousel .match-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.carousel .match-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    max-width: 320px;
    position: relative;
}

.carousel .match-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

.carousel .match-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.carousel .match-buttons {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.carousel .match-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.carousel .match-btn.chat {
    background: #ff4d6d;
    color: white;
}

.carousel .match-btn.close {
    background: #ddd;
    color: #333;
}

@keyframes popIn {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}