/* ============================================================
   测一测你像古代的哪个美女 · 国风视觉
   配色：胭脂粉 / 黛蓝 / 藤黄 / 玄墨 / 宣纸
   ============================================================ */

:root {
  --yanzhi: #a94054;        /* 胭脂 */
  --yanzhi-deep: #8c2f42;
  --yanzhi-light: #f6e3e6;
  --dai: #33415c;           /* 黛蓝 */
  --dai-deep: #232e47;
  --teng: #c99a3f;          /* 藤黄 */
  --teng-light: #f3e8cf;
  --xuan: #211d26;          /* 玄墨 */
  --paper: #f6f0e3;         /* 宣纸 */
  --paper-2: #efe5d0;
  --ink: #3a3340;
  --ink-light: #857a8c;

  --rar-r: #6b7a99;
  --rar-sr: #b98a2e;
  --rar-ssr: #a94054;
  --rar-ur: #7a1f2b;
  --gold: #c9a063;

  --font-kai: "Kaiti SC", "STKaiti", KaiTi, "TW-Kai", "Noto Serif SC", "Songti SC", serif;
  --font-song: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: var(--font-song);
  color: var(--ink);
  background: var(--dai-deep);
  overscroll-behavior-y: none;
}

button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; touch-action: manipulation; }

/* ---------- 应用容器（移动优先，桌面居中） ---------- */
#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 20% 8%, rgba(201, 154, 63, 0.10), transparent 55%),
    radial-gradient(ellipse at 85% 92%, rgba(169, 64, 84, 0.08), transparent 50%),
    linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
  overflow: hidden;
}

@media (min-width: 520px) {
  body { padding: 24px 0; background: radial-gradient(ellipse at center, #2c3a58 0%, #1b2337 100%); }
  #app {
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(201, 160, 99, 0.25);
  }
}

/* ---------- 背景装饰 ---------- */
.bg-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

.bg-clouds {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%2333415c' stroke-opacity='0.06' stroke-width='2'%3E%3Cpath d='M20 70 q8 -14 16 0 q8 -14 16 0'/%3E%3Cpath d='M70 30 q8 -14 16 0 q8 -14 16 0'/%3E%3Ccircle cx='100' cy='90' r='3'/%3E%3Ccircle cx='14' cy='24' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

.petal {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 60% 0 60% 0;
  background: linear-gradient(135deg, rgba(169, 64, 84, 0.5), rgba(169, 64, 84, 0.12));
  animation: petal-fall linear infinite;
  opacity: 0.7;
}
.petal-1 { left: 8%;  animation-duration: 11s; animation-delay: 0s; }
.petal-2 { left: 28%; animation-duration: 14s; animation-delay: 3s; width: 9px; height: 9px; }
.petal-3 { left: 52%; animation-duration: 10s; animation-delay: 6s; }
.petal-4 { left: 74%; animation-duration: 13s; animation-delay: 1.5s; width: 10px; height: 10px; }
.petal-5 { left: 90%; animation-duration: 12s; animation-delay: 8s; }

@keyframes petal-fall {
  0%   { transform: translateY(-8vh) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.7; }
  50%  { transform: translateY(50vh) translateX(26px) rotate(180deg); }
  100% { transform: translateY(108vh) translateX(-14px) rotate(360deg); opacity: 0; }
}

/* ---------- 屏幕切换 ---------- */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  flex-direction: column;
}
.screen.active { display: flex; animation: screen-in 0.32s ease both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-family: var(--font-kai);
  letter-spacing: 0.12em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
  touch-action: manipulation;
  user-select: none;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--yanzhi) 0%, var(--yanzhi-deep) 100%);
  color: #fdf7ee;
  box-shadow: 0 8px 22px rgba(169, 64, 84, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:active { box-shadow: 0 3px 10px rgba(169, 64, 84, 0.3); }

.btn-ghost {
  border: 1px solid rgba(51, 65, 92, 0.4);
  color: var(--dai);
  background: rgba(255, 255, 255, 0.35);
}

.btn-lg { padding: 15px 52px; font-size: 1.15rem; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--dai);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(51, 65, 92, 0.2);
  font-family: var(--font-song);
  line-height: 1;
  touch-action: manipulation;
}
.icon-btn:active { transform: scale(0.92); }

