/* ============================================================
   MASQUEPLAY DESIGN SYSTEM — CSS CUSTOM PROPERTIES
   ============================================================ */

:root {
  --app-height: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-nav-height: calc(64px + var(--safe-bottom));
  --app-shell-max-width: 480px;

  /* --- Backgrounds --- */
  --bg-base:      #0c0a10;
  --bg-surface:   #141018;
  --bg-card:      #1c1724;
  --bg-hover:     #241e2e;
  --bg-overlay:   rgba(12, 10, 16, 0.86);

  /* --- Borders --- */
  --border:       #2c2438;
  --border-strong:#44364e;
  --border-focus: var(--rose);

  /* --- Rose — Primary accent (CTA, hearts, active) --- */
  --rose:         #e8407a;
  --rose-hover:   #f55590;
  --rose-dim:     rgba(232, 64, 122, 0.15);
  --rose-glow:    rgba(232, 64, 122, 0.32);

  /* --- Gold — Premium, matches, masquerade luxury --- */
  --gold:         #f0b440;
  --gold-hover:   #f8c85a;
  --gold-dim:     rgba(240, 180, 64, 0.14);
  --gold-glow:    rgba(240, 180, 64, 0.28);

  /* --- Violet — Secondary UI, gradients, aurora --- */
  --violet:       #9b6dff;
  --violet-hover: #b08aff;
  --violet-dim:   rgba(155, 109, 255, 0.14);
  --violet-glow:  rgba(155, 109, 255, 0.28);

  /* --- Text hierarchy (warm-tinted whites) --- */
  --text-primary:   #f2eaf8;
  --text-secondary: #b8a8cc;
  --text-muted:     #7a6a8e;

  /* --- Semantic --- */
  --green:      #2ed8a8;
  --green-dim:  rgba(46, 216, 168, 0.14);
  --red:        #f87171;
  --red-dim:    rgba(248, 113, 113, 0.14);
  --yellow:     #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.14);

  /* --- Typography --- */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui:      'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* --- Type scale --- */
  --text-xs:   0.72rem;
  --text-sm:   0.82rem;
  --text-base: 0.94rem;
  --text-md:   1.05rem;
  --text-lg:   1.2rem;
  --text-xl:   1.5rem;
  --text-2xl:  2rem;
  --text-3xl:  2.8rem;
  --text-4xl:  3.8rem;

  /* --- Spacing --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

  /* --- Radius --- */
  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   24px;
  --radius-xl:   32px;
  --radius-full: 999px;

  /* --- Shadows --- */
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.28);
  --shadow:      0 8px 32px rgba(0,0,0,0.42);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.56);
  --shadow-rose: 0 8px 32px var(--rose-glow);
  --shadow-gold: 0 8px 32px var(--gold-glow);

  /* --- Transitions --- */
  --transition-fast: 0.14s ease;
  --transition:      0.22s ease;
  --transition-slow: 0.38s ease;

  /* --- Gradients --- */
  --gradient-rose:          linear-gradient(135deg, #e8407a, #c0207a);
  --gradient-rose-gold:     linear-gradient(135deg, #e8407a, #f0b440);
  --gradient-violet:        linear-gradient(135deg, #9b6dff, #e8407a);
  --gradient-aurora:        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(155,109,255,0.22), transparent 60%),
                            radial-gradient(ellipse 60% 40% at 80% 76%, rgba(232,64,122,0.18), transparent 55%);
  --gradient-photo-overlay: linear-gradient(to bottom, transparent 35%, rgba(12,10,16,0.72) 65%, rgba(12,10,16,0.96) 100%);
}

@supports (height: 100svh) {
  :root {
    --app-height: 100svh;
  }
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-base);
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text-primary);
  /* Match app background so iOS safe-area bleed-through is invisible */
  background: var(--bg-base);
  min-height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

#app,
#app * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#app input,
#app textarea,
#app select,
#app option,
#app [contenteditable="true"],
#app [contenteditable="plaintext-only"] {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

