/* =====================================================================
 * 调调系列 · 色彩人格香水测试 —— 样式
 * ===================================================================== */
:root {
  --bg: #F7F4EF;
  --card: #FFFFFF;
  --ink: #2E2A26;
  --ink-soft: #6E6659;
  --line: #E7E1D6;
  --accent: #9E2B33;
  --accent-soft: #F6E7E4;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(60, 50, 40, .08);
  font-size: 16px;
}

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

[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 字号兜底：微信「设置 → 通用 → 字体大小」会强行放大 H5 的文字，
     页面在微信里"看起来不对"多半是这个。用 !important 压掉放大。 */
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  -webkit-tap-highlight-color: transparent;
  /* 版面固定：只允许纵向滑动 —— 双击不再触发放大，双指捏合也被禁掉 */
  touch-action: pan-y;
  overscroll-behavior-y: none;           /* 关掉微信里的下拉回弹/下拉刷新感 */
}

html { height: 100%; }
body {
  /* 手机铺满、平板/桌面居中，最大 520px */
  max-width: min(100%, 520px);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;                    /* 杜绝横向滚动 */
}
img { max-width: 100%; }
/* pan-y 而不是 manipulation：manipulation 仍允许双指缩放，pan-y 才彻底禁掉 */
button, a, label { touch-action: pan-y; -webkit-user-select: none; user-select: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
           10px calc(16px + env(safe-area-inset-left));
  background: rgba(247, 244, 239, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand {
  font-size: .82rem; letter-spacing: .1em; color: var(--ink-soft); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-btn { flex-shrink: 0; }

.music-btn {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
  color: var(--ink-soft); font-size: .8rem;
  transition: box-shadow .2s;
}
.music-btn:active { box-shadow: 0 0 0 4px rgba(158, 43, 51, .08); }
.music-btn .music-icon { font-size: .9rem; }
.music-bars { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.music-bars i {
  width: 3px; background: var(--accent); border-radius: 2px;
  height: 4px; opacity: .35;
}
.music-btn.playing .music-bars i { opacity: 1; animation: bar 0.9s ease-in-out infinite; }
.music-btn.playing .music-bars i:nth-child(2) { animation-delay: .2s; }
.music-btn.playing .music-bars i:nth-child(3) { animation-delay: .4s; }
@keyframes bar { 0%,100% { height: 4px; } 50% { height: 12px; } }

/* ---------- 屏幕切换 ---------- */
.screen {
  display: none;
  padding: 22px calc(18px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom))
           calc(18px + env(safe-area-inset-left));
  animation: fadeUp .45s ease;
}
.screen.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 封面 ---------- */
.intro-hero { text-align: center; padding: 26px 0 18px; }
.intro-dots { display: flex; justify-content: center; gap: 10px; margin-bottom: 22px; }
.intro-dots span {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c); animation: bob 2.4s ease-in-out infinite;
}
.intro-dots span:nth-child(odd) { animation-delay: .5s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.intro-title {
  font-size: clamp(1.75rem, 7.4vw, 2.15rem); line-height: 1.25;
  font-weight: 700; letter-spacing: .06em;
}
.intro-sub { margin-top: 12px; color: var(--ink-soft); font-size: clamp(.86rem, 3.6vw, .95rem); }

.intro-cards { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 26px; }
.intro-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.intro-card h3 { font-size: .95rem; margin-bottom: 6px; color: var(--accent); }
.intro-card p { font-size: .85rem; line-height: 1.75; color: var(--ink-soft); }
.intro-foot { text-align: center; margin-top: 14px; font-size: .78rem; color: #A79C8C; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: block; width: 100%; min-height: 50px; padding: 15px;
  background: var(--ink); color: #fff; border: none; border-radius: 999px;
  font-size: clamp(.95rem, 3.9vw, 1rem); font-weight: 600; letter-spacing: .1em; cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.btn-primary:active { transform: scale(.97); opacity: .9; }
.btn-primary.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-ghost {
  display: block; width: 100%; margin-top: 2px; padding: 10px;
  background: transparent; border: none; color: var(--ink-soft);
  font-size: .88rem; cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
}

/* ---------- 答题 ---------- */
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.progress-track { flex: 1; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #9E2B33, #E09A2D, #3E7CA6, #4F7F5F, #D4839B);
  transition: width .35s ease;
}
.progress-num { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.quiz-q {
  font-size: clamp(1.05rem, 4.6vw, 1.2rem);
  font-weight: 700; line-height: 1.6; margin-bottom: 14px;
}
.quiz-q .q-no { display: block; font-size: .75rem; color: var(--accent); letter-spacing: .2em; margin-bottom: 8px; font-weight: 600; }

/* 答题提示条 */
.quiz-tip {
  font-size: .78rem; color: var(--ink-soft); text-align: center;
  background: #fff; border: 1px dashed var(--line); border-radius: 12px;
  padding: 9px 12px; margin-bottom: 14px;
}
.quiz-tip b { color: var(--accent); font-size: .95rem; padding: 0 2px; }
.quiz-tip.shake { animation: tipshake .32s ease; }
@keyframes tipshake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.quiz-opts { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px; min-height: 56px;
  font-size: clamp(.92rem, 3.9vw, 1rem); line-height: 1.6; text-align: left; cursor: pointer;
  color: var(--ink); font-family: inherit;
  transition: border-color .15s, transform .12s, background .15s;
}
.opt:active { transform: scale(.985); }
.opt:hover { border-color: #C9BFAE; }
.opt.picked { border-color: var(--accent); background: #FBF3F1; }

/* 单选题选项前的 A / B 标记 */
.opt-key {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid #C9BFAE; color: #9A8F7E; background: #fff;
  font-size: .74rem; font-weight: 700; line-height: 21px; text-align: center;
  margin-top: 1px; transition: background .15s, border-color .15s, color .15s;
}
.opt.picked .opt-key { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt-txt { flex: 1; }

/* ---------- 加载页 ---------- */
#screen-loading { text-align: center; padding-top: 40vh; padding-top: 40dvh; }
.loading-dots { display: flex; justify-content: center; gap: 8px; }
.loading-dots span {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  animation: bounce 1s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .18s; background: #E09A2D; }
.loading-dots span:nth-child(3) { animation-delay: .36s; background: #3E7CA6; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.loading-text { margin-top: 18px; color: var(--ink-soft); font-size: .9rem; letter-spacing: .08em; }

/* ---------- 结果页 ---------- */
.result-hero {
  border-radius: 22px; padding: clamp(24px, 7vw, 30px) clamp(18px, 5vw, 24px) 26px;
  color: #fff;
  background: linear-gradient(150deg, var(--g1), var(--g2));
  box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden;
}
.result-hero::after {
  content: ""; position: absolute; right: -34px; top: -34px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.result-en { font-size: .68rem; letter-spacing: .35em; opacity: .8; }
.result-name { font-size: clamp(2rem, 9.2vw, 2.5rem); font-weight: 700; margin: 10px 0 4px; letter-spacing: .12em; }
.result-label { font-size: clamp(.76rem, 3.3vw, .84rem); opacity: .85; letter-spacing: .1em; }
.result-tagline { margin-top: 14px; font-size: clamp(.88rem, 3.8vw, .98rem); opacity: .95; line-height: 1.6; }
.result-icon { font-size: 2.2rem; margin-bottom: 6px; }

/* 第二人格（容错：藏在你身上的另一面） */
.result-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 2px 6px;
}
.result-divider::before, .result-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
/* 中间标签：淡强调色胶囊——比原来那行灰字更醒目，但仍克制不抢主结果 */
.result-divider > span {
  flex: 0 0 auto; white-space: nowrap;
  font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  color: var(--accent, #9E2B33);
  background: var(--accent-soft, #F6E7E4);
  border: 1px solid #EBD4D1;
  border-radius: 999px; padding: 5px 16px;
}
.result-hero--sub { padding: clamp(20px, 6vw, 26px) clamp(16px, 5vw, 22px) 22px; }
.result-hero--sub .result-name { font-size: clamp(1.7rem, 8vw, 2.1rem); }
.result-hero--sub .result-icon { font-size: 1.7rem; margin-bottom: 4px; }
.resonance {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 14px; font-size: .76rem; color: rgba(255,255,255,.92); letter-spacing: .04em;
}
.resonance .bar {
  width: 120px; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,.32); overflow: hidden;
}
.resonance .bar > i {
  display: block; height: 100%; background: #fff; border-radius: 999px;
}

.result-block { margin-top: 22px; }
.result-block > h2 {
  font-size: 1.02rem; font-weight: 700; letter-spacing: .05em;
  padding-left: 12px; border-left: 4px solid var(--accent, var(--ink));
  margin-bottom: 12px;
}

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 10px; }
.card h4 { font-size: .92rem; margin-bottom: 6px; }
.card p { font-size: .86rem; line-height: 1.85; color: var(--ink-soft); }

.keywords { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.keywords span {
  font-size: .78rem; padding: 5px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
}

/* 香水卡片 */
.perf-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.perf-card + .perf-card { margin-top: 10px; }
.perf-img {
  width: 62px; height: 62px; border-radius: 12px; flex-shrink: 0;
  object-fit: cover; background: var(--ph, #EDE6DA);
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; color: rgba(0,0,0,.45); font-weight: 600; text-align: center; line-height: 1.3;
  padding: 4px;
}
.perf-info { flex: 1; min-width: 0; }
.perf-info .perf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.perf-info h4 { font-size: .95rem; }
.perf-badge {
  font-size: .66rem; padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.perf-badge.main { background: var(--accent-soft, #F6E7E4); color: var(--accent, #9E2B33); }
.perf-badge.sub  { background: #EFEAE1; color: var(--ink-soft); }
.perf-info p { margin-top: 5px; font-size: .8rem; line-height: 1.7; color: var(--ink-soft); }

/* 你可能还喜欢：自适应两列（窄屏自动单列），角标在右上角，色块左·文字右 */
.perf-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 14px 10px; margin-top: 2px;
}
.perf-grid .perf-card {
  position: relative;
  flex-direction: row; align-items: center; gap: 10px;
  margin-top: 0; padding: 10px 12px 10px;
  padding-top: 30px;
}
.perf-grid .perf-img { width: 50px; height: 50px; border-radius: 10px; font-size: .58rem; }
.perf-grid .perf-head { gap: 0; flex-wrap: wrap; }
.perf-grid .perf-info h4 { font-size: .82rem; letter-spacing: 0; }
.perf-grid .perf-info p {
  margin-top: 3px; font-size: .72rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 味道介绍被截断时：整卡可点击展开 / 收起 */
.perf-grid .perf-card.expandable { cursor: pointer; }
.perf-grid .perf-card.expandable:hover { border-color: #C9BFAE; }
.perf-grid .perf-card.expanded .perf-info p {
  -webkit-line-clamp: unset; display: block; overflow: visible;
}
.perf-more {
  display: inline-block; margin-top: 3px;
  font-size: .64rem; font-weight: 600; color: var(--accent, #9E2B33);
  letter-spacing: .02em;
}
.perf-grid .perf-badge.sub {
  position: absolute; top: 8px; right: 10px;
  font-size: .62rem; padding: 3px 10px;
  background: #F9F3F1; color: var(--accent, #9E2B33);
  border: 1px solid #EAD5D2;
}
/* ---------- 第二人格区块整体缩一档 ----------
 * 目的：次级结果不该和主结果一样"重"。把 hero、标题、卡片、香水卡的字号与间距
 * 统一收到约 85%，让视觉层级明确——这块是补充信息，不是第二个主结果。 */
.result-secondary .result-divider { margin: 26px 2px 6px; }
.result-secondary .result-divider > span { font-size: .76rem; padding: 4px 14px; }

.result-secondary .result-hero--sub {
  padding: clamp(16px, 4.6vw, 20px) clamp(14px, 4vw, 18px) 17px;
  border-radius: 18px;
}
.result-secondary .result-hero--sub::after { width: 96px; height: 96px; right: -26px; top: -26px; }
.result-secondary .result-en { font-size: .6rem; letter-spacing: .3em; }
.result-secondary .result-name { font-size: clamp(1.42rem, 6.6vw, 1.7rem); margin: 6px 0 2px; }
.result-secondary .result-label { font-size: clamp(.68rem, 2.9vw, .74rem); }
.result-secondary .result-tagline { margin-top: 10px; font-size: clamp(.78rem, 3.3vw, .86rem); }
.result-secondary .result-icon { font-size: 1.4rem; margin-bottom: 2px; }
.result-secondary .resonance { margin-top: 11px; font-size: .68rem; }
.result-secondary .resonance .bar { width: 92px; height: 5px; }

.result-secondary .result-block { margin-top: 18px; }
.result-secondary .result-block > h2 {
  font-size: .9rem; padding-left: 10px; border-left-width: 3px; margin-bottom: 10px;
}
.result-secondary .card { padding: 13px 15px; border-radius: 12px; }
.result-secondary .card + .card { margin-top: 8px; }
.result-secondary .card h4 { font-size: .82rem; margin-bottom: 4px; }
.result-secondary .card p { font-size: .78rem; line-height: 1.75; }
.result-secondary .keywords { gap: 6px; margin-bottom: 11px; }
.result-secondary .keywords span { font-size: .7rem; padding: 4px 10px; }

.result-secondary .perf-card { gap: 11px; padding: 11px 13px; border-radius: 12px; }
.result-secondary .perf-img { width: 52px; height: 52px; border-radius: 10px; font-size: .6rem; }
.result-secondary .perf-info h4 { font-size: .86rem; }
.result-secondary .perf-info p { font-size: .74rem; margin-top: 4px; line-height: 1.65; }
.result-secondary .perf-badge { font-size: .6rem; padding: 2px 7px; }

.result-secondary .perf-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 11px 8px; }
.result-secondary .perf-grid .perf-card { padding: 9px 10px; padding-top: 26px; gap: 8px; }
.result-secondary .perf-grid .perf-img { width: 42px; height: 42px; border-radius: 9px; font-size: .52rem; }
.result-secondary .perf-grid .perf-info h4 { font-size: .74rem; }
.result-secondary .perf-grid .perf-info p { font-size: .66rem; }
.result-secondary .perf-grid .perf-badge.sub { font-size: .56rem; padding: 2px 8px; top: 7px; right: 8px; }
.result-secondary .perf-more { font-size: .58rem; }

/* ---------- 第二人格：左色卡 + 右解读 ----------
 * 左卡与右栏等高（align-items: stretch）。因为右栏有三段解读、天然更高，
 * 左卡内部用「身份信息居中 + 共鸣度贴底」的两段式结构把高度"撑满"，
 * 而不是让内容挤在中间、下方留一大片空色。 */
.sub-split {
  display: grid;
  grid-template-columns: minmax(108px, .84fr) 1.16fr;
  gap: 10px; align-items: stretch; margin-top: 10px;
}

.sub-color { display: flex; }
.sub-color .result-hero--sub {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 20px 12px 18px; border-radius: 18px;
}
/* 两处柔和光晕，给高卡片一点质感，避免大片纯色显得空 */
.sub-color .result-hero--sub::before {
  content: ""; position: absolute; left: -34px; bottom: -46px;
  width: 126px; height: 126px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.sub-color .result-hero--sub::after { width: 88px; height: 88px; right: -26px; top: -26px; }

/* 身份信息（英文 / 图标 / 人格式名 / 标签 / 一句话）在剩余空间里居中 */
.sub-color-main {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 1;
}
.sub-color .result-en { font-size: .5rem; letter-spacing: .14em; white-space: nowrap; }
.sub-color .result-icon { font-size: 1.3rem; margin: 6px 0 0; }
.sub-color .result-name { font-size: 1.38rem; letter-spacing: .06em; margin: 5px 0 3px; }
.sub-color .result-label { font-size: .64rem; letter-spacing: .02em; text-wrap: balance; }
.sub-color .result-tagline { margin-top: 10px; font-size: .74rem; line-height: 1.55; text-wrap: balance; }

/* 共鸣度：贴卡片底部，用一条细线分隔，进度条居中 */
.sub-color .resonance {
  flex-direction: column; align-items: center; gap: 7px;
  width: 100%; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.24);
  font-size: .62rem; line-height: 1.4; position: relative; z-index: 1;
}
.sub-color .resonance .bar { width: 82%; max-width: 100px; height: 5px; }

/* 右栏：标题 + 关键词 + 三段解读 */
.sub-analysis { display: flex; flex-direction: column; }
.sub-analysis .result-block { margin-top: 0; }
.sub-analysis .result-block > h2 { font-size: .88rem; margin-bottom: 9px; }
.sub-analysis .keywords { gap: 5px; margin-bottom: 10px; }
.sub-analysis .keywords span { font-size: .62rem; padding: 3px 8px; }
.sub-analysis .card { padding: 11px 12px; }
.sub-analysis .card + .card { margin-top: 7px; }
.sub-analysis .card h4 { font-size: .78rem; margin-bottom: 3px; letter-spacing: .02em; }
.sub-analysis .card p { font-size: .74rem; line-height: 1.7; }

/* 极窄屏兜底：退回上下堆叠，左卡不再拉伸 */
@media (max-width: 340px) {
  .sub-split { grid-template-columns: 1fr; align-items: start; }
  .sub-color .result-hero--sub { flex: none; }
  .sub-color-main { flex: none; }
}

.result-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- 分享卡离屏舞台 ---------- */
#shareCardStage {
  position: fixed; left: -9999px; top: 0;
  width: 640px;
}

/* ---------- 图鉴页 / 顶栏返回 ---------- */
.topbar-back {
  font-size: .85rem; color: var(--ink-soft); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.gallery {
  padding: 26px calc(18px + env(safe-area-inset-right)) calc(46px + env(safe-area-inset-bottom))
           calc(18px + env(safe-area-inset-left));
}
.gal-head { text-align: center; margin-bottom: 24px; }
.gal-head h1 { font-size: clamp(1.35rem, 6vw, 1.6rem); letter-spacing: .08em; }
.gal-head p { margin-top: 10px; font-size: .78rem; color: var(--ink-soft); line-height: 1.7; }
.gal-item {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 22px; padding: 18px 16px 22px; margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.gal-item .card p strong { color: var(--ink); font-weight: 600; }
.result-actions a.btn-ghost {
  display: block; text-align: center; margin-top: 2px;
}

/* ---------- 小屏 / 横屏微调 ---------- */
@media (max-width: 360px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .intro-cards { margin: 16px 0 20px; }
  .card { padding: 14px 15px; }
}
/* 横屏手机：压缩纵向留白，避免一屏装不下 */
@media (max-height: 480px) and (orientation: landscape) {
  .intro-hero { padding: 12px 0 10px; }
  .intro-dots { margin-bottom: 14px; }
  #screen-loading { padding-top: 22dvh; }
}
/* 桌面/平板：内容居中并加外框，避免被拉得太宽 */
@media (min-width: 700px) {
  body { box-shadow: 0 0 60px rgba(60, 50, 40, .06); }
}
