/* ============================================
   LoveGo — "Velvet Dusk" Design System
   A warm, luxurious dating experience with
   rose-gold accents and cinematic depth.
   ============================================ */

/* --- Google Fonts loaded in HTML --- */

/* --- Design Tokens --- */
:root {
  /* Primary palette: warm rose-gold on deep velvet */
  --accent: #e8a87c;
  --accent-light: #f4c6a0;
  --accent-dark: #c4825a;
  --accent-glow: rgba(232, 168, 124, 0.35);
  --accent-glow-strong: rgba(232, 168, 124, 0.6);

  /* Surfaces: warm-tinted darks */
  --bg-deep: #08070c;
  --bg-primary: #0e0d14;
  --bg-elevated: #16141f;
  --bg-card: rgba(26, 23, 36, 0.7);
  --bg-input: #1a1726;
  --bg-glass: rgba(26, 23, 36, 0.55);

  /* Text hierarchy */
  --text-primary: #f2ede8;
  --text-secondary: rgba(242, 237, 232, 0.6);
  --text-muted: rgba(242, 237, 232, 0.3);

  /* Borders */
  --border-subtle: rgba(232, 168, 124, 0.1);
  --border-accent: rgba(232, 168, 124, 0.25);

  /* Semantic */
  --success: #7dd3a8;
  --heart: #e8556d;
  --heart-glow: rgba(232, 85, 109, 0.4);
  --heart-deep: #c93d55;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
}

/* --- Base Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  overflow: hidden;
}

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }

/* Hide scrollbars but allow scroll */
::-webkit-scrollbar { width: 0; display: none; }
* { scrollbar-width: none; }

/* Selection color */
::selection {
  background: rgba(232, 168, 124, 0.3);
  color: var(--text-primary);
}

/* --- App Shell --- */
#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* Ambient background glow */
#app::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(232, 168, 124, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#app::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(232, 85, 109, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  max-width: 430px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  z-index: 1;
  margin: 0 auto;
}

/* Noise texture overlay */
.app-container::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  opacity: 0.5;
}

/* =======================================================
   PAGE SYSTEM — Critical: use !important to prevent
   page-specific flex/grid from overriding display:none
   ======================================================= */
.page {
  display: none !important;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.page.active {
  display: flex !important;
}

/* --- Shared: Typography --- */
.display-text {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Shared: Top Bar --- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent-light), var(--accent), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

.lang-toggle:active {
  background: rgba(232, 168, 124, 0.12);
}

/* Language dropdown */
.lang-switcher-wrap {
  position: relative;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 200;
  min-width: 180px;
  overflow: hidden;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.lang-option:hover,
.lang-option.active {
  background: rgba(232, 168, 124, 0.08);
}

.lang-option.active {
  color: var(--accent-light);
}

.lang-flag { font-size: 18px; }
.lang-name { flex: 1; }
.lang-check { color: var(--accent); font-size: 14px; font-weight: 700; }

.avatar-mini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.2s;
}

.avatar-mini:active { transform: scale(0.95); }

/* --- Shared: Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  flex-shrink: 0;
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.back-btn:active {
  background: rgba(232, 168, 124, 0.12);
  transform: scale(0.92);
}

.header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Bottom nav removed — flow is linear: Discover → Verify → Match → Success → Chat */

/* --- Shared: Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 12, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
}

.modal-content {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--border-subtle);
  box-shadow:
    0 0 40px var(--accent-glow),
    0 24px 48px rgba(0, 0, 0, 0.4);
  animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  0% { transform: scale(0.92) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(232, 168, 124, 0.12); }

.modal-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Shared: Toast --- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.4s;
  box-shadow: 0 8px 24px var(--accent-glow);
  visibility: hidden;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0s;
}

/* ============================================
   1. DISCOVER PAGE
   ============================================ */
.discover-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  overflow: hidden;
}

.main-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  position: relative;
  overflow: hidden;
}

/* Floating background avatars */
.bg-avatars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-avatar {
  position: absolute;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  filter: blur(1.5px) saturate(0.7);
  animation: bgFloat ease-in-out infinite alternate;
}

@keyframes bgFloat {
  0%   { opacity: 0; transform: translateY(8px) scale(0.9); }
  30%  { opacity: 0.15; }
  50%  { opacity: 0.1; transform: translateY(-6px) scale(1); }
  70%  { opacity: 0.15; }
  100% { opacity: 0; transform: translateY(8px) scale(0.9); }
}

/* Avatar section */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.avatar-ring-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(232, 168, 124, 0.08);
  stroke-width: 2.5;
}

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 879.6;
  stroke-dashoffset: 0;
  animation: ringCountdown 7s linear forwards;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

@keyframes ringCountdown {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 879.6; }
}