/* ============================================================
   APP SHELL
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: var(--app-shell-max-width);
  height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  /* Own background so aurora gradient doesn't leak outside #app */
  background: var(--bg-base);
  background-image: var(--gradient-aurora);
}

@media all and (display-mode: standalone) {
  :root {
    --app-height: 100vh;
  }

  html,
  body {
    height: 100vh;
    min-height: 100vh;
  }

  #app {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    max-width: var(--app-shell-max-width);
    margin: 0 auto;
  }

  #app.app--nav-visible #screen-container {
    padding-bottom: var(--bottom-nav-height);
  }
}

/* ============================================================
   SCREENS
   ============================================================ */

#screen-container {
  flex: 1;
  min-height: 0; /* prevents flex child from overflowing parent on iOS */
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Auth + onboarding screens scroll their own content */
.screen {
  display: none;
}

.screen.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Auth + onboarding screens scroll internally */
.auth-screen,
.onboarding-screen {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.screen-header {
  padding: calc(var(--space-6) + var(--safe-top)) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.screen-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.1;
}

.screen-body {
  padding: var(--space-6);
}

.placeholder-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   3. BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  transition: transform var(--transition-fast), background var(--transition-fast),
              border-color var(--transition-fast), box-shadow var(--transition-fast),
              opacity var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-sm  { height: 34px; padding: 0 var(--space-4); font-size: var(--text-xs); }
.btn-md  { height: 44px; padding: 0 var(--space-5); font-size: var(--text-sm); }
.btn-lg  { height: 54px; padding: 0 var(--space-8); font-size: var(--text-base); }

.btn-primary {
  background: var(--gradient-rose);
  color: #fff;
  box-shadow: var(--shadow-rose);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--rose-hover), #d030a0);
  box-shadow: 0 12px 40px var(--rose-glow);
}

.btn-gold {
  background: var(--gold);
  color: #1a0e0a;
  box-shadow: var(--shadow-gold);
  font-weight: 700;
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-hover);
  box-shadow: 0 12px 40px var(--gold-glow);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,0.24); }

.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-full); font-size: 1.2rem; }
.btn-icon.btn-sm { width: 34px; height: 34px; font-size: 1rem; }
.btn-icon.btn-lg { width: 56px; height: 56px; font-size: 1.5rem; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}

/* ============================================================
   4. PERSONA SWIPE CARD
   ============================================================ */

.swipe-card {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  user-select: none;
}

.swipe-card-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155,109,255,0.3), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(232,64,122,0.25), transparent 50%),
    linear-gradient(160deg, #1e1030 0%, #2a1040 40%, #1a0828 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mask-placeholder {
  font-size: 5rem;
  opacity: 0.55;
  filter: drop-shadow(0 0 24px rgba(232,64,122,0.4));
}

.swipe-card-overlay {
  position: absolute;
  inset: 0;
  background: var(--gradient-photo-overlay);
}

.swipe-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-5);
}

.swipe-card-name {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.01em;
}

.swipe-card-age {
  display: inline-block;
  margin-left: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: 300;
  color: rgba(255,255,255,0.75);
}

.swipe-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.swipe-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-surface);
}

.swipe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.5rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow);
}

.swipe-btn:hover { transform: scale(1.12); }

.swipe-btn-pass {
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-muted);
}
.swipe-btn-pass:hover { border-color: var(--red); color: var(--red); }

.swipe-btn-like {
  background: var(--gradient-rose);
  color: #fff;
  box-shadow: var(--shadow-rose);
  width: 70px;
  height: 70px;
  font-size: 1.8rem;
}
.swipe-btn-like:hover { box-shadow: 0 12px 40px var(--rose-glow); }

.swipe-btn-super {
  background: var(--gold-dim);
  border: 2px solid var(--gold);
  color: var(--gold);
}
.swipe-btn-super:hover { background: var(--gold-dim); box-shadow: var(--shadow-gold); }

