/* 字体由本地字体栈提供：CSP 仅允许 self，不引入外部字体请求。
   Plus Jakarta Sans 若本机已安装则优先，否则回落到系统中文字体。 */

:root {
  /* ===== 设计令牌：全站唯一色彩与间距来源（见 design-system 目录下的 MASTER.md） ===== */
  --color-primary: #2563eb;
  --color-primary-ink: #1d4ed8;
  --color-primary-soft: #eff5ff;
  --color-on-primary: #ffffff;
  --color-secondary: #334155;
  --color-on-secondary: #ffffff;
  --color-accent: #ea580c;
  --color-accent-ink: #c2410c;
  --color-background: #f8fafc;
  --color-card: #ffffff;
  --color-card-fg: #1e293b;
  --color-foreground: #1e293b;
  --color-ink: #0f172a;
  --color-muted: #f1f5f9;
  --color-muted-fg: #475569;
  --color-border: #e2e8f0;
  --color-destructive: #dc2626;
  --color-destructive-soft: #fef2f2;
  --color-on-destructive: #ffffff;
  --color-success: #16a34a;
  --color-success-soft: #dcfce7;
  --color-ring: #2563eb;

  /* 后台端扩展：深色仅用于侧栏，不铺满整页 */
  --navy: #0f172a;
  --navy-2: #1b2336;
  --navy-fg: #e2e8f0;
  --navy-muted: #94a3b8;
  --sidebar: #0f172a;
  --sidebar-card: #1b2336;
  --sidebar-fg: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --status-green: #22c55e;

  /* 圆角与阴影 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --sh-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sh-2: 0 4px 16px rgba(15, 23, 42, 0.06);
  --sh-3: 0 12px 32px rgba(15, 23, 42, 0.1);
  --shadow-sm: var(--sh-1);
  --shadow-md: var(--sh-2);
  --shadow-lg: var(--sh-3);
  --shadow-xl: 0 20px 25px rgba(15, 23, 42, 0.15);

  /* 间距刻度 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --space-xs: var(--sp-1);
  --space-sm: var(--sp-2);
  --space-md: var(--sp-4);
  --space-lg: var(--sp-5);
  --space-xl: var(--sp-6);

  /* 字体：数据类文本（激活码/ID/分数）统一走等宽 */
  --font-sans: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  --font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mono: var(--font-mono);

  /* 动效时长：统一 180ms，尊重 prefers-reduced-motion */
  --t-fast: 180ms ease-out;
  --t: 220ms ease;

  /* ===== 兼容旧变量名，统一映射到令牌 ===== */
  --page: var(--color-background);
  --card: var(--color-card);
  --ink: var(--color-ink);
  --muted: var(--color-muted-fg);
  --soft: var(--color-muted);
  --line: var(--color-border);
  --blue: var(--color-primary);
  --blue-soft: var(--color-primary-soft);
  --green: var(--color-success);
  --green-soft: var(--color-success-soft);
  --dark: var(--navy);
  --red: var(--color-destructive);
  --shadow: var(--sh-3);

  font-family: var(--font-sans);
}

html {
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 30px 22px 52px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--green));
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.quiet-button,
.back-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
}

.site-header .brand {
  margin-right: auto;
}

.member-name {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.activation-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 27, 58, 0.42);
}

.activation-card {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(7, 27, 58, 0.22);
}

.activation-card h1 {
  margin: 6px 0 8px;
  font-size: 26px;
}

.activation-card > p:not(.eyebrow) {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.65;
}

/* 激活弹窗内的题库状态：已激活显示使用期限，未激活显示可激活 */
.activation-status {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.activation-status:empty {
  display: none;
}

.activation-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--color-muted);
}

.activation-row strong {
  font-size: 14px;
}

.activation-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.activation-badge.active {
  color: #137a2e;
  background: #e6f6ea;
}

.activation-badge.expired {
  color: #8a6d1d;
  background: #faf3dd;
}

.activation-badge.idle {
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--color-card);
}

