:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #3d3730;
  --text-2: #4a4239;
  --dim: #9c9186;
  --dim-2: #a89d92;
  --ember: #f97316;
  --ember-2: #fb923c;
  --line: rgba(61, 55, 48, 0.08);
  --line-2: rgba(61, 55, 48, 0.06);
  --shadow: 0 4rpx 20rpx rgba(61, 55, 48, 0.05);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #efe9e0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding: 16px 16px 40px;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ===== 右上角音乐开关 ===== */
.bgm-toggle {
  position: fixed;
  top: 14px;
  right: max(14px, calc((100vw - 480px) / 2 + 14px));
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(61, 55, 48, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bgm-icon { font-size: 20px; filter: grayscale(1); opacity: 0.5; transition: all .2s; }
.bgm-icon.on { filter: none; opacity: 1; }

/* ===== 通用卡片 / 标题 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(61, 55, 48, 0.04);
}

.sec-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  padding-left: 10px;
  border-left: 3px solid var(--ember);
  margin-bottom: 12px;
}

.text-dim { color: var(--dim); }

/* ===== 封面 ===== */
.glow-top {
  position: absolute;
  top: -60px; left: 50%;
  width: 360px; height: 220px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0));
  pointer-events: none;
}
.hero { position: relative; margin-bottom: 16px; }
.hero-img {
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 6px 22px rgba(61, 55, 48, 0.1);
  display: block;
}
.hero-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: 20px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: var(--ember);
  font-size: 13px;
  font-weight: 700;
}

.story-label { font-size: 18px; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.story-body .story-p { display: block; font-size: 14px; line-height: 1.85; color: var(--text-2); margin-bottom: 8px; }

.tips { margin-bottom: 16px; }
.tip-item { display: flex; align-items: flex-start; margin-bottom: 10px; }
.tip-dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); margin-top: 7px; margin-right: 10px; }
.tip-text { font-size: 13px; color: var(--dim); line-height: 1.6; }

