/* ============================================================
   两心 · Together 设计系统
   暖白 / 纯白 / 墨黑 / 陶土红，克制、干净、有呼吸感。
   ============================================================ */

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

:root {
  --bg: #f5f4f1;
  --surf: #ffffff;
  --ink: #17181b;
  --brand: #be5b41;
  --line: #e9e5df;

  --ink-2: #63656c;
  --ink-3: #a2a4ab;
  --brand-deep: #a44c34;
  --brand-soft: rgba(190, 91, 65, 0.12);

  --radius: 18px;
  --radius-sm: 12px;

  --shadow: 0 18px 48px rgba(23, 24, 27, 0.07), 0 2px 10px rgba(23, 24, 27, 0.04);
  --shadow-sm: 0 6px 20px rgba(23, 24, 27, 0.06);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --maxw: 480px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#app { min-height: 100vh; }

/* ---------- 布局 ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
}

.appbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  position: sticky;
  top: 0;
  background: rgba(245, 244, 241, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(190, 91, 65, 0.28);
}
.btn-primary:hover { background: var(--brand-deep); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.btn-ghost {
  height: auto;
  padding: 8px 4px;
  color: var(--ink-2);
  font-size: 15px;
}
.btn-ghost:hover { color: var(--brand); }

.btn-block { width: 100%; }

/* ---------- 输入框 ---------- */
.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surf);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--ink-3); }
.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}

/* ---------- 分段控件 ---------- */
.seg {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  font-family: var(--font);
}
.seg button.active {
  background: var(--surf);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- 品牌 ---------- */
.brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), #d17a5d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 14px 30px rgba(190, 91, 65, 0.34);
}

/* ---------- 排版 ---------- */
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.3; }
.h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.35; }
.sub { color: var(--ink-2); font-size: 15px; }
.muted { color: var(--ink-3); font-size: 13px; }
.kicker { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }

/* ---------- 邀请码 ---------- */
.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--brand);
  text-align: center;
}

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease;
  cursor: pointer;
}
.list-item:active { transform: scale(0.985); }
.list-item .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.list-item .title { font-weight: 600; font-size: 15px; }
.list-item .chevron { color: var(--ink-3); font-size: 18px; }

/* ---------- 提示 / 错误 ---------- */
.notice {
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
}
.error-text { color: #c0392b; font-size: 13px; }

/* ---------- 工具类 ---------- */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.gap-12 { display: flex; flex-direction: column; gap: 12px; }
.gap-16 { display: flex; flex-direction: column; gap: 16px; }
.center { text-align: center; }
.grow { flex: 1; }
.footer-text {
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  margin-top: auto;
  padding-top: 40px;
  letter-spacing: 0.3px;
}

/* ---------- 加载指示 ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ---------- 视图辅助 ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}
.brand-sub { letter-spacing: 4px; }
.tagline { max-width: 280px; line-height: 1.75; }
.appbar-title { font-weight: 700; font-size: 16px; }
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink-3);
  text-transform: uppercase;
}
.partner-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 600;
}
.input-code { text-transform: uppercase; letter-spacing: 4px; }
.link { color: var(--brand); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- 业务视图辅助 ---------- */
.textarea {
  height: auto;
  min-height: 120px;
  padding: 14px 16px;
  line-height: 1.6;
  resize: vertical;
}
.breath-circle {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--brand-soft), var(--brand));
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.28); }
}
.upload-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.avatar-preview {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
}
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-msg {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
}
.chat-msg.ai { align-self: flex-start; background: var(--surf); border: 1px solid var(--line); }
.chat-msg.me { align-self: flex-end; background: var(--brand); color: #fff; }