.activation-detail {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.activation-note {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* 两个题库都解锁后，整块激活码填写区隐藏，改为展示完成态 */
.activation-done {
  display: grid;
  gap: 4px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid #bfe6c9;
  border-radius: var(--r-sm);
  background: #e9f8ee;
}

.activation-done strong {
  color: #137a2e;
  font-size: 14px;
}

.activation-done span {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.activation-card label,
.activation-card label span {
  display: block;
}

.activation-card label span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.activation-card input {
  width: 100%;
  min-height: 48px;
  margin-bottom: 16px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.activation-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.activation-card select {
  width: 100%;
  height: 48px;
  margin-bottom: 16px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 14px center;
  cursor: pointer;
}

.activation-card select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.activation-card .primary-button {
  width: 100%;
}

.contact-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.contact-divider::before,
.contact-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.wechat-contact {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.wechat-contact img {
  width: 132px;
  height: 132px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.wechat-contact strong,
.wechat-contact span {
  display: block;
}

.wechat-contact strong {
  margin-bottom: 6px;
  font-size: 15px;
}

.wechat-contact span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--page);
  font-size: 22px;
}

body.modal-open {
  overflow: hidden;
}

.quiet-button:hover,
.back-button:hover {
  color: var(--blue);
  background: #eef5ff;
}

.home-screen {
  display: grid;
  gap: 28px;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.cert-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--t-fast);
}

.cert-card:hover {
  box-shadow: var(--sh-2);
}

.cert-head {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.cert-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 25px;
  font-weight: 900;
}

.intermediate-card .cert-icon {
  color: var(--green);
  background: var(--green-soft);
}

.cert-head-text {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intermediate-card .eyebrow {
  color: var(--green);
}

.cert-card h1,
.exam-setup h1,
.exam-result h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.summary,
.exam-setup p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

/* 元信息 chip：中性底色 + 描边，等宽数字便于对齐 */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-weight: 800;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.primary-button {
  color: var(--color-on-primary);
  background: var(--color-primary);
}

.primary-button:hover:not(:disabled) {
  background: var(--color-primary-ink);
}

.primary-button:disabled {
  color: var(--color-on-primary);
  background: #a1a9b6;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--color-primary-ink);
  border-color: var(--line);
  background: var(--card);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--blue-soft);
}

.secondary-button:disabled {
  color: var(--muted);
  background: var(--color-muted);
  cursor: not-allowed;
}

/* ===== 首页：Hero + 核心能力 + 等级入口 ===== */

.site-header {
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--sh-1);
}

.quiet-button.is-primary {
  color: var(--color-on-primary);
  background: var(--color-primary);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.26);
}

.quiet-button.is-primary:hover {
  color: var(--color-on-primary);
  background: var(--color-primary-ink);
}

.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 120% at 88% 10%, rgba(96, 165, 250, 0.5) 0%, rgba(37, 99, 235, 0) 58%),
    radial-gradient(90% 90% at 4% 98%, rgba(56, 189, 248, 0.32) 0%, rgba(37, 99, 235, 0) 62%),
    linear-gradient(135deg, #1b3aa8 0%, #2563eb 52%, #3b82f6 100%);
  box-shadow: var(--sh-3);
}

.home-hero::after {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 100% at 72% 0%, #000 18%, transparent 78%);
  mask-image: radial-gradient(120% 100% at 72% 0%, #000 18%, transparent 78%);
  content: "";
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 32px;
  align-items: center;
  padding: 46px 46px 42px;
}

.hero-copy {
  min-width: 0;
}

.hero-eyebrow {
  color: #bfdbfe;
}

.home-hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.2;
}

.hero-title-line {
  display: block;
  margin-top: 4px;
  background: linear-gradient(92deg, #fed7aa 0%, #fdba74 45%, #fcd34d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 46ch;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 16px;
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-primary {
  min-height: 50px;
  color: var(--color-primary-ink);
  background: #fff;
  box-shadow: 0 10px 22px rgba(3, 14, 46, 0.26);
}

.hero-primary:hover:not(:disabled) {
  background: #eaf1ff;
}

.hero-secondary {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
}

.hero-secondary:hover:not(:disabled) {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.26);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 36px;
  margin: 30px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  list-style: none;
}

.hero-stats li {
  display: grid;
  gap: 5px;
}

.hero-stats strong {
  color: #fff;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stats span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  letter-spacing: 0.4px;
}

.hero-visual {
  display: grid;
  place-items: center;
}

.hero-art {
  width: min(100%, 340px);
  height: auto;
  filter: drop-shadow(0 18px 34px rgba(4, 16, 48, 0.34));
}

.home-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.feature-card:hover {
  border-color: #c7d8f7;
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

.feature-card h3 {
  margin: 0;
  font-size: 16px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.68;
}

.cert-section {
  display: grid;
  gap: 18px;
}

.section-head {
  max-width: 62ch;
}

.section-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}

.section-head > p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.cert-card {
  position: relative;
  overflow: hidden;
}

.cert-ribbon {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), #60a5fa);
}

