﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --tg-theme-bg-color: #f7f3ec;
    --tg-theme-text-color: #16120f;
    --tg-theme-hint-color: #7f7367;
    --tg-theme-button-color: #d85f3b;
    --tg-theme-secondary-bg-color: #fff8f1;
    --surface: rgba(255, 252, 247, 0.82);
    --surface-strong: #fffaf5;
    --border: rgba(89, 58, 40, 0.12);
    --shadow: 0 18px 40px rgba(61, 38, 22, 0.12);
}

body {
    font-family: 'Segoe UI', 'SF Pro Display', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(248, 199, 153, 0.45), transparent 32%),
        radial-gradient(circle at top right, rgba(226, 106, 82, 0.20), transparent 28%),
        linear-gradient(180deg, #fcf8f3 0%, #f3ede5 100%);
    color: var(--tg-theme-text-color);
    min-height: 100vh;
    overflow: hidden;
}

#app {
    min-height: 100vh;
    position: relative;
    padding: 18px 14px 0;
}

.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 6px;
}

.app-header h1 {
    font-size: 30px;
    line-height: 1;
}

.header-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 250, 245, 0.78);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.cards-screen,
.empty-state {
    height: calc(100vh - 108px);
}

.cards-screen {
    position: relative;
}

#cards-container {
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 124px;
}

.loading-state {
    width: min(390px, calc(100% - 6px));
    height: min(610px, calc(100% - 12px));
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    color: var(--tg-theme-hint-color);
    text-align: center;
    font-weight: 700;
}

.loading-card {
    position: relative;
    height: 100%;
    min-height: 430px;
    overflow: hidden;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 250, 245, 0.92), rgba(245, 231, 218, 0.92));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.loading-photo {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.54) 45%, transparent 80%),
        linear-gradient(135deg, #f6d1b8, #dccfc3);
    background-size: 220% 100%, 100% 100%;
    animation: shimmer 1.15s linear infinite;
}

.loading-lines {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 28px;
    display: grid;
    gap: 12px;
}

.loading-lines span {
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 250, 245, 0.74);
}

.loading-lines span:first-child {
    width: 62%;
    height: 28px;
}

.loading-lines span:last-child {
    width: 42%;
}

.loading-state.hidden {
    display: none;
}

.card {
    position: absolute;
    width: calc(100% - 6px);
    max-width: 390px;
    height: calc(100% - 12px);
    max-height: 610px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(70, 45, 29, 0.22);
    cursor: grab;
    touch-action: none;
    will-change: transform;
    background: #ddd;
}

.card:active {
    cursor: grabbing;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-gradient {
    position: absolute;
    inset: auto 0 0 0;
    height: 58%;
    background: linear-gradient(180deg, transparent 0%, rgba(16, 9, 7, 0.08) 35%, rgba(16, 9, 7, 0.92) 100%);
}

.card-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px;
    color: #fffaf5;
}

.card-name {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 6px;
}

.card-city {
    font-size: 16px;
    opacity: 0.92;
}

.card-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    z-index: 2;
    backdrop-filter: blur(14px);
}

.card-badge.superlike {
    color: #3b2a18;
    background: rgba(255, 214, 79, 0.88);
}

.card-badge.like {
    color: white;
    background: rgba(222, 81, 115, 0.82);
}

.card-indicator {
    position: absolute;
    top: 26px;
    padding: 10px 18px;
    border-radius: 16px;
    font-size: 22px;
    font-weight: 800;
    opacity: 0;
    transition: opacity 0.2s;
}

.card-indicator.like {
    right: 22px;
    color: white;
    background: rgba(46, 213, 115, 0.9);
    transform: rotate(12deg);
}

.card-indicator.dislike {
    left: 22px;
    color: white;
    background: rgba(255, 71, 87, 0.9);
    transform: rotate(-12deg);
}

.actions-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 20px;
    background: linear-gradient(180deg, rgba(247, 243, 236, 0) 0%, rgba(247, 243, 236, 0.85) 28%, rgba(247, 243, 236, 0.98) 100%);
    backdrop-filter: blur(14px);
    z-index: 20;
}

.action-row {
    width: min(290px, 100%);
    display: flex;
    justify-content: space-between;
}

.action-superlike-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

