/* ═══════════════════════════════════════════════════════════════════════════
   Baby Names App — Styles
   Mobile-first, warm palette
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --bg:           #FFF8F3;
  --card:         #FFFFFF;
  --primary:      #E8705A;
  --primary-dk:   #C95843;
  --secondary:    #F4A261;
  --text:         #3D2A1E;
  --text-muted:   #9A8880;
  --border:       #F0E6DF;
  --love:         #E8705A;
  --maybe:        #F4A261;
  --pass:         #C4B8B2;
  --match:        #52B788;
  --match-lt:     #D4EDDA;
  --shadow-sm:    0 2px 8px rgba(61,42,30,.08);
  --shadow-md:    0 6px 24px rgba(61,42,30,.12);
  --shadow-lg:    0 12px 40px rgba(61,42,30,.18);
  --r-sm:  12px;
  --r-md:  20px;
  --r-lg:  28px;
  --r-xl:  36px;
}

/* ── RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
}

a { color: var(--primary); text-decoration: none; }

/* ── LAYOUT HELPERS ─────────────────────────────────────────────────────── */
.center { display: flex; align-items: center; justify-content: center; }
.col    { display: flex; flex-direction: column; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ── SCREEN SYSTEM ──────────────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
}
.screen.active { display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN  (index.html)
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 32px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-logo .icon {
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: var(--shadow-md);
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.auth-logo p {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
}

.auth-tabs {
  display: flex;
  background: var(--border);
  border-radius: var(--r-sm);
  padding: 4px;
  width: 100%;
  max-width: 360px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border-radius: 8px;
  transition: all .2s;
}

.auth-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.auth-form .field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.auth-form .field input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s;
}

.auth-form .field input:focus {
  border-color: var(--primary);
}

.auth-error {
  background: #FEE;
  border: 1px solid #F99;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: #C33;
  display: none;
}
.auth-error.visible { display: block; }

.auth-success {
  background: var(--match-lt);
  border: 1px solid var(--match);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: #2A6B4E;
  display: none;
  text-align: center;
}
.auth-success.visible { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Primary button */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 800;
  transition: all .15s;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232,112,90,.35);
}
.btn-primary:active { transform: scale(.97); background: var(--primary-dk); }

.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:active { transform: scale(.97); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  padding: 10px;
}

.btn:disabled {
  opacity: .5;
  pointer-events: none;
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark {
  border-color: rgba(61,42,30,.2);
  border-top-color: var(--text);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 900;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROOM SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#room-screen {
  padding: 40px 24px 40px;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.room-icon {
  font-size: 56px;
  line-height: 1;
}

#room-screen h2 {
  font-size: 26px;
  font-weight: 900;
  text-align: center;
}

#room-screen p {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.invite-code-box {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  text-align: center;
  width: 100%;
  max-width: 320px;
}

.invite-code-box .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.invite-code-box .code {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--primary);
}

.invite-code-box .hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.join-input-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.join-input-wrap input {
  flex: 1;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s;
}

.join-input-wrap input:focus { border-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   QUIZ SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#quiz-screen {
  padding: 0;
}

.quiz-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.quiz-header h2 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 4px;
}

.quiz-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.quiz-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 14px;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .4s ease;
}

.quiz-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
}

.quiz-step {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fade-up .3s ease;
}

.quiz-step.active { display: flex; }

.quiz-step h3 {
  font-size: 19px;
  font-weight: 800;
}

.quiz-step .hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
}

/* Choice pills */
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-pill {
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  transition: all .15s;
  cursor: pointer;
}

.choice-pill.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.choice-pill.selected:active { transform: scale(.95); }

/* Text inputs in quiz */
.quiz-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s;
}
.quiz-input:focus { border-color: var(--primary); }

.quiz-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM NAV
   ═══════════════════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav.visible { display: flex; }

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: color .15s;
}

.nav-btn .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform .15s;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn.active .nav-icon { transform: scale(1.15); }

/* ═══════════════════════════════════════════════════════════════════════════
   SWIPE SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#swipe-screen {
  padding-bottom: 80px; /* space for bottom nav */
}

