:root {
    --bg: #0f0a14;
    --bg-card: #1a1224;
    --bg-elevated: #241830;
    --text: #f5eef8;
    --text-muted: #a894b8;
    --accent: #e84393;
    --accent-soft: rgba(232, 67, 147, 0.2);
    --like: #ff4757;
    --dislike: #576574;
    --super: #ffa502;
    --radius: 20px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
    height: 100%;
}

body {
    font-family: "Manrope", system-ui, sans-serif;
    background: radial-gradient(
        ellipse 120% 80% at 50% -20%,
        #2d1b3d 0%,
        var(--bg) 55%
    );
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    background: rgba(15, 10, 20, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
    font-weight: 800;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    color: var(--accent);
    flex-shrink: 0;
}

.topbar-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-menu {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0;
}

.btn-menu:hover,
.btn-menu[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.08);
}

.menu-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    position: relative;
}

.menu-icon::before,
.menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.menu-icon::before {
    top: -6px;
}

.menu-icon::after {
    top: 6px;
}

.nav-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 8px;
    z-index: 100;
}

.nav-dropdown-user {
    padding: 8px 12px 6px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nav-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-dropdown-item.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-dropdown-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}

.nav-dropdown-danger {
    color: #ff6b81;
}

main {
    flex: 1;
    padding: 16px 16px calc(24px + var(--safe-bottom));
}

.screen {
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.hero {
    text-align: center;
    padding: 32px 8px 24px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 8px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.tagline {
    margin-top: 10px;
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

.login-card,
.gate-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-hint,
.login-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

#telegram-login {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 16px;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition:
        transform 0.15s,
        opacity 0.15s;
}

.btn-primary {
    background: linear-gradient(135deg, #e84393, #a855f7);
    color: white;
    padding: 14px 22px;
    width: 100%;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    padding: 14px 22px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
    transform: scale(0.97);
}

.gate-card {
    margin-top: 24px;
    text-align: center;
}

.gate-card h2 {
    margin-bottom: 12px;
}

.gate-card .btn-primary,
.gate-card .btn-secondary {
    margin-top: 10px;
    width: 100%;
}

.premium-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.premium-panel h2 {
    margin-bottom: 12px;
    font-size: 1.35rem;
}

.premium-panel h3 {
    margin: 20px 0 10px;
    font-size: 1rem;
    color: #fff;
}

.premium-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.premium-badge--active {
    background: rgba(255, 165, 2, 0.18);
    color: #ffc048;
}

.premium-meta {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.premium-benefits {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text);
    line-height: 1.55;
}

.premium-benefits li {
    margin-bottom: 8px;
}

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

.premium-plan {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.premium-plan strong {
    color: #ffc048;
    white-space: nowrap;
}

.premium-note {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.premium-cta {
    margin-top: 16px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-photos {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #120a18;
}

.card-photos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.photo-nav-prev {
    left: 8px;
}
.photo-nav-next {
    right: 8px;
}

.photo-dots {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.photo-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
}

.photo-dots span.active {
    background: white;
    transform: scale(1.15);
}

.card-body {
    padding: 18px 18px 8px;
}

.card-body h2 {
    font-size: 1.45rem;
    font-weight: 800;
}

.card-meta {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.9rem;
}

.card-extras {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-bio {
    margin-top: 12px;
    line-height: 1.55;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 18px calc(18px + var(--safe-bottom));
}

.action-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s;
}

.action-btn:active {
    transform: scale(0.92);
}

.action-btn.dislike {
    background: var(--bg-elevated);
    color: var(--dislike);
    font-size: 1.3rem;
}

.action-btn.like {
    background: linear-gradient(135deg, #ff6b81, var(--like));
    color: white;
}

.action-btn.superlike {
    background: linear-gradient(135deg, #ffc048, var(--super));
    color: white;
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.empty-state h2 {
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 20px;
}

.error-text {
    text-align: center;
    color: #ff6b81;
    margin-top: 16px;
    font-size: 0.9rem;
}

.toast {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    z-index: 100;
    max-width: 90%;
    box-shadow: var(--shadow);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-inner {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.modal-inner h2 {
    margin-bottom: 8px;
}

.modal-inner p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.card.swipe-out-left {
    animation: swipeLeft 0.35s forwards;
}

.card.swipe-out-right {
    animation: swipeRight 0.35s forwards;
}

@keyframes swipeLeft {
    to {
        transform: translateX(-120%) rotate(-12deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(120%) rotate(12deg);
        opacity: 0;
    }
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.nav-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.match-card {
    display: grid;
    grid-template-columns: 104px 1fr;
    gap: 14px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow);
}

.match-photo {
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-elevated);
}

.match-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.match-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.match-info h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.match-meta,
.match-extras,
.match-bio {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
    margin-top: 5px;
}

.match-bio {
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.match-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.match-actions .btn-secondary,
.match-actions .btn-ghost {
    width: auto;
    padding: 8px 10px;
    font-size: 0.78rem;
}

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

.profile-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-section h2 {
    font-size: 1.05rem;
    margin-bottom: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.field span {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.95rem;
}

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

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.field-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-field input {
    margin-top: 3px;
}

.profile-photos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.profile-photo-item {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-elevated);
}

.profile-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.profile-photo-actions button {
    flex: 1;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.75rem;
    padding: 6px 4px;
    border-radius: 8px;
    cursor: pointer;
}

.upload-label {
    display: flex;
    cursor: pointer;
}

.geo-btn {
    margin: -4px 0 12px;
    font-size: 0.85rem;
}

.rules-page main {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.rules-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.rules-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 16px;
}

.rules-card-inapp {
    margin-top: 24px;
}

.rules-card h2 {
    margin-bottom: 16px;
}

.rules-content {
    color: var(--text);
    line-height: 1.65;
    font-size: 1rem;
}

.rules-content h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.rules-content h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.75rem 0 0.65rem;
    color: #fff;
}

.rules-content h2:first-child {
    margin-top: 0;
}

.rules-content p {
    margin: 0 0 1rem;
    color: var(--text);
}

.rules-content p:last-child {
    margin-bottom: 0;
}

.rules-content b {
    color: #fff;
    font-weight: 600;
}

.rules-content a {
    color: #e879f9;
    text-decoration: none;
}

.rules-content a:hover {
    text-decoration: underline;
}

.rules-contact {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-contact h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.rules-contact p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.rules-contact a {
    color: #e879f9;
    font-weight: 600;
}

.rules-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.rules-actions .btn-ghost {
  text-align: center;
  width: 100%;
}

.dev-login {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.dev-login .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}

.dev-login .field span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dev-login input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
}

[hidden] {
    display: none !important;
}
