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

:root {
  --bg: #ffffff;
  --bg-soft: #f5f4f2;
  --bg-warm: #faf9f7;
  --text: #1c1c1c;
  --text-secondary: #5c5c5c;
  --text-light: #9a9a9a;
  --text-muted: #bcbcbc;
  --accent: #7c6f64;
  --accent-light: #d4cdc5;
  --accent-hover: #6a5e54;
  --accent-bg: rgba(124, 111, 100, 0.08);
  --border: #e6e3df;
  --border-light: #f0eeeb;
  --error: #c0392b;
  --error-bg: #fdf0ef;
  --success: #4a7c5c;
  --success-bg: #edf5ef;
  --warning: #b8860b;
  --warning-bg: #fef9e7;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.08);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app { min-height: 100vh; }

::selection {
  background: var(--accent-bg);
  color: var(--text);
}

/* ---- Typography ---- */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
  border-color: var(--accent-light);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: white;
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
}
.btn-danger:hover {
  background: var(--error);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #3f6d4f;
  box-shadow: var(--shadow-sm);
}

.btn-block { width: 100%; }

.btn-sm { padding: 7px 16px; font-size: 0.8125rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 22px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.form-group .hint {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: 4px;
}

.form-group .char-count {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
  text-align: right;
  transition: color var(--transition);
}

.form-group .char-count.enough { color: var(--success); }

.form-group .error-text {
  font-size: 0.8125rem;
  color: var(--error);
  margin-top: 4px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); }

/* ---- Photo Upload ---- */
.photo-upload {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  margin: 0 auto;
  position: relative;
  background: var(--bg-soft);
}

.photo-upload:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

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

.photo-upload .placeholder {
  text-align: center;
  color: var(--text-light);
  font-size: 0.75rem;
}

.photo-upload .placeholder svg {
  display: block;
  margin: 0 auto 6px;
  opacity: 0.5;
}

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 2px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-sans);
}

.nav-link:hover { color: var(--text); background: var(--bg-soft); }

.nav-link.active {
  color: var(--text);
  background: var(--accent-bg);
  font-weight: 600;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0;
}

/* ---- Page Layout ---- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---- Landing Page ---- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-warm) 50%, var(--bg-soft) 100%);
}

.landing-logo {
  font-size: 4.5rem;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-tagline {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 400px;
  line-height: 1.5;
}

.landing-desc {
  max-width: 440px;
  font-size: 0.9375rem;
  color: var(--text-light);
  margin-bottom: 36px;
  line-height: 1.7;
}

.landing-actions {
  display: flex;
  gap: 12px;
}

.landing-actions .btn {
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 72px;
  max-width: 560px;
}

.landing-feature { text-align: center; }

.landing-feature .icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--accent);
}

.landing-feature h3 {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.landing-feature p {
  font-size: 0.8125rem;
  color: var(--text-light);
  max-width: 160px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ---- Profile Card (Discover) ---- */
.profile-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.profile-card:hover { box-shadow: var(--shadow-md); }

.profile-card-photo {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  transition: filter 0.6s ease;
}

.profile-card-photo.blurred { filter: blur(28px) saturate(0.5); }

.profile-card-body { padding: 28px; }

.profile-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.profile-card-name {
  font-family: var(--font-serif);
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.profile-card-age {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 300;
}

.profile-card-location {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 18px;
}

.profile-card-bio {
  margin-bottom: 24px;
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.profile-card-questions {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

.profile-card-question { margin-bottom: 18px; }
.profile-card-question:last-child { margin-bottom: 0; }

.profile-card-question h4 {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}

.profile-card-question p {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---- Discover Controls ---- */
.discover-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 16px;
}

.discover-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-light);
}

.discover-timer .timer-bar {
  width: 100px;
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.discover-timer .timer-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

.blur-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.blur-toggle-switch {
  width: 34px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.blur-toggle-switch::after {
  content: '';
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.blur-toggle.active .blur-toggle-switch { background: var(--accent); }
.blur-toggle.active .blur-toggle-switch::after { transform: translateX(14px); }

/* ---- Message Compose ---- */
.message-compose {
  margin-top: 28px;
  padding: 24px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.message-compose h3 { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; margin-bottom: 4px; }

.message-compose .hint {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.message-compose textarea {
  min-height: 130px;
  background: white;
  border-radius: var(--radius-xs);
}

.message-compose .message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.message-error {
  font-size: 0.8125rem;
  color: var(--error);
  margin-top: 8px;
}

/* ---- Connections Page ---- */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.connection-item:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-sm);
}

.connection-item-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.connection-item-info {
  flex: 1;
  min-width: 0;
}

.connection-item-name {
  font-weight: 500;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.connection-item-preview {
  font-size: 0.8125rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-item-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.connection-item-status.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.connection-item-status.accepted {
  background: var(--success-bg);
  color: var(--success);
}

/* ---- Chat ---- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  background: var(--bg);
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
}

.chat-header-photo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-header-info h3 {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
}

.chat-header-info p {
  font-size: 0.6875rem;
  color: var(--text-light);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-warm);
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  line-height: 1.5;
  position: relative;
}

.chat-bubble.sent {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble.received {
  background: white;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.chat-bubble .timestamp {
  font-size: 0.625rem;
  opacity: 0.5;
  margin-top: 6px;
  display: block;
}

.chat-bubble.sent .timestamp { opacity: 0.65; }

.chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg);
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 16px;
  border-radius: 21px;
  resize: none;
  background: var(--bg-soft);
  border-color: transparent;
}

.chat-input-bar textarea:focus {
  background: var(--bg);
  border-color: var(--accent);
}

/* ---- Pending Action Card ---- */
.pending-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

/* ---- Profile Section ---- */
.profile-view-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 14px;
  display: block;
  border: 3px solid var(--border);
}

.profile-view-header { text-align: center; margin-bottom: 28px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 72px 24px;
}

.empty-state svg {
  margin-bottom: 14px;
  opacity: 0.2;
  color: var(--text-light);
}

.empty-state h2 { margin-bottom: 8px; }

.empty-state p {
  max-width: 300px;
  margin: 0 auto;
  font-size: 0.9375rem;
}

/* ---- Pending Banner ---- */
.pending-banner {
  background: var(--warning-bg);
  border: 1px solid #f5e6a3;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 12px;
}

.pending-banner p {
  font-size: 0.8125rem;
  color: #8a6d00;
}

/* ---- Demo Badge ---- */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

/* ---- Discover Profile Count ---- */
.discover-count {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* ---- Typing indicator ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 18px;
  align-self: flex-start;
  background: white;
  border-radius: var(--radius-sm);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--accent-light);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

/* ---- Online indicator ---- */
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 4px;
  animation: pulse 2s infinite;
}

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

/* ---- Utility ---- */
.gradient-text {
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 32px 0;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  h1 { font-size: 1.75rem; }
  .landing-logo { font-size: 3.25rem; }
  .landing-features { grid-template-columns: 1fr; gap: 28px; margin-top: 48px; }
  .landing-actions { flex-direction: column; width: 100%; }
  .landing-actions .btn { width: 100%; max-width: 300px; margin: 0 auto; }
  .profile-card-body { padding: 20px; }
  .profile-card-photo { aspect-ratio: 4/5; }
  .discover-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .discover-timer { justify-content: center; }
  .page { padding: 24px 16px 80px; }
  .chat-bubble { max-width: 85%; }
  .nav { padding: 0 16px; }
}
