:root {
  --ink: #172554;
  --muted: #5d6e8a;
  --purple: #5b55e7;
  --purple-dark: #403bc4;
  --green: #15977f;
  --pink: #e95578;
  --orange: #e07832;
  --yellow: #ffd65a;
  --blue: #4b83de;
  --line: #c9dff0;
  --shadow: rgba(74, 91, 132, .13);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 214, 90, .46) 0 72px, transparent 74px),
    radial-gradient(circle at 92% 14%, rgba(70, 198, 171, .26) 0 108px, transparent 110px),
    radial-gradient(circle at 86% 92%, rgba(145, 119, 237, .18) 0 145px, transparent 147px),
    linear-gradient(155deg, #f9fdff 0%, #eaf6ff 55%, #f1edff 100%);
  background-attachment: fixed;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: auto;
  padding: 25px 18px 42px;
}

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

.brand { display: flex; align-items: center; gap: 14px; }
.brand small, .eyebrow {
  color: #635ead;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.brand h1 {
  margin: 2px 0 0;
  font-size: clamp(1.18rem, 4vw, 1.78rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  background: linear-gradient(145deg, #6d67f2, #5049d8);
  border: 2px solid #423cc6;
  border-radius: 19px;
  box-shadow: 0 8px 0 #3d37bd;
  font-size: 1.13rem;
  font-weight: 900;
  transform: rotate(-3deg);
}

.badge {
  flex: none;
  padding: 9px 14px;
  color: #075a4d;
  background: #ddfff6;
  border: 2px solid #8cdec9;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(21, 151, 127, .16);
  font-size: .8rem;
  font-weight: 900;
}

.panel {
  position: relative;
  padding: clamp(25px, 5vw, 46px);
  overflow: hidden;
  background: rgba(255,255,255,.96);
  border: 2px solid var(--line);
  border-radius: 31px;
  box-shadow: 0 12px 0 var(--shadow), 0 25px 60px rgba(71, 91, 140, .09);
  text-align: center;
}

.home-panel::before,
.home-panel::after {
  position: absolute;
  z-index: 0;
  content: "★";
  font-size: 3.2rem;
  line-height: 1;
  opacity: .14;
  transform: rotate(-13deg);
}
.home-panel::before { top: 25px; left: 34px; color: #e6b31e; }
.home-panel::after { right: 31px; bottom: 28px; color: var(--purple); transform: rotate(15deg); }
.home-panel > * { position: relative; z-index: 1; }

.panel h2, .future-card h2 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.lead {
  max-width: 625px;
  margin: 17px auto 29px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.58;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.category {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 25px;
  align-items: center;
  gap: 13px;
  min-height: 91px;
  padding: 14px 16px;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #f4f9ff);
  border: 2px solid #cfe0f1;
  border-radius: 21px;
  box-shadow: 0 6px 0 #c3d6e6;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.category:hover { transform: translateY(-3px); border-color: #aebfef; box-shadow: 0 9px 0 #c3d6e6; }
.category:focus-visible { outline: 4px solid rgba(91, 85, 231, .23); outline-offset: 3px; }
.category .mark {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  color: #fff;
  background: var(--purple);
  border-radius: 17px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.12);
  font-size: 1.02rem;
  font-weight: 900;
}
.category strong { display: block; font-size: 1.06rem; }
.category small { display: block; margin-top: 4px; color: #6a7991; font-size: .86rem; }
.category b { color: #8b98ad; font-size: 1.75rem; line-height: 1; }
.category[data-category="all"] .mark { color: #765300; background: var(--yellow); }
.category[data-category="rz"] .mark { background: var(--pink); }
.category[data-category="h"] .mark { background: var(--green); }
.category[data-category="ae"] .mark { background: var(--orange); }
.category[data-category="cap"] .mark { background: #8d54cc; }

.hidden { display: none !important; }

.back {
  padding: 9px 12px;
  color: #455775;
  background: rgba(255,255,255,.7);
  border: 0;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
.back:hover { background: #eef4fb; }
.panel > .back { display: block; margin: -14px 0 14px; }

.rule-box {
  max-width: 690px;
  margin: 25px auto 28px;
  padding: 22px 23px;
  color: #374966;
  background: linear-gradient(145deg, #f6f5ff, #eef7ff);
  border: 2px solid #cbc9ff;
  border-radius: 20px;
  box-shadow: 0 6px 0 rgba(91,85,231,.1);
  font-size: 1.02rem;
  line-height: 1.62;
  text-align: left;
}

.primary, .secondary {
  min-height: 54px;
  padding: 0 21px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
}
.primary {
  color: #fff;
  background: linear-gradient(145deg, #6862ef, var(--purple));
  border: 2px solid #4b45d3;
  box-shadow: 0 6px 0 #413bc7;
}
.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #413bc7; }
.secondary { color: #354767; background: #fff; border: 2px solid #bdcee0; }

.progress-row {
  display: flex;
  justify-content: space-between;
  margin: 0 4px 9px;
  color: #4f6080;
  font-size: .92rem;
  font-weight: 900;
}
.progress {
  height: 13px;
  margin-bottom: 19px;
  overflow: hidden;
  background: #fff;
  border: 2px solid #c5dcef;
  border-radius: 99px;
}
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #46c6ab, var(--yellow)); border-radius: inherit; transition: width .25s ease; }

.question-panel { min-height: 470px; }
.word {
  margin: 32px auto 19px;
  font-size: clamp(2.25rem, 10vw, 4.65rem);
  font-weight: 900;
  letter-spacing: .075em;
  line-height: 1.15;
}
.missing {
  display: inline-block;
  min-width: .74em;
  color: #8a5f00;
  border-bottom: 7px solid var(--yellow);
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  max-width: 550px;
  margin: 28px auto;
}
.answer {
  height: 76px;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #f1f8ff);
  border: 2px solid #c7dbea;
  border-radius: 19px;
  box-shadow: 0 6px 0 #bfd2e1;
  font-size: 1.55rem;
  font-weight: 900;
  cursor: pointer;
}
.answer:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 #bfd2e1; }
.answer.correct { color: #075a4d; background: #dffff6; border-color: #43b99f; box-shadow: 0 6px 0 #26927a; }
.answer.wrong { color: #81223a; background: #ffe9ee; border-color: #ea718e; box-shadow: 0 6px 0 #ca4767; }

.write-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 11px;
  max-width: 590px;
  margin: 29px auto;
  text-align: left;
}
.write-form label { grid-column: 1 / -1; color: #354767; font-weight: 900; }
.write-form input {
  height: 58px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  border: 2px solid #afc9dd;
  border-radius: 15px;
  outline: none;
  font-size: 1.12rem;
  font-weight: 800;
}
.write-form input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(91,85,231,.13); }

.feedback {
  max-width: 610px;
  margin: 22px auto 0;
  padding: 19px 20px;
  color: #075a4d;
  background: linear-gradient(145deg, #effffb, #ddfff6);
  border: 2px solid #8cdec9;
  border-radius: 19px;
  box-shadow: 0 6px 0 rgba(21,151,127,.12);
  line-height: 1.5;
}
.feedback.bad { color: #734124; background: #fff1e7; border-color: #efc29f; box-shadow: 0 6px 0 rgba(224,120,50,.12); }
.feedback p { margin: 7px 0 0; }
.feedback button { margin-top: 13px; }
.centered { display: block; margin: 19px auto; }

.result-panel { max-width: 690px; margin: 52px auto; }
.trophy { font-size: 5.2rem; filter: drop-shadow(0 7px 0 rgba(102,78,0,.14)); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 13px; }

.future-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr);
  gap: 28px;
  margin-top: 32px;
  padding: clamp(24px, 5vw, 36px);
  color: #fff;
  background:
    radial-gradient(circle at 94% 16%, rgba(255,214,90,.22) 0 76px, transparent 78px),
    linear-gradient(135deg, #403bc4, #645fe9);
  border: 2px solid #3933b6;
  border-radius: 27px;
  box-shadow: 0 10px 0 #302b91, 0 24px 55px rgba(48,43,145,.18);
}
.future-card .eyebrow { color: #dcd9ff; }
.future-card h2 { font-size: clamp(1.55rem, 4vw, 2.3rem); }
.future-card p { margin-bottom: 0; color: #ecebff; font-size: 1rem; line-height: 1.58; }
.future-card ul {
  display: grid;
  align-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 900;
}
.future-card li { position: relative; padding: 11px 12px 11px 40px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; }
.future-card li::before { position: absolute; left: 13px; content: "✓"; color: #9af1dd; font-weight: 900; }

footer {
  padding: 27px 5px 0;
  color: #667791;
  font-size: .88rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 650px) {
  .shell { padding: 17px 12px 32px; }
  .topbar { align-items: flex-start; }
  .logo { width: 50px; height: 50px; border-radius: 16px; }
  .badge { padding: 7px 10px; font-size: .7rem; }
  .panel { padding: 25px 15px; border-radius: 26px; }
  .home-panel::before { top: 17px; left: 15px; }
  .home-panel::after { right: 14px; bottom: 18px; }
  .category-grid, .answers { grid-template-columns: 1fr; }
  .category { min-height: 82px; padding: 12px 13px; }
  .category .mark { width: 51px; height: 51px; border-radius: 15px; }
  .write-form, .future-card { grid-template-columns: 1fr; }
  .write-form .primary { width: 100%; }
  .future-card { gap: 20px; padding: 23px 18px; }
  .question-panel { min-height: 440px; }
}

@media (prefers-reduced-motion: no-preference) {
  .panel { animation: panel-in .32s ease-out; }
  @keyframes panel-in { from { opacity: 0; transform: translateY(7px); } }
}