.avatar-large {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  animation: avatarReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 0 40px var(--accent-glow),
    0 0 80px rgba(232, 168, 124, 0.1),
    inset 0 0 30px rgba(0, 0, 0, 0.2);
}

@keyframes avatarReveal {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  text-align: center;
  margin-top: var(--space-md);
  animation: fadeUp 0.5s ease both;
}

.profile-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-distance {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

@keyframes fadeUp {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Gender selector */
.gender-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 0;
  position: relative;
  z-index: 1;
}

.gender-label {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 500;
}

.gender-tabs {
  display: flex;
  gap: var(--space-sm);
}

.gender-tab {
  padding: 8px 22px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.gender-tab.active {
  background: rgba(232, 168, 124, 0.12);
  color: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Heart button */
.heart-section {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  position: relative;
  z-index: 1;
}

.heart-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
    rgba(232, 85, 109, 0.25),
    rgba(232, 85, 109, 0.08));
  border: 2px solid rgba(232, 85, 109, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  animation: heartPulse 2s ease-in-out infinite;
  transition: all 0.2s;
  box-shadow:
    0 0 40px var(--heart-glow),
    0 0 80px rgba(232, 85, 109, 0.12);
}

.heart-btn:active {
  transform: scale(0.88);
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.08); }
  30% { transform: scale(1); }
  45% { transform: scale(1.05); }
}

.heart-icon {
  font-size: 40px;
  filter: drop-shadow(0 0 12px rgba(232, 85, 109, 0.5));
}

.heart-text {
  font-size: 14px;
  font-weight: 600;
  color: #f08a9e;
  letter-spacing: 0.03em;
}

/* Activity feed */
.activity-feed {
  padding: 0 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.feed-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 10px;
  padding: 0 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.feed-scroll {
  display: inline-flex;
  gap: 8px;
  padding: 0 20px;
  animation: marqueeScroll 30s linear infinite;
  white-space: nowrap;
}

.feed-scroll:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.feed-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  animation: fadeUp 0.5s ease both;
}

.feed-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.feed-info {
  display: flex;
  flex-direction: column;
}

.feed-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.feed-status {
  font-size: 10px;
  color: var(--text-muted);
}

.feed-status.success {
  color: var(--accent);
}

/* ============================================
   2. VERIFY PAGE
   ============================================ */
.verify-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  overflow-y: auto;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--space-lg) 40px;
  gap: 20px;
}

/* Liked preview */
.liked-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.liked-avatar-wrap {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 40px var(--accent-glow);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 30px var(--accent-glow); }
  50% { box-shadow: 0 0 50px var(--accent-glow-strong), 0 0 80px var(--accent-glow); }
}

.liked-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.liked-text {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-secondary);
}

.liked-text strong {
  color: var(--accent-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
}

/* Form */
.form-section {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 500;
}

.phone-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.country-code {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 10px;
  font-size: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.3s;
}

.country-code:hover {
  border-color: var(--accent);
}

.country-abbr {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
}

.country-dial { font-weight: 500; }

.dropdown-arrow {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Country picker dropdown */
.country-dropdown {
  margin-top: var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.country-search {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 14px;
}

.country-search::placeholder { color: var(--text-muted); }

.country-list {
  max-height: 200px;
  overflow-y: auto;
}

.country-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.country-option:hover,
.country-option.active {
  background: rgba(232, 168, 124, 0.08);
}

.country-option.active { color: var(--accent-light); }

.opt-flag { font-size: 18px; }
.opt-name { flex: 1; color: var(--text-primary); }
.opt-abbr { color: var(--text-muted); font-size: 12px; }
.opt-code { color: var(--text-secondary); font-size: 13px; min-width: 40px; text-align: right; }

.phone-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text-primary);
  transition: all 0.3s;
}

.phone-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.phone-input::placeholder { color: var(--text-muted); }

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

/* Confirm button */
.confirm-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  background: var(--bg-card);
  transition: all 0.35s ease;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.confirm-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 6px 24px var(--accent-glow);
}

.confirm-btn.active:active {
  transform: scale(0.97);
}

/* Login error */
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(232, 85, 109, 0.1);
  border: 1px solid rgba(232, 85, 109, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #f08a9e;
}

/* Code guide modal with image */
.code-guide-modal {
  padding: 0;
  overflow: hidden;
}

.code-guide-modal .modal-header,
.code-guide-modal .code-display,
.code-guide-modal .copy-confirm-btn {
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.code-guide-modal .modal-header {
  padding-top: var(--space-lg);
}

.code-guide-modal .copy-confirm-btn {
  margin: 0 var(--space-lg) var(--space-lg);
  width: calc(100% - var(--space-lg) * 2);
}

.guide-img-wrap {
  width: 100%;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.guide-img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 200px;
  object-fit: cover;
}

/* Code display */
.code-display {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-lg);
}

