/* ============================================================
 * city-h5 · 城市旅行杂志风格
 * 封面 / 结果：暗调胶片   答题：纸感浅色
 * ============================================================ */

:root {
  --paper: #f2eee6;
  --paper-2: #e6e0d4;
  --ink: #16151a;
  --ink-2: #6d675d;

  --night: #14161a;
  --night-2: #1c1f24;
  --night-ink: #f4f1ea;
  --night-dim: #8d8a82;
  --n-line: rgba(244, 241, 234, .14);

  --accent: #d1502a;
  --accent-soft: rgba(209, 80, 42, .12);
  --gold: #e0a03c;
  --line: rgba(22, 21, 26, .13);

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--night);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------- 视图基础 ---------- */
.view { flex: 1; display: flex; flex-direction: column; position: relative; }
.view.day  { background: var(--paper); color: var(--ink); padding: 22px 22px 30px; }
.view.night {
  background: var(--night); color: var(--night-ink);
  padding: 22px 22px 30px;
}
/* 胶片颗粒 + 暖光晕 */
.view.night::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 70% at 78% -8%, rgba(224, 160, 60, .16), transparent 62%),
    radial-gradient(90% 55% at 8% 104%, rgba(209, 80, 42, .13), transparent 60%);
}
.view.night::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.014) 0 1px, transparent 1px 4px);
}
.view > * { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--night-dim);
}
.view.day .eyebrow { color: var(--ink-2); }

.mono { font-family: var(--mono); }

/* ---------- 封面 ---------- */
#view-cover { justify-content: space-between; padding-top: 26px; padding-bottom: 26px; }
.cover-top { display: flex; justify-content: space-between; align-items: center; }

.cover-main { margin-top: auto; margin-bottom: auto; padding: 26px 0 20px; }

.cover-title {
  margin: 0;
  font-size: 60px;
  line-height: .93;
  font-weight: 900;
  letter-spacing: -.035em;
}
.cover-title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
/* 荧光笔高亮：压在字的下半部，而不是当一条下划线 */
.cover-title em::after {
  content: ''; position: absolute; left: -1px; right: -1px; bottom: 9px;
  height: 21px; background: rgba(209, 80, 42, .34); z-index: -1;
}

.cover-coord {
  display: flex; align-items: center; gap: 10px;
  margin-top: 20px;
  font-size: 10px; letter-spacing: .14em;
  color: var(--night-dim);
}
.cover-coord .dots {
  flex: 1; height: 1px;
  background-image: linear-gradient(90deg, var(--n-line) 0 4px, transparent 4px 9px);
  background-size: 9px 1px; background-repeat: repeat-x;
}

.cover-sub {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(244, 241, 234, .66);
}

.cover-foot { padding-top: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%;
  border: 0; border-radius: 3px;
  padding: 17px 16px;
  font-family: inherit;
  font-size: 14px; font-weight: 600;
  letter-spacing: .28em; text-indent: .28em;
  cursor: pointer;
  transition: transform .12s ease, opacity .18s ease, background .18s ease;
}
.btn:active { transform: scale(.985); opacity: .9; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--night-ink);
  border: 1px solid var(--n-line); margin-top: 10px;
  letter-spacing: .18em; text-indent: .18em; font-weight: 500;
}
.view.day .btn-ghost { color: var(--ink); border-color: var(--line); }
.btn-quiet {
  background: transparent; border: 0; color: var(--ink-2);
  font-size: 13px; letter-spacing: .1em; text-indent: .1em;
  padding: 12px; font-weight: 500;
}

.fineprint {
  margin: 14px 0 0; text-align: center;
  font-size: 10.5px; letter-spacing: .06em;
  color: rgba(244, 241, 234, .38);
}

/* ---------- 答题页 ---------- */
.quiz-head { display: flex; flex-direction: column; gap: 10px; }
.quiz-count {
  font-size: 11px; letter-spacing: .16em; color: var(--ink-2);
}
.quiz-count b { color: var(--accent); font-weight: 700; }
.quiz-bar { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.quiz-bar i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
}

.quiz-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 26px 0; }

