/* 性格城市匹配 · 登机牌视觉 */
:root {
  --paper: #f6f2ea;
  --card: #fffdf8;
  --ink: #22303f;
  --ink2: #5a6b7d;
  --navy: #1d3557;
  --navy2: #2a4d7f;
  --stamp: #c14953;
  --gold: #d9a05b;
  --line: #d8d0c0;
  --serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --sans: -apple-system, 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SF Mono', 'Menlo', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  background-image: radial-gradient(circle at 15% 10%, rgba(29,53,87,.05), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(193,73,83,.05), transparent 40%);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}
.hidden { display: none !important; }
#app { max-width: 640px; margin: 0 auto; padding: 24px 20px 60px; }

/* ============ 授权页 ============ */
.gate-wrap { padding-top: 30px; text-align: center; }
.gate-brand {
  display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: 6px;
  color: var(--navy); border: 1px solid var(--navy); padding: 5px 12px 5px 18px; border-radius: 999px;
  margin-bottom: 18px; opacity: .85;
}
.gate-title { font-family: var(--serif); font-size: 34px; letter-spacing: 4px; color: var(--navy); }
.gate-sub { margin-top: 10px; color: var(--ink2); font-size: 15px; letter-spacing: 1px; }

/* 登机牌 */
.boarding-pass {
  margin: 26px auto 0; max-width: 340px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(29,53,87,.10), 0 2px 6px rgba(29,53,87,.06);
  text-align: left; position: relative;
}
.boarding-pass::after {
  content: ''; position: absolute; right: -7px; top: 58%; width: 14px; height: 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 50%;
  transform: translateY(-50%);
}
.boarding-pass::before {
  content: ''; position: absolute; left: -7px; top: 58%; width: 14px; height: 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 50%;
  transform: translateY(-50%); z-index: 1;
}
.bp-top {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  color: #f4efe4; padding: 16px 18px 14px; position: relative; overflow: hidden;
}
.bp-top::after {
  content: '✈'; position: absolute; right: 14px; top: 12px; font-size: 26px; opacity: .35;
}
.bp-route { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bp-node { display: flex; flex-direction: column; gap: 2px; }
.bp-node b { font-family: var(--mono); font-size: 22px; letter-spacing: 2px; }
.bp-node span { font-size: 11px; opacity: .75; }
.bp-plane { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, rgba(244,239,228,.8) 0 6px, transparent 6px 12px); position: relative; margin: 0 6px 14px; }
.bp-plane::after {
  content: '→'; position: absolute; right: -4px; top: -10px; color: #f4efe4; font-size: 14px;
}
.bp-info { margin-top: 8px; font-size: 11px; opacity: .8; letter-spacing: 1px; font-family: var(--mono); }
.bp-body { padding: 14px 18px; border-bottom: 1px dashed var(--line); }
.bp-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--ink2); }
.bp-row b { color: var(--ink); font-weight: 600; }
.bp-barcode {
  height: 44px; margin: 14px 18px 16px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 10px, var(--ink) 10px 13px, transparent 13px 16px);
  opacity: .8; border-radius: 2px;
}

