:root {
    --ink: #25243a;
    --muted: #737287;
    --accent: #7457e8;
    --accent-dark: #6042d1;
    --soft: #f5f2ff;
    --line: #e8e5f0;
    --white: #fff;
    --rose: #e74370;
    --rose-soft: #fff0f4;
    --danger: #a82e48;
    --danger-soft: #fff4f5;
    --shadow: 0 12px 34px rgba(48, 33, 68, .08);
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(ellipse at 8% 12%, rgba(255, 220, 230, .58), transparent 34rem),
        radial-gradient(ellipse at 92% 36%, rgba(218, 232, 255, .48), transparent 38rem),
        linear-gradient(180deg, #faf9fc, #f8f7fb);
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 100%, rgba(255, 255, 255, .55), transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(255, 255, 255, .45), transparent 42%);
}

img {
    max-width: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
.button-link {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s ease, transform .15s ease;
}

button:hover,
.button-link:hover {
    filter: brightness(.96);
    text-decoration: none;
}

button:active {
    transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(116, 87, 232, .32);
    outline-offset: 2px;
}

button.secondary,
.button-light {
    background: #eeeaf8;
    color: var(--ink);
}

.button-danger {
    background: var(--danger);
    color: #fff;
}

.button-link {
    color: #fff;
}

.inline {
    display: inline;
    margin: 0;
}

/* Шапка и навигация */

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px max(20px, calc((100% - 1100px) / 2));
    border-bottom: 1px solid rgba(232, 229, 240, .9);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
}

.brand {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.04em;
}

nav,
.main-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.main-nav > a {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--ink);
    white-space: nowrap;
}

.main-nav > a:hover,
.main-nav-link.is-active {
    background: var(--soft);
    color: var(--accent-dark);
    text-decoration: none;
}

.main-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.link-button {
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 600;
}

.link-button:hover {
    text-decoration: underline;
}

.nav-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 1.1em;
    line-height: 1;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Основная ширина и заголовки */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.page-heading,
.section-heading {
    max-width: 760px;
    margin: 0 auto 22px;
    text-align: center;
}

.page-heading h1,
.section-heading h1 {
    margin: 4px 0 8px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

/* Баннер и гостевая главная */

.hero {
    margin-bottom: 28px;
    padding: 36px;
    border: 1px solid #eee7fb;
    border-radius: 24px;
    background: linear-gradient(135deg, #f1edff, #fff3f5);
}

.hero h1 {
    margin: 4px 0 8px;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.12;
    letter-spacing: -.045em;
}

.hero p:last-child {
    max-width: 680px;
}

.guest-hero {
    max-width: 760px;
    margin: 8vh auto;
    text-align: center;
}

.guest-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Сетки и карточки */

.grid,
.discovery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.card,
.discovery-card,
.form-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--white);
    box-shadow: 0 8px 26px rgba(48, 33, 68, .05);
}

.card,
.discovery-card {
    min-width: 0;
}

.profile-link {
    display: block;
    color: inherit;
}

.profile-link:hover {
    text-decoration: none;
}

.profile-link:hover h2 {
    color: var(--accent);
}

.avatar,
.discovery-photo {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    object-fit: cover;
    object-position: center;
    background: var(--soft);
}

.discovery-photo-link {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--soft);
}

.discovery-photo-link:hover {
    text-decoration: none;
}

.discovery-photo {
    transition: transform .25s ease;
}

.discovery-photo-link:hover .discovery-photo {
    transform: scale(1.025);
}

.card-body,
.discovery-content {
    min-width: 0;
    padding: 18px;
}

.discovery-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.discovery-title h2,
.profile-card-heading h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

.discovery-title span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 14px;
}

.profile-card-heading {
    padding-bottom: 0;
}

.profile-card-heading h2 {
    transition: color .15s ease;
}

.profile-card-heading p {
    margin: 4px 0 0;
}

.discovery-about {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.card-actions {
    padding-top: 12px;
}

.seeking-chip {
    display: inline-block;
    margin: 10px 0 2px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--rose-soft);
    color: #b62f55;
    font-size: 13px;
}

.badge {
    display: inline-block;
    margin: 4px 0 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--soft);
    color: var(--accent);
    font-size: 13px;
}

.discovery-photo-link .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    margin: 0;
    background: rgba(255, 255, 255, .94);
}

.badge-danger {
    background: #ffe6ea;
    color: var(--danger);
}

/* Кнопки симпатии */

.swipe-actions,
.person-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
}

.swipe-actions form,
.person-actions form {
    margin: 0;
}

.swipe-button {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 7px 20px rgba(50, 25, 40, .1);
    font-size: 27px;
    transition: transform .15s ease, box-shadow .15s ease;
}

.swipe-button:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 25px rgba(50, 25, 40, .16);
}

.like-button {
    color: var(--rose);
}

.pass-button {
    color: #77717a;
    font-size: 34px;
}

/* Фильтры */

.filter-bar {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 130px 130px auto;
    gap: 10px;
    align-items: end;
    margin: 22px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
}

.filter-bar input {
    margin: 0;
}

/* Формы */

.form-card {
    max-width: 620px;
    margin: 0 auto;
    padding: 24px;
}

.spaced {
    margin-top: 20px;
}

label {
    display: block;
    margin: 14px 0;
    font-weight: 600;
}

input,
textarea,
select {
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 6px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #c9bdf7;
    outline-offset: 1px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #fff4d9;
}

.consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 400;
}

.consent input {
    flex: 0 0 auto;
    width: auto;
    margin-top: 5px;
}

.report-box {
    margin-top: 14px;
}

.report-box summary {
    color: var(--accent);
    cursor: pointer;
}

.report-box form {
    padding-top: 8px;
}

/* Старая страница профиля */

.profile-page {
    display: grid;
    grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.profile-photo {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    max-height: 560px;
    border-radius: 16px;
    background: var(--soft);
    object-fit: cover;
    object-position: center;
}

.profile-info {
    min-width: 0;
}

.profile-info h1 {
    margin-top: 0;
}

.profile-about {
    margin: 18px 0;
    overflow-wrap: anywhere;
}

.profile-action {
    margin: 18px 0;
}

.back-link {
    margin-top: 24px;
}

/* Галерея старого шаблона анкеты */

.person-page {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(300px, .9fr);
    gap: 24px;
    align-items: start;
}

.person-gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    border-radius: 18px;
    background: var(--soft);
    object-fit: cover;
    object-position: center;
}

.person-gallery img:first-child:nth-last-child(1) {
    grid-column: 1 / -1;
    max-height: 620px;
    aspect-ratio: 4 / 5;
}

.person-details {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .93);
    box-shadow: var(--shadow);
}

.person-details h1 {
    margin: 2px 0 14px;
}

.detail-card {
    margin: 14px 0;
    padding: 16px;
    border-radius: 16px;
    background: #fff7f9;
}

.detail-card h2 {
    margin: 0 0 6px;
    font-size: 16px;
}

.detail-card p {
    margin: 0;
    overflow-wrap: anywhere;
}

.profile-more summary {
    margin: 16px 0;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

/* Полноэкранная открытая анкета.
   Фотография занимает всё окно под верхней шапкой. */

.person-full {
    position: relative;
    display: block;
    width: 100vw;
    min-height: calc(100dvh - var(--topbar-height));
    margin-right: calc((1100px - 100vw) / 2);
    margin-left: calc((1100px - 100vw) / 2);
    overflow: hidden;
    isolation: isolate;
    background: #201c29;
}

/* Если экран уже стандартного контейнера, центрируем полноэкранный блок */
@supports (width: 100svw) {
    .person-full {
        width: 100svw;
        margin-right: calc((1100px - 100svw) / 2);
        margin-left: calc((1100px - 100svw) / 2);
    }
}

.person-gallery-shell {
    position: absolute;
    z-index: 0;
    inset: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(135deg, rgba(255,255,255,.88), rgba(215,197,255,.75), rgba(255,224,232,.82));
    box-shadow:
        inset 0 0 22px rgba(255, 255, 255, .28),
        0 0 30px rgba(160, 118, 255, .3);
}

.person-gallery {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    background: #201c29;
    perspective: 1200px;
}

.person-gallery::before,
.person-gallery::after {
    position: absolute;
    z-index: 2;
    inset: 0;
    content: "";
    pointer-events: none;
}

.person-gallery::before {
    background:
        linear-gradient(90deg, rgba(255,255,255,.16), transparent 8%, transparent 92%, rgba(255,255,255,.18)),
        linear-gradient(180deg, rgba(15,12,22,.10), transparent 30%, transparent 52%, rgba(15,12,22,.74));
    mix-blend-mode: screen;
}

.person-gallery::after {
    box-shadow:
        inset 18px 0 24px rgba(255, 255, 255, .17),
        inset -18px 0 24px rgba(255, 255, 255, .17);
}

.person-gallery-photo {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center;
    background: #201c29;
}

.person-gallery-photo[hidden] {
    display: none;
}

.person-gallery .photo-arrow {
    z-index: 5;
}

.person-gallery .photo-dots {
    z-index: 5;
}

.person-details {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 54%;
    overflow-y: auto;
    padding: 28px max(22px, calc((100% - 900px) / 2)) 24px;
    border: 0;
    border-radius: 0;
    background: linear-gradient(
        180deg,
        rgba(24, 19, 32, 0),
        rgba(24, 19, 32, .74) 16%,
        rgba(24, 19, 32, .91)
    );
    color: #fff;
    box-shadow: none;
    backdrop-filter: blur(3px);
}

.person-details .eyebrow,
.person-details .muted {
    color: rgba(255, 255, 255, .78);
}

.person-details h1,
.person-details h2 {
    color: #fff;
}

.person-details .detail-card {
    display: inline-block;
    max-width: min(100%, 480px);
    margin: 8px 8px 0 0;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .13);
    color: #fff;
    backdrop-filter: blur(8px);
}

.person-details .detail-card h2 {
    margin-bottom: 3px;
    font-size: 14px;
}

.person-details .detail-card p {
    color: rgba(255, 255, 255, .95);
}

.person-details .back-link a {
    color: #fff;
}

.person-details .block-control {
    max-width: 620px;
    background: rgba(255, 255, 255, .94);
    color: var(--ink);
}

.person-details .block-control summary {
    color: var(--danger);
}