.swipe-indicator {
  position: absolute;
  top: var(--space-6);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.swipe-indicator-like {
  left: var(--space-5);
  border: 3px solid var(--rose);
  color: var(--rose);
  transform: rotate(-12deg);
}

.swipe-indicator-pass {
  right: var(--space-5);
  border: 3px solid var(--text-muted);
  color: var(--text-muted);
  transform: rotate(12deg);
}

/* ── Match overlay ──────────────────────────────────────── */
.match-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.match-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.match-overlay-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: match-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes match-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.match-overlay-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}
.match-overlay-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

.match-logo {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto var(--space-3);
  filter: drop-shadow(0 0 12px rgba(232, 64, 122, 0.3));
}

.match-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 var(--space-2);
}

.match-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-5);
  line-height: 1.4;
}

.match-personas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.match-persona {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.match-persona-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--rose);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.match-persona-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-persona-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.match-persona-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.match-heart {
  font-size: 1.5rem;
  color: var(--rose);
  flex-shrink: 0;
}

.match-play-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
}

/* ============================================================
   5. CHIPS / TAGS
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.chip:hover { border-color: var(--rose); color: var(--text-primary); }

.chip.active {
  border-color: var(--rose);
  background: var(--rose-dim);
  color: var(--rose);
}

.chip-removable .chip-x { font-size: 0.9em; opacity: 0.6; cursor: pointer; margin-left: 2px; }
.chip-removable .chip-x:hover { opacity: 1; }

.chip-on-photo {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
}

/* ============================================================
   6. BOTTOM NAVIGATION
   ============================================================ */

.bottom-nav {
  display: flex;
  align-items: center;
  background: rgba(12, 10, 16, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 0 var(--space-4) 4px;
  flex-shrink: 0;
}

@media all and (display-mode: standalone) {
  .bottom-nav {
    position: fixed;
    left: 50%;
    bottom: env(safe-area-inset-bottom, 0px);
    width: min(100vw, var(--app-shell-max-width));
    max-width: var(--app-shell-max-width);
    transform: translateX(-50%);
    z-index: 3;
  }
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.nav-icon svg {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-item:hover .nav-icon { transform: translateY(-2px); }
.nav-item.active { color: var(--rose); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 8px var(--rose-glow)); }

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--rose);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* ============================================================
   7. MATCH CELEBRATION
   ============================================================ */

.match-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.match-burst {
  position: relative;
  padding: var(--space-10) var(--space-6) var(--space-8);
  background:
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(232,64,122,0.38) 0%, rgba(155,109,255,0.2) 50%, transparent 80%),
    var(--bg-surface);
  overflow: hidden;
}

.match-burst::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(240,180,64,0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(232,64,122,0.12), transparent 40%);
}

.match-eyebrow {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--rose);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.match-title {
  position: relative;
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 600;
  font-style: italic;
  background: var(--gradient-rose-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-6);
}

.match-avatars {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.match-avatar {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  border: 3px solid var(--rose);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155,109,255,0.4), transparent 60%),
    linear-gradient(160deg, #1e1030, #2a1040);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 0 0 4px var(--rose-dim), var(--shadow-rose);
}

.match-heart {
  font-size: 1.6rem;
  animation: heartbeat 1.2s ease infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  30%       { transform: scale(1.3); }
  60%       { transform: scale(1.1); }
}

.match-body { padding: var(--space-5) var(--space-6); }

.match-names {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.match-names strong { color: var(--text-primary); font-weight: 600; }

.match-actions { display: flex; flex-direction: column; gap: var(--space-3); }

/* ============================================================
   8. CHAT LIST ITEM
   ============================================================ */

.chat-list {
  display: flex;
  flex-direction: column;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  border: 0;
}

#screen-chats .screen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--space-6) var(--space-6);
}

.chats-archive-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
  width: 100%;
  margin-top: var(--space-5);
  padding-top: var(--space-2);
}

