:root {
  /* Color tokens */
  --bg: #FBF8F3;
  --bg-alt: #F3EEE4;
  --ink: #16302E;
  --ink-soft: #4A6260;
  --line: #E4DDD0;
  --coral: #FF6B4A;
  --coral-dark: #E5502F;
  --seafoam: #4ECDC4;
  --sun: #FFC857;
  --card-bg: #FFFFFF;
  --danger: #D64545;

  /* Type */
  --font-display: 'Fraunces', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(22, 48, 46, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

p { line-height: 1.5; margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--coral-dark); }

button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 16px; /* prevents iOS zoom-on-focus */
}

input, select, textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--ink);
  margin-bottom: 12px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--coral);
}

textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--coral); color: white; }
.btn-primary:hover { background: var(--coral-dark); }

.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-block { width: 100%; }

.btn-icon {
  width: 52px; height: 52px; border-radius: 50%; padding: 0;
  background: white; box-shadow: var(--shadow); border: 1.5px solid var(--line);
  font-size: 22px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.error-text { color: var(--danger); font-size: 14px; margin: -6px 0 12px; }
.hint-text { color: var(--ink-soft); font-size: 13px; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-dark);
}

.gradient-text {
  background: linear-gradient(100deg, var(--coral) 0%, #FF8F6B 45%, var(--seafoam) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-glow {
  position: relative;
}
.hero-glow::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 480px; height: 320px;
  background: radial-gradient(ellipse at center, rgba(255,107,74,0.16) 0%, rgba(78,205,196,0.10) 55%, transparent 75%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--coral);
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 13px;
  background: rgba(255, 107, 74, 0.06);
}
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px 48px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.auth-hero { text-align: center; margin-bottom: 32px; }
.auth-hero h1 { font-size: 44px; line-height: 1.05; }
.auth-hero .eyebrow { display: block; margin-bottom: 10px; }
.auth-hero p { max-width: 320px; margin: 12px auto 0; }

.tab-switch {
  display: flex;
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}
.tab-switch button {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab-switch button.active { background: white; color: var(--ink); box-shadow: var(--shadow); }

.divider-note {
  text-align: center;
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 13px;
  margin-top: 20px;
}

/* ---------- App shell ---------- */
.app-shell { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .wordmark { font-family: var(--font-display); font-size: 22px; font-weight: 600; }

.view { flex: 1; padding: 20px; padding-bottom: 100px; max-width: 520px; margin: 0 auto; width: 100%; }
.view[hidden] { display: none; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 600;
}
.bottom-nav button .icon { font-size: 22px; }
.bottom-nav button.active { color: var(--coral-dark); }

/* ---------- Discovery / swipe ---------- */
.deck { position: relative; height: 62vh; min-height: 380px; margin-bottom: 20px; }
.swipe-card {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.swipe-card .photo {
  flex: 1;
  background: linear-gradient(160deg, var(--bg-alt), #E9E2D3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 14px;
  position: relative;
}
.swipe-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.swipe-card .info { padding: 18px 20px; }
.swipe-card .info h3 { font-size: 22px; margin-bottom: 2px; }
.swipe-card .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink-soft);
}
.badge.verified { background: rgba(78, 205, 196, 0.18); color: #2A8A82; }

.deck-actions { display: flex; justify-content: center; gap: 20px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state .glyph { font-size: 40px; margin-bottom: 12px; }

/* ---------- Match modal (signature moment) ---------- */
.match-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at 50% 30%, rgba(255,107,74,0.92), rgba(22,48,46,0.94));
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; text-align: center; color: white;
  padding: 24px;
  animation: fadeIn 0.25s ease;
}
.match-overlay[hidden] { display: none; }
.match-overlay h1 {
  font-size: 52px; color: white; margin-bottom: 8px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.match-overlay p { color: rgba(255,255,255,0.85); margin-bottom: 28px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Matches list ---------- */
.match-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; color: var(--ink-soft);
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.match-row .name { font-weight: 700; margin-bottom: 2px; }
.match-row .preview { font-size: 13px; color: var(--ink-soft); }

/* ---------- Chat ---------- */
.chat-shell { display: flex; flex-direction: column; height: 100vh; }
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.45; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: var(--coral); color: white; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: white; box-shadow: var(--shadow); border-bottom-left-radius: 4px; }
.bubble.unsent { font-style: italic; opacity: 0.6; }
.chat-input-row {
  display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.chat-input-row input { margin-bottom: 0; flex: 1; border-radius: 999px; }
.chat-input-row button { flex-shrink: 0; }

/* Utility */
.center-loading { text-align: center; padding: 40px; color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 200; box-shadow: var(--shadow);
}
