:root {
  --ink: #343145;
  --muted: #77728a;
  --paper: #fff8ef;
  --paper-soft: #fffdf9;
  --card: #fff;
  --line: #eadfd3;
  --coral: #e9786b;
  --coral-light: #ffebe6;
  --orange: var(--coral);
  --lavender: #8678d8;
  --lavender-light: #efedff;
  --blue: #5477d5;
  --blue-light: #edf2ff;
  --teal: #4eaaa0;
  --green: #3b966c;
  --red: #bd5b62;
  --shadow: 0 14px 35px rgba(91, 70, 105, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.site-header {
  height: 76px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, .94);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px 13px 13px 4px;
  display: grid;
  place-items: center;
  background: var(--lavender);
  color: white;
  font-size: 12px;
  transform: rotate(-3deg);
}
.site-header nav { display: flex; height: 76px; gap: 28px; }
.nav-link {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.nav-link.active { color: var(--ink); border-bottom: 3px solid var(--coral); }
main { min-height: calc(100vh - 76px); }

.hero {
  max-width: 1200px;
  margin: auto;
  padding: 46px 24px 46px;
}
.eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .16em;
  color: var(--coral);
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 78px);
  line-height: .98;
  letter-spacing: -.035em;
  font-weight: 500;
}
h1 span { color: var(--coral); }
.hero-copy { max-width: 520px; color: var(--muted); font-size: 18px; }
.hero-stats {
  background: var(--lavender);
  color: white;
  border-radius: 26px 26px 26px 8px;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  box-shadow: 8px 8px 0 var(--lavender-light);
  max-width: 330px;
}
.hero-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid rgba(255,255,255,.25);
}
.hero-stats div:last-child { border: 0; }
.hero-stats strong { font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.hero-stats span { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }

.catalog-section, .progress-section {
  max-width: 1200px;
  margin: auto;
  padding: 46px 24px 68px;
}
.catalog-section { border-top: 2px dashed var(--line); }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-heading h2 {
  font-family: Georgia, serif;
  font-size: 36px;
  font-weight: 500;
  margin-bottom: 0;
}
.muted { color: var(--muted); font-size: 14px; }
.catalog { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.test-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px 24px 24px 8px;
  padding: 28px;
  overflow: hidden;
  box-shadow: 0 4px 0 rgba(230, 217, 205, .5);
  transition: .2s transform, .2s box-shadow;
}
.test-card:hover { transform: translateY(-4px) rotate(-.2deg); box-shadow: var(--shadow); }
.test-card:before {
  content: "";
  position: absolute;
  left: 24px;
  top: 0;
  width: 58px;
  height: 7px;
  border-radius: 0 0 8px 8px;
  background: var(--accent, var(--coral));
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.category { font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.status-pill { padding: 6px 12px; border-radius: 999px; background: var(--paper); font-size: 11px; font-weight: 800; }
.status-pill.complete { background: #def4e8; color: var(--green); }
.test-card h3 { font-family: Georgia, serif; font-size: 29px; font-weight: 500; margin: 14px 0 8px; }
.test-card p { min-height: 48px; color: var(--muted); }
.card-meta { display: flex; gap: 20px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 18px; margin-top: 22px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.mini-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.mini-progress-track { width: 90px; height: 6px; background: #eee7df; border-radius: 8px; overflow: hidden; }
.mini-progress-track span { height: 100%; display: block; background: var(--accent, var(--coral)); }
.button {
  border: 0;
  border-radius: 12px 12px 12px 4px;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.button.orange { background: var(--coral); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.progress-section { border-top: 2px dashed var(--line); }
.progress-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.progress-card { padding: 22px; background: white; border: 1px solid var(--line); border-radius: 20px 20px 20px 7px; }
.progress-card-head { display: flex; justify-content: space-between; align-items: center; }
.progress-card h3 { font-size: 17px; margin-bottom: 5px; }
.best-score-block { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.best-score-block span { color: var(--muted); font-size: 12px; }
.best-score { font-family: Georgia, serif; font-size: 28px; color: var(--coral); }
.history-bars { display: flex; align-items: end; gap: 6px; height: 58px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.history-bars span { flex: 1; max-width: 28px; background: var(--lavender-light); border-radius: 8px 8px 2px 2px; min-height: 3px; }
.history-bars span:last-child { background: var(--coral); }
.empty-state { grid-column: 1/-1; text-align: center; padding: 48px; border: 2px dashed var(--line); border-radius: 18px; color: var(--muted); }
footer {
  min-height: 110px;
  padding: 0 clamp(20px, 5vw, 72px);
  background: var(--ink);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-brand .brand-mark { background: #ffd9ad; color: var(--ink); }
footer p { margin: 0; color: #cfccd8; font-size: 13px; }

.test-app { max-width: 960px; margin: auto; padding: 40px 24px 80px; }
.intro-navigation { max-width: 680px; margin: 0 auto 16px; }
.back-to-tests { background: white; border: 1px solid var(--line); box-shadow: 0 3px 0 rgba(230, 217, 205, .55); }
.test-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.timer { font-variant-numeric: tabular-nums; padding: 8px 14px; border-radius: 999px; background: white; border: 1px solid var(--line); font-weight: 800; }
.timer.danger { color: var(--red); }
.test-layout { display: grid; grid-template-columns: 180px 1fr; gap: 24px; }
.question-rail { background: white; border: 1px solid var(--line); border-radius: 20px 20px 20px 7px; padding: 16px; height: max-content; }
.rail-title { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.question-dots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.question-dot { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 12px; }
.question-dot.current { background: var(--lavender); color: white; border-color: var(--lavender); }
.question-dot.answered { border-color: #b8dfcc; background: #edf8f2; color: var(--green); }
.question-panel { background: white; border: 1px solid var(--line); border-radius: 24px 24px 24px 8px; padding: clamp(24px, 5vw, 44px); }
.question-kicker { color: var(--coral); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.question-panel h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; margin: 14px 0 28px; }
.options { display: grid; gap: 10px; margin-bottom: 30px; }
.option { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; }
.option:hover { background: var(--paper-soft); }
.option.selected { border-color: var(--lavender); box-shadow: inset 0 0 0 1px var(--lavender); background: var(--lavender-light); }
.option input { accent-color: var(--lavender); }
.text-answer { width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 14px; font-size: 16px; }
.text-answer:focus { outline: 3px solid var(--lavender-light); border-color: var(--lavender); }
.question-actions { display: flex; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 22px; }
.intro-panel { max-width: 680px; margin: 30px auto; background: white; border: 1px solid var(--line); border-radius: 26px 26px 26px 10px; padding: clamp(28px, 6vw, 56px); }
.intro-panel h1 { font-size: clamp(42px, 8vw, 64px); }
.intro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0; }
.intro-stat { background: var(--paper); padding: 16px; border-radius: 14px; }
.intro-stat span { display: block; color: var(--muted); font-size: 12px; }
.intro-stat strong { font-family: Georgia, serif; font-size: 22px; }
.results { max-width: 760px; margin: 30px auto; }
.score-card { background: var(--lavender); color: white; border-radius: 26px 26px 26px 10px; padding: 42px; display: grid; grid-template-columns: 170px 1fr; align-items: center; }
.score-ring { width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(var(--coral) var(--score), rgba(255,255,255,.25) 0); display: grid; place-items: center; }
.score-ring:before { content: ""; width: 118px; height: 118px; border-radius: 50%; background: var(--lavender); grid-area: 1/1; }
.score-ring strong { grid-area: 1/1; font-family: Georgia, serif; font-size: 38px; z-index: 1; }
.score-copy h1 { font-size: 46px; margin-bottom: 8px; }
.score-copy .question-kicker { color: #ffe2dc; }
.result-list { background: white; border: 1px solid var(--line); border-radius: 20px; margin-top: 18px; padding: 8px 24px; }
.result-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.result-row:last-child { border: 0; }
.result-row.incorrect { padding-top: 18px; padding-bottom: 18px; }
.result-answer { display: grid; gap: 8px; }
.answer-line {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.answer-line strong { color: var(--ink); overflow-wrap: anywhere; }
.correct-answer {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4dede;
}
.correct-answer strong { color: var(--black); }
.result-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); }
.result-icon.wrong { background: var(--red); }
.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.error { text-align: center; padding: 70px 20px; }

@media (max-width: 760px) {
  .site-header { padding: 0 20px; }
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-stats { width: 100%; }
  .catalog, .progress-grid { grid-template-columns: 1fr; }
  .test-layout { grid-template-columns: 1fr; }
  .question-rail { display: none; }
  .section-heading { align-items: flex-start; }
  .hero h1 { font-size: 54px; }
  .hero-stats strong { font-size: 25px; }
  .score-card { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .score-copy h1 { font-size: 38px; }
  footer { min-height: 0; height: auto; padding: 30px 20px; gap: 18px; }
}

@media (max-width: 430px) {
  .hero-stats div { padding: 3px 10px; }
  .hero h1 { font-size: 46px; }
  .section-heading h2 { font-size: 30px; }
  .test-card { padding: 24px 20px; }
  .intro-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .card-footer { align-items: stretch; flex-direction: column; }
}
