/* 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #0f0f1a;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
}

/* 页面切换 */
.page {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding-bottom: 120rpx;
  -webkit-overflow-scrolling: touch;
}
.page.active { display: block; }
.page.no-tab { padding-bottom: 30rpx; }

.container { padding: 20px; min-height: calc(100vh - 60px); }

/* 通用 */
.card {
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.page-title { font-size: 22px; font-weight: 700; text-align: center; margin: 20px 0; }
.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 30px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  color: #fff;
  box-shadow: 0 4px 20px rgba(233,69,96,0.4);
}
.btn-primary:active { opacity: 0.8; transform: scale(0.98); }
.btn-primary:disabled { background: rgba(233,69,96,0.3); color: rgba(255,255,255,0.5); box-shadow: none; }
.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* 头像 */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar::before {
  content: attr(data-text);
  font-size: 1em;
}
.avatar-small { width: 40px; height: 40px; font-size: 14px; }
.avatar-medium { width: 60px; height: 60px; font-size: 20px; }
.avatar-large { width: 100px; height: 100px; font-size: 36px; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 12px;
  margin: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.tag.tag-active, .tag.active {
  background: rgba(233,69,96,0.2);
  color: #e94560;
  border-color: #e94560;
}
.tags-wrap { display: flex; flex-wrap: wrap; gap: 4px; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  padding: 60px 30px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.logo-area { text-align: center; margin-bottom: 50px; }
.logo-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: #fff; font-weight: 700;
  margin: 0 auto 20px;
  box-shadow: 0 10px 30px rgba(233,69,96,0.4);
}
.app-name { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.app-desc { font-size: 14px; color: rgba(255,255,255,0.6); }
.features { width: 100%; margin-bottom: 40px; }
.feature-item { display: flex; align-items: center; padding: 10px 0; }
.feature-icon { font-size: 22px; margin-right: 14px; }
.feature-text { font-size: 14px; color: rgba(255,255,255,0.8); }
.login-form { width: 100%; }
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  color: #fff;
  margin-bottom: 14px;
  outline: none;
}
.form-input::placeholder { color: rgba(255,255,255,0.4); }
.login-btn { margin-top: 10px; }
.login-hint { text-align: center; color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 16px; }

/* ===== 首页 ===== */
.welcome-header { display: flex; align-items: center; gap: 16px; }
.welcome-text { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.credits-text { font-size: 13px; color: rgba(255,255,255,0.6); }
.vip-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #000;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.action-area { text-align: center; margin: 40px 0; }
.match-btn { max-width: 280px; margin: 0 auto 16px; }
.match-hint { font-size: 12px; color: rgba(255,255,255,0.5); }
.stats-card { display: flex; justify-content: space-around; }
.stat-item { text-align: center; }
.stat-number { font-size: 24px; font-weight: 700; color: #e94560; }
.stat-label { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 4px; }

/* ===== 匹配页 ===== */
.setting-item { margin-bottom: 24px; }
.setting-label { font-size: 14px; color: rgba(255,255,255,0.7); margin-bottom: 12px; }
.gender-options { display: flex; gap: 12px; }
.gender-btn {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 14px;
  cursor: pointer;
}
.gender-btn.active {
  background: rgba(233,69,96,0.2);
  border-color: #e94560;
  color: #e94560;
}
.credits-info {
  display: flex;
  justify-content: space-between;
  padding: 12px 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.buy-link { color: #e94560; cursor: pointer; }
.start-btn { margin-top: 20px; }

.matching-area { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; }
.matching-animation {
  position: relative;
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 30px;
}
.pulse-circle {
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 2px solid #e94560;
  animation: pulse 2s infinite;
}
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1s; }
@keyframes pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.matching-icon { font-size: 50px; z-index: 1; }
.matching-text { font-size: 15px; color: rgba(255,255,255,0.8); margin-bottom: 30px; }
.cancel-btn { max-width: 200px; }

.matched-area { padding: 30px 16px; text-align: center; }
.matched-card { text-align: center; margin-bottom: 30px; }
.matched-avatar { display: flex; justify-content: center; margin-bottom: 16px; }
.matched-nickname { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.matched-bio { font-size: 14px; color: rgba(255,255,255,0.6); margin-bottom: 16px; }
.matched-tags { display: flex; flex-wrap: wrap; justify-content: center; }

/* ===== 聊天页 ===== */
.chat-container { display: flex; flex-direction: column; height: 100vh; }
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(26,26,46,0.95);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.header-info { display: flex; flex-direction: column; }
.partner-name { font-size: 16px; font-weight: 600; }
.typing-indicator { font-size: 11px; color: #e94560; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; }
.action-btn {
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.reveal-btn { background: rgba(233,69,96,0.2); color: #e94560; border: 1px solid #e94560; }
.friend-btn { background: rgba(76,175,80,0.2); color: #4caf50; border: 1px solid #4caf50; }
.close-btn { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.2); }

.message-list {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.message-tip { text-align: center; padding: 20px; }
.message-tip > div { font-size: 12px; color: rgba(255,255,255,0.4); margin-bottom: 4px; }

.message-item { display: flex; margin-bottom: 14px; }
.message-item.mine { justify-content: flex-end; }
.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.4;
}
.bubble-mine {
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  border-bottom-right-radius: 4px;
}
.bubble-other {
  background: rgba(255,255,255,0.1);
  border-bottom-left-radius: 4px;
}

.input-area {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: rgba(26,26,46,0.95);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.message-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  color: #fff;
  outline: none;
}
.message-input::placeholder { color: rgba(255,255,255,0.4); }
.send-btn {
  margin-left: 10px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 个人资料 ===== */
.profile-header { display: flex; align-items: center; gap: 16px; }
.profile-info { flex: 1; }
.profile-nickname { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.profile-bio { font-size: 13px; color: rgba(255,255,255,0.6); }

.edit-item { margin-bottom: 18px; }
.edit-label { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 8px; }
.edit-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: #fff;
  outline: none;
}
.save-btn { margin-top: 12px; }

.account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.account-item:last-child { border-bottom: none; }
.account-label { font-size: 14px; }
.account-value { font-size: 14px; color: #e94560; }
.account-arrow { color: rgba(255,255,255,0.4); }

/* ===== 商店 ===== */
.section { margin-bottom: 24px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; padding-left: 4px; }
.product-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.product-card {
  flex: 1 1 calc(50% - 5px);
  min-width: calc(50% - 5px);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.product-card.selected {
  border-color: #e94560;
  background: rgba(233,69,96,0.1);
}
.vip-card {
  background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(255,170,0,0.05));
  border-color: rgba(255,215,0,0.3);
}
.vip-card.selected {
  border-color: #ffd700;
  background: rgba(255,215,0,0.15);
}
.product-credits { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.product-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.product-price { font-size: 17px; color: #e94560; font-weight: 700; margin-bottom: 4px; }
.product-unit, .product-desc { font-size: 11px; color: rgba(255,255,255,0.5); }

.benefit-item { display: flex; align-items: center; padding: 6px 0; }
.benefit-icon { color: #4caf50; margin-right: 10px; }
.buy-area { padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); }
.buy-btn { max-width: 400px; margin: 0 auto; }

/* ===== 底部导航 ===== */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(26,26,46,0.98);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  backdrop-filter: blur(10px);
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
}
.tab-item.active { color: #e94560; }
.tab-icon { font-size: 22px; margin-bottom: 2px; }
.tab-label { font-size: 11px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; }