/* ============ 首页 ============ */
#screen-home { justify-content: center; }

.home-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 28px calc(32px + var(--safe-bottom));
  text-align: center;
}

.home-seal {
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--yanzhi-deep), var(--yanzhi));
  color: #fdf3e7;
  font-family: var(--font-kai);
  font-size: 2rem;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(140, 47, 66, 0.35), inset 0 0 0 1.5px rgba(253, 243, 231, 0.5);
  margin-bottom: 26px;
  transform: rotate(-3deg);
}

.home-title {
  font-family: var(--font-kai);
  font-weight: 600;
  font-size: 2.05rem;
  line-height: 1.42;
  color: var(--xuan);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.home-title em {
  font-style: normal;
  color: var(--yanzhi);
  position: relative;
}
.home-title em::after {
  content: "";
  position: absolute;
  left: 4%; right: 4%; bottom: 2px;
  height: 8px;
  background: linear-gradient(90deg, transparent, rgba(201, 154, 63, 0.5), transparent);
  z-index: -1;
}

.home-sub {
  margin-top: 16px;
  font-size: 0.92rem;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  line-height: 1.9;
}

.home-proof {
  margin-top: 22px;
  font-size: 0.8rem;
  color: var(--dai);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(51, 65, 92, 0.18);
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.home-proof b { color: var(--yanzhi); font-family: var(--font-kai); margin: 0 2px; }

#btn-start { margin-top: 30px; }

#btn-fortune-home { margin-top: 14px; padding: 10px 26px; font-size: 0.92rem; }

.home-progress {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--ink-light);
  letter-spacing: 0.1em;
}

/* ============ 答题 ============ */
#screen-quiz { padding: 0; }

.quiz-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px;
}

.quiz-progress {
  flex: 1;
  height: 6px;
  background: rgba(51, 65, 92, 0.14);
  border-radius: 3px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  width: 10%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teng), var(--yanzhi));
  transition: width 0.35s ease;
}

.quiz-count {
  font-family: var(--font-kai);
  font-size: 0.85rem;
  color: var(--dai);
  min-width: 46px;
  text-align: right;
  letter-spacing: 0.05em;
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 20px calc(20px + var(--safe-bottom));
}

.quiz-theme {
  align-self: center;
  font-family: var(--font-kai);
  font-size: 0.85rem;
  color: var(--teng);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  margin-bottom: 14px;
}
.quiz-theme::before, .quiz-theme::after { content: "——"; color: rgba(201, 154, 63, 0.5); }
.quiz-theme::before { margin-right: 8px; }
.quiz-theme::after { margin-left: 8px; }

.quiz-card {
  position: relative;
  background: linear-gradient(170deg, #fbf6ea 0%, #f4ecd9 100%);
  border: 1px solid rgba(51, 65, 92, 0.16);
  border-radius: 14px;
  padding: 30px 22px 24px;
  box-shadow: 0 14px 34px rgba(35, 46, 71, 0.12);
}
.quiz-card::before, .quiz-card::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--teng);
  opacity: 0.55;
}
.quiz-card::before { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.quiz-card::after { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

.quiz-card.switching { animation: card-slide-out 0.18s ease both; }
.quiz-card.entering { animation: card-slide-in 0.24s ease both; }

@keyframes card-slide-out {
  to { opacity: 0; transform: translateX(-26px); }
}
@keyframes card-slide-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.quiz-rod {
  position: absolute;
  left: 14px; right: 14px;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, #6b5136, #4a3826);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.quiz-rod::before, .quiz-rod::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 9px; height: 13px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c9a063, #8a6c3d);
}
.quiz-rod::before { left: -7px; }
.quiz-rod::after { right: -7px; }
.quiz-rod-top { top: -4px; }
.quiz-rod-bottom { bottom: -4px; }

.quiz-question {
  font-family: var(--font-kai);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.75;
  color: var(--xuan);
  margin: 8px 0 20px;
  letter-spacing: 0.02em;
}

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

.option {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px solid rgba(51, 65, 92, 0.14);
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  width: 100%;
}
.option:active { transform: scale(0.98); }

.option-seal {
  flex: none;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(51, 65, 92, 0.35);
  border-radius: 7px;
  font-family: var(--font-kai);
  font-size: 0.95rem;
  color: var(--dai);
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.15s ease;
}

.option.selected {
  border-color: var(--yanzhi);
  background: var(--yanzhi-light);
  transform: scale(1.02);
}
.option.selected .option-seal {
  background: var(--yanzhi);
  border-color: var(--yanzhi);
  color: #fdf3e7;
}

.option.chosen { animation: opt-pop 0.25s ease; }
@keyframes opt-pop {
  40% { transform: scale(1.05); }
}

.quiz-tip {
  text-align: center;
  font-size: 0.8rem;
  color: var(--teng);
  font-family: var(--font-kai);
  letter-spacing: 0.1em;
  margin-top: 16px;
  min-height: 1.2em;
}

/* ============ 揭晓 ============ */
#screen-reveal {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(169, 64, 84, 0.14), transparent 60%),
    linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
}

.reveal-box { text-align: center; }

.reveal-ring {
  width: 128px; height: 128px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 2px dashed rgba(51, 65, 92, 0.35);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  animation: ring-spin 9s linear infinite;
}
.reveal-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 154, 63, 0.5);
  animation: ring-spin 6s linear infinite reverse;
}
.reveal-ring::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(169, 64, 84, 0.16), transparent 70%);
}

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