.code-char {
  width: 38px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Outfit', monospace;
  color: var(--accent-light);
  box-shadow: 0 0 12px var(--accent-glow);
}

.copy-confirm-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 24px var(--accent-glow);
  transition: transform 0.2s;
}

.copy-confirm-btn:active { transform: scale(0.97); }

.btn-icon { font-size: 18px; }

/* ============================================
   3. MATCHING PAGE
   ============================================ */
.matching-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  padding: 0 20px;
}

.match-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 0 30px;
}

.match-avatar {
  position: relative;
  transition: transform 0.8s ease-in-out;
}

.match-avatar.connecting.left {
  animation: slideRight 2s ease-in-out infinite alternate;
}
.match-avatar.connecting.right {
  animation: slideLeft 2s ease-in-out infinite alternate;
}

.match-avatar.matched.left {
  animation: none;
  transform: translateX(30px);
}
.match-avatar.matched.right {
  animation: none;
  transform: translateX(-30px);
}

@keyframes slideRight {
  0% { transform: translateX(0); }
  100% { transform: translateX(15px); }
}
@keyframes slideLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-15px); }
}

.avatar-glow-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.4;
  animation: glowPulse 2s infinite;
}

.avatar-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
}

.avatar-circle.me {
  box-shadow: 0 0 24px rgba(138, 120, 200, 0.35);
}

.avatar-circle.target {
  box-shadow: 0 0 24px var(--accent-glow);
}

/* Connection line */
.connection-line {
  width: 100px;
  height: 60px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.8s, opacity 0.8s;
}

.connection-line.matched {
  width: 40px;
  overflow: visible;
}

.pulse-line { width: 100%; height: 100%; }

.heartbeat-svg { width: 100%; height: 100%; }

.heartbeat-line {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  filter: drop-shadow(0 0 4px var(--accent));
  stroke: var(--accent);
}

.heartbeat-line.active {
  animation: drawLine 2s linear infinite;
}

@keyframes drawLine {
  0% { stroke-dashoffset: 400; }
  100% { stroke-dashoffset: 0; }
}

.match-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  animation: heartPop 0.6s ease both;
  filter: drop-shadow(0 0 14px rgba(232, 85, 109, 0.6));
  z-index: 10;
}

@keyframes heartPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Status section */
.status-section {
  text-align: center;
  padding: 20px 0;
}

.status-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.5s;
}

.status-text.success {
  color: var(--accent-light);
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  text-shadow: 0 0 24px var(--accent-glow);
}

.code-section {
  margin-top: 28px;
}

.code-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.code-display-large {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 16px;
}

.code-char-large {
  width: 34px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid rgba(232, 168, 124, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Outfit', monospace;
  color: var(--accent-light);
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.help-btn:active { background: rgba(232, 168, 124, 0.1); }

.help-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* Help modal steps */
.help-modal {
  position: relative;
}

.help-modal h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  text-align: center;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.help-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.step-content p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Progress */
.progress-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 0;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-light));
  border-radius: 3px;
  transition: width 0.3s;
  box-shadow: 0 0 8px var(--accent-glow);
}

.progress-text {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  min-width: 38px;
  text-align: right;
  font-family: 'Outfit', monospace;
}

/* Success button */
.success-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 6px 24px var(--accent-glow);
  margin-top: 20px;
  animation: modalIn 0.5s ease;
  letter-spacing: 0.02em;
}

.success-btn:active { transform: scale(0.97); }

/* ============================================
   4. SUCCESS PAGE
   ============================================ */
.success-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  overflow-y: auto;
}

.success-page > .header {
  position: relative;
  z-index: 10;
  padding: var(--space-md) 20px;
}

.success-page > .profile-section,
.success-page > .actions,
.success-page > .match-stats,
.success-page > .celebration {
  padding-left: 20px;
  padding-right: 20px;
}

.celebration {
  position: relative;
  height: 0;
  z-index: 0;
  overflow: hidden;
}

.confetti-container {
  position: absolute;
  width: 100%;
  top: -20px;
  z-index: 0;
  pointer-events: none;
}

.confetti {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  animation: confettiFall 3s ease-in infinite;
}

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

/* Profile section */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0;
}

/* Success page ring (browse mode) */
.success-page .avatar-ring-wrapper {
  width: 200px;
  height: 200px;
}

.success-page .ring-bg {
  fill: none;
  stroke: rgba(232, 168, 124, 0.08);
  stroke-width: 2.5;
}

.success-page .ring-progress,
.browse-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

@keyframes ringDown {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 754; }
}

