/* ============================================================
   徒步 & 溜达风格测试 · 山野活力风(设计稿 V1)
   浅绿底 / 森林绿 + 橙 / 大圆角胶囊 / 3D 按压
   ============================================================ */

:root {
  --bg: #f4f8f3;
  --ink: #1f3d2b;
  --muted: #5b7a66;
  --muted-light: #8aa394;
  --muted-faint: #9db8a8;
  --green: #2d8a4e;
  --green-dark: #1d6636;
  --green-soft: #e9f5ec;
  --green-grad: #7fb069;
  --orange: #ff8c42;
  --orange-dark: #d96b1f;
  --orange-soft: #fff3e8;
  --orange-line: #ffb37e;
  --orange-line-soft: #ffd9b8;
  --card: #ffffff;
  --line: #e3efe4;
  --line-soft: #ddebe0;
  --opt-bg: #fbfdfb;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-card: 0 4px 0 var(--line);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* 页面容器:移动端优先,桌面端居中卡片 */
.page {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 20px 40px;
}

/* ---------- 按钮:胶囊 + 3D 按压 ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:active {
  transform: translateY(3px);
}

.btn-orange {
  background: var(--orange);
  box-shadow: 0 5px 0 var(--orange-dark);
  letter-spacing: 6px;
  text-indent: 6px;
}

.btn-orange:active {
  box-shadow: 0 2px 0 var(--orange-dark);
}

.btn-green {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-dark);
  letter-spacing: 2px;
}

.btn-green:active {
  box-shadow: 0 2px 0 var(--green-dark);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 首页 ---------- */
.home-page {
  padding-top: 56px;
}

.hero {
  text-align: center;
}

.logo-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.logo-row span {
  font-size: 30px;
}

.hero-title {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 1px;
}

.hero-title .accent {
  color: var(--green);
}

.hero-sub {
  margin: 14px auto 0;
  max-width: 300px;
  font-size: 15px;
  color: var(--muted);
}

.hero-desc {
  margin: 26px 0;
  padding: 16px 18px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  font-size: 14px;
  color: #4a6254;
}

.hero .btn {
  margin-top: 4px;
}

.foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-faint);
}

/* ---------- 测试页 ---------- */
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.quiz-head .num {
  font-size: 22px;
  font-weight: 900;
  color: var(--green);
  white-space: nowrap;
}

.quiz-head .total {
  font-size: 13px;
  color: var(--muted-light);
  white-space: nowrap;
}

.track {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 22px;
}

.track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--green-grad));
  transition: width 0.3s ease;
}

.q-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 20px 22px;
  animation: fadeSlide 0.22s ease;
}

.q-card .q {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.5;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 15px 16px;
  background: var(--opt-bg);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.5;
  color: #2c4a39;
  text-align: left;
  transition: all 0.15s ease;
}

.opt .k {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.opt:active,
.opt.picked {
  border-color: var(--green);
  background: var(--green-soft);
}

.opt.picked .k {
  background: var(--orange);
}

.back {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--muted-light);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.back:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 加载 / 错误状态 ---------- */
.state-box {
  padding: 48px 24px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state-title {
  font-size: 18px;
  font-weight: 800;
}

.state-desc {
  margin: 10px 0 22px;
  font-size: 14px;
  color: var(--muted);
}

.state-box .btn {
  max-width: 240px;
  margin: 0 auto;
}

/* ---------- 结果页 ---------- */
.result-hero {
  text-align: center;
}

.result-hero .avatar {
  width: 96px;
  height: 128px;
  margin: 0 auto 14px;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 24px;
  box-shadow: 0 6px 16px rgba(45, 138, 78, 0.25);
}

.result-hero .code {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.1;
  color: var(--green);
}

.result-hero .name {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
}

.result-hero .share {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 14px;
  background: var(--orange-soft);
  border: 1.5px dashed var(--orange-line);
  border-radius: 999px;
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 700;
}

.result-hero .title {
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}

.kw {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 4px;
}

.kw span {
  padding: 5px 14px;
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.card {
  margin-top: 16px;
  padding: 18px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 3px 0 var(--line);
}

.card h3 {
  margin-bottom: 8px;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--green);
}

.card p,
.card li {
  font-size: 14.5px;
  color: #3c5747;
}

.card ul {
  list-style: none;
}

.card li {
  position: relative;
  padding: 6px 0 6px 22px;
}

.card li::before {
  content: "✦";
  position: absolute;
  left: 2px;
  color: var(--orange);
}

.joke {
  background: var(--orange-soft);
  border-color: var(--orange-line-soft);
}

.joke h3 {
  color: var(--orange-dark);
}

.again {
  margin-top: 26px;
}

.result-page .foot {
  margin-top: 18px;
}

/* ---------- 数据统计页 ---------- */
.stats-head {
  text-align: center;
  margin-bottom: 18px;
}

.stats-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
}

.stats-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.stats-body .state-box {
  margin-top: 18px;
}

.stats-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 18px 22px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.stats-total .num {
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  color: var(--green);
}

.stats-total .label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 3px;
  text-indent: 3px;
}

.stats-section {
  margin-top: 18px;
  padding: 18px 16px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.stats-section h2 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--green);
}

.stat-list {
  list-style: none;
}

.stat-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row .name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: #2c4a39;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-row .count {
  font-size: 13px;
  color: var(--muted-light);
  white-space: nowrap;
}

.stat-row .percent {
  width: 58px;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: var(--orange-dark);
  white-space: nowrap;
}

.chart-list {
  list-style: none;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.chart-row .name {
  flex: none;
  width: 80px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-track {
  flex: 1;
  min-width: 0;
  height: 14px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d8a4e, #ff8c42);
}

.chart-row .percent {
  flex: none;
  width: 46px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
}

.stats-back {
  display: block;
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-light);
}

.stats-back:active {
  opacity: 0.7;
}

/* 首页底部:数据统计入口(小字、灰绿,不抢主按钮) */
.stats-entry {
  display: block;
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-light);
}

.stats-entry:active {
  opacity: 0.7;
}

/* ---------- 桌面端:居中卡片,背景更宽敞 ---------- */
@media (min-width: 480px) {
  .page {
    padding-top: 56px;
    padding-bottom: 56px;
  }
}

@media (max-width: 360px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-title {
    font-size: 27px;
  }

  .q-card {
    padding-left: 16px;
    padding-right: 16px;
  }

  .quiz-head .total {
    display: none;
  }
}

@media (max-width: 375px) {
  .stats-total .num {
    font-size: 46px;
  }

  .chart-row {
    gap: 8px;
  }

  .chart-row .name {
    width: 64px;
  }

  .chart-row .percent {
    width: 42px;
  }
}

/* 保存结果轻提示 toast */
.save-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #2d8a4e; color: #fff; font-size: 14px; font-weight: 700;
  padding: 10px 20px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 999; max-width: 86vw; text-align: center;
}
.save-toast.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.save-toast.toast-fail { background: #d96b1f; }
