/* ============================================================
   设计令牌 — 新中式 · 宣纸暖石色
   ============================================================ */
:root {
  /* 基础色 */
  --bg:         #fffefc;   /* 近白净底 */
  --paper:      #FAFAF6;   /* 近白暖纸 */
  --red:        #B5403C;   /* 朱砂红（首页/答题页强调色） */
  --ink:        #1A1612;   /* 水墨黑 */
  --text:       #3A3028;
  --text-mid:   #6A5E52;
  --text-soft:  #9E9488;
  --line:       rgba(58,48,40,0.12);
  --border:     rgba(58,48,40,0.18);
  --shadow-xs:  0 1px 8px rgba(58,48,40,0.06);
  --shadow-sm:  0 2px 16px rgba(58,48,40,0.09);
  --shadow:     0 4px 28px rgba(58,48,40,0.12);

  /* 城市主题色 RGB（由 JS 动态注入，供结果页使用） */
  --city-rgb:   139, 184, 200;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --trans: all 0.28s var(--ease);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Serif SC', 'STSong', 'SimSun', serif;
  background: var(--bg);
  /* 极轻斜纹肌理 */
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0, transparent 28px,
    rgba(130,110,85,0.032) 28px, rgba(130,110,85,0.032) 29px
  );
  color: var(--text);
  line-height: 1.8;
  overflow: hidden;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   页面切换系统
   ============================================================ */
.page {
  position: fixed; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s var(--ease);
  -webkit-overflow-scrolling: touch;
}
.page.active { opacity: 1; pointer-events: all; z-index: 10; }

/* ============================================================
   首页 — 新中式封面
   ============================================================ */
#home-page {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
}
.home-main {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 52px 40px;
  min-height: 100dvh;
}

/* Logo 图标 */
.home-seal {
  display: block;
  width: 82px; height: 82px;
  border-radius: 20px;
  margin: 0 auto 28px;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(58,48,40,0.14);
}
.home-eyebrow {
  font-size: 12.5px; color: var(--text-soft);
  letter-spacing: 0.14em; margin-bottom: 16px; font-weight: 300;
}
.home-title {
  font-size: clamp(44px, 12vw, 62px);
  font-weight: 700; color: var(--ink);
  letter-spacing: 0.18em; line-height: 1.1; margin-bottom: 16px;
}
.title-rule {
  width: 34px; height: 1.5px;
  background: var(--red);
  margin: 0 auto 28px; opacity: 0.7;
}
.home-quote {
  font-size: clamp(14.5px, 3.6vw, 16.5px);
  font-weight: 600; color: var(--text);
  line-height: 1.9; margin-bottom: 22px; letter-spacing: 0.04em;
}
.home-desc {
  font-size: 13px; color: var(--text-mid);
  line-height: 2.1; max-width: 320px;
  margin: 0 auto 42px; letter-spacing: 0.03em; font-weight: 300;
}
.btn-start {
  display: block; width: 100%; max-width: 264px;
  padding: 14px 32px;
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 0;
  font-size: 15px; font-family: 'Noto Serif SC', serif;
  font-weight: 500; cursor: pointer;
  letter-spacing: 0.18em;
  transition: var(--trans);
  margin: 0 auto 26px;
}
.btn-start:hover {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink); letter-spacing: 0.22em;
}
.btn-start:active { opacity: 0.85; }
.home-meta {
  font-size: 12px; color: var(--text-soft);
  letter-spacing: 0.1em; font-weight: 300;
}

/* ============================================================
   城市预览面板（测试工具）
   ============================================================ */
