:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f1f4ff;
  --text: #172033;
  --muted: #687386;
  --faint: #929bad;
  --line: #e1e6ee;
  --primary: #335cff;
  --primary-dark: #2448db;
  --primary-soft: #edf1ff;
  --success: #168a58;
  --success-soft: #eaf8f1;
  --danger: #d34646;
  --danger-soft: #fff0f0;
  --amber: #cf8114;
  --amber-soft: #fff5df;
  --shadow-sm: 0 7px 24px rgba(27, 39, 68, 0.07);
  --shadow-lg: 0 24px 70px rgba(27, 39, 68, 0.12);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -5%, rgba(51, 92, 255, 0.1), transparent 31rem),
    radial-gradient(circle at 94% 8%, rgba(22, 138, 88, 0.07), transparent 26rem),
    var(--bg);
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
a,
summary,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
summary,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(51, 92, 255, 0.28);
  outline-offset: 3px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 13px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.primary-link {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 10px 24px rgba(51, 92, 255, 0.24);
}

.primary-link:hover {
  background: var(--primary-dark);
  box-shadow: 0 13px 28px rgba(51, 92, 255, 0.3);
  transform: translateY(-2px);
}

.secondary-link {
  color: #344054;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.secondary-link:hover {
  color: var(--primary);
  border-color: rgba(51, 92, 255, 0.35);
}

/* Shared header and notifications */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
}

.brand-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #4e72ff, #274ad9);
  border-radius: 14px;
  box-shadow: 0 9px 20px rgba(51, 92, 255, 0.25);
  font-weight: 900;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: -2px;
  color: var(--faint);
  font-size: 0.68rem;
}

.landing-nav {
  display: flex;
  gap: 24px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.landing-nav a:hover,
.text-button:hover {
  color: var(--primary);
}

.text-button {
  padding: 8px 0;
  color: inherit;
  background: none;
  border: 0;
  font-weight: inherit;
}

.toast-stack {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 80;
  width: min(430px, calc(100% - 32px));
  transform: translateX(-50%);
}

.toast {
  padding: 13px 16px;
  color: #2e3a51;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 700;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast--success {
  border-left-color: var(--success);
}

.toast--warning {
  border-left-color: var(--amber);
}

.toast--leaving {
  opacity: 0;
  transform: translateY(-10px);
}

/* Landing page */
.landing-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.65fr);
  gap: clamp(42px, 8vw, 100px);
  align-items: center;
  min-height: 410px;
  padding: 64px 30px 48px;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.5rem, 5.15vw, 4.7rem);
  line-height: 1.1;
  letter-spacing: -0.05em;
}

.hero h1 span {
  color: var(--primary);
}

.hero-description {
  max-width: 650px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
}

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