.reveal-hexagram {
  font-size: 3.2rem;
  color: var(--yanzhi);
  animation: hex-pulse 1.1s ease-in-out infinite;
}
@keyframes hex-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.14); opacity: 1; }
}

.reveal-text {
  font-family: var(--font-kai);
  font-size: 1.25rem;
  color: var(--xuan);
  letter-spacing: 0.2em;
}
.reveal-sub {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ink-light);
  letter-spacing: 0.12em;
}

/* ============ 结果页 ============ */
#screen-result { padding: 0; }

.result-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 24px;
}

.result-home {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 5;
  width: 32px; height: 32px;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.6);
}

.result-headline {
  font-family: var(--font-kai);
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
  color: var(--xuan);
  line-height: 1.7;
  margin: 6px 26px 4px;
  letter-spacing: 0.03em;
}
.result-headline .hl-name { color: var(--yanzhi); }

.result-balanced {
  text-align: center;
  font-size: 0.82rem;
  color: var(--teng);
  font-family: var(--font-kai);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  padding: 0 20px;
  line-height: 1.8;
}

/* ---------- 身份卡 ---------- */
.idcard {
  position: relative;
  margin-top: 14px;
  border-radius: 20px;
  padding: 30px 20px 24px;
  text-align: center;
  background: linear-gradient(165deg, #fbf6ea 0%, #f2e9d6 100%);
  border: 1.5px solid rgba(51, 65, 92, 0.18);
  box-shadow: 0 16px 40px rgba(35, 46, 71, 0.14);
  overflow: hidden;
}
.idcard::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 14px;
  border: 1px dashed rgba(201, 154, 63, 0.45);
  pointer-events: none;
}

.idcard.r-R   { --sil: var(--rar-r);   --ring: var(--rar-r); }
.idcard.r-SR  { --sil: var(--rar-sr);  --ring: var(--rar-sr); }
.idcard.r-SSR { --sil: var(--rar-ssr); --ring: var(--rar-ssr); }
.idcard.r-UR  { --sil: var(--rar-ur);  --ring: var(--rar-ur); }

.idcard.r-R   { border-color: rgba(107, 122, 153, 0.45); }
.idcard.r-SR  { border-color: rgba(185, 138, 46, 0.5); }
.idcard.r-SSR { border-color: rgba(169, 64, 84, 0.5); }
.idcard.r-UR  { border-color: rgba(122, 31, 43, 0.6); box-shadow: 0 16px 44px rgba(122, 31, 43, 0.28); }

.idcard-glow {
  position: absolute;
  top: -40%; left: 50%;
  width: 130%; height: 80%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(201, 160, 99, 0.22), transparent 65%);
  pointer-events: none;
}
.idcard.r-UR .idcard-glow { background: radial-gradient(ellipse at center, rgba(201, 160, 99, 0.4), transparent 65%); }

