/* 考牌易 —— 极简排版风
 *
 * 四条贯穿全站的规矩：
 *   1. 层级靠字号和字重，不靠框线色块。
 *   2. 一个强调色（藏青），只出现在「进度 / 正确 / 主按钮」三处；错误用低饱和砖红。
 *      其余全站只有黑白灰。颜色少，每次出现才有意义。
 *   3. 几乎不用阴影，分隔靠留白和一根 1px 细线。
 *   4. 动效只保留选中答案时的一次 150ms 颜色过渡。
 *
 * 金色只活在 logo 里，界面里一次都不出现 —— 品牌可以有自己的一套色，功能界面必须克制。
 */

:root {
  --bg:        #FAFAF8;   /* 暖白，久看不刺眼 */
  --surface:   #FFFFFF;
  --ink:       #1A1A1A;   /* 近黑而非纯黑：降低对比疲劳 */
  --ink-2:     #5A5A56;
  --ink-3:     #90908B;
  --line:      #E4E4DE;
  --accent:    #1F3A5F;   /* 藏青 */
  --accent-bg: #EEF2F7;
  --wrong:     #A6483C;   /* 低饱和砖红 */
  --wrong-bg:  #F7EDEB;

  --gap:   20px;
  --pad:   22px;
  --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

/* ── 布局骨架 ───────────────────────────────────────────── */
#app { max-width: 720px; margin: 0 auto; padding: 32px var(--pad) calc(96px + var(--safe-b)); }

.sidebar { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none; background: rgba(250,250,248,.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
body.activated .tabbar { display: flex; }
.tab {
  flex: 1; text-align: center; padding: 13px 0 12px;
  font-size: 13px; letter-spacing: .08em; color: var(--ink-3);
  cursor: pointer; transition: color .15s;
}
.tab.active { color: var(--accent); font-weight: 600; }

/* ── 激活页 ─────────────────────────────────────────────── */
.activate-wrap { max-width: 340px; margin: 14vh auto 0; text-align: center; }
.activate-mark { width: 132px; height: auto; margin: 0 auto 26px; display: block; }
.activate-sub  { color: var(--ink-3); font-size: 14px; letter-spacing: .04em; margin-bottom: 34px; }
.activate-input {
  width: 100%; padding: 14px 0; border: none; border-bottom: 1px solid var(--line);
  background: transparent; text-align: center;
  font-size: 26px; letter-spacing: .34em; font-variant-numeric: tabular-nums;
  color: var(--ink); outline: none; transition: border-color .15s;
}
.activate-input:focus { border-bottom-color: var(--accent); }
.activate-input::placeholder { font-size: 15px; letter-spacing: .06em; color: var(--ink-3); }
.activate-btn {
  width: 100%; margin-top: 30px; padding: 15px 0;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  font-size: 16px; letter-spacing: .18em;
}
.activate-btn:disabled { opacity: .45; }
.activate-error { min-height: 22px; margin-top: 16px; font-size: 13px; color: var(--wrong); }

/* ── 首页 ───────────────────────────────────────────────── */
.pt { font-size: 27px; font-weight: 600; letter-spacing: .02em; }
.ps { color: var(--ink-3); font-size: 13px; letter-spacing: .1em; margin: 4px 0 42px; }

.section-label {
  font-size: 12px; letter-spacing: .18em; color: var(--ink-3);
  margin: 42px 0 14px; text-transform: uppercase;
}

/* 卡片：白底 + 一根细线，不用阴影 */
.paper-card, .exam-card, .stats-card, .wrong-card, .link-card, .result-card, .review-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad); margin-bottom: 14px;
}
/* 原来那几根彩色装饰竖条：极简风里属于噪音，隐掉但不改 JS */
.paper-bar, .card-bar, .wrong-bar, .practice-bar { display: none; }

.paper-title, .card-title, .link-title, .wrong-title, .stub-title {
  font-size: 18px; font-weight: 600; letter-spacing: .01em;
}
.paper-sub, .card-sub, .link-sub, .wrong-sub, .hint-text {
  color: var(--ink-3); font-size: 13px; margin-top: 5px;
}

/* 进度：全站唯一一处藏青填充 */
.progress-row, .prog-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.progress-bar, .prog-bar { flex: 1; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill, .prog-fill { height: 100%; background: var(--accent); transition: width .3s; }
.progress-text, .prog-text {
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}

.paper-btns, .wrong-btns, .exam-meta, .mode-btns, .nav-btns, .action-btns, .btn-placeholder {
  display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
}
.paper-btns > *, .wrong-btns > * { flex: 1; }

/* 按钮：只有主按钮是实心藏青，其余一律描边 */
.btn-study, .btn-exam, .btn-primary, .start-btn, .mode-btn.primary,
.btn-wrong-test, .action-btn.primary, .btn-retest {
  padding: 11px 18px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 14px; letter-spacing: .04em;
  text-align: center; transition: opacity .15s;
}
.btn-home, .btn-secondary, .mode-btn, .btn-wrong-view, .back-btn, .stub-back,
.action-btn, .btn-prev, .remove-btn, .review-toggle, .q-delete, .fav-btn {
  padding: 11px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 14px; letter-spacing: .04em; text-align: center;
  transition: border-color .15s, color .15s;
}
.btn-home:active, .btn-secondary:active, .mode-btn:active { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .4; }
.wrong-badge {
  font-size: 12px; color: var(--wrong); background: var(--wrong-bg);
  padding: 3px 10px; border-radius: 20px; font-variant-numeric: tabular-nums;
}
.wrong-header, .review-header, .study-header, .page-header, .expl-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* 统计：数字大、标签小，层级全靠字号 */
.stats-row, .wr-stats-row, .stats-detail { display: flex; gap: 8px; }
.stat-item, .stat-box {
  flex: 1; text-align: center; padding: 16px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-unit { font-size: 12px; color: var(--ink-3); margin-left: 2px; }
.stat-label, .stats-label { font-size: 12px; color: var(--ink-3); margin-top: 3px; letter-spacing: .04em; }
.stats-left { flex: 1; }
.practice-icon, .op-icon, .result-icon, .stub-ico, .practice-arrow { display: none; }
.practice-text { flex: 1; }

/* ── 做题页 ─────────────────────────────────────────────── */
.page-title, .header-title { font-size: 19px; font-weight: 600; }
.page-sub, .header-count {
  font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.timer {
  font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--accent); letter-spacing: .06em;
}

.q-meta { display: flex; gap: 12px; margin: 30px 0 14px; font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.q-num { font-variant-numeric: tabular-nums; }

/* 题干挑大梁：大字号、松行高 */
.q-text, .review-q-text {
  font-size: 20px; line-height: 1.75; font-weight: 500; letter-spacing: .005em;
  margin-bottom: 26px;
}

.opts, .review-opts { display: flex; flex-direction: column; gap: 10px; }
.op-item, .review-opt {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, background .15s, color .15s;  /* 全站唯一的动效 */
}
.op-key, .review-opt-key {
  flex: none; width: 22px; font-weight: 600; color: var(--ink-3);
  transition: color .15s;
}
.op-text, .review-opt-text { flex: 1; line-height: 1.6; }

.op-item.selected { border-color: var(--accent); }
.op-item.selected .op-key { color: var(--accent); }
.op-item.correct, .review-opt.correct {
  border-color: var(--accent); background: var(--accent-bg);
}
.op-item.correct .op-key, .review-opt.correct .review-opt-key { color: var(--accent); }
.op-item.wrong, .review-opt.wrong {
  border-color: var(--wrong); background: var(--wrong-bg);
}
.op-item.wrong .op-key, .review-opt.wrong .review-opt-key { color: var(--wrong); }
.op-item.disabled { pointer-events: none; }

/* 解析：换个底色，靠留白隔开，不加边框 */
.expl, .review-expl {
  margin-top: 24px; padding: 20px; background: #F3F3EF;
  border-radius: var(--radius);
}
.expl-title, .review-expl-title {
  font-size: 12px; letter-spacing: .18em; color: var(--ink-3); margin-bottom: 10px;
}
.expl-content, .review-expl-content {
  font-size: 15px; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap;
}
.correct-text { color: var(--accent); }
.wrong-text   { color: var(--wrong); }
.fav-btn.isFav { border-color: var(--accent); color: var(--accent); }

.nav-btns { position: sticky; bottom: calc(12px + var(--safe-b)); margin-top: 30px; }
.nav-btns > * { flex: 1; }

/* ── 成绩 / 回顾 ────────────────────────────────────────── */
.result-wrap { text-align: center; padding-top: 8px; }
.result-badge {
  display: inline-block; font-size: 12px; letter-spacing: .2em;
  padding: 5px 16px; border-radius: 20px; margin-bottom: 22px;
  border: 1px solid var(--line); color: var(--ink-3);
}
.result-badge.pass { color: var(--accent); border-color: var(--accent); }
.result-badge.fail { color: var(--wrong); border-color: var(--wrong); }
.result-pct {
  font-size: 62px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.result-title { font-size: 17px; margin-top: 12px; }
.result-note, .result-detail { color: var(--ink-3); font-size: 13px; margin-top: 8px; }
.result-body { margin-top: 34px; text-align: left; }

.review-section { margin-top: 36px; }
.review-title { font-size: 12px; letter-spacing: .18em; color: var(--ink-3); margin-bottom: 14px; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item-row, .q-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 0; border-bottom: 1px solid var(--line);
}
.review-num, .q-num {
  flex: none; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  padding-top: 3px; min-width: 46px;
}
.review-text, .q-item-main { flex: 1; font-size: 15px; line-height: 1.6; }
.review-chapter, .q-chapter, .q-answer { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.review-answer-info { font-size: 13px; margin-top: 6px; color: var(--ink-2); }
.review-q-header { display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.empty, .empty-review, .remove-notice {
  text-align: center; color: var(--ink-3); font-size: 14px; padding: 56px 0;
}
.remove-notice { padding: 14px 0; }

/* ── 浮层 ───────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 22px;
  font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(26,26,26,.4);
  display: flex; align-items: center; justify-content: center; z-index: 300; padding: 24px;
}
.modal { background: var(--surface); border-radius: 14px; padding: 26px 24px 18px; max-width: 320px; width: 100%; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-content { color: var(--ink-2); font-size: 14px; margin: 10px 0 22px; line-height: 1.7; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns > * { flex: 1; padding: 11px 0; border-radius: var(--radius); text-align: center; font-size: 15px; }
.modal-cancel { border: 1px solid var(--line); color: var(--ink-2); }
.modal-ok { background: var(--accent); color: #fff; }

.stub-wrap { text-align: center; padding: 20vh 0; }
.stub-title { margin-bottom: 20px; }

/* ── 宽屏：左侧边栏取代底部 tab ─────────────────────────── */
@media (min-width: 900px) {
  body.activated .tabbar { display: none; }
  body.activated .sidebar {
    display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 224px;
    padding: 40px 26px; border-right: 1px solid var(--line); background: var(--bg);
  }
  .brand-mark { width: 96px; height: auto; display: block; margin-bottom: 46px; }
  .snav { display: flex; flex-direction: column; gap: 2px; }
  .snav-item {
    padding: 10px 12px; border-radius: 8px; font-size: 15px;
    color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s;
  }
  .snav-item:hover  { background: #F0F0EB; }
  .snav-item.active { color: var(--accent); font-weight: 600; background: var(--accent-bg); }
  body.activated #app { margin-left: 224px; padding-top: 48px; padding-bottom: 72px; }
  .paper-btns > *, .wrong-btns > * { flex: 0 1 auto; }
}