.overview-card {
  position: relative;
  min-height: 330px;
  padding: 26px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.87);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.overview-card::after {
  position: absolute;
  right: -65px;
  bottom: -85px;
  width: 210px;
  height: 210px;
  content: "";
  background: rgba(51, 92, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.overview-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.overview-topline strong {
  color: var(--text);
  font-size: 1.2rem;
}

.overview-topline small {
  color: var(--faint);
  font-size: 0.68rem;
}

.overview-chart {
  display: grid;
  width: 142px;
  height: 142px;
  margin: 26px auto;
  place-items: center;
  background: conic-gradient(var(--primary) var(--progress), #e8ecf4 0);
  border-radius: 50%;
}

.overview-chart::before {
  grid-area: 1 / 1;
  width: 106px;
  height: 106px;
  content: "";
  background: var(--surface);
  border-radius: 50%;
}

.overview-chart > div {
  z-index: 1;
  grid-area: 1 / 1;
  text-align: center;
}

.overview-chart strong,
.overview-chart span {
  display: block;
}

.overview-chart strong {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.overview-chart span {
  color: var(--muted);
  font-size: 0.7rem;
}

.overview-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.overview-metrics div + div {
  border-left: 1px solid var(--line);
}

.overview-metrics strong,
.overview-metrics span {
  display: block;
}

.overview-metrics strong {
  font-size: 1.05rem;
}

.overview-metrics span {
  color: var(--faint);
  font-size: 0.68rem;
}

.search-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  margin-bottom: 20px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.search-strip > div {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 800;
}

.search-icon {
  color: var(--primary);
  font-size: 1.25rem;
}

.search-strip form {
  display: grid;
  grid-template-columns: 1fr auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.search-strip input {
  min-width: 0;
  height: 46px;
  padding: 0 15px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-strip button {
  padding: 0 20px;
  color: #fff;
  background: var(--text);
  border: 0;
  font-weight: 750;
}

.mode-section,
.tool-section {
  padding: 38px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.section-heading--compact {
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25;
}

.section-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 17px;
}

.mode-card {
  min-width: 0;
  padding: 21px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(27, 39, 68, 0.035);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.mode-card:hover {
  border-color: rgba(51, 92, 255, 0.22);
  box-shadow: 0 14px 32px rgba(27, 39, 68, 0.1);
  transform: translateY(-3px);
}

.mode-card-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: center;
}

.mode-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 15px;
  font-size: 0.95rem;
  font-weight: 900;
}

.mode-card--blue .mode-icon {
  color: #3157e8;
  background: #edf1ff;
}

.mode-card--green .mode-icon {
  color: #148257;
  background: #e8f8f1;
}

.mode-card--amber .mode-icon {
  color: #bd7410;
  background: #fff5df;
}

.mode-content strong,
.mode-content small {
  display: block;
  white-space: nowrap;
}

.mode-content strong {
  font-size: 1.05rem;
}

.mode-content small {
  color: var(--muted);
  font-size: 0.76rem;
}

.accuracy-pill {
  padding: 4px 8px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 850;
}

.mini-progress {
  height: 6px;
  margin: 20px 0 10px;
  overflow: hidden;
  background: #edf0f5;
  border-radius: 99px;
}

.mini-progress span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.mode-card--green .mini-progress span {
  background: var(--success);
}

.mode-card--amber .mini-progress span {
  background: var(--amber);
}

.mode-stats {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.68rem;
}

.mode-stats strong {
  color: #4b5568;
}

.mode-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 18px;
}

.mode-primary,
.icon-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #dbe2ff;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 800;
}

.mode-primary {
  gap: 8px;
}

.mode-primary:hover,
.icon-action:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.icon-action {
  width: 43px;
  font-size: 1.05rem;
}

.tool-section {
  margin-top: 20px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}

.tool-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.tool-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 15px;
  font-size: 1.3rem;
  font-weight: 850;
}

.tool-card--favorite .tool-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.tool-card strong {
  font-size: 1.02rem;
}

.tool-card p {
  margin: 3px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chip-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-links a {
  padding: 5px 9px;
  color: #526078;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
}

.chip-links a:hover {
  color: var(--primary);
  border-color: rgba(51, 92, 255, 0.35);
}

.chip-links b {
  margin-left: 3px;
  color: var(--text);
}

.landing-footer {
  display: flex;
  justify-content: space-between;
  padding: 28px 4px 0;
  color: var(--faint);
  font-size: 0.72rem;
}

/* Quiz and shared topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 247, 251, 0.88);
  border-bottom: 1px solid rgba(220, 226, 236, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1040px, calc(100% - 40px));
  min-height: 70px;
  margin: 0 auto;
}

.back-link,
.ghost-button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  color: var(--muted);
  font-weight: 750;
}

.back-link {
  justify-self: start;
}

.back-link:hover {
  color: var(--primary);
}

.topbar-title {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-self: center;
}

.topbar-badge {
  padding: 5px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 850;
}

.ghost-button {
  justify-self: end;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.ghost-button:hover {
  color: var(--primary);
  border-color: rgba(51, 92, 255, 0.28);
}

.quiz-shell {
  width: min(910px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 52px;
}

.toast-stack--quiz {
  top: 86px;
}

.practice-tabs {
  display: flex;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 17px;
  padding: 5px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(224, 229, 238, 0.94);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}

.practice-tabs::-webkit-scrollbar {
  display: none;
}

.practice-tabs a {
  flex: 0 0 auto;
  padding: 7px 14px;
  color: var(--muted);
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 750;
}

.practice-tabs a:hover {
  color: var(--primary);
}

.practice-tabs a[aria-current="page"] {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 12px rgba(51, 92, 255, 0.22);
}

.progress-panel {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 17px;
  padding: 18px 23px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.position-block span,
.accuracy-block span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.position-block strong,
.accuracy-block strong {
  display: block;
  margin-top: 2px;
  font-size: 1.3rem;
  line-height: 1.2;
}

.position-block small {
  color: var(--faint);
  font-size: 0.78rem;
}

.accuracy-block {
  text-align: right;
}

.accuracy-block strong {
  color: var(--success);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e8ecf3;
  border-radius: 99px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #335cff, #7289ff);
  border-radius: inherit;
  transition: width 240ms ease;
}

.question-card {
  padding: clamp(26px, 5vw, 47px);
  background: var(--surface);
  border: 1px solid rgba(224, 229, 238, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.question-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.question-labels {
  display: flex;
  gap: 9px;
  align-items: center;
}

.question-number {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.question-type {
  padding: 4px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 0.68rem;
}

.favorite-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 38px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 750;
}

.favorite-button:hover,
.favorite-button--active {
  color: #b66e0e;
  background: var(--amber-soft);
  border-color: #f1d49e;
}

.question-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 12px;
  color: var(--faint);
  font-size: 0.69rem;
}

.question-context span + span::before {
  margin-right: 14px;
  content: "·";
}

.question-text {
  margin: 0 0 28px;
  font-size: clamp(1.18rem, 2.4vw, 1.52rem);
  font-weight: 750;
  line-height: 1.72;
  letter-spacing: -0.01em;
}

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

.option-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 26px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 16px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.option-row:hover {
  background: #fff;
  border-color: rgba(51, 92, 255, 0.45);
  box-shadow: 0 6px 16px rgba(27, 39, 68, 0.06);
  transform: translateY(-1px);
}

.option-row--button {
  appearance: none;
}

.option-key {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #44506a;
  background: #fff;
  border: 1px solid #dce2eb;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 850;
}

.option-text {
  min-width: 0;
  font-size: 0.96rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.option-state {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: transparent;
  border: 1.5px solid #cbd3df;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 900;
}

.option-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.option-row--check:has(.option-input:focus-visible) {
  outline: 3px solid rgba(51, 92, 255, 0.28);
  outline-offset: 3px;
}

.option-row--check:has(.option-input:checked),
.option-row--selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.option-row--check:has(.option-input:checked) .option-key,
.option-row--selected .option-key,
.option-row--check:has(.option-input:checked) .option-state,
.option-row--selected .option-state {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.option-row--correct,
.option-row--correct:hover {
  background: var(--success-soft);
  border-color: var(--success);
}

.option-row--correct .option-key,
.option-row--correct .option-state {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.option-row--wrong,
.option-row--wrong:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.option-row--wrong .option-key,
.option-row--wrong .option-state {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.primary-button,
.secondary-button,
.nav-button,
.danger-button {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 8px 18px rgba(51, 92, 255, 0.2);
}

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

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.submit-answer {
  width: 100%;
  margin-top: 17px;
}

.selection-count {
  font-size: 0.75rem;
  opacity: 0.82;
}

.result-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 21px;
  padding: 16px 18px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}

.result-banner--success {
  color: #0f7048;
  background: var(--success-soft);
  border-color: #b8e7d2;
}

.result-banner--error {
  color: #b33232;
  background: var(--danger-soft);
  border-color: #f1c4c4;
}

.result-icon {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: currentColor;
  border-radius: 50%;
  font-weight: 900;
}

.result-banner strong,
.result-banner p {
  display: block;
  margin: 0;
}

.result-banner p {
  margin-top: 2px;
  font-size: 0.86rem;
}

.analysis-panel {
  margin-top: 23px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.analysis-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 18px;
  font-size: 0.88rem;
  font-weight: 750;
  list-style: none;
}

.analysis-panel summary::-webkit-details-marker {
  display: none;
}

.summary-arrow {
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform 160ms ease;
}

.analysis-panel[open] .summary-arrow {
  transform: rotate(180deg);
}

.analysis-content {
  padding: 0 18px 19px;
  border-top: 1px solid var(--line);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin: 17px 0;
}

.source-grid div {
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.source-grid dt {
  color: var(--muted);
  font-size: 0.67rem;
}

.source-grid dd {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.analysis-text {
  padding: 15px;
  color: #344054;
  background: #fff;
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.nav-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 17px;
}

.nav-button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  justify-self: start;
  color: #344054;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
}

.nav-button--next {
  justify-self: end;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.nav-button:hover:not(:disabled) {
  border-color: rgba(51, 92, 255, 0.45);
  transform: translateY(-1px);
}

.nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.keyboard-tip {
  color: var(--faint);
  font-size: 0.7rem;
  text-align: center;
}

/* Dialogs and answer card */
.answer-dialog,
.reset-dialog {
  width: min(780px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 36px));
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 90px rgba(18, 28, 50, 0.28);
}

.answer-dialog::backdrop,
.reset-dialog::backdrop {
  background: rgba(20, 29, 48, 0.5);
  backdrop-filter: blur(5px);
}

.dialog-panel,
.reset-panel {
  max-height: inherit;
  overflow-y: auto;
  padding: 27px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.4rem;
  line-height: 1;
}

.card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 11px 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 11px;
  font-size: 0.76rem;
}

.card-summary span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-dot--correct {
  background: var(--success);
}

.status-dot--wrong {
  background: var(--danger);
}

.status-dot--favorite {
  background: var(--amber);
}

.card-filters {
  display: flex;
  gap: 7px;
  margin-top: 17px;
}

.card-filters button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 750;
}

