/* =========================================================
   供电刷题 · design system
   ========================================================= */
:root {
  --sidebar-w: 260px;
  --bg: #f3f5fb;
  --bg-2: #eef1f9;
  --surface: #ffffff;
  --surface-2: #f4f6fc;
  --surface-3: #e9edf6;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #4f46e5;
  --primary-2: #8b5cf6;
  --primary-soft: #eef0ff;
  --primary-text: #4338ca;
  --accent: #f59e0b;
  --accent-soft: #fff7e6;
  --accent-text: #b45309;
  --success: #12b76a;
  --success-soft: #ecfdf3;
  --success-border: #abefc6;
  --success-text: #067647;
  --danger: #f04438;
  --danger-soft: #fef3f2;
  --danger-border: #fecdca;
  --danger-text: #b42318;
  --warning: #f79009;
  --warning-soft: #fffaeb;
  --warning-border: #fedf89;
  --warning-text: #b54708;
  --teal: #0ea5a4;
  --teal-soft: #e6fffb;
  --teal-text: #0f766e;
  --violet-soft: #f4f0ff;
  --violet-text: #6d28d9;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px -8px rgba(16, 24, 40, .12), 0 4px 10px -4px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, .22);
  --radius: 20px;
  --q-size: 21px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-2: #0e1426;
  --surface: #141b2f;
  --surface-2: #1a2340;
  --surface-3: #243052;
  --text: #eef2ff;
  --text-2: #d5dcf0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: #26304d;
  --border-strong: #33405f;
  --primary: #818cf8;
  --primary-2: #a78bfa;
  --primary-soft: rgba(129, 140, 248, .14);
  --primary-text: #c7d2fe;
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, .12);
  --accent-text: #fcd34d;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, .12);
  --success-border: rgba(74, 222, 128, .3);
  --success-text: #86efac;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .12);
  --danger-border: rgba(251, 113, 133, .3);
  --danger-text: #fda4af;
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .12);
  --warning-border: rgba(251, 191, 36, .3);
  --warning-text: #fcd34d;
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, .12);
  --teal-text: #99f6e4;
  --violet-soft: rgba(167, 139, 250, .14);
  --violet-text: #ddd6fe;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

[data-font="small"] { --q-size: 18px; }
[data-font="normal"] { --q-size: 21px; }
[data-font="large"] { --q-size: 24px; }

* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(99, 102, 241, .10), transparent 60%),
    radial-gradient(700px 360px at -10% 20%, rgba(14, 165, 164, .07), transparent 60%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(99, 102, 241, .20), transparent 60%),
    radial-gradient(700px 360px at -10% 20%, rgba(14, 165, 164, .12), transparent 60%);
}

::selection { background: rgba(99, 102, 241, .22); }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.filled { fill: currentColor; }

/* ============================ sidebar ============================ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  color: #cbd5e1;
  background:
    radial-gradient(420px 240px at 110% -5%, rgba(99, 102, 241, .38), transparent 70%),
    radial-gradient(360px 260px at -20% 100%, rgba(14, 165, 164, .18), transparent 70%),
    linear-gradient(180deg, #111827 0%, #0b1020 100%);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  text-decoration: none;
  color: #fff;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 8px 22px rgba(99, 102, 241, .42), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark .ic { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: .5px; }
.brand-text small { margin-top: 3px; font-size: 10.5px; color: #8b97ad; letter-spacing: .6px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  margin: 17px 12px 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #64748b;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: #a8b3c7;
  font-size: 13.5px;
  text-decoration: none;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item .ic { width: 19px; height: 19px; color: #7c89a3; transition: color .18s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:hover .ic { color: #c7d2fe; }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, .30), rgba(99, 102, 241, .08));
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .16);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #818cf8;
  box-shadow: 0 0 12px #818cf8;
}
.nav-item.active .ic { color: #c7d2fe; }
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #e0e7ff;
  background: rgba(99, 102, 241, .28);
}
.nav-badge.subtle { color: #94a3b8; background: rgba(255, 255, 255, .07); }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }

.goal-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
}
.goal-ring {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0);
  transition: background .4s;
}
.goal-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #111827; }
.goal-ring span { position: relative; z-index: 1; font-size: 10.5px; font-weight: 700; color: #fff; }
.goal-copy { display: flex; flex-direction: column; min-width: 0; }
.goal-copy strong { font-size: 12.5px; color: #fff; font-weight: 600; }
.goal-copy span { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.sidebar-foot { display: flex; align-items: center; gap: 6px; margin: 12px 6px 0; font-size: 10px; color: #64748b; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 12, 24, .55);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

/* ============================ shell / topbar ============================ */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 76px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(243, 245, 251, .82);
  backdrop-filter: blur(16px) saturate(1.2);
}
[data-theme="dark"] .topbar { background: rgba(10, 15, 30, .82); }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin-top: 1px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.streak-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 11px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.streak-pill .ic { width: 15px; height: 15px; }
.streak-pill small { font-size: 10.5px; font-weight: 500; opacity: .8; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.96); }
.menu-btn { display: none; }

.view {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px 80px;
  flex: 1;
}
.view:focus { outline: none; }
.view-anim > * { animation: fadeUp .42s cubic-bezier(.2, .8, .2, 1) both; }
.view-anim > *:nth-child(2) { animation-delay: .04s; }
.view-anim > *:nth-child(3) { animation-delay: .08s; }
.view-anim > *:nth-child(4) { animation-delay: .12s; }
.view-anim > *:nth-child(5) { animation-delay: .16s; }
.view-anim > *:nth-child(6) { animation-delay: .2s; }

