/* 北美电子人民广场 — 全局样式（移动端优先） */
:root {
  --bg: #faf6ee;            /* 米白 / 暖 beige 底 */
  --bg-deep: #f3ecdf;
  --card: #ffffff;
  --primary: #c0392b;       /* 朱红 */
  --primary-dark: #9c2b20;
  --coral: #e8735a;         /* 珊瑚红点缀 */
  --gold: #a5761a;
  --gold-bg: #faf0d7;
  --text: #33312d;          /* 深灰文字 */
  --muted: #8b857a;
  --border: #e9e0d0;
  --shadow: 0 2px 14px rgba(120, 88, 55, 0.09);
  --radius: 14px;
  --tabbar-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

/* 内容容器：移动端优先，桌面居中 */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 24px rgba(120, 88, 55, 0.08);
  padding-bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
}

.app.no-tabbar { padding-bottom: 24px; }

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 246, 238, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.topbar .sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

main { padding: 14px 14px 0; }

/* 面板 / tab 切换 */
.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(233, 224, 208, 0.6);
}
.card h2 {
  margin: 0 0 10px;
  font-size: 16px;
}
.card h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: -2px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.28);
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  width: 100%;
}

.btn-small {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 10px;
  width: auto;
}
.btn-like { background: var(--primary); color: #fff; flex: 1; }
.btn-like:hover { background: var(--primary-dark); }
.btn-pass { background: var(--bg-deep); color: var(--text); flex: 1; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label, .field > .label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field .req { color: var(--primary); }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 88px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }

.radio-row { display: flex; gap: 10px; }
.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  background: #fff;
  min-height: 48px;
}
.radio-card input { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: #fdf1ee;
  font-weight: 600;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-size: 15px;
  cursor: pointer;
}
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); }

.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.error-text { font-size: 13px; color: var(--primary); margin: 6px 0 0; }

/* 落地页 hero */
.hero {
  text-align: center;
  padding: 40px 24px 28px;
  background: linear-gradient(180deg, #fff8f0 0%, var(--bg) 100%);
}
.seal {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(192, 57, 43, 0.35);
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0.08em;
}
.slogan {
  margin: 0 0 22px;
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.12em;
}
.intro-list {
  list-style: none;
  margin: 0 auto 4px;
  padding: 0;
  max-width: 340px;
  text-align: left;
}
.intro-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid rgba(233, 224, 208, 0.6);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 14px;
}
.intro-list .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  margin-top: 7px;
}
.intro-list strong { display: block; font-size: 15px; }
.intro-list span { color: var(--muted); }