/* ===== 按钮 ===== */
.actions { margin-top: 8px; }
.btn-primary, .btn-ghost {
  width: 100%;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.btn-primary { background: linear-gradient(90deg, var(--ember), var(--ember-2)); color: #fff; box-shadow: 0 6px 18px rgba(249, 115, 22, 0.3); }
.btn-ghost { background: #fff; color: var(--ember); border: 1px solid rgba(249, 115, 22, 0.4); box-shadow: none; }
.btn-primary:active, .btn-ghost:active { transform: scale(0.975); }
.btn-ghost + .btn-ghost, .btn-primary + .btn-ghost { margin-top: 12px; }
.action-row { display: flex; margin-top: 12px; }
.action-half { flex: 1; }
.action-half:first-child { margin-right: 12px; }
.footer-note { text-align: center; margin-top: 18px; font-size: 12px; color: var(--dim); }

/* ===== 弹层（说明 / 海报） ===== */
.modal-mask, .poster-mask {
  position: fixed; inset: 0;
  background: rgba(61, 55, 48, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px; z-index: 998;
}
.modal-box {
  background: #fff; border-radius: 18px; padding: 22px; width: 100%; max-width: 340px;
}
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 12px; text-align: center; }
.modal-body { font-size: 14px; line-height: 1.8; color: var(--text-2); margin-bottom: 16px; }
.modal-close { margin-top: 4px; }

/* ===== 答题页 ===== */
.quiz-page { padding-top: 16px; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.step-text { font-size: 13px; color: var(--dim); letter-spacing: .5px; }
.step-count { font-size: 13px; color: var(--ember); font-weight: 700; }
.progress-track { height: 5px; border-radius: 3px; background: rgba(61, 55, 48, 0.08); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--ember), var(--ember-2)); transition: width .45s ease; }

/* 实时属性条 */
.attr-bar {
  display: flex; align-items: stretch; justify-content: space-between; gap: 8px;
  margin-bottom: 14px; padding: 11px 9px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 3px 10px rgba(61, 55, 48, 0.05);
}
.attr-item { position: relative; flex: 1; display: flex; align-items: center; gap: 6px; padding: 3px 5px; }
.attr-item + .attr-item { border-left: 1px solid var(--line); }
.attr-icon { font-size: 18px; line-height: 1; }
.attr-meta { min-width: 0; }
.attr-name { font-size: 11px; color: var(--dim); line-height: 1.2; white-space: nowrap; }
.attr-val { font-size: 18px; font-weight: 800; line-height: 1.15; transition: transform .2s ease; }
.attr-delta {
  position: absolute; top: -3px; right: 3px; font-size: 10px; font-weight: 700;
  opacity: 0; animation: deltaPop 1s ease-out forwards;
}
.attr-delta.good { color: #16a34a; }
.attr-delta.bad { color: #ef4444; }
@keyframes deltaPop {
  0% { opacity: 0; transform: translateY(5px) scale(.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.05); }
  80% { opacity: 1; transform: translateY(-3px) scale(1); }
  100% { opacity: 0; transform: translateY(-7px) scale(.9); }
}

.hint-bar { padding: 10px 13px; margin-bottom: 14px; border-radius: 10px; background: rgba(249, 115, 22, 0.08); border: 1px dashed rgba(249, 115, 22, 0.3); }
.hint-text { font-size: 12px; color: #b45309; line-height: 1.6; }

/* 悬浮上升数值 */
.float-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.float-group {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transform: translateX(-50%); animation: floatUp 1.15s ease-out forwards;
}
.float-item { font-size: 16px; font-weight: 800; white-space: nowrap; text-shadow: 0 1px 4px rgba(255,255,255,.9), 0 0 1px rgba(0,0,0,.15); }
@keyframes floatUp {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.8); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-90px) scale(1.1); }
}

/* 选择后场景微动画 */
.scene-fx {
  position: fixed; left: 0; right: 0; top: 38%; z-index: 55;
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
  animation: fxFade 1.1s ease-out forwards;
}
.fx-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(61,55,48,.18)); }
.fx-caption {
  margin-top: 10px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,.94); border: 1px solid rgba(61,55,48,.1);
  box-shadow: 0 4px 12px rgba(61,55,48,.1); font-size: 14px; font-weight: 700; color: var(--text);
}
@keyframes fxFade { 0% { opacity: 0; transform: scale(.6); } 18% { opacity: 1; transform: scale(1.08); } 78% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.96); } }
.fx-pop { animation: fxPop 1.1s ease-out forwards; }
.fx-shake { animation: fxShake 1.1s ease-in-out forwards; }
.fx-float { animation: fxFloat 1.1s ease-in-out forwards; }
.fx-drop { animation: fxDrop 1.1s ease-in forwards; }
.fx-wave { animation: fxWave 1.1s ease-in-out forwards; }
.fx-pulse { animation: fxPulse 1.1s ease-out forwards; }
@keyframes fxPop { 0% { transform: scale(.4); opacity: 0; } 40% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fxShake { 0%,100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-10px) rotate(-8deg); } 40% { transform: translateX(10px) rotate(8deg); } 60% { transform: translateX(-6px) rotate(-5deg); } 80% { transform: translateX(6px) rotate(5deg); } }
@keyframes fxFloat { 0% { transform: translateY(30px); opacity: 0; } 30% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-12px); opacity: 1; } }
@keyframes fxDrop { 0% { transform: translateY(-40px) scale(.8); opacity: 0; } 35% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes fxWave { 0% { transform: rotate(0) translateY(0); opacity: 0; } 25% { transform: rotate(-10deg) translateY(-6px); opacity: 1; } 50% { transform: rotate(10deg) translateY(0); } 75% { transform: rotate(-6deg) translateY(-3px); } 100% { transform: rotate(0); opacity: 1; } }
@keyframes fxPulse { 0% { transform: scale(.7); opacity: 0; } 30% { transform: scale(1.2); opacity: 1; } 55% { transform: scale(.95); } 80% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* 剧情卡 */
.scene-card { border-left: 3px solid var(--ember); }
.scene-head { display: flex; align-items: center; margin-bottom: 12px; }
.scene-index { flex-shrink: 0; padding: 3px 10px; margin-right: 10px; border-radius: 6px; background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.26); color: var(--ember); font-size: 12px; font-weight: 700; }
.scene-title { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.3; }
.scene-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.scene-text { font-size: 15px; line-height: 1.85; color: var(--text-2); }

/* 选项 */
.options { transition: opacity .28s ease, transform .28s ease; }
.option {
  display: flex; align-items: flex-start; padding: 15px 14px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  transition: transform .18s ease, border-color .18s ease; box-shadow: 0 2px 8px rgba(61,55,48,.04);
  cursor: pointer;
}
.option.hover { transform: scale(.975); border-color: rgba(249, 115, 22, 0.55); }
.option-key {
  flex-shrink: 0; width: 28px; height: 28px; margin-right: 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
  background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.32); color: var(--ember);
}
.opt-B .option-key { background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.3); color: #0284c7; }
.option-body { flex: 1; min-width: 0; }
.option-label { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.45; margin-bottom: 6px; }
.option-desc { font-size: 13px; color: var(--dim); line-height: 1.6; }
.option-arrow { flex-shrink: 0; margin-left: 8px; font-size: 22px; line-height: 1; color: #c8beb2; align-self: center; }
.quit-hint { text-align: center; margin-top: 10px; font-size: 12px; color: var(--dim); }

/* ===== 结果页 ===== */
.result-page { padding-top: 8px; }
.result-img-wrap { margin-bottom: 16px; }
.result-img { width: 100%; border-radius: 16px; box-shadow: 0 4px 16px rgba(61,55,48,.08); display: block; }

.ending-hero { text-align: center; padding: 22px 16px 18px; margin-bottom: 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 2px 10px rgba(61,55,48,.05); }
.ending-badge-wrap { margin-bottom: 12px; }
.ending-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px;
  border-radius: 50%; font-size: 30px; font-weight: 800; color: #fff; box-shadow: 0 5px 14px rgba(61,55,48,.14);
}
.ending-persona { font-size: 23px; font-weight: 800; letter-spacing: 1px; color: var(--text); margin-bottom: 6px; }
.ending-title { font-size: 14px; color: var(--dim); letter-spacing: .5px; margin-bottom: 6px; }
.ending-summary { display: inline-block; padding: 4px 12px; border-radius: 12px; background: rgba(61,55,48,.05); font-size: 12px; color: #6b6259; margin-bottom: 14px; }
.pop-bar-track { height: 6px; border-radius: 3px; background: rgba(61,55,48,.08); overflow: hidden; margin-bottom: 7px; }
.pop-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--ember-2), var(--ember)); transition: width .8s ease; }
.pop-bar-text { font-size: 12px; color: var(--dim); }

