:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #2d504d;
  --muted: #6c817d;
  --paper: #fffdf7;
  --cream: #fff5d8;
  --line: #ddd5b9;
  --green: #65b989;
  --green-dark: #35785e;
  --gold: #f1bd48;
  --coral: #ef7468;
  --blue: #62acd6;
  --purple: #8b73bd;
  --shadow: 0 18px 44px rgba(62, 83, 75, .14);
  --soft-shadow: 0 9px 23px rgba(62, 83, 75, .11);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: #f4f9ed;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 9%, rgba(245, 195, 78, .2) 0 120px, transparent 122px),
    radial-gradient(circle at 94% 8%, rgba(98, 172, 214, .18) 0 154px, transparent 156px),
    linear-gradient(145deg, #f3f9ed 0%, #fffaf1 54%, #f2effc 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .15;
  background-image: radial-gradient(#6f9186 1px, transparent 1px);
  background-size: 26px 26px;
  content: '';
  pointer-events: none;
}

button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible { outline: 4px solid rgba(240, 185, 68, .72); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 48px;
}

.loading-card {
  display: grid;
  width: min(410px, 100%);
  min-height: 250px;
  margin: 20vh auto 0;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 37px;
  box-shadow: var(--shadow);
}

.loading-card span { font-size: 60px; animation: float 1.4s ease-in-out infinite alternate; }
.loading-card p { margin: 0; font-size: 19px; font-weight: 900; }

.topbar,
.topbar-actions,
.brand,
.section-heading,
.level-top,
.level-footer,
.game-heading,
.mission-strip,
.board-title,
.choice-heading,
.feedback-card,
.result-actions,
.result-stats {
  display: flex;
  align-items: center;
}

.topbar {
  position: relative;
  z-index: 30;
  min-height: 66px;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  gap: 12px;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  font-size: 29px;
  background: #fff8dc;
  border: 3px solid #dfd2aa;
  border-radius: 19px;
  box-shadow: 0 7px 16px rgba(67, 87, 78, .12);
  transform: rotate(-4deg);
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 25px; font-weight: 900; line-height: 1.04; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.topbar-actions { gap: 10px; }
.top-spark { color: var(--gold); font-size: 28px; animation: twinkle 2s ease-in-out infinite; }

.sound-button,
.back-button {
  min-height: 49px;
  color: var(--ink);
  font-weight: 900;
  background: rgba(255, 253, 247, .92);
  border: 2px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 7px 16px rgba(65, 83, 76, .08);
}

.sound-button { display: flex; align-items: center; gap: 9px; padding: 0 17px; font-size: 13px; }
.back-button { width: 49px; padding: 0; font-size: 23px; }

.eyebrow {
  margin: 0 0 8px;
  color: #397b62;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.hint-button {
  display: inline-flex;
  min-height: 53px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 21px;
  font-weight: 900;
  border-radius: 17px;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button { color: white; background: #3e9875; border: 0; box-shadow: 0 8px 0 #2f785e, 0 16px 27px rgba(49, 122, 94, .2); }
.secondary-button { color: var(--ink); background: #fffdf6; border: 2px solid #d7d2b9; box-shadow: 0 6px 0 #ddd7c4; }
.hint-button { color: #715418; background: #fff3c5; border: 2px solid #e7bd50; box-shadow: 0 6px 0 #d8aa39; }
.primary-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover,
.hint-button:not(:disabled):hover { transform: translateY(-2px); }
.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.hint-button:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.hint-button:disabled { opacity: .52; box-shadow: none; }
.primary-button.compact { min-height: 46px; margin-left: auto; padding-inline: 17px; border-radius: 14px; font-size: 14px; box-shadow: 0 6px 0 #2f785e; }

/* Главная */
.hero {
  position: relative;
  display: grid;
  min-height: 495px;
  align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr);
  gap: clamp(30px, 5vw, 68px);
  overflow: hidden;
  padding: clamp(42px, 6vw, 72px);
  background: linear-gradient(120deg, rgba(255, 253, 247, .98), rgba(247, 244, 255, .97));
  border: 3px solid #ddd4b7;
  border-radius: 46px;
  box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
  position: absolute;
  content: '';
  border-radius: 50%;
  pointer-events: none;
}
.hero::before { top: -175px; left: 43%; width: 350px; height: 350px; background: rgba(245, 195, 78, .17); }
.hero::after { right: -80px; bottom: -105px; width: 280px; height: 280px; background: rgba(101, 185, 137, .15); }
.hero-copy { position: relative; z-index: 3; }
.hero h1 { max-width: 580px; margin-bottom: 19px; font-size: clamp(50px, 6.1vw, 74px); font-weight: 900; letter-spacing: -.05em; line-height: .98; }
.hero-copy > p:not(.eyebrow) { max-width: 560px; margin-bottom: 27px; color: var(--muted); font-size: 18px; font-weight: 800; line-height: 1.52; }

.hero-scene {
  position: relative;
  z-index: 2;
  min-height: 335px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 244, 204, .9), rgba(220, 240, 227, .95)),
    repeating-linear-gradient(90deg, transparent 0 48px, rgba(92, 145, 125, .1) 49px 50px);
  border: 8px solid white;
  border-radius: 38px;
  box-shadow: 0 20px 38px rgba(57, 75, 70, .2);
  transform: rotate(1deg);
}

.hero-label {
  position: absolute;
  z-index: 6;
  top: 18px;
  left: 50%;
  padding: 8px 15px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, .91);
  border: 2px solid #ddd5b9;
  border-radius: 999px;
  transform: translateX(-50%);
}

.hero-pattern {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: repeat(3, 76px);
  justify-content: center;
  gap: 12px 18px;
  transform: translateY(-45%);
}

.hero-token {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  background: rgba(255, 255, 255, .82);
  border: 3px solid rgba(54, 91, 88, .18);
  border-radius: 21px;
  box-shadow: 0 8px 14px rgba(56, 83, 75, .12);
  animation: token-in .45s both;
  animation-delay: var(--delay);
}

.hero-token .pattern-svg { width: 68px; height: 68px; }
.hero-blank { color: var(--purple); font-family: Georgia, serif; font-size: 45px; font-weight: 900; border: 3px dashed var(--purple); }
.hero-thread { position: absolute; right: 15%; bottom: 33px; left: 15%; height: 13px; border-bottom: 4px dashed rgba(54, 91, 88, .26); border-radius: 50%; }
.hero-wand { position: absolute; z-index: 7; right: 9px; bottom: 3px; font-size: 48px; transform: rotate(-13deg); }

.how-section,
.levels-section { margin-top: 49px; }
.section-heading { justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(34px, 4vw, 47px); font-weight: 900; letter-spacing: -.035em; }
.section-heading > p { max-width: 430px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 800; line-height: 1.45; text-align: right; }
.steps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.step-card {
  display: grid;
  min-height: 130px;
  align-items: center;
  grid-template-columns: 66px 1fr;
  gap: 15px;
  padding: 21px;
  background: rgba(255, 253, 247, .9);
  border: 2px solid var(--line);
  border-radius: 25px;
  box-shadow: var(--soft-shadow);
}

.step-number {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  padding-top: 1px;
  color: white;
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
  background: var(--green);
  border: 5px solid #d5f0df;
  border-radius: 50%;
}

.step-card:nth-child(2) .step-number { background: var(--gold); border-color: #fff0bf; }
.step-card:nth-child(3) .step-number { background: var(--purple); border-color: #e5dcf8; }
.step-card strong,
.step-card small { display: block; }
.step-card strong { margin-bottom: 7px; font-size: 18px; font-weight: 900; }
.step-card small { color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.42; }

.levels-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.level-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 390px;
  flex-direction: column;
  padding: 23px;
  overflow: hidden;
  text-align: left;
  background: #fffdf7;
  border: 3px solid color-mix(in srgb, var(--accent), white 55%);
  border-radius: 31px;
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.level-card::after { position: absolute; right: -38px; bottom: -50px; width: 140px; height: 140px; background: color-mix(in srgb, var(--accent), transparent 82%); border-radius: 50%; content: ''; }
.level-card:not(:disabled):hover { transform: translateY(-6px); box-shadow: 0 18px 34px rgba(62, 83, 75, .16); }
.level-top { position: relative; z-index: 2; justify-content: space-between; }
.level-icon { display: grid; width: 53px; height: 53px; place-items: center; font-size: 27px; background: color-mix(in srgb, var(--accent), white 77%); border-radius: 17px; }
.level-best { color: #786437; font-size: 13px; font-weight: 900; letter-spacing: .07em; }
.level-preview { position: relative; z-index: 2; display: grid; min-height: 92px; align-items: center; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 16px 0 17px; padding: 12px 9px; background: color-mix(in srgb, var(--accent), white 89%); border: 2px solid color-mix(in srgb, var(--accent), white 65%); border-radius: 21px; }
.level-preview span { display: grid; min-width: 0; place-items: center; }
.level-preview .pattern-svg { width: 100%; max-width: 54px; }
.level-preview b { color: var(--accent); font-family: Georgia, serif; font-size: 30px; text-align: center; }
.level-copy { position: relative; z-index: 2; display: block; }
.level-copy small,
.level-copy strong,
.level-copy > span { display: block; }
.level-copy small { margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.level-copy strong { margin-bottom: 8px; font-size: 25px; font-weight: 900; letter-spacing: -.02em; }
.level-copy > span { color: var(--muted); font-size: 14px; font-weight: 800; line-height: 1.42; }
.level-footer { position: relative; z-index: 2; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 17px; font-size: 12px; font-weight: 900; }
.level-footer b { color: var(--accent); }

.parent-tip {
  display: grid;
  max-width: 890px;
  grid-template-columns: 54px 1fr;
  gap: 15px;
  margin: 39px auto 0;
  padding: 20px 24px;
  background: #fff7d8;
  border: 2px solid #ead28c;
  border-radius: 24px;
}
.parent-tip > span { display: grid; width: 49px; height: 49px; place-items: center; font-size: 25px; background: white; border-radius: 16px; }
.parent-tip p { align-self: center; margin: 0; color: #715f3f; font-size: 14px; font-weight: 800; line-height: 1.5; }

/* Игровой экран */
.game-shell {
  padding: clamp(24px, 4vw, 46px);
  background: rgba(255, 253, 247, .96);
  border: 3px solid #ddd4b7;
  border-radius: 42px;
  box-shadow: var(--shadow);
}

.game-heading { justify-content: space-between; gap: 24px; }
.game-heading h1 { margin-bottom: 7px; font-size: clamp(34px, 5vw, 53px); font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.game-heading > div > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 16px; font-weight: 800; }
.round-badge { display: grid; min-width: 84px; height: 84px; place-items: center; align-content: center; color: white; background: var(--level-accent); border: 7px solid color-mix(in srgb, var(--level-accent), white 70%); border-radius: 50%; box-shadow: 0 8px 17px rgba(62, 83, 75, .15); }
.round-badge strong { font-family: Georgia, serif; font-size: 29px; line-height: .9; }
.round-badge span { margin-top: 3px; font-size: 11px; font-weight: 900; }

.mission-strip { justify-content: space-between; gap: 18px; margin: 25px 0 20px; padding: 13px 17px; background: color-mix(in srgb, var(--level-accent), white 91%); border: 2px solid color-mix(in srgb, var(--level-accent), white 68%); border-radius: 18px; }
.mission-strip > span { font-size: 12px; font-weight: 900; }
.progress-dots { display: grid; width: min(560px, 70%); grid-template-columns: repeat(10, minmax(7px, 1fr)); gap: 6px; }
.progress-dot { height: 9px; background: white; border: 1px solid color-mix(in srgb, var(--level-accent), white 56%); border-radius: 999px; }
.progress-dot.done { background: var(--level-accent); }
.progress-dot.current { background: var(--gold); box-shadow: 0 0 0 3px rgba(241, 189, 72, .2); }

.pattern-board {
  position: relative;
  overflow: hidden;
  padding: clamp(19px, 3vw, 31px);
  background:
    linear-gradient(rgba(255,255,255,.68), rgba(255,255,255,.68)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(94, 151, 126, .11) 32px 33px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(94, 151, 126, .11) 32px 33px),
    #f0f8ec;
  border: 3px solid #cadfc9;
  border-radius: 31px;
}

.pattern-board::after { position: absolute; right: -34px; bottom: -43px; width: 130px; height: 130px; background: rgba(98, 172, 214, .1); border-radius: 50%; content: ''; }
.board-title { position: relative; z-index: 2; gap: 12px; margin-bottom: 18px; }
.board-title > span { display: grid; width: 47px; height: 47px; place-items: center; font-size: 25px; background: white; border: 2px solid #d6decf; border-radius: 15px; }
.board-title strong,
.board-title small { display: block; }
.board-title strong { font-size: 18px; font-weight: 900; }
.board-title small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 800; }

.pattern-row {
  position: relative;
  z-index: 2;
  display: grid;
  max-width: 830px;
  grid-template-columns: repeat(var(--count), minmax(0, 1fr));
  gap: clamp(5px, 1vw, 12px);
  margin: 0 auto;
}

.pattern-tile {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  background: rgba(255,255,255,.94);
  border: 3px solid #d9dfd4;
  border-radius: clamp(12px, 2vw, 22px);
  box-shadow: 0 7px 14px rgba(60, 81, 73, .1);
}

.pattern-tile::after { position: absolute; top: 50%; right: calc(clamp(5px, 1vw, 12px) * -1 - 7px); z-index: 5; color: #a4b3aa; font-size: 15px; font-weight: 900; content: '›'; transform: translateY(-50%); }
.pattern-tile:last-child::after { display: none; }
.pattern-tile small { position: absolute; top: 7px; left: 9px; z-index: 2; color: #9aa9a2; font-family: Georgia, serif; font-size: 11px; font-weight: 900; line-height: 1; }
.pattern-svg { display: block; width: 88%; height: 88%; overflow: visible; filter: drop-shadow(0 5px 3px rgba(48, 70, 65, .12)); }
.answer-tile { background: #fff9dd; border: 3px dashed #d6aa3c; box-shadow: inset 0 0 0 5px rgba(245, 195, 78, .1); }
.answer-tile > strong { padding-top: 3px; color: #a5781b; font-family: Georgia, serif; font-size: clamp(31px, 5vw, 54px); line-height: 1; }
.answer-tile.solved { background: #e6f7e8; border-style: solid; border-color: #65b989; animation: solved-pop .38s ease-out; }
.answer-tile > b { position: absolute; right: 5px; bottom: 4px; display: grid; width: 23px; height: 23px; place-items: center; color: white; font-size: 13px; background: #3e9875; border-radius: 50%; }

.choice-section { margin-top: 29px; }
.choice-heading { justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.choice-heading h2 { margin: 0; font-size: clamp(27px, 4vw, 37px); font-weight: 900; letter-spacing: -.03em; }
.options-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.options-grid[data-count="3"] { max-width: 790px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-inline: auto; }
.option-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 158px;
  place-items: center;
  padding: 15px;
  overflow: hidden;
  background: white;
  border: 3px solid #d9d5c2;
  border-radius: 25px;
  box-shadow: 0 7px 0 #d8d3bf, 0 13px 23px rgba(62, 83, 75, .1);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.option-card:not(:disabled):hover { border-color: var(--level-accent); transform: translateY(-4px); }
.option-card:not(:disabled):active { box-shadow: 0 2px 0 #d8d3bf; transform: translateY(4px); }
.option-card .pattern-svg { width: 118px; height: 118px; max-width: 90%; }
.option-number { position: absolute; top: 9px; left: 10px; z-index: 3; display: grid; width: 29px; height: 29px; place-items: center; padding-top: 1px; color: var(--ink); font-family: Georgia, serif; font-size: 15px; font-weight: 900; line-height: 1; background: #f7f5ed; border: 2px solid #ded9c8; border-radius: 50%; }
.option-mark { position: absolute; right: 10px; bottom: 9px; z-index: 3; display: grid; width: 33px; height: 33px; place-items: center; color: white; font-size: 22px; font-weight: 900; border-radius: 50%; }
.option-card.is-wrong { opacity: .55; background: #fff1ef; border-color: #e8837a; box-shadow: none; animation: shake .33s ease; }
.option-card.is-wrong .option-mark { background: #df665d; }
.option-card.is-hint { border-color: var(--gold); box-shadow: 0 0 0 5px rgba(241, 189, 72, .22), 0 7px 0 #dbad3f; animation: hint-pulse .9s ease-in-out infinite alternate; }
.option-card.is-correct { background: #e8f7e9; border-color: #65b989; box-shadow: 0 0 0 5px rgba(101,185,137,.18); animation: solved-pop .38s ease-out; }
.option-card.is-correct .option-mark { background: #3e9875; }
.option-card:disabled { cursor: default; }

.feedback-card {
  min-height: 82px;
  gap: 14px;
  margin-top: 22px;
  padding: 15px 17px;
  background: #f5f7f3;
  border: 2px solid #d8dfd7;
  border-radius: 22px;
}
.feedback-icon { display: grid; min-width: 49px; height: 49px; place-items: center; font-size: 25px; background: white; border-radius: 15px; }
.feedback-card p { margin: 0; }
.feedback-card strong,
.feedback-card small { display: block; }
.feedback-card strong { margin-bottom: 4px; font-size: 16px; font-weight: 900; }
.feedback-card small { color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.4; }
.feedback-card.wrong { background: #fff2ef; border-color: #efbbb5; }
.feedback-card.hint { background: #fff7da; border-color: #ead189; }
.feedback-card.correct { background: #eaf8ec; border-color: #acd9b5; }

/* Результат */
.result-card {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  padding: clamp(34px, 6vw, 70px);
  text-align: center;
  background: linear-gradient(145deg, #fffdf7, color-mix(in srgb, var(--level-accent), white 91%));
  border: 3px solid #ddd4b7;
  border-radius: 44px;
  box-shadow: var(--shadow);
}
.result-card::before,
.result-card::after { position: absolute; content: ''; border-radius: 50%; }
.result-card::before { top: -120px; left: -90px; width: 290px; height: 290px; background: rgba(245,195,78,.18); }
.result-card::after { right: -90px; bottom: -120px; width: 300px; height: 300px; background: color-mix(in srgb, var(--level-accent), transparent 80%); }
.result-card > * { position: relative; z-index: 2; }
.result-icon { display: grid; width: 89px; height: 89px; margin: 0 auto 15px; place-items: center; font-size: 47px; background: white; border: 4px solid color-mix(in srgb, var(--level-accent), white 55%); border-radius: 29px; box-shadow: var(--soft-shadow); transform: rotate(-4deg); }
.result-card h1 { margin-bottom: 10px; font-size: clamp(43px, 6vw, 66px); font-weight: 900; letter-spacing: -.05em; }
.result-lead { max-width: 620px; margin: 0 auto 9px; color: var(--muted); font-size: 17px; font-weight: 800; line-height: 1.5; }
.result-stars { color: var(--gold); font-size: 50px; letter-spacing: 7px; text-shadow: 0 4px 0 #d89e2f; }
.result-stars span { color: #e4decd; text-shadow: none; }
.result-pattern { display: grid; max-width: 720px; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 22px auto; padding: 12px; background: rgba(255,255,255,.72); border: 2px solid #ded8c4; border-radius: 24px; }
.result-pattern span,
.result-pattern b { display: grid; aspect-ratio: 1; place-items: center; background: white; border: 2px solid #e0ddcf; border-radius: 16px; }
.result-pattern b { background: #e8f7e9; border-color: #65b989; }
.result-pattern .pattern-svg { width: 90%; height: 90%; }
.result-stats { max-width: 680px; justify-content: center; margin: 0 auto 28px; overflow: hidden; background: rgba(255,255,255,.72); border: 2px solid #ded8c4; border-radius: 23px; }
.result-stats > span { min-width: 0; flex: 1; padding: 17px 10px; }
.result-stats > span + span { border-left: 2px solid #e3decf; }
.result-stats strong,
.result-stats small { display: block; }
.result-stats strong { margin-bottom: 4px; font-family: Georgia, serif; font-size: 29px; }
.result-stats small { color: var(--muted); font-size: 11px; font-weight: 900; }
.result-actions { justify-content: center; gap: 13px; }
.result-confetti i { position: absolute; color: var(--level-accent); font-style: normal; animation: float 1.7s ease-in-out infinite alternate; }
.result-confetti i:nth-child(1) { top: 10%; left: 8%; color: var(--coral); }
.result-confetti i:nth-child(2) { top: 20%; right: 11%; color: var(--blue); animation-delay: .3s; }
.result-confetti i:nth-child(3) { bottom: 21%; left: 12%; color: var(--green); animation-delay: .6s; }
.result-confetti i:nth-child(4) { top: 9%; right: 27%; color: var(--gold); animation-delay: .9s; }
.result-confetti i:nth-child(5) { bottom: 12%; right: 8%; color: var(--purple); animation-delay: .4s; }
.result-confetti i:nth-child(6) { top: 36%; left: 5%; color: var(--gold); animation-delay: .7s; }

@keyframes token-in { from { opacity: 0; transform: translateY(12px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes solved-pop { 50% { transform: scale(1.06) rotate(1deg); } }
@keyframes hint-pulse { to { box-shadow: 0 0 0 8px rgba(241,189,72,.13), 0 7px 0 #dbad3f; } }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes float { to { transform: translateY(-10px) rotate(4deg); } }
@keyframes twinkle { 50% { opacity: .45; transform: rotate(25deg) scale(.75); } }

@media (max-width: 900px) {
  .hero { min-height: 0; grid-template-columns: 1fr; padding: 44px; }
  .hero-copy { text-align: center; }
  .hero-copy > p:not(.eyebrow) { margin-inline: auto; }
  .hero-scene { width: min(520px, 100%); min-height: 300px; margin: 0 auto; }
  .steps-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 105px; }
  .levels-grid { grid-template-columns: 1fr; }
  .level-card { min-height: 0; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 0 18px; }
  .level-top { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
  .level-best { display: none; }
  .level-preview { grid-column: 2; margin: 0 0 15px; }
  .level-copy { grid-column: 2; }
  .level-footer { grid-column: 2; }
  .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .options-grid[data-count="3"] { max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .app { width: min(100% - 20px, 1120px); padding-top: 12px; }
  .topbar { min-height: 53px; margin-bottom: 13px; }
  .brand { gap: 8px; }
  .brand-mark { width: 46px; height: 46px; font-size: 23px; border-radius: 15px; }
  .brand strong { font-size: 20px; }
  .brand small { display: none; }
  .sound-button { width: 47px; min-height: 46px; justify-content: center; padding: 0; }
  .sound-button span:last-child { display: none; }
  .back-button { width: 46px; min-height: 46px; }
  .top-spark { display: none; }
  .hero { padding: 34px 21px; border-radius: 31px; }
  .hero h1 { font-size: clamp(42px, 13vw, 58px); }
  .hero-copy > p:not(.eyebrow) { font-size: 16px; }
  .hero-scene { min-height: 270px; border-width: 6px; border-radius: 27px; }
  .hero-pattern { grid-template-columns: repeat(3, 63px); gap: 10px 13px; }
  .hero-token { width: 63px; height: 63px; border-radius: 17px; }
  .hero-token .pattern-svg { width: 56px; height: 56px; }
  .hero-blank { font-size: 37px; }
  .how-section, .levels-section { margin-top: 38px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-heading > p { text-align: left; }
  .section-heading h2 { font-size: 34px; }
  .step-card { grid-template-columns: 55px 1fr; padding: 16px; }
  .step-number { width: 52px; height: 52px; font-size: 24px; }
  .level-card { grid-template-columns: 1fr; padding: 19px; }
  .level-top, .level-preview, .level-copy, .level-footer { grid-column: 1; }
  .level-top { grid-row: auto; margin-bottom: 13px; }
  .level-best { display: block; }
  .level-preview { min-height: 82px; }
  .parent-tip { grid-template-columns: 44px 1fr; padding: 17px; }
  .parent-tip > span { width: 42px; height: 42px; }
  .game-shell { padding: 20px 14px 22px; border-radius: 29px; }
  .game-heading { align-items: flex-start; }
  .game-heading h1 { font-size: 35px; }
  .game-heading > div > p:not(.eyebrow) { font-size: 14px; line-height: 1.4; }
  .round-badge { min-width: 66px; height: 66px; border-width: 5px; }
  .round-badge strong { font-size: 23px; }
  .mission-strip { margin-block: 18px 14px; padding: 10px 12px; }
  .mission-strip > span { display: none; }
  .progress-dots { width: 100%; }
  .pattern-board { padding: 15px 9px 18px; border-radius: 23px; }
  .board-title { margin: 0 6px 14px; }
  .board-title > span { width: 41px; height: 41px; font-size: 21px; }
  .board-title strong { font-size: 16px; }
  .pattern-row { gap: 4px; }
  .pattern-tile { border-width: 2px; border-radius: 10px; box-shadow: 0 4px 8px rgba(60,81,73,.09); }
  .pattern-tile::after { display: none; }
  .pattern-tile small { top: 3px; left: 5px; font-size: 8px; }
  .answer-tile { border-width: 2px; }
  .answer-tile > b { width: 16px; height: 16px; right: 2px; bottom: 2px; font-size: 9px; }
  .choice-section { margin-top: 24px; }
  .choice-heading { align-items: flex-end; }
  .choice-heading h2 { font-size: 27px; }
  .choice-heading .eyebrow { margin-bottom: 4px; }
  .hint-button { min-height: 45px; padding: 0 12px; font-size: 13px; border-radius: 14px; }
  .options-grid,
  .options-grid[data-count="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .option-card { min-height: 126px; padding: 10px; border-radius: 20px; }
  .option-card .pattern-svg { width: 94px; height: 94px; }
  .option-number { top: 7px; left: 7px; width: 25px; height: 25px; font-size: 13px; }
  .option-mark { right: 7px; bottom: 7px; width: 28px; height: 28px; font-size: 18px; }
  .feedback-card { align-items: flex-start; min-height: 0; padding: 13px; }
  .feedback-icon { min-width: 42px; height: 42px; font-size: 21px; }
  .feedback-card.correct { flex-wrap: wrap; }
  .feedback-card.correct p { min-width: 0; flex: 1; }
  .feedback-card .primary-button.compact { width: 100%; margin-left: 0; }
  .result-card { min-height: 0; padding: 39px 17px; border-radius: 31px; }
  .result-card h1 { font-size: 43px; }
  .result-icon { width: 75px; height: 75px; font-size: 39px; }
  .result-stars { font-size: 40px; }
  .result-pattern { gap: 4px; padding: 7px; border-radius: 16px; }
  .result-pattern span, .result-pattern b { border-radius: 9px; }
  .result-stats small { min-height: 26px; }
  .result-actions { align-items: stretch; flex-direction: column-reverse; }
}

@media (max-width: 400px) {
  .brand strong { font-size: 18px; }
  .game-heading h1 { font-size: 31px; }
  .round-badge { min-width: 60px; height: 60px; }
  .pattern-board { padding-inline: 6px; }
  .pattern-row { gap: 3px; }
  .choice-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .hint-button { align-self: stretch; }
  .option-card { min-height: 116px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