.auth-card { margin: 6px 14px 0; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.auth-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* 候选人卡片 */
.person-card { position: relative; }
.person-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.person-name { font-size: 18px; font-weight: 700; }
.person-meta { color: var(--muted); font-size: 14px; }
.person-line { font-size: 14px; margin: 4px 0; }
.person-intro {
  font-size: 14px;
  color: #5b564d;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 0;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.badge-t5 { background: var(--gold-bg); color: var(--gold); border: 1px solid #e5d3a3; }
.badge-a9 { background: #fbe9e4; color: var(--primary); border: 1px solid #f0c4b8; }
.badge-demo { background: #efece6; color: var(--muted); border: 1px solid #ddd6c8; }

/* 状态 chip */
.status-chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.status-pending { background: #fdf3e0; color: #a5761a; }
.status-liked { background: #fbe9e4; color: var(--primary); }
.status-matched { background: #e7f4e4; color: #2e7d32; }
.status-passed { background: #efece6; color: var(--muted); }

.rec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.rec-item:last-child { border-bottom: none; }
.rec-info .name { font-weight: 700; font-size: 15px; }
.rec-info .meta { font-size: 13px; color: var(--muted); }
.rec-time { font-size: 12px; color: var(--muted); }

/* 邀请码 */
.invite-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px dashed var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.invite-code {
  flex: 1;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-family: ui-monospace, monospace;
  word-break: break-all;
}

/* 底部 tab 栏 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border);
  z-index: 30;
}
.tabbar button {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  position: relative;
}
.tabbar button .tab-icon { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--primary); font-weight: 700; }
.tabbar button.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}
.tabbar button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* 空状态 */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 20px;
  font-size: 14px;
}
.empty .empty-icon { font-size: 40px; display: block; margin-bottom: 10px; }

/* 加载中 */
.loading { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  max-width: min(440px, calc(100vw - 40px));
  background: rgba(51, 49, 45, 0.94);
  color: #fff;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 聊天 */
.chat-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-picker button {
  flex: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  min-height: 40px;
}
.chat-picker button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px 12px;
  min-height: 220px;
}
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg-who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  word-break: break-word;
}
.msg.mine .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.msg.theirs .bubble {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.msg-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

.chat-form {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 8px 0 4px;
}
.chat-form input { flex: 1; min-width: 0; }
.chat-form .btn { width: auto; min-height: 48px; }

/* 屏幕阅读器专用 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 桌面端微调 */
@media (min-width: 520px) {
  body { padding: 24px 0; }
  .app { border-radius: 20px; min-height: calc(100dvh - 48px); overflow: hidden; }
  .tabbar { border-radius: 0 0 20px 20px; overflow: hidden; }
}

/* 桌面宽屏：内容区放宽，不再只占 1/3 屏宽（手机端仍保持 480px） */
@media (min-width: 900px) {
  .app { max-width: 1140px; }
}

/* 广场男女分子 tab */
.subtabs {
  display: flex;
  gap: 8px;
  padding: 4px 2px 12px;
}
.subtabs button {
  flex: 1;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  min-height: 40px;
}
.subtabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* 自动匹配 A：般配度分数条 */
.match-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
}
.match-score-num {
  font-weight: 700;
  color: #c2410c;
  font-size: 15px;
  white-space: nowrap;
}
.match-score-reasons {
  font-size: 12px;
  color: #9a3412;
}
.best-hint {
  font-size: 13px;
  color: #666;
  padding: 2px 2px 10px;
}

/* 密码框小眼睛 */
.password-wrap { position: relative; }
.password-wrap input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: none; font-size: 18px; line-height: 1;
  padding: 8px; cursor: pointer; opacity: 0.65;
}
.password-toggle:active { opacity: 1; }

/* 头像照片 */
.person-head { align-items: center; }
.person-photo {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; flex: none;
  background: #eee;
}
.photo-preview {
  display: block; width: 110px; height: 110px; border-radius: 50%;
  object-fit: cover; margin-top: 8px; background: #eee;
}
.photo-preview[hidden] { display: none; }

/* 自定义文件选择按钮：原生按钮文字跟浏览器语言走，无法随页面语言切换，故用 label + 文件名文案代替 */
.file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px;
  border: 1px solid #ccc; border-radius: 10px; background: #fff; color: #333;
  font-size: 14px; font-weight: 600; cursor: pointer; flex: none;
}
.file-btn:hover { background: #f5f5f5; }
.file-name { color: #666; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 牵手动态 */
.activity-line {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid #f0f0f0;
  font-size: 13px; color: #888;
}
.badge-a8 { background: #fef3e2; color: #b45309; border: 1px solid #f0d9a8; }

.register-note { background: #fff8e7; border: 1px solid #e8c87a; }
.register-note h2 { font-size: 16px; margin: 0 0 8px; }
.register-note ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.8; }
.register-note li { margin: 2px 0; }

/* 站长管理页候选人表格（Excel 式：一行一位候选人，横向可滚动） */
.table-wrap { overflow-x: auto; margin: 12px 0; }
.admin-table { border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.admin-table th, .admin-table td { border: 1px solid #e0e0e0; padding: 6px 10px; text-align: left; }
.admin-table thead th { background: #f5f5f5; }
.admin-table td.long-text { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.admin-table td.actions { white-space: nowrap; }
.admin-table td.plaza-photo { padding: 4px 6px; }
.admin-table img.plaza-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; display: block; }

/* 语言切换：默认中文，html.lang-en 时只显示英文 */
.i18n-en { display: none; }
html.lang-en .i18n-zh { display: none; }
html.lang-en .i18n-en { display: inline; }
.lang-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; flex-shrink: 0; background: #fff; }
.lang-toggle button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.lang-toggle button.active { background: var(--primary); color: #fff; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-titles { min-width: 0; }
.hero .lang-toggle { margin-top: 10px; }
