:root{
  color-scheme: light;
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --primary:#2563eb;
  --primary-weak:#dbeafe;
  --border:#e5e7eb;
  --ok:#16a34a;
  --bad:#dc2626;
  --warn:#f59e0b;
  --shadow:0 12px 28px rgba(15,23,42,.08);
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans SC","PingFang SC","Microsoft YaHei",Arial,sans-serif;color:var(--text)}
body{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
button,input,select{font:inherit}
button{border:0;border-radius:14px;background:var(--primary);color:white;padding:12px 16px;font-weight:700;cursor:pointer;min-height:44px;touch-action:manipulation}
button:disabled{opacity:.45;cursor:not-allowed}
button.secondary{background:#eef2ff;color:#1f2937}
button.ghost{background:#eef2ff;color:#1f2937}
.hidden{display:none!important}
.shell{max-width:980px;margin:0 auto;padding:14px 14px 32px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:6px 0 14px}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.logo{width:46px;height:46px;border-radius:16px;background:linear-gradient(135deg,#2563eb,#7c3aed);display:grid;place-items:center;color:#fff;font-weight:900;font-size:24px;box-shadow:var(--shadow)}
h1{font-size:20px;line-height:1.15;margin:0}
.brand p{margin:4px 0 0;color:var(--muted);font-size:13px}
.card{background:var(--card);border:1px solid var(--border);border-radius:24px;padding:18px;box-shadow:var(--shadow);margin-bottom:14px}
.auth-card{margin-top:28px}
.auth-card h2{margin:0 0 8px}
.muted{color:var(--muted);line-height:1.65}
.auth-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}
.panel{border:1px solid var(--border);border-radius:18px;padding:16px;background:#fbfdff}
.panel h3{margin:0 0 12px}
label{display:block;color:#374151;font-size:14px;font-weight:700}
input,select{width:100%;margin-top:7px;border:1px solid var(--border);border-radius:14px;background:white;color:var(--text);padding:12px 13px;min-height:46px;outline:none}
input:focus,select:focus{border-color:var(--primary);box-shadow:0 0 0 4px var(--primary-weak)}
.panel button{width:100%;margin-top:14px}
.message{min-height:24px;margin-top:12px;color:var(--bad);font-weight:700}
.controls{display:grid;gap:12px}
.select-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mode-row{display:flex;gap:8px;overflow:auto;padding-bottom:2px}
.mode{background:#eef2ff;color:#374151;white-space:nowrap}
.mode.active{background:var(--primary);color:white}
.stats{display:flex;gap:8px;flex-wrap:wrap;color:#374151;font-size:13px}
.stats span{background:#f3f4f6;border-radius:999px;padding:6px 10px}
.quiz-card{min-height:360px}
.question-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.meta{color:var(--muted);font-size:13px;margin-bottom:8px}
#questionStem{font-size:21px;line-height:1.55;margin:0 0 14px;white-space:pre-wrap}
.favorite{font-size:28px;line-height:1;background:#fff7ed;color:#b45309;width:50px;height:50px;padding:0;flex:0 0 auto;border:1px solid #fed7aa}
.favorite.on{background:#fef3c7;color:#d97706}
.options{display:grid;gap:10px;margin-top:12px}
.option{width:100%;text-align:left;background:#f9fafb;color:#1f2937;border:1px solid var(--border);display:flex;align-items:flex-start;gap:10px;line-height:1.55;font-weight:600}
.option .letter{display:inline-grid;place-items:center;flex:0 0 auto;width:30px;height:30px;border-radius:999px;background:#e5e7eb;font-weight:900}
.option.selected{border-color:var(--primary);background:var(--primary-weak)}
.option.correct{border-color:#86efac;background:#dcfce7}
.option.wrong{border-color:#fca5a5;background:#fee2e2}
.result{border-radius:18px;padding:14px;margin-top:14px;border:1px solid var(--border);line-height:1.7}
.result.ok{background:#f0fdf4;border-color:#bbf7d0;color:#14532d}
.result.bad{background:#fef2f2;border-color:#fecaca;color:#7f1d1d}
.nav-row{display:grid;grid-template-columns:1fr 1.1fr 1fr;gap:10px;margin-top:16px}
.answer-section h2{margin:0}
.section-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:12px}
.legend{font-size:12px;color:var(--muted);display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:#d1d5db}.dot.ok{background:var(--ok)}.dot.bad{background:var(--bad)}.dot.fav{background:var(--warn)}
.answer-card{display:grid;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:8px}
.answer-card button{min-height:42px;padding:0;border-radius:12px;background:#f3f4f6;color:#374151;border:1px solid var(--border);font-weight:800}
.answer-card button.correct{background:#dcfce7;color:#166534;border-color:#86efac}
.answer-card button.wrong{background:#fee2e2;color:#991b1b;border-color:#fca5a5}
.answer-card button.favorite{box-shadow:inset 0 0 0 2px #f59e0b}
.answer-card button.current{outline:3px solid var(--primary);outline-offset:1px}
.empty{text-align:center;padding:28px}
@media (max-width:720px){
  .shell{padding:10px 10px 24px}.topbar{align-items:flex-start}.auth-grid,.select-row{grid-template-columns:1fr}.card{border-radius:20px;padding:14px}.quiz-card{min-height:auto}#questionStem{font-size:18px}.nav-row{grid-template-columns:1fr;}.section-head{display:block}.legend{justify-content:flex-start;margin-top:8px}.topbar h1{font-size:17px}.logo{width:40px;height:40px;border-radius:14px}.mode-row button{padding:10px 13px}.answer-card{grid-template-columns:repeat(6,1fr)}
}
@media (max-width:390px){.answer-card{grid-template-columns:repeat(5,1fr)}button{padding:11px 12px}.option{padding:11px}}
