/* ===== Токени ===== */
:root {
  color-scheme: light dark;
  --bg: #f6f4f7;
  --surface: #ffffff;
  --surface-2: #f0edf3;
  --text: #1d1a23;
  --muted: #706a7a;
  --line: #e5e1ea;
  --accent: #ff3d6e;
  --accent-2: #ff8a4c;
  --accent-soft: #ffe5ec;
  --grad: linear-gradient(135deg, #ff3d6e 0%, #ff8a4c 100%);
  --ok: #12a565;
  --ok-soft: #dcf5e9;
  --warn: #c98200;
  --warn-soft: #fff1d6;
  --danger: #e5484d;
  --danger-soft: #ffe4e4;
  --skip: #8b8496;
  --verified: #1d8cf8;
  --verified-ink: #0a62c2;
  --verified-soft: #e4f0ff;
  --coin: #d99a00;
  --coin-soft: #fff3d1;
  --shadow: 0 8px 28px rgba(40, 20, 60, .14);
  --shadow-sm: 0 2px 10px rgba(40, 20, 60, .08);
  --radius: 18px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121016;
    --surface: #1c1a22;
    --surface-2: #27242f;
    --text: #f3f0f7;
    --muted: #a49eb0;
    --line: #322e3c;
    --accent-soft: #3a1b26;
    --ok-soft: #12301f;
    --warn-soft: #33270d;
    --danger-soft: #3a1a1c;
    --verified: #3a9bff;
    --verified-ink: #8cc4ff;
    --verified-soft: #13263c;
    --coin: #f5b82e;
    --coin-soft: #3a2c0c;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
  }
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; stroke: none; }
.ic.sm { width: 18px; height: 18px; }
.ic.lg { width: 32px; height: 32px; }

/* ===== Каркас ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
@media (min-width: 600px) {
  body { background: var(--surface-2); }
  #app { box-shadow: 0 0 0 1px var(--line), var(--shadow); }
}
.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
}
.view.fixed { overflow: hidden; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { margin-left: -8px; }
.logo { font-weight: 900; font-size: 24px; letter-spacing: -.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; flex: 1; }

.page { padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 16px; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 14px;
  font-weight: 650; font-size: 16px; line-height: 1.2; text-align: center;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s ease, opacity .15s ease, background .15s ease;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(255, 61, 110, .3); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 6px 14px; font-size: 14px; border-radius: 11px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); flex: none;
}
.icon-btn:active { background: var(--surface-2); }

/* ===== Форми ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 650; color: var(--muted); padding: 0; }
.field small { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="tel"], textarea, select {
  width: 100%;
  font-size: 16px; /* щоб iOS не збільшував сторінку */
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px;
  border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line);
  font-weight: 600; font-size: 15px; cursor: pointer;
}
.chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

.hint { color: var(--muted); font-size: 14px; }
.notice {
  padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--text);
  font-size: 14px; display: flex; gap: 10px; align-items: flex-start;
}
.notice .ic { color: var(--warn); }
.surface { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; }

/* Сегментований перемикач */
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg > * {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; border-radius: 9px; font-weight: 650; font-size: 15px; color: var(--muted);
}
.seg > .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Нижнє меню ===== */
.tabbar {
  flex: none;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 10;
}
.tabbar a {
  flex: 1; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 650; color: var(--muted); position: relative;
}
.tabbar a.on { color: var(--accent); }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
}
.badge:empty { display: none; }

/* ===== Сповіщення ===== */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 12px);
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 420px); width: max-content;
  background: #26222d; color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 15px; font-weight: 550; box-shadow: var(--shadow); z-index: 1000;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ===== Вхід ===== */
.auth { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 32px 20px calc(32px + var(--safe-b)); }
.brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand-mark { width: 76px; height: 76px; border-radius: 24px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px rgba(255, 61, 110, .35); }
.brand-mark .ic { width: 40px; height: 40px; }
.brand h1 { font-size: 34px; font-weight: 900; letter-spacing: -.03em; }
.brand p { color: var(--muted); max-width: 340px; }