.q-text {
  margin: 0 0 26px;
  font-size: 21px; font-weight: 700;
  line-height: 1.55; letter-spacing: -.01em;
}

.opts { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, .5);
  padding: 16px 16px;
  font-size: 15px; line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
  transition: all .16s ease;
}
.opt:active { transform: scale(.99); }
.opt .idx {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: 10px; line-height: 1;
  padding: 5px 0 0;
  color: var(--ink-2); letter-spacing: .05em;
}
.opt.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.opt.sel .idx { color: var(--accent); font-weight: 700; }

.quiz-foot { min-height: 40px; }

/* ---------- 出生日期页 ---------- */
.birth-body { justify-content: flex-start; padding-top: 22px; }

.birth-sub {
  margin: -8px 0 26px;
  font-size: 13.5px; line-height: 1.75;
  color: var(--ink-2);
}

.birth-row { display: flex; gap: 9px; margin-bottom: 11px; }

.sel-wrap {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, .55);
  padding: 9px 13px 7px;
  transition: border-color .16s ease;
}
.sel-wrap:focus-within { border-color: var(--accent); }
.sel-wrap.wide { flex: 0 0 auto; }

.sel-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  color: var(--ink-2); margin-bottom: 3px;
}

.sel {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  border: 0; outline: 0; background: transparent;
  font-family: inherit;
  font-size: 17px; font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
  padding: 0 16px 0 0;
  /* 自绘箭头，避免各端原生控件样式差异 */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
                    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 2px center, right 7px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.birth-hint {
  margin: 4px 0 0;
  font-size: 11.5px; line-height: 1.7;
  color: var(--ink-2);
}

.birth-err {
  margin-top: 14px;
  font-size: 12.5px; line-height: 1.6;
  color: var(--accent);
  border: 1px solid rgba(209, 80, 42, .35);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 10px 12px;
}

#view-birth .quiz-foot { display: flex; flex-direction: column; }
#view-birth .btn-quiet { order: 2; margin-top: 2px; }

/* ---------- 计算中 ---------- */
#view-computing { justify-content: center; align-items: center; }
.comp-wrap { text-align: center; width: 100%; }
.comp-roll {
  font-size: 44px; font-weight: 900; letter-spacing: -.02em;
  color: var(--night-ink); line-height: 1.1;
  min-height: 52px;
}
.comp-hint {
  margin-top: 18px; font-size: 12px; letter-spacing: .1em;
  color: var(--night-dim);
}
.comp-dots { margin-top: 26px; display: flex; justify-content: center; gap: 5px; }
.comp-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--n-line); display: block;
  animation: pulse 1.1s infinite;
}
.comp-dots i:nth-child(2) { animation-delay: .18s; }
.comp-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; background: var(--accent); } }

/* ---------- 结果页 ---------- */
.res-top { display: flex; justify-content: space-between; align-items: baseline; }

.res-city { margin-top: 20px; }
.res-city-name {
  font-size: 68px; font-weight: 900;
  line-height: .95; letter-spacing: -.04em;
  animation: rise .5s cubic-bezier(.2, .8, .3, 1) both;
}
.res-city-en {
  margin-top: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  color: var(--night-dim);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.res-score-row {
  display: flex; align-items: flex-end; gap: 14px;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--n-line);
}
.res-score { display: flex; align-items: flex-start; gap: 2px; }
.res-score b {
  font-size: 54px; font-weight: 900; line-height: .9;
  color: var(--accent); letter-spacing: -.03em;
}
.res-score span { font-family: var(--mono); font-size: 15px; color: var(--accent); padding-top: 4px; }
.res-score-txt { padding-bottom: 3px; }
.res-score-t { font-size: 13px; font-weight: 600; }
.res-score-d { margin-top: 4px; font-size: 11px; color: var(--night-dim); letter-spacing: .05em; }

.res-line {
  margin: 26px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 19px; font-weight: 600; line-height: 1.6;
  letter-spacing: -.005em;
}

