/* 沈阳供暖大测评 H5 —— 设计基准 375 x 714，整体等比缩放。
 * 设计原稿为 375 x 812（含 44 状态栏 + 54 小程序导航）；
 * 真实 web-view 顶部已被小程序原生导航占据，页面不自绘标题栏，故画布高度减 98、内容整体上移 98。 */
:root {
  --orange: #ff5c0a;
  --orange-deep: #ff631b;
  --ink: #2c1b11;
  --ink-2: #432a17;
  --ink-3: #5f4026;
  --paper: #fef6ec;
  --option: #feebc7;
  --track: #f4e2d0;
  --muted: #a38b76;
  --btn-gradient: linear-gradient(180deg, #ffaa4f 0%, #ff3746 100%);
  --btn-shadow: 0 6px 10px rgba(255, 89, 26, .18);
  --font-display: "Tensentype JiaLiCuYuanGB18030", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: #efe9e1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; color: inherit; }

/* ---------- 舞台：固定 375x714，按宽度等比缩放 ---------- */
.device {
  --scale: 1;
  position: relative;
  width: 375px;
  height: 714px;
  overflow: hidden;
  flex: none;
  background: #fff7ee;
  box-shadow: 0 12px 40px rgba(80, 48, 24, .14);
}

.stage {
  position: absolute;
  top: 0; left: 0;
  width: 375px;
  height: 714px;
  transform: scale(var(--scale));
  transform-origin: 0 0;
  overflow: hidden;
}

.screen, .overlay {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active, .overlay.active { display: block; }

.bg {
  position: absolute;
  inset: 0;
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
}
.bg-home { background-image: url("../images/heating-home-bg.jpg"); }
.bg-inner { background-image: url("../images/heating-inner-bg.jpg"); }

.bg-home::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(254, 201, 197, .55) 0%, rgba(254, 201, 197, 0) 34%, rgba(254, 213, 198, 0) 88%, rgba(254, 213, 198, .9) 100%);
}
.bg-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(254, 213, 198, 0) 91%, rgba(254, 213, 198, .85) 100%);
}

/* ---------- 通用组件 ---------- */
.btn-primary {
  position: absolute;
  border-radius: 29px;
  background: var(--btn-gradient);
  border: 1px solid #fff9df;
  box-shadow: var(--btn-shadow);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 1px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn-primary:active { transform: scale(.97); opacity: .92; }

.btn-plain {
  position: absolute;
  border-radius: 29px;
  background: var(--paper);
  border: 1px solid var(--orange);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  transition: transform .12s ease;
}
.btn-plain:active { transform: scale(.97); }

.link-arrow {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink-2);
  font-family: var(--font-display);
  white-space: nowrap;
}
.link-arrow .arrow { font-size: 18px; line-height: 1; font-family: var(--font-body); font-weight: 700; }
.link-arrow.back .arrow { order: -1; }

.card {
  position: absolute;
  background: var(--paper);
  border-radius: 20px;
}

