/* ============================================
   tongue-api H5 前端样式（Phase 0）
   品牌色通过 CSS 变量 --brand 动态注入
   ============================================ */
:root {
  --brand: #00665B;
  --brand-dark: #005048;
  --brand-light: #E6F2EF;
  --bg: #FAF6EE;
  --card: #FFFFFF;
  --text: #2B2B2B;
  --text-sub: #8A8578;
  --line: #EFE7D8;
  --cta: #C93A3A;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #F2E9D8 100%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px 32px;
  position: relative;
}

/* ---------- 通用视图 ---------- */
.view { animation: fadeIn .35s ease; }
.view[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 首页：品牌区 ---------- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 20px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--brand-light);
  border: 2px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
}

.brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.brand-name {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.brand-slogan {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-sub);
}

/* ---------- 首页：主卡片 ---------- */
.hero-card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(80, 60, 30, .08);
  margin-bottom: 24px;
}

.hero-icon { font-size: 52px; line-height: 1; }

.hero-title {
  margin-top: 14px;
  font-size: 21px;
  font-weight: 700;
}

.hero-desc {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-sub);
}

/* ---------- 首页：步骤 ---------- */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.step { display: flex; flex-direction: column; align-items: center; width: 76px; }

.step-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 4px 10px rgba(80, 60, 30, .10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.step-name { margin-top: 8px; font-size: 13px; color: var(--text-sub); }

.step-arrow { color: var(--brand); font-size: 20px; margin: 0 6px 24px; font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn-primary, .btn-cta {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border: none;
  border-radius: 50px;
  padding: 15px 24px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}

.btn-primary:active, .btn-cta:active { transform: scale(.96); opacity: .9; }
.btn-primary:disabled { opacity: .5; pointer-events: none; }

.btn-secondary {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 12px auto 0;
  border: 1.5px solid var(--brand);
  border-radius: 50px;
  padding: 13px 24px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--brand);
  background: transparent;
  cursor: pointer;
  transition: background .15s;
}

.btn-secondary:active { background: var(--brand-light); }

.btn-again { margin-top: 18px; }

/* 首页「我的历史报告」入口 */
.btn-history { margin-top: 14px; }

/* 结果页：报告信息行 */
.result-meta {
  text-align: center;
  font-size: 12px;
  color: var(--text-soft, #8A8A80);
  margin: 4px 0 14px;
}

/* 结果页：复制报告链接 */
.btn-copy-link {
  margin-top: 22px;
  font-size: 14px;
  letter-spacing: 1px;
}

/* ---------- 历史报告列表 ---------- */
.history-tip {
  font-size: 12px;
  color: #B8B09F;
  margin-bottom: 14px;
  line-height: 1.6;
}

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  cursor: pointer;
  transition: transform .12s;
}
.history-item:active { transform: scale(.97); }

.hi-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hi-type { font-size: 15px; font-weight: 700; color: var(--brand); }
.hi-shop { font-size: 12px; color: var(--text-soft, #8A8A80); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-date { font-size: 11px; color: #B8B09F; flex-shrink: 0; }

.empty-tip {
  text-align: center;
  color: #B8B09F;
  font-size: 13px;
  line-height: 1.9;
  padding: 40px 0;
}

/* ---------- 免责声明 ---------- */
.disclaimer {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: #B8B09F;
}

/* ---------- 拍照页 ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-head h2 { font-size: 18px; font-weight: 700; }

.btn-back {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--card);
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  cursor: pointer;
}

.page-head-spacer { width: 36px; }

.guide-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(80, 60, 30, .08);
  margin-bottom: 16px;
}

.guide-art { text-align: center; padding: 4px 0 10px; }
.guide-art svg { width: 190px; max-width: 100%; height: auto; }

/* ---------- 选填信息（性别/年龄 chips） ---------- */
.info-card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(80, 60, 30, .08);
  margin-bottom: 16px;
}

.info-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 10px;
}

.chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip-row:last-child { margin-bottom: 2px; }

.chip-title {
  font-size: 13px;
  color: var(--text-sub);
  min-width: 32px;
}

.chip {
  border: 1.5px solid #D8CCB4;
  background: #FAF7F0;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: all .15s;
}
.chip.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
.chip:active { transform: scale(.95); }

.guide-list { list-style: none; }
.guide-list li {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
  padding: 5px 0 5px 22px;
  position: relative;
}
.guide-list li::before {
  content: "✔";
  position: absolute;
  left: 2px;
  color: var(--brand);
  font-size: 12px;
}

.photo-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: #F3EEE2;
  border: 2px dashed #D8CCB4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.photo-placeholder { text-align: center; color: #B8B09F; }
.photo-icon { font-size: 44px; margin-bottom: 8px; }
.photo-placeholder p { font-size: 13px; margin-bottom: 10px; }
.photo-tips {
  list-style: none;
  text-align: left;
  display: inline-block;
  margin: 0 auto;
  padding: 8px 12px;
  background: rgba(255,255,255,0.55);
  border-radius: 10px;
  font-size: 11.5px;
  color: #7A7262;
  line-height: 1.7;
}
.photo-tips li { padding-left: 14px; position: relative; }
.photo-tips li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-weight: 700;
}