.swipe-header {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swipe-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.swipe-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.swipe-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.swipe-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width .3s ease;
}

/* Card stage */
.card-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 0;
  position: relative;
  overflow: hidden;
}

/* Stack shadow cards */
.card-stage::before,
.card-stage::after {
  content: '';
  position: absolute;
  left: 50%;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-stage::after {
  transform: translateX(-50%) translateY(12px) scale(.92);
  width: calc(100% - 52px);
  height: calc(100% - 80px);
  z-index: 1;
}

.card-stage::before {
  transform: translateX(-50%) translateY(6px) scale(.96);
  width: calc(100% - 36px);
  height: calc(100% - 60px);
  z-index: 2;
}

/* The active card */
.name-card {
  position: relative;
  z-index: 10;
  width: 100%;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px 28px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  will-change: transform;
  transition: transform .3s cubic-bezier(.25,.46,.45,.94), opacity .3s ease;
}

.name-card:active { cursor: grabbing; }

.card-vote-label {
  position: absolute;
  top: 24px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  border-width: 3px;
  border-style: solid;
}

.card-vote-label.love-label {
  right: 20px;
  color: var(--love);
  border-color: var(--love);
  transform: rotate(15deg);
}

.card-vote-label.pass-label {
  left: 20px;
  color: var(--pass);
  border-color: var(--pass);
  transform: rotate(-15deg);
}

.card-vote-label.maybe-label {
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  color: var(--maybe);
  border-color: var(--maybe);
}

.card-vote-label.visible { opacity: 1; }

.card-name {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}

.card-meaning-section {
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.card-meaning-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary);
  margin-bottom: 4px;
}

.card-meaning {
  font-size: 15px;
  color: var(--text);
  font-style: italic;
  line-height: 1.45;
}

.card-origin {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

.card-trending {
  margin: -10px 0 14px;
}

.card-trending-label {
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.card-trending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-trending-rank {
  padding: 3px 7px;
  border-radius: 100px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.card-trending-none {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.card-tag {
  padding: 4px 12px;
  background: var(--bg);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: capitalize;
}

.card-syllables {
  display: flex;
  gap: 4px;
  align-items: center;
}

.syl-dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  opacity: .4;
}
.syl-dot.filled { opacity: 1; }

.card-syl-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Vote buttons */
.vote-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 20px 16px;
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.vote-btn .circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .15s;
}

.vote-btn:active .circle { transform: scale(.92); box-shadow: var(--shadow-sm); }

.btn-pass   .circle { background: var(--card); border: 2.5px solid var(--pass); color: var(--pass); }
.btn-maybe  .circle { background: var(--maybe); font-size: 22px; }
.btn-love   .circle { background: var(--love); }

.vote-btn .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.btn-love   .label { color: var(--love); }
.btn-pass   .label { color: var(--pass); }
.btn-maybe  .label { color: var(--maybe); }

/* Done state */
.swipe-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  text-align: center;
  position: relative;
  z-index: 3;
}

.swipe-done .big-icon { font-size: 72px; }

.swipe-done h3 {
  font-size: 24px;
  font-weight: 900;
}

.swipe-done p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 280px;
}

.swipe-done-stats {
  display: flex;
  gap: 20px;
  margin: 4px 0;
}

.swipe-done-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}

.swipe-done-stat-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.swipe-done-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.swipe-done-insights {
  width: 100%;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--bg);
  text-align: left;
}

