:root{
  color-scheme: light;
  --bg:#f6f7f4;
  --surface:#ffffff;
  --surface-2:#eef6f4;
  --text:#16201f;
  --muted:#687371;
  --line:#d7dfdc;
  --primary:#0f766e;
  --primary-2:#115e59;
  --accent:#d97706;
  --accent-2:#4338ca;
  --bad:#b42318;
  --bad-bg:#fff1f0;
  --good:#087443;
  --good-bg:#ecfdf3;
  --shadow:0 12px 28px rgba(17, 24, 39, .08);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*{box-sizing:border-box}
body{
  margin:0;
  min-height:100vh;
  background:var(--bg);
  color:var(--text);
}
button,input,select{font:inherit}
button{cursor:pointer}
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px clamp(16px, 4vw, 36px);
  background:rgba(246,247,244,.92);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(14px);
}
.topbar h1,.subject-strip h2,.section-head h2{margin:0;line-height:1.15}
.topbar h1{font-size:26px}
.eyebrow{
  color:var(--primary-2);
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
}
.top-actions{display:flex;gap:8px}
.icon-btn{
  width:42px;
  height:42px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  box-shadow:0 1px 0 rgba(0,0,0,.03);
}
main{
  width:min(1160px, 100%);
  margin:0 auto;
  padding:20px clamp(14px, 4vw, 28px) 44px;
}
.hidden{display:none!important}
.view{display:block}
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:16px;
  margin:10px 0 18px;
}
.section-head p{margin:8px 0 0;color:var(--muted)}
.subject-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:14px;
}
.subject-card{
  min-height:192px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  padding:18px;
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:18px;
}
.subject-card h3{margin:0;font-size:23px}
.subject-card p{margin:8px 0 0;color:var(--muted);line-height:1.55}
.subject-meta{display:flex;flex-wrap:wrap;gap:8px}
.pill{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:4px 9px;
  border-radius:999px;
  background:var(--surface-2);
  color:var(--primary-2);
  border:1px solid #c7e4df;
  font-size:13px;
  font-weight:700;
}
.subject-strip{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin:8px 0 16px;
}
.stats-grid{
  display:grid;
  grid-template-columns:repeat(5,minmax(110px,1fr));
  gap:10px;
  margin-bottom:14px;
}
.stat{
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  padding:12px;
}
.stat span{display:block;color:var(--muted);font-size:12px}
.stat b{display:block;margin-top:4px;font-size:22px;line-height:1.1}
.panel,.question-card,.result-card{
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
  box-shadow:var(--shadow);
}
.panel{padding:14px;margin-bottom:14px}
.filters{
  display:grid;
  grid-template-columns:1.35fr 1fr .8fr .8fr .8fr 1.4fr;
  gap:10px;
}
label span{
  display:block;
  margin-bottom:5px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
select,input[type="search"],input[type="number"]{
  width:100%;
  min-height:42px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  padding:8px 10px;
}
.type-row,.command-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}
.type-row label{
  display:flex;
  align-items:center;
  gap:7px;
  min-height:36px;
  padding:7px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fbfcfb;
}
button.primary,button.secondary,button.danger{
  min-height:42px;
  border-radius:8px;
  padding:9px 14px;
  border:1px solid transparent;
  font-weight:700;
}
button.primary{background:var(--primary);color:#fff}
button.primary:hover{background:var(--primary-2)}
button.secondary{background:#fff;color:var(--primary-2);border-color:#9ccfc8}
button.danger{background:var(--bad);color:#fff}
button.ghost{background:#fff;color:var(--bad);border-color:#f0aaa4}
.filter-info{margin-top:10px;color:var(--muted);font-size:14px}
.quiz-area{min-height:220px}
.empty{
  padding:24px;
  color:var(--muted);
}
.question-card{padding:16px}
.question-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
}
.question-meta{display:flex;flex-wrap:wrap;gap:7px}
.question-index{color:var(--muted);font-weight:700}
.question-title{
  margin:12px 0 14px;
  font-size:20px;
  line-height:1.55;
}
.options{display:grid;gap:10px}
.option{
  display:grid;
  grid-template-columns:36px 1fr;
  gap:10px;
  align-items:start;
  width:100%;
  min-height:48px;
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px;
  background:#fff;
  text-align:left;
}
.option:hover{border-color:#8bc8c0;background:#f8fcfb}
.option .letter{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--surface-2);
  font-weight:800;
  color:var(--primary-2);
}
.option.selected{border-color:var(--accent-2);background:#f3f3ff}
.option.correct{border-color:var(--good);background:var(--good-bg)}
.option.wrong{border-color:var(--bad);background:var(--bad-bg)}
.feedback{
  margin-top:14px;
  padding:12px;
  border-radius:8px;
  background:var(--surface-2);
  border:1px solid #c7e4df;
  line-height:1.6;
}
.feedback.good{background:var(--good-bg);border-color:#97d7b8}
.feedback.bad{background:var(--bad-bg);border-color:#f0aaa4}
.quiz-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  gap:10px;
  margin-top:14px;
}
.left-actions,.right-actions{display:flex;flex-wrap:wrap;gap:8px}
.fav-active{border-color:#f0b84f!important;color:#8a5200!important;background:#fff8e8!important}
.result-card{padding:18px}
.result-card h3{margin:0 0 10px}
.wrong-list{display:grid;gap:10px;margin-top:12px}
.wrong-item{padding:12px;border:1px solid var(--line);border-radius:8px;background:#fff}
.wrong-item b{display:block;margin-bottom:6px}
.toast{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%);
  z-index:50;
  max-width:min(92vw,520px);
  padding:11px 14px;
  border-radius:8px;
  background:#16201f;
  color:#fff;
  box-shadow:var(--shadow);
}
@media (max-width: 860px){
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .filters{grid-template-columns:1fr 1fr}
  .search-field{grid-column:1/-1}
}
@media (max-width: 560px){
  .topbar{padding:13px 14px}
  .topbar h1{font-size:22px}
  main{padding:16px 12px 34px}
  .subject-strip,.question-top{align-items:stretch;flex-direction:column}
  .stats-grid{grid-template-columns:1fr 1fr}
  .filters{grid-template-columns:1fr}
  .command-row button{flex:1 1 130px}
  .question-title{font-size:18px}
  .option{grid-template-columns:32px 1fr}
}
