/* ========== Design Tokens ========== */
:root {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --surface-light: #fafafa;
  --surface-hover: #eeeeee;
  --border: #e5e5e5;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #9a9a9a;
  --accent: #fed51b;
  --accent-dark: #e6b800;
  --accent-text: #1a1a1a;
  --pink: #ff6b9d;
  --purple: #af52de;
  --lavender: #bf5af2;
  --danger: #ff453a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #ffffff;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
}

textarea {
  resize: none;
}

/* ========== App Container ========== */
.app-container {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* ========== Top Header ========== */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #000000;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.icon-check {
  width: 20px;
  height: 20px;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-primary);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px 100px;
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar {
  display: none;
}

.page {
  display: none;
  animation: fadeIn 0.22s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Page Headers ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 10px 0 16px;
}

.page-header.stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.title-dot {
  color: var(--accent);
}

.header-meta {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ========== Search Box ========== */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 14px;
}

.search-box .icon-search {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
}

.search-box input::placeholder {
  color: var(--text-tertiary);
}

/* ========== Search History ========== */
.search-history {
  margin: -6px 0 14px;
}

.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-clear-history {
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
}

.search-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-history-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-history-item .history-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.search-history-item .history-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  margin-left: 2px;
  flex-shrink: 0;
}

/* ========== Filter Tags ========== */
.filter-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin-bottom: 18px;
  padding-bottom: 4px;
  padding-right: 40px;
}

.filter-tags::-webkit-scrollbar {
  display: none;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: all 0.15s ease;
}

.tag-pill .icon-star {
  width: 12px;
  height: 12px;
}

.tag-pill.active {
  background: var(--surface-hover);
  border-color: var(--border);
}

.tag-pill:active {
  transform: scale(0.96);
}

/* ========== Cards ========== */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.person-card,
.request-card,
.profile-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.person-card {
  cursor: pointer;
  transition: transform 0.1s ease;
}

.person-card:active {
  transform: scale(0.99);
}

/* 广场上不显示自己的资料卡（HTML hidden + JS hidden 双重兜底） */
#my-square-card,
#my-square-card[hidden] {
  display: none !important;
}

.request-card {
  border: 2px solid var(--pink);
}

/* ========== Avatars ========== */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  flex-shrink: 0;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.avatar-pink {
  background: var(--pink);
}

.avatar-purple {
  background: var(--purple);
  color: #ffffff;
}

.avatar-lavender {
  background: var(--lavender);
  color: #ffffff;
}

.avatar-gray {
  background: #e5e5ea;
  color: #000000;
}

.avatar-img {
  background-size: cover;
  background-position: center;
  color: transparent;
}

/* ========== Card Header ========== */
.card-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.card-meta {
  flex: 1;
  min-width: 0;
}

.card-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.card-name {
  font-size: 17px;
  font-weight: 700;
}

.status-badge {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-location {
  font-size: 13px;
  color: var(--text-secondary);
}

.homepage-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* ========== Tags ========== */
.card-tags,
.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ability-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.ability-tag .icon-diamond {
  width: 10px;
  height: 10px;
}

/* ========== Card Body ========== */
.card-bio {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 12px;
}

.wish-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(254, 213, 27, 0.12);
  border: 1px solid rgba(254, 213, 27, 0.35);
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  margin-bottom: 14px;
}

.wish-label {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
}

