:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --paper-deep: #e9e1d5;
  --ink: #20211d;
  --muted: #737267;
  --coral: #ef6a54;
  --coral-dark: #d94f3b;
  --acid: #d9e56f;
  --white: #fffdf8;
  --shadow: 0 24px 60px rgba(50, 39, 28, .17);
  --radius: 30px;
  font-family: "Avenir Next", Avenir, "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); background: var(--paper); overflow-x: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noise { position: fixed; inset: 0; opacity: .06; pointer-events: none; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); }

.shell { width: min(100%, 540px); min-height: 100vh; min-height: 100dvh; margin: 0 auto; position: relative; padding: 0 20px 112px; }
.topbar { height: 78px; padding-top: env(safe-area-inset-top); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 800; font-size: 22px; text-decoration: none; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px 11px 15px 15px; color: var(--white); background: var(--coral); font-family: Georgia, serif; font-size: 22px; transform: rotate(-4deg); box-shadow: 0 8px 18px rgba(239,106,84,.3); }
.top-actions, .location { display: flex; align-items: center; }
.top-actions { gap: 8px; }
.location { gap: 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
.location svg { width: 16px; height: 16px; }
.icon-button, .filter-button { border: 0; background: rgba(255,253,248,.72); border-radius: 14px; display: grid; place-items: center; cursor: pointer; }
.icon-button { width: 40px; height: 40px; }
.account-button { min-height: 40px; display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 5px; border: 0; border-radius: 14px; color: var(--ink); background: rgba(255,253,248,.78); cursor: pointer; font-size: 11px; font-weight: 900; }
.account-avatar { width: 30px; height: 30px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; color: #fff; background: #fc3f1d; text-transform: uppercase; }
.filter-button { width: 46px; height: 46px; border: 1px solid rgba(32,33,29,.08); box-shadow: 0 8px 24px rgba(49,42,35,.08); }

.view { display: none; animation: view-in .3s ease both; }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 12px 2px 18px; }
.section-heading.compact { align-items: center; margin-bottom: 26px; }
.eyebrow { margin: 0 0 5px; color: var(--coral-dark); text-transform: uppercase; font-size: 10px; font-weight: 900; letter-spacing: .19em; }
h1, h2, p { text-wrap: balance; }
h1 { margin: 0; font-size: clamp(34px, 9vw, 46px); line-height: .98; letter-spacing: -.065em; }
h1 em { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }

.deck-wrap { position: relative; height: min(62vh, 610px); min-height: 450px; }
.deck { position: absolute; inset: 0; perspective: 1200px; }
.cat-card { position: absolute; inset: 0; overflow: hidden; border-radius: var(--radius); background: #c9b7a4; box-shadow: var(--shadow); transform-origin: 50% 95%; touch-action: none; user-select: none; will-change: transform; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.cat-card:nth-last-child(2) { transform: translateY(8px) scale(.965) rotate(1.2deg); filter: saturate(.92); }
.cat-card:nth-last-child(n+3) { transform: translateY(15px) scale(.93) rotate(-1deg); opacity: .72; }
.cat-card.is-dragging { transition: none; cursor: grabbing; }
.cat-card.is-gone-right { transform: translate(135%, 10px) rotate(18deg) !important; opacity: 0; }
.cat-card.is-gone-left { transform: translate(-135%, 10px) rotate(-18deg) !important; opacity: 0; }
.cat-photo { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cat-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(16,16,14,.86), rgba(16,16,14,0) 58%, rgba(16,16,14,.08)); pointer-events: none; }
.card-content { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 82px 24px 25px; color: #fff; }
.card-kicker { display: flex; gap: 7px; align-items: center; margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 4px rgba(217,229,111,.22); }
.card-title { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 37px; line-height: 1; letter-spacing: -.045em; }
.card-title span { font-family: Georgia, serif; font-weight: 400; font-size: 26px; opacity: .85; }
.card-bio { margin: 10px 0 13px; max-width: 40ch; font-size: 14px; line-height: 1.42; color: rgba(255,255,255,.85); }
.trait-list { display: flex; flex-wrap: wrap; gap: 7px; }
.trait { border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); backdrop-filter: blur(10px); padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.swipe-stamp { position: absolute; z-index: 3; top: 36px; padding: 8px 12px; border: 3px solid; border-radius: 8px; text-transform: uppercase; font-weight: 900; font-size: 24px; letter-spacing: .08em; opacity: 0; }
.swipe-stamp.like { left: 26px; color: var(--acid); transform: rotate(-10deg); }
.swipe-stamp.pass { right: 26px; color: #ff8c7a; transform: rotate(10deg); }

.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 20px; padding: 20px 0 7px; }
.swipe-button { display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; transition: transform .18s, box-shadow .18s; box-shadow: 0 10px 28px rgba(46,38,31,.13); }
.swipe-button:hover { transform: translateY(-3px); }
.swipe-button:active { transform: scale(.92); }
.swipe-button.pass, .swipe-button.like { width: 58px; height: 58px; background: var(--white); }
.swipe-button.pass { color: var(--coral); }
.swipe-button.like { color: #fff; background: var(--coral); box-shadow: 0 12px 30px rgba(239,106,84,.34); }
.swipe-button.rewind { width: 43px; height: 43px; color: #777268; background: #e7dfd3; }
.swipe-button svg { width: 26px; height: 26px; stroke-width: 2.3; }
.gesture-hint { display: flex; justify-content: center; gap: 44px; margin: 0; color: #9a958b; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(255,253,248,.58); border: 1px dashed #cfc4b6; border-radius: var(--radius); padding: 36px; }
.empty-state[hidden] { display: none; }
.empty-orbit { width: 82px; height: 82px; display: grid; place-items: center; border: 1px solid #cfc4b6; border-radius: 50%; position: relative; margin-bottom: 24px; }
.empty-orbit::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--coral); top: -2px; left: 8px; }
.empty-state h2, .empty-list h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: -.04em; }
.empty-state p, .empty-list p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 24px; }

.bottom-nav { position: fixed; z-index: 10; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 28px), 512px); height: 76px; padding: 8px 10px; display: flex; justify-content: space-around; border-radius: 24px; background: rgba(32,33,29,.93); backdrop-filter: blur(18px); box-shadow: 0 16px 45px rgba(23,23,20,.28); }
.nav-item { flex: 1; border: 0; background: transparent; color: #a7a59d; display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; font-weight: 800; }
.nav-item svg { width: 23px; height: 23px; }
.nav-item.is-active { color: #fff; }
.nav-item.is-active svg { color: var(--acid); }
.nav-icon-wrap { position: relative; height: 24px; }
.nav-icon-wrap i { position: absolute; right: -6px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px #292a25; }

.count-badge { min-width: 42px; height: 42px; padding: 0 10px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--coral); font-weight: 900; }
.matches-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.match-card { border: 0; padding: 0; overflow: hidden; min-height: 238px; border-radius: 22px; background: var(--white); text-align: left; box-shadow: 0 12px 30px rgba(48,42,35,.09); cursor: pointer; }
.match-card img { width: 100%; aspect-ratio: 1 / 1.05; object-fit: cover; display: block; }
.match-card div { padding: 12px 13px 15px; }
.match-card h3 { margin: 0 0 2px; font-size: 18px; letter-spacing: -.04em; }
.match-card p { margin: 0; color: var(--muted); font-size: 11px; }
.empty-list { text-align: center; margin: 15vh auto 0; max-width: 300px; }
.empty-list-icon { display: block; margin-bottom: 15px; color: var(--coral); font-family: Georgia, serif; font-size: 66px; line-height: 1; }
.auth-gate { margin: 12vh auto 0; max-width: 360px; padding: 30px 24px; border: 1px solid rgba(32,33,29,.08); border-radius: 26px; text-align: center; background: rgba(255,253,248,.68); box-shadow: 0 18px 40px rgba(48,42,35,.08); }
.auth-gate[hidden] { display: none; }
.auth-gate-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 20px; color: #fff; background: var(--coral); font-family: Georgia, serif; font-size: 30px; transform: rotate(-4deg); }
.auth-gate h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: -.04em; }
.auth-gate p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.profile-form { padding-bottom: 20px; }
fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend { width: 100%; margin-bottom: 12px; font-size: 13px; font-weight: 900; }
legend span { float: right; color: var(--muted); font-weight: 600; }
.photo-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.photo-grid { display: contents; }
.photo-tile, .photo-add { aspect-ratio: .78; border-radius: 18px; overflow: hidden; position: relative; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile button { position: absolute; top: 5px; right: 5px; width: 25px; height: 25px; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: rgba(25,25,22,.72); }
.photo-tile button svg { width: 14px; }
.photo-tile:first-child::after { content: "обложка"; position: absolute; left: 6px; bottom: 6px; padding: 4px 6px; border-radius: 999px; background: var(--acid); font-size: 8px; font-weight: 900; text-transform: uppercase; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; border: 1.5px dashed #bdb3a6; color: var(--muted); background: rgba(255,255,255,.3); font-size: 10px; font-weight: 800; }
.photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-add.is-loading { pointer-events: none; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.field-note { margin: 9px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 28px; }
.field { position: relative; display: flex; flex-direction: column; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field > span { margin-left: 3px; color: #5e5c54; font-size: 11px; font-weight: 800; }
.field input, .field textarea { width: 100%; border: 1px solid #d6cdc1; border-radius: 16px; outline: none; color: var(--ink); background: rgba(255,253,248,.75); padding: 14px 15px; transition: border .2s, box-shadow .2s; }
.field textarea { resize: vertical; min-height: 106px; }
.field input:focus, .field textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(239,106,84,.13); }
.field small { position: absolute; right: 10px; bottom: 8px; color: #aaa297; font-size: 9px; }
.trait-options { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-options input { position: absolute; opacity: 0; }
.trait-options span { display: block; padding: 10px 12px; border: 1px solid #d2c9bd; border-radius: 999px; cursor: pointer; background: rgba(255,253,248,.5); font-size: 11px; font-weight: 700; }
.trait-options input:checked + span { color: #fff; border-color: var(--ink); background: var(--ink); }
.primary-button { border: 0; min-height: 50px; border-radius: 16px; color: #fff; background: var(--ink); padding: 0 20px; cursor: pointer; font-weight: 800; box-shadow: 0 10px 24px rgba(32,33,29,.17); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.submit-button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding-left: 22px; background: var(--coral); box-shadow: 0 12px 28px rgba(239,106,84,.25); }
.save-state { color: #8f8b80; font-size: 10px; font-weight: 800; }

.match-dialog { width: min(calc(100% - 32px), 420px); border: 0; border-radius: 32px; padding: 38px 28px 28px; text-align: center; color: var(--ink); background: var(--paper); box-shadow: 0 35px 90px rgba(25,24,21,.38); }
.match-dialog::backdrop { background: rgba(28,28,24,.62); backdrop-filter: blur(6px); }
.dialog-close { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--paper-deep); display: grid; place-items: center; cursor: pointer; }
.dialog-close svg { width: 17px; }
.match-dialog h2 { margin: 0 0 8px; font-family: Georgia, serif; font-weight: 400; font-size: 42px; letter-spacing: -.05em; }
.match-dialog > p:not(.eyebrow) { margin: 0 auto 24px; color: var(--muted); font-size: 13px; }
.match-faces { display: flex; justify-content: center; margin: 28px 0 22px; }
.match-faces > div { width: 120px; height: 145px; overflow: hidden; border: 5px solid var(--paper); border-radius: 60px; background: var(--paper-deep); box-shadow: 0 10px 26px rgba(32,31,27,.14); }
.match-faces > div:first-child { transform: rotate(-8deg) translateX(10px); display: grid; place-items: center; background: var(--acid); }
.match-faces > div:last-child { transform: rotate(8deg) translateX(-10px); }
.match-faces img { width: 100%; height: 100%; object-fit: cover; }
.match-faces span { font-family: Georgia, serif; font-style: italic; font-size: 22px; }
.match-dialog .primary-button { width: 100%; }
.text-button { border: 0; background: transparent; margin-top: 12px; padding: 8px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.auth-dialog { width: min(calc(100% - 32px), 400px); border: 0; border-radius: 30px; padding: 42px 28px 28px; text-align: center; color: var(--ink); background: var(--paper); box-shadow: 0 35px 90px rgba(25,24,21,.38); }
.auth-dialog::backdrop, .chat-dialog::backdrop { background: rgba(28,28,24,.62); backdrop-filter: blur(6px); }
.auth-logo { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 22px; color: #fff; background: #fc3f1d; font: 800 34px/1 Georgia, serif; transform: rotate(-4deg); }
.auth-dialog h2 { margin: 0 0 10px; font-size: 30px; line-height: 1.04; letter-spacing: -.05em; }
.auth-dialog > p:not(.eyebrow) { margin: 0 auto 24px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-dialog small { display: block; margin-top: 16px; color: #999388; font-size: 10px; line-height: 1.4; }
.yandex-button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 16px; color: #fff; background: #fc3f1d; cursor: pointer; font-weight: 900; }
.yandex-button span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #fc3f1d; background: #fff; font-family: Georgia, serif; }
.dev-login-panel { padding: 14px; border: 1px solid #d6cdc1; border-radius: 18px; background: rgba(255,253,248,.72); text-align: left; }
.dev-login-panel > p { margin: 0 0 9px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.dev-login-panel > div { display: grid; gap: 7px; }
.dev-account { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #ddd4c8; border-radius: 13px; background: var(--white); cursor: pointer; text-align: left; }
.dev-account strong { display: block; font-size: 12px; }
.dev-account span { color: var(--muted); font-size: 10px; }
.dev-account i { color: var(--coral-dark); font-size: 9px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.dev-account.is-active { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(239,106,84,.12); }
.chat-dialog { width: min(100%, 540px); height: min(100dvh, 760px); max-width: none; max-height: none; margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 30px; color: var(--ink); background: var(--paper); box-shadow: 0 35px 90px rgba(25,24,21,.38); }
.chat-dialog[open] { display: grid; grid-template-rows: auto 1fr auto; }
.chat-header { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid rgba(32,33,29,.08); background: rgba(255,253,248,.9); }
.chat-back { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 13px; background: var(--paper-deep); cursor: pointer; }
.chat-header img { width: 44px; height: 44px; border-radius: 15px; object-fit: cover; }
.chat-header div { display: flex; flex-direction: column; gap: 2px; }
.chat-header strong { font-size: 15px; }
.chat-header span { color: var(--muted); font-size: 10px; }
.chat-messages { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 20px 18px; }
.chat-empty { margin: auto; max-width: 250px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.message { max-width: 78%; padding: 10px 13px; border-radius: 16px 16px 16px 5px; background: var(--white); box-shadow: 0 6px 18px rgba(48,42,35,.07); font-size: 13px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.mine { align-self: flex-end; border-radius: 16px 16px 5px 16px; color: #fff; background: var(--coral); }
.chat-form { display: flex; align-items: end; gap: 9px; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(32,33,29,.08); background: var(--white); }
.chat-form textarea { flex: 1; max-height: 110px; resize: none; border: 1px solid #d6cdc1; border-radius: 17px; outline: none; padding: 12px 14px; background: var(--paper); }
.chat-form button { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 16px; color: #fff; background: var(--coral); cursor: pointer; }
.confetti i { position: absolute; width: 8px; height: 16px; border-radius: 4px; background: var(--coral); animation: fall 2s ease-out infinite; }
.confetti i:nth-child(1){left:12%;top:5%;transform:rotate(25deg)}.confetti i:nth-child(2){left:28%;top:15%;background:var(--acid);animation-delay:.4s}.confetti i:nth-child(3){right:13%;top:10%;animation-delay:.7s}.confetti i:nth-child(4){right:30%;top:3%;background:#7ba6a2;animation-delay:1s}.confetti i:nth-child(5){left:48%;top:10%;background:#d4a75b;animation-delay:1.4s}
@keyframes fall { 0% { opacity: 0; translate: 0 -16px; } 25% { opacity: 1; } 100% { opacity: 0; translate: 8px 70px; rotate: 180deg; } }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 105px; transform: translate(-50%, 14px); max-width: calc(100% - 44px); padding: 12px 16px; border-radius: 13px; color: #fff; background: rgba(32,33,29,.94); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  body { background: radial-gradient(circle at 20% 10%, #fff8ec 0, transparent 28%), radial-gradient(circle at 80% 80%, #e1e8bc 0, transparent 26%), var(--paper-deep); }
  .shell { background: var(--paper); box-shadow: 0 0 80px rgba(54,45,35,.12); }
}
@media (max-height: 760px) {
  .topbar { height: 64px; }
  .section-heading { margin-top: 2px; margin-bottom: 12px; }
  .deck-wrap { min-height: 370px; height: 56vh; }
  .card-bio { display: none; }
  .swipe-actions { padding-top: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