/* ============================ primitives ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s, box-shadow .16s, background .16s, border-color .16s, opacity .16s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .65); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); box-shadow: 0 12px 24px -8px rgba(79, 70, 229, .65); }
.btn-white { background: #fff; color: #3730a3; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .4); }
.btn-white:hover { background: #f5f3ff; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 75%, var(--primary) 8%); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-ghost-danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.btn-lg { height: 50px; padding: 0 24px; border-radius: 14px; font-size: 15px; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-icon-only { width: 42px; padding: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge-single { color: var(--primary-text); background: var(--primary-soft); }
.badge-multiple { color: var(--violet-text); background: var(--violet-soft); }
.badge-judge { color: var(--teal-text); background: var(--teal-soft); }
.badge-fill { color: var(--accent-text); background: var(--accent-soft); }
.badge-neutral { color: var(--muted); background: var(--surface-2); }
.badge-success { color: var(--success-text); background: var(--success-soft); }
.badge-danger { color: var(--danger-text); background: var(--danger-soft); }
.badge-warning { color: var(--warning-text); background: var(--warning-soft); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
.section-head h2 { font-size: 17.5px; font-weight: 700; letter-spacing: .2px; }
.section-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.section-head .link { font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.section-head .link:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.hide-sm { display: grid; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ============================ home ============================ */
.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  padding: 32px 36px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(800px 300px at 92% -30%, rgba(255, 255, 255, .24), transparent 62%),
    linear-gradient(135deg, #4338ca 0%, #5b4be0 46%, #7c3aed 100%);
  box-shadow: 0 28px 60px -28px rgba(67, 56, 202, .62);
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: linear-gradient(120deg, transparent 25%, #000 100%);
  opacity: .5;
}
.home-hero::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -130px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 55px solid rgba(255, 255, 255, .07);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .3px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
}
.hero-eyebrow .ic { width: 14px; height: 14px; }
.hero-copy h2 { margin: 16px 0 10px; font-size: 30px; line-height: 1.3; letter-spacing: .3px; }
.hero-copy h2 em { font-style: normal; color: #fde68a; }
.hero-copy p { max-width: 560px; font-size: 13px; line-height: 1.8; color: rgba(255, 255, 255, .78); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 20px; font-size: 11.5px; color: rgba(255, 255, 255, .66); }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta .ic { width: 14px; height: 14px; }
.hero-side { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-width: 176px; }
.hero-ring {
  width: 138px;
  height: 138px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(#fde68a calc(var(--p) * 1%), rgba(255, 255, 255, .18) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.hero-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: rgba(52, 40, 150, .72); backdrop-filter: blur(8px); }
.hero-ring-in { position: relative; z-index: 1; text-align: center; line-height: 1.15; }
.hero-ring-in strong { display: block; font-size: 30px; letter-spacing: -.5px; }
.hero-ring-in span { display: block; margin-top: 2px; font-size: 10.5px; color: rgba(255, 255, 255, .7); }
.hero-side-note { font-size: 11.5px; color: rgba(255, 255, 255, .72); text-align: center; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-icon .ic { width: 20px; height: 20px; }
.stat-copy { min-width: 0; }
.stat-copy strong { display: block; font-size: 23px; line-height: 1.1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-copy span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.stat-copy small { font-size: 10px; color: var(--muted-2); }

.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.type-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 19px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.type-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -34px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--tc-soft);
  opacity: .55;
  pointer-events: none;
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--tc); }
.type-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.type-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tc-soft); color: var(--tc-text); }
.type-icon .ic { width: 21px; height: 21px; }
.type-arrow { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted-2); background: var(--surface-2); transition: background .2s, color .2s, transform .2s; }
.type-arrow .ic { width: 15px; height: 15px; }
.type-card:hover .type-arrow { background: var(--tc); color: #fff; transform: translateX(2px); }
.type-name { font-size: 14px; font-weight: 600; }
.type-count { font-size: 27px; font-weight: 800; line-height: 1; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.type-count small { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.type-progress { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.type-progress i { display: block; height: 100%; border-radius: 99px; background: var(--tc); transition: width .5s; }
.type-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.t-single { --tc: var(--primary); --tc-soft: var(--primary-soft); --tc-text: var(--primary-text); }
.t-multiple { --tc: #8b5cf6; --tc-soft: var(--violet-soft); --tc-text: var(--violet-text); }
.t-judge { --tc: #0ea5a4; --tc-soft: var(--teal-soft); --tc-text: var(--teal-text); }
.t-fill { --tc: #f59e0b; --tc-soft: var(--accent-soft); --tc-text: var(--accent-text); }

.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.quick-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.quick-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.quick-icon .ic { width: 19px; height: 19px; }
.quick-copy { min-width: 0; }
.quick-copy strong { display: block; font-size: 13px; font-weight: 600; }
.quick-copy span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-card > .ic { margin-left: auto; width: 16px; height: 16px; color: var(--muted-2); flex: none; }

.dash-lower { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.chart-card, .exam-recent { padding: 20px 22px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-head h3 { font-size: 14.5px; }
.chart-head p { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; margin-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-track { width: 100%; max-width: 38px; height: 100%; display: flex; align-items: flex-end; border-radius: 7px; background: linear-gradient(180deg, transparent, var(--surface-2)); }
.bar-fill { width: 100%; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); min-height: 4px; transition: height .6s cubic-bezier(.2, .8, .2, 1); opacity: .86; }
.bar-col.today .bar-fill { background: linear-gradient(180deg, #fbbf24, #f59e0b); opacity: 1; box-shadow: 0 6px 16px -6px rgba(245, 158, 11, .7); }
.bar-label { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.bar-val { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

.exam-recent-list { display: flex; flex-direction: column; margin-top: 12px; }
.exam-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); text-decoration: none; color: var(--text); }
.exam-row:last-child { border-bottom: 0; }
.exam-score { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 14px; font-weight: 800; background: var(--surface-2); color: var(--text-2); flex: none; }
.exam-score.pass { background: var(--success-soft); color: var(--success-text); }
.exam-score.fail { background: var(--danger-soft); color: var(--danger-text); }
.exam-row-copy { min-width: 0; flex: 1; }
.exam-row-copy strong { display: block; font-size: 12.5px; font-weight: 600; }
.exam-row-copy span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.exam-row > .ic { color: var(--muted-2); width: 16px; height: 16px; }

/* ============================ practice ============================ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.page-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.practice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.practice-main { min-width: 0; }
.practice-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.practice-bar .progress { flex: 1; }
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .35s; }
.practice-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.qcard { padding: 28px 32px 26px; position: relative; }
.qcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.q-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.q-num { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.q-tools { display: flex; align-items: center; gap: 2px; }
.q-tools .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.q-tools .icon-btn.active { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.q-tools .icon-btn.active.fav { color: var(--accent-text); }
.q-text {
  font-size: var(--q-size);
  line-height: 1.85;
  font-weight: 600;
  letter-spacing: .15px;
  color: var(--text);
  word-break: break-word;
  margin-bottom: 24px;
}
.q-text .blank {
  display: inline-block;
  min-width: 2.6em;
  height: 1.02em;
  margin: 0 3px;
  vertical-align: -.1em;
  border-bottom: 2px dashed var(--primary);
  background: linear-gradient(180deg, transparent 62%, var(--primary-soft) 62%);
  border-radius: 2px;
}
.q-meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: 11px; color: var(--muted-2); }
.q-meta-line span { display: inline-flex; align-items: center; gap: 4px; }
.q-meta-line .ic { width: 13px; height: 13px; }

.options { display: flex; flex-direction: column; gap: 11px; }
.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 15px 17px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 15px;
  line-height: 1.6;
  transition: border-color .16s, background .16s, transform .16s, box-shadow .16s;
}
.option:hover:not(.locked) { border-color: var(--primary); background: var(--primary-soft); transform: translateX(2px); }
.option-key {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  transition: all .16s;
}
.option.multi .option-key { border-radius: 9px; }
.option-text { flex: 1; padding-top: 2px; min-width: 0; word-break: break-word; }
.option-mark { margin-left: auto; padding-top: 3px; color: transparent; }
.option-mark .ic { width: 20px; height: 20px; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(79, 70, 229, .08); }
.option.selected .option-key { background: var(--primary); border-color: var(--primary); color: #fff; }
.option.selected .option-mark { color: var(--primary); }
.option.correct { border-color: var(--success); background: var(--success-soft); box-shadow: none; }
.option.correct .option-key { background: var(--success); border-color: var(--success); color: #fff; }
.option.correct .option-mark { color: var(--success); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.wrong .option-key { background: var(--danger); border-color: var(--danger); color: #fff; }
.option.wrong .option-mark { color: var(--danger); }
.option.locked { cursor: default; }
.option.dim { opacity: .55; }
.option.locked:hover { transform: none; }

.judge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.judge-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 120px;
  padding: 18px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  transition: all .16s;
}
.judge-btn .judge-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); transition: all .16s; }
.judge-btn .judge-ico .ic { width: 21px; height: 21px; }
.judge-btn:hover:not(.locked) { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.judge-btn.selected { border-color: var(--primary); background: var(--primary-soft); }
.judge-btn.selected .judge-ico { background: var(--primary); color: #fff; }
.judge-btn.correct { border-color: var(--success); background: var(--success-soft); }
.judge-btn.correct .judge-ico { background: var(--success); color: #fff; }
.judge-btn.wrong { border-color: var(--danger); background: var(--danger-soft); }
.judge-btn.wrong .judge-ico { background: var(--danger); color: #fff; }
.judge-btn.locked { cursor: default; }
.judge-key { font-size: 10.5px; color: var(--muted-2); font-weight: 500; }

.fill-box { margin-top: 2px; }
.fill-label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.fill-input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.fill-input::placeholder { color: var(--muted-2); }
.fill-input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px rgba(79, 70, 229, .1); }
.fill-input:disabled { opacity: .7; }
.fill-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.fill-hint { font-size: 11.5px; color: var(--muted-2); }

.feedback { margin-top: 20px; padding: 16px 18px; border-radius: 15px; border: 1px solid transparent; animation: fadeUp .3s ease both; }
.fb-correct { background: var(--success-soft); border-color: var(--success-border); }
.fb-wrong { background: var(--danger-soft); border-color: var(--danger-border); }
.fb-neutral { background: var(--warning-soft); border-color: var(--warning-border); }
.fb-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.fb-head .ic { width: 22px; height: 22px; }
.fb-correct .fb-head { color: var(--success-text); }
.fb-wrong .fb-head { color: var(--danger-text); }
.fb-neutral .fb-head { color: var(--warning-text); }
.fb-head strong { font-size: 15px; }
.fb-head .badge { margin-left: 2px; }
.fb-body { margin-top: 10px; font-size: 13px; color: var(--text-2); line-height: 1.8; }
.fb-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 5px; }
.fb-line b { font-weight: 600; color: var(--text); }
.answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 2px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.fb-correct .answer-chip { border-color: var(--success-border); }
.fb-wrong .answer-chip { border-color: var(--danger-border); }
.fb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.answer-box {
  margin-top: 8px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.answer-box .label { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }

.practice-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.practice-actions-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.keyboard-hint { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 10.5px; color: var(--muted-2); flex-wrap: wrap; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.sheet { padding: 18px; position: sticky; top: 96px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sheet-head h3 { font-size: 14px; }
.sheet-head .icon-btn { width: 30px; height: 30px; }
.sheet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 13px; }
.sheet-stat { padding: 7px 4px; border-radius: 9px; background: var(--surface-2); text-align: center; }
.sheet-stat strong { display: block; font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sheet-stat span { display: block; font-size: 9.5px; color: var(--muted); }
.sheet-stat.c strong { color: var(--success-text); }
.sheet-stat.w strong { color: var(--danger-text); }
.sheet-stat.a strong { color: var(--primary-text); }
.sheet-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-height: 356px; overflow-y: auto; padding: 2px 3px 2px 1px; scrollbar-width: thin; }
.sheet-cell {
  position: relative;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: transform .12s, border-color .12s, background .12s;
}
.sheet-cell:hover { transform: translateY(-1px); border-color: var(--primary); }
.sheet-cell.is-current { outline: 2px solid var(--primary); outline-offset: 1px; color: var(--primary-text); background: var(--primary-soft); }
.sheet-cell.is-correct { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); }
.sheet-cell.is-wrong { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); }
.sheet-cell.is-answered { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary-text); }
.sheet-cell.is-marked::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.sheet-cell.is-pending { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning-text); }
.sheet-legend { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; font-size: 10px; color: var(--muted); }
.sheet-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); }
.legend-dot.c { background: var(--success); border-color: var(--success); }
.legend-dot.w { background: var(--danger); border-color: var(--danger); }
.legend-dot.a { background: var(--primary); border-color: var(--primary); }
.legend-dot.m { background: var(--accent); border-color: var(--accent); }

/* completion */
.finish-card { max-width: 680px; margin: 30px auto; padding: 38px; text-align: center; }
.finish-icon { width: 78px; height: 78px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 16px 34px -14px rgba(79, 70, 229, .7); }
.finish-icon .ic { width: 38px; height: 38px; }
.finish-card h2 { font-size: 25px; }
.finish-card > p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.finish-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 24px 0; }
.finish-stat { padding: 14px 8px; border-radius: 14px; background: var(--surface-2); }
.finish-stat strong { display: block; font-size: 22px; }
.finish-stat span { font-size: 11px; color: var(--muted); }
.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ============================ exam ============================ */
.exam-setup { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 18px; align-items: start; }
.setup-card { padding: 26px 28px; }
.setup-card h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.setup-card h3 .ic { color: var(--primary); }
.setup-card > p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.field { margin-top: 22px; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.field-label strong { font-size: 13px; font-weight: 600; }
.field-label span { font-size: 11px; color: var(--muted); }
.seg-row { display: flex; flex-wrap: wrap; gap: 7px; }
.seg {
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .15s;
}
.seg:hover { border-color: var(--border-strong); }
.seg.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.type-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.type-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: all .15s;
}
.type-check:hover { border-color: var(--border-strong); }
.type-check.active { border-color: var(--primary); background: var(--primary-soft); }
.type-check-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.type-check.active .type-check-icon { background: var(--primary); color: #fff; }
.type-check-icon .ic { width: 17px; height: 17px; }
.type-check-copy { min-width: 0; }
.type-check-copy strong { display: block; font-size: 12.5px; }
.type-check-copy span { display: block; font-size: 10.5px; color: var(--muted); }
.type-check > .check-mark { margin-left: auto; color: transparent; }
.type-check.active > .check-mark { color: var(--primary); }
.type-check > .check-mark .ic { width: 17px; height: 17px; }

.setup-summary { padding: 24px; position: sticky; top: 96px; background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%); }
.setup-summary h3 { font-size: 15px; }
.summary-list { margin: 16px 0 20px; display: flex; flex-direction: column; gap: 12px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.summary-row span { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.summary-row span .ic { width: 15px; height: 15px; }
.summary-row strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-note { padding: 11px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; line-height: 1.7; display: flex; gap: 7px; margin-bottom: 14px; }
.summary-note .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.exam-topbar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; }
.exam-timer { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .5px; color: var(--text); font-variant-numeric: tabular-nums; }
.exam-timer .ic { width: 19px; height: 19px; color: var(--muted); }
.exam-timer.warning { color: var(--danger); animation: pulse 1.2s infinite; }
.exam-topbar .progress { flex: 1; }
.exam-topbar .practice-count { font-size: 11.5px; }
.exam-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.exam-actions-right { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* ============================ result ============================ */
.result-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 34px;
  align-items: center;
  padding: 32px 36px;
  border-radius: 24px;
  background:
    radial-gradient(500px 260px at 100% 0%, var(--primary-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.score-ring {
  width: 178px;
  height: 178px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--ring-color, var(--primary)) calc(var(--score) * 1%), var(--surface-3) 0);
  transition: background .8s;
}
.score-ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.score-ring-in { position: relative; z-index: 1; text-align: center; line-height: 1.1; }
.score-ring-in strong { display: block; font-size: 44px; font-weight: 800; letter-spacing: -1.5px; color: var(--ring-color, var(--primary)); font-variant-numeric: tabular-nums; }
.score-ring-in span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.result-copy h2 { font-size: 27px; letter-spacing: .2px; }
.result-copy h2 .badge { vertical-align: 4px; margin-left: 8px; }
.result-copy > p { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.result-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
.result-mini div { padding: 10px 12px; border-radius: 11px; background: var(--surface-2); }
.result-mini strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.result-mini span { font-size: 10.5px; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.result-panel { padding: 22px 24px; }
.result-panel h3 { font-size: 15px; display: flex; align-items: center; gap: 7px; }
.result-panel h3 .ic { color: var(--primary); }
.type-stat-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.type-stat { display: grid; grid-template-columns: 70px 1fr 70px; gap: 10px; align-items: center; font-size: 12px; }
.type-stat .ts-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.type-stat .ts-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.type-stat strong { text-align: right; font-variant-numeric: tabular-nums; }
.result-wrong-list { display: flex; flex-direction: column; margin-top: 12px; }
.result-wrong {
  display: flex;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
  text-align: left;
  background: none;
  border-left: 0; border-right: 0; border-top: 0;
  color: var(--text);
}
.result-wrong:last-child { border-bottom: 0; }
.result-wrong-num { width: 26px; height: 26px; border-radius: 8px; background: var(--danger-soft); color: var(--danger-text); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none; }
.result-wrong-copy { min-width: 0; flex: 1; }
.result-wrong-copy strong { display: block; font-size: 12px; font-weight: 500; line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.result-wrong-copy span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.empty-mini { padding: 26px 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ============================ library / filters ============================ */
.library-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.library-head h2 { font-size: 22px; }
.library-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; margin-bottom: 14px; }
.search-field { position: relative; flex: 1 1 240px; min-width: 200px; }
.search-field .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.search-field input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-field input::placeholder { color: var(--muted-2); }
.search-field input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.search-clear:hover { background: var(--surface-3); }
.search-clear .ic { width: 14px; height: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.select {
  height: 36px;
  padding: 0 30px 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--text-2);
  font-size: 11.5px;
  outline: none;
  appearance: none;
  cursor: pointer;
}
[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }

.qlist { overflow: hidden; }
.qitem {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: background .15s;
}
.qitem:last-child { border-bottom: 0; }
.qitem:hover { background: var(--surface-2); }
.qitem-id { width: 44px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.qitem-main { min-width: 0; }
.qitem-title { font-size: 13px; font-weight: 500; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qitem-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.qitem-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.qitem-side { display: flex; align-items: center; gap: 5px; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 600; }
.status-pill .ic { width: 11px; height: 11px; }
.status-correct { background: var(--success-soft); color: var(--success-text); }
.status-wrong { background: var(--danger-soft); color: var(--danger-text); }
.status-none { background: var(--surface-2); color: var(--muted); }
.status-fav { background: var(--accent-soft); color: var(--accent-text); }
.qitem-side .icon-btn { width: 32px; height: 32px; }
.qitem-side .icon-btn.active { color: var(--accent-text); background: var(--accent-soft); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.page-btn { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; pointer-events: none; }
.page-info { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* ============================ stats ============================ */
.stats-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-panel { padding: 18px 20px; }
.stat-panel .sp-label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat-panel .sp-label .ic { width: 14px; height: 14px; }
.stat-panel .sp-value { margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.stat-panel .sp-sub { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.stats-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 14px; margin-top: 14px; }
.stats-panel { padding: 22px 24px; }
.stats-panel h3 { font-size: 15px; display: flex; align-items: center; gap: 7px; }
.stats-panel h3 .ic { color: var(--primary); }
.mastery-wrap { display: flex; align-items: center; gap: 26px; margin-top: 18px; }
.mastery-ring {
  width: 146px;
  height: 146px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--success) calc(var(--m) * 1%), var(--surface-3) 0);
}
.mastery-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.mastery-ring div { position: relative; z-index: 1; text-align: center; line-height: 1.2; }
.mastery-ring strong { display: block; font-size: 27px; letter-spacing: -.5px; }
.mastery-ring span { font-size: 10.5px; color: var(--muted); }
.mastery-detail { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.mastery-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.mastery-row .legend-dot { width: 8px; height: 8px; }
.mastery-row span { color: var(--muted); }
.mastery-row strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.type-stat-list.big { gap: 16px; }
.type-stat.big { grid-template-columns: 80px 1fr 88px; }
.type-stat.big .ts-bar { height: 8px; }
.heat-grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; margin-top: 18px; }
.heat-cell { aspect-ratio: 1; border-radius: 4px; background: var(--surface-3); transition: transform .12s; }
.heat-cell:hover { transform: scale(1.12); }
.heat-cell.l1 { background: color-mix(in srgb, var(--primary) 25%, var(--surface)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--primary) 45%, var(--surface)); }
.heat-cell.l3 { background: color-mix(in srgb, var(--primary) 70%, var(--surface)); }
.heat-cell.l4 { background: var(--primary); }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 10px; font-size: 9.5px; color: var(--muted-2); }
.heat-legend .heat-cell { width: 11px; height: 11px; aspect-ratio: auto; }
.achievements { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.achievement { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); opacity: .48; }
.achievement.unlocked { opacity: 1; background: var(--surface); border-color: var(--success-border); }
.achievement-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.achievement.unlocked .achievement-icon { background: var(--accent-soft); color: var(--accent-text); }
.achievement-icon .ic { width: 18px; height: 18px; }
.achievement-copy strong { display: block; font-size: 11.5px; }
.achievement-copy span { display: block; font-size: 9.5px; color: var(--muted); }
.history-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.history-table th { text-align: left; font-size: 10.5px; font-weight: 500; color: var(--muted); padding: 0 8px 9px; border-bottom: 1px solid var(--border); }
.history-table td { padding: 10px 8px; border-bottom: 1px dashed var(--border); font-size: 12px; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table .score-cell { font-weight: 700; font-variant-numeric: tabular-nums; }
.history-table .pass { color: var(--success-text); }
.history-table .fail { color: var(--danger-text); }

/* ============================ settings ============================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.settings-card { padding: 22px 24px; }
.settings-card h3 { font-size: 15px; display: flex; align-items: center; gap: 7px; }
.settings-card h3 .ic { color: var(--primary); }
.settings-card > p { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-copy { min-width: 0; }
.setting-copy strong { display: block; font-size: 12.5px; font-weight: 600; }
.setting-copy span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.switch { width: 44px; height: 25px; border-radius: 999px; border: 0; padding: 0; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(19px); }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.seg-group { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg-opt { height: 29px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; }
.seg-opt.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: 0; background: var(--surface-2); color: var(--muted); font-size: 16px; }
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper span { min-width: 42px; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.about-box { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.about-box b { color: var(--text); font-weight: 600; }
.storage-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.storage-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.setting-note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; line-height: 1.7; display: flex; gap: 7px; }
.setting-note .ic { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* ============================ empty states ============================ */
.empty { padding: 54px 20px; text-align: center; }
.empty-icon { width: 66px; height: 66px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--border); }
.empty-icon .ic { width: 30px; height: 30px; }
.empty h3 { font-size: 16px; }
.empty p { margin: 5px auto 0; max-width: 380px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.empty .btn { margin-top: 16px; }

/* ============================ modal ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 12, 24, .56);
  backdrop-filter: blur(4px);
  animation: fadeIn .18s ease both;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .24s cubic-bezier(.2, .8, .2, 1) both;
  overflow: hidden;
}
.modal.wide { max-width: 780px; }
.modal.search-modal { max-width: 660px; align-self: flex-start; margin-top: 8vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex: none; }
.modal-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-head h3 .ic { color: var(--primary); width: 19px; height: 19px; }
.modal-head .icon-btn { width: 32px; height: 32px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); flex: none; }
.modal-foot .left { margin-right: auto; }

.confirm-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 14px; background: var(--danger-soft); color: var(--danger-text); }
.confirm-icon .ic { width: 25px; height: 25px; }
.confirm-title { font-size: 17px; }
.confirm-text { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.modal-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}
.modal-textarea:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.modal-note-hint { margin-top: 7px; font-size: 10.5px; color: var(--muted-2); }

.search-input-wrap { position: relative; }
.search-input-wrap .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted-2); }
.search-input-wrap input { width: 100%; height: 50px; padding: 0 42px 0 42px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; }
.search-input-wrap input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.search-results { margin-top: 12px; max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.search-result { display: flex; gap: 10px; align-items: flex-start; padding: 10px 11px; border-radius: 10px; border: 1px solid transparent; background: transparent; text-align: left; color: var(--text); }
.search-result:hover, .search-result.active { background: var(--surface-2); border-color: var(--border); }
.search-result-id { width: 34px; height: 24px; border-radius: 6px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; margin-top: 1px; }
.search-result-copy { min-width: 0; flex: 1; }
.search-result-copy strong { display: block; font-size: 12px; font-weight: 500; line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result-copy span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.search-result mark, .qitem-title mark { background: var(--accent-soft); color: var(--accent-text); border-radius: 3px; padding: 0 2px; }
.search-empty { padding: 34px 0; text-align: center; color: var(--muted); font-size: 12px; }
.search-tip { display: flex; align-items: center; gap: 10px; padding-top: 11px; margin-top: 9px; border-top: 1px solid var(--border); font-size: 10px; color: var(--muted-2); flex-wrap: wrap; }

.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.shortcut-row span { color: var(--muted); }
.shortcut-keys { display: flex; gap: 3px; }
.shortcut-keys kbd { min-width: 22px; height: 21px; }

/* question detail modal */
.qdetail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 14px; }
.qdetail-text { font-size: 16px; line-height: 1.8; font-weight: 600; margin-bottom: 16px; }
.qdetail-options { display: flex; flex-direction: column; gap: 8px; }
.qdetail-opt { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 12.5px; line-height: 1.6; background: var(--surface); }
.qdetail-opt .option-key { width: 24px; height: 24px; min-width: 24px; font-size: 10.5px; }
.qdetail-opt.correct { border-color: var(--success-border); background: var(--success-soft); }
.qdetail-opt.correct .option-key { background: var(--success); border-color: var(--success); color: #fff; }
.qdetail-answer { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; line-height: 1.8; }
.qdetail-answer b { color: var(--primary-text); }
.qdetail-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 11px; color: var(--muted); }
.qdetail-note { margin-top: 14px; padding: 11px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; }
.qdetail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ============================ toast ============================ */
.toast-root { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 11px;
  background: #111827;
  color: #f8fafc;
  font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  animation: toastIn .25s cubic-bezier(.2, .8, .2, 1) both;
}
[data-theme="dark"] .toast { background: #e2e8f0; color: #0f172a; }
.toast .ic { width: 16px; height: 16px; }
.toast.success .ic { color: #4ade80; }
.toast.error .ic { color: #fca5a5; }
.toast.info .ic { color: #93c5fd; }

/* ============================ mobile nav ============================ */
.mobile-nav { display: none; }

/* ============================ responsive ============================ */
@media (max-width: 1180px) {
  :root { --sidebar-w: 240px; }
  .view { padding: 24px 24px 70px; }
  .topbar { padding: 0 22px; }
  .practice-layout, .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .sheet { position: static; display: none; }
  .sheet.mobile-open { display: block; }
  .exam-setup { grid-template-columns: 1fr; }
  .setup-summary { position: static; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .home-hero { grid-template-columns: 1fr; padding: 28px; }
  .hero-side { flex-direction: row; justify-content: flex-start; gap: 18px; }
  .hero-ring { width: 108px; height: 108px; }
  .hero-ring-in strong { font-size: 24px; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid, .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-lower { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 22px; }
  .result-mini { width: 100%; }
  .result-actions { justify-content: center; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); box-shadow: 20px 0 60px rgba(0, 0, 0, .3); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { height: 64px; padding: 0 14px; gap: 10px; }
  .topbar-title h1 { font-size: 16.5px; }
  .topbar-title p { font-size: 10.5px; }
  .view { padding: 18px 14px 96px; }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 50;
    height: 62px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: 0 14px 40px -12px rgba(16, 24, 40, .3);
    align-items: stretch;
    justify-content: space-around;
  }
  .mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: 9.5px;
    font-weight: 500;
  }
  .mobile-nav a .ic { width: 19px; height: 19px; }
  .mobile-nav a.active { color: var(--primary); background: var(--primary-soft); }
  .hide-sm { display: none; }
  .streak-pill { display: none; }
  .goal-card { margin-top: 18px; }
  .sheet { position: static; display: none; }
  .sheet.mobile-open { display: block; }
  .practice-layout, .exam-layout { grid-template-columns: 1fr; }
  .qcard { padding: 22px 20px; }
  .qcard-top { margin-bottom: 14px; }
  .q-text { margin-bottom: 20px; }
  .option { padding: 13px 14px; font-size: 14.5px; gap: 11px; }
  .option-key { width: 27px; height: 27px; min-width: 27px; font-size: 11.5px; }
  .qitem { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 13px 14px; }
  .qitem-id { width: 36px; height: 30px; font-size: 10.5px; }
  .qitem-side .status-pill { display: none; }
  .filter-bar { padding: 10px; }
  .search-field { flex-basis: 100%; }
  .page-head h2, .library-head h2 { font-size: 19px; }
  .result-hero { padding: 24px 20px; }
  .score-ring { width: 148px; height: 148px; }
  .score-ring-in strong { font-size: 36px; }
  .finish-card { padding: 26px 20px; }
  .finish-stats { grid-template-columns: repeat(2, 1fr); }
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 24px); border-radius: 20px; }
  .modal.search-modal { align-self: center; margin-top: 0; }
  .modal-foot { padding: 12px 16px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .stats-layout { grid-template-columns: 1fr; }
  .mastery-wrap { flex-direction: column; align-items: flex-start; gap: 18px; }
  .mastery-detail { width: 100%; }
  .achievements { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .stats-grid, .stats-cards { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .type-card { padding: 15px 14px; gap: 10px; }
  .type-count { font-size: 23px; }
  .quick-grid { grid-template-columns: 1fr; }
  .hero-copy h2 { font-size: 24px; }
  .hero-side { display: none; }
  .home-hero { padding: 24px 20px; }
  .result-mini { grid-template-columns: repeat(2, 1fr); }
  .stats-panel, .chart-card, .exam-recent, .settings-card, .result-panel { padding: 18px 16px; }
  .judge-grid { grid-template-columns: 1fr; }
  .judge-btn { min-height: 86px; flex-direction: row; gap: 12px; }
  .judge-btn .judge-ico { width: 34px; height: 34px; }
  .sheet-grid { grid-template-columns: repeat(6, 1fr); }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .practice-actions { gap: 8px; }
  .practice-actions .btn { flex: 1; }
  .practice-actions-right { flex: 1; margin-left: 0; }
  .practice-actions-right .btn { flex: 1; }
  .keyboard-hint { display: none; }
  .exam-topbar { flex-wrap: wrap; padding: 12px 14px; }
  .exam-topbar .progress { order: 3; flex-basis: 100%; }
  .history-table th:nth-child(2), .history-table td:nth-child(2) { display: none; }
  .type-check-grid { grid-template-columns: 1fr; }
  .seg { padding: 0 12px; }
  .finish-card h2 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ============================ animations ============================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.pop { animation: pop .3s ease both; }

/* ============================ print ============================ */
@media print {
  body::before, .sidebar, .topbar, .mobile-nav, .filter-bar, .library-head .btn, .pagination, .sheet, .practice-actions, .keyboard-hint { display: none !important; }
  .main { margin: 0; }
  .view { padding: 0; max-width: none; }
  .card, .qlist { box-shadow: none; border-color: #ddd; }
  .qitem { break-inside: avoid; }
}

/* ============================ additions / fixes ============================ */
.si-indigo { background: var(--primary-soft); color: var(--primary-text); }
.si-teal   { background: var(--teal-soft); color: var(--teal-text); }
.si-green  { background: var(--success-soft); color: var(--success-text); }
.si-amber  { background: var(--accent-soft); color: var(--accent-text); }

.resume-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
  background: linear-gradient(90deg, var(--primary-soft), var(--surface));
}
.resume-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary);
  color: #fff;
}
.resume-banner-icon.soft { background: var(--primary-soft); color: var(--primary-text); }
.resume-banner-icon .ic { width: 18px; height: 18px; }
.resume-banner-copy { min-width: 0; flex: 1; }
.resume-banner-copy strong { display: block; font-size: 12.5px; font-weight: 600; }
.resume-banner-copy span { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }
.resume-banner .btn { flex: none; }

.type-card > * { position: relative; z-index: 1; }
.qitem { cursor: pointer; }
.qitem:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.practice-bar { flex-wrap: wrap; }
.option:disabled, .judge-btn:disabled { cursor: default; }
.option:disabled:hover, .judge-btn:disabled:hover { transform: none; }

.hide-sm { display: inline-flex; }
@media (max-width: 820px) {
  .hide-sm { display: none !important; }
}

/* the review mode shouldn't show "added to wrong book" styling */
.fb-review .badge { background: var(--surface-2); color: var(--muted); }

/* history panel action */
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head-row .btn { flex: none; }

/* print header */
.print-only { display: none; }
@media print {
  .print-only { display: block; margin-bottom: 14px; }
  .print-only h1 { font-size: 20px; }
  .print-only p { font-size: 11px; color: #666; }
}
.result-grid { align-items: start; }

@media (max-width: 820px) {
  .practice-bar .progress { flex: 1 1 100%; order: -1; }
}

/* blank placeholders also appear in the detail modal and search snippets */
.blank {
  display: inline-block;
  min-width: 2.6em;
  height: 1.02em;
  margin: 0 3px;
  vertical-align: -.1em;
  border-bottom: 2px dashed var(--primary);
  background: linear-gradient(180deg, transparent 62%, var(--primary-soft) 62%);
  border-radius: 2px;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* stronger progress track so it stays visible on both themes */
.progress { background: color-mix(in srgb, var(--text) 8%, transparent); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .05); }
[data-theme="dark"] .progress { background: rgba(255, 255, 255, .10); }

/* ============================ banks & import ============================ */
.bank-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 15px;
  margin-bottom: 14px;
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
  background: linear-gradient(90deg, var(--primary-soft), var(--surface));
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.bank-note-icon { width: 20px; height: 20px; display: grid; place-items: center; color: var(--primary-text); flex: none; margin-top: 1px; }
.bank-note-icon .ic { width: 16px; height: 16px; }
.bank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bank-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.bank-card.active { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm); }
.bank-card.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--primary), var(--primary-2)); }
.bank-card-head { display: flex; align-items: center; gap: 12px; }
.bank-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.bank-icon .ic { width: 21px; height: 21px; }
.bank-title { min-width: 0; flex: 1; }
.bank-title strong { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank-title span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.bank-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 10.5px; color: var(--muted); }
.bank-meta span { display: inline-flex; align-items: center; gap: 4px; }
.bank-meta .ic { width: 13px; height: 13px; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.bank-storage { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 10.5px; color: var(--muted-2); }

.import-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.import-card { padding: 22px; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 208px;
  padding: 26px 18px;
  text-align: center;
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.dropzone-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dropzone-icon .ic { width: 26px; height: 26px; }
.dropzone strong { font-size: 14px; }
.dropzone > span:not(.dropzone-icon) { font-size: 11.5px; color: var(--muted); }
.dropzone small { font-size: 10.5px; color: var(--muted-2); max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; color: var(--muted-2); font-size: 10.5px; }
.import-or::before, .import-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.import-textarea { min-height: 130px; font-family: var(--mono); font-size: 11.5px; }
.import-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.import-actions .btn-lg { height: 46px; }
.import-error { margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger-text); font-size: 11.5px; line-height: 1.7; display: flex; gap: 6px; }
.import-error .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.import-progress { margin-top: 12px; padding: 13px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.import-progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.import-progress-head span { display: inline-flex; align-items: center; gap: 5px; }
.import-progress-head .ic { width: 14px; height: 14px; }
.import-tips { padding: 20px 22px; }
.import-tips h3 { font-size: 14px; display: flex; align-items: center; gap: 7px; }
.import-tips h3 .ic { color: var(--primary); }
.import-tip { padding: 11px 0; border-bottom: 1px dashed var(--border); }
.import-tip:last-child { border-bottom: 0; padding-bottom: 0; }
.import-tip b { display: block; font-size: 11.5px; margin-bottom: 3px; }
.import-tip span { display: block; font-size: 10.5px; line-height: 1.7; color: var(--muted); }
.import-preview { padding: 24px 26px; }
.import-result-head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.import-result-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--success-soft); color: var(--success-text); flex: none; }
.import-result-icon .ic { width: 23px; height: 23px; }
.import-result-head > div:nth-child(2) { flex: 1; min-width: 0; }
.import-result-head strong { display: block; font-size: 16px; }
.import-result-head span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.import-name-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 18px 0; }
.import-name-row label { font-size: 12px; font-weight: 600; }
.import-name-row .fill-input { height: 44px; font-size: 13px; }
.import-warnings { margin-bottom: 16px; padding: 10px 13px; border-radius: 10px; background: var(--warning-soft); border: 1px solid var(--warning-border); font-size: 11px; color: var(--warning-text); }
.import-warnings summary { cursor: pointer; display: flex; align-items: center; gap: 5px; }
.import-warnings .ic { width: 14px; height: 14px; }
.warn-list { max-height: 150px; overflow: auto; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--warning-border); line-height: 1.7; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.preview-head strong { font-size: 12.5px; }
.preview-list { display: flex; flex-direction: column; gap: 8px; }
.preview-item { padding: 13px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.preview-item-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.preview-no { font-size: 10px; color: var(--muted-2); }
.preview-question { margin-top: 6px; font-size: 12.5px; font-weight: 500; line-height: 1.65; }
.preview-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 10.5px; color: var(--text-2); }
.preview-opt b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); font-size: 9.5px; margin-right: 4px; }
.preview-answer { margin-top: 7px; font-size: 10.5px; color: var(--success-text); }
.preview-answer b { font-weight: 700; }
.qitem-answer { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 10.5px; color: var(--muted); }
.qitem-answer b { color: var(--success-text); font-weight: 600; }
.qitem-answer .wrong-answer { color: var(--danger-text); }

@media (max-width: 1050px) {
  .bank-grid { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .import-tips { order: 2; }
}
@media (max-width: 700px) {
  .bank-card { padding: 16px; }
  .import-card { padding: 16px; }
  .import-preview { padding: 18px 16px; }
  .import-name-row { grid-template-columns: 1fr; }
  .import-name-row .btn { width: 100%; }
  .import-result-head { flex-wrap: wrap; }
  .dropzone { min-height: 170px; }
}