.gate-form { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
#code-input {
  width: 260px; padding: 13px 16px; font-size: 19px; text-align: center;
  font-family: var(--mono); letter-spacing: 4px; text-transform: uppercase;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--navy); outline: none; transition: border-color .2s;
}
#code-input:focus { border-color: var(--navy); }
.btn-primary {
  width: 260px; padding: 14px; font-size: 16px; letter-spacing: 3px; cursor: pointer;
  color: #f4efe4; background: linear-gradient(135deg, var(--navy), var(--navy2));
  border: none; border-radius: 10px; box-shadow: 0 6px 16px rgba(29,53,87,.25);
  transition: transform .15s, box-shadow .15s;
}
.btn-primary:active { transform: scale(.97); }
.code-msg { min-height: 18px; font-size: 13px; color: var(--stamp); }
.code-msg.ok { color: #2e7d4f; }
.gate-tip { margin-top: 6px; font-size: 12px; color: var(--ink2); opacity: .8; }

/* ============ 答题页 ============ */
.quiz-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 10px; }
.btn-back {
  display: flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--ink2); font-size: 13px; cursor: pointer; padding: 6px 0;
}
.btn-back .arrow { width: 9px; height: 9px; border-left: 2px solid var(--ink2); border-bottom: 2px solid var(--ink2); transform: rotate(45deg); }
.btn-back:disabled { opacity: .3; cursor: default; }
.quiz-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink2); }
.dim-tag {
  background: rgba(29,53,87,.08); color: var(--navy); padding: 3px 10px;
  border-radius: 999px; font-size: 12px;
}
.progress { height: 5px; background: rgba(29,53,87,.08); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--navy), var(--stamp)); border-radius: 999px; transition: width .3s; }
.quiz-body { padding-top: 28px; }
.q-text { font-family: var(--serif); font-size: 21px; line-height: 1.55; margin-bottom: 22px; letter-spacing: .5px; }
.options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; cursor: pointer;
  padding: 15px 16px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 15px; line-height: 1.5; color: var(--ink);
  font-family: var(--sans); transition: border-color .15s, background .15s, transform .15s;
}
.opt:active { transform: scale(.98); }
.opt.picked { border-color: var(--navy); background: rgba(29,53,87,.06); }
.opt-key {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; font-size: 12px;
  display: grid; place-items: center; background: rgba(29,53,87,.08); color: var(--navy);
  font-family: var(--mono); margin-top: 1px;
}
.opt.picked .opt-key { background: var(--navy); color: #f4efe4; }
.quiz-foot { text-align: center; margin-top: 26px; font-size: 12px; color: var(--ink2); opacity: .7; }

/* ============ 结果页 ============ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 18px; margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(29,53,87,.05);
}
.card-title {
  font-size: 15px; font-weight: 700; margin-bottom: 14px; letter-spacing: 1px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.card-title .en { font-family: var(--mono); font-size: 10px; color: var(--ink2); letter-spacing: 2px; font-weight: 400; }
.para { font-size: 14.5px; line-height: 1.8; color: var(--ink); }
.plain { font-size: 14px; line-height: 1.8; color: var(--ink); margin-top: 10px; }

.result-hero {
  color: #f7f3ea; border-radius: 16px; padding: 30px 20px 26px; text-align: center;
  margin-bottom: 16px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--hero-a, #1d3557), #101820);
  box-shadow: 0 14px 34px rgba(16,24,32,.25);
}
.result-hero::before {
  content: ''; position: absolute; inset: 10px; border: 1px dashed rgba(247,243,234,.28);
  border-radius: 12px; pointer-events: none;
}
.hero-stamp {
  position: absolute; top: 14px; right: 14px; width: 64px; height: 64px;
  border: 2.5px solid rgba(247,243,234,.5); border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; letter-spacing: 1px; transform: rotate(12deg); color: rgba(247,243,234,.7);
  font-family: var(--mono); line-height: 1.3; text-align: center;
}
.hero-badge { font-family: var(--mono); font-size: 11px; letter-spacing: 4px; opacity: .75; }
.hero-name {
  font-family: var(--serif); font-size: 52px; letter-spacing: 8px; margin-top: 14px;
  text-indent: 8px; color: var(--accent, #d9a05b);
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.hero-en { font-family: var(--mono); font-size: 13px; letter-spacing: 5px; opacity: .7; margin-top: 6px; }
.hero-tagline { font-size: 16px; margin-top: 14px; letter-spacing: 2px; opacity: .95; }
.hero-rule { width: 44px; height: 1px; background: rgba(247,243,234,.4); margin: 16px auto; }
.hero-match { font-size: 13px; opacity: .85; }
.hero-match b { font-size: 30px; font-family: var(--mono); color: var(--accent2, #ffd166); margin: 0 2px; }
.hero-kws { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.hero-kws span {
  border: 1px solid rgba(247,243,234,.45); border-radius: 999px; padding: 4px 14px;
  font-size: 12px; letter-spacing: 2px;
}

.archetype {
  background: linear-gradient(135deg, rgba(29,53,87,.06), rgba(193,73,83,.05));
  border: 1px dashed var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
  font-size: 14px; line-height: 1.7;
}
.archetype b { font-family: var(--serif); color: var(--navy); font-size: 16px; letter-spacing: 2px; }

.dim-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.dn { width: 44px; font-size: 13px; color: var(--ink2); flex-shrink: 0; }
.dim-track { flex: 1; height: 8px; background: rgba(29,53,87,.08); border-radius: 999px; position: relative; overflow: hidden; }
.dim-fill { height: 100%; background: linear-gradient(90deg, var(--navy2), var(--navy)); border-radius: 999px; }
.dv { width: 92px; font-size: 12px; color: var(--ink2); text-align: right; flex-shrink: 0; }
.dv b { color: var(--navy); }

.list { list-style: none; }
.list li { position: relative; padding: 6px 0 6px 22px; font-size: 14px; line-height: 1.65; }
.list li::before { content: ''; position: absolute; left: 4px; top: 14px; width: 7px; height: 7px; border-radius: 2px; background: var(--gold); transform: rotate(45deg); }
.list.warn li::before { background: var(--stamp); }
.mid-note { margin-top: 10px; font-size: 13px; color: var(--ink2); background: rgba(29,53,87,.05); border-radius: 8px; padding: 10px 12px; line-height: 1.6; }

.subcity {
  display: flex; align-items: center; gap: 14px;
}
.subcity .sc-name { font-family: var(--serif); font-size: 26px; color: var(--navy); letter-spacing: 3px; }
.subcity .sc-meta { font-size: 13px; color: var(--ink2); line-height: 1.6; }

.quotes { display: flex; flex-direction: column; gap: 8px; }
.quote-item {
  background: rgba(29,53,87,.05); border-radius: 10px; padding: 12px 14px;
  font-size: 14px; line-height: 1.6; color: var(--ink);
}
.share-hint { text-align: center; font-size: 13px; color: var(--ink2); line-height: 1.8; margin: 20px 0 10px; }
.result-foot { text-align: center; font-size: 11px; color: var(--ink2); opacity: .6; margin-top: 10px; line-height: 1.8; }
.result-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 20px; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal-mask { position: absolute; inset: 0; background: rgba(16,24,32,.55); }
.modal-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(92vw, 400px); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 16px; overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--line);
}
.modal-close { background: none; border: none; font-size: 22px; color: var(--ink2); cursor: pointer; }
.save-scroll { overflow-y: auto; padding: 14px; }
.save-scroll img { width: 100%; border-radius: 10px; }
.save-tip { text-align: center; font-size: 12px; color: var(--ink2); line-height: 1.7; padding: 0 16px 8px; }
.modal-btns { display: flex; gap: 10px; padding: 10px 16px 16px; }
.modal-btns .btn-primary { width: auto; flex: 1; padding: 12px; letter-spacing: 1px; font-size: 14px; }
.modal-btns .btn-ghost { flex: 1; }
.btn-ghost {
  padding: 12px; font-size: 14px; cursor: pointer; background: none;
  border: 1.5px solid var(--line); border-radius: 10px; color: var(--ink2);
}
.toast {
  position: fixed; left: 50%; bottom: 12vh; transform: translateX(-50%);
  background: rgba(22,30,40,.92); color: #f4efe4; font-size: 14px;
  padding: 10px 20px; border-radius: 999px; z-index: 99; white-space: nowrap;
}

/* ===== v3：匹配理由 / 人文风情 / 生活成本 / 建议 / 其他城市 ===== */
.cost-level { font-size: 13px; color: var(--ink2); margin-bottom: 10px; }
.cost-level b { color: var(--navy); font-size: 15px; }
.cost-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-top: 1px dashed var(--line);
}
.cost-row:first-of-type { border-top: none; }
.cost-k {
  flex: none; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--navy); border-radius: 6px; padding: 3px 8px; margin-top: 1px;
}
.cost-v { font-size: 13px; color: var(--ink); line-height: 1.6; }
.advice-block { margin-top: 14px; }
.advice-block:first-child { margin-top: 0; }
.advice-h {
  font-size: 13px; font-weight: 700; color: var(--navy);
  margin-bottom: 8px; padding-left: 10px; border-left: 3px solid var(--gold);
}
ol.tips { margin: 0; padding-left: 20px; }
ol.tips li { font-size: 13px; color: var(--ink); line-height: 1.7; margin-bottom: 6px; }
ul.challenges { margin: 0; list-style: none; }
ul.challenges li {
  font-size: 13px; color: #8a4a3a; line-height: 1.7; margin-bottom: 6px; padding-left: 18px; position: relative;
}
ul.challenges li::before { content: '✘'; position: absolute; left: 0; font-size: 11px; top: 3px; }
.alt-row { padding: 11px 0; border-top: 1px dashed var(--line); }
.alt-row:first-of-type { border-top: none; }
.alt-main { display: flex; justify-content: space-between; align-items: baseline; }
.alt-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.alt-match { font-size: 14px; font-weight: 700; color: var(--accent2, #b5543a); }
.alt-sub { font-size: 12px; color: var(--ink2); margin-top: 3px; line-height: 1.6; }

/* ===== v3：交叉验证摇摆提示卡 ===== */
.card.wiggle {
  border: 1.5px dashed #d8a13a;
  background: #fdf6e3;
}
.card.wiggle .card-title { color: #a6721b; }