.intermediate-card .cert-ribbon {
  background: linear-gradient(90deg, var(--color-accent), #f59e0b);
}

.home-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 22px 4px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.home-footer p {
  margin: 0;
}

.home-footer a {
  color: var(--color-primary-ink);
  font-weight: 700;
  text-decoration: none;
}

.home-footer a:hover {
  text-decoration: underline;
}

.work-screen {
  display: grid;
  gap: 18px;
}

.study-page {
  min-height: 100svh;
  overflow-y: scroll;
  background: #fff;
}

.study-page .app {
  width: 100%;
  min-height: 100svh;
  padding: 0;
}

.study-page .work-screen {
  min-height: 100svh;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
}

.study-page .work-topbar,
.study-page .work-tools {
  width: 100%;
  padding-right: max(20px, calc((100vw - 1180px) / 2));
  padding-left: max(20px, calc((100vw - 1180px) / 2));
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.study-page .work-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.study-page .work-tools {
  background: #f8fafc;
}

.study-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.study-account .member-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.answer-sheet-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  color: #164a9b;
  background: #fff;
  font-weight: 800;
}

.answer-sheet-trigger:hover {
  border-color: #8eb4ff;
  background: var(--blue-soft);
}

.answer-sheet-trigger strong {
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--green);
  font-size: 12px;
}

.answer-sheet-icon {
  color: var(--blue);
  font-size: 20px;
  line-height: 1;
}

.answer-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  visibility: hidden;
  background: rgba(7, 27, 58, 0.28);
  opacity: 0;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.answer-sheet-overlay.open {
  visibility: visible;
  opacity: 1;
}

.answer-sheet-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 25;
  width: min(390px, 100%);
  height: 100dvh;
  overflow-y: auto;
  padding: 28px 24px max(28px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 48px rgba(7, 27, 58, 0.14);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.answer-sheet-drawer.open {
  transform: translateX(0);
}

.answer-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.answer-sheet-header span {
  color: var(--muted);
  font-size: 12px;
}

.answer-sheet-header h2 {
  margin: 5px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}

.answer-sheet-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 24px;
  line-height: 1;
}

.answer-sheet-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.answer-sheet-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.answer-sheet-legend i {
  width: 12px;
  height: 12px;
  display: block;
  border: 1px solid #cbd7e5;
  border-radius: 3px;
  background: #fff;
}

.answer-sheet-legend i.current {
  border: 2px solid var(--blue);
}

.answer-sheet-legend i.answered {
  border-color: #b8e6d5;
  background: var(--green-soft);
}

.answer-sheet-legend i.wrong {
  border-color: #efb7b7;
  background: #fff0f0;
}

.answer-sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.answer-number {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #cbd7e5;
  border-radius: 6px;
  color: #3e536f;
  background: #fff;
  font-size: 14px;
  font-weight: 800;
}

.answer-number:hover {
  border-color: #8eb4ff;
  color: var(--blue);
  background: #f5f9ff;
}

.answer-number.answered {
  border-color: #9ddac3;
  color: #087b5d;
  background: var(--green-soft);
}

.answer-number.wrong {
  border-color: #eba5a5;
  color: #b23d3d;
  background: #fff0f0;
}

.answer-number.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 102, 255, 0.18);
}

.answer-number:disabled {
  border-color: #e5eaf0;
  color: #aab6c4;
  background: #f4f6f8;
  cursor: not-allowed;
}

.answer-sheet-open {
  overflow: hidden;
}

.study-page .screen {
  min-width: 0;
  padding: 24px 20px 48px;
  background: #fff;
}