.idcard-medallion {
  position: relative;
  width: 148px; height: 148px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fdf9ef 0%, var(--paper-2) 78%);
  border: 2.5px solid var(--ring, var(--dai));
  box-shadow: 0 8px 22px rgba(35, 46, 71, 0.18), inset 0 0 0 5px rgba(255, 255, 255, 0.55);
  display: flex; align-items: center; justify-content: center;
  color: var(--dai);
}
.idcard-medallion::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1.5px dashed var(--ring, var(--dai));
  opacity: 0.45;
}

.portrait { width: 128px; height: 160px; margin-top: 6px; }
.portrait .silhouette { fill: var(--sil, var(--dai)); }

.idcard-rarity {
  position: absolute;
  right: -6px; bottom: 6px;
  font-family: var(--font-kai);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fdf3e7;
  background: linear-gradient(135deg, var(--ring, var(--dai)), color-mix(in srgb, var(--ring, var(--dai)) 78%, #000));
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  transform: rotate(3deg);
}

.idcard-name {
  font-family: var(--font-kai);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--xuan);
  margin-top: 18px;
  letter-spacing: 0.1em;
}
.idcard-title {
  font-family: var(--font-kai);
  font-size: 0.98rem;
  color: var(--dai);
  margin-top: 6px;
  letter-spacing: 0.06em;
}
.idcard-era {
  font-size: 0.78rem;
  color: var(--ink-light);
  margin-top: 5px;
  letter-spacing: 0.1em;
}

.idcard-match {
  margin-top: 14px;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 20px;
  border-radius: 999px;
  background: rgba(169, 64, 84, 0.08);
  border: 1px solid rgba(169, 64, 84, 0.22);
}
.idcard-match span {
  font-family: var(--font-kai);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--yanzhi);
}
.idcard-match small { font-size: 0.75rem; color: var(--ink-light); letter-spacing: 0.15em; }

/* ---------- 第二像 ---------- */
.result-second {
  margin-top: 12px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--dai);
  line-height: 1.8;
}
.result-second b { font-family: var(--font-kai); color: var(--xuan); font-weight: 600; }
.result-second .second-pct { color: var(--teng); }

/* ---------- 标签 ---------- */
.result-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.tag-chip {
  font-size: 0.78rem;
  color: var(--dai);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(51, 65, 92, 0.22);
  padding: 5px 13px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}
.tag-chip:first-child {
  color: var(--yanzhi-deep);
  border-color: rgba(169, 64, 84, 0.35);
  background: var(--yanzhi-light);
}

/* ---------- 面板 ---------- */
.panel {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(51, 65, 92, 0.12);
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: 0 6px 18px rgba(35, 46, 71, 0.06);
}

.panel-title {
  font-family: var(--font-kai);
  font-size: 1.02rem;
  color: var(--xuan);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.panel-title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--yanzhi);
  transform: rotate(45deg);
  box-shadow: 0 0 0 2.5px rgba(169, 64, 84, 0.15);
}
.panel-title small { font-size: 0.72rem; color: var(--ink-light); font-family: var(--font-song); letter-spacing: 0.05em; margin-left: auto; }

.panel-text {
  font-size: 0.9rem;
  line-height: 2;
  color: var(--ink);
  text-align: justify;
}

.analysis-list { list-style: none; }
.analysis-list li {
  position: relative;
  font-size: 0.88rem;
  line-height: 2;
  color: var(--ink);
  padding-left: 20px;
  margin-bottom: 6px;
}
.analysis-list li::before {
  content: "❖";
  position: absolute;
  left: 0;
  color: var(--teng);
  font-size: 0.75rem;
  top: 0.32em;
}

.facts-list { list-style: none; counter-reset: fact; }
.facts-list li {
  counter-increment: fact;
  position: relative;
  font-size: 0.88rem;
  line-height: 2;
  color: var(--ink);
  padding-left: 30px;
  margin-bottom: 8px;
}
.facts-list li::before {
  content: counter(fact);
  position: absolute;
  left: 0; top: 0.42em;
  width: 19px; height: 19px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-kai);
  font-size: 0.72rem;
  color: #fdf3e7;
  background: linear-gradient(135deg, var(--teng), #a87c2c);
  border-radius: 5px;
}

