/* ============================================================
 * 颜色性格测试 · 样式
 * ============================================================ */
:root {
  --red: #FF4D4F;   --red-deep: #E03B2E;
  --yellow: #FFB020;--yellow-deep: #E2950F;
  --blue: #3B82F6;  --blue-deep: #2563EB;
  --green: #22C55E; --green-deep: #16A34A;
  --ink: #1f2430;
  --ink-soft: #6b7280;
  --paper: #ffffff;
  --radius: 22px;
  --shadow: 0 14px 40px rgba(31,36,48,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #f4f5f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ---------- 屏幕切换 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 0 22px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
}
.screen.is-active { display: flex; opacity: 1; transform: none; }

/* ================= 首页（四色竖向卡片） ================= */
.screen-home {
  flex-direction: column;
  padding: 7vh 0 0;
  background: #fff;
}
.home-head { text-align: center; padding: 0 22px; }
.home-kicker {
  letter-spacing: .3em; font-size: 12px; color: var(--ink-soft);
  margin: 0 0 12px; font-weight: 600;
}
.home-title {
  font-size: 40px; line-height: 1.15; margin: 0 0 10px;
  font-weight: 900; letter-spacing: 1px;
}
.grad-text {
  background: linear-gradient(135deg,var(--red),var(--yellow) 40%,var(--green) 70%,var(--blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home-sub { color: var(--ink-soft); font-size: 14px; margin: 0; }

.color-cols {
  flex: 1;
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 30px 0 0; gap: 0;
}
.color-col {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 6px; color: #fff;
  transition: transform .18s ease;
}
.color-col:active { transform: scale(.97); }
.color-col[data-color="red"]    { background: linear-gradient(160deg,#FF7A6B,#FF3B30); }
.color-col[data-color="yellow"] { background: linear-gradient(160deg,#FFCB5E,#FF9E2C); }
.color-col[data-color="blue"]   { background: linear-gradient(160deg,#5BA3FF,#2563EB); }
.color-col[data-color="green"]  { background: linear-gradient(160deg,#4CD97E,#16A34A); }
.cc-emoji { font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); }
.cc-name { font-size: 22px; font-weight: 800; letter-spacing: 3px; }
.cc-label { font-size: 13px; opacity: .92; letter-spacing: 1px; }

.home-foot-wrap { padding: 18px 22px 24px; text-align: center; }
.btn-start {
  width: 100%;
  border: none; border-radius: 999px;
  padding: 16px; font-size: 18px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg,#FF8A3D,#FF6B2C);
  box-shadow: 0 12px 26px rgba(255,120,40,.40);
  cursor: pointer; letter-spacing: 4px;
  transition: transform .15s ease;
  animation: pulse 2.4s ease-in-out infinite;
}
.btn-start:active { transform: scale(.97); }
@keyframes pulse {
  0%,100% { box-shadow: 0 12px 26px rgba(255,120,40,.34); }
  50%     { box-shadow: 0 12px 34px rgba(255,120,40,.58); }
}
.home-foot { color: var(--ink-soft); font-size: 13px; margin: 14px 0 0; }
.home-foot b { color: var(--red); }

/* ================= 答题页 ================= */
.screen-quiz { padding-top: 0; }
.quiz-top {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 4px 12px;
  position: sticky; top: 0; background: #fff; z-index: 5;
}
.quiz-back {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: #f1f2f6; color: var(--ink); font-size: 24px; line-height: 1;
  cursor: pointer; flex: none;
}
.progress-wrap { flex: 1; height: 12px; background: #f0e2d6; border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 5%; border-radius: 999px;
  background: linear-gradient(90deg,#FF8A3D,#FF6B2C);
  transition: width .4s cubic-bezier(.4,1.2,.5,1);
}
.progress-num { font-size: 13px; color: var(--ink-soft); font-weight: 700; flex: none; min-width: 38px; text-align: right; }

.quiz-body { padding: 18px 4px 40px; flex: 1; }
.quiz-index {
  font-size: 14px; font-weight: 800; letter-spacing: 3px; color: var(--red);
  margin: 0 0 14px;
}
.quiz-q {
  font-family: "Songti SC","STSong","SimSun",Georgia,"Times New Roman",serif;
  font-size: 27px; line-height: 1.5; margin: 0 0 30px; font-weight: 700; color: #20242e;
}

.options { display: flex; flex-direction: column; gap: 16px; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px;
  border: 1.5px solid #e6e8ee; border-radius: 16px;
  padding: 18px 18px; cursor: pointer; background: #fff;
  font-size: 16px; line-height: 1.45; font-weight: 500; color: var(--ink);
  transition: transform .15s ease, border-color .2s ease, background .2s ease;
  animation: optIn .35s ease both;
}
.option:active { transform: scale(.98); }
.option.is-picked {
  border-color: var(--picked, var(--red));
  background: var(--picked-bg, #fff5f4);
}
.option.is-picked::after {
  content: ""; position: absolute; right: 18px; top: 50%;
  width: 22px; height: 22px; border-radius: 50%;
  transform: translateY(-50%); background: var(--picked, var(--red));
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
}
@keyframes optIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ================= 计分过渡页 ================= */
.screen-scoring { align-items: center; justify-content: center; background: linear-gradient(180deg,#fff,#fbfbff); }
.scoring-inner { text-align: center; }
.scoring-ring {
  width: 130px; height: 130px; margin: 0 auto 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(from 0deg, var(--red),var(--yellow),var(--green),var(--blue),var(--red));
  animation: spin 1.6s linear infinite;
  box-shadow: 0 0 0 10px #fff, 0 10px 30px rgba(0,0,0,.12);
}
.scoring-ring::before {
  content: ""; position: absolute; width: 104px; height: 104px; border-radius: 50%; background: #fff;
}
.scoring-emoji { position: relative; font-size: 46px; animation: bob 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%,100%{ transform: translateY(-4px);} 50%{ transform: translateY(4px);} }
.scoring-title { font-size: 24px; font-weight: 800; margin: 0 0 8px; }
.scoring-sub { color: var(--ink-soft); margin: 0; }

/* ================= 结果页（整页主色铺底） ================= */
.screen-result { padding-top: 0; padding-bottom: 36px; overflow-y: auto; background: #fff; }
.result-hero {
  text-align: center; color: #fff; padding: 46px 22px 40px;
  margin: 0 -22px 22px; position: relative; overflow: hidden;
}
.result-hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 82% 4%, rgba(255,255,255,.26), transparent 52%);
}
.result-kicker { position: relative; z-index:1; letter-spacing: .22em; font-size: 13px; opacity: .95; margin: 0 0 18px; font-weight: 700; }
.result-emoji-row { position: relative; z-index:1; display: inline-flex; flex-direction: column; align-items: center; }
.result-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.2)); }
.result-color-name { font-size: 34px; font-weight: 900; letter-spacing: 4px; margin-top: 8px; }
.result-title {
  position: relative; z-index:1; font-family: "Songti SC","STSong","SimSun",Georgia,serif;
  font-size: 30px; font-weight: 700; margin: 18px 0 14px;
}
.pill {
  position: relative; z-index:1; display: inline-block;
  background: rgba(255,255,255,.24); border: 1px solid rgba(255,255,255,.5);
  padding: 7px 20px; border-radius: 999px; font-size: 14px; font-weight: 700; letter-spacing: 1px;
  backdrop-filter: blur(3px);
}
.result-combo { position: relative; z-index:1; font-size: 14px; opacity: .96; margin: 16px auto 0; max-width: 300px; line-height: 1.6; }

.result-card {
  background: #fff; border: 1px solid #f0f1f5; border-radius: var(--radius);
  padding: 20px 18px; margin: 0 0 16px; box-shadow: 0 8px 22px rgba(31,36,48,.05);
}
.result-core { font-size: 16px; line-height: 1.75; color: #343a47; margin: 0; }
.rc-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; margin: 0 0 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red{background:var(--red);} .dot-yellow{background:var(--yellow);} .dot-blue{background:var(--blue);} .dot-green{background:var(--green);}
.rc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rc-list li {
  position: relative; padding-left: 24px; font-size: 15px; line-height: 1.55; color: #343a47;
}
.rc-list li::before {
  content: "●"; position: absolute; left: 4px; top: 0; font-size: 10px; color: var(--red);
}
.rc-list-grow li::before { color: var(--blue); }
.rc-list-advice li::before { color: var(--green); }
.rc-list-advice li { padding-left: 26px; }
.rc-list-advice li::before { content: "💡"; font-size: 12px; left: 0; top: 2px; }

.score-bars { display: flex; flex-direction: column; gap: 14px; }
.score-row { display: flex; align-items: center; gap: 12px; }
.score-name { width: 42px; font-size: 14px; font-weight: 700; flex: none; }
.score-track { flex: 1; height: 14px; background: #f1f2f6; border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 999px; width: 0; transition: width .8s cubic-bezier(.4,1,.4,1); }
.score-val { width: 34px; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-soft); flex: none; }

.best-text { font-size: 15px; line-height: 1.65; color: #343a47; margin: 0 0 14px; }
.best-chips { display: flex; gap: 12px; }
.best-chip {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  font-weight: 700; font-size: 14px; color: #fff;
}
.best-chip .bc-emoji { font-size: 18px; }

.result-actions { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 14px; }
.btn-poster {
  border: none; border-radius: 999px; padding: 16px; font-size: 17px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg,#7C5CFF,#5B8DEF); cursor: pointer;
  box-shadow: 0 12px 26px rgba(91,141,239,.36);
}
.btn-poster:active { transform: scale(.98); }
.btn-restart {
  border: 2px solid #e7e9ef; border-radius: 999px; padding: 14px; font-size: 15px; font-weight: 700;
  background: #fff; color: var(--ink-soft); cursor: pointer;
}
.btn-restart:active { transform: scale(.98); }
.result-foot { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 0; }

/* 引流卡 */
.result-lead { display: flex; align-items: center; gap: 16px; }
.lead-qr {
  flex: none; width: 92px; height: 92px; border-radius: 14px;
  border: 2px dashed #d7dae2; display: grid; place-items: center;
  color: var(--ink-soft); font-size: 12px; font-weight: 700; text-align: center;
  background: #fafbfc; line-height: 1.4;
}
.lead-body { flex: 1; }
.lead-brand { font-size: 17px; font-weight: 900; margin: 0 0 6px; color: var(--ink); }
.lead-desc { font-size: 13px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 6px; }
.lead-desc b { color: var(--red); }
.lead-cta { font-size: 12px; color: var(--red); font-weight: 700; margin: 0; }
.lead-qr.has-img { border: none; background: #fff; padding: 0; }
.lead-qr.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }

/* ================= 海报弹层 ================= */
.poster-modal {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(20,22,30,.72); backdrop-filter: blur(4px);
}
.poster-modal.is-open { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.poster-sheet { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.poster-stage { position: relative; width: 100%; }
#poster-canvas {
  width: 100%; height: auto; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.4); display: block;
}
#poster-img {
  position: absolute; top: 0; left: 0; width: 100%; height: auto;
  border-radius: 16px; visibility: hidden; -webkit-touch-callout: default;
}
.poster-actions { display: flex; gap: 10px; width: 100%; }
.btn-save, .btn-copy, .btn-close {
  flex: 1; text-align: center; text-decoration: none; padding: 13px 8px; border-radius: 14px;
  font-size: 14px; font-weight: 700; cursor: pointer; border: none;
}
.btn-save { background: #fff; color: var(--ink); }
.btn-copy { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-close { background: rgba(255,255,255,.10); color: #fff; }
.btn-save:active, .btn-copy:active, .btn-close:active { transform: scale(.96); }
.poster-tip { color: rgba(255,255,255,.7); font-size: 12px; margin: 0; text-align: center; }
.btn-refresh {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.45); color: #fff; font-size: 20px; cursor: pointer;
  backdrop-filter: blur(3px);
}
.btn-refresh:active { transform: scale(.92); }

/* ================= Toast ================= */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(20,22,30,.9); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 80;
  transition: opacity .25s ease, transform .25s ease; white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 360px) {
  .home-title { font-size: 40px; }
  .quiz-q { font-size: 22px; }
}