/* 雷达 + 属性 */
.radar-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.radar-canvas { width: 100%; height: 240px; }
.reveal-note { font-size: 13px; color: var(--dim); margin: -4px 0 12px; }
.attr-row { margin-bottom: 14px; }
.attr-row:last-child { margin-bottom: 0; }
.attr-row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 5px; }
.attr-row-name { font-size: 14px; color: var(--text-2); white-space: nowrap; flex: 1; min-width: 0; }
.attr-row-val { font-size: 17px; font-weight: 800; }
.attr-row-track { height: 6px; border-radius: 3px; background: rgba(61,55,48,.08); overflow: hidden; margin-bottom: 4px; }
.attr-row-fill { height: 100%; border-radius: 3px; transition: width .9s cubic-bezier(.34,1.2,.64,1); }
.attr-row-desc { font-size: 12px; color: var(--dim-2); }

.ending-desc { font-size: 15px; line-height: 1.9; color: var(--text-2); }

.trait-item { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.trait-item:last-child { border-bottom: none; padding-bottom: 0; }
.trait-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.trait-name { font-size: 15px; color: var(--text); }
.trait-stars { display: flex; }
.star { width: 11px; height: 11px; margin-left: 5px; border-radius: 50%; background: rgba(61,55,48,.12); }
.star-on { background: #f59e0b; }
.trait-note { font-size: 13px; color: var(--dim-2); }

.play-item { display: flex; align-items: flex-start; margin-bottom: 11px; }
.play-item:last-child { margin-bottom: 0; }
.play-index { flex-shrink: 0; width: 20px; height: 20px; margin-right: 10px; border-radius: 50%; background: rgba(249,115,22,.1); border: 1px solid rgba(249,115,22,.3); color: var(--ember); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.play-text { flex: 1; font-size: 14px; line-height: 1.75; color: var(--text-2); }

.replay-item { position: relative; padding: 12px 0 12px 14px; border-left: 2px solid rgba(61,55,48,.1); margin-bottom: 4px; }
.replay-item:last-child { margin-bottom: 0; }
.replay-step { font-size: 12px; color: var(--dim-2); margin-bottom: 3px; }
.replay-node { font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.replay-choice { display: flex; align-items: flex-start; }
.replay-key { flex-shrink: 0; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: rgba(249,115,22,.1); color: var(--ember); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.replay-label { flex: 1; font-size: 14px; color: var(--text); line-height: 1.5; }

.share-tip { text-align: center; margin-top: 16px; font-size: 12px; color: var(--dim); }
.disclaimer { text-align: center; margin-top: 20px; padding: 0 10px; font-size: 12px; line-height: 1.7; color: var(--dim); }

/* 海报弹层 */
.poster-panel { width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.poster-title { text-align: center; font-size: 13px; color: #f5efe6; margin-bottom: 10px; }
.poster-img { width: 100%; border-radius: 12px; box-shadow: 0 10px 30px rgba(61,55,48,.3); display: block; }
.poster-actions { display: flex; margin-top: 14px; }
.poster-btn { flex: 1; height: 44px; font-size: 14px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.poster-btn:first-child { margin-right: 12px; }

/* 通用进场动画 */
@keyframes animIn { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes animPop { 0% { opacity: 0; transform: scale(.92); } 100% { opacity: 1; transform: scale(1); } }
.anim-in { animation: animIn .4s ease-out both; }
.anim-pop { animation: animPop .45s ease-out both; }

/* 轻提示 */
.h5-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(61, 55, 48, 0.9); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: 14px; z-index: 999; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 复制文案弹层 */
.copy-text {
  width: 100%; height: 150px; resize: none;
  border: 1px solid rgba(61, 55, 48, 0.18); border-radius: 12px;
  padding: 12px; font-size: 14px; line-height: 1.7; color: var(--text);
  background: #faf7f2; box-sizing: border-box;
  -webkit-user-select: text; user-select: text;
}

/* 页面底部水印（不明显，但保留版权声明；不遮挡内容、不拦截点击） */
.page-watermark {
  position: fixed; left: 0; right: 0; bottom: 0;
  text-align: center; font-size: 11px; line-height: 1.3; letter-spacing: .2px;
  color: rgba(61, 55, 48, 0.34);
  padding: 6px 14px; pointer-events: none; z-index: 40;
}