.city-panel {
  position: fixed; top: 0; right: 0;
  height: 100dvh; z-index: 500;
  display: flex; align-items: stretch;
}
.city-panel-tab {
  width: 26px; background: var(--ink);
  color: rgba(245,240,229,0.72); border: none; cursor: pointer;
  writing-mode: vertical-rl; font-size: 11px; letter-spacing: 0.14em;
  font-family: 'Noto Serif SC', serif; padding: 24px 0;
  flex-shrink: 0; transition: var(--trans);
  display: flex; align-items: center; justify-content: center;
}
.city-panel-tab:hover { color: var(--paper); }
.city-panel-inner {
  width: 0; overflow: hidden;
  transition: width 0.36s var(--ease);
  background: var(--paper); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.city-panel.open .city-panel-inner { width: 188px; }
.city-panel-header {
  padding: 14px 14px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; white-space: nowrap;
}
.city-panel-header span { font-size: 12px; color: var(--text-soft); letter-spacing: 0.1em; }
.city-panel-close {
  background: none; border: none; color: var(--text-soft);
  font-size: 16px; cursor: pointer; line-height: 1;
  padding: 2px 4px; transition: color 0.2s;
}
.city-panel-close:hover { color: var(--red); }
.city-panel-body {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 5px; white-space: nowrap;
}
.city-btn {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  background: none; border: 1px solid var(--line); cursor: pointer;
  font-family: 'Noto Serif SC', serif; font-size: 13px;
  color: var(--text); letter-spacing: 0.06em;
  transition: var(--trans); text-align: left; border-radius: 0;
}
.city-btn:hover { background: var(--bg); border-color: var(--border); }
.city-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   答题页 — Quiz Page
   ============================================================ */
#quiz-page {
  background: var(--bg);
  background-image: repeating-linear-gradient(
    -45deg, transparent 0, transparent 28px,
    rgba(130,110,85,0.032) 28px, rgba(130,110,85,0.032) 29px
  );
}
.quiz-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 10px;
  background: rgba(255,254,252,0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--line);
}
.back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-mid); font-family: 'Noto Serif SC', serif;
  font-size: 13.5px; letter-spacing: 0.06em;
  padding: 4px 0; display: flex; align-items: center; gap: 6px;
  transition: color 0.2s;
}
.back-btn:hover { color: var(--red); }
.progress-info { font-size: 13px; color: var(--text-soft); letter-spacing: 0.06em; }
.progress-info #current-q { color: var(--text); font-weight: 600; font-size: 15px; }
.progress-bar-wrap {
  height: 2px; background: rgba(58,48,40,0.08);
  position: sticky; top: 53px; z-index: 99;
}
.progress-bar {
  height: 100%; background: var(--red);
  transition: width 0.65s var(--ease); width: 0%;
}
.question-container {
  padding: 28px 18px 56px; max-width: 580px; margin: 0 auto;
}
.question-container.entering     { animation: qEnter      0.36s var(--ease) both; }
.question-container.leaving      { animation: qLeave      0.28s var(--ease) forwards; }
.question-container.leaving-right{ animation: qLeaveRight 0.28s var(--ease) forwards; }
@keyframes qEnter      { from{opacity:0;transform:translateX(24px)} to{opacity:1;transform:translateX(0)} }
@keyframes qLeave      { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(-24px)} }
@keyframes qLeaveRight { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(24px)} }

/* 维度标签：icon 容器 + 分类文字 */
.question-group-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(58,48,40,0.06);
  padding: 5px 12px 5px 6px;
  border-radius: 8px;
  font-size: 12px; color: var(--text-mid);
  letter-spacing: 0.08em; margin-bottom: 22px; font-weight: 400;
}
.badge-icon {
  width: 22px; height: 22px;
  background: rgba(181,64,60,0.10);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); flex-shrink: 0;
}

/* 题干 — 大字衬线 + 呼吸间距 */
.question-text {
  font-size: clamp(18px, 4.8vw, 22px); font-weight: 600;
  color: var(--ink); line-height: 1.75;
  margin-bottom: 32px; letter-spacing: 0.04em;
}

.options-grid { display: flex; flex-direction: column; gap: 10px; }