.chats-archive-section::before {
  content: '';
  position: absolute;
  top: calc(var(--space-2) + 20px);
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.chats-archive-toggle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-self: center;
  min-width: 184px;
  min-height: 40px;
  padding: 0 var(--space-4);
  margin: 0 auto;
  border-radius: var(--radius-full);
  border-color: var(--border-strong);
  background: rgba(28, 23, 36, 0.78);
  box-shadow: var(--shadow-sm);
  justify-content: center;
}

.chats-archive-toggle:hover:not(:disabled) {
  background: rgba(36, 30, 46, 0.92);
}

.chats-archive-toggle[aria-expanded="true"] {
  background: var(--rose-dim);
  border-color: var(--rose);
  color: var(--rose);
  box-shadow: 0 0 0 1px rgba(232, 64, 122, 0.18);
}

.chats-archive-toggle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.chats-archive-toggle[aria-expanded="true"] .chats-archive-toggle-icon {
  transform: rotate(180deg);
}

.chats-archive-list {
  width: 100%;
  margin-top: 0;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.chat-item:last-child { border-bottom: 0; }
.chat-item:hover { background: transparent; }

.chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155,109,255,0.35), transparent 60%),
    linear-gradient(160deg, #200e36, #2a1040);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  position: relative;
}

.chat-avatar-online::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--green);
  border: 2px solid var(--bg-surface);
}

.chat-info { flex: 1; min-width: 0; }

.chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 3px;
}

.chat-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.chat-preview {
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview.unread { color: var(--text-secondary); font-weight: 500; }

.chat-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-unread-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--rose);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   9. INPUT FIELDS
   ============================================================ */

.field-group { display: flex; flex-direction: column; gap: var(--space-2); }

.field-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }

.field-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  outline: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.field-input::placeholder { color: var(--text-muted); }

.field-input:focus {
  border-color: var(--rose);
  background: rgba(28, 23, 36, 0.95);
  box-shadow: 0 0 0 3px var(--rose-dim);
}

.field-input.error { border-color: var(--red); }
.field-input.error:focus { box-shadow: 0 0 0 3px var(--red-dim); }

.field-helper { font-size: var(--text-xs); color: var(--text-muted); }
.field-helper.error { color: var(--red); }
.field-helper.valid { color: var(--green); }

select.field-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6a8e' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
  padding-right: 36px;
}

/* ============================================================
   10. CONVERSATION SCREEN
   ============================================================ */

#screen-conversation {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-base);
}

@media all and (display-mode: standalone) {
  #screen-conversation {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    width: min(100vw, var(--app-shell-max-width));
    max-width: var(--app-shell-max-width);
    transform: translateX(-50%);
  }
}

#screen-conversation.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  will-change: height;
  overscroll-behavior: none;
  touch-action: none;
}

/* ── Dual avatar layout in chat list ─────────────────────── */
.chat-avatars {
  position: relative;
  width: 64px;
  height: 52px;
  flex-shrink: 0;
}

.chat-avatar--back {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
  overflow: hidden;
}

.chat-avatar--front {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
  overflow: hidden;
}

.chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Conversation header ─────────────────────────────────── */
.conversation-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  flex-shrink: 0;
  touch-action: manipulation;
}

.conversation-back-btn {
  flex-shrink: 0;
  background: rgba(28, 23, 36, 0.92);
  border-color: var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.conversation-back-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.conversation-personas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  overflow: hidden;
}

.conversation-persona-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.conversation-profile-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: rgba(28, 23, 36, 0.92);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex-shrink: 0;
  overflow: visible;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.conversation-profile-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.conversation-profile-btn:active {
  transform: scale(0.97);
}

.conversation-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155,109,255,0.35), transparent 60%),
    linear-gradient(160deg, #200e36, #2a1040);
}

.conversation-profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-persona-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

.conversation-divider {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: var(--text-sm);
}

.partner-online-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--green);
  flex-shrink: 0;
}

