/* ==========================================================================
   Dating script - main stylesheet (public site + shared admin base)
   Light and dark themes are controlled by <html data-theme="light|dark|system">.
   ========================================================================== */

:root {
  --accent: #C94A6E;
  --like: #FF4D57;
  --radius: 24px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --sidebar-w: 224px;
  --safe-t: 0px;
  --safe-b: 0px; /* Android WebViews (Facebook, Instagram) report a bogus bottom inset; real insets only on iOS / installed PWA */
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

@supports (-webkit-touch-callout: none) { :root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); } }
@media (display-mode: standalone) { :root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); } }

/* Dark (default) */
:root,
:root[data-theme="dark"] {
  --bg: #0E0E10;
  --surface: #1C1C22;
  --surface-2: #26262E;
  --border: #2A2A33;
  --text: #FFFFFF;
  --muted: #A0A0AB;
  --accent-text: color-mix(in srgb, var(--accent) 62%, #fff);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --skeleton-a: #1C1C22;
  --skeleton-b: #2A2A33;
  --glass: rgba(14, 14, 16, .55);
  --notice-bg: rgba(255, 255, 255, .06);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F7F7F9;
  --surface: #FFFFFF;
  --surface-2: #EFEFF3;
  --border: #E4E4EA;
  --text: #16161A;
  --muted: #6B6B76;
  --accent-text: color-mix(in srgb, var(--accent) 86%, #000);
  --shadow: 0 8px 26px rgba(22, 22, 30, .10);
  --skeleton-a: #EDEDF1;
  --skeleton-b: #F7F7F9;
  --glass: rgba(255, 255, 255, .6);
  --notice-bg: rgba(0, 0, 0, .04);
  color-scheme: light;
}

:root[data-theme="system"] {
  --bg: #F7F7F9;
  --surface: #FFFFFF;
  --surface-2: #EFEFF3;
  --border: #E4E4EA;
  --text: #16161A;
  --muted: #6B6B76;
  --accent-text: color-mix(in srgb, var(--accent) 86%, #000);
  --shadow: 0 8px 26px rgba(22, 22, 30, .10);
  --skeleton-a: #EDEDF1;
  --skeleton-b: #F7F7F9;
  --glass: rgba(255, 255, 255, .6);
  --notice-bg: rgba(0, 0, 0, .04);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0E0E10;
    --surface: #1C1C22;
    --surface-2: #26262E;
    --border: #2A2A33;
    --text: #FFFFFF;
    --muted: #A0A0AB;
    --accent-text: color-mix(in srgb, var(--accent) 62%, #fff);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --skeleton-a: #1C1C22;
    --skeleton-b: #2A2A33;
    --glass: rgba(14, 14, 16, .55);
    --notice-bg: rgba(255, 255, 255, .06);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-word; }
.inline { display: inline; }
.stack > * + * { margin-top: 14px; }

.ico { width: 22px; height: 22px; flex: none; }
.ico-sm { width: 16px; height: 16px; }
.ico-xl { width: 56px; height: 56px; stroke-width: 1.5; }

/* ---------- Layout shell ---------- */
.main-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body.with-nav .main-wrap { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 16px 24px; }
.main-narrow { max-width: 720px; }
.main-swipe { max-width: 560px; }
.main-profile { max-width: 640px; padding-left: 0; padding-right: 0; padding-top: 0; }
.main-chats { max-width: 1100px; padding: 0; }
.main-onboarding { max-width: 560px; }

.announce { background: var(--accent); color: #fff; text-align: center; padding: 8px 16px; font-size: .9rem; font-weight: 600; padding-top: calc(var(--safe-t) + 8px); }

.site-footer { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; padding: 16px; color: var(--muted); font-size: .85rem; }
.site-footer a { color: var(--muted); }

/* Navigation: bottom bar on phones, sidebar on desktop */
.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around; align-items: stretch;
  box-sizing: border-box; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--border);
  /* own compositing layer + extra surface below it: in-app WebViews (Facebook, Instagram) resize the viewport while scrolling and can leave a gap under fixed bars */
  transform: translateZ(0); -webkit-transform: translateZ(0);
  box-shadow: 0 60px 0 0 var(--surface);
}
.nav-brand { display: none; }
.nav-signin { flex: 1; align-self: center; margin: 0 12px; justify-content: center; white-space: nowrap; min-width: 0; }
.nav-item .nav-label { white-space: nowrap; }
.nav-item {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none;
}
.nav-item:hover { text-decoration: none; }
body[data-guest="1"] .nav-item:not([data-badge="discover"]) { display: none; }
.nav-item .ico { width: 26px; height: 26px; }
.nav-item.active { color: var(--text); }
.nav-item.active .ico { fill: currentColor; }
.nav-item[data-badge="discover"].active .ico { fill: none; stroke-width: 2.6; }
.nav-item .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--like); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}

@media (min-width: 769px) {
  body.with-nav .main-wrap { padding-bottom: 0; margin-left: var(--sidebar-w); }
  .nav {
    box-shadow: none; transform: none;
    top: 0; bottom: auto; right: auto; width: var(--sidebar-w); height: 100vh; height: 100dvh;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 20px 14px; border-top: 0; border-right: 1px solid var(--border);
  }
  .nav-brand { display: block; padding: 6px 12px 22px; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--text); }
  .nav-brand:hover { text-decoration: none; }
  .nav-brand img { max-height: 40px; width: auto; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 14px; border-radius: 14px; font-size: 1rem; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--surface-2); }
  .nav-item .badge { position: static; margin-left: auto; }
  .nav-signin { flex: none; align-self: stretch; margin: auto 0 0; }
  .main { padding-top: 28px; }
  .main-profile { padding-top: 24px; }
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px;
  border: 1px solid transparent; border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 1.02rem; text-decoration: none; transition: transform .12s ease, opacity .15s, background .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-dark { background: #26262E; color: #fff; }
:root[data-theme="light"] .btn-dark { background: #16161A; }
.btn-like { background: var(--like); color: #fff; }
.btn-like.is-done { background: var(--surface-2); color: var(--muted); }
.btn-danger { background: #C0262D; color: #fff; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn-google:hover { background: #f6f6f6; }
.btn-facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.btn-facebook:hover { background: #166fe0; }
.sheet-panel .btn-block + .btn-block { margin-top: 10px; }
.btn-link { background: none; border: 0; color: var(--accent-text); min-height: 40px; padding: 0 8px; text-decoration: underline; }
.btn-small { min-height: 36px; padding: 0 16px; font-size: .9rem; }
.btn-block { display: flex; width: 100%; }
.btn-grow { flex: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }

.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn.glass { background: var(--glass); color: var(--text); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.icon-btn.placeholder { visibility: hidden; }

.field { display: block; margin: 0 0 14px; }
.field > span:first-child { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 140px; }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="email"], input[type="file"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1rem; outline: none;
}
textarea { resize: vertical; min-height: 110px; border-radius: 18px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="color"] { width: 64px; height: 44px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.form-error { color: #FF6B72; font-weight: 600; margin: 10px 0; }
:root[data-theme="light"] .form-error { color: #C0262D; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] .form-error { color: #C0262D; } }

.switch-row, .check-row, .radio-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; cursor: pointer; }
.check-row, .radio-row { justify-content: flex-start; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; flex: none; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
input[type="checkbox"]:not(.switch), input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.radio-cards { display: grid; gap: 12px; margin: 18px 0; }
.radio-cards.compact { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 0; }
.radio-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--surface); border: 2px solid var(--border); border-radius: 20px; cursor: pointer; font-weight: 600; transition: border-color .15s, background .15s; }
.radio-cards.compact .radio-card { padding: 12px; justify-content: center; text-align: center; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; position: relative; }
.radio-card input:checked ~ .radio-dot { border-color: var(--accent); }
.radio-card input:checked ~ .radio-dot::after { content: ""; position: absolute; inset: 4px; background: var(--accent); border-radius: 50%; }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.radio-card:has(input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* ---------- Cards, pills, notices ---------- */
.card-box, section.card, form.card, article.card, div.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.card-box h2, section.card h2, form.card h2, article.card h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.notice { background: var(--notice-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
.notice-ok { border-color: #22C55E; }
.notice-info { display: flex; gap: 8px; align-items: flex-start; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle; line-height: 1.5; }
.pill-bot { background: #3B4BCB; color: #fff; }
.pill-gold { background: #F5C542; color: #3B2A00; }
.pill-new { background: #15803D; color: #fff; }
.dot-online { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 2px rgba(0,0,0,.35); margin-right: 4px; vertical-align: middle; }
.is-online { color: #22C55E; }
.plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }
.row-user { display: flex; align-items: center; gap: 10px; }
.sub-h { margin-top: 16px; font-size: .95rem; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 4px; background: none; border: 0; border-top: 1px solid var(--border); color: var(--text); font-size: 1rem; text-align: left; text-decoration: none; }
section .menu-item:first-of-type, .sheet-panel .menu-item:first-child { border-top: 0; }
.menu-item:hover { text-decoration: none; background: var(--surface-2); }
.menu-item.danger { color: #FF6B72; }
:root[data-theme="light"] .menu-item.danger { color: #C0262D; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 76px; height: 76px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 36px; border-radius: 999px; color: var(--muted); }
.seg.active { background: var(--surface-2); color: var(--text); }
.seg:hover { text-decoration: none; }
.gold-banner { display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius-sm); background: linear-gradient(90deg, #F5C542, #E9A93A); color: #3B2A00; font-weight: 700; }
.gold-banner span { flex: 1; }
.gold-banner:hover { text-decoration: none; }

/* ---------- Profile grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 769px) { .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; } }
.card.profile-card, .profile-card { position: relative; display: block; aspect-ratio: 3 / 4; padding: 0; margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); color: #fff; border: 0; box-shadow: var(--shadow); text-decoration: none; }
.profile-card:hover { text-decoration: none; }
.profile-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.profile-card:hover img { transform: scale(1.03); }
.profile-card .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.15) 45%, rgba(0,0,0,0) 65%); }
.profile-card .info { position: absolute; left: 14px; right: 14px; bottom: 12px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.profile-card .name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.profile-card .sub { font-size: .8rem; opacity: .9; }
.profile-card .tl { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.profile-card .tr { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.5); font-size: .78rem; font-weight: 600; }
.profile-card .tr .ico { width: 14px; height: 14px; }
.profile-card.blurred img { filter: none; }
.profile-card .lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); }
.profile-card .lock .ico { width: 36px; height: 36px; }
.profile-card .liked-note { position: absolute; left: 12px; right: 12px; bottom: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.7); }

.skeleton { background: linear-gradient(100deg, var(--skeleton-a) 30%, var(--skeleton-b) 50%, var(--skeleton-a) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.card.skeleton { aspect-ratio: 3 / 4; border: 0; padding: 0; margin: 0; border-radius: var(--radius); }
.match-row.skeleton { height: 76px; border-radius: 20px; margin-bottom: 10px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.empty, .notice-page, .error-page { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty h2, .notice-page h1, .error-page h1 { color: var(--text); margin: 0; }
.empty .btn, .notice-page .btn { margin-top: 8px; }
.sentinel { height: 1px; }
.error-page { min-height: 100vh; min-height: 100dvh; justify-content: center; }
.error-code { font-family: var(--serif); font-size: 4rem; font-weight: 700; margin: 0; color: var(--accent-text); line-height: 1; }
.error-icon { color: var(--accent-text); }
.error-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.debug-detail { text-align: left; max-width: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: .75rem; white-space: pre-wrap; color: var(--text); }
.prose { max-width: 680px; margin: 0 auto; }
.prose p, .prose li { color: var(--text); }
.prose ul { padding-left: 1.2em; }

/* ---------- Swipe ---------- */
.swipe-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.deck { position: relative; width: min(100%, 420px); aspect-ratio: 3 / 4.1; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.deck-loading { position: absolute; inset: 0; border-radius: var(--radius); }
.swipe-card { position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); color: #fff; box-shadow: var(--shadow); cursor: grab; will-change: transform; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s; touch-action: none; }
.swipe-card.dragging { transition: none; cursor: grabbing; }
.swipe-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.swipe-card .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.8) 0%, rgba(0,0,0,0) 55%); pointer-events: none; }
.swipe-card .info { position: absolute; left: 20px; right: 20px; bottom: 18px; pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.swipe-card .name { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swipe-card .sub { opacity: .92; }
.stamp { position: absolute; top: 28px; padding: 4px 14px; border: 4px solid; border-radius: 10px; font-size: 1.9rem; font-weight: 800; letter-spacing: .06em; opacity: 0; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.stamp-like { left: 24px; color: #3DDC84; border-color: #3DDC84; transform: rotate(-14deg); }
.stamp-nope { right: 24px; color: #FF6B72; border-color: #FF6B72; transform: rotate(14deg); }
.swipe-actions { display: flex; gap: 28px; justify-content: center; }
.round-btn { width: 68px; height: 68px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); transition: transform .12s; }
.round-btn:active { transform: scale(.9); }
.round-btn .ico { width: 30px; height: 30px; }
.round-btn.pass { color: #FF6B72; }
.round-btn.like { color: #fff; background: var(--like); border-color: var(--like); }
.round-btn.like .ico { fill: currentColor; }
.swipe-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .swipe-hint { display: block; } }

/* ---------- Profile page ---------- */
.profile { padding-bottom: 24px; }
.gallery { position: relative; background: var(--surface-2); height: min(62vh, 540px); min-height: 400px; overflow: hidden; }
@media (min-width: 769px) { .gallery { height: min(72vh, 620px); min-height: 420px; } }
.gallery-track img { cursor: zoom-in; }
@media (min-width: 769px) { .gallery { border-radius: var(--radius); } }
.gallery-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.gallery-top { position: absolute; top: calc(var(--safe-t) + 10px); left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.gallery-top > * { pointer-events: auto; }
.gallery-top > .placeholder { display: none; }
.gallery-count { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.gallery-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 110px 16px 14px; color: #fff; background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 30%, rgba(0,0,0,.45) 62%, rgba(0,0,0,0) 100%); pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.gallery-info h1 { margin: 0 0 2px; font-size: 1.9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #fff; }
.gallery-sub, .gallery-status { margin: 0; opacity: .95; }
.gallery-status.is-online { color: #4ADE80; }
.profile-actions { display: flex; gap: 12px; padding: 16px; }
.gallery-info .profile-actions { padding: 14px 0 0; pointer-events: auto; text-shadow: none; }
.profile .card { margin: 0 16px 16px; }
.about .bio { white-space: normal; color: var(--text); }
.facts { margin: 12px 0 0; display: grid; gap: 10px; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.facts dt { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.facts dd { margin: 0; text-align: right; }

/* ---------- Matches / lists ---------- */
.match-list { display: grid; gap: 10px; }
.match-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; color: var(--text); text-decoration: none; }
.match-row:hover { text-decoration: none; background: var(--surface-2); }
.match-row .avatar { width: 56px; height: 56px; }
.match-row .grow { flex: 1; min-width: 0; }
.match-row strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.match-row .row-actions { display: flex; gap: 6px; }
.row-link, .row-link:hover { color: inherit; text-decoration: none; }
.profile-card .sub, .profile-card .name { display: block; }
.profile-card .name { display: flex; }
.fresh-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--like); flex: none; }

/* ---------- Chats ---------- */
.chats { display: grid; grid-template-columns: 1fr; min-height: calc(100dvh - var(--nav-h) - var(--safe-b)); }
.chat-list-pane { padding: calc(var(--safe-t) + 14px) 16px 16px; }
.chat-pane { display: none; flex-direction: column; min-width: 0; height: calc(100dvh - var(--nav-h) - var(--safe-b)); background: var(--bg); }
.chats[data-has-active="1"] .chat-list-pane { display: none; }
.chats[data-has-active="1"] .chat-pane { display: flex; }
.chat-list { display: flex; flex-direction: column; gap: 4px; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 16px; color: var(--text); text-decoration: none; }
.chat-item:hover, .chat-item.active { background: var(--surface-2); text-decoration: none; }
.chat-item .avatar { width: 54px; height: 54px; }
.chat-item .avatar-wrap { position: relative; flex: none; }
.chat-item .avatar-wrap .dot-online { position: absolute; right: 0; bottom: 2px; margin: 0; }
.chat-item .grow { flex: 1; min-width: 0; }
.chat-item .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-item .top strong { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-item .top strong > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item time { color: var(--muted); font-size: .75rem; flex: none; }
.chat-item .last { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.chat-item.unread .last { color: var(--text); font-weight: 600; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 8px) 10px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-peer { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.chat-peer:hover { text-decoration: none; }
.chat-peer-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.chat-peer-text strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bot-strip { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: color-mix(in srgb, #3B4BCB 22%, var(--surface)); border-bottom: 1px solid var(--border); font-size: .85rem; font-weight: 600; }
.messages { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.bubble { max-width: min(82%, 520px); padding: 9px 14px; border-radius: 20px; background: var(--surface-2); color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 20px; border-bottom-right-radius: 6px; }
.bubble.failed { background: color-mix(in srgb, #C0262D 70%, var(--surface)); }
.bubble .meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: .7rem; opacity: .8; margin-top: 2px; white-space: normal; }
.bubble .meta .ico { width: 15px; height: 15px; }
.bubble .meta .read { color: #BFE9FF; opacity: 1; }
.day-sep { align-self: center; color: var(--muted); font-size: .75rem; margin: 8px 0; }
.composer-area { padding: 8px 10px calc(var(--safe-b) * 0 + 10px); border-top: 1px solid var(--border); background: var(--surface); }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 44px; max-height: 140px; border-radius: 22px; padding: 10px 16px; resize: none; flex: 1; }
.composer .send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.composer .send[disabled] { opacity: .5; }
.limit-note { font-size: .78rem; color: var(--muted); padding: 0 6px 6px; }
.strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 16px; background: var(--notice-bg); border: 1px solid var(--border); font-weight: 600; }
.chat-placeholder { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
@media (min-width: 769px) {
  .chats { grid-template-columns: 340px 1fr; min-height: 100vh; border-left: 0; }
  .chat-list-pane { border-right: 1px solid var(--border); height: 100vh; height: 100dvh; overflow-y: auto; padding-top: 26px; }
  .chat-pane, .chats[data-has-active="1"] .chat-pane { display: flex; height: 100vh; height: 100dvh; }
  .chats[data-has-active="1"] .chat-list-pane { display: block; }
  .chat-back { display: none; }
  .composer-area { padding-bottom: 12px; }
}

/* ---------- Sheets, modals, toasts ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .2s ease; }
.sheet-panel { position: relative; width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; padding: 24px 20px calc(20px + var(--safe-b)); animation: rise .25s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow); }
.sheet-panel h2 { margin-bottom: 8px; }
.sheet-panel .btn-block { margin-top: 10px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.radio-list { margin-bottom: 8px; }
@media (min-width: 769px) { .sheet { align-items: center; } .sheet-panel { border-radius: 28px; padding-bottom: 24px; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.75); animation: fade .2s ease; }
.match-modal { text-align: center; max-width: 420px; width: 100%; background: var(--surface); border-radius: 32px; padding: 32px 24px; animation: pop .35s cubic-bezier(.2,1.3,.4,1); }
.match-modal h2 { font-size: 2rem; color: var(--accent-text); }
.match-photos { display: flex; justify-content: center; margin: 22px 0; }
.match-photos img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.match-photos img + img { margin-left: -24px; }
.match-modal .btn { margin-top: 8px; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; z-index: 100; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
body.bare .toasts, .admin-body .toasts { bottom: calc(var(--safe-b) + 16px); }
.toast { pointer-events: auto; max-width: 440px; padding: 12px 18px; border-radius: 16px; background: #26262E; color: #fff; box-shadow: var(--shadow); font-weight: 600; animation: rise .25s ease; }
.toast.error { background: #B3202A; }
.toast.ok { background: #15803D; }
@media (min-width: 769px) { .toasts { bottom: 24px; left: var(--sidebar-w); } body.bare .toasts { left: 0; } }

.cookie-bar { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); font-size: .82rem; }
body.bare .cookie-bar { bottom: calc(var(--safe-b) + 10px); }
@media (min-width: 769px) { .cookie-bar { left: calc(var(--sidebar-w) + 16px); max-width: 560px; bottom: 16px; } body.bare .cookie-bar { left: 16px; } }
.noscript { padding: 12px; text-align: center; background: #B3202A; color: #fff; }

/* ---------- Welcome ---------- */
body.bare .main { max-width: none; padding: 0; }
body.bare .main-onboarding { max-width: 560px; padding: calc(var(--safe-t) + 14px) 18px 24px; }
.welcome { min-height: 100dvh; display: flex; flex-direction: column; justify-content: space-between; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 20px); background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%), var(--bg); position: relative; }
.welcome-hero { margin: auto; text-align: center; max-width: 440px; }
.brand-title { font-size: clamp(2.6rem, 11vw, 4rem); margin: 0 0 10px; letter-spacing: -.02em; }
.welcome-logo { max-height: 90px; margin: 0 auto 14px; width: auto; }
.lead { font-size: 1.15rem; color: var(--muted); }
.welcome-actions { width: 100%; max-width: 400px; margin: 0 auto; display: grid; gap: 12px; }
.welcome-foot { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: center; margin-top: 22px; color: var(--muted); font-size: .85rem; }
.welcome-foot a { color: var(--muted); }
.theme-fab { position: absolute; top: calc(var(--safe-t) + 14px); right: 14px; background: var(--surface); border: 1px solid var(--border); }
.theme-fab .ico-dark { display: none; }
:root[data-theme="dark"] .theme-fab .ico-light { display: none; }
:root[data-theme="dark"] .theme-fab .ico-dark { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .theme-fab .ico-light { display: none; }
  :root[data-theme="system"] .theme-fab .ico-dark { display: inline-flex; }
}
.age-note { border: 1px solid var(--border); border-radius: 999px; padding: 0 10px; }

/* ---------- Onboarding ---------- */
.ob { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.ob-top { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; width: 0; }
.ob-count { color: var(--muted); font-size: .8rem; width: 40px; text-align: right; }
.ob-body { flex: 1; padding: 28px 2px 110px; }
.ob-title { font-size: clamp(1.9rem, 7vw, 2.4rem); margin-bottom: 8px; }
.ob-help { margin-bottom: 18px; }
.fab-next { position: fixed; right: max(20px, calc(50% - 280px + 20px)); bottom: calc(var(--safe-b) + 22px); width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); transition: transform .15s, background .2s; }
.fab-next .ico { width: 28px; height: 28px; }
.ob-skip { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-b) + 34px); display: flex; justify-content: center; gap: 18px; padding-right: 88px; }
.fab-next:active { transform: scale(.92); }
.fab-next[disabled] { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.ob-done .done-badge { width: 110px; height: 110px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; animation: pop .5s cubic-bezier(.2,1.3,.4,1); }
.ob-done { min-height: 100dvh; justify-content: center; }
.notice-page { min-height: 70vh; justify-content: center; }
.loc-box { display: grid; gap: 12px; margin: 18px 0; }
.loc-status { display: flex; align-items: center; gap: 10px; padding: 16px; border: 2px dashed var(--border); border-radius: 18px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.photo-tile { position: relative; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--muted); border: 2px dashed var(--border); font-size: .8rem; text-align: center; }
.photo-tile.dragging { opacity: .4; }
.photo-tile.drag-over { outline: 3px solid var(--accent-text); }
.tile-del { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tile-del .ico { width: 16px; height: 16px; }
.tile-main { position: absolute; left: 6px; right: 6px; bottom: 6px; border: 0; border-radius: 999px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; font-weight: 700; padding: 5px 4px; }
.tile-badge { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 2px 8px; }
.tile-pending { background: #B7791F; top: auto; bottom: 6px; left: 6px; }
.tile-rejected { background: #B3202A; top: auto; bottom: 6px; left: 6px; }

/* ---------- Me / Gold ---------- */
.me-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.me-card-text { flex: 1; min-width: 160px; }
.me-card-text h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.gold-hero { text-align: center; padding: 20px 8px; }
.gold-star { color: #F5C542; }
.gold-star .ico { fill: #F5C542; }
.perks { list-style: none; padding: 0; margin: 14px auto 0; display: inline-grid; gap: 8px; text-align: left; }
.perks li { display: flex; align-items: center; gap: 10px; }
.perks .ico { color: #22C55E; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 18px 0; }
.plan { text-align: center; }
.plan-price { font-family: var(--serif); font-size: 2rem; font-weight: 700; margin: 6px 0; }
.btn-row .btn .ico-sm { margin-right: 2px; }

/* ---------- Admin (shared tokens; layout in admin.css) ---------- */
.admin-body { background: var(--bg); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .skeleton { animation: none; }
}
body[data-active="chats"] .cookie-bar { display: none; }

/* ---------- Ads (clearly labelled, never overlapping controls) ---------- */
.ad { display: block; margin: 0 0 16px; text-align: center; overflow: hidden; }
.ad-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.ad ins.adsbygoogle { display: block; min-height: 50px; }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
/* In-feed ad: its own full row between profile cards, clearly labelled, shown at the size Google serves (no scaling, no clipping). */
.ad-grid { grid-column: 1 / -1; margin: 12px 0; padding: 4px 0; overflow: visible; }
.ad-profile, .ad-profile_top, .ad-profile_bottom { margin: 0 16px 16px; padding: 10px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.ad-profile .ad-label, .ad-profile_top .ad-label, .ad-profile_bottom .ad-label { text-align: left; margin-bottom: 8px; }
.ad-profile ins.adsbygoogle, .ad-profile_top ins.adsbygoogle, .ad-profile_bottom ins.adsbygoogle { min-height: 100px; border-radius: 10px; overflow: hidden; }
.ad-bottom { margin-top: 16px; }

/* Photo lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.92); }
.lightbox[hidden] { display: none; }
.lightbox { touch-action: none; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 8px; }
.lightbox-btn { position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lightbox-btn:hover { background: rgba(255,255,255,.28); }
.lightbox-close { top: 20px; right: 24px; }
.lightbox-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox img { max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); }
.lightbox-actions { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 44px); display: flex; gap: 12px; padding: 0 16px; max-width: 520px; margin: 0 auto; }
.lightbox-count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 700; }

/* Similar profiles under a profile */
.similar { margin: 8px 16px 16px; }
.similar h2 { margin: 0 0 12px; font-size: 1.1rem; }
@media (min-width: 769px) { .similar-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }

/* Google "Auto ads" are injected outside our placements; only the placements set in the admin panel may show ads. */
.google-auto-placed, ins.adsbygoogle[data-anchor-status], body > ins.adsbygoogle:not([data-ad-slot]) { display: none !important; }
