/* ImKes Dating — дизайн-система в духе Jerm Dating (красная тема, белые карточки) */

:root {
    --brand: #b0002b;
    --brand-2: #d81e3f;
    --brand-soft: #fdecef;
    --text: #1b1b1b;
    --muted: #8c8c8c;
    --line: #ececec;
    --bg: #ffffff;
    --surface: #f7f7f9;
    --green: #1fa971;
    --green-soft: #e7f7f0;
    --amber: #f3a712;
    --danger: #e23744;
    --radius: 20px;
    --radius-sm: 14px;
    --shadow: 0 10px 30px rgba(24, 24, 27, 0.12);
    --nav-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--tg-theme-bg-color, var(--bg));
    color: var(--tg-theme-text-color, var(--text));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overscroll-behavior: none;
}

body { display: flex; justify-content: center; }

.app {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg);
    overflow: hidden;
}

/* ---------- Верхняя панель ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    z-index: 20;
}
.topbar .spacer { flex: 1; }
.topbar button {
    background: rgba(255, 255, 255, 0.16);
    border: 0;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.topbar button:active { transform: scale(0.94); }

/* ---------- Экраны ---------- */
.screen {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-h) + 12px);
}
.screen.active { display: flex; }
.screen.no-nav { padding-bottom: 12px; }
.screen.centered { align-items: center; justify-content: center; }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    z-index: 30;
}
.bottom-nav.hidden { display: none; }
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border: 0;
    background: none;
    color: #b8b8bd;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
}
.nav-item .icon { font-size: 20px; line-height: 1; }
.nav-item .icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 18px;
    margin-top: -8px;
    border-radius: 50%;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.nav-item.active { color: var(--brand); }
.nav-item.active .icon {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
}
.nav-item.active .icon-wrap {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(176, 0, 43, 0.32);
    font-size: 18px;
    margin-top: -8px;
}
.nav-item .badge {
    position: absolute;
    transform: translate(14px, -6px);
    background: var(--brand-2);
    color: #fff;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 9px;
}

