:root {
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --text: #1c2033;
  --text-soft: #5d6480;
  --text-mute: #8b91a7;
  --line: #e6e8f0;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --success: #16a34a;
  --teal: #0ea5a4;
  --amber: #f59e0b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(28, 32, 51, .07);
  --shadow-lg: 0 14px 40px rgba(28, 32, 51, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px;
  gap: 12px;
}

.brand { display: flex; align-items: baseline; gap: 8px; }

.logo {
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 20px;
  background: linear-gradient(135deg, #6366f1, #0ea5a4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text { color: var(--text-soft); font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-meta { color: var(--text-mute); font-size: 13px; }

/* ---------- 视图切换 ---------- */
.view { display: none; }
.view-active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font-size: 30px; margin: 0 0 12px; letter-spacing: .5px; }
.grad {
  background: linear-gradient(135deg, #6366f1, #0ea5a4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { color: var(--text-soft); max-width: 640px; margin: 0 auto; font-size: 14px; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0 22px;
}

.mode-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: all .18s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mode-card:hover { border-color: #c9cff5; transform: translateY(-2px); box-shadow: var(--shadow); }
.mode-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow); }

.mode-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.mode-card-featured .mode-badge { background: var(--primary); }
.mode-num { font-size: 34px; font-weight: 800; line-height: 1.1; }
.mode-unit { font-size: 13px; color: var(--text-mute); }
.mode-desc { font-size: 13px; color: var(--text-soft); margin-top: 8px; min-height: 44px; }

.home-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.notice {
  margin: 26px auto 0;
  max-width: 660px;
  padding-left: 20px;
  color: var(--text-soft);
  font-size: 13px;
}
.notice li { margin-bottom: 6px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
  background: #fff;
  color: var(--text);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 13px 34px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4338ca; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-outline { border-color: var(--line); background: #fff; }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--line); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- 答题 ---------- */
.test-head { margin-bottom: 14px; }
.test-head-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.q-index strong { font-size: 18px; }
.q-index, .q-answered { color: var(--text-soft); font-size: 13px; }
.q-answered { margin-left: auto; }

.progress { height: 6px; background: #e8eaf3; border-radius: 20px; overflow: hidden; }
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #6366f1, #0ea5a4);
  transition: width .25s ease;
}

.question-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-bottom: 18px;
}
.q-text { font-size: 19px; font-weight: 600; margin: 0 0 22px; line-height: 1.6; }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  transition: all .14s ease;
}
.opt:hover { border-color: #b9c0f0; background: #fafbff; }
.opt.active { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.opt-key {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #eceefb;
  color: var(--text-soft);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.opt.active .opt-key { background: var(--primary); color: #fff; }

.hint { margin-top: 18px; font-size: 12.5px; color: var(--text-mute); }
kbd {
  background: #f0f2f8;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  font-family: inherit;
  font-size: 12px;
}

.test-foot { display: flex; justify-content: space-between; gap: 12px; }
.test-foot .btn-primary, .test-foot .btn-success { margin-left: auto; }

/* 题卡 */
.sheet {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-soft); margin-bottom: 12px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 7px; max-height: 300px; overflow-y: auto; }
.cell {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-soft);
}
.cell:hover { border-color: var(--primary); }
.cell.done { background: var(--primary-soft); border-color: #c9cff5; color: var(--primary); }
.cell.current { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, .18); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px 0 6px; }
.dot-done { background: var(--primary); }
.dot-todo { background: #d7dae6; }

/* ---------- 结果 ---------- */
.result-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  background: linear-gradient(135deg, #6366f1, #0ea5a4);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.result-code {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 2px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 12px;
  padding: 8px 18px;
}
.result-title h2 { margin: 0; font-size: 24px; }
.result-title p { margin: 2px 0 0; font-size: 14px; opacity: .92; }
.result-en { font-size: 12.5px !important; opacity: .75; }

.panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.panel-title { margin: 0 0 16px; font-size: 16px; }
.panel-foot { margin: 14px 0 0; font-size: 12.5px; color: var(--text-mute); }
.sub-title { margin: 18px 0 8px; font-size: 14px; color: var(--text-soft); }
.desc { color: var(--text-soft); margin: 0; }

.dim-list { display: flex; flex-direction: column; gap: 18px; }
.dim-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
.dim-top { display: flex; justify-content: space-between; font-size: 14px; }
.dim-top .pole { color: var(--text-soft); }
.dim-top .pole.win { color: var(--text); font-weight: 700; }
.dim-top .pct { font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 10px; background: #eceef7; border-radius: 20px; overflow: hidden; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, #6366f1, #0ea5a4); border-radius: 20px; }
.bar-mid { position: absolute; top: -3px; bottom: -3px; left: 50%; width: 2px; background: #c7cbdc; }
.dim-note { font-size: 12.5px; color: var(--text-mute); }
.chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 1px 9px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: 1px;
}
.chip-strong { background: #e6f6ee; color: #15803d; }
.chip-mid { background: #fff5e5; color: #b45309; }
.chip-slight { background: #eef0f7; color: #6b7280; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.list { margin: 0; padding-left: 18px; color: var(--text-soft); font-size: 13.5px; }
.list li { margin-bottom: 5px; }

.fn-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fn {
  background: #f7f8fd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  font-size: 13.5px;
}
.fn-tag { display: block; font-size: 11.5px; color: var(--text-mute); margin-bottom: 4px; }

.result-actions { display: flex; gap: 12px; justify-content: center; margin: 22px 0 14px; }
.disclaimer { font-size: 12.5px; color: var(--text-mute); text-align: center; margin: 0; }

.footer { text-align: center; font-size: 12px; color: var(--text-mute); margin-top: 26px; }

.hidden { display: none !important; }

/* ---------- 分享弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 23, 38, .55); }
.modal-body {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 18px 26px;
  animation: slideUp .26s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.wechat-tip {
  background: #eaf7ef;
  color: #15803d;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 12px;
}
.card-wrap { text-align: center; }
.card-wrap img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: block;
  margin: 0 auto;
}
.card-tip { font-size: 12.5px; color: var(--text-mute); margin: 10px 0 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 auto; }

@media (min-width: 721px) {
  .modal { align-items: center; }
  .modal-body { border-radius: 18px; max-height: 90vh; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: rgba(28, 32, 51, .92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s ease;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .mode-desc { min-height: 0; }
  .hero h1 { font-size: 24px; }
  .result-code { font-size: 34px; }
  .two-col, .fn-row { grid-template-columns: 1fr; }
  .fn-row { grid-template-columns: 1fr 1fr; }
  .q-text { font-size: 17px; }
}