#photoPreview { width: 100%; height: 100%; object-fit: cover; }

.btn-group { text-align: center; }

/* ---------- 加载动画 ---------- */
.loading {
  margin-top: 26px;
  text-align: center;
  animation: fadeIn .3s;
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 4px solid var(--brand-light);
  border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}

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

.loading-text { font-size: 15px; font-weight: 600; color: var(--text); }
.loading-sub { margin-top: 6px; font-size: 12px; color: var(--text-sub); }

/* ---------- 结果页 ---------- */
.result-badge {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  margin: 6px 0 10px;
}

.result-type {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.result-card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(80, 60, 30, .07);
  margin-bottom: 14px;
  text-align: left;
}

.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }

.card-body { font-size: 14px; line-height: 1.8; color: #4A463D; }
.card-body p { margin-bottom: 6px; }
.card-body p:last-child { margin-bottom: 0; }

/* CTA 卡片 */
.cta-card {
  margin-top: 22px;
  background: linear-gradient(135deg, #FFF7E8 0%, #FFEFD6 100%);
  border: 1.5px solid #F0D9AE;
  border-radius: 18px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(180, 130, 40, .12);
}

.cta-title { font-size: 16px; font-weight: 700; color: #8A5A1E; }
.cta-desc { margin-top: 6px; font-size: 12.5px; color: #A07F4E; }

.btn-cta {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--cta) 0%, #A92C2C 100%);
  box-shadow: 0 6px 18px rgba(201, 58, 58, .30);
  animation: pulse 2s infinite;
  font-size: 16px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.cta-tip { margin-top: 10px; font-size: 12px; color: #A07F4E; }

/* 留资卡（顾客可选输入手机号，把报告以短信发给自己） */
.lead-card { border: 1.5px solid #D4E8D4; background: #F6FBF6; }
.lead-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.lead-input {
  flex: 1; min-width: 0; height: 44px; border-radius: 10px;
  border: 1.5px solid #D0D0C8; background: #fff;
  padding: 0 12px; font-size: 15px; color: var(--text);
  outline: none; -webkit-appearance: none;
}
.lead-input:focus { border-color: var(--brand); }
.lead-btn {
  flex-shrink: 0; height: 44px; padding: 0 18px; border: none;
  border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.lead-btn:active { opacity: 0.8; }
.lead-btn:disabled { opacity: 0.5; }
.lead-note { font-size: 13px; color: #2F7A2F; margin-bottom: 6px; font-weight: 600; }
.lead-note.err { color: #C93A3A; }
.lead-privacy { font-size: 11.5px; color: #B0AB9C; margin-top: 4px; }

/* 商家二维码（微信/美团，顾客报告页展示） */
/* 商家双码：上下竖排，每码独立大卡，避免微信长按识别互相干扰 */
.shop-qr-row { display: flex; flex-direction: column; gap: 20px; }
.shop-qr-item {
  width: 100%;
  text-align: center;
  background: #FAF7F1;
  border: 1.5px dashed #E5DFD2;
  border-radius: 14px;
  padding: 14px 10px;
}
.shop-qr-item img {
  max-width: 100%;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid #EDE7DA;
  border-radius: 12px;
  display: block;
  margin: 0 auto 12px;
  padding: 12px;
  box-sizing: border-box;
}
.shop-qr-item .qr-tag { font-size: 13px; font-weight: 700; color: var(--brand-dark); margin-bottom: 10px; }
.shop-qr-item p { font-size: 12px; color: #6B665A; line-height: 1.5; }

/* 结果页免责声明 */
.result-disclaimer {
  margin: 6px 0 22px;
  font-size: 11.5px;
  color: #B0A998;
  text-align: center;
  line-height: 1.7;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, .88);
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 50px;
  white-space: nowrap;
  z-index: 999;
  animation: fadeIn .25s;
  max-width: 90%;
  white-space: normal;
  text-align: center;
}

/* ============ 店家数据看板 ============ */
.form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border, #dde5dd);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #222;
}
.form-input:focus { outline: none; border-color: #00665B; }
.dash-usage {
  background: #F3FAF7;
  border: 1px solid #D5EBE2;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.dash-usage-txt { font-size: 13px; color: #222; margin-bottom: 8px; }
.dash-usage-txt b { color: #00665B; font-size: 16px; }
.dash-bar {
  height: 8px;
  background: #E2EEE9;
  border-radius: 99px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2BA87F, #00665B);
  border-radius: 99px;
  transition: width .4s ease;
}
.dash-bar-fill.warn { background: linear-gradient(90deg, #E8A13A, #C98A1B); }
.dash-bar-fill.full { background: linear-gradient(90deg, #E05B5B, #C93A3A); }
/* ============ 店家数据看板 · 报告列表折叠 ============ */
.dash-report {
  background: #fff;
  border: 1px solid var(--border, #e5ebe5);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.dash-report-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dash-report-h:active { background: #f7f9f7; }
.dash-type { font-weight: 700; color: #00665B; font-size: 13px; }
.dash-date {
  color: #888;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dash-toggle {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(90deg, #2BA87F, #00665B);
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,102,91,.35);
}
.dash-toggle.open {
  background: linear-gradient(90deg, #E8A13A, #C98217);
  color: #fff;
  box-shadow: 0 1px 3px rgba(201,130,23,.35);
}
.dash-report-body {
  padding: 0 12px 12px;
  border-top: 1px solid #f0f3f0;
  animation: fadeIn .25s ease;
}
.dash-report-body .dash-sec { margin-top: 10px; }
.dash-report-body .dash-sec:first-child { margin-top: 8px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dash-sec { margin-top: 10px; }
.dash-sec:first-child { margin-top: 8px; }
.dash-sec-t { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
.dash-sec-c {
  font-size: 12px;
  color: #444;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============ 顾客端报告海报 ============ */
.btn-copy-link { width: 100%; }
#posterBox { margin-top: 12px; text-align: center; }
.poster-save-tip { font-size: 12px; color: #999; margin-top: 6px; }
.poster-preview-img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 6px auto 0;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 60, 45, 0.28);
}
.poster {
  position: relative;
  width: 360px;
  min-height: 480px;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 60, 45, 0.28);
  box-sizing: border-box;
  background: #0A2E28;
}
.poster-offscreen {
  position: absolute;
  left: -9999px;
  top: -9999px;
  z-index: -1;
}
.poster .p-bg {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
.poster .p-overlay {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0, 24, 20, 0.52);
  z-index: 1;
}
.poster .p-content {
  position: relative;
  z-index: 2;
  padding: 26px 18px 16px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.poster .p-brand { font-size: 11px; letter-spacing: 4px; opacity: 0.92; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.poster .p-name { font-size: 19px; font-weight: 800; margin-top: 10px; line-height: 1.4; word-break: break-all; text-shadow: 0 2px 6px rgba(0,0,0,.45); }
.poster .p-type {
  font-size: 24px;
  font-weight: 800;
  margin-top: 14px;
  color: #F3DE9A;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,.55);
}
.poster .p-slogan { font-size: 14px; margin-top: 10px; line-height: 1.7; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.poster .p-qr {
  display: inline-block;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  margin-top: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.poster .p-qr canvas, .poster .p-qr img { display: block; width: 112px; height: 112px; }
.poster .p-tip { font-size: 11.5px; margin-top: 10px; letter-spacing: 2px; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.poster .p-footer {
  margin-top: auto;
  padding-top: 10px;
  font-size: 10px;
  opacity: 0.85;
  letter-spacing: 3px;
  width: 100%;
}