.person-details .person-actions {
    justify-content: flex-start;
    margin-top: 12px;
}

.person-details .badge {
    background: rgba(255, 255, 255, .92);
}

/* Менеджер фотографий в профиле */

.profile-editor,
.gallery-manager {
    margin-bottom: 22px;
}

.photo-management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.photo-management-item {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.photo-management-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: center;
}

.photo-pending {
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 5;
    place-items: center;
    padding: 12px;
    background: var(--rose-soft);
    color: #b62f55;
    text-align: center;
}

.photo-caption {
    padding: 8px 10px;
    color: var(--muted);
    font-size: 13px;
}

.photo-management-item form {
    padding: 0 10px 10px;
}

.photo-management-item button {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
}

/* Удаление анкеты */

.danger-zone {
    max-width: 620px;
    margin: 24px auto;
    padding: 20px;
    border: 1px solid #f0c7cf;
    border-radius: 18px;
    background: var(--danger-soft);
}

.danger-zone h2 {
    margin-top: 0;
    color: var(--danger);
}

/* Чаты и сообщения */

.chat-panel {
    max-width: 760px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.chat-header h1 {
    margin: 0;
    font-size: 20px;
    text-align: center;
}

.message-list {
    display: flex;
    min-height: 260px;
    max-height: 60vh;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 18px;
    background: #fffafd;
}

.message {
    max-width: min(80%, 520px);
    align-self: flex-start;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    background: #f4eff3;
}

.message p {
    margin: 0 0 4px;
    overflow-wrap: anywhere;
}

.message small {
    color: var(--muted);
    font-size: 11px;
}

.message-mine {
    align-self: flex-end;
    border-radius: 16px 16px 4px 16px;
    background: #ffe8ef;
}

.chat-compose {
    display: flex;
    align-items: end;
    gap: 10px;
    padding: 14px;
}

.chat-compose textarea {
    min-height: 46px;
    margin: 0;
    resize: vertical;
}

.chat-compose button {
    flex: 0 0 auto;
    min-height: 46px;
}

.chat-list {
    max-width: 760px;
    margin: 0 auto;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    color: var(--ink);
    transition: background .15s ease, transform .15s ease;
}

.chat-list-item:hover {
    transform: translateY(-1px);
    background: #fff7f9;
    text-decoration: none;
}

.chat-list-item img {
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--soft);
}

.chat-list-copy {
    display: grid;
    min-width: 0;
    flex: 1;
}

.chat-list-copy span {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.blocked-chat-label {
    color: var(--danger) !important;
}

/* Блокировка и причина */

.block-control {
    max-width: 620px;
    margin: 18px auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .9);
}

.block-control summary {
    color: var(--danger);
    font-weight: 700;
    cursor: pointer;
}

.block-notice {
    margin: 12px;
}

/* Уведомления и взаимные симпатии */

.notification-section,
.matches-strip-section,
.chat-threads-section {
    margin: 24px 0;
}

.notification-list {
    display: grid;
    gap: 10px;
}

.notification-card {
    margin: 0;
}

.notification-open {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    color: var(--ink);
    text-align: left;
}

.notification-open img {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
}

.notification-open span {
    display: grid;
}

.notification-open small {
    color: var(--muted);
}

.matches-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 2px 14px;
    scroll-snap-type: x mandatory;
}

.match-tile {
    flex: 0 0 150px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    text-align: center;
    scroll-snap-align: start;
}

.match-tile > a:first-child {
    display: grid;
    gap: 6px;
    color: var(--ink);
}

.match-tile img {
    width: 100%;
    aspect-ratio: 1 / 1.15;
    border-radius: 13px;
    object-fit: cover;
}

.match-chat-link {
    display: block;
    margin-top: 8px;
    padding: 8px;
    font-size: 13px;
}

/* Уведомления, пустые состояния */

.empty-state {
    padding: 40px 20px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .94);
    text-align: center;
}

.empty-state h2,
.empty-state h3 {
    margin-top: 0;
}

/* Админ-панель */

.admin-section {
    margin: 28px 0;
}

.admin-section > h2 {
    margin-bottom: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.admin-row,
.admin-card {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--white);
}

.admin-card {
    min-width: 0;
    box-shadow: 0 6px 20px rgba(48, 33, 68, .04);
}

.admin-card > div,
.admin-card-content {
    min-width: 150px;
    flex: 1;
}

.admin-card h3 {
    margin: 0 0 4px;
}

.admin-card p {
    margin: 5px 0;
}

.admin-row label {
    min-width: 150px;
}

