/* NISP二级 · 刷题宝典 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #eef1f6;
  color: #1f2937;
  min-height: 100vh;
}
button { font-family: inherit; }

#app { max-width: 760px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; min-height: 52px;
}
.hdr .back {
  width: 34px; height: 34px; border: none; background: #f3f4f6; border-radius: 50%;
  font-size: 17px; color: #374151; cursor: pointer; flex: none; line-height: 1;
}
.hdr .htitle { flex: 1; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .hright { font-size: 14px; color: #6b7280; flex: none; display: flex; align-items: center; gap: 8px; }
.hdr .hright .timer { font-weight: 700; font-variant-numeric: tabular-nums; color: #2563eb; }
.hdr .hright .timer.danger { color: #dc2626; }

.main { flex: 1; padding: 14px 14px 30px; }

/* ---------- home ---------- */
.hero {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff; border-radius: 16px; padding: 20px 18px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
}
.hero h1 { font-size: 21px; letter-spacing: .5px; }
.hero .sub { margin-top: 4px; font-size: 13px; opacity: .85; }
.hero .nums { display: flex; gap: 26px; margin-top: 16px; }
.hero .nums .n b { display: block; font-size: 22px; }
.hero .nums .n span { font-size: 12px; opacity: .85; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile {
  position: relative; background: #fff; border-radius: 14px; padding: 16px;
  border: none; text-align: left; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .06s ease;
}
.tile:active { transform: scale(.98); }
.tile .ico { font-size: 24px; }
.tile .t { font-weight: 700; margin-top: 8px; font-size: 16px; }
.tile .d { font-size: 12px; color: #6b7280; margin-top: 3px; }
.tile.disabled { opacity: .55; }
.tile .badge {
  position: absolute; top: 12px; right: 12px; background: #dc2626; color: #fff;
  font-size: 11px; border-radius: 999px; padding: 2px 8px; font-weight: 700;
}

.card { background: #fff; border-radius: 14px; padding: 14px 16px; margin-top: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h3 { font-size: 14px; color: #374151; margin-bottom: 10px; }
.resume-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 10px 12px; margin-top: 16px; font-size: 13px;
}
.resume-bar .btns { display: flex; gap: 8px; flex: none; }

.hist-item { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed #e5e7eb; }
.hist-item:last-child { border-bottom: none; }
.hist-item .sc { font-weight: 700; }
.hist-item .sc.pass { color: #16a34a; }
.hist-item .sc.fail { color: #dc2626; }

.footnote { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 20px; line-height: 1.7; }
.link-danger { background: none; border: none; color: #dc2626; font-size: 12px; cursor: pointer; text-decoration: underline; }

/* ---------- progress bar ---------- */
.pbar { height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #4f46e5); border-radius: 999px; transition: width .2s; }

/* ---------- question ---------- */
.qcard { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.qmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.qno { font-weight: 800; font-size: 16px; }
.tag { font-size: 11px; background: #eff6ff; color: #2563eb; border-radius: 6px; padding: 2px 7px; }
.tag.warn { background: #fef3c7; color: #b45309; }
.tag.ok { background: #dcfce7; color: #15803d; }
.stem { font-size: 16px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.qimg { display: block; max-width: 100%; margin: 12px auto 4px; border: 1px solid #e5e7eb; border-radius: 8px; }

.opts { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1.5px solid #e5e7eb; border-radius: 12px; padding: 12px 12px;
  font-size: 15px; line-height: 1.6; cursor: pointer; background: #fff;
  transition: border-color .1s, background .1s;
}
.opt .bullet {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid #cbd5e1; color: #475569; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.opt .otext { flex: 1; word-break: break-word; }
.opt.locked { cursor: default; }
.opt.picked { border-color: #2563eb; background: #eff6ff; }
.opt.picked .bullet { border-color: #2563eb; background: #2563eb; color: #fff; }
.opt.correct { border-color: #16a34a; background: #f0fdf4; }
.opt.correct .bullet { border-color: #16a34a; background: #16a34a; color: #fff; }
.opt.wrongpick { border-color: #dc2626; background: #fef2f2; }
.opt.wrongpick .bullet { border-color: #dc2626; background: #dc2626; color: #fff; }
.opt .mark { flex: none; font-weight: 800; }

.fb { margin-top: 14px; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.7; }
.fb.good { background: #f0fdf4; border: 1px solid #bbf7d0; }
.fb.bad { background: #fef2f2; border: 1px solid #fecaca; }
.fb .fb-title { font-weight: 800; margin-bottom: 4px; }
.fb.good .fb-title { color: #15803d; }
.fb.bad .fb-title { color: #b91c1c; }
.fb .fb-note { margin-top: 6px; color: #b45309; font-size: 13px; background: #fffbeb; border-radius: 8px; padding: 6px 9px; }
.fb .fb-exp { margin-top: 8px; color: #374151; white-space: pre-wrap; }
.fb .fb-exp b { color: #2563eb; }
.fb .fb-exp .none { color: #9ca3af; }
.fb img { display: block; max-width: 100%; margin-top: 10px; border: 1px solid #e5e7eb; border-radius: 8px; }

/* ---------- bottom nav ---------- */
.bnav {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e5e7eb;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.bnav button {
  flex: 1; height: 44px; border-radius: 12px; border: 1.5px solid #d1d5db;
  background: #fff; font-size: 15px; font-weight: 600; color: #374151; cursor: pointer;
}
.bnav button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.bnav button:disabled { opacity: .4; cursor: default; }
.bnav button.ghost { flex: none; width: 44px; font-size: 17px; }

.posline { text-align: center; color: #9ca3af; font-size: 12px; margin: 12px 0 0; }

/* ---------- exam navigator ---------- */
.navgrid-wrap { padding: 4px 2px; }
.navgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.navgrid button {
  aspect-ratio: 1; border-radius: 10px; border: 1.5px solid #d1d5db; background: #fff;
  font-size: 13px; font-weight: 600; color: #475569; cursor: pointer;
}
.navgrid button.answered { background: #2563eb; border-color: #2563eb; color: #fff; }
.navgrid button.flagged { border-color: #f59e0b; box-shadow: inset 0 0 0 2px #f59e0b; }
.navgrid button.cur { outline: 2.5px solid #4f46e5; outline-offset: 1px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #6b7280; margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -1px; border: 1.5px solid #d1d5db; background: #fff; }
.legend i.on { background: #2563eb; border-color: #2563eb; }
.legend i.fl { border-color: #f59e0b; box-shadow: inset 0 0 0 2px #f59e0b; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 480px;
  max-height: 86vh; overflow: auto; padding: 18px;
}
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.modal .m-body { font-size: 14px; line-height: 1.7; color: #374151; }
.modal .m-btns { display: flex; gap: 10px; margin-top: 16px; }
.modal .m-btns button {
  flex: 1; height: 42px; border-radius: 10px; border: 1.5px solid #d1d5db;
  background: #fff; font-size: 15px; font-weight: 600; color: #374151; cursor: pointer;
}
.modal .m-btns button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.modal .m-btns button.danger { background: #dc2626; border-color: #dc2626; color: #fff; }

.seg { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 84px; height: 40px; border-radius: 10px; border: 1.5px solid #d1d5db;
  background: #fff; font-size: 14px; font-weight: 600; color: #374151; cursor: pointer;
}
.seg button.on { border-color: #2563eb; background: #eff6ff; color: #2563eb; }

/* ---------- result ---------- */
.result-hero {
  background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
  border-radius: 16px; text-align: center; padding: 26px 16px;
}
.result-hero .score { font-size: 52px; font-weight: 800; line-height: 1; }
.result-hero .score small { font-size: 18px; font-weight: 600; opacity: .8; }
.result-hero .verdict { margin-top: 10px; font-size: 15px; font-weight: 700; }
.result-hero .verdict.pass { color: #a7f3d0; }
.result-hero .verdict.fail { color: #fecaca; }
.rstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.rstats .cell { background: #fff; border-radius: 12px; padding: 12px 6px; text-align: center; }
.rstats .cell b { display: block; font-size: 17px; }
.rstats .cell span { font-size: 12px; color: #6b7280; }

/* ---------- wrong book list ---------- */
.witem {
  background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.witem .wmain { flex: 1; min-width: 0; }
.witem .wstem { font-size: 14px; line-height: 1.55; color: #1f2937; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.witem .wmeta { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.witem .del {
  flex: none; border: none; background: #fef2f2; color: #dc2626; width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 15px;
}
.empty { text-align: center; color: #9ca3af; padding: 60px 20px; font-size: 15px; }
.empty .big { font-size: 44px; margin-bottom: 12px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; top: 18px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99; pointer-events: none; }
.toast {
  background: rgba(15, 23, 42, .88); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; animation: tin .18s ease;
}
.toast.good { background: rgba(22, 163, 74, .92); }
.toast.bad { background: rgba(220, 38, 38, .92); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .navgrid { grid-template-columns: repeat(7, 1fr); }
  .hero .nums { gap: 18px; }
}

/* ---------- 设置 / 同步 ---------- */
.gear {
  width: 30px; height: 30px; border: none; background: #f3f4f6;
  border-radius: 50%; font-size: 15px; cursor: pointer; line-height: 1;
}
.gear:active { background: #e5e7eb; }
.sync-tip {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.8; color: #1e40af;
}
.sync-lab { font-weight: 700; font-size: 14px; margin-top: 14px; color: #1f2937; }
textarea.sync-ta {
  width: 100%; min-height: 88px; border: 1.5px solid #d1d5db; border-radius: 10px;
  padding: 8px 10px; font-size: 12px; font-family: ui-monospace, Consolas, monospace;
  color: #374151; resize: vertical; margin-top: 6px; word-break: break-all; background: #fafafa;
}
textarea.sync-ta:focus { outline: none; border-color: #93c5fd; }
.sync-btn {
  margin-top: 8px; width: 100%; height: 38px; border-radius: 10px;
  border: 1.5px solid #2563eb; background: #eff6ff; color: #2563eb;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.sync-btn:active { background: #dbeafe; }

/* ---------- 电脑端适配 ---------- */
@media (min-width: 820px) {
  body { font-size: 16px; }
  #app { max-width: 900px; }
  .main { padding: 22px 20px 40px; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .tile { padding: 18px 18px; }
  .tile:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.10); }
  .qcard { padding: 22px 28px; }
  .stem { font-size: 16.5px; line-height: 1.9; }
  .opt { padding: 13px 16px; }
  .opt.tappable:hover { border-color: #93c5fd; background: #f8fbff; }
  .card { padding: 18px 22px; }
  .hero { padding: 24px 24px; }
  .rstats { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .witem:hover { box-shadow: 0 4px 12px rgba(0,0,0,.10); }
}
@media (hover: none) {
  .tile:hover, .witem:hover { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
}

/* ---------- 访问口令锁 ---------- */
.lockwrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
}
.lockcard {
  background: #fff; border-radius: 18px; padding: 30px 26px;
  width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .3);
}
.lockico { font-size: 42px; }
.locktitle { font-size: 18px; font-weight: 800; margin-top: 8px; }
.locksub { font-size: 13px; color: #6b7280; margin-top: 6px; line-height: 1.6; }
.lockinput {
  width: 100%; height: 44px; border: 1.5px solid #d1d5db; border-radius: 12px;
  padding: 0 14px; font-size: 15px; margin-top: 16px; text-align: center;
  letter-spacing: 2px;
}
.lockinput:focus { outline: none; border-color: #2563eb; }
.lockbtn {
  width: 100%; height: 44px; margin-top: 12px; border-radius: 12px;
  border: none; background: #2563eb; color: #fff; font-size: 15px;
  font-weight: 700; cursor: pointer;
}
.lockbtn:active { background: #1d4ed8; }
.lockhint { font-size: 12px; color: #9ca3af; margin-top: 14px; }
