:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface2: #0f3460;
  --accent: #ff6b9d;
  --text: #eaeaea;
  --text-dim: #8892a4;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* Age Gate */
.age-gate-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 32px;
  background: var(--bg);
}
.age-gate-page h1 { font-size: 28px; margin-bottom: 8px; }
.age-gate-page p { color: var(--text-dim); margin-bottom: 32px; line-height: 1.6; }
.confirm-btn {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 16px 40px;
  color: white;
  font-size: 18px;
  cursor: pointer;
  margin-bottom: 12px;
  width: 100%;
  max-width: 300px;
}
.deny-btn {
  background: none;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 12px 40px;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
}

/* App Layout */
.app-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.page { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.page.active { display: flex; }

/* Bottom Nav */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #222;
  flex-shrink: 0;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 16px;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 22px; }

/* Map */
#map { flex: 1; min-height: 0; }

/* Profile Popup */
.profile-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 16px));
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 2000;
  max-height: 80vh;
  overflow-y: auto;
}
.profile-popup.open { transform: translateY(0); }
.popup-handle { width: 40px; height: 4px; background: #333; border-radius: 2px; margin: 0 auto 20px; }
.popup-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.avatar-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  flex-shrink: 0;
}
.popup-bio { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.chat-btn {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 14px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
}

/* Inbox */
.inbox-list { flex: 1; overflow-y: auto; padding: 16px; }
.inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  background: var(--surface);
}
.inbox-item:active { opacity: 0.7; }
.inbox-meta { flex: 1; }
.inbox-name { font-weight: 600; margin-bottom: 4px; }
.inbox-preview { font-size: 13px; color: var(--text-dim); }
.inbox-empty { text-align: center; padding: 60px 24px; color: var(--text-dim); }
.inbox-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Chat */
.chat-wrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.back-btn { background: none; border: none; color: var(--accent); font-size: 22px; cursor: pointer; }
.header-name { font-weight: 600; font-size: 16px; }
.quota-bar { padding: 6px 16px; background: #1a0a10; text-align: center; font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 80px;
}
.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  word-break: break-word;
}
.bubble-user { background: var(--accent); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble-char { background: var(--surface); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 18px;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}
.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid #222;
}
.chat-input {
  flex: 1;
  background: #333;
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
}

/* Premium Modal */
.premium-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.premium-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  max-width: 320px;
  margin: 16px;
}
.premium-card h2 { margin-bottom: 8px; }
.premium-card p { color: var(--text-dim); font-size: 14px; margin-bottom: 8px; line-height: 1.6; }
.premium-btn {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
}
.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
}
