:root {
  --bg: #f6f1ff;
  --bg2: #fdf6f0;
  --card: #ffffff;
  --text: #2a2340;
  --muted: #8a83a0;
  --line: #ece7f6;
  --primary: #7c5cff;
  --primary-2: #b06cff;
  --primary-soft: #efeaff;
  --accent: #ff8a65;
  --danger: #e5484d;
  --ok: #2fa66a;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(92, 64, 180, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[v-cloak] { display: none; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%) fixed;
  background-color: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom));
}
.page.center { min-height: 80vh; display: flex; align-items: center; justify-content: center; flex-direction: column; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title { margin: 0 0 12px; font-size: 16px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.error { color: var(--danger); font-size: 14px; margin: 12px 0 0; }
.notice { background: var(--primary-soft); border-radius: 12px; padding: 12px 14px; margin: 16px 0 0; font-size: 15px; }
.tips { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  border: none; border-radius: 999px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  background: var(--primary-soft); color: var(--primary);
  transition: transform .1s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 16px rgba(124, 92, 255, .3); }
.btn.ghost { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn.link { background: transparent; color: var(--muted); font-weight: 400; font-size: 14px; }
.text-btn { background: none; border: none; color: var(--primary); font-size: 15px; padding: 8px 0; cursor: pointer; }
.text-btn:disabled { color: var(--muted); opacity: .5; }

/* 首页 */
.home .hero { text-align: center; padding: 48px 0 28px; }
.logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 24px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 34px; box-shadow: 0 10px 24px rgba(124, 92, 255, .35);
}
.home h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: 1px; }
.home .hero p { margin: 0; }
.code-input {
  width: 100%; height: 56px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #faf9fe;
  text-align: center; font-size: 22px; letter-spacing: 3px; font-weight: 600;
  text-transform: uppercase; outline: none;
}
.code-input:focus { border-color: var(--primary); background: #fff; }
.code-input::placeholder { font-size: 16px; letter-spacing: 1px; font-weight: 400; color: #bbb5cc; text-transform: none; }

/* 介绍页 */
.q-title { margin: 0 0 4px; font-size: 24px; }
.subtitle { margin: 0 0 12px; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.meta span { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 2px 12px; font-size: 13px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.history-item:first-of-type { border-top: none; }

/* 排版内容 */
.md h3 { font-size: 16px; margin: 18px 0 8px; color: var(--primary); }
.md h3:first-child { margin-top: 0; }
.md p { margin: 8px 0; }
.md ul { margin: 8px 0; padding-left: 20px; }
.md li { margin: 4px 0; }
.md strong { color: var(--text); }

/* 答题页 */
.quiz-top { display: flex; justify-content: space-between; align-items: center; }
.counter { color: var(--muted); font-size: 14px; }
.counter b { color: var(--primary); font-size: 18px; }
.progress { height: 6px; background: var(--primary-soft); border-radius: 999px; overflow: hidden; margin: 8px 0 24px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 999px; transition: width .3s; }
.question h2 { font-size: 20px; line-height: 1.5; margin: 0 0 20px; min-height: 60px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  text-align: left; padding: 14px 16px; margin-bottom: 12px;
  background: var(--card); border: 2px solid transparent; border-radius: 16px;
  box-shadow: var(--shadow); cursor: pointer; font-size: 16px; line-height: 1.5;
  transition: border-color .15s, background .15s, transform .1s;
}
.option:active { transform: scale(.99); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt-letter {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 14px;
}
.option.selected .opt-letter { background: var(--primary); color: #fff; }
.quiz-bottom { margin-top: 8px; }

.forward-enter-active, .forward-leave-active, .back-enter-active, .back-leave-active { transition: all .18s ease; }
.forward-leave-active, .back-leave-active { pointer-events: none; }
.forward-enter-from { opacity: 0; transform: translateX(24px); }
.forward-leave-to { opacity: 0; transform: translateX(-24px); }
.back-enter-from { opacity: 0; transform: translateX(-24px); }
.back-leave-to { opacity: 0; transform: translateX(24px); }

/* 结果页 */
.result-hero {
  text-align: center; color: #fff; padding: 28px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2) 60%, var(--accent));
}
.result-hero .muted { color: rgba(255, 255, 255, .8); margin: 0 0 8px; }
.result-hero h1 { margin: 4px 0; font-size: 28px; }
.result-key { font-size: 44px; font-weight: 800; letter-spacing: 6px; line-height: 1.2; }
.tagline { margin: 8px 0 0; opacity: .95; }
.score { margin-top: 12px; }
.score b { font-size: 36px; }
.pair-bar, .single-bar { margin: 14px 0; }
.pair-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.pair-labels .strong { color: var(--primary); font-weight: 700; }
.pair-track { height: 10px; border-radius: 999px; background: #ffd9cc; overflow: hidden; }
.pair-left { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.single-track { height: 10px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.single-track div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 999px; }
.result-actions { margin-bottom: 8px; }

/* 其他 */
.preview-banner { background: #fff4d6; color: #8a6100; text-align: center; font-size: 13px; padding: 8px 12px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(30, 24, 50, .88); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 100; max-width: 90vw; text-align: center;
}