.swipe-done-insights-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.swipe-done-insight {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.swipe-done-insight + .swipe-done-insight {
  border-top: 1px solid var(--border);
}

.swipe-done-insight-label {
  color: var(--text);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MATCH OVERLAY (celebration)
   ═══════════════════════════════════════════════════════════════════════════ */
.match-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.match-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.match-card {
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 32px 28px 40px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.25,.46,.45,.94);
}

.match-overlay.visible .match-card {
  transform: translateY(0);
}

.match-hearts {
  font-size: 52px;
  animation: heart-pop .6s cubic-bezier(.25,.46,.45,.94);
}

@keyframes heart-pop {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.match-card h2 {
  font-size: 13px;
  font-weight: 800;
  color: var(--match);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.match-card .match-name {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1px;
}

.match-card .match-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

.match-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

/* Confetti */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 12px;
  border-radius: 2px;
  animation: confetti-fall 2.5s ease-in forwards;
  pointer-events: none;
  z-index: 1000;
}

@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SHORTLIST SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#shortlist-screen {
  padding-bottom: 100px;
}

.shortlist-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
}

.shortlist-empty .big-icon { font-size: 64px; }

.shortlist-empty h3 {
  font-size: 20px;
  font-weight: 800;
}

.shortlist-empty p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 270px;
}

.shortlist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 0;
}

.shortlist-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
}

.shortlist-tab {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.shortlist-tab.active {
  border-color: var(--primary);
  color: var(--primary-dk);
  background: #FFF3EE;
}

.shortlist-item {
  background: var(--card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.shortlist-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  cursor: pointer;
}

.shortlist-item-name {
  font-size: 22px;
  font-weight: 900;
}

.shortlist-item-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.shortlist-item-badge {
  background: var(--match-lt);
  color: var(--match);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.shortlist-item-badge.custom {
  background: #FFF3E8;
  color: var(--secondary);
}

.shortlist-item-badge.maybe {
  background: #FFF3E8;
  color: #A9631E;
}

.shortlist-item-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: 12px;
  animation: fade-up .2s ease;
}

.shortlist-item.open .shortlist-item-body { display: flex; }

.shortlist-meaning {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  padding-top: 12px;
}

.shortlist-note-area {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  resize: none;
  transition: border-color .2s;
  min-height: 70px;
}
.shortlist-note-area:focus { border-color: var(--primary); }

.shortlist-item-actions {
  display: flex;
  gap: 8px;
}

.btn-save-note {
  flex: 1;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
}

.btn-remove {
  padding: 10px 14px;
  background: #FEE;
  color: #C33;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
}

/* Add custom name */
.shortlist-add-row {
  padding: 12px 16px 0;
}

.shortlist-add-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  animation: fade-up .2s ease;
}

.shortlist-add-form.open { display: flex; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#profile-screen {
  padding: 0 0 80px;
}

.profile-header {
  background: var(--primary);
  padding: 48px 24px 32px;
  text-align: center;
  color: #fff;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 12px;
}

.profile-header h2 {
  font-size: 22px;
  font-weight: 900;
}

.profile-header p {
  font-size: 14px;
  opacity: .8;
  margin-top: 2px;
}

.profile-section {
  margin: 20px 16px 0;
  background: var(--card);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.profile-row:last-child { border-bottom: none; }

.profile-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-row-icon {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.profile-row-label {
  font-size: 15px;
  font-weight: 700;
}

.profile-row-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.profile-row-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 500;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── LOGOUT BUTTON (in every post-login screen header) ──────────────────── */
.btn-logout-sm {
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  font-family: inherit;
}
.btn-logout-sm:active {
  background: #FEE;
  color: #C33;
  border-color: #F99;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#loading-screen {
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#loading-screen .big-icon { font-size: 56px; }

#loading-screen p {
  font-size: 15px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DESKTOP: center the mobile content
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 520px) {
  body {
    display: flex;
    justify-content: center;
    background: #EDE5DF;
  }

  .screen {
    max-width: 480px;
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    box-shadow: 0 0 60px rgba(0,0,0,.15);
  }

  .bottom-nav {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .match-overlay {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* ── RECOMMENDATION ENGINE ───────────────────────────────────────────────── */
.recommend-intro {
  padding: 16px 20px 4px;
  border-bottom: 1px solid var(--border);
}

.recommend-intro-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 4px;
}

.recommend-intro-tags {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.recommend-intro-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.recommend-item .shortlist-item-head {
  align-items: flex-start;
}

.recommend-meaning {
  font-style: italic;
  margin-top: 2px;
}

.recommend-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  padding-left: 8px;
}

.rec-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform .15s, background .15s;
  flex-shrink: 0;
}

.rec-btn:active { transform: scale(.9); }
.rec-love:active  { background: #FFE0DC; }
.rec-maybe:active { background: #FFF0DC; }
.rec-pass:active  { background: #EEE; font-size: 13px; font-weight: 700; color: var(--text-muted); }

.recommend-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
}

.recommend-reason {
  color: var(--primary);
  font-style: italic;
  margin-top: 2px;
}

.maybe-item .shortlist-item-head {
  align-items: flex-start;
}

.recommend-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #A9631E;
  background: #FFF3E8;
  border-radius: var(--r-sm);
  padding: 2px 8px;
  margin: 3px 0 2px;
}

.card-partner-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-dk);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}

.card-partner-note {
  font-size: 14px;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── BROWSE ──────────────────────────────────────────────────────────────── */
#browse-screen {
  padding-bottom: 100px;
}

.browse-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 0;
}

.browse-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.browse-chip {
  padding: 7px 13px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.browse-chip.active {
  border-color: var(--primary);
  color: var(--primary-dk);
  background: #FFF3EE;
}

.browse-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 0;
}

.browse-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  color: var(--text);
}

.browse-row:active { transform: scale(.98); }

.browse-row-main {
  flex: 1;
  min-width: 0;
}

.browse-row-name {
  font-size: 18px;
  font-weight: 900;
}

.browse-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.browse-row-sub b { color: var(--primary-dk); }

.browse-row-vote {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--border);
  color: var(--text-muted);
}

