:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --primary: #1f4e8c;
  --primary-dark: #173d70;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ee;
  --success: #2f855a;
  --warning: #b7791f;
  --error: #b42318;
  --shadow: 0 12px 32px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(31, 78, 140, .35); outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 48px);
  background: rgba(255,255,255,.95);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--text); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.nav a { color: var(--muted); font-weight: 600; font-size: 14px; }
.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 48px; }
.footer { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.hero {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  align-items: center;
  gap: 40px;
}
.hero h1, .page-title h1, .auth-panel h1 { margin: 0 0 12px; font-size: clamp(34px, 5vw, 58px); line-height: 1.05; }
.hero p { max-width: 650px; color: var(--muted); font-size: 18px; }
.eyebrow { margin: 0 0 10px; color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: #fff; color: var(--primary); }
.button.danger { background: var(--error); border-color: var(--error); }
.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.button:disabled { opacity: .62; cursor: wait; }

.exam-preview, .panel, .practice-card, .auth-panel, .review-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.exam-preview { padding: 28px; }
.exam-preview .question { font-size: 24px; color: var(--text); }
.timer-pill { display: inline-flex; padding: 8px 12px; border-radius: 6px; background: #eef4ff; color: var(--primary); font-weight: 900; }
.auth-panel, .panel { padding: 26px; }
.auth-panel { max-width: 520px; margin: 28px auto; }
.narrow { max-width: 720px; margin-inline: auto; }

.form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; color: var(--text); }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 12px 13px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
textarea { resize: vertical; }
.notice { padding: 12px 14px; border-radius: 6px; margin: 12px 0; font-weight: 700; }
.notice.error { color: var(--error); background: #fff1f0; border: 1px solid #ffd6d2; }
.notice.success { color: var(--success); background: #edf9f2; border: 1px solid #ccebd8; }
.status-ok { color: var(--success); font-weight: 900; }
.status-bad { color: var(--error); font-weight: 900; }
.muted { color: var(--muted); }

.page-title { margin-bottom: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 28px; }
.cards.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.practice-card { padding: 24px; }
.practice-card h2, .panel h2, .review-card h2 { margin-top: 0; }
.practice-card p { color: var(--muted); min-height: 48px; }
.practice-card > span { display: block; margin-bottom: 18px; font-weight: 800; color: var(--primary); }
.options { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.filters > * { width: auto; }
.pagination { display: flex; justify-content: center; gap: 18px; margin-top: 18px; }
.profile-list { display: grid; grid-template-columns: 220px 1fr; gap: 12px 18px; }
.profile-list dt { color: var(--muted); font-weight: 800; }
.profile-list dd { margin: 0; }
.profile-list.compact { grid-template-columns: 150px 1fr; }
.review-list { display: grid; gap: 18px; }
.review-card { padding: 24px; }
.passage-result { font-size: 17px; line-height: 1.7; }
.muted-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.score-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.score-strip span { padding: 8px 10px; border-radius: 6px; background: #eef4ff; font-weight: 700; }
.bar-chart { height: 240px; display: flex; align-items: end; gap: 10px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; min-width: 20px; background: var(--primary); border-radius: 5px 5px 0 0; position: relative; }
.bar span { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font-size: 11px; color: var(--muted); text-align: center; width: 70px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (max-width: 900px) {
  .hero, .cards.two { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .options { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .container { width: min(100% - 22px, 1160px); padding-top: 22px; }
  .hero { min-height: auto; }
  .hero h1, .page-title h1, .auth-panel h1 { font-size: 36px; }
  .stat-grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .profile-list, .profile-list.compact { grid-template-columns: 1fr; gap: 4px; }
  .filters > * { width: 100%; }
}