.conversation-profile-btn--partner .partner-online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  border: 2px solid var(--bg-surface);
}

/* ── Message list ────────────────────────────────────────── */
.conversation-messages {
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
  padding-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.conversation-footer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
  background: rgba(12, 10, 16, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  touch-action: manipulation;
  padding-bottom: var(--safe-bottom);
}

@media all and (display-mode: standalone) {
  #app.app--keyboard-open .conversation-footer {
    padding-bottom: 0;
  }
}

.conversation-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: auto;
  padding: var(--space-6);
}

/* ── Message bubbles ─────────────────────────────────────── */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.msg-row--mine  { align-self: flex-end;   align-items: flex-end; }
.msg-row--theirs { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-base);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row--mine .msg-bubble {
  background: var(--rose);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-row--theirs .msg-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
}

/* ── Typing indicator ────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  min-height: 28px;
}

.conversation-send-error {
  margin: 0 var(--space-4);
}

.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.typing-dots span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input bar ───────────────────────────────────────────── */
.conversation-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  flex-shrink: 0;
}

.conversation-input {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: 22px;
  min-height: 44px;
  max-height: none;
  line-height: 1.45;
  resize: none;
  overflow-y: hidden;
  white-space: pre-wrap;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.conversation-input::-webkit-scrollbar {
  width: 8px;
}

.conversation-send-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full) !important;
  flex-shrink: 0;
}

.conversation-send-btn svg,
.conversation-back-btn svg {
  width: 20px;
  height: 20px;
}

/* ── AI icebreaker button ────────────────────────────────── */
.conversation-icebreaker-btn {
  align-self: center;
  margin: var(--space-4) auto;
  gap: var(--space-2);
  background: linear-gradient(135deg, var(--violet), var(--rose));
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  cursor: pointer;
}
.conversation-icebreaker-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.conversation-ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.conversation-icebreaker-btn .conversation-ai-icon svg {
  width: 18px;
  height: 18px;
}

/* ── AI rewrite button (in input bar) ────────────────────── */
.conversation-rewrite-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
  padding: 0;
}
.conversation-rewrite-btn:hover { background: var(--bg-hover); }
.conversation-rewrite-btn:disabled { opacity: 0.5; cursor: wait; }
.conversation-rewrite-btn .conversation-ai-icon svg { width: 20px; height: 20px; }

/* ── AI badge on message bubbles ─────────────────────────── */
.msg-ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--violet);
  border: 1px solid rgba(155, 109, 255, 0.42);
  border-radius: var(--radius-full);
  background: var(--violet-dim);
  margin-left: var(--space-2);
  vertical-align: middle;
  opacity: 0.95;
}
.msg-ai-badge svg { width: 11px; height: 11px; }
.msg-row--mine .msg-ai-badge {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ============================================================
   11. TOAST / NOTIFICATION
   ============================================================ */

.toast-stack { display: flex; flex-direction: column; gap: var(--space-3); }

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(20, 16, 24, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 360px;
}

.toast-icon { font-size: 1.1rem; line-height: 1.4; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-title { font-weight: 600; font-size: var(--text-sm); }
.toast-body  { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

.toast.success { border-color: rgba(46,216,168,0.3); }
.toast.success .toast-title { color: var(--green); }

.toast.match {
  border-color: var(--rose-glow);
  background: linear-gradient(135deg, rgba(232,64,122,0.12), rgba(20,16,24,0.96));
}
.toast.match .toast-title { color: var(--rose); }

.toast.warning { border-color: rgba(251,191,36,0.3); }
.toast.warning .toast-title { color: var(--yellow); }

/* ============================================================
   11. MASK AVATAR
   ============================================================ */

.mask-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155,109,255,0.4), transparent 60%),
    linear-gradient(160deg, #1e1030, #2a1040);
  color: rgba(255,255,255,0.6);
  font-size: 1.4rem;
  border: 1.5px solid var(--border);
}

.mask-avatar-xl { width: 96px; height: 96px; font-size: 2.6rem; }
.mask-avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }
.mask-avatar-md { width: 52px; height: 52px; font-size: 1.3rem; }
.mask-avatar-sm { width: 36px; height: 36px; font-size: 0.9rem; }