.res-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.res-tags span {
  font-size: 11px; letter-spacing: .06em;
  padding: 5px 10px; border-radius: 2px;
  background: rgba(244, 241, 234, .07);
  color: rgba(244, 241, 234, .72);
  border: 1px solid var(--n-line);
}

/* 雷达图 */
.radar-wrap { margin: 30px 0 6px; }
.radar-wrap svg { display: block; width: 100%; height: auto; }
.radar-legend {
  display: flex; justify-content: center; gap: 20px;
  margin-top: 10px; font-size: 11px; color: var(--night-dim); letter-spacing: .05em;
}
.radar-legend i {
  display: inline-block; width: 14px; height: 2px; vertical-align: middle;
  margin-right: 6px;
}
.radar-legend .lg-you i { background: var(--accent); }
.radar-legend .lg-city i {
  background: repeating-linear-gradient(90deg, var(--gold) 0 3px, transparent 3px 6px);
}

/* 内容块 */
.block { margin-top: 30px; }
.block-t {
  margin: 0 0 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--night-dim);
  display: flex; align-items: center; gap: 10px;
}
.block-t::after {
  content: ''; flex: 1; height: 1px; background: var(--n-line);
}

.reasons { margin: 0; padding: 0; list-style: none; }
.reasons li {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(244, 241, 234, .07);
  font-size: 14px; line-height: 1.65;
  color: rgba(244, 241, 234, .86);
}
.reasons li:last-child { border-bottom: 0; }
.reasons li b {
  flex: 0 0 auto; width: 20px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--accent); padding-top: 3px;
}

.adapt-box {
  font-size: 14px; line-height: 1.7;
  color: rgba(244, 241, 234, .8);
  border: 1px dashed var(--n-line);
  border-radius: 3px;
  padding: 15px;
}
.adapt-box strong { color: var(--night-ink); font-weight: 700; }

/* 实用信息 */
.kv-row { display: flex; flex-direction: column; gap: 1px; }
.kv {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid rgba(244, 241, 234, .07);
  font-size: 14px; line-height: 1.6;
}
.kv:last-child { border-bottom: 0; }
.kv-k {
  flex: 0 0 76px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--night-dim); padding-top: 4px;
}
.kv-v { flex: 1; color: rgba(244, 241, 234, .88); }

/* 票根卡 */
.ticket-row { display: flex; flex-direction: column; gap: 9px; }
.ticket {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--n-line);
  border-radius: 3px;
  background: rgba(244, 241, 234, .04);
  padding: 14px 15px;
  overflow: hidden;
}
.ticket::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gold); opacity: .8;
}
.ticket.off::after { background: var(--night-dim); opacity: .45; }
.ticket-name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.ticket-sub {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--night-dim); margin-top: 5px;
}
.ticket-tags { font-size: 11.5px; color: rgba(244, 241, 234, .6); margin-top: 6px; line-height: 1.5; }
.ticket-score {
  margin-left: auto; flex: 0 0 auto; text-align: right;
}
.ticket-score b { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--gold); }
.ticket.off .ticket-score b { color: var(--night-dim); }
.ticket-score i { font-size: 10px; font-style: normal; color: var(--night-dim); }

.off-note {
  margin: 12px 0 0; font-size: 12.5px; line-height: 1.7;
  color: rgba(244, 241, 234, .55);
}
.off-note em { font-style: normal; color: rgba(244, 241, 234, .78); }

.res-actions { margin-top: 34px; display: flex; flex-direction: column; gap: 0; }

/* ---------- 先天八字模块（结果页） ---------- */
.bazi-lunar {
  font-size: 17px; font-weight: 800; line-height: 1.45;
  color: var(--night-ink);
  letter-spacing: -.005em;
}
.bazi-solar {
  margin-top: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  color: var(--night-dim);
}