.admin-row input,
.admin-row select {
    margin-top: 6px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-actions form {
    margin: 0;
}

.admin-photo-card {
    align-items: flex-start;
}

.admin-photo-preview {
    flex: 0 0 150px;
    width: 150px;
}

.admin-photo-preview img,
.moderation-photo {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
    background: var(--soft);
    object-fit: cover;
    object-position: center;
}

.report-content {
    overflow-wrap: anywhere;
}

/* Юридические страницы и подвал */

.not-found {
    text-align: center;
}

.legal {
    line-height: 1.7;
}

.footer {
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

/* Карточка анкет: слайдер */

.profile-deck {
    position: relative;
    width: 100%;
}

.deck-card {
    position: relative;
    min-height: min(76vh, 780px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 28px;
    background: #292333;
    box-shadow: 0 22px 70px rgba(39, 29, 54, .2);
    isolation: isolate;
}

.deck-card[hidden] {
    display: none;
}

.deck-photo-link,
.deck-photo-frame {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
}

.deck-photo-link {
    z-index: 0;
}

.deck-photo-frame {
    perspective: 1200px;
    background: #ddd6e8;
}

.deck-photo {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .34s ease, opacity .34s ease;
}

.deck-photo[hidden] {
    display: none;
}

.deck-scrim {
    position: absolute;
    z-index: 1;
    inset: 35% 0 0;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(17, 13, 25, .9));
}

.deck-info {
    position: absolute;
    z-index: 2;
    right: 22px;
    bottom: 100px;
    left: 22px;
    color: #fff;
    pointer-events: none;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
}

.deck-info h2 {
    margin: 4px 0;
    font-size: clamp(28px, 7vw, 42px);
    line-height: 1.08;
}

.deck-location,
.deck-interests,
.deck-about {
    margin: 6px 0;
}

.deck-about {
    display: -webkit-box;
    max-width: 58ch;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.deck-info .seeking-chip {
    background: rgba(255, 239, 245, .95);
    text-shadow: none;
}

.deck-actions {
    position: absolute;
    z-index: 3;
    right: 18px;
    bottom: 22px;
    left: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deck-nav-button,
.sympathy-button {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    color: var(--accent);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .2);
    font-size: 32px;
    cursor: pointer;
}

.sympathy-button {
    width: 66px;
    height: 66px;
    border: 3px solid rgba(255, 255, 255, .9);
    background: linear-gradient(135deg, #ff6f91, #8059e8);
    color: #fff;
    font-size: 38px;
}

.deck-counter {
    position: absolute;
    z-index: 3;
    top: 12px;
    right: 20px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(20, 16, 28, .44);
    color: #fff;
    font-size: 13px;
}

.deck-hint {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* Кнопки перехода фото */

.photo-arrow {
    position: absolute;
    z-index: 5;
    top: 50%;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    background: rgba(25, 20, 33, .38);
    color: #fff;
    font-size: 30px;
    transform: translateY(-50%);
}

.photo-arrow-prev {
    left: 12px;
}

.photo-arrow-next {
    right: 12px;
}

.photo-dots {
    position: absolute;
    z-index: 5;
    top: 14px;
    right: 55px;
    left: 55px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.photo-dots span {
    height: 3px;
    flex: 1;
    max-width: 80px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .48);
}

.photo-dots span.is-current {
    background: #fff;
}

/* Эффекты перелистывания */

.animate-cube {
    animation: cube-swap .34s ease;
}

.animate-rotate {
    animation: rotate-swap .38s ease;
}

@keyframes cube-swap {
    0% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotateY(70deg) scale(.94);
        opacity: .5;
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes rotate-swap {
    0% {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(8deg) scale(.94);
        opacity: .5;
    }
    100% {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

/* Слайдер взаимных симпатий и значки навигации */

.nav-gnome {
    display: inline-block;
    margin-right: 3px;
    font-size: 20px;
    transform-origin: center bottom;
}

.gnome-walk {
    animation: gnome-walk .55s ease-in-out infinite alternate;
}

.gnome-writing {
    animation: gnome-write .65s ease-in-out infinite alternate;
}

.gnome-kiss {
    animation: gnome-kiss .85s ease-in-out infinite;
}

.gnome-book {
    animation: gnome-book .9s ease-in-out infinite alternate;
}

@keyframes gnome-walk {
    to {
        transform: translateY(-2px) rotate(7deg);
    }
}

@keyframes gnome-write {
    to {
        transform: rotate(-8deg) translateY(-1px);
    }
}

@keyframes gnome-kiss {
    50% {
        transform: scale(1.16);
    }
}

@keyframes gnome-book {
    to {
        transform: rotateY(25deg);
    }
}

/* Планшеты */

@media (max-width: 900px) {
    .person-details {
        padding-right: 20px;
        padding-left: 20px;
    }

    .person-details .detail-card {
        max-width: 100%;
    }
}

/* Мобильные устройства */

@media (max-width: 700px) {
    :root {
        --topbar-height: 56px;
    }

    .topbar {
        align-items: center;
        flex-direction: row;
        gap: 8px;
        padding: 8px 14px;
    }

    .brand {
        font-size: 19px;
    }

    .main-nav,
    nav {
        width: auto;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }

    .main-nav > a,
    .link-button {
        flex: 0 0 auto;
        padding: 7px 9px;
        font-size: 13px;
    }

    .container {
        padding: 18px 12px 42px;
    }

    .hero {
        margin-bottom: 20px;
        padding: 24px 20px;
        border-radius: 20px;
    }

    .grid,
    .discovery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .card,
    .discovery-card {
        border-radius: 16px;
    }

    .avatar,
    .discovery-photo {
        aspect-ratio: 3 / 4;
    }

    .card-body,
    .discovery-content {
        padding: 11px;
    }

    .discovery-title {
        display: block;
    }

    .discovery-title h2,
    .profile-card-heading h2 {
        font-size: 16px;
        line-height: 1.25;
    }

    .discovery-title span {
        display: block;
        margin-top: 3px;
        font-size: 12px;
    }

    .discovery-about {
        font-size: 13px;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }

    .discovery-content .muted {
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .seeking-chip {
        max-width: 100%;
        margin-top: 7px;
        padding: 4px 8px;
        font-size: 11px;
        line-height: 1.3;
    }

    .swipe-actions {
        gap: 10px;
        margin-top: 12px;
    }

    .swipe-button {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .pass-button {
        font-size: 28px;
    }

    .discovery-content .button-link {
        display: block;
        padding: 8px;
        font-size: 12px;
        text-align: center;
    }

    .filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 12px;
    }

    .filter-bar input:first-of-type {
        grid-column: 1 / -1;
    }

    .filter-bar button {
        grid-column: 1 / -1;
    }

    .profile-page,
    .person-page {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .profile-photo {
        width: 100%;
        max-height: none;
        aspect-ratio: 4 / 5;
    }

    .person-gallery img {
        aspect-ratio: 3 / 4;
        border-radius: 14px;
    }

    .person-gallery img:first-child:nth-last-child(1) {
        max-height: none;
        aspect-ratio: 4 / 5;
    }

    .person-details {
        padding: 18px;
    }

    .form-card {
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .admin-row,
    .admin-card {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions form,
    .admin-actions button {
        width: 100%;
    }

    .admin-photo-preview {
        width: min(100%, 240px);
        flex-basis: auto;
    }

    /* Нижняя навигация на мобильном */
    .main-nav {
        position: fixed;
        z-index: 50;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        justify-content: space-around;
        gap: 2px;
        padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(232, 229, 240, .95);
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(14px);
    }

    .main-nav > a.main-nav-link {
        display: grid;
        min-width: 52px;
        justify-items: center;
        gap: 1px;
        padding: 4px 5px;
        font-size: 10px;
        line-height: 1.15;
    }

    .main-nav .logout-form {
        flex: 0 0 auto;
    }

    .main-nav .logout-button {
        display: grid;
        min-width: 46px;
        justify-items: center;
        gap: 1px;
        padding: 4px 5px;
        font-size: 10px;
        line-height: 1.15;
    }

    .nav-gnome,
    .nav-icon {
        margin: 0;
        font-size: 20px;
    }

    body {
        padding-bottom: calc(62px + env(safe-area-inset-bottom));
    }

    .footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    /* Одноэкранная карточка просмотра анкет */
    .discovery-page {
        max-width: none;
    }

    .discovery-page > .page-heading {
        margin-bottom: 12px;
    }

    .deck-card {
        min-height: min(76dvh, 780px);
        border-radius: 20px;
    }

    .deck-info {
        right: 16px;
        bottom: 94px;
        left: 16px;
    }

    .deck-info h2 {
        font-size: 30px;
    }

    /* Открытая анкета: фото занимает всю ширину и высоту окна,
       детали остаются поверх нижней части фотографии. */
    .person-full {
        width: 100vw;
        width: 100svw;
        min-height: calc(100dvh - var(--topbar-height));
        margin-right: -12px;
        margin-left: -12px;
        overflow: hidden;
    }

    .person-gallery-shell,
    .person-gallery {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .person-gallery-photo {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
        border-radius: 0;
        object-fit: cover;
    }

    .person-details {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 58%;
        overflow-y: auto;
        padding: 24px 16px 20px;
        border-radius: 0;
        background: linear-gradient(
            180deg,
            rgba(24, 19, 32, 0),
            rgba(24, 19, 32, .76) 18%,
            rgba(24, 19, 32, .93)
        );
        color: #fff;
    }

    .person-details h1,
    .person-details h2 {
        color: #fff;
    }

    .person-details .detail-card {
        display: block;
        width: fit-content;
        max-width: 100%;
        margin: 8px 0;
        padding: 9px 12px;
        border: 1px solid rgba(255, 255, 255, .22);
        border-radius: 13px;
        background: rgba(255, 255, 255, .13);
    }

    .person-details .eyebrow {
        color: rgba(255, 255, 255, .78);
    }

    .person-details .back-link a {
        color: #fff;
    }

    .person-gallery .photo-arrow {
        width: 38px;
        height: 38px;
    }

    .guest-hero {
        margin-top: 24px;
    }

    .chat-panel {
        border-radius: 18px;
    }

    .chat-header {
        gap: 6px;
        padding: 12px;
    }

    .chat-header h1 {
        font-size: 16px;
    }

    .chat-header a {
        font-size: 13px;
    }

    .message-list {
        max-height: 55dvh;
        padding: 12px;
    }
}

/* Очень узкие телефоны */
@media (max-width: 360px) {
    .container {
        padding-right: 10px;
        padding-left: 10px;
    }

    .grid,
    .discovery-grid {
        gap: 8px;
    }

    .card-body,
    .discovery-content {
        padding: 9px;
    }

    .discovery-title h2,
    .profile-card-heading h2 {
        font-size: 15px;
    }

    .swipe-button {
        width: 38px;
        height: 38px;
    }

    .main-nav > a.main-nav-link {
        min-width: 45px;
        padding-right: 3px;
        padding-left: 3px;
        font-size: 9px;
    }

    .nav-gnome,
    .nav-icon {
        font-size: 18px;
    }
}

/* Уменьшение анимации по настройке устройства */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }

    .animate-cube,
    .animate-rotate,
    .gnome-walk,
    .gnome-writing,
    .gnome-kiss,
    .gnome-book {
        animation: none !important;
    }
}


/* Экран просмотра анкет и открытой анкеты — без прокрутки всей страницы */
.immersive-page {
    overflow: hidden;
}

.immersive-page .footer {
    display: none;
}

.immersive-page .container {
    width: 100%;
    max-width: none;
    height: calc(100dvh - var(--topbar-height, 64px));
    min-height: 0;
    overflow: hidden;
    padding: 10px 18px 12px;
}

.immersive-page .discovery-page {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 760px;
    flex-direction: column;
    margin: 0 auto;
}

.immersive-page .discovery-heading {
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.immersive-page .discovery-heading h1 {
    margin: 0;
    font-size: 22px;
}

.immersive-page .discovery-heading .eyebrow {
    margin-bottom: 0;
    font-size: 11px;
}

.immersive-page .profile-deck {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.immersive-page .deck-card {
    position: absolute;
    inset: 0;
    min-height: 0;
    overflow: visible;
    border: 0;
    border-radius: 26px;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
}

.immersive-page .deck-card[hidden] {
    display: none;
}

/* Фото-карты позади главного снимка */
.deck-photo-stack {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
}

.deck-stack-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 26px;
    background: #ddd6e8;
    object-fit: cover;
    box-shadow: 0 10px 28px rgba(35, 25, 48, .2);
}

.deck-stack-photo-back {
    transform: translate(10px, -8px) rotate(2deg) scale(.975);
    opacity: .7;
}

.deck-stack-photo-front {
    transform: translate(5px, -4px) rotate(1deg) scale(.988);
    opacity: .88;
}

.immersive-page .deck-photo-frame {
    position: absolute;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 26px;
    background: #282230;
    box-shadow:
        0 14px 42px rgba(35, 25, 48, .22),
        0 0 22px rgba(203, 175, 255, .45),
        inset 0 0 0 3px rgba(255, 255, 255, .22);
}

.immersive-page .deck-photo-frame::after {
    position: absolute;
    z-index: 2;
    inset: 0;
    content: "";
    pointer-events: none;
    border: 5px solid rgba(255, 255, 255, .16);
    border-radius: inherit;
    box-shadow:
        inset 12px 0 20px rgba(255, 255, 255, .2),
        inset -12px 0 20px rgba(255, 255, 255, .2);
}

.immersive-page .deck-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.immersive-page .deck-open-profile {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 26px;
    background: transparent;
}

.immersive-page .deck-open-profile:hover,
.immersive-page .deck-open-profile:focus {
    background: transparent;
    filter: none;
}

.immersive-page .deck-scrim {
    z-index: 3;
    border-radius: 26px;
    background: linear-gradient(
        180deg,
        rgba(17, 13, 25, .04) 30%,
        rgba(17, 13, 25, .18) 54%,
        rgba(17, 13, 25, .82) 100%
    );
    pointer-events: none;
}

.immersive-page .deck-info {
    z-index: 4;
    right: 20px;
    bottom: 104px;
    left: 20px;
    pointer-events: none;
}

.immersive-page .deck-actions {
    z-index: 6;
    right: 14px;
    bottom: 16px;
    left: 14px;
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 9px;
    align-items: center;
}

.deck-reaction-form {
    min-width: 0;
    margin: 0;
}

.deck-action-pill {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 999px;
    background: rgba(255, 255, 255, .29);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .13);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}

.deck-action-pill:hover {
    background: rgba(255, 255, 255, .42);
    transform: translateY(-2px);
}

.deck-action-pill > span:first-child {
    font-size: 21px;
}

.deck-chat-pill {
    min-height: 52px;
    background: rgba(116, 87, 232, .54);
    color: #fff;
}

.deck-chat-pill:hover {
    background: rgba(116, 87, 232, .72);
    text-decoration: none;
}

.immersive-page .deck-counter {
    z-index: 6;
}

.immersive-page .photo-arrow,
.immersive-page .photo-dots {
    z-index: 6;
}

.immersive-page .deck-hint {
    flex: 0 0 auto;
    margin: 5px 0 0;
    font-size: 11px;
}

/* Выбранный эффект смены фотографий */
.animate-cube {
    animation: profile-cube-turn .38s ease both;
}

.animate-rotate {
    animation: profile-photo-rotate .4s ease both;
}

@keyframes profile-cube-turn {
    0% {
        transform: perspective(1000px) rotateY(0) scale(1);
        opacity: 1;
    }
    45% {
        transform: perspective(1000px) rotateY(-72deg) scale(.96);
        opacity: .45;
    }
    100% {
        transform: perspective(1000px) rotateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes profile-photo-rotate {
    0% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
    45% {
        transform: scale(.94) rotate(-5deg);
        opacity: .48;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

/* Открытая анкета: фото на весь экран, детали — выдвижная панель */
.person-full {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border-radius: 22px;
    background: #201c29;
    isolation: isolate;
}

.person-gallery-shell,
.person-gallery {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #fff, #d7c5ff, #ffe0e8, #fff);
    box-shadow:
        inset 0 0 22px rgba(255, 255, 255, .25),
        0 0 28px rgba(160, 118, 255, .32);
}

.person-gallery {
    background: #201c29;
    perspective: 1200px;
}

.person-gallery-photo {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 5px solid rgba(255, 255, 255, .78);
    border-radius: inherit;
    object-fit: cover;
    object-position: center;
    box-shadow:
        inset 0 0 24px rgba(255, 255, 255, .25),
        0 0 25px rgba(198, 164, 255, .55);
}

.person-gallery-photo[hidden] {
    display: none;
}

.person-gallery::after {
    position: absolute;
    z-index: 2;
    inset: 5px;
    content: "";
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .32);
    border-radius: inherit;
    box-shadow:
        inset 14px 0 24px rgba(255, 255, 255, .18),
        inset -14px 0 24px rgba(255, 255, 255, .18);
}

.person-gallery .photo-arrow,
.person-gallery .photo-dots {
    z-index: 5;
}

/* Ручка и выдвижная панель */
.person-info-handle {
    position: absolute;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, .42);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: rgba(32, 27, 42, .72);
    color: #fff;
    font-size: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.person-info-grip {
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .86);
}

.person-info-drawer {
    position: absolute;
    z-index: 7;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(72%, 620px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .42);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: rgba(33, 27, 43, .91);
    color: #fff;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, .18);
    transform: translateY(calc(100% - 58px));
    transition: transform .32s cubic-bezier(.2, .75, .25, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.person-full.info-open .person-info-drawer {
    transform: translateY(0);
}

.person-info-scroll {
    max-height: min(72vh, 620px);
    overflow-y: auto;
    padding: 22px 22px 80px;
    overscroll-behavior: contain;
}

.person-info-drawer h1,
.person-info-drawer h2 {
    color: #fff;
}

.person-info-drawer .eyebrow {
    color: rgba(255, 255, 255, .72);
}

.person-info-drawer .detail-card {
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, .17);
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.person-info-drawer .detail-card p {
    color: rgba(255, 255, 255, .92);
}

.person-chat-button {
    display: inline-block;
    margin: 10px 0;
}

.person-info-drawer .back-link a {
    color: #fff;
}

/* Мобильный вид */
@media (max-width: 700px) {
    .immersive-page {
        --topbar-height: 56px;
        --mobile-nav-height: 64px;
    }

    .immersive-page .container {
        height: calc(100dvh - var(--topbar-height) - var(--mobile-nav-height));
        padding: 6px 10px 5px;
    }

    .immersive-page .discovery-heading {
        margin-bottom: 5px;
    }

    .immersive-page .discovery-heading h1 {
        font-size: 18px;
    }

    .immersive-page .deck-card {
        border-radius: 20px;
    }

    .deck-stack-photo,
    .immersive-page .deck-photo-frame,
    .immersive-page .deck-open-profile,
    .immersive-page .deck-scrim {
        border-radius: 20px;
    }

    .deck-stack-photo-back {
        transform: translate(7px, -6px) rotate(2deg) scale(.97);
    }

    .deck-stack-photo-front {
        transform: translate(3px, -3px) rotate(1deg) scale(.985);
    }

    .immersive-page .deck-info {
        right: 14px;
        bottom: 86px;
        left: 14px;
    }

    .immersive-page .deck-info h2 {
        font-size: clamp(25px, 7vw, 34px);
    }

    .immersive-page .deck-actions {
        right: 9px;
        bottom: 10px;
        left: 9px;
        gap: 6px;
    }

    .deck-action-pill {
        min-height: 44px;
        gap: 4px;
        padding: 7px 5px;
        font-size: 11px;
    }

    .deck-action-pill > span:first-child {
        font-size: 18px;
    }

    .deck-chat-pill {
        min-height: 48px;
    }

    .immersive-page .deck-counter {
        top: 10px;
        right: 12px;
    }

    .immersive-page .deck-hint {
        font-size: 10px;
    }

    .person-full {
        border-radius: 18px;
    }

    .person-gallery-photo {
        border-width: 4px;
    }

    .person-info-drawer {
        max-height: 76%;
        border-radius: 18px 18px 0 0;
    }

    .person-info-scroll {
        max-height: 76dvh;
        padding: 18px 16px calc(76px + env(safe-area-inset-bottom));
    }

    .person-info-handle {
        min-height: 54px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .person-full.info-open .person-info-drawer {
        max-height: 76%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .animate-cube,
    .animate-rotate {
        animation: none !important;
    }

    .person-info-drawer {
        transition: none !important;
    }
}

/* Фото анкеты:
   размытый дубликат заполняет фон,
   основное фото целиком сохраняет пропорции. */

.immersive-page .person-full {
    position: relative;
    display: block;
    width: 100%;
    max-width: 760px;
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 24px;
    background: #282230;
    box-shadow:
        0 14px 42px rgba(35, 25, 48, .22),
        0 0 24px rgba(203, 175, 255, .4);
    isolation: isolate;
}

.immersive-page .person-gallery-shell,
.immersive-page .person-gallery {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: inherit;
}

.immersive-page .person-gallery-shell {
    padding: 6px;
    background: linear-gradient(
        135deg,
        #fff,
        #d7c5ff,
        #ffe0e8,
        #fff
    );
    box-shadow:
        inset 0 0 22px rgba(255, 255, 255, .34),
        0 0 25px rgba(160, 118, 255, .4);
}

.immersive-page .person-gallery {
    background: #282230;
    perspective: 1200px;
}

/* Размытый фоновый слой: заполняет окно без пустых краёв. */
.person-gallery-backdrop {
    position: absolute;
    z-index: 0;
    inset: -5%;
    display: block;
    width: 110%;
    height: 110%;
    object-fit: cover;
    object-position: center;
    filter: blur(22px) brightness(.58) saturate(.9);
    transform: scale(1.04);
    pointer-events: none;
}

/* Основной слой показывает фотографию полностью и без искажения. */
.immersive-page .person-gallery-photo {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 8px;
    border: 0;
    border-radius: inherit;
    object-fit: contain;
    object-position: center;
    background: transparent;
    box-shadow: none;
}

.immersive-page .person-gallery-photo[hidden] {
    display: none;
}

/* Светящаяся окантовка «зеркала». */
.immersive-page .person-gallery::after {
    position: absolute;
    z-index: 3;
    inset: 5px;
    content: "";
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .44);
    border-radius: inherit;
    box-shadow:
        inset 12px 0 20px rgba(255, 255, 255, .16),
        inset -12px 0 20px rgba(255, 255, 255, .16),
        0 0 18px rgba(213, 190, 255, .28);
}

.person-gallery .photo-dots {
    z-index: 5;
}

.immersive-page .person-info-handle,
.immersive-page .person-info-drawer {
    z-index: 7;
}

@media (max-width: 700px) {
    .immersive-page .person-full {
        width: 100%;
        max-width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        border-radius: 20px;
    }

    .immersive-page .person-gallery-shell {
        padding: 5px;
    }

    .immersive-page .person-gallery {
        border-radius: 15px;
    }

    .immersive-page .person-gallery-photo {
        padding: 6px;
    }

    .person-gallery-backdrop {
        filter: blur(18px) brightness(.58);
    }
}

@media (prefers-reduced-motion: reduce) {
    .animate-cube,
    .animate-rotate {
        animation: none !important;
    }
}

/* Единые размеры и равномерное распределение пунктов навигации */
.main-nav {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.main-nav-link,
.logout-button {
    display: inline-flex;
    min-width: 92px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 10px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.main-nav-link.is-active,
.mobile-nav-item.is-active {
    background: rgba(129, 100, 220, .13);
}

.nav-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
}

.logout-form,
.mobile-nav-logout {
    display: contents;
}

.mobile-nav {
    display: none;
}

/* Страница анкеты занимает доступное окно между шапкой и нижней навигацией */
body.person-page {
    height: 100dvh;
    overflow: hidden;
}

.person-page .container {
    position: fixed;
    z-index: 1;
    top: var(--person-top, 70px);
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    align-items: stretch;
    justify-content: center;
    margin: 0;
    padding: 10px 18px;
    overflow: hidden;
}

.person-page .footer {
    display: none;
}

.person-page .person-full {
    position: relative;
    width: 100%;
    max-width: 760px;
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 24px;
    background: #292333;
    box-shadow:
        0 14px 42px rgba(35, 25, 48, .22),
        0 0 24px rgba(203, 175, 255, .38);
    isolation: isolate;
}

/* Фото полностью видно, а его копия заполняет фон карточки */
.person-page .person-gallery-shell,
.person-page .person-gallery {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: inherit;
}

.person-page .person-gallery-shell {
    padding: 6px;
    background: linear-gradient(135deg, #fff, #d7c5ff, #ffe0e8, #fff);
    box-shadow:
        inset 0 0 22px rgba(255, 255, 255, .32),
        0 0 24px rgba(160, 118, 255, .38);
}

.person-page .person-gallery {
    background: #2d2833;
    perspective: 1200px;
}

.person-gallery-backdrop {
    position: absolute;
    z-index: 0;
    inset: -5%;
    width: 110%;
    height: 110%;
    object-fit: cover;
    object-position: center;
    filter: blur(22px) brightness(.62);
    transform: scale(1.04);
    pointer-events: none;
}

.person-page .person-gallery-photo {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 8px;
    border: 0;
    border-radius: inherit;
    object-fit: contain;
    object-position: center;
    background: transparent;
    box-shadow: none;
}

.person-page .person-gallery-photo[hidden] {
    display: none;
}

.person-page .person-gallery::after {
    position: absolute;
    z-index: 3;
    inset: 5px;
    content: "";
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .44);
    border-radius: inherit;
    box-shadow:
        inset 12px 0 20px rgba(255, 255, 255, .16),
        inset -12px 0 20px rgba(255, 255, 255, .16),
        0 0 18px rgba(213, 190, 255, .28);
}

/* Кнопки фото: только для компьютера */
.person-gallery-control {
    position: absolute;
    z-index: 6;
    top: 50%;
    display: flex;
    width: 44px;
    height: 54px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 999px;
    background: rgba(35, 28, 45, .42);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.person-gallery-control:hover {
    background: rgba(35, 28, 45, .68);
}

.person-gallery-control-prev {
    left: 14px;
}

.person-gallery-control-next {
    right: 14px;
}

.person-gallery-dots {
    position: absolute;
    z-index: 5;
    top: 14px;
    left: 50%;
    display: flex;
    gap: 5px;
    transform: translateX(-50%);
}

.person-gallery-dots span {
    width: 18px;
    height: 3px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .48);
}

.person-gallery-dots span.is-current {
    background: #fff;
}

/* Закрытая панель всегда показывает имя, возраст и город */
.person-page .person-info-handle {
    position: absolute;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: 78px;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 14px;
    padding: 11px 18px calc(11px + env(safe-area-inset-bottom));
    border: 1px solid rgba(255, 255, 255, .72);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, .84);
    color: #292333;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 -8px 24px rgba(30, 20, 45, .1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.person-info-grip {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: rgba(73, 61, 88, .28);
    transform: translateX(-50%);
}

.person-info-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.person-info-summary strong {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-info-summary > span {
    color: #655d70;
    font-size: 13px;
}

.person-info-action {
    color: #6551b5;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* Открытая панель полностью накрывает окно анкеты */
.person-page .person-info-drawer {
    position: absolute;
    z-index: 9;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 22px;
    background: rgba(255, 255, 255, .92);
    color: #292333;
    box-shadow: 0 0 35px rgba(30, 20, 45, .18);
    transform: translateY(101%);
    transition: transform .32s cubic-bezier(.2, .75, .25, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.person-page.info-open .person-info-drawer {
    transform: translateY(0);
}

.person-info-drawer-heading {
    display: flex;
    flex: 0 0 auto;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(80, 65, 100, .12);
}

.person-info-close {
    min-height: 38px;
    padding: 6px 18px;
    border: 0;
    border-radius: 999px;
    background: rgba(112, 84, 190, .1);
    color: #463780;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.person-info-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
}

.person-page .person-info-drawer h1,
.person-page .person-info-drawer h2 {
    color: #292333;
}

.person-page .person-info-drawer .eyebrow,
.person-page .person-info-drawer .detail-card p {
    color: #5e5669;
}

.person-page .person-info-drawer .detail-card {
    margin: 10px 0;
    border: 1px solid rgba(78, 65, 96, .14);
    background: rgba(255, 255, 255, .62);
    color: #292333;
}

.person-page .person-info-drawer .back-link a {
    color: #514099;
}

@media (max-width: 700px) {
    :root {
        --mobile-nav-height: 66px;
        --mobile-header-height: 52px;
    }

    .topbar {
        min-height: var(--mobile-header-height);
    }

    /* На мобильном пункты меню равномерно занимают ширину экрана. */
    .topbar .main-nav {
        display: none;
    }

    .mobile-nav {
        position: fixed;
        z-index: 50;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(var(--mobile-nav-count, 6), minmax(0, 1fr));
        gap: 0;
        min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
        padding: 5px 3px calc(5px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(80, 65, 100, .12);
        background: rgba(255, 255, 255, .94);
        box-shadow: 0 -4px 18px rgba(38, 28, 54, .08);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .mobile-nav:has(.mobile-nav-logout) {
        --mobile-nav-count: 7;
    }

    .mobile-nav-item {
        display: flex;
        width: 100%;
        min-width: 0;
        min-height: 52px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        padding: 4px 1px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #332d3c;
        font: inherit;
        text-align: center;
        text-decoration: none;
        cursor: pointer;
    }

    .mobile-nav-item .nav-icon {
        font-size: 18px;
    }

    .mobile-nav-item .nav-label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        font-size: clamp(8px, 2.3vw, 10px);
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .person-page .container {
        top: var(--mobile-header-height);
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
        height: auto;
        padding: 0;
    }

    .person-page .person-full {
        width: 100%;
        max-width: none;
        height: 100%;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .person-page .person-gallery-shell {
        padding: 4px;
    }

    .person-page .person-gallery,
    .person-page .person-gallery-photo {
        border-radius: 0;
    }

    .person-page .person-gallery-photo {
        padding: 5px;
    }

    .person-gallery-backdrop {
        filter: blur(18px) brightness(.62);
    }

    .person-gallery-control {
        display: none !important;
    }

    .person-page .person-info-drawer {
        border-radius: 0;
    }

    .person-info-scroll {
        padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .animate-cube,
    .animate-rotate,
    .person-info-drawer {
        animation: none !important;
        transition: none !important;
    }
}

/* На компьютере навигация остаётся обычной горизонтальной панелью */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.logout-form {
    display: block;
    margin: 0;
}

.main-nav-link,
.main-nav .logout-button {
    display: inline-flex;
    min-width: 88px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 10px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.main-nav-link.is-active {
    background: rgba(129, 100, 220, .13);
}

.nav-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
}

/* Мобильная версия: меню возвращено наверх и растянуто на всю ширину */
@media (max-width: 700px) {
    :root {
        --mobile-menu-height: 66px;
    }

    .topbar {
        position: fixed;
        z-index: 100;
        top: 0;
        right: 0;
        left: 0;
        display: flex;
        width: 100%;
        min-height: var(--mobile-menu-height);
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
        border-bottom: 1px solid rgba(80, 65, 100, .13);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 4px 16px rgba(38, 28, 54, .08);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    /* Освобождаем всю ширину для пунктов меню. */
    .topbar .brand {
        display: none;
    }

    .topbar .main-nav {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(var(--mobile-menu-items, 6), minmax(0, 1fr));
        align-items: stretch;
        justify-content: stretch;
        gap: 0;
        padding: 4px 3px;
    }

    /* У зарегистрированного пользователя 5–7 пунктов,
       число колонок задаётся по фактическому числу пунктов. */
    .topbar .main-nav:has(.logout-form) {
        --mobile-menu-items: 6;
    }

    .topbar .main-nav:has(.logout-form):has(a[href="/?r=admin"]) {
        --mobile-menu-items: 7;
    }

    .topbar .main-nav > a,
    .topbar .main-nav > .logout-form {
        display: flex;
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    .topbar .main-nav-link,
    .topbar .main-nav .logout-button {
        display: flex;
        width: 100%;
        min-width: 0;
        min-height: 56px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        padding: 4px 1px;
        border-radius: 9px;
        white-space: normal;
    }

    .topbar .main-nav-link.is-active {
        background: rgba(129, 100, 220, .15);
    }

    .topbar .main-nav-link .nav-icon,
    .topbar .main-nav .logout-button .nav-icon {
        font-size: 18px;
    }

    .topbar .nav-label {
        display: block;
        width: 100%;
        overflow-wrap: anywhere;
        font-size: clamp(8px, 2.25vw, 10px);
        line-height: 1.05;
        text-align: center;
    }

    /* Убираем старую нижнюю навигацию, если она осталась в прежнем CSS. */
    .mobile-nav {
        display: none !important;
    }

    /* Контент обычных страниц начинается ниже закреплённого меню. */
    body:not(.person-page) .container {
        padding-top: calc(var(--mobile-menu-height) + 12px);
    }

    /* Открытая анкета занимает место под верхним меню до низа экрана. */
    .person-page {
        height: 100dvh;
        overflow: hidden;
    }

    .person-page .container {
        position: fixed;
        z-index: 1;
        top: var(--mobile-menu-height);
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .person-page .person-full {
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 0;
        margin: 0;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .person-page .person-gallery-shell {
        padding: 4px;
    }

    .person-page .person-gallery,
    .person-page .person-gallery-photo {
        border-radius: 0;
    }

    /* Стрелки остаются только на компьютере — на телефоне листают свайпом. */
    .person-page .person-gallery-control {
        display: none !important;
    }

    /* На мобильном нет нижнего меню, поэтому анкета доходит до края экрана. */
    .person-page .footer {
        display: none;
    }
}

/* Сведения привязаны к нижнему краю окна анкеты.
   При открытии шторка поднимается и закрывает фотографию целиком. */
.person-page .person-full {
    position: relative;
    overflow: hidden;
}

.person-page .person-info-handle {
    position: absolute;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
}

.person-page .person-info-drawer {
    position: absolute;
    z-index: 9;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
    max-height: none;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: inherit;
    background: rgba(255, 255, 255, .97);
    color: #292333;
    box-shadow: 0 0 35px rgba(30, 20, 45, .2);
    transform: translateY(101%);
    transition: transform .34s cubic-bezier(.2, .75, .25, 1);
    pointer-events: none;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.person-page.info-open .person-info-drawer {
    transform: translateY(0);
    pointer-events: auto;
}

.person-page .person-info-drawer-heading {
    display: flex;
    flex: 0 0 auto;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(80, 65, 100, .14);
}

.person-page .person-info-close {
    min-height: 38px;
    padding: 6px 18px;
    border: 0;
    border-radius: 999px;
    background: rgba(112, 84, 190, .11);
    color: #463780;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.person-page .person-info-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
}

.person-page .person-info-drawer h1,
.person-page .person-info-drawer h2 {
    color: #292333;
}

.person-page .person-info-drawer .eyebrow,
.person-page .person-info-drawer .detail-card p {
    color: #5e5669;
}

.person-page .person-info-drawer .detail-card {
    border: 1px solid rgba(78, 65, 96, .14);
    background: rgba(255, 255, 255, .7);
    color: #292333;
}

@media (prefers-reduced-motion: reduce) {
    .person-page .person-info-drawer {
        transition: none;
    }
}


/* Исправление нижней панели на странице полной анкеты.
   Вставить в самый конец style.css. */

.person-page .person-full {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Закрытая ручка остаётся поверх скрытой панели и принимает касания */
.person-page .person-info-handle {
    z-index: 8;
    touch-action: none;
}

/* Панель в закрытом состоянии скрыта за нижним краем карточки.
   Видимая ручка остаётся отдельной кнопкой. */
.person-page .person-info-drawer {
    position: absolute;
    z-index: 7;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    inset: auto 0 0;

    display: flex;
    flex-direction: column;

    width: 100%;
    height: min(78%, 620px);
    max-height: 78%;
    min-height: 0;

    margin: 0;
    padding: 0;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, .82);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;

    background: rgba(255, 255, 255, .94);
    color: #292333;
    box-shadow: 0 -12px 36px rgba(30, 20, 45, .2);

    /* Скрыта; ручка остаётся видимой поверх неё */
    transform: translateY(calc(100% - 1px));
    transition: transform .32s cubic-bezier(.2, .75, .25, 1);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Важно: info-open переключается на article.person-full,
   поэтому состояние открытой панели задаём именно через него. */
.person-page .person-full.info-open .person-info-drawer {
    z-index: 9;
    transform: translateY(0);
}

/* Когда панель открыта, она сама находится выше ручки.
   Отключаем ручку, чтобы она не перехватывала нажатия. */
.person-page .person-full.info-open .person-info-handle {
    pointer-events: none;
}

/* Заголовок и кнопка закрытия остаются доступными */
.person-page .person-info-drawer-heading {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    min-height: 54px;
    align-items: center;
    justify-content: center;
}

/* Содержимое прокручивается внутри панели */
.person-page .person-info-scroll {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Ссылки и интерактивные элементы панели принимают нажатия */
.person-page .person-info-drawer button,
.person-page .person-info-drawer a,
.person-page .person-info-drawer summary,
.person-page .person-info-drawer input,
.person-page .person-info-drawer select,
.person-page .person-info-drawer textarea {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

/* На телефонах оставляем место для системной нижней зоны */
@media (max-width: 700px) {
    .person-page .person-info-drawer {
        height: 78%;
        max-height: 78%;
        border-radius: 18px 18px 0 0;
    }

    .person-page .person-info-scroll {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Учитываем настройку пользователя о сокращении анимации */
@media (prefers-reduced-motion: reduce) {
    .person-page .person-info-drawer {
        transition: none;
    }
}


/* Скруглённые углы карточки и фотографий полной анкеты */
.person-page .person-full {
    border-radius: 24px;
    overflow: hidden;
}

.person-page .person-gallery-shell,
.person-page .person-gallery {
    border-radius: inherit;
    overflow: hidden;
}

.person-page .person-gallery-photo,
.person-page .person-gallery-backdrop {
    border-radius: inherit;
}

/* Сохраняем скругление рамки галереи */
.person-page .person-gallery::after {
    border-radius: inherit;
}

@media (max-width: 700px) {
    .person-page .person-full {
        border-radius: 20px;
    }
}

/* Полная анкета: скруглённая карточка с фото */
.person-page .person-full {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    isolation: isolate;
}

.person-page .person-gallery-shell,
.person-page .person-gallery,
.person-page .person-gallery-photo,
.person-page .person-gallery-backdrop {
    border-radius: inherit;
}

.person-page .person-gallery-shell,
.person-page .person-gallery {
    overflow: hidden;
}

/* Ручка свёрнутой панели: имя и город, без надписи «Сведения» */
.person-page .person-info-handle {
    z-index: 8;
    touch-action: none;
}

/* Панель сведений в закрытом состоянии */
.person-page .person-info-drawer {
    position: absolute;
    z-index: 7;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    inset: auto 0 0;

    display: flex;
    flex-direction: column;

    width: 100%;
    height: min(78%, 620px);
    max-height: 78%;
    min-height: 0;

    margin: 0;
    padding: 0;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, .82);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;

    background: rgba(255, 255, 255, .94);
    color: #292333;
    box-shadow: 0 -12px 36px rgba(30, 20, 45, .2);

    transform: translateY(calc(100% - 1px));
    transition: transform .32s cubic-bezier(.2, .75, .25, 1);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Открытое состояние: класс добавляется на article.person-full */
.person-page .person-full.info-open .person-info-drawer {
    z-index: 9;
    transform: translateY(0);
}

/* В открытом состоянии ручка не перекрывает панель */
.person-page .person-full.info-open .person-info-handle {
    pointer-events: none;
}

/* Заголовок и кнопка закрытия */
.person-page .person-info-drawer-heading {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    min-height: 54px;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 14px;
    border-bottom: 1px solid rgba(80, 65, 100, .12);
}

.person-page .person-info-close {
    display: inline-flex;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(80, 65, 100, .16);
    border-radius: 50%;
    background: rgba(112, 84, 190, .1);
    color: #463780;
    cursor: pointer;
}

.person-page .person-info-close:hover {
    background: rgba(112, 84, 190, .18);
}

.person-page .person-info-close-icon {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Прокручиваемое содержимое панели */
.person-page .person-info-scroll {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Кнопки, ссылки и элементы формы внутри панели */
.person-page .person-info-drawer button,
.person-page .person-info-drawer a,
.person-page .person-info-drawer summary,
.person-page .person-info-drawer input,
.person-page .person-info-drawer select,
.person-page .person-info-drawer textarea {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

@media (max-width: 700px) {
    .person-page .person-full {
        border-radius: 20px;
    }

    .person-page .person-info-drawer {
        height: 78%;
        max-height: 78%;
        border-radius: 18px 18px 0 0;
    }

    .person-page .person-info-scroll {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .person-page .person-info-drawer {
        transition: none;
    }
}

/* Полная анкета: скруглённая карточка и фото */
.person-page .person-full {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    isolation: isolate;
}

.person-page .person-gallery-shell,
.person-page .person-gallery,
.person-page .person-gallery-photo,
.person-page .person-gallery-backdrop {
    border-radius: inherit;
}

.person-page .person-gallery-shell,
.person-page .person-gallery {
    overflow: hidden;
}

/* Свёрнутая панель: ручка, имя и город без надписи «Сведения» */
.person-page .person-info-handle {
    z-index: 8;
    touch-action: manipulation;
}

/* Нижняя выдвижная шторка */
.person-page .person-info-drawer {
    position: absolute;
    z-index: 7;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    inset: auto 0 0;

    display: flex;
    flex-direction: column;

    width: 100%;
    height: min(78%, 620px);
    max-height: 78%;
    min-height: 0;

    margin: 0;
    padding: 0;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, .82);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;

    background: rgba(255, 255, 255, .94);
    color: #292333;
    box-shadow: 0 -12px 36px rgba(30, 20, 45, .2);

    transform: translateY(calc(100% - 1px));
    transition: transform .32s cubic-bezier(.2, .75, .25, 1);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.person-page .person-full.info-open .person-info-drawer {
    z-index: 9;
    transform: translateY(0);
}

/* При открытой шторке скрытая ручка не должна перехватывать касания */
.person-page .person-full.info-open .person-info-handle {
    pointer-events: none;
}

/* Верхняя зона и кнопка-стрелка для компьютера */
.person-page .person-info-drawer-heading {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    min-height: 54px;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 14px;
    border-bottom: 1px solid rgba(80, 65, 100, .12);
}

.person-page .person-info-close {
    display: inline-flex;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(80, 65, 100, .16);
    border-radius: 50%;
    background: rgba(112, 84, 190, .1);
    color: #463780;
    cursor: pointer;
}

.person-page .person-info-close:hover {
    background: rgba(112, 84, 190, .18);
}

.person-page .person-info-close-icon {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Прокрутка содержимого шторки */
.person-page .person-info-scroll {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Интерактивные элементы внутри раскрытой шторки */
.person-page .person-info-drawer button,
.person-page .person-info-drawer a,
.person-page .person-info-drawer summary,
.person-page .person-info-drawer input,
.person-page .person-info-drawer select,
.person-page .person-info-drawer textarea {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

@media (max-width: 700px) {
    .person-page .person-full {
        border-radius: 20px;
    }

    .person-page .person-info-drawer {
        height: 78%;
        max-height: 78%;
        border-radius: 18px 18px 0 0;
    }

    .person-page .person-info-scroll {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    /* На мобильных кнопку-стрелку скрываем: закрытие — свайпом вниз */
    .person-page .person-info-close {
        display: none;
    }

    .person-page .person-info-drawer-heading {
        min-height: 54px;
        border-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .person-page .person-info-drawer {
        transition: none;
    }
}

/* Исправление закрытия шторки на телефонах */
@media (max-width: 700px) {
    /* Показываем кнопку закрытия */
    .person-page .person-info-close {
        display: inline-flex;
    }

    /* Не отдаём свайп с верхней полосы шторки браузеру */
    .person-page .person-info-drawer-heading {
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
    }
}


@media (max-width: 700px) {
    .person-page .person-info-close {
        display: none !important;
    }

    .person-page .person-info-drawer-heading {
        cursor: pointer;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Скрыть верхние названия страниц */
main.container h1 {
    display: none !important;
}



.discovery-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
}

.filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
}

.filter-trigger svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.filters-overlay[hidden] {
    display: none;
}

.filters-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    overflow: auto;
    background: rgba(24, 20, 34, .48);
}

.filters-sheet {
    width: min(100%, 620px);
    max-height: 100dvh;
    margin: 0 auto;
    overflow-y: auto;
    border-radius: 0 0 24px 24px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(20, 15, 30, .2);
    transform: translateY(-100%);
    transition: transform .3s ease;
}

.filters-overlay.is-open .filters-sheet {
    transform: translateY(0);
}

.filters-header {
    position: sticky;
    z-index: 2;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
}

.filters-close,
.filters-reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
}

.filters-close {
    padding: 6px 0;
}

.filters-close span:first-child {
    font-size: 26px;
    line-height: 1;
}

.filters-reset {
    color: var(--accent);
}

.filters-form {
    padding: 12px 20px 28px;
}

.filter-tabs,
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 8px 0 22px;
    padding: 4px;
    border-radius: 999px;
    background: #f1eff7;
}

.filter-tab,
.filter-chip {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.filter-tab input,
.filter-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.filter-tab span,
.filter-chip span {
    display: block;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.3;
}

.filter-tab span {
    border-color: transparent;
    background: transparent;
    text-align: center;
}

.filter-tab input:checked + span,
.filter-chip input:checked + span {
    border-color: var(--accent);
    background: #f2eeff;
    color: var(--accent-dark);
}

.filter-section {
    margin: 22px 0;
}

.filter-section h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.filter-text-label {
    margin: 20px 0;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

.dual-range {
    position: relative;
    height: 32px;
}

.dual-range input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 32px;
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 4px;
    background: #d9d4e8;
}

.dual-range input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 4px;
    background: #d9d4e8;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -8px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
}

.dual-range input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    pointer-events: auto;
}

.filters-submit-wrap {
    display: flex;
    justify-content: center;
    padding: 12px 0 8px;
}

.filters-apply {
    min-width: 200px;
    border-radius: 999px;
}

body.filters-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .filters-sheet {
        width: 100%;
        border-radius: 0 0 18px 18px;
    }

    .filters-form {
        padding-right: 16px;
        padding-left: 16px;
    }
}



.discovery-toolbar {
    position: relative;
    z-index: 50;
}

.filter-trigger {
    position: relative;
    z-index: 51;
}

.filters-overlay {
    position: fixed;
    z-index: 9999;
    inset: 0;
}



/* Редактирование анкеты */
.vk-profile {
    max-width: 760px;
    margin: 0 auto;
    padding-bottom: 28px;
}

.vk-profile-header {
    position: sticky;
    z-index: 30;
    top: 64px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
    margin: -28px -20px 14px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
}

.vk-profile-header h1 {
    display: block !important;
    margin: 0;
    font-size: 22px;
    text-align: left;
}

.vk-profile-back,
.vk-profile-save {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    background: transparent;
    color: #3989c9;
    font-size: 32px;
    line-height: 1;
    text-decoration: none;
}

.vk-profile-save {
    font-size: 28px;
}

.vk-profile-form {
    display: grid;
    gap: 14px;
}

.vk-profile-card {
    padding: 22px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(32, 35, 42, .045);
}

.vk-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.vk-card-heading h2 {
    margin: 0;
    color: #17191c;
    font-size: 21px;
    line-height: 1.25;
}

.vk-card-heading p {
    margin: 4px 0 0;
    color: #868b91;
    line-height: 1.35;
}

.vk-field {
    display: block;
    margin: 16px 0;
    color: #777d84;
    font-weight: 400;
}

.vk-field input,
.vk-field textarea,
.vk-field select {
    min-height: 48px;
    margin-top: 7px;
    padding: 12px 14px;
    border: 1px solid #dedfe3;
    border-radius: 14px;
    background: #f4f5f6;
    color: #17191c;
    font-size: 16px;
}

.vk-field textarea {
    resize: vertical;
}

.vk-fields-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.vk-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.vk-media-item {
    position: relative;
    min-width: 0;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border-radius: 22px;
    background: #eceef1;
}

.vk-media-item > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vk-media-pending {
    display: grid;
    width: 100%;
    min-height: 150px;
    aspect-ratio: 3 / 4;
    place-items: center;
    padding: 12px;
    background: #f0f1f3;
    color: #767b82;
    text-align: center;
}

.vk-media-number {
    position: absolute;
    top: 9px;
    left: 9px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(20, 25, 30, .65);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.vk-media-item form {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
}

.vk-media-delete {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(30, 35, 40, .6);
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

.vk-upload-form {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.vk-upload-form small,
.vk-empty-hint {
    color: #8a8f95;
}

.vk-upload-button {
    display: block;
    margin: 0;
    padding: 12px 15px;
    border: 1px solid #e0e2e5;
    border-radius: 14px;
    background: #f5f6f7;
    color: #287eb8;
    text-align: center;
    cursor: pointer;
}

.vk-upload-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.vk-video-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.vk-video-item {
    min-width: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #f3f4f5;
}

.vk-video-item video {
    display: block;
    width: 100%;
    max-height: 360px;
    background: #111;
}

.vk-video-item form {
    padding: 10px;
}

.vk-interest-summary,
.interest-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-interest-pill {
    display: inline-flex;
    padding: 8px 13px;
    border-radius: 999px;
    background: #f1f2f4;
    color: #22252a;
    font-weight: 600;
}

.vk-edit-button {
    width: 100%;
    margin-top: 18px;
    background: #f3f4f5;
    color: #3888c8;
}

.vk-save-bottom {
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
}

.interest-overlay[hidden] {
    display: none;
}

.interest-overlay {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 20, 28, .45);
}

.interest-sheet {
    display: flex;
    width: min(100%, 720px);
    max-height: 88dvh;
    flex-direction: column;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
    background: #fff;
    transform: translateY(100%);
    transition: transform .25s ease;
}

.interest-overlay.is-open .interest-sheet {
    transform: translateY(0);
}

.interest-sheet-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    border-bottom: 1px solid var(--line);
}

.interest-sheet-header button {
    padding: 0;
    background: transparent;
    color: #3989c9;
    font-size: 30px;
}

.interest-sheet-content {
    overflow-y: auto;
    padding: 4px 18px 20px;
}

.interest-group {
    margin: 18px 0;
}

.interest-group h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.interest-option {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.interest-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.interest-option span {
    display: block;
    padding: 9px 13px;
    border: 1px solid #e4e5e8;
    border-radius: 999px;
    background: #f5f6f7;
    color: #25272b;
    font-size: 14px;
}

.interest-option input:checked + span {
    border-color: #3989c9;
    background: #eaf4fc;
    color: #1976b8;
}

.interest-option input:focus-visible + span {
    outline: 2px solid #3989c9;
    outline-offset: 2px;
}

.interest-sheet-footer {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fff;
}

.interest-sheet-footer button {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
}

body.interest-dialog-open {
    overflow: hidden;
}

@media (max-width: 700px) {
    .vk-profile-header {
        top: 56px;
        margin: -6px -10px 10px;
        padding: 8px 12px;
    }

    .vk-profile-card {
        padding: 18px 16px;
        border-radius: 22px;
    }

    .vk-fields-two {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .vk-media-grid {
        gap: 8px;
    }

    .vk-media-item {
        border-radius: 17px;
    }

    .interest-sheet {
        max-height: 90dvh;
    }
}


/* Отступы и расстояние между карточками профиля */
.vk-profile-form {
    display: grid;
    gap: 16px;
}

.vk-profile-form > .vk-profile-card {
    margin: 0;
}

/* Форма загрузки: кнопки и пояснение расположены отдельными строками */
.vk-upload-form {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 16px;
}

.vk-upload-form .vk-upload-button,
.vk-upload-form > button {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
}

.vk-upload-form small {
    display: block;
    width: 100%;
    margin: 0;
    color: #858b91;
    font-size: 14px;
    line-height: 1.45;
}

.vk-profile > .danger-zone {
    margin-top: 18px;
}

.vk-profile {
    display: grid;
    gap: 16px;
}

.vk-profile-card {
    margin: 0;
}

.vk-upload-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 16px;
}

.vk-upload-form .vk-upload-button,
.vk-upload-form > button {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0;
}

.vk-upload-form small {
    display: block;
    margin: 0;
    color: #858b91;
    font-size: 14px;
    line-height: 1.45;
}

.vk-profile > .danger-zone {
    margin-top: 0;
}



.discovery-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.discovery-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    max-height: 48px;
    overflow: hidden;
    color: #25232b;
    font-size: 11px;
    line-height: 1.25;
}

.discovery-stats > div {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
}

.discovery-online-count {
    color: #26934a;
}

.discovery-active-count {
    color: #25232b;
}

@media (max-width: 700px) {
    .discovery-toolbar {
        min-height: 52px;
        margin-bottom: 8px;
    }

    .discovery-stats {
        max-height: 46px;
        font-size: 10px;
    }

    .filter-trigger {
        flex: 0 0 auto;
    }

    .deck-counter {
        display: none !important;
    }
}



@media (max-width: 700px) {
    /*
     * Высота верхней навигации сайта. Если она отличается на вашем телефоне,
     * измените 108px по фактической высоте меню.
     */
    .discovery-page {
        --mobile-site-nav-height: 108px;

        display: flex;
        height: calc(
            100dvh
            - var(--mobile-site-nav-height)
            - env(safe-area-inset-bottom, 0px)
        );
        min-height: 0;
        flex-direction: column;
    }

    .discovery-page > .page-heading {
        display: none;
    }

    .discovery-page .profile-deck {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
    }

    .discovery-page .deck-card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
    }

    .discovery-page .deck-photo-frame {
        width: 100%;
        height: 100%;
    }

    .discovery-page .deck-hint {
        flex: 0 0 auto;
        margin: 4px 0 0;
        text-align: center;
    }
}


.discovery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 0 0 10px;
}

.discovery-stats {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    color: #292631;
    font-size: 12px;
    line-height: 1.25;
}

.discovery-stats > div {
    white-space: nowrap;
}

.discovery-online-count {
    color: #26934a;
}

.discovery-active-count {
    color: #292631;
}

.discovery-toolbar .filter-trigger {
    flex: 0 0 auto;
}

.deck-counter {
    display: none !important;
}

@media (max-width: 700px) {
    .discovery-toolbar {
        min-height: 52px;
        gap: 8px;
    }

    .discovery-stats {
        font-size: 11px;
    }
}



/* Мобильная страница анкет: ширина экрана и высота от шапки до низа окна. */
@media (max-width: 700px) {
    .immersive-page {
        height: 100dvh;
        overflow: hidden;
    }

    .immersive-page .container {
        position: fixed;
        z-index: 1;
        top: var(--site-header-height, var(--topbar-height, 56px));
        right: 0;
        bottom: 0;
        left: 0;

        width: 100%;
        height: auto;
        min-height: 0;
        max-width: none;
        overflow: hidden;

        margin: 0;
        padding: 0;
    }

    .immersive-page .discovery-page {
        display: flex;
        width: 100%;
        height: 100%;
        min-height: 0;
        max-width: none;
        flex-direction: column;
        margin: 0;
    }

    .immersive-page .discovery-toolbar {
        flex: 0 0 auto;
        width: 100%;
        margin: 0;
        padding: 10px 16px;
    }

    .immersive-page .profile-deck {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin: 0;
    }

    .immersive-page .deck-card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        border-radius: 0;
    }

    .immersive-page .deck-photo-frame,
    .immersive-page .deck-photo,
    .immersive-page .deck-photo-stack,
    .immersive-page .deck-stack-photo {
        border-radius: 0;
    }

    .immersive-page .deck-hint {
        display: none;
    }
}



/* Мобильная страница анкет: панель сверху, карточка занимает оставшееся место. */


    body.immersive-page {
        height: 100dvh;
        min-height: 100dvh;
        padding-bottom: 0;
    }

    .immersive-page .container {
        position: fixed;
        z-index: 1;
        top: var(--site-header-height, var(--topbar-height, 56px));
        right: 0;
        bottom: 0;
        left: 0;

        width: 100%;
        height: auto;
        min-height: 0;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .immersive-page .discovery-page {
        display: flex;
        width: 100%;
        height: 100%;
        min-height: 0;
        max-width: none;
        flex-direction: column;
        gap: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .immersive-page .discovery-toolbar {
        position: relative;
        z-index: 10;
        display: flex;
        flex: 0 0 auto;
        width: 100%;
        min-height: 64px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin: 0;
        padding: 6px 16px;
    }

    .immersive-page .discovery-stats {
        flex: 1 1 auto;
        min-width: 0;
        max-height: none;
        overflow: visible;
        font-size: 11px;
        line-height: 1.3;
    }

    .immersive-page .discovery-toolbar .filter-trigger {
        flex: 0 0 auto;
    }

    .immersive-page .profile-deck {
        position: relative;
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin: 0;
        overflow: hidden;
    }

    .immersive-page .deck-card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        overflow: hidden;
        border-radius: 0;
    }

    .immersive-page .deck-photo-frame,
    .immersive-page .deck-photo,
    .immersive-page .deck-photo-stack,
    .immersive-page .deck-stack-photo,
    .immersive-page .deck-open-profile,
    .immersive-page .deck-scrim {
        border-radius: 0;
    }

    .immersive-page .deck-hint {
        display: none;
    }
}


/* На обычных страницах сохраняем вертикальную прокрутку. */
html {
    min-height: 100%;
    overflow-y: auto;
}

body:not(.immersive-page) {
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Полноэкранная раскладка только для страницы «Анкеты» на телефоне.
   Не применяется к открытой полной анкете с классом .person-page. */
@media (max-width: 700px) {
    body.immersive-page:not(.person-page) {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        padding-bottom: 0;
    }

    body.immersive-page:not(.person-page) > .container {
        position: fixed;
        z-index: 1;
        top: var(--site-header-height, var(--topbar-height, 56px));
        right: 0;
        bottom: 0;
        left: 0;

        width: 100%;
        height: auto;
        min-height: 0;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    body.immersive-page:not(.person-page) .discovery-page {
        display: flex;
        width: 100%;
        height: 100%;
        min-height: 0;
        max-width: none;
        flex-direction: column;
        gap: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    /* Статистика и фильтр остаются над карточкой. */
    body.immersive-page:not(.person-page) .discovery-toolbar {
        position: relative;
        z-index: 10;
        display: flex;
        flex: 0 0 auto;
        width: 100%;
        min-height: 64px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin: 0;
        padding: 6px 16px;
    }

    body.immersive-page:not(.person-page) .discovery-stats {
        flex: 1 1 auto;
        min-width: 0;
        max-height: none;
        overflow: visible;
        font-size: 11px;
        line-height: 1.3;
    }

    /* Карточка заполняет всё место ниже панели. */
    body.immersive-page:not(.person-page) .profile-deck {
        position: relative;
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin: 0;
        overflow: hidden;
    }

    body.immersive-page:not(.person-page) .deck-card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        overflow: hidden;
        border-radius: 0;
    }

    body.immersive-page:not(.person-page) .deck-photo-frame,
    body.immersive-page:not(.person-page) .deck-photo,
    body.immersive-page:not(.person-page) .deck-photo-stack,
    body.immersive-page:not(.person-page) .deck-stack-photo,
    body.immersive-page:not(.person-page) .deck-open-profile,
    body.immersive-page:not(.person-page) .deck-scrim {
        border-radius: 0;
    }

    body.immersive-page:not(.person-page) .deck-hint {
        display: none;
    }
}


/* Переливающаяся зеркальная окантовка */
@property --mirror-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@keyframes mirror-frame-shine {
    to {
        --mirror-angle: 360deg;
    }
}

/* Пространство для эффекта стопки книжных страниц */
.immersive-page .profile-deck {
    perspective: 1600px;
    transform-style: preserve-3d;
}

.immersive-page .deck-card.is-active {
    z-index: 3;
}

.immersive-page .deck-card.is-queued {
    z-index: 1;
    transform: translate(5px, -5px) scale(.985);
    opacity: .82;
    pointer-events: none;
    filter: saturate(.9);
    box-shadow:
        2px 2px 0 rgba(255, 255, 255, .95),
        4px 5px 0 rgba(190, 174, 229, .8),
        7px 9px 18px rgba(35, 25, 48, .22);
}

.immersive-page .deck-card.is-page-under {
    z-index: 2;
    opacity: 1;
    pointer-events: none;
    transform: none;
    filter: none;
}

.immersive-page .deck-card.is-turning-forward,
.immersive-page .deck-card.is-turning-backward {
    z-index: 5;
    overflow: hidden;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, box-shadow;
}

.immersive-page .deck-card.is-turning-forward {
    transform-origin: right center;
    animation: profile-page-turn-forward 720ms cubic-bezier(.45, .05, .25, 1) both;
}

.immersive-page .deck-card.is-turning-backward {
    transform-origin: left center;
    animation: profile-page-turn-backward 720ms cubic-bezier(.45, .05, .25, 1) both;
}

@keyframes profile-page-turn-forward {
    0% {
        transform: perspective(1600px) rotateY(0deg);
        box-shadow: 0 0 0 rgba(20, 15, 30, 0);
    }

    38% {
        box-shadow: 18px 5px 28px rgba(20, 15, 30, .28);
    }

    100% {
        transform: perspective(1600px) rotateY(-165deg);
        box-shadow: 26px 5px 34px rgba(20, 15, 30, .38);
    }
}

@keyframes profile-page-turn-backward {
    0% {
        transform: perspective(1600px) rotateY(0deg);
        box-shadow: 0 0 0 rgba(20, 15, 30, 0);
    }

    38% {
        box-shadow: -18px 5px 28px rgba(20, 15, 30, .28);
    }

    100% {
        transform: perspective(1600px) rotateY(165deg);
        box-shadow: -26px 5px 34px rgba(20, 15, 30, .38);
    }
}

/* Закруглённая карточка с зеркальным свечением */
.immersive-page .deck-card {
    border-radius: 24px;
}

.immersive-page .deck-photo-frame {
    position: absolute;
    overflow: hidden;
    border: 0 !important;
    border-radius: 24px !important;
    box-shadow:
        0 0 10px rgba(255, 255, 255, .9),
        0 0 24px rgba(190, 157, 255, .55),
        0 0 42px rgba(255, 179, 222, .3);
}

/* Анимированный светящийся контур поверх фото */
.immersive-page .deck-photo-frame::after {
    position: absolute;
    z-index: 8;
    inset: 0;
    padding: 3px;
    content: "";
    pointer-events: none;
    border-radius: inherit;
    background: conic-gradient(
        from var(--mirror-angle),
        #fff 0deg,
        #d5c5ff 55deg,
        #fff 105deg,
        #ffc9e6 165deg,
        #fff 220deg,
        #bfeaff 280deg,
        #fff 330deg,
        #d5c5ff 360deg
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: mirror-frame-shine 7s linear infinite;
}

.immersive-page .deck-photo,
.immersive-page .deck-stack-photo {
    border-radius: 21px;
}

/* На телефоне оставляем закруглённый вид карточки */
@media (max-width: 700px) {
    .immersive-page .deck-card,
    .immersive-page .deck-photo-frame,
    .immersive-page .deck-open-profile,
    .immersive-page .deck-scrim {
        border-radius: 22px !important;
    }

    .immersive-page .deck-photo,
    .immersive-page .deck-stack-photo {
        border-radius: 19px !important;
    }
}

/* Учитываем настройку устройства «уменьшить анимацию» */
@media (prefers-reduced-motion: reduce) {
    .immersive-page .deck-photo-frame {
        animation: none;
    }

    .immersive-page .deck-card.is-turning-forward,
    .immersive-page .deck-card.is-turning-backward {
        animation-duration: 1ms;
    }
}


/* Дополнительные эффекты смены фотографий */
.animate-slide {
    animation: gallery-slide .42s cubic-bezier(.22, .7, .25, 1) both;
}

.animate-fade {
    animation: gallery-fade .45s ease both;
}

.animate-flip {
    animation: gallery-flip .58s cubic-bezier(.2, .75, .25, 1) both;
    transform-origin: center center;
    backface-visibility: hidden;
}

.animate-zoom {
    animation: gallery-zoom .48s cubic-bezier(.2, .75, .25, 1) both;
}

@keyframes gallery-slide {
    0% {
        transform: translateX(22px);
        opacity: .45;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes gallery-fade {
    0% {
        opacity: .2;
    }

    100% {
        opacity: 1;
    }
}

@keyframes gallery-flip {
    0% {
        transform: perspective(1100px) rotateY(72deg);
        opacity: .35;
    }

    100% {
        transform: perspective(1100px) rotateY(0);
        opacity: 1;
    }
}

@keyframes gallery-zoom {
    0% {
        transform: scale(1.12);
        opacity: .45;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Надпись на кнопке открытия сведений */
.person-info-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Шторка появляется сверху вниз поверх фотографии */
.person-full .person-info-drawer {
    position: absolute;
    z-index: 12;
    top: env(safe-area-inset-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;

    display: flex;
    width: 100%;
    height: min(76%, 620px);
    max-height: calc(100% - 72px);
    flex-direction: column;

    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .75);
    border-top: 0;
    border-radius: 0 0 24px 24px;
    background: rgba(250, 248, 255, .94);
    color: #25243a;
    box-shadow:
        0 14px 40px rgba(25, 18, 38, .28),
        0 0 24px rgba(190, 157, 255, .35);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    visibility: hidden;
    opacity: 0;
    transform: translateY(-105%);
    transition:
        transform .42s cubic-bezier(.22, .7, .25, 1),
        opacity .25s ease,
        visibility 0s linear .42s;
}

.person-full.info-open .person-info-drawer {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition:
        transform .42s cubic-bezier(.22, .7, .25, 1),
        opacity .25s ease,
        visibility 0s;
}

.person-full .person-info-drawer-heading {
    flex: 0 0 auto;
}

.person-full .person-info-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.person-full .person-info-handle {
    z-index: 14;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .animate-slide,
    .animate-fade,
    .animate-flip,
    .animate-zoom {
        animation-duration: 1ms;
    }

    .person-full .person-info-drawer {
        transition-duration: 1ms;
    }
}