.mask-avatar.loading { animation: shimmer 1.8s ease-in-out infinite; }

@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ============================================================
   12. AUTH SCREENS (Login / Signup)
   ============================================================ */

.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: calc(var(--space-6) + var(--safe-top)) var(--space-6) var(--space-6);
  gap: var(--space-8);
}

.auth-logo {
  text-align: center;
}

.auth-logo-img {
  width: 150px;
  height: auto;
  display: block;
  margin: 0 auto var(--space-3);
  filter: drop-shadow(0 0 18px rgba(232, 64, 122, 0.28));
}

.auth-logo-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 500;
  font-style: italic;
  background: var(--gradient-rose-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: var(--space-1);
}

.auth-logo-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.auth-card-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-submit {
  width: 100%;
  margin-top: var(--space-2);
}

.auth-error {
  font-size: var(--text-sm);
  color: var(--red);
  background: var(--red-dim);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.auth-switch {
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--rose);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link:hover { color: var(--rose-hover); }

/* ============================================================
   13. ONBOARDING SCREENS (Couple pairing + Preferences)
   ============================================================ */

.onboarding-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: calc(var(--space-10) + var(--safe-top)) var(--space-6) var(--space-8);
  gap: var(--space-8);
}

.onboarding-header {
  text-align: center;
}

.onboarding-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.onboarding-logo {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 auto var(--space-4);
}

#screen-couple-choice .onboarding-screen {
  justify-content: center;
}

#screen-couple-choice .onboarding-actions {
  margin-top: var(--space-8);
}

.onboarding-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  line-height: 1.2;
}

.onboarding-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
}

.onboarding-btn {
  width: 100%;
}

/* ── Invite code display ── */

.invite-code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
}

.invite-code-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.invite-code-display {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.18em;
  background: var(--rose-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-6);
}

.invite-share-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.invite-share-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Input that displays like the invite code */
.invite-code-input {
  font-family: var(--font-mono) !important;
  font-size: var(--text-xl) !important;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

/* ── Seeking screen (Preferences) ── */

.prefs-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.prefs-section-label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Gender symbol buttons ── */

.sex-symbol-row {
  display: flex;
  gap: var(--space-5);
  justify-content: center;
  padding: var(--space-2) 0;
}

.sex-symbol-btn {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.sex-symbol-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.sex-symbol-btn.active {
  color: var(--rose);
  border-color: var(--rose);
  background: var(--rose-dim);
  box-shadow: 0 0 0 3px rgba(232, 64, 122, 0.18), 0 0 24px rgba(232, 64, 122, 0.22);
}

.sex-symbol-svg {
  width: 58px;
  height: 58px;
}

/* ── Age range slider ── */

/*
 * Vertical zones (top → bottom):
 *   0–22px  : age value labels (only min/max ticks visible)
 *  22–36px  : tick marks (above the track)
 *  54px     : track centre-line
 *  container: 88px total (leaves 17px below track for thumb overflow)
 */
.age-slider-outer {
  position: relative;
  height: 88px;
  margin-top: var(--space-3);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.age-track-bg,
.age-track-fill {
  position: absolute;
  top: 54px;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
}
.age-track-bg  { left: 0; right: 0; background: var(--border-strong); }
.age-track-fill {
  left: 0;            /* overridden by JS */
  right: auto;
  background: var(--gradient-rose);
}

/* Round draggable thumbs */
.age-thumb {
  position: absolute;
  top: 54px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rose);
  border: 3px solid var(--bg-base);
  box-shadow: 0 0 0 4px rgba(232, 64, 122, 0.25), var(--shadow-rose);
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 3;
  touch-action: none;
  transition: box-shadow var(--transition-fast);
  outline: none;
}
.age-thumb:focus-visible {
  box-shadow: 0 0 0 6px rgba(232, 64, 122, 0.38), var(--shadow-rose);
}
.age-thumb:active { cursor: grabbing; }

/* Tick elements — positioned in the upper portion of the container */
.age-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Age value labels — large, at very top */
.age-tick-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--rose);
  white-space: nowrap;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

/* Tick marks — above the track */
.age-tick-mark {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 8px;
  background: var(--border-strong);
  border-radius: 1px;
  transition: background var(--transition-fast);
}
.age-tick-mark.in-range {
  background: var(--rose);
  opacity: 0.55;
}

/* ============================================================
   14. PERSONAS SCREEN
   ============================================================ */

/* ── Header ── */
.personas-header {
  padding: calc(var(--space-5) + var(--safe-top)) var(--space-6) var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.personas-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.personas-header-sub {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.personas-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.selection-counter {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  color: var(--rose);
  font-weight: 500;
}

.reset-timer {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.backlog-badge {
  font-size: var(--text-xs);
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-family: var(--font-ui);
}

/* ── Scroll area ── */
.personas-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4) 0;
  -webkit-overflow-scrolling: touch;
}

/* ── Loading state ── */
.pool-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
}

.pool-loading-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

/* ── Persona card grid ── */
.persona-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding-bottom: var(--space-8);
}