/* 四柱 / 三柱 */
.bazi-pillars { display: flex; gap: 7px; margin: 15px 0 2px; }
.bazi-pillars > div {
  flex: 1; text-align: center;
  border: 1px solid var(--n-line);
  border-radius: 3px;
  background: rgba(244, 241, 234, .04);
  padding: 9px 3px 10px;
}
.bazi-pillars i {
  display: block; font-style: normal;
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  color: var(--night-dim); margin-bottom: 5px;
}
.bazi-pillars b {
  display: block;
  font-size: 16px; font-weight: 800; letter-spacing: .03em;
  color: var(--night-ink);
}
.bazi-pillars > div.is-day {
  border-color: rgba(209, 80, 42, .5);
  background: rgba(209, 80, 42, .1);
}
.bazi-pillars > div.is-day b { color: var(--accent); }

/* 五行分布条 */
.wx-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.wx-bar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.wx-bar .nm {
  flex: 0 0 20px; font-weight: 700;
  color: rgba(244, 241, 234, .82);
}
.wx-bar .track {
  flex: 1; height: 6px; border-radius: 3px;
  background: rgba(244, 241, 234, .08);
  overflow: hidden;
}
.wx-bar .fill {
  display: block; height: 100%; border-radius: 3px;
  background: rgba(244, 241, 234, .3);
  transition: width .55s cubic-bezier(.3, 0, .2, 1);
}
.wx-bar .num {
  flex: 0 0 auto; width: 26px; text-align: right;
  font-family: var(--mono); font-size: 10px;
  color: var(--night-dim);
}
.wx-bar .tag {
  flex: 0 0 auto; width: 34px; text-align: center;
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  padding: 1px 4px; border-radius: 2px;
}
.wx-bar.is-main .nm { color: var(--accent); }
.wx-bar.is-main .fill { background: var(--accent); }
.wx-bar.is-main .tag { background: rgba(209, 80, 42, .22); color: var(--accent); }
.wx-bar.is-need .nm { color: var(--gold); }
.wx-bar.is-need .fill { background: var(--gold); }
.wx-bar.is-need .tag { background: rgba(224, 160, 60, .2); color: var(--gold); }

.wx-verdict {
  margin-top: 18px; padding-top: 15px;
  border-top: 1px solid var(--n-line);
  font-size: 14px; line-height: 1.75;
  color: rgba(244, 241, 234, .84);
}
.wx-verdict b { color: var(--night-ink); font-weight: 800; }
.wx-verdict .hl { color: var(--accent); font-weight: 800; }
.wx-verdict .hl2 { color: var(--gold); font-weight: 800; }

.wx-warn {
  margin-top: 15px; padding-left: 12px;
  border-left: 2px solid var(--n-line);
  font-size: 12.5px; line-height: 1.75;
  color: rgba(244, 241, 234, .55);
}

.wx-rel {
  margin-top: 14px;
  font-size: 13.5px; line-height: 1.7;
  color: rgba(244, 241, 234, .8);
  padding: 12px 14px;
  border-radius: 3px;
  background: rgba(224, 160, 60, .08);
  border: 1px solid rgba(224, 160, 60, .2);
}

/* 票根里的五行标 */
.wx-chip {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  padding: 2px 6px; border-radius: 2px;
  margin-left: 7px; vertical-align: 2px;
  background: rgba(224, 160, 60, .16);
  color: var(--gold);
}
.wx-chip.off { background: rgba(244, 241, 234, .07); color: var(--night-dim); }

/* ---------- 页脚 ---------- */
.footer {
  background: var(--night);
  padding: 18px 22px 26px;
  border-top: 1px solid var(--n-line);
}
.disclaimer {
  margin: 0; font-size: 10.5px; line-height: 1.75;
  color: rgba(244, 241, 234, .34);
}

/* ---------- 分享图弹层 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 11, 13, .9);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px; gap: 16px;
}
.sheet img {
  width: 100%; max-width: 360px;
  border-radius: 4px; display: block;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .6);
}
.sheet-tip { font-size: 12px; color: rgba(244, 241, 234, .6); text-align: center; line-height: 1.6; }
.sheet .btn { max-width: 360px; }

/* ---------- 桌面端 ---------- */
@media (min-width: 520px) {
  body { padding: 20px 0; }
  .app {
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
    min-height: calc(100vh - 40px);
  }
  .cover-title { font-size: 66px; }
  .res-city-name { font-size: 74px; }
}