.action-btn {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:active {
    transform: translateY(2px) scale(0.96);
}

.action-btn.dislike {
    color: white;
    background: linear-gradient(135deg, #ff7f73, #ff4d69);
}

.action-btn.like {
    color: white;
    background: linear-gradient(135deg, #67d785, #22b573);
}

.action-btn.superlike {
    width: 58px;
    height: 58px;
    color: white;
    background: linear-gradient(135deg, #ffcc48, #ff9f43);
    position: relative;
}

.superlike-counter {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    background: #221a15;
    border: 2px solid #fffaf5;
}

.info-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(calc(100% - 28px));
    transition: transform 0.3s ease;
    border-radius: 28px 28px 0 0;
    background: rgba(255, 251, 246, 0.95);
    backdrop-filter: blur(18px);
    box-shadow: 0 -12px 40px rgba(61, 38, 22, 0.12);
    z-index: 30;
    max-height: 74vh;
}

.info-panel.expanded {
    transform: translateY(0);
}

.info-handle {
    padding: 12px;
    display: flex;
    justify-content: center;
}

.handle-bar {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(127, 115, 103, 0.45);
}

.info-content {
    padding: 2px 22px 118px;
    overflow-y: auto;
    max-height: calc(74vh - 30px);
}

#info-name {
    font-size: 28px;
    margin-bottom: 8px;
}

.info-city {
    color: var(--tg-theme-hint-color);
    margin-bottom: 18px;
}

.info-bio {
    white-space: pre-wrap;
    line-height: 1.6;
}

.info-badge {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 226, 232, 0.72);
    border: 1px solid rgba(222, 81, 115, 0.15);
}

.empty-state {
    overflow-y: auto;
    padding: 8px 2px 132px;
}

.empty-state.hidden {
    display: none;
}

.empty-hero,
.dashboard-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.empty-hero {
    padding: 26px 22px;
    margin-bottom: 16px;
}

.empty-badge {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(216, 95, 59, 0.10);
    color: #a1472d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.empty-hero h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.empty-hero p {
    color: var(--tg-theme-hint-color);
    line-height: 1.6;
}

.empty-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.primary-btn,
.ghost-btn,
.match-chat-btn,
.link-btn {
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.primary-btn:active,
.ghost-btn:active,
.match-chat-btn:active,
.link-btn:active {
    transform: translateY(1px) scale(0.98);
}

.primary-btn,
.ghost-btn {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
}

.primary-btn {
    color: white;
    background: linear-gradient(135deg, #d85f3b, #b54b2b);
}

.ghost-btn {
    color: var(--tg-theme-text-color);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--border);
}

.dashboard-section {
    padding: 20px;
    margin-bottom: 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-heading h3 {
    font-size: 20px;
}

.section-heading span {
    color: var(--tg-theme-hint-color);
    font-weight: 700;
}

.link-btn {
    background: transparent;
    color: #a1472d;
    font-size: 14px;
    font-weight: 700;
}

.matches-list {
    display: grid;
    gap: 12px;
}

.match-card,
.profile-card--self {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 14px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(89, 58, 40, 0.08);
}

.match-card.empty-placeholder {
    grid-template-columns: 1fr;
    text-align: center;
    color: var(--tg-theme-hint-color);
    padding: 22px 16px;
}

.match-photo,
.profile-photo {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    object-fit: cover;
    background: linear-gradient(135deg, #f8d7b0, #f3bda5);
}

.match-meta,
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-title,
.profile-title {
    font-size: 18px;
    font-weight: 700;
}

.match-subtitle,
.profile-subtitle,
.profile-search {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.45;
}

.match-chat-btn {
    justify-self: start;
    margin-top: 6px;
    padding: 10px 14px;
    border-radius: 14px;
    color: white;
    background: #16120f;
    font-weight: 700;
}

.profile-bio {
    font-size: 14px;
    line-height: 1.55;
}

.match-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 15, 12, 0.58);
    backdrop-filter: blur(8px);
    z-index: 100;
}

.match-popup.hidden {
    display: none;
}

.match-content {
    width: min(92vw, 360px);
    padding: 28px 24px;
    border-radius: 28px;
    text-align: center;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.match-hearts {
    font-size: 54px;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

.card.fly-left {
    animation: flyLeft 0.4s forwards;
}

.card.fly-right {
    animation: flyRight 0.4s forwards;
}

.card.fly-up {
    animation: flyUp 0.4s forwards;
}

@keyframes flyLeft {
    to {
        transform: translateX(-150%) rotate(-24deg);
        opacity: 0;
    }
}

@keyframes flyRight {
    to {
        transform: translateX(150%) rotate(24deg);
        opacity: 0;
    }
}

@keyframes flyUp {
    to {
        transform: translateY(-150%) scale(0.88);
        opacity: 0;
    }
}

@keyframes shimmer {
    to {
        background-position: -220% 0, 0 0;
    }
}

@media (max-width: 420px) {
    .empty-actions {
        flex-direction: column;
    }

    .match-card,
    .profile-card--self {
        grid-template-columns: 64px 1fr;
    }

    .match-photo,
    .profile-photo {
        width: 64px;
        height: 64px;
    }
}

.editor-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
}

.editor-modal.hidden {
    display: none;
}

.editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 15, 12, 0.54);
    backdrop-filter: blur(10px);
}

.editor-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(88vh, 760px);
    overflow-y: auto;
    padding: 22px 18px 28px;
    border-radius: 30px 30px 0 0;
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.98), rgba(250, 244, 236, 0.98));
    box-shadow: 0 -20px 60px rgba(61, 38, 22, 0.18);
}

.editor-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.editor-topbar h3 {
    font-size: 24px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    color: var(--tg-theme-text-color);
    font-size: 20px;
    cursor: pointer;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-size: 14px;
    font-weight: 700;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px;
    border: 1px solid rgba(89, 58, 40, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--tg-theme-text-color);
    font: inherit;
    outline: none;
}

.field textarea {
    min-height: 116px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: rgba(216, 95, 59, 0.55);
    box-shadow: 0 0 0 4px rgba(216, 95, 59, 0.12);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.field-grid--search {
    grid-template-columns: 1.2fr 1fr 1fr;
}

.editor-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(89, 58, 40, 0.08);
    color: var(--tg-theme-hint-color);
    line-height: 1.5;
}

.editor-note > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-note > div strong {
    color: var(--tg-theme-text-color);
    font-size: 14px;
}

.editor-note > div span {
    font-size: 13px;
}

.editor-note--warning {
    background: rgba(255, 231, 184, 0.42);
    border-color: rgba(214, 150, 39, 0.24);
}

.form-status {
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
}

.form-status.hidden {
    display: none;
}

.form-status--saving {
    background: rgba(255, 204, 72, 0.18);
    color: #8a5a08;
}

.form-status--success {
    background: rgba(84, 196, 120, 0.18);
    color: #1b6c3a;
}

.form-status--error {
    background: rgba(255, 98, 98, 0.14);
    color: #ab2d2d;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

#profile-save-btn:disabled {
    opacity: 0.65;
    pointer-events: none;
}

@media (max-width: 420px) {
    .field-grid,
    .field-grid--search,
    .editor-actions,
    .editor-note {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .editor-actions > * {
        width: 100%;
    }
}

