/* ── 设计变量 ─────────────────────────────── */
:root {
  --primary:       #0EA5E9;
  --primary-dark:  #0284C7;
  --primary-light: #E0F2FE;
  --bg:            #F0F9FF;
  --card:          #FFFFFF;
  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;
  --border:        #E2E8F0;
  --success:       #22C55E;
  --danger:        #EF4444;
  --radius:        18px;
  --radius-sm:     10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

/* ── 基础 ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ── 加载 ─────────────────────────────────── */
.loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 页面骨架 ─────────────────────────────── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── 通用卡片 ─────────────────────────────── */
.card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ── 品牌 header ──────────────────────────── */
.brand-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 8px;
}
.brand-logo {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .02em;
}

/* ── 文本页 ───────────────────────────────── */
.text-card {
  padding: 28px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.text-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.text-icon svg { width: 28px; height: 28px; color: var(--primary); }

.text-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.text-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  width: 100%;
  text-align: left;
  background: #F8FAFC;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

/* ── 名片页 ───────────────────────────────── */
.vcard-card { padding: 28px 24px 24px; }

.vcard-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.vcard-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.vcard-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── 名片字段行 ───────────────────────────── */
.vcard-fields { display: flex; flex-direction: column; gap: 2px; }

.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.field-row:last-child { border-bottom: none; }
.field-row:is(a):active { background: var(--bg); }

.field-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}
.field-icon.phone   { background: #DCFCE7; }
.field-icon.email   { background: #FEF9C3; }
.field-icon.website { background: #DBEAFE; }
.field-icon.company { background: #F3E8FF; }
.field-icon.address { background: #FFE4E6; }
.field-icon.title   { background: #FFEDD5; }

.field-info { flex: 1; min-width: 0; }
.field-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 1px;
}
.field-value {
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.field-row .field-value { color: var(--primary); }

.field-chevron { color: var(--text-light); font-size: 12px; }

/* ── 按钮 ─────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .85; transform: scale(.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.btn-copy { composes: btn btn-secondary from global; }

/* ── 扫码次数 ─────────────────────────────── */
.scan-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--card);
  border-radius: 20px;
  padding: 6px 14px;
  box-shadow: var(--shadow);
}
.scan-badge svg { width: 14px; height: 14px; }

/* ── 底部品牌 ─────────────────────────────── */
.powered-by {
  font-size: 12px;
  color: var(--text-light);
}
.powered-by a { color: var(--primary); text-decoration: none; }

/* ── 错误 / 404 ───────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
}
.error-icon { font-size: 64px; line-height: 1; }
.error-title { font-size: 20px; font-weight: 700; color: var(--text); }
.error-desc  { font-size: 15px; color: var(--text-muted); line-height: 1.5; }

/* ── Toast ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(15,23,42,.9);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 24px;
  transition: transform .25s ease, opacity .25s ease;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