.wish-text {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ========== Card Actions ========== */
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-link {
  flex: 1;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-primary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  padding: 9px 16px;
}

.btn-outline {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 9px 14px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

.btn-lg {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
}

.btn-flex {
  flex: 1;
  padding: 11px 10px;
  font-size: 12px;
}

.btn-primary:active,
.btn-outline:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn-outline .icon-star {
  width: 13px;
  height: 13px;
}

.btn-favorite.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ========== Profile Card ========== */
.profile-card {
  position: relative;
  margin-bottom: 22px;
}

.profile-main {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-location {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-edit {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
}

/* ========== Section Title ========== */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 14px;
}

.section-title h2 {
  font-size: 17px;
  font-weight: 700;
}

.section-count {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========== Favorites ========== */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.favorite-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
}

.favorite-card .avatar {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

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

.favorite-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.favorite-location {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-card .avatar-img {
  background-size: cover;
  background-position: center;
}

.connection-tag {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
}

.connection-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
}

.connection-contact-label {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.connection-contact-value {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-connection {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-unfavorite {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.btn-unfavorite .icon-star {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.empty-hint {
  font-size: 14px;
  color: var(--text-tertiary);
  padding: 16px 4px;
}

/* ========== Request Card ========== */
.request-message {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-left: 4px;
}

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

.request-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.request-contact[hidden] {
  display: none;
}

.request-contact .contact-label {
  font-size: 13px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.request-contact .contact-value {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-contact .btn-copy {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ========== AI Page Specifics ========== */
.feature-card {
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 14px;
}

.story-card {
  border: 2px solid var(--pink);
  background: transparent;
}

.story-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.story-title .icon-book {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

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

.ai-notice {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  position: relative;
}

.ai-notice::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 28px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  transform: rotate(45deg);
}

.ai-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 14px;
  margin-bottom: 14px;
}

.ai-actions .icon-lightning,
.ai-actions .icon-book {
  width: 15px;
  height: 15px;
}

.story-btn {
  color: var(--pink);
  border-color: var(--pink);
  background: transparent;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 8px 8px 8px 14px;
  margin-top: 6px;
}

.chat-input-bar input {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.chat-input-bar input::placeholder {
  color: var(--text-tertiary);
}

.btn-send {
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
}

/* ========== Edit Profile Page ========== */
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 16px;
}

.edit-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-spacer {
  width: 40px;
}

.back-btn {
  width: 36px;
  height: 36px;
  margin-left: -8px;
}

.page-edit {
  padding-bottom: 20px;
}

.form-section {
  margin-bottom: 24px;
}

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

.form-label span:first-child,
.form-step-title span:last-child {
  font-size: 16px;
  font-weight: 700;
}

.form-hint {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.form-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.step-number {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
}

.form-field {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.form-field textarea {
  width: 100%;
  min-height: 90px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
}

.form-field textarea::placeholder {
  color: var(--text-tertiary);
}

.form-field.bordered {
  border-color: var(--accent);
}

/* Input fields */
.input-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.input-field input {
  flex: 1;
  font-size: 16px;
  color: var(--text-primary);
  background: transparent;
}

.input-field input::placeholder {
  color: var(--text-tertiary);
}

.input-clear {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--text-tertiary);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.count-badge {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
}

.required::after {
  content: " *";
  color: var(--pink);
}

.ability-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

.ability-category {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.ability-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.ability-option {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.ability-option small {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.ability-option.selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.ability-option.selected small {
  color: rgba(0, 0, 0, 0.65);
}

.ability-option.ability-custom-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 10px 12px;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border);
}

.ability-option.ability-custom-add:active {
  transform: scale(0.95);
  opacity: 0.8;
}

.ability-custom-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.ability-custom-form[hidden] {
  display: none !important;
}

.ability-custom-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.ability-custom-form input:focus {
  border-color: var(--accent);
}

.btn-ability-custom-confirm {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
  border: none;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-ability-custom-confirm:active {
  transform: scale(0.96);
  opacity: 0.9;
}

/* ========== Edit Page Additions ========== */
.page-edit {
  padding-bottom: 30px;
}

.form-section.compact {
  margin-bottom: 18px;
}

/* Avatar upload */
.avatar-section .form-label {
  margin-bottom: 12px;
}

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: 28px;
}

.avatar-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.avatar-uploader {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.avatar-uploader .avatar {
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.avatar-uploader::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.avatar-uploader:hover::after {
  opacity: 1;
}

.avatar-camera {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.avatar-camera svg {
  display: block;
}

/* Segmented control */
.segmented-control {
  display: flex;
  gap: 10px;
}

.segment {
  flex: 1;
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.segment.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* Tag input */
.tag-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tag-input-row .input-field {
  flex: 1;
}

.btn-generate {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-add-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.btn-add-tag .icon-plus {
  width: 14px;
  height: 14px;
}

/* Textarea with char count */
.textarea-count {
  position: relative;
  padding-bottom: 30px;
}

.textarea-count textarea {
  min-height: 110px;
}

.char-count {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Ability section header */
.ability-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
}

.ability-title .icon-sparkle {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* Ability options as grid */
.ability-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.ability-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
}

.ability-option small {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Save button */
.btn-save {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 17px;
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(217, 255, 0, 0.25);
}

.btn-save:active {
  opacity: 0.9;
  transform: scale(0.98);
}

/* ========== Bottom Navigation ========== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 8px 0 22px;
  z-index: 100;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 18px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-item.active {
  color: var(--accent);
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
}

.badge-dot {
  position: absolute;
  top: 2px;
  right: 18px;
  min-width: 16px;
  height: 16px;
  background: var(--pink);
  color: #ffffff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  z-index: 2;
}

.locked-nav .nav-item {
  color: rgba(26, 26, 26, 0.7);
}

.locked-nav .nav-icon {
  width: 20px;
  height: 20px;
}

/* ========== Person Detail Modal ========== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-sheet {
  width: 100%;
  max-height: 88vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px 18px;
}

.modal-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.modal-meta {
  flex: 1;
  min-width: 0;
}

.modal-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-location {
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.modal-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.modal-wish {
  margin-top: 0;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 12px 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.modal-footer .btn-flex {
  flex: 1;
  justify-content: center;
}

/* ========== Story Modal ========== */
.modal-footer .btn-outline,
.modal-footer .btn-primary {
  flex: 1;
  justify-content: center;
}

.story-hint {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.story-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.story-textarea::placeholder {
  color: var(--text-tertiary);
}

.story-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(254, 213, 27, 0.2);
}

.story-count {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 8px;
}

/* ========== Match Modal ========== */
.match-hint {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.match-hint.error {
  color: #d23b3b;
}

.match-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.match-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--bg);
}

.match-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.match-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.match-name {
  font-size: 16px;
  font-weight: 800;
}

.match-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.match-score {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #000;
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.match-reason {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.match-empty {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px 0;
}

/* ========== Signup / Pending (invite gate) ========== */
.pending-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 16px;
  margin: 10px 0 18px;
}
.pending-phone {
  font-size: 14px;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.pending-phone span {
  font-weight: 700;
}
.pending-tip {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin: 0;
}

/* ========== Utilities ========== */
[hidden] {
  display: none !important;
}

/* ========== Responsive tweaks for desktop preview ========== */
@media (min-width: 431px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .app-container {
    min-height: 100vh;
    height: 100vh;
  }
}

/* ========== Login Page ========== */
.login-page {
  padding-top: 0;
}

.login-inner {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 40px);
  padding: 52px 6px 36px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #000000;
  margin-bottom: 54px;
}

.login-brand .icon-check {
  width: 26px;
  height: 26px;
}

.login-head {
  margin-bottom: 34px;
}

.login-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.login-sub {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  transition: border-color 0.15s ease;
}

.login-field:focus-within {
  border-color: var(--accent);
}

.login-field-area {
  align-items: stretch;
  padding: 6px 8px;
}

.login-field-area textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  resize: none;
  padding: 8px 6px;
  font-family: inherit;
  line-height: 1.5;
}

.login-field-area textarea::placeholder {
  color: var(--text-tertiary);
}

.login-prefix {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.login-field-icon {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.login-field input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  color: var(--text-primary);
  background: transparent;
}

.login-field input::placeholder {
  color: var(--text-tertiary);
}

.login-field-otp {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
}
.login-field-otp input {
  flex: 1;
  min-width: 0;
}
.btn-send-code {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #d99e00;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-send-code:disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.pwd-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.pwd-toggle svg {
  width: 20px;
  height: 20px;
}

.pwd-toggle.show {
  color: var(--text-primary);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: -4px 2px 0;
  line-height: 1.4;
}

.btn-login {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 17px;
  font-weight: 700;
  margin-top: 6px;
  box-shadow: 0 4px 16px rgba(254, 213, 27, 0.3);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-login:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.login-hint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.5;
}

.login-switch {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.text-link {
  display: inline;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  padding: 0;
  margin-left: 4px;
  text-decoration: none;
  background: transparent;
}

.text-link:active {
  opacity: 0.8;
}

/* ========== Logout Button (我的页) ========== */
.btn-logout {
  width: 100%;
  margin-top: 30px;
  padding: 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-logout:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* ========== Onboarding Page ========== */
.onboarding-page {
  padding-top: 0;
}

.onboarding-inner {
  padding: 40px 6px 36px;
  min-height: calc(100vh - 40px);
}

.onboarding-head {
  position: relative;
  margin-bottom: 28px;
}

.btn-onboarding-logout {
  position: absolute;
  top: 0;
  right: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-onboarding-logout:active {
  background: var(--surface);
  transform: scale(0.97);
}

.onboarding-step {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.onboarding-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.onboarding-sub {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.onboarding-section {
  display: flex;
  flex-direction: column;
}

.onboarding-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.onboarding-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.onboarding-count {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}

.onboarding-field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.onboarding-field input,
.onboarding-field textarea {
  width: 100%;
  font-size: 15px;
  color: var(--text-primary);
  background: transparent;
}

.onboarding-field input::placeholder,
.onboarding-field textarea::placeholder {
  color: var(--text-tertiary);
}

.onboarding-field textarea {
  min-height: 90px;
  line-height: 1.6;
  resize: none;
}

.onboarding-field:focus-within {
  border-color: var(--accent);
}

.status-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-option {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.status-option.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.onboarding-abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.onboarding-abilities .ability-option {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.onboarding-abilities .ability-option.selected {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.onboarding-abilities .ability-option.onboarding-ability-add {
  min-width: 40px;
  padding: 8px 12px;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border);
}

.onboarding-abilities .ability-option.onboarding-ability-add:active {
  transform: scale(0.95);
  opacity: 0.8;
}

.onboarding-ability-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.onboarding-ability-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.onboarding-ability-form input:focus {
  border-color: var(--accent);
}

.btn-ability-confirm {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
  border: none;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-ability-confirm:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.onboarding-error {
  color: var(--danger);
  font-size: 13px;
  margin: -6px 2px 0;
  line-height: 1.4;
}

.btn-onboarding {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 17px;
  font-weight: 700;
  margin-top: 4px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(254, 213, 27, 0.3);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-onboarding:active {
  transform: scale(0.98);
  opacity: 0.9;
}