/* 选项卡片 — 白底 + 微阴影 */
.option-card {
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 13px 14px 13px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: transform 0.22s var(--ease),
              border-color 0.22s var(--ease),
              box-shadow 0.22s var(--ease),
              background 0.22s var(--ease);
  box-shadow: 0 1px 8px rgba(58,48,40,0.07);
  position: relative;
}
/* Emoji 圆形底座 */
.option-emoji-wrap {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(58,48,40,0.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.22s var(--ease);
}
.option-emoji { font-size: 20px; line-height: 1; }
.option-text  {
  flex: 1; font-size: 14px; line-height: 1.7;
  color: var(--text); letter-spacing: 0.02em;
}
/* 右侧单选圆圈 */
.option-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.22s var(--ease),
              background   0.22s var(--ease),
              opacity      0.22s var(--ease);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
}
/* 悬停态：上浮 + 浅边框 + 单选圈出现 */
.option-card:hover {
  transform: translateY(-2px);
  border-color: rgba(58,48,40,0.14);
  box-shadow: 0 5px 18px rgba(58,48,40,0.11);
}
.option-card:hover .option-radio {
  border-color: rgba(58,48,40,0.22);
  opacity: 1;
}
/* 选中态：微放大 + 朱砂红描边 + 淡红底 + 单选圈填充 */
.option-card.selected {
  transform: scale(1.012);
  border-color: var(--red);
  background: rgba(181,64,60,0.04);
  box-shadow: 0 3px 14px rgba(181,64,60,0.12);
}
.option-card.selected .option-emoji-wrap {
  background: rgba(181,64,60,0.10);
}
.option-card.selected .option-radio {
  border-color: var(--red);
  background: var(--red);
  opacity: 1;
}
.option-card.selected .option-radio::after {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #fff; display: block;
}

/* ============================================================
   结果页 — 新中式杂志排版
   ============================================================ */
#result-page {
  background: var(--bg);
  background-image: repeating-linear-gradient(
    -45deg, transparent 0, transparent 28px,
    rgba(130,110,85,0.032) 28px, rgba(130,110,85,0.032) 29px
  );
}

/* ── 英雄区（顶部氛围光由 JS 注入 background） ── */
.result-hero-section {
  padding: 60px 24px 2px;
  text-align: center;
  position: relative;
  z-index: 1;
  /* 氛围渐变由 JS 动态 inline style 设定 */
}

/* 标签 */
.result-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-soft);
  margin-bottom: 28px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.result-label::before, .result-label::after {
  content: '✦';
  font-size: 9px;
  color: rgba(var(--city-rgb), 0.6);
}

/* 城市名 + 拼音水印容器 */
.result-city-wrap {
  position: relative;
  height: clamp(76px, 20vw, 100px);   /* 固定高度让拼音上下溢出形成裁切效果 */
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}

/* 拼音水印 — 12% 主题色，超大字体横穿容器 */
.result-pinyin {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: min(26vw, 112px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(var(--city-rgb), 0.12);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

/* 城市名 — 水墨大字 */
.result-city-name {
  position: relative; z-index: 1;
  font-size: clamp(58px, 16vw, 84px);
  font-weight: 700; color: var(--ink);
  letter-spacing: 0.16em; line-height: 1.15;
}

/* 气质标签 — 100% 主题色文字 + 40% 主题色描边 */
.result-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 26px;
}
.tag {
  padding: 4px 18px;
  border-radius: 20px;
  border: 1px solid rgba(var(--city-rgb), 0.40);
  font-size: 12.5px;
  color: rgba(var(--city-rgb), 1);
  background: rgba(var(--city-rgb), 0.07);
  letter-spacing: 0.08em;
}

/* 契合度 — 100% 主题色数字 */
.result-match-wrap { text-align: center; }
.result-match-num {
  display: inline-flex; align-items: flex-start; gap: 2px;
  color: rgba(var(--city-rgb), 1);
  margin-bottom: 5px;
}
.num-big {
  font-size: clamp(56px, 15vw, 72px);
  font-weight: 700; line-height: 1; letter-spacing: -0.02em;
}
.num-pct {
  font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 500; padding-top: 9px; letter-spacing: 0;
}
.result-match-label {
  font-size: 12.5px; color: var(--text-soft); letter-spacing: 0.1em;
}

/* ── 金句区 — 大引号 25% 主题色 ── */
.result-quote-section {
  padding: 28px 20px 30px;
  position: relative;
}
.quote-deco {
  display: block;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 72px; line-height: 0.72;
  color: rgba(var(--city-rgb), 0.25);
  user-select: none; pointer-events: none;
}
.quote-deco.open  { text-align: left;  padding-left: 6px;  margin-bottom: -4px; }
.quote-deco.close { text-align: right; padding-right: 6px; margin-top: -4px; }
.result-quote-text {
  font-size: 18px; color: var(--text-mid);
  line-height: 2.2; letter-spacing: 0.05em; text-align: center;
  padding: 0 8px;
}

/* ── 内容区 ── */
.result-body {
  padding: 4px 16px 16px; max-width: 580px; margin: 0 auto;
}

/* 卡片化 section：白底 + 圆角 + 微阴影，板块间距替代分割线 */
.result-section {
  padding: 20px 20px 22px;
  margin-bottom: 10px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 12px rgba(58,48,40,0.07);
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.result-section:last-child { margin-bottom: 0; }
.result-section.visible { opacity: 1; transform: translateY(0); }

/* 栏目头部：图标 + 标题 */
.section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 11px;
}
/* 图标背景泡 — 15% 主题色 */
.section-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: rgba(var(--city-rgb), 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.section-title {
  font-size: 14.5px; font-weight: 600;
  color: var(--ink); letter-spacing: 0.06em;
}

/* 渐变分割线 — 从主题色渐变到透明 */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--city-rgb), 0.55) 0%, transparent 65%);
  margin-bottom: 16px;
}

