:root {
  --bg1: #f8f4ff;
  --bg2: #fff7ef;
  --ink: #3b3345;
  --ink-soft: #6b6375;
  --card: #ffffff;
  --card-border: rgba(120, 100, 160, 0.14);
  --accent: #ff8c42;
  --accent2: #ff5f6d;
  --grad-accent: linear-gradient(135deg, #ff8c42, #ff5f6d);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 8px 24px rgba(120, 100, 160, 0.12);
  --common: #6b7280;
  --rare: #8b5cf6;
  --epic: #eab308;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body.page {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, var(--bg1), var(--bg2) 55%, #fff);
  min-height: 100vh;
  overflow-x: hidden;
}
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5; }

.view { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 24px 18px 40px; }
.view-title { text-align: center; font-size: 22px; margin: 8px 0 20px; font-weight: 700; }

/* ===== 首屏 ===== */
.land-header { text-align: center; padding: 34px 0 12px; }
.brand { font-size: 34px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.brand .brand-sub { font-size: 20px; font-weight: 600; color: var(--accent); }
.land-sub { margin-top: 12px; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }

.social-proof { margin: 24px 6px 0; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.ticker { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker.ticker-anim { animation: tick 0.4s ease; }
@keyframes tick { from { opacity: 0.2; transform: translateY(4px); } }
.today-count { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--accent2); }

.draw-hero { text-align: center; margin: 30px 0 10px; }
.btn-draw {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 18px 40px; border: none; border-radius: 60px; cursor: pointer;
  background: var(--grad-accent); color: #fff;
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
  box-shadow: 0 12px 30px rgba(255, 95, 109, 0.35);
}
.btn-draw .btn-draw-emoji { font-size: 30px; }
.breathe { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.draw-tip { margin-top: 14px; color: var(--ink-soft); font-size: 12px; }

.land-features { display: flex; justify-content: center; gap: 10px; margin: 26px 0 6px; }
.lf { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 10px 16px; text-align: center; box-shadow: var(--shadow); font-size: 12px; color: var(--ink-soft); }
.lf b { display: block; font-size: 20px; margin-bottom: 3px; }

/* ===== 通用按钮 ===== */
.btn { border: none; border-radius: 14px; cursor: pointer; font-size: 15px; font-weight: 600; padding: 13px 18px; font-family: inherit; }
.btn-primary { background: var(--grad-accent); color: #fff; box-shadow: 0 6px 16px rgba(255,95,109,0.28); }
.btn-cta { background: var(--grad-accent); color: #fff; width: 100%; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--card-border); }
.btn-outline { background: transparent; color: var(--ink-soft); border: 1px dashed var(--card-border); }
.btn-link { background: transparent; color: var(--ink-soft); text-decoration: underline; font-weight: 400; }

/* ===== 选择题 ===== */
.quiz-block { margin: 18px 0; }
.quiz-q { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.quiz-opts button {
  border: 1px solid var(--card-border); background: var(--card); border-radius: 14px;
  padding: 12px 16px; font-size: 15px; font-family: inherit; cursor: pointer; color: var(--ink);
  transition: all 0.15s;
}
.quiz-opts button.active { border-color: var(--accent); background: #fff2e6; box-shadow: 0 0 0 2px rgba(255,140,66,0.25); }
.mood-option i { font-style: normal; font-size: 12px; color: var(--ink-soft); }
.quiz-custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; background: var(--card); border: 1px dashed var(--card-border); border-radius: 14px; padding: 10px 14px; }
.quiz-custom-label { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.quiz-input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; color: var(--ink); font-family: inherit; }
.quiz-input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.voice-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--card-border); background: #fff; font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); transition: all .15s; }
.voice-btn.listening { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px rgba(233,30,99,.15); }
.quiz-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 26px; }

/* ===== 刮卡 ===== */
.scratch-wrap { position: relative; width: 100%; aspect-ratio: 4 / 5; margin: 6px auto; }
.scratch-under { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); overflow: hidden; background: linear-gradient(165deg, #fff6fb, #fdeef5 45%, #fbe3ef); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 16px; box-sizing: border-box; }
.scratch-under .su-badge { font-size: 12px; color: #c2185b; background: rgba(255,255,255,.7); border: 1px solid rgba(233,30,99,.25); border-radius: 999px; padding: 4px 12px; margin-bottom: 10px; }
.scratch-under .su-emoji { font-size: 64px; line-height: 1; margin: 8px 0; }
.scratch-under .su-name { font-size: 30px; font-weight: 800; color: #333; }
.scratch-under .su-tagline { font-size: 16px; color: #c2185b; margin-top: 6px; }
#scratchCanvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; border-radius: var(--radius); box-shadow: var(--shadow); touch-action: none; }
.scratch-fallback { position: absolute; z-index: 3; bottom: -6px; left: 0; right: 0; text-align: center; }
.scratch-fallback .btn { background: #fff; color: var(--ink-soft); font-size: 12px; padding: 8px 12px; opacity: 0.9; }

/* ===== 刮开后同页展开 ===== */
.reveal-panel { margin-top: 26px; animation: fadeUp .4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== AI 生成中遮罩 ===== */
.ai-loading-overlay { background: rgba(255,255,255,.62); backdrop-filter: blur(2px); z-index: 70; }
.ai-loading-card { background: #fff; border-radius: 20px; padding: 30px 26px; text-align: center; box-shadow: var(--shadow); max-width: 320px; width: 82%; }
.ai-loading-spinner { width: 42px; height: 42px; margin: 0 auto 16px; border: 4px solid #fce0e6; border-top-color: #e91e63; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-loading-text { font-size: 15px; font-weight: 600; color: var(--ink); }
.ai-loading-sub { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

/* ===== 结果卡 ===== */
.result-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 24px;
  box-shadow: var(--shadow); overflow: hidden;
}
.res-top {
  padding: 22px 20px 18px;
  background: linear-gradient(165deg, #fdf6ff, #fff3e8);
  text-align: center;
}
.res-rarity {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 12px;
}
.rarity-common { color: #4b5563; background: rgba(107,114,128,0.1); }
.rarity-rare { color: #7c3aed; background: linear-gradient(135deg, rgba(34,211,238,0.18), rgba(139,92,246,0.18)); box-shadow: 0 0 0 1px rgba(139,92,246,0.4); }
.rarity-epic { color: #b45309; background: linear-gradient(135deg, rgba(250,204,21,0.3), rgba(249,115,22,0.25)); box-shadow: 0 0 0 2px rgba(234,179,8,0.6); animation: epicShine 2s linear infinite; }
@keyframes epicShine { 0%,100% { box-shadow: 0 0 0 2px rgba(234,179,8,0.6);} 50% { box-shadow: 0 0 14px 3px rgba(250,204,21,0.8);} }
.res-emoji { font-size: 80px; line-height: 1; margin: 4px 0; }
.res-persona { font-size: 28px; font-weight: 800; margin-top: 4px; }
.res-tagline { font-size: 15px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.res-metaphor { margin-top: 14px; color: var(--ink-soft); font-style: italic; font-size: 15px; line-height: 1.7; text-align: left; }
.res-reading { margin-top: 10px; color: var(--ink); font-size: 15px; line-height: 1.8; text-align: left; }
.res-action { margin-top: 12px; color: var(--accent2); font-weight: 600; font-size: 15px; text-align: left; }
.res-quote { margin-top: 16px; padding: 14px 16px; background: rgba(120,100,160,0.06); border-radius: var(--radius-sm); color: var(--ink-soft); font-size: 14px; line-height: 1.9; font-family: "Kaiti SC", serif; text-align: center; }

.res-divider { height: 8px; background: linear-gradient(90deg, var(--bg1), #fff, var(--bg2)); }
.res-bottom { padding: 16px 16px 20px; }

.tip-card { background: linear-gradient(135deg, #fff2e6, #ffe7d6); border: 1px solid rgba(255,140,66,0.3); border-radius: var(--radius); padding: 14px 16px; }
.tip-scene { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.tip-content { font-size: 15px; line-height: 1.8; color: var(--ink); margin-bottom: 12px; }

.mini { margin-top: 14px; }
.streak-card, .collect-card { background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; }
.streak-head, .collect-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; font-weight: 700; }
.streak-days { font-size: 13px; color: var(--ink-soft); }
.streak-days b { color: var(--accent); font-size: 20px; }
.streak-track { height: 8px; background: #f0ecf5; border-radius: 4px; overflow: hidden; }
.streak-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 4px; transition: width 0.5s; }
.streak-hint { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.milestones { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.milestone { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.milestone .ms-day { min-width: 52px; padding: 3px 8px; border-radius: 10px; background: #f0ecf5; text-align: center; font-weight: 600; }
.milestone.done { color: var(--accent2); }
.milestone.done .ms-day { background: #ffe3dc; color: var(--accent2); }

.collect-num { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.collect-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.collect-cell { text-align: center; padding: 6px 2px; background: #f7f4fb; border-radius: 10px; }
.collect-cell .cc-emoji { font-size: 20px; display: block; }
.collect-cell .cc-name { font-size: 10px; color: var(--ink-soft); display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collect-cell.got { background: #fff2e6; }
.collect-cell.got .cc-name { color: var(--accent); font-weight: 600; }

.draw-left { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 4px; }
.draw-left-num { font-size: 34px; font-weight: 800; color: var(--accent); }
.draw-left-hint { color: var(--ink-soft); font-size: 13px; }

.action-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.action-buttons .btn { flex: 1 1 44%; min-width: 132px; }

.nickname-optional { margin: 14px 4px 0; }
.nickname-optional label { font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.nickname-optional input { width: 100%; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: 12px; font-size: 14px; font-family: inherit; }
.nickname-optional input.need-nick { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(255,95,109,.28); animation: nickShake .3s ease; }
@keyframes nickShake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }

.disclaimer { margin-top: 14px; text-align: center; font-size: 11px; color: var(--ink-soft); line-height: 1.7; }

/* ===== 弹窗 ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(40,30,55,0.45); align-items: center; justify-content: center; padding: 22px; }
.modal.is-open { animation: fadein 0.25s; }
@keyframes fadein { from { opacity: 0; } }
.modal-card { background: #fff; border-radius: 22px; padding: 22px; max-width: 420px; width: 100%; max-height: 88vh; overflow-y: auto; }
.modal-card h3 { font-size: 19px; margin-bottom: 10px; }
.modal-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.comply-note { font-size: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.guide-qr { display: block; width: 200px; height: 200px; margin: 14px auto 6px; border-radius: 12px; }
.guide-scan { text-align: center; font-weight: 700; color: var(--accent); }
.guide-note { text-align: center; font-size: 12px; }

.poster-preview { display: block; width: 100%; border-radius: 12px; margin: 12px 0; }
.poster-hint { text-align: center; font-size: 12px; }
/* 海报风格切换（马卡龙/古风） */
.poster-style-select { display: flex; gap: 10px; margin: 2px 0 0; }
.ps-opt { flex: 1; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--card-border); background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all .15s; font-family: inherit; }
.ps-opt.is-active { border-color: var(--accent2); color: var(--accent2); background: #fff4f6; box-shadow: 0 0 0 2px rgba(255,95,109,0.18); }

.group-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-item { background: #fff2e6; color: var(--ink); padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.cloud-item b { color: var(--accent); }
.group-hot, .group-rare { margin-top: 10px; font-size: 13px; color: var(--ink); }

.compare-result { margin-top: 12px; }
.cmp-vis { display: flex; align-items: center; justify-content: space-around; gap: 8px; }
.cmp-me, .cmp-other { text-align: center; }
.cmp-me b, .cmp-other b { font-size: 30px; display: block; }
.cmp-me span, .cmp-other span { font-size: 13px; color: var(--ink-soft); }
.cmp-syn { text-align: center; padding: 10px; background: #fff2e6; border-radius: 12px; }
.cmp-syn b { font-size: 26px; color: var(--accent); display: block; }
.cmp-syn i { font-size: 11px; color: var(--ink-soft); font-style: normal; }
.cmp-note { margin-top: 10px; font-size: 13px; color: var(--ink); line-height: 1.7; }
#compareName { width: 100%; padding: 11px 12px; border: 1px solid var(--card-border); border-radius: 12px; font-size: 14px; font-family: inherit; margin-bottom: 6px; }

/* ===== 藏头诗 ===== */
.acrostic-meta { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.acrostic-meta b { color: var(--accent); font-weight: 700; }
.acrostic-poem {
  font-family: "Kaiti SC", "STKaiti", serif; font-size: 20px; line-height: 2.1; letter-spacing: 1px;
  color: var(--ink); background: linear-gradient(135deg, #fdf6ff, #fff3e8);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  padding: 18px 16px; text-align: center; white-space: pre-wrap; overflow-x: auto;
}
.acrostic-note { font-size: 11px; color: var(--ink-soft); text-align: center; margin-top: 10px; }

/* ===== 页脚 ===== */
.footer { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 20px 18px 40px; text-align: center; }
.footer p { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.compliance-statement { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--card-border); text-align: center; }
.compliance-statement p { font-size: 11px; line-height: 1.8; color: var(--ink-soft); opacity: 0.85; }
.copyright { margin-top: 12px; font-size: 11px; opacity: 0.7; }

@media (min-width: 500px) { .view, .footer { max-width: 460px; } }