/* ===== Стрічка анкет ===== */
.feed { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 12px; }
.deck { flex: 1; min-height: 0; position: relative; }
.card {
  position: absolute; inset: 0;
  border-radius: 22px; overflow: hidden;
  background: #222; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.card.enter { animation: cardIn .28s ease; }
.card.fly { transition: transform .32s ease-in, opacity .32s ease-in; }
.card.back { transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes cardIn { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }

.carousel { position: absolute; inset: 0; background: #222; }
.carousel img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .18s ease; pointer-events: none; -webkit-user-drag: none;
}
.carousel img.on { opacity: 1; }
.carousel.bump { animation: bump .2s ease; }
@keyframes bump { 50% { transform: scale(.985); } }
.bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.bars i { flex: 1; height: 3.5px; border-radius: 2px; background: rgba(255, 255, 255, .4); }
.bars i.on { background: #fff; }

.card-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 60px 18px 18px; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .45) 55%, transparent 100%);
  display: flex; align-items: flex-end; gap: 10px;
}
.card-info .who { flex: 1; min-width: 0; }
.card-info h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.card-info .city { display: flex; align-items: center; gap: 4px; font-size: 15px; opacity: .92; margin-top: 2px; }
.card-info .bio { font-size: 15px; margin-top: 6px; opacity: .95; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-info .icon-btn { color: #fff; background: rgba(255, 255, 255, .18); }
.online-dot { width: 11px; height: 11px; border-radius: 50%; background: #2bd47d; box-shadow: 0 0 0 2px rgba(0, 0, 0, .15); flex: none; }

.stamp {
  position: absolute; top: 46px; z-index: 3; padding: 4px 14px;
  font-size: 34px; font-weight: 900; letter-spacing: .04em; border: 4px solid; border-radius: 12px;
  opacity: 0; pointer-events: none;
}
.stamp.like { left: 22px; color: #2bd47d; transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: #ff5470; transform: rotate(14deg); }

.actions { flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 0 16px; }
.act {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}
.act:active { transform: scale(.9); }
.act.big { width: 68px; height: 68px; }
.act.big .ic { width: 32px; height: 32px; }
.act.skip { color: var(--skip); }
.act.like { color: #fff; background: var(--grad); box-shadow: 0 8px 20px rgba(255, 61, 110, .35); }
.act.small { width: 50px; height: 50px; color: var(--accent); }
.act:disabled { opacity: .45; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 32px 24px; color: var(--muted); }
.empty .big-ic { width: 84px; height: 84px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.empty .big-ic .ic { width: 38px; height: 38px; }
.empty h2 { color: var(--text); font-size: 21px; }
.empty .btn-col { width: 100%; max-width: 300px; margin-top: 6px; }

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

/* ===== Нижня панель (sheet) ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 5, 20, .5); opacity: 0; transition: opacity .22s ease; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + var(--safe-b));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { font-size: 21px; font-weight: 800; }
@media (min-width: 600px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; max-width: 460px; }
}

/* Камера */
.cam { display: flex; flex-direction: column; gap: 10px; }
.cam-preview { display: none; border-radius: 16px; overflow: hidden; background: #000; }
.cam.has-media .cam-preview { display: block; }
.cam-preview img, .cam-preview video { width: 100%; max-height: 46dvh; object-fit: contain; margin: 0 auto; }
.cam-buttons { display: flex; gap: 10px; }
.cam-buttons .btn { flex: 1; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .15s ease; }

/* ===== Списки ===== */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; position: relative; }
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-size: 16px; }
.row .main small { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main small.unread { color: var(--text); font-weight: 650; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: var(--muted); font-size: 12px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar.sm { width: 40px; height: 40px; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .online-dot { position: absolute; right: 1px; bottom: 1px; box-shadow: 0 0 0 2.5px var(--bg); }

.new-matches { display: flex; gap: 14px; overflow-x: auto; padding: 4px 16px 12px; scrollbar-width: none; }
.new-matches::-webkit-scrollbar { display: none; }
.new-matches a { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex: none; font-size: 13px; font-weight: 600; }
.new-matches .avatar { width: 68px; height: 68px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.new-matches span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 16px 6px; }

/* ===== Чат ===== */
.chat-head { border-bottom: 1px solid var(--line); }
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.chat-head .who b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who small { display: block; color: var(--muted); font-size: 13px; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: 80%; padding: 9px 13px; border-radius: 18px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; background: var(--surface); box-shadow: var(--shadow-sm); }
.msg.mine { align-self: flex-end; background: var(--grad); color: #fff; }
.msg time { display: block; font-size: 11px; opacity: .65; text-align: right; margin-top: 2px; }
.msg.mine time::after { content: " ✓"; }
.msg.mine.read time::after { content: " ✓✓"; }
.day-sep { align-self: center; font-size: 12px; font-weight: 650; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 10px; margin: 8px 0; }
.chat-hello { margin: auto; text-align: center; color: var(--muted); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chat-hello .avatar { width: 96px; height: 96px; }
.composer { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; padding: 10px 14px; border-radius: 22px; line-height: 1.35; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.composer .send:disabled { opacity: .45; }

/* ===== Профіль іншого користувача ===== */
.gallery { position: relative; aspect-ratio: 3 / 4; max-height: 64dvh; width: 100%; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); touch-action: manipulation; }
.profile-info h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.profile-info .city { display: flex; align-items: center; gap: 4px; color: var(--muted); margin-top: 2px; }
.profile-info .bio { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.pill.match { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.no { background: var(--danger-soft); color: var(--danger); }
.contacts-box { border-radius: 16px; background: var(--ok-soft); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.contacts-box .item { display: flex; align-items: flex-start; gap: 10px; }
.contacts-box .item > div { flex: 1; min-width: 0; }
.contacts-box small { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ok); }
.contacts-box p { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; user-select: text; }
.contacts-box .icon-btn { color: var(--ok); width: 36px; height: 36px; }

/* ===== Мій профіль ===== */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-btn { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.tile .tile-btn .ic { width: 16px; height: 16px; }
.tile .del { top: 6px; right: 6px; }
.tile .star { bottom: 6px; right: 6px; }
.tile .main-label { position: absolute; left: 6px; bottom: 6px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; }
.tile.add { display: grid; place-items: center; border: 2px dashed var(--line); background: transparent; color: var(--accent); cursor: pointer; }
.tile.add input { display: none; }
.tile.busy::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }

/* ===== Запити ===== */
.req-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 24px; }
.req-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.req-card.unseen { box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm); }
.req-head { display: flex; align-items: center; gap: 10px; }
.req-head .main { flex: 1; min-width: 0; }
.req-head b { display: block; }
.req-head small { color: var(--muted); font-size: 13px; }
.req-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.req-title .ic { color: var(--accent); }
.req-note { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.req-media { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.req-media figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.req-media figcaption { font-size: 12px; font-weight: 650; color: var(--muted); }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: #000; width: 100%; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, .2); }
.thumb.placeholder { background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }

/* ===== Перегляд медіа на весь екран ===== */
.viewer { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .94); display: flex; align-items: center; justify-content: center; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .close { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; color: #fff; background: rgba(255, 255, 255, .15); z-index: 2; }

/* ===== Взаємна симпатія ===== */
.match-screen {
  position: fixed; inset: 0; z-index: 150; background: linear-gradient(160deg, rgba(255, 61, 110, .96), rgba(255, 138, 76, .96));
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 24px;
  text-align: center; animation: fadeIn .25s ease;
}
.match-screen h2 { font-size: 38px; font-weight: 900; letter-spacing: -.03em; }
.match-screen .pair { display: flex; }
.match-screen .pair img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; background: rgba(255, 255, 255, .3); }
.match-screen .pair img + img { margin-left: -24px; }
.match-screen .btn-col { width: 100%; max-width: 320px; }
.match-screen .btn.primary { background: #fff; color: var(--accent); }
.match-screen .btn.ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); }
@keyframes fadeIn { from { opacity: 0; } }

/* ===== Дрібниці ===== */
.msg.pending { opacity: .6; }
.pad-x { padding: 0 16px 12px; }
.mt-8 { margin-top: 8px; }
.center { text-align: center; }

/* ===== Підтверджена анкета ===== */
.vbadge { display: inline-block; width: .95em; height: .95em; margin-left: .25em; vertical-align: -.12em; flex: none; }
.vbadge .vb-bg { fill: var(--verified); stroke: var(--verified); stroke-width: 1.6; stroke-linejoin: round; }
.vbadge .vb-check { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.card-info h2 .vbadge, .profile-info h2 .vbadge { margin-left: 0; }
.pill.verified { background: var(--verified-soft); color: var(--verified-ink); }
.new-matches .nm-name { display: flex; align-items: center; justify-content: center; max-width: 72px; }
.new-matches .nm-name .vbadge { flex: none; }
.verify-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--verified-soft); }
.verify-box > .ic { color: var(--verified-ink); }
.verify-box > .vbadge { width: 28px; height: 28px; margin: 0; }
.verify-box > div { flex: 1; min-width: 0; }
.verify-box b { display: block; }
.verify-box small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.verify-code { text-align: center; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.verify-code small { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.verify-code b { display: block; font-size: 40px; font-weight: 800; letter-spacing: .25em; padding-left: .25em; font-variant-numeric: tabular-nums; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--verified-soft); color: var(--verified-ink); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ===== Вибір мови ===== */
.auth { position: relative; }
.lang-switch {
  position: absolute; top: 12px; right: 16px;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 650;
}
.lang-list { display: flex; flex-direction: column; gap: 2px; }
.lang-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 0 14px; border-radius: 12px; font-size: 17px; font-weight: 600; text-align: left;
}
.lang-item:active { background: var(--surface-2); }
.lang-item.on { background: var(--accent-soft); color: var(--accent); }
.lang-btn { justify-content: flex-start; }

/* ===== Монети ===== */
.coin-amt { display: inline-flex; align-items: center; gap: 3px; font-weight: 750; white-space: nowrap; vertical-align: -.15em; }
.coin-amt .ic { color: var(--coin); }
.btn.primary .coin-amt .ic, .wallet-hero .coin-amt .ic { color: #fff; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 750;
}
.coin-chip .ic { color: var(--coin); }
.act.like { position: relative; }
.like-badge {
  position: absolute; top: -4px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center; background: var(--surface); color: var(--accent);
  font-size: 12px; font-weight: 800; box-shadow: var(--shadow-sm);
}
.like-badge:empty { display: none; }
.like-badge.paid { color: var(--text); }
.like-badge .ic { width: 12px; height: 12px; }
.need-coins { display: grid; place-items: center; width: 72px; height: 72px; margin: 4px auto 0; border-radius: 50%; background: var(--coin-soft); color: var(--coin); }
.need-coins .ic { width: 36px; height: 36px; }
.section-h { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 750; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.surface.stack h3 { font-size: 17px; }

.quick-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qtile { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.qtile > .ic { color: var(--accent); }
.qtile:first-child > .ic { color: var(--coin); }
.qtile > div { min-width: 0; }
.qtile b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qtile small { display: block; font-size: 12px; color: var(--muted); }
.qtile .badge { position: absolute; top: 8px; right: 8px; }

/* Гаманець */
.wallet-hero {
  display: flex; flex-direction: column; gap: 4px; text-align: center; padding: 20px 16px; border-radius: 22px;
  background: var(--grad); color: #fff; box-shadow: 0 10px 28px rgba(255, 61, 110, .3);
}
.wallet-hero small { opacity: .85; font-weight: 650; }
.wallet-balance { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 44px; font-weight: 800; letter-spacing: -.02em; }
.wallet-balance .ic { width: 40px; height: 40px; }
.wallet-hero p { opacity: .92; font-size: 14px; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ref-stats > div { background: var(--surface-2); border-radius: 12px; padding: 8px 6px; text-align: center; min-width: 0; }
.ref-stats b { display: block; font-size: 18px; }
.ref-stats small { display: block; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.price-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.price-list > div:last-child { border-bottom: 0; }
.tx-list { display: flex; flex-direction: column; }
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx b { display: block; font-size: 15px; font-weight: 650; }
.tx small { color: var(--muted); font-size: 12px; }
.tx-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.tx-amt.plus { color: var(--ok); }

/* Гості */
.guest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.guest { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 8px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.guest-photo { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.guest-photo img { width: 100%; height: 100%; object-fit: cover; }
.guest b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest small { color: var(--muted); font-size: 12px; }
.guest .btn { margin-top: 4px; }
/* Розмиті мініатюри: це крихітні (12 px) копії, тож розмиття — лише для краси, а не захист */
img.blurred, .album-card.locked img, .album-covers.big img { filter: blur(10px) saturate(1.2); transform: scale(1.35); }
.blur-fallback { position: absolute; inset: 0; background: linear-gradient(135deg, #c9b6d8, #f2b8c6); }
.album-lock {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff;
}
.new-badge { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; }

/* Приватні альбоми */
.album-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.album-grid:empty { display: none; }
.album-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.album-covers { position: relative; display: flex; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface-2); }
.album-covers img { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.album-empty { flex: 1; display: grid; place-items: center; color: var(--muted); }
.album-meta { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; }
.album-meta b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-meta small { color: var(--muted); font-size: 12px; }
.album-locked { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; text-align: center; }
.album-locked .btn { max-width: 360px; }
.album-covers.big { width: 100%; max-width: 360px; aspect-ratio: 4 / 3; border-radius: 22px; }

/* Сторінка запрошення */
.ref-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ref-photo { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 4px solid var(--surface); box-shadow: var(--shadow); }
.ref-hero h1 { font-size: 26px; font-weight: 850; letter-spacing: -.02em; }
.ref-who { font-weight: 650; }
#ref-card { display: flex; flex-direction: column; gap: 24px; }

/* Посилання користувача */
.link-list { display: flex; flex-direction: column; }
.link-list:empty { display: none; }
.ref-link { display: flex; align-items: center; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ref-link:last-child { border-bottom: 0; }
.ref-link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ref-link-main b { font-size: 15px; }
.ref-link-main small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-link .icon-btn { width: 38px; height: 38px; color: var(--muted); }

/* ===== Чат: медіа, геолокація, запис голосу ===== */
.composer .attach { color: var(--muted); width: 44px; height: 44px; }
.msg.kind-image, .msg.kind-video, .msg.kind-location, .msg.kind-live { padding: 4px; max-width: 260px; }
.msg.kind-image time, .msg.kind-video time, .msg.kind-location time, .msg.kind-live time { padding: 0 8px 2px; }
.msg-photo { display: block; border-radius: 14px; overflow: hidden; }
.msg-photo img { max-width: 100%; max-height: 320px; object-fit: cover; }
.msg-video { width: 100%; max-height: 320px; border-radius: 14px; background: #000; }
.voice { display: flex; align-items: center; gap: 6px; }
.voice audio { height: 36px; max-width: 220px; }
.msg.mine .voice .ic { color: #fff; }
.loc-caption, .call-caption { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 6px 6px 0; }
.msg.kind-location_request .loc-caption, .msg.kind-call .call-caption { padding: 0; }
.loc-sub { display: block; padding: 0 6px; font-size: 12px; opacity: .75; }
.msg .btn-row { margin-top: 8px; }
.msg .btn.sm { min-height: 34px; }
.msg.mine .btn.ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #2bd47d; box-shadow: 0 0 0 3px rgba(43, 212, 125, .3); animation: pulse 1.6s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(43, 212, 125, 0); } }

.map-card { position: relative; display: block; width: 240px; max-width: 100%; height: 150px; overflow: hidden; border-radius: 14px; background: #dfe7e3; }
.map-tiles { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: repeat(3, 256px); }
.map-tiles img { width: 256px; height: 256px; max-width: none; }
.map-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); color: var(--accent); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.map-pin .ic { width: 32px; height: 32px; }
.map-attr { position: absolute; right: 4px; bottom: 2px; font-size: 9px; color: #333; background: rgba(255, 255, 255, .75); padding: 0 4px; border-radius: 4px; }

.recorder { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s ease infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-time { flex: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.recorder .send { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; }

.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 12px; font-size: 16px; font-weight: 600; text-align: left; }
.menu-item:active { background: var(--surface-2); }
.menu-item .ic { color: var(--accent); }

/* Смуга трансляції геолокації — завжди видно, що місце передається */
.beacon-bar {
  flex: none; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 12px 6px;
  background: var(--ok); color: #fff; font-size: 13px; font-weight: 650; z-index: 20;
}
.beacon-bar + .view { padding-top: 0; }
.beacon-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beacon-bar button { padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .22); font-weight: 750; font-size: 13px; }
.beacon-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1.2s ease infinite; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.phone-ok { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--ok); }

/* ===== Дзвінок ===== */
.call-overlay {
  position: fixed; inset: 0; z-index: 300; background: #15121b; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(40px + var(--safe-t)) 20px calc(28px + var(--safe-b));
}
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.call-overlay.has-remote-video .call-remote { display: block; }
.call-audio { display: none; }
.call-local {
  position: absolute; right: 14px; top: calc(14px + var(--safe-t)); width: 104px; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 14px; background: #000; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); display: none; z-index: 2; transform: scaleX(-1);
}
.call-overlay.has-local-video .call-local { display: block; }
.call-info { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-top: 6vh; }
.call-overlay.has-remote-video .call-info { margin-top: 0; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.call-overlay.has-remote-video .call-avatar { display: none; }
.call-avatar { width: 120px; height: 120px; box-shadow: 0 0 0 4px rgba(255, 255, 255, .15); }
.call-name { font-size: 28px; font-weight: 800; }
.call-status { opacity: .8; font-variant-numeric: tabular-nums; }
.call-actions { position: relative; z-index: 1; display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #fff; min-width: 64px; }
.call-btn .ic { width: 62px; height: 62px; padding: 18px; border-radius: 50%; background: rgba(255, 255, 255, .16); box-sizing: border-box; }
.call-btn.off .ic { background: #fff; color: #15121b; }
.call-btn.red .ic { background: var(--danger); }
.call-btn.green .ic { background: #12a565; }
/* Переноси рядків зберігаємо лише в текстових повідомленнях */
.msg[class*="kind-"]:not(.kind-text) { white-space: normal; }
.ref-link-main small.link-used { color: var(--ok); font-weight: 650; }
.ref-link-main small.link-blocked { color: var(--warn); font-weight: 650; }

/* Зникаючі повідомлення */
.composer .once-toggle { color: var(--muted); width: 44px; height: 44px; flex: none; }
.composer.once-on .once-toggle { color: #fff; background: var(--grad); }
.composer.once-on textarea { box-shadow: inset 0 0 0 1.5px var(--accent); }
.once-strip { flex: none; display: flex; gap: 8px; align-items: flex-start; padding: 8px 14px; font-size: 13px; line-height: 1.35; color: var(--accent); background: var(--accent-soft); }
.once-strip .ic { flex: none; margin-top: 1px; }
.msg.once { white-space: normal; padding: 4px; width: 240px; max-width: 80%; }
.msg.once time { padding: 0 8px 2px; }
.once-card { position: relative; display: grid; align-content: end; gap: 2px; width: 100%; min-height: 120px; padding: 12px; border-radius: 14px; overflow: hidden; color: #fff; text-align: left; font: inherit; background: #2b2533; }
button.once-card { cursor: pointer; }
.once-cover { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(135deg, #47305e, #7a2d4c); }
.once-cover img { width: 100%; height: 100%; object-fit: cover; }
.once-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .05) 20%, rgba(0, 0, 0, .55)); }
.once-cover i { display: block; height: 10px; margin: 14px 14px 0; border-radius: 6px; background: rgba(255, 255, 255, .45); filter: blur(4px); }
.once-cover i:nth-child(2) { width: 70%; }
.once-cover i:nth-child(3) { width: 45%; }
.once-label, .once-card small { position: relative; }
.once-label { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.once-card small { font-size: 12px; opacity: .9; }
.msg.once:not(.once-new) { width: auto; padding: 8px 12px 4px; }
.msg.once:not(.once-new) time { padding: 0; }
.once-gone { display: flex; gap: 8px; align-items: center; opacity: .85; }
.once-gone b { display: block; font-size: 14px; font-weight: 650; }
.once-gone small { display: block; font-size: 12px; }
.once-viewer { background: #000; flex-direction: column; align-items: stretch; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.once-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 10px 10px 16px; color: #fff; font-size: 14px; }
.once-bar .grow { flex: 1; }
.once-bar .icon-btn { color: #fff; background: rgba(255, 255, 255, .15); }
.once-bar .btn.ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5); }
.once-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px 12px calc(12px + var(--safe-b)); }
.once-body img, .once-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.once-text { max-width: 560px; max-height: 100%; overflow-y: auto; color: #fff; font-size: 20px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.once-voice { display: grid; justify-items: center; gap: 18px; color: #fff; }