.browse-row-vote.vote-love  { background: #FFE0DC; color: var(--primary-dk); }
.browse-row-vote.vote-maybe { background: #FFF0DC; color: #A9631E; }

.browse-more {
  margin-top: 4px;
}

/* Nicknames on the swipe card */
.card-nicknames {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: -8px 0 20px;
}

/* ── NAME DETAILS SHEET ──────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;   /* below the match celebration */
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.sheet-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.sheet {
  position: relative;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 28px 22px max(24px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.25,.46,.45,.94);
}

.sheet-overlay.visible .sheet { transform: translateY(0); }

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.sheet-name {
  font-size: 34px;
  font-weight: 900;
  padding-right: 40px;
}

.sheet-facts {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}

.sheet-meaning {
  font-size: 15px;
  font-style: italic;
  color: var(--text);
  margin-top: 8px;
}

.sheet-section { margin-top: 18px; }

.sheet-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 6px;
}

.sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sheet-chip {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 100px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.sheet-chip-link {
  color: var(--primary-dk);
}

.sheet-chip-link:active { transform: scale(.95); }

.sheet-none {
  font-size: 13px;
  color: var(--text-muted);
}

.sheet-votes {
  position: sticky;
  bottom: calc(-1 * max(24px, env(safe-area-inset-bottom)));
  display: flex;
  gap: 8px;
  margin: 24px -22px calc(-1 * max(24px, env(safe-area-inset-bottom)));
  padding: 12px 22px max(16px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
}

.sheet-vote {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.sheet-vote span { font-size: 20px; line-height: 1; }
.sheet-vote:active { transform: scale(.96); }
.sheet-vote.selected.vote-love  { border-color: var(--love);  background: #FFE0DC; color: var(--primary-dk); }
.sheet-vote.selected.vote-maybe { border-color: var(--maybe); background: #FFF0DC; color: #A9631E; }
.sheet-vote.selected.vote-pass  { border-color: var(--pass);  background: #F4F0EE; color: var(--text); }

@media (min-width: 520px) {
  .sheet-overlay {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* ── HEAR THE NAME ───────────────────────────────────────────────────────── */
.card-title,
.sheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-title { margin-bottom: 8px; }
.card-title .card-name { margin-bottom: 0; min-width: 0; overflow-wrap: anywhere; }
.sheet-title { padding-right: 40px; }
.sheet-title .sheet-name { padding-right: 0; min-width: 0; overflow-wrap: anywhere; }

.hear-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFF3EE;
  border: 1.5px solid var(--border);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
}

.hear-btn:active { transform: scale(.9); }
.hear-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── ASK AI ABOUT A NAME ─────────────────────────────────────────────────── */
.ai-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-ask-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 2px solid var(--primary);
  background: #FFF3EE;
  text-align: left;
}

.ai-ask-btn:active { transform: scale(.98); }

.ai-ask-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--primary-dk);
}

.ai-ask-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.ai-family-link {
  background: none;
  padding: 0;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-dk);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.ai-error {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dk);
}

.ai-retry { align-self: flex-start; padding: 10px 18px; font-size: 14px; }

.ai-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  font-weight: 900;
  color: var(--primary-dk);
}

.ai-header span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.ai-block .sheet-label { margin-bottom: 4px; }

.ai-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.ai-block .sheet-chips + .ai-text { margin-top: 6px; }

.ai-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.ai-list li {
  padding-left: 14px;
  position: relative;
}

.ai-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: .6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--secondary);
}

.ai-followup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.ai-followup-row {
  display: flex;
  gap: 8px;
}

.ai-followup-row .quiz-input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 15px; }
.ai-followup-row .btn { padding: 0 18px; font-size: 15px; flex-shrink: 0; }