.page-title {
  position: absolute;
  left: 24px; top: 28px; width: 327px; height: 46px; margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 900;
  line-height: 46px;
  letter-spacing: -1px;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- 首页 ---------- */
.home-title {
  position: absolute; left: 43px; top: 22px; width: 290px;
  font-family: var(--font-display); font-weight: 900; letter-spacing: -2px;
  line-height: 1;
  -webkit-text-stroke: .6px currentColor;
}
.home-title .line1 { font-size: 72px; color: var(--ink); white-space: nowrap; }
.home-title .line2 { font-size: 83px; color: var(--orange); margin-left: 19px; margin-top: 2px; white-space: nowrap; }

.ticket {
  position: absolute; top: 220px; height: 39px;
  border-radius: 5px; border: 1px solid #fff9e9;
  box-shadow: 0 2px 3px rgba(153, 77, 0, .08);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; font-family: var(--font-display);
  transition: transform .12s ease;
}
.ticket:active { transform: scale(.96); }
.ticket.green { left: 65px; width: 133px; background: linear-gradient(180deg, #e2f4ce, #fff2b1); color: #153c26; }
.ticket.orange { left: 198px; width: 113px; background: linear-gradient(180deg, #ffb443, #ff7613); color: #fff; }

.home-cta { left: 28px; top: 563px; width: 319px; height: 58px; font-size: 27px; }
.home-cta.with-arrow::after { content: "›"; font-family: var(--font-body); font-size: 28px; font-weight: 700; margin-left: 10px; line-height: 1; }
.home-rank { left: 142px; top: 639px; }

/* ---------- 问卷 ---------- */
.quiz-card { left: 24px; top: 47px; width: 327px; height: 522px; }
.quiz-card.wide { height: 590px; }
.quiz-head { position: absolute; left: 20px; top: 32px; display: flex; align-items: baseline; gap: 13px; }
.quiz-step { font-size: 20px; font-weight: 900; color: var(--orange); font-family: var(--font-display); }
.quiz-total { font-size: 16px; color: var(--ink-2); }
.progress { position: absolute; left: 20px; top: 68px; width: 287px; display: flex; gap: 8px; }
.progress i { width: 90.33px; height: 10px; border-radius: 14px; background: var(--track); transition: background .2s ease; }
.progress i.on { background: var(--orange); }
.quiz-q {
  position: absolute; left: 20px; top: 108px; width: 287px; margin: 0;
  font-size: 20px; font-weight: 900; color: var(--ink); line-height: 24px;
}
.quiz-options { position: absolute; left: 20px; top: 162px; width: 287px; }
.quiz-options.grid { display: grid; grid-template-columns: 138px 138px; gap: 12px 12px; }

.option {
  width: 287px; height: 56px; margin-bottom: 12px;
  border-radius: 48px; background: var(--option); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.quiz-options.grid .option { width: 138px; margin-bottom: 0; }
.option:active { transform: scale(.97); }
.option.selected { background: var(--orange); color: #fff; font-weight: 800; }

.community {
  position: absolute; left: 20px; top: 502px; width: 287px; height: 56px;
  border-radius: 48px; background: var(--option); display: flex; align-items: center;
}
.community[hidden] { display: none; }
.community input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent;
  padding: 0 24px; font-size: 18px; font-weight: 600; color: var(--ink);
}
.community input::placeholder { color: #b29c88; font-weight: 500; }
.community .community-done {
  width: 72px; height: 42px; margin-right: 7px; border-radius: 24px;
  background: var(--btn-gradient); color: #fff; font-size: 15px; font-weight: 900;
  display: none; align-items: center; justify-content: center;
}
.community.ready .community-done { display: flex; }
.community.ready input { padding-right: 8px; }

.quiz-prev { left: 161px; top: 587px; }
.quiz-prev.q3 { top: 655px; }
.quiz-submit-hint {
  position: absolute; left: 44px; top: 616px; width: 287px;
  font-size: 13px; color: var(--muted); text-align: center; display: none;
}
.quiz-submit-hint.show { display: block; }

/* ---------- 排行榜 ---------- */
.rank-card { left: 24px; top: 99px; width: 327px; height: 560px; }
/* 三等分栅格：每列一个 tab 居中，字数不同（区域温度 4 字 / 满意度 3 字）也不会挤到右边缘 */
.rank-tabs {
  position: absolute; left: 20px; top: 32px; width: 287px;
  display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center;
}
.rank-tab {
  height: 40px; font-size: 18px; color: var(--ink-3); font-weight: 400;
  border-bottom: 2px solid transparent; padding: 0 2px 6px; white-space: nowrap;
}
.rank-tab.on { color: var(--ink); font-weight: 900; border-bottom-color: var(--orange); }

/* 居中：满 3 个时正好铺满 287，只上榜 1~2 个时也不会偏在左边 */
.podium { position: absolute; left: 20px; top: 88px; width: 287px; display: flex; justify-content: center; gap: 8px; }
.podium-item {
  width: 90.33px; height: 112px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.podium-item.no2 { background: #e8f4e8; }
.podium-item.no1 { background: #fff0cb; }
.podium-item.no3 { background: #fbebdd; }
.podium-item .no { font-size: 11px; font-weight: 600; color: #9a8876; }
.podium-item.no1 .no { color: var(--orange-deep); }
.podium-item .area { font-size: 14px; font-weight: 900; color: #39271d; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-item .value { font-size: 20px; font-weight: 900; color: #443027; }
.podium-item.no1 .value { color: var(--orange-deep); }

.rank-list {
  position: absolute; left: 20px; top: 210px; width: 287px; height: auto; max-height: 206px;
  background: #fff; border-radius: 10px; overflow: hidden;
}
/* 没有前三名（区域都未达阈值）时列表上移，避免领奖台位置留一大块空白；
   说明文字的位置由 JS 按列表实际高度贴到列表下方 */
.rank-card.no-podium .rank-list { top: 96px; max-height: 320px; }
.rank-row { height: 29.4px; display: flex; align-items: center; padding: 0 10px; font-size: 13px; }
.rank-row .r { width: 30px; font-size: 12px; color: #94785f; }
.rank-row .a { flex: 1; font-weight: 600; color: #3f2c21; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .v { width: 76px; text-align: right; font-size: 14px; font-weight: 600; color: #3f2c21; }
.rank-row.insufficient { color: #a9a099; }
.rank-row.insufficient .a { font-weight: 400; color: #a9a099; }
.rank-row.insufficient .v { font-size: 12px; font-weight: 400; color: #b3aaa2; }

.rank-note { position: absolute; left: 20px; top: 426px; width: 287px; text-align: center; font-size: 9px; color: var(--muted); line-height: 12px; }
.rank-cta { left: 44px; top: 569px; width: 287px; height: 58px; font-size: 27px; }

/* ---------- 排行榜无数据状态 ---------- */
.rank-empty {
  position: absolute; left: 20px; top: 88px; width: 287px; height: 366px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.empty-art {
  width: 132px; height: 132px; border-radius: 50%; margin-bottom: 26px;
  background: radial-gradient(circle at 40% 35%, #fff7e8 0%, #ffe7c4 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 172, 80, .25);
  display: flex; align-items: center; justify-content: center;
}
.empty-art svg { width: 76px; height: 76px; }
.empty-title { font-size: 18px; font-weight: 900; color: var(--ink); font-family: var(--font-display); }
.empty-desc { margin-top: 12px; font-size: 13px; line-height: 22px; color: #8a725e; text-align: center; }
.empty-hint {
  margin-top: 22px; padding: 7px 14px; border: 1px dashed #e8cdb0; border-radius: 16px;
  font-size: 11px; color: #b29c88; white-space: nowrap;
}
/* 加载失败态：整块可点重试，光标给个反馈 */
.rank-empty.retry { cursor: pointer; }
.rank-empty.retry .empty-desc { color: #cf8a4a; font-weight: 600; }

/* ---------- 结果页 ---------- */
.result-card { left: 24px; top: 99px; width: 327px; height: 483px; }
.result-temp {
  position: absolute; left: 20px; top: 32px; width: 287px; height: 77px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 900; color: var(--orange); font-family: var(--font-display);
  letter-spacing: -1px;
}
.result-badge {
  position: absolute; left: 84px; top: 125px; width: 160px; height: 44px;
  border-radius: 45px; background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; font-family: var(--font-display);
}
.result-area { position: absolute; left: 20px; top: 185px; width: 287px; text-align: center; font-size: 19px; font-weight: 900; color: var(--ink-3); }
.result-slogan { position: absolute; left: 20px; top: 239px; width: 287px; text-align: center; font-size: 24px; font-weight: 900; color: var(--ink); font-family: var(--font-display); }
.result-desc { position: absolute; left: 20px; top: 283px; width: 287px; text-align: center; font-size: 16px; color: var(--ink-3); }
.result-share { left: 44px; top: 430px; width: 287px; height: 54px; font-size: 24px; }
.result-again { left: 44px; top: 496px; width: 287px; height: 54px; font-size: 24px; }
.result-rank { left: 142px; top: 600px; }

/* ---------- 登录弹层 ---------- */
.overlay { z-index: 40; }
.overlay .mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.login-sheet {
  position: absolute; left: 0; top: 487px; width: 375px; height: 227px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #fdf1eb 79%, #fdddcc 100%);
}
.login-title { position: absolute; left: 21px; top: 32px; width: 333px; font-size: 24px; font-weight: 900; color: var(--ink); font-family: var(--font-display); }
.login-btn {
  position: absolute; left: 21px; top: 76px; width: 333px; height: 58px;
  border-radius: 29px; background: linear-gradient(180deg, #4dd655, #17a630);
  color: #fff; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 24px; font-weight: 900; font-family: var(--font-display);
  transition: transform .12s ease;
}
.login-btn:active { transform: scale(.97); }
.wechat-icon { width: 28px; height: 28px; position: relative; }
.wechat-icon i { position: absolute; border-radius: 50%; border: 2.4px solid #fff; }
.wechat-icon i:first-child { width: 22px; height: 18px; left: 0; top: 1px; }
.wechat-icon i:last-child { width: 18px; height: 15px; left: 10px; top: 11px; background: #3ab54a; }
.wechat-icon i::before, .wechat-icon i::after { content: ""; position: absolute; width: 2.6px; height: 2.6px; border-radius: 50%; background: #fff; top: 5px; }
.wechat-icon i::before { left: 4px; }
.wechat-icon i::after { right: 4px; }
.login-skip { left: 132px; top: 150px; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%) scale(.94);
  z-index: 60; max-width: 300px; padding: 10px 16px; border-radius: 20px;
  background: rgba(44, 27, 17, .88); color: #fff; font-size: 13px; line-height: 18px;
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) scale(1); }

@media (min-width: 480px) {
  body { align-items: center; padding: 24px 0; }
}