.card-filters button[aria-pressed="true"] {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #d6dfff;
}

.card-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto;
  gap: 11px;
  align-items: end;
  margin: 17px 0;
}

.card-toolbar label > span,
.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.7rem;
}

.card-toolbar select,
.card-toolbar input,
.reset-panel select {
  width: 100%;
  height: 45px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.secondary-button {
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d8e0ff;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
}

.card-number {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  place-items: center;
  color: #5f6b7d;
  background: #f2f4f7;
  border: 1px solid #e2e7ee;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 750;
}

.card-number:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.card-number--correct {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.card-number--wrong {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.card-number--favorite::after {
  position: absolute;
  top: 2px;
  right: 3px;
  color: #ffc85c;
  content: "★";
  font-size: 0.52rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.card-number--current {
  box-shadow: 0 0 0 3px rgba(51, 92, 255, 0.22);
  border-color: var(--primary);
}

.card-empty {
  margin: 22px 0 4px;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

.reset-dialog {
  width: min(470px, calc(100% - 28px));
}

.reset-note {
  margin: 0 0 18px;
  padding: 12px 14px;
  color: #85520d;
  background: var(--amber-soft);
  border-radius: 10px;
  font-size: 0.8rem;
}

.danger-button {
  width: 100%;
  margin-top: 16px;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
}

/* Empty practice state */
.quiz-shell--empty {
  min-height: calc(100vh - 70px);
}

.empty-state {
  max-width: 660px;
  margin: 50px auto 0;
  padding: 58px 38px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 24px;
  font-size: 2rem;
  font-weight: 850;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.2rem);
}

.empty-state > p:not(.eyebrow) {
  max-width: 500px;
  margin: 12px auto 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

/* Search page */
.search-shell {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 60px;
}

.search-hero {
  padding: 0 10px 34px;
  text-align: center;
}

.search-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.search-hero > p:not(.eyebrow) {
  margin: 12px 0 25px;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 9px;
  max-width: 780px;
  margin: 0 auto;
}

.search-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
  padding: 0 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap span {
  color: var(--primary);
  font-size: 1.25rem;
}

.search-form input,
.search-form select,
.search-form button {
  height: 52px;
  border-radius: 13px;
}

.search-form input {
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-form select {
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.search-form button {
  padding: 0 24px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  font-weight: 800;
}

.search-results {
  padding: 27px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.results-heading h2 {
  margin: 0;
  font-size: 1.18rem;
}

.results-heading > span {
  color: var(--muted);
  font-size: 0.74rem;
}

.result-list {
  display: grid;
  gap: 11px;
}

.search-result-card {
  position: relative;
  display: block;
  padding: 18px 130px 18px 19px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.search-result-card:hover {
  border-color: rgba(51, 92, 255, 0.35);
  box-shadow: 0 10px 24px rgba(27, 39, 68, 0.07);
  transform: translateY(-1px);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--primary);
  font-size: 0.67rem;
  font-weight: 750;
}

.result-meta span + span {
  color: var(--faint);
}

.search-result-card h3 {
  margin: 7px 0 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

.search-result-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-link {
  position: absolute;
  top: 50%;
  right: 20px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.result-link i {
  margin-left: 5px;
  font-style: normal;
}

.search-empty {
  padding: 70px 20px;
  color: var(--muted);
  text-align: center;
}

.search-empty > span {
  color: var(--faint);
  font-size: 2.5rem;
}

.search-empty h2 {
  margin: 9px 0 2px;
  color: var(--text);
  font-size: 1.25rem;
}

.search-empty p {
  margin: 0;
  font-size: 0.82rem;
}

.search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.search-suggestions a {
  padding: 6px 12px;
  color: #48546b;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 99px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: auto;
    padding: 62px 12px 40px;
  }

  .overview-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: center;
    min-height: auto;
  }

  .overview-chart {
    margin: 0;
  }

  .overview-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: left;
  }

  .overview-metrics div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  .overview-metrics div + div {
    padding-top: 9px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

@media (max-width: 700px) {
  .landing-shell,
  .topbar-inner,
  .quiz-shell,
  .search-shell {
    width: min(100% - 24px, 1000px);
  }

  .landing-shell {
    padding-top: 17px;
  }

  .landing-nav {
    gap: 14px;
  }

  .hero {
    padding: 48px 4px 31px;
  }

  .hero h1 {
    font-size: clamp(2.05rem, 11vw, 3.1rem);
  }

  .hero-description {
    margin-top: 18px;
    font-size: 0.92rem;
  }

  .overview-card {
    grid-template-columns: 1fr auto;
    padding: 21px;
  }

  .overview-chart {
    width: 120px;
    height: 120px;
  }

  .overview-chart::before {
    width: 90px;
    height: 90px;
  }

  .overview-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    text-align: center;
  }

  .overview-metrics div {
    display: block;
  }

  .overview-metrics div + div {
    padding-top: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .search-strip {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 15px;
  }

  .mode-section,
  .tool-section {
    padding: 23px 16px;
  }

  .section-heading {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .section-note {
    display: none;
  }

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

  .landing-footer {
    display: grid;
    gap: 3px;
    justify-content: center;
    text-align: center;
  }

  .topbar-inner {
    min-height: 62px;
  }

  .back-link,
  .ghost-button {
    width: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
  }

  .back-link > span:last-child,
  .ghost-button > span:last-child,
  .topbar-title > strong {
    display: none;
  }

  .quiz-shell {
    padding-top: 15px;
  }

  .practice-tabs {
    width: 100%;
    justify-content: flex-start;
  }

  .practice-tabs a {
    flex: 1 0 auto;
    text-align: center;
  }

  .progress-panel {
    grid-template-columns: 1fr 1fr;
    gap: 13px 20px;
    padding: 15px;
  }

  .progress-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .question-card {
    padding: 22px 16px;
    border-radius: 20px;
  }

  .question-text {
    margin-bottom: 22px;
    font-size: 1.08rem;
    line-height: 1.68;
  }

  .option-row {
    grid-template-columns: 38px minmax(0, 1fr) 22px;
    gap: 10px;
    min-height: 58px;
    padding: 9px 11px;
  }

  .option-key {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .option-text {
    font-size: 0.9rem;
  }

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

  .nav-actions {
    grid-template-columns: 1fr 1fr;
    gap: 11px;
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 10;
  }

  .nav-button {
    width: 100%;
    min-height: 51px;
    box-shadow: var(--shadow-sm);
  }

  .keyboard-tip {
    display: none;
  }

  .dialog-panel,
  .reset-panel {
    padding: 20px 16px;
  }

  .card-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .card-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
  }

  .empty-state {
    margin-top: 30px;
    padding: 42px 22px;
  }

  .search-shell {
    padding-top: 35px;
  }

  .search-form {
    grid-template-columns: 1fr auto;
  }

  .search-input-wrap {
    grid-column: 1 / -1;
  }

  .search-results {
    padding: 17px 13px;
  }

  .search-result-card {
    padding: 16px;
  }

  .result-link {
    position: static;
    display: inline-block;
    margin-top: 10px;
    transform: none;
  }
}

@media (max-width: 480px) {
  .brand-subtitle,
  .landing-nav > a {
    display: none;
  }

  .hero-actions,
  .hero-actions > a {
    width: 100%;
  }

  .overview-card {
    gap: 12px;
  }

  .overview-topline {
    display: grid;
  }

  .search-strip form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .search-strip input {
    padding: 0 11px;
  }

  .search-strip button {
    padding: 0 14px;
  }

  .mode-card {
    padding: 18px;
  }

  .mode-card-heading {
    grid-template-columns: auto 1fr;
  }

  .accuracy-pill {
    display: none;
  }

  .mode-stats {
    gap: 7px;
  }

  .tool-card {
    grid-template-columns: 1fr;
  }

  .question-heading {
    align-items: flex-start;
  }

  .question-labels {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .favorite-button > span:last-child {
    display: none;
  }

  .favorite-button {
    width: 38px;
    padding: 0;
    justify-content: center;
    font-size: 1rem;
  }

  .question-context span + span::before {
    display: none;
  }

  .card-filters {
    overflow-x: auto;
  }

  .search-form {
    grid-template-columns: 1fr 92px;
  }

  .search-form button {
    padding: 0 16px;
  }

  .results-heading {
    display: block;
  }

  .results-heading > span {
    display: block;
    margin-top: 4px;
  }
}

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

@media print {
  .topbar,
  .practice-tabs,
  .nav-actions,
  .favorite-form,
  .answer-dialog {
    display: none !important;
  }

  body,
  .question-card {
    background: #fff;
    box-shadow: none;
  }
}