/* ---------- 运势 ---------- */
.panel-fortune {
  background: linear-gradient(165deg, #fbf4e4 0%, #f5ecd8 100%);
  border-color: rgba(201, 154, 63, 0.35);
}

.fortune-slip {
  position: relative;
  background: linear-gradient(175deg, #fffdf6 0%, #faf3e2 100%);
  border: 1px solid rgba(201, 154, 63, 0.4);
  border-radius: 12px;
  padding: 16px 16px 14px;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.7), 0 4px 14px rgba(201, 154, 63, 0.12);
}
.fortune-slip.shake { animation: slip-shake 0.5s ease; }
@keyframes slip-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-2.5deg) translateX(-4px); }
  45% { transform: rotate(2deg) translateX(4px); }
  70% { transform: rotate(-1deg); }
}

.fortune-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  font-family: var(--font-kai);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fdf3e7;
  padding: 5px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--yanzhi-deep), var(--yanzhi));
  box-shadow: 0 4px 12px rgba(169, 64, 84, 0.3);
  margin-bottom: 12px;
  transform: rotate(-2deg);
}
.fortune-level.lv-中吉 { background: linear-gradient(135deg, #a87c2c, var(--teng)); box-shadow: 0 4px 12px rgba(201, 154, 63, 0.35); }
.fortune-level.lv-小吉 { background: linear-gradient(135deg, #4d5c7d, #6b7a99); box-shadow: 0 4px 12px rgba(107, 122, 153, 0.3); }
.fortune-level.lv-平   { background: linear-gradient(135deg, #6d6472, #857a8c); box-shadow: 0 4px 12px rgba(133, 122, 140, 0.3); }

.fortune-lines { list-style: none; }
.fortune-lines li {
  display: flex;
  gap: 10px;
  font-size: 0.86rem;
  line-height: 1.95;
  color: var(--ink);
}
.fortune-lines .fl-cat {
  flex: none;
  font-family: var(--font-kai);
  color: var(--yanzhi-deep);
  letter-spacing: 0.05em;
}
.fortune-lines .fl-cat::after { content: " ·"; color: var(--teng); }

.fortune-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(201, 154, 63, 0.4);
  font-size: 0.82rem;
  line-height: 1.95;
  color: var(--dai);
}
.fortune-extra b { font-family: var(--font-kai); color: var(--xuan); font-weight: 600; }
.fortune-extra .fe-advice { color: var(--yanzhi-deep); }

.fortune-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--ink-light);
  letter-spacing: 0.06em;
}

.result-spacer { height: 8px; }

/* ---------- 底部操作栏 ---------- */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(246, 240, 227, 0.4) 0%, rgba(246, 240, 227, 0.96) 45%);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(51, 65, 92, 0.1);
}

.action-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: 12px;
  font-family: var(--font-kai);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(51, 65, 92, 0.25);
  color: var(--dai);
  transition: transform 0.12s ease;
  touch-action: manipulation;
}
.action-btn:active { transform: scale(0.96); }

.action-primary {
  background: linear-gradient(135deg, var(--yanzhi) 0%, var(--yanzhi-deep) 100%);
  border-color: transparent;
  color: #fdf3e7;
  box-shadow: 0 6px 16px rgba(169, 64, 84, 0.32);
}

/* ============ 海报弹层 ============ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 18, 28, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}
.modal.open { display: flex; animation: screen-in 0.25s ease; }

.poster-wrap { text-align: center; max-width: 100%; }

#poster-canvas {
  max-width: min(78vw, 340px);
  max-height: 68vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(201, 160, 99, 0.3);
}

.poster-hint {
  margin: 14px 0;
  font-size: 0.8rem;
  color: rgba(246, 240, 227, 0.75);
  letter-spacing: 0.08em;
}

.poster-actions { display: flex; gap: 12px; justify-content: center; }
.poster-actions .btn-ghost { color: rgba(246, 240, 227, 0.9); border-color: rgba(246, 240, 227, 0.4); background: transparent; }
.poster-actions .btn { padding: 10px 26px; font-size: 0.92rem; text-decoration: none; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(16px);
  z-index: 200;
  max-width: 82vw;
  padding: 11px 22px;
  background: rgba(33, 29, 38, 0.92);
  color: var(--paper);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
  line-height: 1.6;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 减弱动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .petal, .reveal-ring, .reveal-ring::before, .reveal-hexagram { animation: none; }
  .screen.active { animation: none; }
}
