﻿:root {
  --lavender-dark: #6f4f91;
  --lavender: #9270b2;
  --lavender-soft: #eee4f6;
  --lavender-pale: #faf6fd;
  --mint: #edf7e8;
  --mint-strong: #74a86f;
  --pink: #faeaf1;
  --pink-strong: #c77b9f;
  --yellow: #fff4c9;
  --yellow-strong: #bd8a23;
  --ink: #3d3246;
  --muted: #776b80;
  --line: #e2d7e9;
  --paper: #fffefe;
  --bg: #f8f4fb;
  --good: #3f7f51;
  --good-bg: #e9f6ea;
  --bad: #a14f67;
  --bad-bg: #fcecf1;
  --shadow: 0 14px 34px rgba(95, 69, 123, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 18%, rgba(236, 220, 248, .75), transparent 24rem),
    radial-gradient(circle at 92% 46%, rgba(231, 246, 225, .7), transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}
button, input { font: inherit; }
button { cursor: pointer; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 12%, rgba(255,255,255,.42) 0 8%, transparent 8.3%),
    radial-gradient(circle at 94% 80%, rgba(231,247,224,.72) 0 16%, transparent 16.4%),
    linear-gradient(135deg, #e9ddf5 0%, #f6e8f0 55%, #ecf6e7 100%);
  color: var(--ink);
  padding: 48px 20px 42px;
  border-bottom: 1px solid #ded0e8;
}
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 290px);
  gap: 30px;
  align-items: center;
}
.hero__inner, main { max-width: 1060px; margin: 0 auto; }
.hero__copy { min-width: 0; }
.hero__art { display: grid; place-items: center; align-self: end; }
.hero__mascot { display: block; width: min(100%, 270px); max-height: 280px; object-fit: contain; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--lavender-dark);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  font-weight: 800;
}
h1 { max-width: 780px; margin: 0; color: #523b68; font-size: clamp(32px, 6vw, 58px); line-height: 1.06; letter-spacing: -.035em; }
.hero__lead { max-width: 670px; margin: 18px 0 30px; color: #665873; font-size: 18px; }
.summary { display: flex; gap: 12px; flex-wrap: wrap; }
.summary div {
  min-width: 126px;
  padding: 12px 16px;
  border: 1px solid rgba(111,79,145,.18);
  border-radius: 15px;
  background: rgba(255,255,255,.68);
  box-shadow: 0 8px 22px rgba(104, 78, 130, .06);
  backdrop-filter: blur(8px);
}
.summary strong { display: block; color: var(--lavender-dark); font-size: 24px; line-height: 1.1; }
.summary span { color: var(--muted); font-size: 13px; }
.progress-shell { height: 8px; margin-top: 24px; overflow: hidden; background: rgba(111,79,145,.13); border-radius: 10px; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--lavender), #8cbf7d); border-radius: inherit; transition: width .35s ease; }

main { padding: 34px 20px 60px; }
.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}
.how > div { display: flex; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 7px 22px rgba(102,74,126,.05); }
.how > div:nth-child(1) { background: var(--lavender-pale); }
.how > div:nth-child(2) { background: var(--mint); border-color: #d5e9cf; }
.how > div:nth-child(3) { background: var(--pink); border-color: #efd4df; }
.how p { margin: 0; font-size: 14px; }
.step-number {
  display: grid; place-items: center; flex: 0 0 31px; height: 31px;
  border-radius: 50%; background: #fff; color: var(--lavender-dark); font-weight: 800;
  box-shadow: 0 4px 11px rgba(96,68,121,.1);
}

.level-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.level-tab {
  padding: 15px 12px; border: 1px solid var(--line); border-radius: 15px;
  background: rgba(255,255,255,.88); color: var(--lavender-dark); font-weight: 800; transition: .2s ease;
}
.level-tab:nth-child(2) { background: #f2f8ee; border-color: #d5e7ce; }
.level-tab:nth-child(3) { background: #fdf0f5; border-color: #edd1dc; }
.level-tab span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.level-tab:hover { transform: translateY(-1px); border-color: #bca7cf; }
.level-tab.active { color: #fff; background: linear-gradient(135deg, #76559a, #9b75b6); border-color: #76559a; box-shadow: var(--shadow); }
.level-tab.active span { color: #f3eafa; }

.level-intro {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  min-height: 116px;
  padding: 18px 20px; margin-bottom: 16px; border-radius: 18px;
  background: linear-gradient(120deg, var(--lavender-soft), var(--mint));
  border: 1px solid #dacbe7;
}
.level-intro::after {
  content: "";
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  margin-left: auto;
  background: url("../assets/characters/mascot-thinking-broccoli-loupe.png") center/contain no-repeat;
}
.level-intro h2 { margin: 0 0 4px; color: var(--lavender-dark); font-size: 21px; }
.level-intro p { margin: 0; color: var(--muted); font-size: 14px; }
.level-score { white-space: nowrap; color: var(--lavender-dark); font-weight: 800; }

.questions { display: grid; gap: 14px; }
.question {
  position: relative;
  background: var(--paper); border: 1px solid var(--line); border-radius: 19px;
  padding: 22px; box-shadow: 0 7px 24px rgba(85, 61, 105, .055);
}
.question:nth-child(3n+1) { background: linear-gradient(135deg, #fff, #fbf7fd); }
.question:nth-child(3n+2) { background: linear-gradient(135deg, #fff, #f6fbf3); border-color: #dcebd6; }
.question:nth-child(3n) { background: linear-gradient(135deg, #fff, #fff6f9); border-color: #eedce4; }
.question.correct { border-color: #a8cfa8; box-shadow: 0 0 0 3px rgba(83,145,89,.08); }
.question.incorrect { border-color: #e2afbe; }
.question__top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.question__top > div { min-width: 0; order: 1; }
.question-mascot { order: 2; flex: 0 0 70px; width: 70px; height: 70px; margin: -12px -4px -8px 4px; object-fit: contain; }
.question-mascot[hidden] { display: none; }
.question__number {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px;
  color: var(--lavender-dark); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #cfc4d7; }
.correct .status-dot { background: var(--good); }
.incorrect .status-dot { background: var(--bad); }
.question h3 { margin: 0 0 8px; color: #58406f; font-size: 18px; }
.question__text { margin: 0 0 18px; font-size: 16px; }
.formula { font-family: "Cambria Math", Georgia, serif; font-size: 1.08em; }
.answer-row { display: flex; gap: 10px; align-items: stretch; }
.answer-input {
  min-width: 0; flex: 1; padding: 12px 14px; border: 1.5px solid #c9bad5; border-radius: 12px;
  background: rgba(255,255,255,.9); color: var(--ink); outline: none; transition: .2s ease;
}
.answer-input:focus { border-color: var(--lavender); box-shadow: 0 0 0 3px rgba(143,107,178,.14); background: #fff; }
.button { padding: 12px 17px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #77569a, #9b74b8); color: #fff; font-weight: 800; }
.button:hover { filter: brightness(.97); }
.button--ghost { background: #fff; color: var(--lavender-dark); border: 1px solid rgba(255,255,255,.7); }
.hint-button { margin-top: 11px; padding: 5px 0; border: 0; background: none; color: var(--yellow-strong); font-size: 14px; font-weight: 800; }
.hint, .feedback {
  display: none; margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 14px;
}
.hint.visible { display: block; background: var(--yellow); color: #705419; }
.feedback.visible { display: block; }
.feedback.good { background: var(--good-bg); color: #2e6840; }
.feedback.bad { background: var(--bad-bg); color: #8d4058; }
.mini-solution { margin-top: 6px; opacity: .92; }

.finish-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 22px;
  margin-top: 28px; padding: 24px; border-radius: 20px;
  background: linear-gradient(135deg, #76559a, #9b72ad); color: #fff;
  box-shadow: var(--shadow);
}
.finish-card h2 { margin: 0 0 5px; }
.finish-card p { margin: 0; color: #f3eafa; }
.finish-card .eyebrow { margin-bottom: 4px; color: #fff2c4; }
.finish-mascot { display: block; width: 116px; height: 116px; object-fit: contain; }
footer { padding: 24px 20px 40px; text-align: center; color: var(--muted); font-size: 13px; }

.site-back {
  display: inline-flex;
  margin-bottom: 1.25rem;
  color: var(--lavender-dark);
  font-weight: 800;
  text-decoration: none;
}
.site-back:hover,
.site-back:focus-visible { text-decoration: underline; }

@media (max-width: 720px) {
  .hero { padding-top: 36px; }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__art { justify-content: end; margin-top: -20px; }
  .hero__mascot { width: 170px; max-height: 170px; }
  .how { grid-template-columns: 1fr; }
  .level-tabs { grid-template-columns: 1fr; }
  .level-intro { align-items: flex-start; flex-wrap: wrap; }
  .level-intro::after { flex-basis: 72px; width: 72px; height: 72px; }
  .finish-card { grid-template-columns: 1fr auto; }
  .finish-copy { grid-column: 1 / -1; }
  .answer-row { flex-direction: column; }
  .button { width: 100%; }
}

@media (max-width: 480px) {
  .question { padding: 18px; }
  .question-mascot { flex-basis: 58px; width: 58px; height: 58px; }
  .level-score { white-space: normal; }
  .finish-card { grid-template-columns: 1fr; }
  .finish-mascot { justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
