:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0b3a7a;
  --primary-2: #155fd1;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.06);
  --ok: #16a34a;
  --bad: #ef4444;
  --focus: rgba(21, 95, 209, 0.25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(1100px 600px at 20% 0%, rgba(21, 95, 209, 0.08), transparent 55%),
              radial-gradient(900px 500px at 80% 10%, rgba(11, 58, 122, 0.08), transparent 55%),
              var(--bg);
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.brand { font-weight: 800; letter-spacing: 0.2px; color: var(--primary); }
.navinfo { color: var(--muted); font-size: 14px; }
.topbar__left { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.topbar__right { display: flex; gap: 10px; align-items: center; }

.timer {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  min-width: 76px;
  text-align: center;
}

.container { max-width: 1080px; margin: 0 auto; padding: 26px 18px 60px; }
.view { display: none; }
.view--active { display: block; }

.h1 { margin: 14px 0 16px; font-size: 30px; letter-spacing: -0.3px; }
.h2 { font-size: 20px; font-weight: 750; margin: 0; }
.subtle { color: var(--muted); font-size: 14px; }
.hint { margin-top: 18px; color: var(--muted); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
}
.card {
  text-align: left;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 18px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(21, 95, 209, 0.35); }
.card__title { font-size: 28px; font-weight: 900; color: var(--primary); }
.card__desc { margin-top: 4px; color: var(--muted); }

.levelHeader { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 12px;
}
.qbtn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  border-radius: 12px;
  padding: 14px 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.qbtn:hover { background: #fff; border-color: rgba(21, 95, 209, 0.35); }

.testHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 750;
}
.btn:hover { background: #fff; }
.btn--primary {
  border-color: rgba(21, 95, 209, 0.35);
  background: linear-gradient(180deg, rgba(21,95,209,0.95), rgba(11,58,122,0.95));
  color: #fff;
}
.btn--primary:hover { filter: brightness(1.03); }
.btn--ghost { background: transparent; }

.passage {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  line-height: 2.1;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.blankWrap {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  margin: 0 2px;
}
.prefix {
  font-weight: 900;
  color: var(--primary);
}
.char {
  width: 15px;
  border: none;
  border-bottom: 2px solid rgba(100, 116, 139, 0.8);
  background: transparent;
  outline: none;
  text-align: center;
  padding: 0;
  margin: 0 1px;
  font-size: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.char:focus {
  border-bottom-color: var(--primary-2);
  box-shadow: 0 10px 0 0 var(--focus);
}

.blankWrap[data-state="correct"] .prefix,
.blankWrap[data-state="correct"] .char { color: var(--ok); border-bottom-color: rgba(22, 163, 74, 0.9); }
.blankWrap[data-state="wrong"] .prefix,
.blankWrap[data-state="wrong"] .char { color: var(--bad); border-bottom-color: rgba(239, 68, 68, 0.9); }

.answerTag {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed rgba(15, 23, 42, 0.25);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