.ai-answer {
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

/* ── FAMILY DETAILS ──────────────────────────────────────────────────────── */
.sheet-intro {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 6px 0 14px;
}

.family-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 4px;
}

.family-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.family-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.family-actions .btn { flex: 1; }

/* ── SOLO INVITE BANNER ──────────────────────────────────────────────────── */
.invite-banner[hidden] { display: none; }

.invite-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 16px 0;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-sm);
  background: #FFF3EE;
  border: 1.5px solid var(--border);
}

.invite-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  color: var(--text-muted);
}

.invite-banner-text b {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
}

.invite-banner-code {
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--primary-dk);
}

.invite-banner-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

/* ── SHORT SCREENS (e.g. iPhone SE): keep the vote buttons above the nav ── */
@media (max-height: 720px) {
  .swipe-header       { padding-top: 12px; }
  .card-stage         { padding-top: 8px; }
  .swipe-header       { gap: 4px; }
  .name-card          { padding: 18px 22px 16px; }
  .card-title         { margin-bottom: 4px; }
  .card-name          { font-size: 34px; }
  .card-origin        { margin-bottom: 10px; }
  .card-nicknames     { margin: -6px 0 16px; }
  .card-meaning-section { padding: 8px 12px; margin-bottom: 10px; }
  .card-tags          { margin-bottom: 12px; }
  .vote-buttons       { padding: 8px 20px 4px; }
  .vote-btn .circle   { width: 52px; height: 52px; font-size: 22px; }
  .invite-banner      { margin-top: 6px; padding: 6px 10px 6px 12px; }
}

.sheet-us {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.card-tag-unisex {
  color: var(--primary-dk);
  background: #FFF3EE;
}

/* ── FAMOUS NAMESAKES ────────────────────────────────────────────────────── */
.card-famous {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dk);
  margin: -8px 0 20px;
}

.card-nicknames + .card-famous { margin-top: -14px; }

.browse-row-famous {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dk);
  margin-top: 2px;
}

@media (max-height: 720px) {
  .card-famous { margin: -6px 0 16px; }
  .card-nicknames + .card-famous { margin-top: -12px; }
}

/* ── LOVED (NOT MATCHED YET) ─────────────────────────────────────────────── */
.loved-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 14px 20px 0;
}

.loved-name {
  flex: 1;
  min-width: 0;
  background: none;
  padding: 0;
  text-align: left;
  color: var(--text);
}

@media (max-width: 440px) {
  .shortlist-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .shortlist-tab { padding: 9px 8px; font-size: 13px; }
}

.profile-version {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
}

/* Changing quiz answers from inside the app: the nav would cover the quiz buttons */
body.quiz-open .bottom-nav { display: none; }

.quiz-subq { margin-top: 18px; }
