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

:root {
  --purple:    #6B47FF;
  --purple-lt: #A78BFA;
  --purple-dk: #4C2ADB;
  --green:     #059669;
  --blue:      #3D7FFF;
  --bg:        #F8F7FF;
  --text:      #1E1245;
  --text2:     rgba(30,18,69,.45);
  --text3:     rgba(30,18,69,.28);
  --border:    rgba(107,71,255,.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  min-height: 100dvh;
}
button { font-family: inherit; }

/* ── SCREENS：一次只顯示一個狀態頁，自然文流、整頁捲動 ──
   position:relative 是彩帶定位錨點：confettiBurst 以 screen 為基準塞 absolute 粒子，
   桌機版 .screen 置中（max-width+margin auto）時少了它座標會掉回整頁、往左偏 */
.screen { display: none; min-height: 100dvh; position: relative; }
.screen.active { display: block; }

/* ── COMMON ── */
.btn {
  border: none; border-radius: 14px; padding: 16px 20px;
  font-size: 15px; font-weight: 800; cursor: pointer;
  transition: transform .12s, opacity .12s; letter-spacing: .2px; width: 100%;
}
.btn:active { transform: scale(0.97); opacity: .9; }
.btn-pink { background: linear-gradient(135deg,#f744b1,#e0309e); color: white; box-shadow: 0 4px 16px rgba(247,68,177,.4); border-radius: 100px; }

.mi {
  font-family: 'Material Icons Round'; font-weight: normal; font-style: normal;
  font-size: 1em; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal;
  -webkit-font-smoothing: antialiased; vertical-align: -0.15em;
  color: white;
}
.wv-rule-n .mi { color: var(--purple); font-size: 16px; vertical-align: -0.2em; }

/* ── HERO ── */
.wv-content { padding-bottom: 32px; }
.wv-hero {
  background: linear-gradient(160deg, #a78bfa 0%, #c4b5fd 55%, #ddd6fe 100%);
  padding: 28px 20px 24px; text-align: center; position: relative; overflow: hidden;
}
.wv-hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.wv-hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  border-radius: 100px; padding: 4px 14px;
  font-size: 14px; font-weight: 700; color: white;
  margin-bottom: 14px; position: relative;
}
.wv-hero-title {
  font-size: 26px; font-weight: 900; color: white;
  line-height: 1.22; letter-spacing: -.4px; margin-bottom: 8px;
  text-shadow: 0 1px 4px rgba(76,10,128,.3), 0 2px 10px rgba(76,10,128,.2);
  position: relative;
}
.wv-hero-sub {
  font-size: 15px; color: white; line-height: 1.6; margin-bottom: 20px; text-shadow: 0 1px 6px rgba(76,10,128,.25); position: relative;
}
.wv-day-dot {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}

/* ── FAQ ── */
details[open] summary .faq-chevron { transform: rotate(180deg); }

/* ── 完成頁勾勾動畫 ── */
@keyframes checkSpin {
  0%   { transform: rotate(-180deg) scale(0); opacity: 0; }
  60%  { transform: rotate(15deg) scale(1.2); opacity: 1; }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}
@keyframes b3CirclePop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
#s-day1-done.active .d5-done-circle, #s-day2-done.active .d5-done-circle,
#s-day3-done.active .d5-done-circle, #s-day4-done.active .d5-done-circle,
#s-day5-done.active .d5-done-circle { animation: b3CirclePop .45s cubic-bezier(.34,1.56,.64,1) var(--d, 0s) both; }
#s-day1-done.active .d5-done-check, #s-day2-done.active .d5-done-check,
#s-day3-done.active .d5-done-check, #s-day4-done.active .d5-done-check,
#s-day5-done.active .d5-done-check { animation: checkSpin .4s cubic-bezier(.34,1.56,.64,1) var(--d, 0s) both; }

/* ── Recap 日曆點動畫 ── */
.dot-check { display: none !important; color: white !important; font-size: 1.5em !important; }
@keyframes dotPop {
  0%   { transform: scale(1) rotate(0deg); }
  25%  { transform: scale(1.45) rotate(-12deg); }
  50%  { transform: scale(1.2) rotate(8deg); }
  70%  { transform: scale(1.35) rotate(-4deg); }
  85%  { transform: scale(1.18) rotate(2deg); }
  100% { transform: scale(1.22) rotate(0deg); }
}
.wv-day-dot.dot-checked {
  background: white;
  border-color: white;
  box-shadow: 0 0 0 6px rgba(255,255,255,.25), 0 0 20px rgba(255,255,255,.4);
  animation: dotPop .5s cubic-bezier(.34,1.56,.64,1) forwards;
}
.wv-day-dot.dot-checked .dot-icon { display: none !important; }
.wv-day-dot.dot-checked .dot-check {
  display: inline-block !important;
  color: var(--purple) !important;
  animation: checkSpin .4s cubic-bezier(.34,1.56,.64,1) forwards;
}
#recap-day-dots .wv-day-dot.dot-checked { animation: none; background: rgba(107,71,255,.2); border-color: rgba(255,255,255,.4); box-shadow: none; }
#recap-day-dots .wv-day-dot.dot-checked .dot-check { animation: fadeIn .5s ease forwards; color: white !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes twinkle { 0%,100% { opacity:.3; transform: scale(1); } 50% { opacity:1; transform: scale(1.3); } }

/* ── RECAP（story 全螢幕）── */
#s-recap { background: #ede9fe; cursor: pointer; }
#s-recap.active { display: block; position: fixed; inset: 0; z-index: 100; overflow: hidden; }

.recap-dots {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px; z-index: 20;
  padding: 0 24px;
}
.rdot-wrap {
  flex: 1; max-width: 44px; padding: 10px 0;
  cursor: pointer; display: flex; align-items: center;
}
.rdot {
  width: 100%; height: 2px; border-radius: 100px;
  background: rgba(255,255,255,.3); overflow: hidden; position: relative;
}
.rdot::after {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0; right: 0;
  background: white; transform: translateX(-100%);
}
.rdot.done::after  { transform: translateX(0); transition: none; }
.rdot.active::after { animation: dotFill var(--dot-dur, 4s) linear forwards; }
@keyframes dotFill { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.recap-slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 90px 32px 64px; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s ease;
  background: linear-gradient(to bottom, #ddd6fe 0%, #c4b5fd 50%, #a78bfa 100%);
}
.recap-slide.rs-active { opacity: 1; pointer-events: all; }

.rs-eyebrow {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: rgba(255,255,255,.85); margin-bottom: 20px;
}
.rs-title {
  font-size: 28px; font-weight: 900; color: white;
  line-height: 1.22; letter-spacing: -.5px; margin-bottom: 12px;
}
.rs-sub { font-size: 14px; color: rgba(255,255,255,.8); line-height: 1.7; }
.rs-num {
  font-size: 96px; font-weight: 900; line-height: 1;
  color: white;
  text-shadow: 0 4px 20px rgba(107,71,255,.35), 0 2px 8px rgba(107,71,255,.2);
  margin: 8px 0;
}
.rs-unit { font-size: 18px; color: rgba(255,255,255,.7); }
.rs-chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 20px 0; }
.rs-chip {
  background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.5);
  border-radius: 100px; padding: 8px 20px;
  font-size: 15px; font-weight: 600; color: white;
}

.rs-scores { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.rs-score-box { text-align: center; min-width: 96px; }
.rs-score-n { font-size: 64px; font-weight: 900; line-height: 1; }
.rs-score-n.old { color: rgba(255,255,255,.6); }
.rs-score-n.new { color: white; text-shadow: 0 4px 20px rgba(107,71,255,.35), 0 2px 8px rgba(107,71,255,.2); }
.rs-score-l { font-size: 14px; color: rgba(255,255,255,.65); margin-top: 4px; }
.rs-arrow { font-size: 28px; color: rgba(255,255,255,.5); }
.rs-score-tag { font-size: 10px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }

.rs-play-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(107,71,255,.12); border: 1px solid rgba(107,71,255,.25);
  color: var(--purple); cursor: pointer; margin-top: 14px;
  position: relative; transition: background .2s, transform .1s;
}
.rs-play-btn:active { transform: scale(0.93); }
.rs-play-btn.rs-playing { background: rgba(107,71,255,.45); border-color: rgba(167,139,250,.7); }
.rs-play-icon { font-size: 22px; transition: opacity .15s; }
.rs-waveform {
  position: absolute; display: flex; gap: 2px; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.rs-play-btn.rs-playing .rs-play-icon { opacity: 0; }
.rs-play-btn.rs-playing .rs-waveform { opacity: 1; }
.rs-waveform span { width: 3px; background: var(--purple); border-radius: 3px; height: 8px; }
.rs-play-btn.rs-playing .rs-waveform span:nth-child(1) { animation: rsWave .7s ease-in-out 0s    infinite alternate; }
.rs-play-btn.rs-playing .rs-waveform span:nth-child(2) { animation: rsWave .7s ease-in-out .15s  infinite alternate; }
.rs-play-btn.rs-playing .rs-waveform span:nth-child(3) { animation: rsWave .7s ease-in-out .3s   infinite alternate; }
.rs-play-btn.rs-playing .rs-waveform span:nth-child(4) { animation: rsWave .7s ease-in-out .45s  infinite alternate; }
@keyframes rsWave { from { height: 4px; } to { height: 18px; } }

.rs-share-btn {
  background: linear-gradient(135deg, #f744b1, #e0309e);
  color: white; border: none; border-radius: 14px;
  padding: 16px 28px; font-size: 15px; font-weight: 800;
  cursor: pointer; width: 100%; margin-bottom: 10px;
  transition: transform .12s;
}
.rs-share-btn:active { transform: scale(0.97); }

.rs-emoji-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.rs-emoji-bg span { position: absolute; font-size: 28px; opacity: 0; animation: emojiFloat linear infinite; }
@keyframes emojiFloat {
  0%   { transform: translateY(0px)   rotate(-4deg); opacity: .18; }
  50%  { transform: translateY(-14px) rotate(4deg);  opacity: .28; }
  100% { transform: translateY(0px)   rotate(-4deg); opacity: .18; }
}

.rs-title-wrap { position: relative; width: 100%; margin-bottom: 24px; text-align: center; }
.rs-sparkle { position: absolute; pointer-events: none; color: rgba(255,255,255,.3); user-select: none; }

.rs-summary {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin: 20px 0 28px; width: 100%;
}
.rs-summary-item {
  background: rgba(255,255,255,.4);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 16px; padding: 16px 10px; text-align: center;
}
.rs-summary-num {
  font-size: 30px; font-weight: 900; line-height: 1; margin-bottom: 5px;
  background: linear-gradient(160deg, #6b47ff, #1e1245);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.rs-summary-label { font-size: 14px; color: rgba(30,18,69,.45); line-height: 1.4; }

/* ── 成就預覽扇形卡 ── */
.recap-fan-wrap { position: relative; height: 230px; margin: 0 16px; cursor: pointer; }
/* 手機版置中：寬度 = 展開後實際佔寬（rfc-2 位移 200 + 卡寬 155）；≥768 維持原本 flex 置中 */
@media (max-width: 767px) {
  .recap-fan-wrap { width: 355px; max-width: calc(100% - 32px); margin: 0 auto; }
}
.recap-fan-card {
  position: absolute; width: 155px; height: 192px;
  left: 0; top: 16px;
  border-radius: 18px;
  border: 3px solid rgba(255,255,255,.85);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px 12px; text-align: center;
  transition: transform .4s cubic-bezier(.34,1.2,.64,1), box-shadow .4s ease;
}
.rfc-0 { transform: translateX(0px)  rotate(0deg); z-index: 3; }
.rfc-1 { transform: translateX(20px) rotate(2deg); z-index: 2; }
.rfc-2 { transform: translateX(38px) rotate(4deg); z-index: 1; }
.recap-fan-wrap.fanned .rfc-0 { transform: translateX(0px)   rotate(-5deg); }
.recap-fan-wrap.fanned .rfc-1 { transform: translateX(100px) rotate(0deg) translateY(-10px); }
.recap-fan-wrap.fanned .rfc-2 { transform: translateX(200px) rotate(5deg);  }

/* 手機版旅程清單：左側加寬呼吸空間（蓋過 markup 行內 padding，桌機維持置中盒不動） */
@media (max-width: 767px) {
  .wv-journey-wrap { padding-left: 32px !important; }
}

/* ── RWD：平板/桌機 ── */
@media (min-width: 768px) {
  .screen { max-width: 720px; margin: 0 auto; }
  .wv-hero { border-radius: 0 0 24px 24px; }
  .wv-journey-wrap { max-width: 480px; margin-left: auto; margin-right: auto; }
  #fan-section, #fan-section-pro { display: flex; flex-direction: column; align-items: center; }
  .recap-fan-wrap { width: 380px; margin: 0; }
}

/* ── 免費用戶導購 popup（Trial-page-v6 iframe）── */
#trial-popup { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5); display: flex; }
#trial-popup[hidden] { display: none; }
.trial-sheet {
  position: relative; display: flex; flex-direction: column;
  width: 100%; height: 100%; margin: auto; background: white;
}
#trial-frame { flex: 1; width: 100%; border: 0; }
/* 蓋在 iframe 頁內失效 X 正上方：X 在頁內置中 max-w 500px 容器的 (16,54)，
   故 left = (sheet寬 − min(sheet寬,500)) / 2 + 16，任何寬度都對齊 */
.trial-close {
  position: absolute; top: 54px; width: 40px; height: 40px;
  left: calc((100% - min(100%, 500px)) / 2 + 16px);
  border: none; border-radius: 50%; background: white; cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
}
.trial-close .mi { color: #B4B4B4; font-size: 24px; }
/* CTA 浮在 iframe 內容上、白色漸層淡出（同 App 原生按鈕的疊法，避免實心 bar 色差斷層） */
.trial-footer {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 32px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, white 65%, rgba(255,255,255,0));
  pointer-events: none;
}
.trial-footer .btn { pointer-events: auto; max-width: 468px; margin: 0 auto; display: block; }
/* 對齊 Trial-page-v6 品牌紫（同頁內「7 天免費試用」橫條 #653AAF→#A73AAF，App 版按鈕同款） */
.trial-cta {
  background: linear-gradient(90deg, #653AAF, #A73AAF); color: white;
  border-radius: 100px; box-shadow: 0 4px 16px rgba(101,58,175,.4);
}
@media (min-width: 768px) {
  .trial-sheet { max-width: 600px; height: min(90vh, 812px); border-radius: 24px; overflow: hidden; }
}

/* ── LOADING（進頁預設畫面）── */
#s-loading.active { display: flex; align-items: center; justify-content: center; }
.loading-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(107,71,255,.15);
  border-top-color: var(--purple);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
