/* ==========================================================
   Lunarsay 心灵小测 —— 纯静态站点样式
   暖色治愈风 / 移动端优先
   ========================================================== */

:root {
  --bg: #fdf8f2;
  --bg-soft: #faf3ea;
  --card: #ffffff;
  --primary: #f0904a;
  --primary-deep: #e07d33;
  --primary-soft: #fde7d3;
  --primary-glow: rgba(240, 144, 74, 0.28);
  --text: #3b322c;
  --text-sub: #9b8e85;
  --text-light: #b9aca2;
  --line: #f2e7db;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 6px 20px rgba(180, 140, 100, 0.1);
  --shadow-soft: 0 2px 10px rgba(180, 140, 100, 0.08);
}

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

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px 40px;
  min-height: 100vh;
}

/* ---------------- 视图切换 ---------------- */
.view { display: none; animation: fadeUp 0.28s ease both; }
.view.active { display: block; }

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

/* ---------------- 首页头部 ---------------- */
.home-head { padding: 26px 0 18px; }

.home-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: var(--text);
}

.home-sub {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-sub);
}

.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #8c7f76;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.icon-btn:active { transform: scale(0.93); }

/* ---------------- 随机一题卡片 ---------------- */
.random-card {
  width: 100%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f6a35f 0%, #f0904a 55%, #ee8740 100%);
  box-shadow: 0 10px 24px var(--primary-glow);
  text-align: left;
  margin-bottom: 20px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.random-card:active { transform: scale(0.985); box-shadow: 0 4px 14px var(--primary-glow); }

.random-title {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.random-sub {
  margin-top: 2px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.random-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- 分类标签 ---------------- */
.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0 14px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 90%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 90%, transparent 100%);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  border: none;
  cursor: pointer;
  padding: 9px 18px;
  border-radius: 999px;
  background: #f3ece4;
  color: #8b7d73;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ---------------- 广告位 ---------------- */
.ad-slot { display: none; }
.ad-slot.show { display: block; margin: 6px 0 18px; }

.ad-box {
  border: 1.5px dashed #e6d6c6;
  border-radius: var(--radius-md);
  background: #fffaf4;
  color: var(--text-light);
  font-size: 12.5px;
  text-align: center;
  padding: 22px 12px;
}
.ad-rect { min-height: 100px; }
.ad-banner { min-height: 64px; }

/* ---------------- 测试卡片列表 ---------------- */
.test-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 10px;
}

@media (max-width: 380px) {
  .test-list { grid-template-columns: 1fr; }
}

.test-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.test-card:active { transform: translateY(1px) scale(0.99); }

.tc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 22px;
}

.tag {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 7px;
  background: #f6efe7;
  color: #9b8b7c;
  font-weight: 600;
}
.tag-hot {
  background: var(--primary-soft);
  color: #d9762b;
}

.tc-done {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3fae7a;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tc-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.tc-brief {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.55;
  margin-bottom: 12px;
  flex: 1;
}

.tc-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.tc-action {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-deep);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  padding: 40px 0;
}

/* ---------------- 答题页 ---------------- */
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}
.quiz-counter { font-size: 14px; font-weight: 700; color: var(--text-sub); }
.quiz-placeholder { width: 42px; height: 42px; }

.progress {
  height: 6px;
  background: #f1e7dc;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7b072, var(--primary));
  transition: width 0.3s ease;
}

.quiz-body { padding: 30px 0 0; }

.quiz-question {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.3px;
  margin-bottom: 26px;
  min-height: 62px;
}

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

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1.5px solid #f1e6da;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 15.5px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.16s ease;
  font-family: inherit;
  line-height: 1.45;
}
.option:active { transform: scale(0.99); }
.option.selected {
  border-color: var(--primary);
  background: #fff7f0;
}

.option-dot {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.8px solid #e8d8c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  color: #bfab99;
  font-weight: 700;
}
.option.selected .option-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quiz-foot { padding: 22px 0 6px; }

.btn {
  display: block;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px var(--primary-glow);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.985); }

.btn-ghost {
  background: #f4ece3;
  color: #8b7d73;
  box-shadow: none;
}
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-outline {
  background: #fff;
  color: var(--primary-deep);
  border: 1.5px solid var(--primary-soft);
  box-shadow: var(--shadow-soft);
}

/* ---------------- 结果页 ---------------- */
.result-hero {
  position: relative;
  background: linear-gradient(160deg, #fff6ec 0%, #ffe9d5 100%);
  border-radius: var(--radius-lg);
  padding: 30px 22px 44px;
  margin: 22px 0 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.result-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c99a6d;
  margin-bottom: 12px;
}

.result-type {
  display: inline-block;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #d9762b;
  background: #fff;
  padding: 8px 18px;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(214, 140, 80, 0.18);
  transform: rotate(-1.2deg);
  margin-bottom: 18px;
  line-height: 1.3;
}

.result-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.result-tags span {
  font-size: 12.5px;
  font-weight: 600;
  color: #b97b45;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #f4ddc6;
  padding: 5px 11px;
  border-radius: 999px;
}

.result-quote {
  font-size: 15.5px;
  line-height: 1.7;
  color: #7a6450;
  font-style: italic;
}

.result-watermark {
  position: absolute;
  right: 18px;
  bottom: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(197, 154, 113, 0.55);
}

.result-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.result-card h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}

.result-desc {
  font-size: 14.5px;
  line-height: 1.85;
  color: #6d6058;
}

.result-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }

.note-box {
  background: #fff6e6;
  border: 1px solid #f6e3c6;
  color: #a67b3f;
  font-size: 12.5px;
  line-height: 1.6;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 12px 0;
}

.prompt-box {
  background: #fff;
  border: 1px dashed #f0d9c2;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: #a58d78;
  text-align: center;
  margin: 12px 0;
}

/* ---------------- 历史页 ---------------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 18px;
}
.page-title { font-size: 18px; font-weight: 800; }

.history-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 10px; }

.history-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 15px 16px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.hi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.hi-type { font-size: 15px; font-weight: 800; color: #d9762b; }
.hi-time { font-size: 11.5px; color: var(--text-light); }
.hi-test { font-size: 12.5px; color: var(--text-sub); }

.hi-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  padding: 60px 0;
}

/* ---------------- 页脚 / 免责 ---------------- */
.site-foot { padding: 24px 0 8px; text-align: center; }

.disclaimer {
  font-size: 11.5px;
  line-height: 1.7;
  color: #b3a69c;
  text-align: center;
  padding: 16px 8px 0;
}

.privacy {
  font-size: 10.5px;
  color: #c2b6ac;
  text-align: center;
  margin-top: 6px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translate(-50%, 16px);
  background: rgba(59, 50, 44, 0.92);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.26s ease;
  z-index: 999;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 桌面端微调 ---------------- */
@media (min-width: 600px) {
  #app { padding-left: 24px; padding-right: 24px; }
  .home-title { font-size: 30px; }
  .test-list { gap: 16px; }
}