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

:root {
  --bg:          #0f0f13;
  --bg-card:     #1a1a24;
  --bg-input:    #111118;
  --accent:      #e94577;
  --accent-dark: #c73060;
  --text:        #f0f0f5;
  --text-muted:  #888899;
  --border:      #2a2a3a;
  --online:      #4ade80;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  transition: background 0.15s, transform 0.1s;
}
button:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  width: 100%;
  padding: 13px;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

input, textarea {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* Layout */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container--wide { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: none;
  transition: color 0.15s;
}
.nav__item--active, .nav__item:hover { color: var(--accent); }
.nav__icon { font-size: 22px; }

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-card__logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-card__logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.auth-card__logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-muted); }
.form-error {
  color: #f87171;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}
.form-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Discover */
.discover-page {
  padding: 16px 16px 80px;
  max-width: 480px;
  margin: 0 auto;
}
.discover-page h2 { margin-bottom: 16px; font-size: 22px; }

.companion-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.companion-card__image {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}
.companion-card__image--placeholder {
  width: 100%;
  height: 420px;
  background: linear-gradient(135deg, #1a1a2e, #2a1a3e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
}
.companion-card__info {
  padding: 16px;
}
.companion-card__name { font-size: 22px; font-weight: 700; }
.companion-card__meta { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.companion-card__bio { margin-top: 8px; font-size: 14px; color: #ccc; }
.companion-card__actions {
  display: flex;
  gap: 12px;
  padding: 12px 16px 16px;
}
.btn-pass {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 24px;
  padding: 14px;
  border-radius: 50px;
}
.btn-like {
  flex: 1;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  padding: 14px;
  border-radius: 50px;
}
.btn-like:hover { background: var(--accent-dark); }

/* Matches */
.matches-page { padding: 16px 16px 80px; }
.matches-page h2 { margin-bottom: 16px; font-size: 22px; }
.match-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  text-decoration: none;
  color: inherit;
}
.match-item:hover { border-color: var(--accent); }
.match-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.match-info { flex: 1; min-width: 0; }
.match-name { font-weight: 600; }
.match-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* Chat */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.chat-header__back { font-size: 22px; color: var(--text-muted); cursor: pointer; padding: 4px; }
.chat-header__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.chat-header__info { flex: 1; }
.chat-header__name { font-weight: 600; }
.chat-header__status { font-size: 12px; color: var(--online); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}
.message--user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message--companion {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.message__time { font-size: 11px; opacity: 0.6; margin-top: 4px; text-align: right; }
.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}
.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input-area textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 15px;
}
.btn-send {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-send:hover { background: var(--accent-dark); }
.btn-send:disabled { background: var(--border); cursor: not-allowed; }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.25s;
  z-index: 999;
  white-space: nowrap;
}
.toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { border-color: #f87171; color: #f87171; }
.toast--success { border-color: var(--online); color: var(--online); }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
