/* 基础样式与设计变量
   颜色、字号都来自《首页答题页 UI 稿》与《9 屏连排稿 v3》，
   改皮只改 :root，具体部件里不写死颜色。 */

:root {
  /* 底色层次 */
  --bg: #FAF7F2;
  --bg-quiz: #FFFDF8;
  --bg-calc: #FBF3E8;
  --surface: #FFFFFF;
  --surface-sel: #FBF1E6;

  /* 文字 */
  --ink: #332E27;
  --ink-soft: #4A4238;
  --muted: #9A8570;
  --faint: #B6A791;

  /* 线与强调 */
  --line: #EFE2CE;
  --line-strong: #F0E3CE;
  --copper: #C6895C;
  --copper-deep: #B9774C;
  --bar-track: #F4EADA;
  --bar-fill: #F0A36E;
  --green: #6FBF9E;
  --cream: #F7F0E3;

  /* 尺寸 */
  --radius: 12px;
  --radius-lg: 16px;
  --app-max: 480px;
  --pad: 22px;

  --ease: cubic-bezier(.32, .72, .28, 1);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* 手机以外的地方把内容收成一列，不要摊满 1440px */
.app {
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 主按钮：首页用绿、答题推进用铜 */
.btn {
  display: block;
  width: 100%;
  text-align: center;
  border-radius: var(--radius);
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: transform .16s var(--ease), opacity .16s var(--ease);
}
.btn:active { transform: scale(.985); opacity: .92; }
.btn-primary { background: var(--green); color: #F7EFE0; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; font-size: 14px; }

/* 兜底错误页：数据挂了要让用户看到人话，不是白屏 */
.fatal {
  margin: auto;
  padding: 30px var(--pad);
  text-align: center;
}
.fatal h1 { font-size: 18px; margin-bottom: 10px; }
.fatal p { font-size: 14px; color: var(--muted); line-height: 1.7; }
.fatal pre {
  margin-top: 14px;
  text-align: left;
  font-size: 11px;
  line-height: 1.5;
  color: var(--faint);
  background: var(--cream);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 40vh;
  overflow: auto;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