.success-avatar {
  position: relative;
  width: 160px;
  height: 160px;
  animation: avatarReveal 0.5s ease;
}

.avatar-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent);
  animation: glowPulse 3s infinite;
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 40px var(--accent-glow);
}

.success-page .profile-info {
  text-align: center;
  margin-top: 18px;
  animation: fadeUp 0.4s ease;
}

.success-page .profile-info h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 700;
}

.distance {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.bio {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Actions */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 0;
}

.action-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

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

.like-btn {
  background: linear-gradient(135deg, var(--heart), var(--heart-deep));
  color: #fff;
  box-shadow: 0 6px 24px var(--heart-glow);
}

.chat-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 6px 24px var(--accent-glow);
}

.continue-btn {
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.action-btn:active { transform: scale(0.97); }

.btn-emoji { font-size: 18px; }

/* Match stats */
.match-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 22px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-top: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: 'Outfit', sans-serif;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-align: center;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

/* ============================================
   5. PROFILE PAGE
   ============================================ */
.profile-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
  padding: 0 20px 20px;
  overflow-y: auto;
}

.my-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-top: 10px;
}

.my-avatar-wrapper { position: relative; }

.my-avatar {
  position: relative;
  width: 56px;
  height: 56px;
}

.my-avatar .avatar-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent);
}

.my-avatar .avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
}

.my-info { flex: 1; }

.my-info h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 700;
}

.my-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'Outfit', monospace;
}

.edit-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* Stats */
.stats-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.stat-card {
  flex: 1;
  padding: 14px 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: 'Outfit', sans-serif;
}

/* Sections */
.section { margin-top: 22px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.section-count {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
  font-size: 14px;
}

.go-discover-btn {
  margin-top: 12px;
  padding: 10px 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Matched list */
.matched-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matched-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  animation: fadeUp 0.4s ease both;
}

.matched-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 12px var(--accent-glow);
  flex-shrink: 0;
}

.matched-info { flex: 1; }

.matched-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.matched-info .age {
  font-weight: 400;
  color: var(--text-secondary);
}

.matched-info p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-action-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: rgba(232, 168, 124, 0.1);
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(232, 168, 124, 0.2);
  white-space: nowrap;
  transition: background 0.2s;
}

.chat-action-btn:active {
  background: rgba(232, 168, 124, 0.2);
}

/* Language switcher */
.lang-section { margin-top: 16px; }

.lang-switcher {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.lang-btn {
  padding: 8px 24px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  transition: all 0.3s;
}

.lang-btn.active {
  background: rgba(232, 168, 124, 0.12);
  color: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Settings */
.settings-section { margin-top: 22px; }

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.setting-item:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.setting-item:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.setting-item + .setting-item { border-top: none; }
.setting-item:active { background: rgba(232, 168, 124, 0.06); }

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

/* ============================================
   6. CHAT PAGE
   ============================================ */
.chat-page {
  height: 100vh;
  height: 100dvh;
  background: var(--bg-primary);
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(14, 13, 20, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  flex-shrink: 0;
}

.chat-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 10px var(--accent-glow);
}

.chat-user-text h3 {
  font-size: 15px;
  font-weight: 600;
}

.online-status {
  font-size: 12px;
  transition: color 0.3s;
}

.online-status.online { color: var(--success); }
.online-status.recent { color: var(--text-muted); }
.online-status.viewing { color: var(--accent-light); }
.online-status.typing { color: var(--accent-light); }

.header-actions {
  display: flex;
  align-items: center;
}

.action-icon {
  font-size: 20px;
  cursor: pointer;
  opacity: 0.6;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-msg {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.system-bubble {
  background: rgba(232, 168, 124, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  font-size: 12px;
  color: var(--accent);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.message-row.sent { justify-content: flex-end; }

.msg-avatar { flex-shrink: 0; }

.mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.message-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  animation: fadeUp 0.25s ease;
  position: relative;
}

.message-bubble:not(.sent) {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message-bubble.sent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-bottom-right-radius: 4px;
  color: #fff;
}

.msg-time {
  font-size: 10px;
  opacity: 0.45;
  margin-top: 3px;
  display: block;
  text-align: right;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBounce 1.4s ease-in-out infinite;
}

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(14, 13, 20, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.3s;
}

.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.send-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Emoji button */
.emoji-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.emoji-btn:active { transform: scale(0.9); }

/* Emoji picker grid */
.emoji-picker {
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  max-height: 200px;
  overflow-y: auto;
  flex-shrink: 0;
}

.emoji-item {
  font-size: 22px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.emoji-item:hover {
  background: rgba(232, 168, 124, 0.12);
}

.emoji-item:active {
  transform: scale(1.2);
}