.study-page .question-card {
  min-height: clamp(480px, calc(100svh - 210px), 760px);
  margin-top: 0;
  padding: 36px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.study-page .exam-setup,
.study-page .exam-result {
  margin-top: 0;
}

.work-topbar,
.work-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.work-topbar {
  justify-content: space-between;
}

.work-topbar > div:not(.mode-switch) {
  min-width: 0;
}

.work-topbar strong,
.work-topbar span {
  display: block;
}

.work-topbar strong {
  font-size: 18px;
}

.work-topbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.work-tools {
  justify-content: space-between;
  flex-wrap: wrap;
}

.mode-switch,
.level-switch {
  display: inline-grid;
  gap: 5px;
  padding: 5px;
  border-radius: 15px;
  background: #edf3f8;
}

.mode-switch {
  grid-template-columns: repeat(3, 1fr);
}

.level-switch {
  grid-template-columns: 1fr 1fr;
}

.mode-switch button,
.level-switch button {
  min-height: 44px;
  min-width: 76px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.mode-switch button.active {
  color: #fff;
  background: var(--blue);
}

.level-switch button.active {
  color: #fff;
  background: var(--green);
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-filter label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.type-filter input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.stats-row {
  display: flex;
  gap: 10px;
}

.stats-row div {
  min-width: 82px;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.stats-row strong {
  color: var(--blue);
  font-size: 18px;
}

.stats-row span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.question-card,
.exam-setup,
.exam-result {
  width: min(100%, 900px);
  margin: 12px auto 0;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 800;
}

.counter-label,
.type-label {
  color: var(--muted);
  font-size: 13px;
}

.counter-label {
  justify-self: center;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-muted);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width var(--t);
}

.question-title {
  margin: 26px 0 30px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.5;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.question-images {
  display: grid;
  gap: 12px;
  margin: -12px 0 28px;
  overflow-anchor: none;
}

.question-images img {
  display: block;
  width: auto;
  max-width: min(100%, 680px);
  max-height: 360px;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(28, 55, 96, 0.08);
  contain: paint;
}

.review-item .question-images {
  margin: 10px 0 14px;
}

.review-item .question-images img {
  max-height: 240px;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-item {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--color-ink);
  background: var(--card);
  text-align: left;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: border-color var(--t-fast), background-color var(--t-fast), box-shadow var(--t-fast);
}

.option-item:hover {
  border-color: var(--color-primary);
  background: var(--blue-soft);
}

/* 选中态：主色描边 + 浅底 */
.option-item.selected {
  border-color: var(--color-primary);
  color: var(--color-primary-ink);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.option-item.selected .option-letter {
  border-color: var(--color-primary);
  color: var(--color-on-primary);
  background: var(--color-primary);
}

/* 判分态：正确走成功色，错误走危险色 */
.option-item.correct {
  border-color: var(--color-success);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px var(--color-success);
}

.option-item.correct .option-letter {
  border-color: var(--color-success);
  color: #fff;
  background: var(--color-success);
}

.option-item.wrong {
  border-color: var(--color-destructive);
  background: var(--color-destructive-soft);
  box-shadow: inset 0 0 0 1px var(--color-destructive);
}

.option-item.wrong .option-letter {
  border-color: var(--color-destructive);
  color: var(--color-on-destructive);
  background: var(--color-destructive);
}

.option-item:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.option-letter {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  background: var(--card);
  font-weight: 900;
}

.option-text {
  font-size: 17px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.short-answer {
  display: grid;
  gap: 8px;
}

.short-answer span {
  color: var(--muted);
  font-size: 13px;
}

.short-answer textarea {
  min-height: 180px;
  width: 100%;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: var(--soft);
  font-size: 16px;
  line-height: 1.7;
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

.card-actions > button {
  flex: 1 1 0;
  min-width: 0;
}

.answer-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--color-card-fg);
  background: var(--card);
  line-height: 1.8;
}

.answer-panel strong {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 16px;
}

.answer-panel.correct {
  border-color: var(--color-success);
  background: var(--green-soft);
}

.answer-panel.wrong {
  border-color: var(--color-destructive);
  background: var(--color-destructive-soft);
}

.exam-setup,
.exam-result {
  display: grid;
  gap: 22px;
}

.exam-rule-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fbfdff;
}

.exam-rule-card strong {
  font-size: 17px;
}

.exam-rule-card p {
  margin: 0;
  color: var(--blue);
  font-weight: 900;
}

.exam-rule-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.exam-rule-card span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.timer {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 900;
}

.score {
  color: var(--color-primary);
  font-family: var(--mono);
  font-size: 56px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score small {
  color: var(--muted);
  font-size: 22px;
}

.pass-badge {
  margin: 12px auto 4px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  width: fit-content;
}

.pass-badge.pass {
  color: #15803d;
  border: 1px solid var(--color-success);
  background: var(--green-soft);
}

.pass-badge.fail {
  color: var(--color-destructive);
  border: 1px solid var(--color-destructive);
  background: var(--color-destructive-soft);
}

.pass-badge.pending {
  color: var(--color-accent-ink);
  border: 1px solid var(--color-accent);
  background: #fff7ed;
}

.result-note {
  padding: 14px 16px;
  border: 1px solid var(--color-accent);
  border-radius: var(--r);
  color: var(--color-accent-ink);
  background: #fff7ed;
  font-size: 14px;
  line-height: 1.7;
}

.login-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.login-actions .secondary-button {
  flex: 1;
}

.login-actions .primary-button {
  flex: 1.4;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.result-grid div,
.review-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
}

.result-grid strong,
.result-grid span {
  display: block;
}

.result-grid strong {
  font-family: var(--mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.result-grid span,
.review-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item h3 {
  margin: 8px 0;
  font-size: 16px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  transform: translate(-50%, 18px);
  max-width: min(92vw, 520px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(16, 26, 48, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.toast-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.14);
  font-size: 14px;
  line-height: 1;
}

.toast-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.26);
}

/* ===== 共享组件类：令牌驱动，学员端与后台端复用 ===== */

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* 骨架屏：>300ms 才显示，避免快速请求时闪烁 */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--color-muted);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  transform: translateX(-100%);
  animation: skeleton-sweep 1.2s ease-in-out infinite;
}

.skeleton-card {
  display: grid;
  gap: 14px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
}

.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-100 { width: 100%; }
.skeleton-block { height: 66px; border-radius: var(--r); }

@keyframes skeleton-sweep {
  to { transform: translateX(100%); }
}

/* 空状态：说明「为什么空」并给出下一步入口 */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
}

.empty-state svg {
  width: 44px;
  height: 44px;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0;
  font-size: 18px;
}

.empty-state p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* 错题本：全部错题总览 + 错题练习入口 */
.wrong-panel {
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
}

.wrong-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.wrong-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.wrong-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.wrong-head strong {
  color: var(--color-primary);
}

.wrong-list {
  display: grid;
  gap: 12px;
}

.wrong-item {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fbfdff;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.wrong-item:hover,
.wrong-item:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.wrong-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.wrong-link {
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* 错题本分页 */
.list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
}

.list-pagination .page-detail {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* 错题详情：只读查看题目与解析 */
#wrongDetail .option-list button {
  cursor: default;
  pointer-events: none;
}

.wrong-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.wrong-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wrong-count {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--color-destructive);
  background: var(--color-destructive-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.wrong-item-text {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wrong-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wrong-streak {
  color: var(--muted);
  font-size: 13px;
}

.wrong-streak.reached {
  color: var(--color-success);
  font-weight: 700;
}

@media (max-width: 760px) {
  .wrong-panel {
    padding: 22px 18px;
  }

  .wrong-head {
    flex-direction: column;
    align-items: stretch;
  }

  .wrong-head .primary-button {
    width: 100%;
  }
}

/* 历史成绩列表：考试档案卡片 */
.history-panel {
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.history-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.history-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-item {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fbfdff;
}

.history-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-item-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-item-title strong {
  font-size: 17px;
}

.history-item-title .pass-badge {
  margin: 0;
}

.history-item-score {
  color: var(--color-primary);
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-item-score span {
  color: var(--muted);
  font-size: 14px;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 13px;
}

.history-item-actions {
  display: flex;
  justify-content: flex-end;
}

.history-detail {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.history-detail-loading {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.history-shorts {
  display: grid;
  gap: 12px;
}

.history-short {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}

.history-short-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-short-head span {
  color: var(--color-primary);
  font-weight: 800;
}

.history-short-question,
.history-short-answer,
.history-short-ref {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
}

.history-short-answer {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--color-muted);
}

.history-short-ref {
  color: var(--muted);
}

/* 确认弹窗（危险操作二次确认） */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.confirm-card {
  width: min(100%, 460px);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.confirm-card h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.confirm-card .danger-note {
  color: var(--red);
  font-weight: 700;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.danger-button {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--color-on-destructive);
  background: var(--color-destructive);
  font-weight: 700;
}

.danger-button:hover {
  background: #b91c1c;
}

.danger-button:disabled {
  background: #e5a3a3;
  cursor: not-allowed;
}

/* 焦点可见性：所有可交互元素统一描边 */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* WCAG 2.2：粘性头部不遮挡聚焦元素 */
html {
  scroll-padding-top: 96px;
}

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

  .skeleton::after {
    animation: none;
    transform: none;
    background: none;
  }
}

@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 40px 36px;
  }

  .hero-art {
    width: min(100%, 300px);
  }

  .home-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cert-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 18px 12px 36px;
  }

  .study-page .app {
    padding: 0;
  }

  .site-header {
    position: static;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: var(--r);
  }

  .site-header .brand {
    width: calc(100% - 150px);
  }

  .member-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-header .quiet-button {
    flex: 1 1 auto;
    min-width: 88px;
  }

  .brand span {
    display: none;
  }

  .home-screen {
    gap: 20px;
  }

  .hero-inner {
    gap: 22px;
    padding: 30px 22px 26px;
  }

  .home-hero h1 {
    font-size: 28px;
  }

  .hero-lead {
    margin-top: 12px;
    font-size: 15px;
  }

  .hero-actions {
    margin-top: 20px;
  }

  .hero-stats {
    gap: 14px 24px;
    margin-top: 24px;
    padding-top: 16px;
  }

  .hero-stats strong {
    font-size: 21px;
  }

  .hero-art {
    width: min(100%, 260px);
  }

  .home-features {
    gap: 12px;
  }

  .feature-card {
    padding: 18px 16px;
  }

  .section-head h2 {
    font-size: 22px;
  }

  .cert-grid {
    gap: 18px;
  }

  .home-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .cert-card {
    gap: 16px;
    padding: 22px;
    border-radius: var(--r-lg);
  }

  .cert-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 22px;
  }

  .cert-card h1 {
    font-size: 21px;
  }

  .summary {
    font-size: 14px;
  }

  .home-actions,
  .work-topbar,
  .work-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .study-page .work-topbar {
    position: static;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
  }

  .study-page .work-topbar .mode-switch,
  .study-page .study-account {
    grid-column: 1 / -1;
  }

  .study-page .study-account {
    justify-content: space-between;
  }

  .study-page .work-tools {
    padding: 12px 14px;
  }

  .answer-sheet-trigger {
    width: 100%;
  }

  .answer-sheet-drawer {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(72dvh, 620px);
    padding: 22px 18px max(24px, env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    transform: translateY(102%);
  }

  .answer-sheet-drawer.open {
    transform: translateY(0);
  }

  .study-page .screen {
    padding: 14px 14px max(55svh, env(safe-area-inset-bottom));
  }

  .study-page .question-card {
    min-height: 0;
    padding: 16px 0 24px;
    border-radius: 0;
  }

  .study-page #practiceCard .card-top .pill,
  .study-page #practiceCard .counter-label,
  .study-page #wrongCard .card-top .pill,
  .study-page #wrongCard .counter-label {
    display: none;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .mode-switch,
  .level-switch {
    width: 100%;
  }

  .type-filter,
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .question-card,
  .exam-setup,
  .exam-result,
  .history-panel {
    padding: 24px;
    border-radius: 24px;
  }

  .history-head {
    flex-direction: column;
    align-items: stretch;
  }

  .history-item-head {
    align-items: flex-start;
  }

  .card-top,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .card-actions {
    gap: 8px;
  }

  /* 错题练习含 4 个按钮，窄屏折成两行避免文字挤压 */
  .card-actions--wide {
    flex-wrap: wrap;
  }

  .card-actions--wide > button {
    flex: 1 1 42%;
  }

  .study-page #practiceCard .card-actions button,
  .study-page #wrongCard .card-actions button {
    min-height: 52px;
    padding: 0 6px;
    border-radius: 14px;
    font-size: 15px;
    white-space: nowrap;
  }

  .counter-label {
    justify-self: start;
  }

  .study-page .type-label,
  .study-page .card-top {
    scroll-margin-top: 10px;
  }

  .question-title {
    font-size: 23px;
  }

  .question-images img {
    width: 100%;
    max-height: 280px;
  }

  .activation-modal {
    align-items: end;
    padding: 0;
  }

  .activation-card {
    width: 100%;
    max-height: calc(100vh - 12px);
    padding: 28px 20px max(24px, env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
  }

  .activation-row {
    grid-template-columns: auto auto;
  }

  .activation-detail {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
  }

  .wechat-contact {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .wechat-contact img {
    width: 118px;
    height: 118px;
  }
}

@media (max-width: 430px) {
  .meta-row {
    gap: 10px 14px;
  }

  .type-filter {
    grid-template-columns: 1fr 1fr;
  }

  .stats-row div {
    min-width: 0;
  }
}
