:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-sub: #6b7280;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --green: #10b981;
  --red: #ef4444;
  --border: #e5e7eb;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 背景图：主页暗色铜版画背景 */
body {
  background-image: url("assets/bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: rgba(10, 12, 28, 0.32);
}

/* 卡片带玻璃质感，让背景图透出来 */
.card {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(8px);
}

.app { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }

.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: 12px 0;
  display: flex; align-items: center; gap: 12px;
}
.progress { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width 0.2s; border-radius: 3px; }
.progress-label { font-size: 13px; color: var(--text-sub); white-space: nowrap; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.screen { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 介绍页：深色玻璃质感，突出背景图 */
.intro-card {
  text-align: center; padding: 52px 40px;
  position: relative; overflow: hidden;
  background: rgba(18, 20, 40, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(180, 165, 120, 0.25);
  color: #e8e6df;
}
.intro-card::before {
  content: ""; position: absolute; top: -80px; right: -80px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(180, 160, 100, 0.22), transparent 70%); border-radius: 50%;
}
.intro-card::after {
  content: ""; position: absolute; bottom: -60px; left: -60px; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(120, 150, 160, 0.16), transparent 70%); border-radius: 50%;
}
.intro-card > * { position: relative; z-index: 1; }
.intro-badge {
  display: inline-block; font-size: 14px; font-weight: 600; color: #e5d5a8;
  background: rgba(180, 160, 100, 0.16); padding: 6px 16px; border-radius: 30px; margin-bottom: 20px;
  letter-spacing: 1px; border: 1px solid rgba(180, 160, 100, 0.3);
}
.intro-card h1 { font-size: 30px; margin-bottom: 10px; line-height: 1.3; color: #f0eee8; }
.subtitle { color: #b8b4a8; margin-bottom: 28px; font-size: 16px; letter-spacing: 0.5px; }
.intro-body { text-align: left; margin-bottom: 28px; }
.intro-body p { margin-bottom: 14px; font-size: 15px; color: #d5d2c8; }
.intro-body ul { padding-left: 20px; margin-bottom: 14px; list-style: none; }
.intro-body li { margin-bottom: 9px; color: #b8b4a8; position: relative; padding-left: 22px; }
.intro-body li::before { content: "✓"; position: absolute; left: 0; color: #c9b268; font-weight: 700; }
.note { font-size: 13px; color: #9a978c; font-style: italic; }
.intro-disclaimer {
  margin-top: 18px; font-size: 12.5px; color: #d9c088;
  background: rgba(60, 50, 20, 0.4); border: 1px solid rgba(180, 160, 100, 0.35); border-radius: 10px; padding: 10px 14px;
}

/* 名字输入页 */
.name-card { text-align: center; padding: 48px 36px; }
.name-card h1 { font-size: 26px; margin-bottom: 10px; }
.name-input {
  width: 100%; max-width: 360px; padding: 14px 18px; margin: 20px auto 8px;
  font-size: 16px; border: 1.5px solid var(--border); border-radius: 12px;
  outline: none; text-align: center; transition: border-color 0.15s;
}
.name-input:focus { border-color: var(--primary); }
.name-hint { font-size: 12.5px; color: var(--text-sub); margin-bottom: 22px; }

/* 按钮 */
.btn {
  display: inline-block; padding: 12px 32px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 600; transition: all 0.15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost:hover { background: rgba(99, 102, 241, 0.06); }
.btn.ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* 答题 */
.q-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.q-dim { font-size: 12px; color: var(--primary); background: rgba(99,102,241,0.1); padding: 4px 10px; border-radius: 20px; }
.q-num { font-size: 13px; color: var(--text-sub); }
.q-text { font-size: 19px; margin-bottom: 24px; line-height: 1.5; }

.q-options { display: flex; flex-direction: column; gap: 12px; }
.opt-btn {
  display: flex; align-items: flex-start; gap: 12px;
  text-align: left; padding: 16px;
  background: #fff; border: 1.5px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all 0.15s; font-size: 15px; line-height: 1.5;
}
.opt-btn:hover { border-color: var(--primary); background: rgba(99,102,241,0.03); }
.opt-btn.selected { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.opt-btn.avoid { border-style: dashed; }
.opt-label {
  flex-shrink: 0; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg); font-weight: 700; font-size: 13px;
}
.opt-btn.selected .opt-label { background: var(--primary); color: #fff; }
.opt-text { flex: 1; }

.q-nav { display: flex; justify-content: space-between; margin-top: 24px; }

/* 结果 */
.result-wrap { display: flex; flex-direction: column; gap: 20px; }
.result-card h1 { text-align: center; font-size: 26px; margin-bottom: 24px; }
.result-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.type-box { text-align: center; }
.type-group {
  display: inline-block; font-size: 13px; color: var(--primary);
  background: rgba(99,102,241,0.1); padding: 4px 14px; border-radius: 20px; margin-bottom: 10px;
}
.type-name { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.type-match {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 12px; border: 1.5px solid; border-radius: 20px;
  margin-bottom: 8px; letter-spacing: 1px;
}
.type-desc { color: var(--text-sub); font-size: 15px; }
.type-intro {
  margin: 0 auto 24px; max-width: 640px; text-align: left;
  background: #f8f9fc; border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 18px 20px;
}
.type-intro-title { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 8px; letter-spacing: 1px; }
.type-intro-text { font-size: 15px; line-height: 1.8; color: #374151; }
.type-advice {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed #e0e4ea;
}
.type-advice-title { font-size: 14px; font-weight: 700; color: #b45309; margin-bottom: 8px; letter-spacing: 1px; }
.type-advice-text { font-size: 15px; line-height: 1.8; color: #57534e; }
.labels-box { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.label-chip { font-size: 13px; background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; padding: 4px 12px; border-radius: 20px; }
.label-chip.muted { background: var(--bg); color: var(--text-sub); border-color: var(--border); }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.chart-box h3 { font-size: 16px; margin-bottom: 12px; text-align: center; }
.chart-box canvas { max-height: 320px; }

.aux-box { margin-bottom: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.aux-box h3 { font-size: 16px; margin-bottom: 12px; }
.aux-content { display: flex; flex-direction: column; gap: 8px; }
.aux-item { font-size: 14px; color: var(--text-sub); }
.aux-item.warn { color: #c2410c; }

.dim-detail { margin-bottom: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.dim-detail h3 { font-size: 16px; margin-bottom: 16px; }
.dim-grid { display: flex; flex-direction: column; gap: 14px; }
.dim-item { font-size: 13px; }
.dim-item-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.dim-name { font-weight: 600; }
.dim-val { font-weight: 700; }
.dim-val.pos { color: var(--green); }
.dim-val.neg { color: var(--red); }
.dim-bar { position: relative; height: 8px; background: #f3f4f6; border-radius: 4px; margin-bottom: 4px; }
.dim-bar-zero { position: absolute; left: 50%; top: -3px; width: 2px; height: 14px; background: #9ca3af; }
.dim-bar-fill { position: absolute; height: 100%; border-radius: 4px; top: 0; }
.dim-bar-fill.pos { background: var(--green); }
.dim-bar-fill.neg { background: var(--red); }
.dim-dir { color: var(--text-sub); font-size: 12px; }
.dim-level-tag {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  padding: 1px 8px; border-radius: 12px; margin-right: 2px;
}
.dim-level-tag.pos { background: rgba(16,185,129,0.12); color: #047857; }
.dim-level-tag.neg { background: rgba(239,68,68,0.12); color: #b91c1c; }

.disclaimer { font-size: 12.5px; color: #b45309; text-align: center; margin: 20px 0; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; }
#retryBtn { display: block; margin: 0 auto; }

/* 响应式 */
@media (max-width: 640px) {
  .charts { grid-template-columns: 1fr; }
  .card { padding: 24px 20px; }
  .intro-card h1 { font-size: 22px; }
  .type-name { font-size: 23px; }
}
