:root {
  --ink: #17202a;
  --muted: #64748b;
  --line: #d9e4e7;
  --bg: #f2f8f7;
  --panel: #ffffff;
  --teal: #0f766e;
  --blue: #2563eb;
  --orange: #f97316;
  --green: #15803d;
  --red: #b91c1c;
  --shadow: 0 18px 45px rgba(15, 118, 110, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}
a { color: var(--teal); text-decoration: none; font-weight: 700; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}
.nav {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}
.nav a {
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav a:hover, .nav-cta { background: #e3f4f1; }
.lang-form select {
  min-width: 118px;
  height: 38px;
  padding: 6px 8px;
  font-size: 14px;
}
.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}
.footer {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}
.hero, .auth-wrap, .dashboard-head {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 28px;
  align-items: center;
}
.hero {
  min-height: 74vh;
}
h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
}
h2, h3 { margin-top: 0; }
.eyebrow {
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.hero p, .auth-copy p, .dashboard-head p { color: var(--muted); font-size: 18px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(23, 32, 42, .14); }
.btn-primary { background: var(--orange); color: white; }
.btn-ghost { background: #dff3ef; color: var(--teal); }
.hero-board, .panel, .domain-card, .question-card, .review-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.hero-board {
  display: grid;
  gap: 14px;
  padding: 28px;
}
.hero-board span, .hero-board strong {
  display: block;
  padding: 18px;
  border-radius: 8px;
  background: #eef8f6;
}
.hero-board strong { background: var(--teal); color: #fff; font-size: 28px; }
.panel { padding: 22px; }
.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 92px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; line-height: 1.35; }
.check input { width: auto; margin-top: 3px; }
.muted { color: var(--muted); }
.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.alert-success { border-color: #86efac; color: var(--green); }
.alert-danger { border-color: #fecaca; color: var(--red); }
.alert-warning { border-color: #fed7aa; color: #9a3412; }
.stats-grid, .domain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.stat {
  display: block;
  color: var(--teal);
  font-size: 38px;
  font-weight: 900;
}
.domain-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.domain-card:hover { transform: translateY(-3px); box-shadow: 0 20px 44px rgba(37, 99, 235, .14); }
.badge {
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}
.price { font-size: 22px; color: var(--orange); font-weight: 900; }
.test-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.test-top h1 { font-size: 34px; }
.test-meters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.test-meters span, .result-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ecf7f5;
  color: var(--teal);
  font-weight: 900;
}
.test-meters .timer-warn {
  background: #fff7ed;
  color: #c2410c;
}
.progress {
  position: sticky;
  top: 64px;
  height: 10px;
  border-radius: 999px;
  background: #dceae8;
  overflow: hidden;
  margin-bottom: 18px;
  z-index: 5;
}
.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width .2s ease;
}
.test-form { display: grid; gap: 16px; }
.quiz-view-control {
  max-width: 360px;
}
.quiz-nav-panel {
  position: sticky;
  top: 82px;
  z-index: 4;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
}
.quiz-nav-top, .quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#questionStepText {
  font-weight: 900;
  color: var(--teal);
}
.question-palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  gap: 8px;
}
.question-palette button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.question-palette button.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px var(--teal);
}
.question-palette button.answered {
  background: #ecfdf5;
  color: var(--green);
}
.question-card { padding: 20px; }
.quiz-paged .question-card[hidden] { display: none; }
.question-card legend {
  display: flex;
  gap: 8px;
  font-size: 18px;
  font-weight: 900;
  padding: 0 0 12px;
}
.q-number { color: var(--teal); flex: 0 0 auto; }
.dual-text, .option-copy {
  display: grid;
  gap: 5px;
}
.english-line {
  display: block;
  color: var(--muted);
  font-size: .92em;
  font-weight: 600;
  line-height: 1.45;
}
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefe;
}
.option input { width: auto; margin-top: 3px; }
.option-copy { flex: 1; }
.sticky-submit {
  position: sticky;
  bottom: 14px;
  justify-self: end;
}
.quiz-actions {
  position: sticky;
  bottom: 12px;
  z-index: 6;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
}
.result-hero {
  text-align: center;
  padding: 36px 18px;
}
.result-hero h1 { color: var(--teal); font-size: 76px; }
.result-hero.failed h1 { color: var(--red); }
.result-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.result-hero.failed .result-meta span {
  background: #fef2f2;
  color: var(--red);
}
.result-hero.passed .result-meta span {
  background: #ecfdf5;
  color: var(--green);
}
.review-list { display: grid; gap: 14px; }
.review-card { padding: 18px; border-left: 6px solid var(--line); }
.review-card.ok { border-left-color: var(--green); }
.review-card.bad { border-left-color: var(--red); }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.analytics-panel { margin-bottom: 16px; }
.trend-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 220px;
  padding-top: 14px;
}
.trend-point {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 6px;
  align-items: end;
  min-height: 190px;
  text-align: center;
}
.trend-bar {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: 8px 8px 0 0;
  background: var(--orange);
}
.trend-point strong { color: var(--teal); font-size: 13px; }
.trend-point small { color: var(--muted); }
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.weak-list, .challenge-list {
  display: grid;
  gap: 12px;
}
.weak-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 1fr auto;
  gap: 10px;
  align-items: center;
}
.weak-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}
.weak-row meter {
  width: 100%;
  height: 14px;
}
.challenge-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefe;
}
.challenge-item p {
  margin: 6px 0 0;
  color: var(--muted);
}
.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #ecf7f5; color: var(--teal); }
.promo-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
.admin-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.admin-links a {
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.form-grid .wide { grid-column: 1 / -1; }

@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { width: 100%; padding-bottom: 2px; }
  .lang-form { margin-left: auto; }
  .hero, .auth-wrap, .dashboard-head { grid-template-columns: 1fr; min-height: auto; }
  h1 { font-size: 38px; }
  .stats-grid, .domain-grid, .admin-links { grid-template-columns: 1fr; }
  .promo-form, .form-grid { grid-template-columns: 1fr; }
  .test-top { align-items: flex-start; flex-direction: column; }
  .test-meters { justify-content: flex-start; width: 100%; }
  .sticky-submit { width: 100%; }
  .quiz-nav-panel { top: 118px; }
  .quiz-nav-top, .quiz-actions { flex-wrap: wrap; }
  .quiz-actions .btn { flex: 1 1 120px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .weak-row { grid-template-columns: 1fr; }
  .shell { width: min(100% - 24px, 1120px); padding-top: 18px; }
}