.persona-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
  border: 2px solid transparent;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  aspect-ratio: 3 / 4;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.persona-card:active {
  transform: scale(0.97);
}

.persona-card--selected {
  border-color: var(--rose);
  box-shadow: 0 0 0 1px var(--rose-glow);
}

.persona-card--locked {
  cursor: default;
}

.persona-card__image {
  position: absolute;
  inset: 0;
  background: var(--bg-hover); /* replaced by gradient/image */
}

.persona-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.persona-card__overlay {
  position: absolute;
  inset: 0;
  background: var(--gradient-photo-overlay);
  pointer-events: none;
}

.persona-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3);
}

.persona-card__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 2px;
}

.persona-card__tagline {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.persona-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.persona-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  line-height: 1.6;
}

/* Selection / rank badge */
.persona-card__badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.persona-card__badge--rank {
  background: var(--rose);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Backlog badge */
.persona-card__backlog-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  background: rgba(12,10,16,0.72);
  border: 1px solid var(--gold);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  z-index: 2;
}

/* ── Lock-in bar ── */
.lock-in-bar {
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-in-btn {
  width: 100%;
  max-width: 360px;
}

.lock-in-bar--locked {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.lock-in-status {
  font-size: var(--text-sm);
  color: var(--green);
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ============================================================
   15. DISCOVER SCREEN — card stack
   ============================================================ */

.discover-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(var(--space-5) + var(--safe-top)) var(--space-6) var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.discover-counter {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Body fills remaining height */
.discover-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Card stack ── */
.card-stack {
  flex: 1;
  position: relative;
  padding: var(--space-4) var(--space-4) 0;
  overflow: hidden;
}

/* Each card is absolutely stacked; depth class set by JS */
.card-stack-item {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  transition: transform var(--transition), opacity var(--transition);
  transform-origin: top center;
  touch-action: none;
}

.card-stack-item.depth-0 {
  transform: translateY(0) scale(1);
  z-index: 10;
  opacity: 1;
}

.card-stack-item.depth-1 {
  transform: translateY(10px) scale(0.96);
  z-index: 9;
  opacity: 0.85;
}

.card-stack-item.depth-2 {
  transform: translateY(18px) scale(0.92);
  z-index: 8;
  opacity: 0.6;
}

/* Dismissal animations triggered by JS */
.card-stack-item.dismiss-left {
  transform: translateX(-120%) rotate(-18deg) !important;
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.card-stack-item.dismiss-right {
  transform: translateX(120%) rotate(18deg) !important;
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

/* Swipe card fills the stack item fully */
.card-stack-item .swipe-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Photo stretches to fill available height instead of using aspect-ratio */
.card-stack-item .swipe-card-photo {
  aspect-ratio: unset;
  flex: 1;
}

/* Image inside swipe card */
.swipe-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Gate state: partner hasn't locked in ── */
.discover-gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  text-align: center;
  gap: var(--space-3);
}

.discover-gate-icon {
  font-size: 2.8rem;
  margin-bottom: var(--space-2);
}

.discover-gate-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  font-style: italic;
  color: var(--text-primary);
}

.discover-gate-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}

/* ── Empty state ── */
.discover-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  text-align: center;
  gap: var(--space-3);
}

.discover-empty-icon {
  width: 160px;
  height: auto;
  display: block;
  margin: 0 auto var(--space-4);
  filter: drop-shadow(0 0 18px rgba(232, 64, 122, 0.28));
}

.discover-empty-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  font-style: italic;
  color: var(--text-primary);
}

.discover-empty-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}