.section-content {
  font-size: 14px; color: var(--text-mid);
  line-height: 2.1; letter-spacing: 0.02em;
}

/* 共同之处列表 */
.resonance-list {
  list-style: none; display: flex; flex-direction: column; gap: 10px;
}
.resonance-list li {
  font-size: 14px; color: var(--text-mid);
  padding-left: 16px; position: relative;
  line-height: 1.8; letter-spacing: 0.02em;
}
.resonance-list li::before {
  content: '·'; position: absolute; left: 0; top: 0;
  color: rgba(var(--city-rgb), 1);
  font-size: 24px; line-height: 1.1;
}

/* 打卡地 — 带主题色底 */
.places-list { display: flex; gap: 8px; flex-wrap: wrap; }
.place-tag {
  padding: 5px 13px;
  border: 1px solid rgba(var(--city-rgb), 0.30);
  font-size: 13px; color: var(--text);
  background: rgba(var(--city-rgb), 0.06);
  letter-spacing: 0.04em;
}

/* 第二城市 */
.secondary-city-header {
  font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 8px;
}
#secondary-text {
  font-size: 14px; color: var(--text-mid);
  line-height: 1.95; letter-spacing: 0.02em;
}

/* 操作按钮 */
.result-actions {
  display: flex; gap: 12px; padding: 8px 24px 20px;
  max-width: 580px; margin: 0 auto;
}
.btn-restart, .btn-share {
  flex: 1; padding: 13px;
  font-size: 14.5px; font-family: 'Noto Serif SC', serif;
  font-weight: 500; cursor: pointer;
  transition: var(--trans); border: none;
  letter-spacing: 0.1em; border-radius: 0;
}
.btn-restart {
  background: var(--paper); color: var(--text);
  border: 1px solid var(--border);
}
.btn-restart:hover { background: var(--bg); }
.btn-share {
  background: var(--ink); color: var(--paper);
}
.btn-share:hover { background: var(--text); }
.share-hint {
  text-align: center; font-size: 12px; color: var(--text-soft);
  padding: 0 20px 56px; line-height: 2;
  max-width: 580px; margin: 0 auto; letter-spacing: 0.05em;
}

/* ============================================================
   版权行
   ============================================================ */
.copyright {
  text-align: center; font-size: 11px; color: var(--text-soft);
  padding: 0 20px 36px; letter-spacing: 0.08em;
  opacity: 0.65; font-weight: 300;
}
/* 答题页版权行：跟随滚动内容，最大宽度与题目容器对齐 */
.quiz-copyright {
  max-width: 580px; margin: 0 auto;
  padding-top: 4px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; bottom: 52px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: rgba(26,22,18,0.88); color: var(--paper);
  padding: 10px 22px; font-size: 13px;
  opacity: 0; transition: all 0.36s var(--ease);
  z-index: 9999; white-space: nowrap;
  backdrop-filter: blur(12px); pointer-events: none; letter-spacing: 0.06em;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   响应式
   ============================================================ */
@media (min-width: 560px) {
  .question-container { padding: 34px 44px 60px; }
  .result-body        { padding: 4px 32px 20px; }
  .result-actions     { padding: 8px 32px 24px; }
  .result-hero-section{ padding: 72px 36px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .result-section { opacity: 1 !important; transform: none !important; }
}