/* ---------- Карточка ленты ---------- */
.feed { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.feed-card {
    position: relative;
    flex: 1;
    min-height: 0;
    margin: 8px 10px 0;
    border-radius: 24px;
    overflow: hidden;
    background: #dcdce2;
}
.feed-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #fff;
    background: linear-gradient(135deg, #7a7a85, #3d3d46);
    font-size: 40px;
}
.feed-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.25) 42%, rgba(0, 0, 0, 0) 65%);
    pointer-events: none;
}
.report-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--brand);
    font-size: 18px;
    cursor: pointer;
}
.feed-head {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 150px;
    color: #fff;
    pointer-events: none;
}
.feed-name {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}
.feed-name .age { font-weight: 500; }
.badge-premium {
    margin-left: 8px;
    background: linear-gradient(135deg, #ffd76e, #f3a712);
    color: #4a2b00;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-shadow: none;
}
.feed-profession {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.feed-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.fact {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
}
.feed-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.round-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 0;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease;
}
.round-btn:active { transform: scale(0.9); }
.round-btn.dislike { color: var(--brand); }
.round-btn.like { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.round-btn.small { width: 44px; height: 44px; font-size: 18px; }
.round-btn.rose { color: var(--brand); }
.round-btn.undo { color: #6b6b73; }

/* ---------- Нижний лист с описанием ---------- */
.sheet {
    background: #fff;
    border-radius: 24px 24px 0 0;
    margin: 0 10px 0;
    padding: 10px 16px 14px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    position: relative;
    flex-shrink: 0;
}
.sheet-handle {
    width: 42px;
    height: 4px;
    border-radius: 4px;
    background: #d9d9de;
    margin: 2px auto 10px;
}
.sheet-bio { font-size: 14px; line-height: 1.45; color: #2b2b2b; margin: 0 0 6px; max-height: 66px; overflow: hidden; }
.sheet-bio.expanded { max-height: 220px; overflow-y: auto; }
.translate-btn {
    border: 0;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 8px;
}
.details-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #3a3a3a;
    padding: 4px 0;
}
.details-row .label { color: var(--muted); }
.toggle-details {
    border: 0;
    background: none;
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
}

/* ---------- Общие элементы ---------- */
.container { padding: 16px; }
.title { font-size: 22px; font-weight: 800; margin: 4px 0 14px; }
.subtitle { color: var(--muted); font-size: 13px; line-height: 1.5; }
.section-title { font-size: 15px; font-weight: 800; margin: 18px 0 10px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 15px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: transform 0.1s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 22px rgba(176, 0, 43, 0.25); }
.btn-outline { background: #fff; border: 1.5px solid var(--line); }
.btn-danger { background: #fff; border: 1.5px solid #ffd6da; color: var(--danger); }
.btn-sm { padding: 10px 14px; font-size: 14px; border-radius: 12px; width: auto; }
.btn-row { display: flex; gap: 10px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); }
.field textarea { min-height: 88px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    border: 1.5px solid var(--line);
    background: #fff;
    color: #333;
    border-radius: 20px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
}
.chip.selected {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent;
    color: #fff;
}
.chip:active { transform: scale(0.96); }

.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.field label.photo-box { display: flex; margin-bottom: 0; font-weight: 400; font-size: 26px; }
.photo-box {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 16px;
    border: 2px dashed #d6d6dd;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b3b3bb;
    font-size: 26px;
    cursor: pointer;
    overflow: hidden;
}
.photo-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-box input { display: none; }

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 10px;
    cursor: pointer;
}
.list-item:active { background: var(--surface); }
.list-item img.avatar, .avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface);
    flex-shrink: 0;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .name { font-weight: 700; font-size: 15px; }
.list-item .meta { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .unread {
    background: var(--brand-2);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.list-item .chevron { color: #c7c7cd; font-size: 16px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 14px;
    background: var(--surface);
    border-radius: 14px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.menu-item:active { background: #efeff3; }
.menu-item .m-icon { font-size: 17px; width: 22px; text-align: center; }
.menu-item .chevron { margin-left: auto; color: #a9a9b0; }

.profile-head { display: flex; align-items: center; gap: 14px; padding: 18px 16px 8px; }
.profile-avatar { width: 78px; height: 78px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: var(--shadow); background: var(--surface); }
.profile-name { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }

.stats { display: flex; gap: 10px; padding: 8px 16px 4px; }
.stat {
    flex: 1;
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    overflow: hidden;
}
.stat .num { font-size: 26px; font-weight: 800; }
.stat .cap { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat .emoji { position: absolute; top: 12px; right: 12px; font-size: 16px; opacity: 0.9; }

/* ---------- Чат ---------- */
.dialog {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--surface);
}
.messages { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.4; position: relative; word-break: break-word; }
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg .time { display: block; font-size: 10px; opacity: 0.65; margin-top: 4px; text-align: right; }
.composer { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line); }
.composer input { flex: 1; border: 1.5px solid var(--line); border-radius: 20px; padding: 11px 14px; font-size: 14px; outline: none; }
.composer button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 17px; cursor: pointer; }

/* ---------- Гид ---------- */
.tabs { display: flex; gap: 6px; padding: 0 16px 10px; }
.tab {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    border-radius: 12px;
    border: 0;
    background: var(--surface);
    color: #555;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

.accordion { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; overflow: hidden; background: #fff; }
.accordion-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.accordion-head .chevron { margin-left: auto; color: #b3b3bb; }
.accordion-body { display: none; padding: 0 14px 14px; font-size: 13px; line-height: 1.55; color: #3d3d3d; }
.accordion.open .accordion-body { display: block; }
.accordion.open .accordion-head .chevron { transform: rotate(180deg); }

.tip-card {
    border-radius: 18px;
    padding: 18px;
    color: #fff;
    background: linear-gradient(150deg, #b0002b, #5c0016);
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}
.tip-card .tip-category { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.8; }
.tip-card .tip-title { font-size: 18px; font-weight: 800; margin-top: 4px; }
.tip-card .tip-text { font-size: 13px; opacity: 0.92; margin-top: 6px; line-height: 1.45; }
.tip-card .tip-badge { position: absolute; top: 14px; left: 14px; background: rgba(255,255,255,0.2); border-radius: 10px; padding: 3px 8px; font-size: 10px; font-weight: 700; }
.tip-card .tip-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -80%); font-size: 54px; opacity: 0.22; }

/* ---------- Подписки ---------- */
.plan {
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 12px;
    color: #fff;
    background: linear-gradient(135deg, #d81e3f, #ff7a92);
    position: relative;
    overflow: hidden;
}
.plan.free { background: linear-gradient(135deg, #1fa971, #6fd3a8); }
.plan .plan-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.plan .plan-sub { font-size: 12px; opacity: 0.92; margin-top: 6px; line-height: 1.45; }
.plan .plan-until { background: rgba(255,255,255,0.22); border-radius: 12px; padding: 10px 12px; font-size: 12px; margin-top: 12px; font-weight: 600; }
.plan .limits { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; }
.plan .limits b { font-size: 15px; }

/* ---------- Онбординг ---------- */
.onboarding { flex: 1; display: flex; flex-direction: column; background: linear-gradient(160deg, #2a0009, #7d0020 55%, #c2102f); color: #fff; padding: 28px 22px 24px; }
.onboarding .dots { display: flex; gap: 6px; margin-bottom: 10px; }
.onboarding .dot { height: 4px; flex: 1; border-radius: 4px; background: rgba(255, 255, 255, 0.28); }
.onboarding .dot.active { background: #fff; }
.onboarding .onb-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 0;
}
.onboarding .logo { font-size: 46px; margin-bottom: 12px; text-align: center; }
.onboarding h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; text-align: center; }
.onboarding .slide-art { font-size: 96px; text-align: center; margin: 22px 0; opacity: 0.9; }
.onboarding p { font-size: 15px; line-height: 1.55; opacity: 0.9; margin: 0; text-align: center; }
.onboarding .btn-primary { background: #fff; color: var(--brand); box-shadow: none; flex-shrink: 0; }

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: #fff;
    background: linear-gradient(165deg, rgba(30, 0, 8, 0.35), rgba(120, 0, 30, 0.92)), radial-gradient(circle at 70% 20%, #ff708c, #7d0020);
}
.hero .logo-big { font-size: 64px; text-align: center; margin-bottom: 8px; }
.hero h1 { font-size: 34px; text-align: center; margin: 0 0 6px; font-weight: 800; }
.hero .hero-sub { text-align: center; font-size: 14px; opacity: 0.9; margin-bottom: 22px; line-height: 1.5; }
.hero .btn-primary { background: #fff; color: var(--brand); box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25); }

/* ---------- Модалки, тосты, просмотр фото ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 12, 0.55);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 60;
}
.overlay.open { display: flex; }
.overlay .modal {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 18px 18px 22px;
    max-height: 86vh;
    overflow-y: auto;
}
.overlay .modal h3 { margin: 0 0 10px; font-size: 18px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.photo-viewer {
    position: fixed;
    inset: 0;
    background: #000;
    display: none;
    flex-direction: column;
    z-index: 80;
}
.photo-viewer.open { display: flex; }
.photo-viewer .pv-top { display: flex; justify-content: flex-end; padding: 14px; }
.photo-viewer .pv-top button { background: rgba(255,255,255,0.14); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 18px; }
.photo-viewer .pv-stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.photo-viewer .pv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.4); color: #fff; font-size: 22px; }
.pv-arrow.left { left: 10px; }
.pv-arrow.right { right: 10px; }
.pv-thumbs { display: flex; gap: 8px; padding: 12px; overflow-x: auto; }
.pv-thumbs img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; opacity: 0.55; }
.pv-thumbs img.active { opacity: 1; outline: 2px solid #fff; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 22px);
    transform: translateX(-50%) translateY(20px);
    background: rgba(24, 24, 27, 0.94);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 16px;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.22s ease;
    z-index: 100;
    max-width: 86%;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    padding: 40px 20px;
    line-height: 1.55;
}
.empty .big { font-size: 42px; margin-bottom: 10px; }

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--line);
    border-top-color: var(--brand-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.swap { animation: swapIn 0.28s ease; }
@keyframes swapIn { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