/* ============================================================
   16. PERSONA BIO MODAL
   ============================================================ */

.persona-bio-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
}

.persona-bio-modal.open {
  display: flex;
}

.persona-bio-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 16, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.persona-bio-sheet {
  position: relative;
  width: 100%;
  height: 92dvh;
  background: var(--bg-base);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.persona-bio-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(12, 10, 16, 0.6);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.persona-bio-photo {
  position: relative;
  width: 100%;
  flex: 1 1 18rem;
  min-height: 10rem;
  background: var(--bg-card);
  cursor: pointer;
}

.persona-bio-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.persona-bio-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--bg-base) 100%);
  pointer-events: none;
}

.persona-bio-identity {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-5) var(--space-6);
}

.persona-bio-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.persona-bio-tagline {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
}

.persona-bio-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  -webkit-overflow-scrolling: touch;
}

.persona-bio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.persona-bio-tag {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 10px;
}

.persona-bio-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-line;
}

.persona-bio-private-toggle {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.persona-bio-private-toggle:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.persona-bio-private-toggle[aria-expanded="true"] {
  background: var(--rose-dim);
  border-color: var(--rose);
  color: var(--rose);
  box-shadow: 0 0 0 1px rgba(232, 64, 122, 0.18);
}

.persona-bio-private {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.persona-bio-private-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.persona-bio-private-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.persona-bio-private-value {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-line;
}

/* ── Profile screen ────────────────────────────────────────── */

.profile-screen-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  overflow-y: auto;
  padding-bottom: var(--space-8);
}

/* Couple names */
.profile-couple-names {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6) 0 var(--space-2);
}

.profile-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.profile-name-divider {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1;
}

/* Stats grid */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.profile-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.profile-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

.profile-stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/* Settings */
.profile-settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-settings-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 var(--space-1);
}

.profile-settings-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.profile-settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.profile-settings-item:hover:not(:disabled) {
  background: var(--bg-hover);
}

.profile-settings-item--disabled {
  cursor: default;
  opacity: 0.54;
}

.profile-settings-item--danger {
  color: var(--red);
  border-radius: var(--radius);
  justify-content: center;
  font-weight: 500;
}

.profile-settings-item--danger:hover {
  background: var(--red-dim);
}

.profile-settings-label {
  flex: 1;
}

.profile-settings-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.profile-settings-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

/* ── Notifications screen ──────────────────────────────────── */

.notif-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.notif-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-2) 0;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}
.notif-back-btn svg { width: 18px; height: 18px; }
.notif-back-btn:hover { color: var(--text-primary); }

.notif-screen-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
  padding-bottom: var(--space-8);
}

.notif-denied-banner {
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.notif-denied-banner p {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--yellow);
  line-height: 1.5;
  margin: 0;
}

.notif-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.notif-row--bordered {
  border-top: 1px solid var(--border);
}

.notif-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notif-row-label {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text-primary);
}

.notif-row-desc {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--rose-dim);
  border-color: var(--rose);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px) translateY(-50%);
  background: var(--rose);
}
