:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #2d504d;
  --muted: #6b817c;
  --paper: #fffdf7;
  --cream: #fff5d8;
  --line: #ddd4b7;
  --green: #65b989;
  --green-dark: #35785e;
  --gold: #f2bd4d;
  --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,
.area-heading,
.area-heading > div,
.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 { min-height: 46px; color: #715418; background: #fff3c5; border: 2px solid #e7bd50; box-shadow: 0 5px 0 #d8aa39; }
.primary-button.compact { min-height: 46px; padding-inline: 17px; box-shadow: 0 5px 0 #2f785e; }
.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: .55; }

.hero {
  position: relative;
  display: grid;
  min-height: 390px;
  grid-template-columns: 1.03fr .97fr;
  overflow: hidden;
  background: linear-gradient(115deg, #fff9e9 0 47%, #eef8ed 47% 100%);
  border: 3px solid #ded4b6;
  border-radius: 38px;
  box-shadow: var(--shadow);
}

.hero::before,
.hero::after { position: absolute; border-radius: 50%; content: ''; pointer-events: none; }
.hero::before { width: 170px; height: 170px; right: -48px; bottom: -75px; background: rgba(98, 172, 214, .16); }
.hero::after { width: 105px; height: 105px; left: 42%; top: -70px; background: rgba(242, 189, 77, .2); }
.hero-copy { z-index: 1; padding: 64px 28px 56px 52px; }
.hero h1 { max-width: 520px; margin-bottom: 20px; font-size: clamp(42px, 5.1vw, 70px); font-weight: 900; line-height: .95; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 510px; margin-bottom: 30px; color: #607772; font-size: 17px; font-weight: 700; line-height: 1.55; }

.hero-scene {
  position: relative;
  min-height: 390px;
  background:
    radial-gradient(circle at 53% 46%, rgba(255, 255, 255, .8) 0 110px, transparent 112px),
    linear-gradient(145deg, rgba(164, 220, 190, .2), rgba(102, 172, 214, .2));
}

.hero-tray {
  position: absolute;
  width: 182px;
  height: 188px;
  left: 28px;
  top: 82px;
  background: #fffdf6;
  border: 4px solid #d8ccb0;
  border-radius: 30px 30px 44px 44px;
  box-shadow: 0 17px 28px rgba(61, 80, 73, .14);
  transform: rotate(-3deg);
}

.hero-tray::before { position: absolute; inset: 12px 12px auto; height: 10px; background: #e7ddc5; border-radius: 99px; content: ''; }
.hero-object { position: absolute; display: block; width: 78px; height: 78px; filter: drop-shadow(0 6px 5px rgba(54, 91, 88, .15)); }
.hero-object-0 { left: 12px; top: 27px; }
.hero-object-1 { right: 13px; top: 54px; }
.hero-object-2 { left: 46px; bottom: 1px; }
.hero-arrow { position: absolute; left: 205px; top: 173px; color: #dd9b31; font-size: 46px; font-weight: 900; animation: point 1s ease-in-out infinite alternate; }
.hero-boxes { position: absolute; right: 24px; top: 72px; display: flex; gap: 9px; align-items: end; }
.hero-box { position: relative; display: block; width: 105px; height: 152px; }
.hero-box i { position: absolute; width: 91%; height: 30px; left: 5%; top: 15px; background: #845c44; border: 4px solid #5c453a; border-radius: 50%; }
.hero-box b { position: absolute; inset: 27px 9px 3px; background: #d99562; border: 4px solid #6d4b3d; border-radius: 5px 5px 24px 24px; }
.hero-box.coral b { background: #ef9a85; }
.hero-box.blue { transform: translateY(25px) rotate(3deg); }
.hero-box.blue b { background: #8bc4e2; }
.hero-sticker { position: absolute; right: 30px; bottom: 31px; padding: 10px 15px; color: #815719; font-size: 13px; font-weight: 900; background: #fff1ae; border: 2px solid #e7bf4d; border-radius: 14px; transform: rotate(-2deg); }

.how-section,
.levels-section { margin-top: 62px; }
.section-heading { justify-content: space-between; gap: 30px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: clamp(34px, 4.5vw, 52px); font-weight: 900; line-height: 1; letter-spacing: -.035em; }
.section-heading > p { max-width: 390px; 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, 1fr); gap: 15px; }
.step-card { display: flex; min-height: 122px; align-items: center; gap: 17px; padding: 20px; background: rgba(255, 253, 247, .93); border: 2px solid var(--line); border-radius: 27px; box-shadow: var(--soft-shadow); }
.step-number { display: grid; flex: 0 0 59px; height: 59px; place-items: center; padding-bottom: 4px; color: white; font-family: Georgia, serif; font-size: 26px; font-weight: 900; line-height: 1; background: #5db48a; border: 6px solid #dff4e7; border-radius: 50%; }
.step-card:nth-child(2) .step-number { background: #eeb640; border-color: #fff0bd; }
.step-card:nth-child(3) .step-number { background: #ec796d; border-color: #ffe0d9; }
.step-card strong,
.step-card small { display: block; }
.step-card strong { margin-bottom: 6px; font-size: 19px; font-weight: 900; }
.step-card small { color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.42; }

.levels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.level-card { display: flex; min-width: 0; min-height: 410px; flex-direction: column; padding: 21px; overflow: hidden; text-align: left; background: rgba(255, 253, 247, .95); border: 3px solid color-mix(in srgb, var(--accent), white 62%); border-radius: 31px; box-shadow: var(--soft-shadow); transition: transform 180ms ease, box-shadow 180ms ease; }
.level-card:not(:disabled):hover { transform: translateY(-6px); box-shadow: 0 22px 34px rgba(62, 83, 75, .17); }
.level-card:nth-child(2) { background: linear-gradient(150deg, #fffdf7, #f5efff); }
.level-card:nth-child(3) { background: linear-gradient(150deg, #fffdf7, #ecf8f2); }
.level-top { justify-content: space-between; }
.level-icon { display: grid; width: 54px; height: 54px; place-items: center; font-size: 27px; background: color-mix(in srgb, var(--accent), white 76%); border-radius: 18px; }
.level-best { color: #bf8a26; font-size: 13px; font-weight: 900; letter-spacing: .03em; }
.level-preview { display: flex; height: 125px; align-items: center; justify-content: center; gap: 5px; margin: 12px -7px 17px; background: rgba(255, 255, 255, .58); border-radius: 24px; }
.preview-item { width: 67px; height: 67px; filter: drop-shadow(0 5px 5px rgba(54, 91, 88, .16)); }
.preview-arrow { color: var(--accent); font-size: 25px; font-weight: 900; }
.mini-box { position: relative; width: 66px; height: 75px; }
.mini-box > i { position: absolute; z-index: 3; width: 58px; min-height: 28px; left: 4px; top: 0; display: grid; place-items: center; background: white; border: 2px solid #ddd5bc; border-radius: 8px; }
.mini-box > b { position: absolute; inset: 26px 6px 2px; background: color-mix(in srgb, var(--accent), #d69a64 45%); border: 3px solid #755141; border-radius: 4px 4px 12px 12px; }
.mini-box .criterion-chip em,
.mini-box .size-symbol { display: none; }
.mini-box .criteria-list { gap: 1px; padding: 1px; }
.mini-box .color-chip i { width: 18px; height: 18px; }
.mini-box .criterion-shape { width: 25px; height: 25px; }
.level-copy { display: block; flex: 1; }
.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: .09em; text-transform: uppercase; }
.level-copy strong { margin-bottom: 9px; font-size: 28px; font-weight: 900; line-height: 1.05; }
.level-copy span { color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1.45; }
.level-footer { justify-content: space-between; margin-top: 18px; padding-top: 15px; border-top: 2px dashed color-mix(in srgb, var(--accent), white 60%); }
.level-footer span { color: var(--muted); font-size: 12px; font-weight: 900; }
.level-footer b { color: var(--accent); font-size: 13px; }
.parent-tip { display: flex; gap: 15px; margin-top: 22px; padding: 19px 24px; color: #526d67; background: rgba(225, 243, 229, .83); border: 2px solid #b9dac3; border-radius: 24px; }
.parent-tip > span { font-size: 25px; }
.parent-tip p { margin: 0; font-size: 14px; line-height: 1.55; }

.game-shell { display: grid; gap: 17px; }
.game-heading { justify-content: space-between; gap: 28px; padding: 30px 34px; background: linear-gradient(115deg, #fffaf0, color-mix(in srgb, var(--level-accent), white 85%)); border: 3px solid #ded4b6; border-radius: 33px; box-shadow: var(--soft-shadow); }
.game-heading h1 { margin-bottom: 7px; font-size: clamp(31px, 4.5vw, 51px); font-weight: 900; line-height: 1; letter-spacing: -.035em; }
.game-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1.45; }
.round-badge { display: grid; flex: 0 0 80px; height: 80px; place-items: center; align-content: center; color: var(--ink); background: #fffdf6; border: 4px solid color-mix(in srgb, var(--level-accent), white 36%); border-radius: 25px; transform: rotate(2deg); }
.round-badge strong { font-family: Georgia, serif; font-size: 30px; line-height: .9; }
.round-badge span { color: var(--muted); font-size: 11px; font-weight: 900; }
.mission-strip { min-height: 52px; justify-content: space-between; gap: 18px; padding: 11px 17px; background: rgba(255, 253, 247, .86); border: 2px solid var(--line); border-radius: 18px; }
.mission-strip > span { color: var(--muted); font-size: 12px; font-weight: 900; white-space: nowrap; }
.progress-dots { display: flex; flex: 1; gap: 7px; }
.progress-dot { flex: 1; height: 8px; background: #e7e3d8; border-radius: 99px; }
.progress-dot.done { background: #78bf94; }
.progress-dot.current { background: var(--level-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--level-accent), transparent 75%); }

.tray-card,
.boxes-card { padding: 19px 21px 22px; background: rgba(255, 253, 247, .96); border: 3px solid var(--line); border-radius: 30px; box-shadow: var(--soft-shadow); }
.area-heading { justify-content: space-between; gap: 17px; margin-bottom: 17px; }
.area-heading > div { gap: 11px; }
.area-heading > div > span { display: grid; width: 46px; height: 46px; place-items: center; font-size: 23px; background: #f4f0e3; border-radius: 15px; }
.area-heading strong,
.area-heading small { display: block; }
.area-heading strong { margin-bottom: 2px; font-size: 18px; font-weight: 900; }
.area-heading small { color: var(--muted); font-size: 12px; font-weight: 800; }
.control-tip { padding: 8px 12px; color: #677c77; font-size: 11px; font-weight: 900; background: #f0f5ea; border-radius: 12px; }

.items-grid { display: grid; min-height: 132px; grid-template-columns: repeat(8, minmax(76px, 1fr)); gap: 10px; padding: 13px; align-items: center; background: linear-gradient(#eef6e8, #f7f9ee); border: 2px dashed #b8ceb5; border-radius: 24px; }
.item-button { position: relative; display: grid; min-width: 0; height: 102px; place-items: center; padding: 6px; touch-action: none; background: #fffdf8; border: 3px solid #dfd9c6; border-radius: 22px; box-shadow: 0 6px 0 #d8d2bf, 0 9px 13px rgba(64, 85, 76, .08); transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease; }
.item-button:hover { transform: translateY(-3px); }
.item-button.selected { z-index: 2; border-color: #e6a92e; box-shadow: 0 0 0 5px #fff0b7, 0 7px 0 #d8a332, 0 14px 23px rgba(187, 134, 30, .2); transform: translateY(-5px) rotate(-2deg); }
.item-button .item-svg { width: 86px; max-width: 100%; height: 86px; filter: drop-shadow(0 5px 4px rgba(54, 91, 88, .16)); }
.pick-mark { position: absolute; width: 25px; height: 25px; right: -6px; top: -7px; display: grid; place-items: center; color: white; font-size: 13px; background: #e3a530; border: 3px solid white; border-radius: 50%; opacity: 0; transform: scale(.4); transition: 150ms ease; }
.item-button.selected .pick-mark { opacity: 1; transform: scale(1); }
.empty-tray { grid-column: 1 / -1; display: flex; min-height: 102px; align-items: center; justify-content: center; gap: 12px; color: #447461; }
.empty-tray span { font-size: 34px; }
.empty-tray strong { font-size: 19px; }

.boxes-card { background: rgba(255, 250, 238, .96); }
.boxes-grid { display: grid; gap: 15px; align-items: stretch; }
.boxes-grid[data-box-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.boxes-grid[data-box-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.boxes-grid[data-box-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.sort-box { --box-color: #dfa06a; position: relative; min-width: 0; min-height: 253px; padding: 0; background: transparent; border: 0; border-radius: 25px; transition: filter 150ms ease, transform 150ms ease; }
.sort-box:nth-child(2) { --box-color: #7dbbdd; }
.sort-box:nth-child(3) { --box-color: #93c895; }
.sort-box:nth-child(4) { --box-color: #b499d7; }
.sort-box:hover { filter: brightness(1.025); transform: translateY(-2px); }
.box-label { position: relative; z-index: 5; display: grid; width: calc(100% - 38px); min-height: 67px; margin: 0 auto -12px; place-items: center; padding: 7px; background: #fffdf7; border: 3px solid #685348; border-radius: 15px; box-shadow: 0 7px 11px rgba(65, 72, 68, .12); }
.box-opening { position: relative; z-index: 3; display: block; width: calc(100% - 13px); height: 45px; margin: 0 auto -18px; background: color-mix(in srgb, var(--box-color), #8c654f 28%); border: 4px solid #684b40; border-radius: 50%; box-shadow: inset 0 9px 0 rgba(70, 47, 40, .25); }
.box-body { position: relative; z-index: 2; display: block; height: 162px; padding: 28px 12px 13px; overflow: hidden; background: linear-gradient(100deg, color-mix(in srgb, var(--box-color), white 10%), var(--box-color)); border: 4px solid #684b40; border-top-width: 3px; border-radius: 7px 7px 24px 24px; box-shadow: inset 12px 0 rgba(255, 255, 255, .13), 0 11px 19px rgba(64, 72, 66, .14); }
.box-body::after { position: absolute; width: 45px; height: 120%; right: 12%; top: -10%; background: rgba(255, 255, 255, .11); content: ''; transform: rotate(9deg); pointer-events: none; }
.box-count { position: absolute; z-index: 4; right: 10px; bottom: 9px; padding: 4px 8px; color: #fff; font-size: 11px; font-weight: 900; background: rgba(75, 57, 48, .68); border-radius: 10px; }
.box-items { position: relative; z-index: 3; display: flex; height: 100%; align-items: center; justify-content: center; flex-wrap: wrap; align-content: center; gap: 0; padding-right: 17px; }
.box-item { position: relative; z-index: 6; display: grid; width: 70px; height: 70px; margin: -3px 1px; place-items: center; background: #fffdf7; border: 3px solid #684b40; border-radius: 19px; box-shadow: 0 5px 9px rgba(67, 55, 49, .18); filter: drop-shadow(0 4px 3px rgba(67, 55, 49, .1)); animation: drop-in 260ms ease both; }
.box-item .item-svg { width: 92%; height: 92%; }

.criteria-list { display: flex; min-width: 0; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; }
.criterion-chip { display: inline-flex; min-width: 0; min-height: 32px; align-items: center; justify-content: center; gap: 4px; padding: 3px 7px; color: #3f605b; background: #f5f3e9; border: 1px solid #ded8c5; border-radius: 10px; }
.criterion-chip em { overflow: hidden; font-size: 10px; font-style: normal; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.color-chip i { display: block; flex: 0 0 22px; width: 22px; height: 22px; background: var(--criterion-color); border: 3px solid #365b58; border-radius: 50%; }
.criterion-shape { display: block; flex: 0 0 28px; width: 28px; height: 28px; }
.size-symbol { display: flex; height: 25px; align-items: end; gap: 2px; }
.size-symbol b { display: block; background: #7aa6be; border: 2px solid #365b58; border-radius: 50%; }
.size-symbol b:nth-child(1) { width: 8px; height: 8px; }
.size-symbol b:nth-child(2) { width: 13px; height: 13px; }
.size-symbol b:nth-child(3) { width: 19px; height: 19px; }
.size-symbol.small b:not(:nth-child(1)),
.size-symbol.medium b:not(:nth-child(2)),
.size-symbol.large b:not(:nth-child(3)) { opacity: .2; }

.sort-box.wrong { animation: shake 330ms ease; }
.sort-box.wrong .box-body,
.sort-box.wrong .box-opening { border-color: #b64c47; filter: saturate(1.2); }
.sort-box.hinted::after { position: absolute; z-index: 9; inset: -8px; border: 6px solid #f1bc46; border-radius: 29px; box-shadow: 0 0 0 8px rgba(255, 226, 132, .55); content: ''; pointer-events: none; animation: hint-pulse 850ms ease-in-out infinite alternate; }
.sort-box.filled .box-count { background: #35785e; }
.sort-box.filled .box-label::after { position: absolute; width: 26px; height: 26px; right: -9px; top: -10px; display: grid; place-items: center; color: white; font-size: 14px; background: #54aa7c; border: 3px solid white; border-radius: 50%; content: '✓'; }

.feedback-card { min-height: 84px; gap: 14px; padding: 14px 18px; background: rgba(255, 253, 247, .97); border: 3px solid var(--line); border-radius: 24px; box-shadow: var(--soft-shadow); }
.feedback-card .feedback-icon { display: grid; flex: 0 0 51px; height: 51px; place-items: center; font-size: 25px; background: #f1f2e8; border-radius: 16px; }
.feedback-card p { flex: 1; margin: 0; }
.feedback-card strong,
.feedback-card small { display: block; }
.feedback-card strong { margin-bottom: 3px; font-size: 17px; font-weight: 900; }
.feedback-card small { color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.4; }
.feedback-card.correct { border-color: #9acdad; background: #f0fbf2; }
.feedback-card.correct .feedback-icon { background: #d8f2df; }
.feedback-card.wrong { border-color: #efaaa2; background: #fff2ef; }
.feedback-card.wrong .feedback-icon { background: #ffe0db; }
.feedback-card.hint { border-color: #eac66a; background: #fff8dd; }
.feedback-card.hint .feedback-icon { background: #ffedaa; }
.feedback-card.selected-feedback { border-color: #e8c365; background: #fff9e7; }

.drag-ghost { position: fixed; z-index: 1000; width: 100px; height: 100px; margin: -50px 0 0 -50px; pointer-events: none; filter: drop-shadow(0 15px 12px rgba(46, 70, 64, .28)); transform: rotate(-6deg) scale(1.08); }
.drag-ghost .item-svg { width: 100%; height: 100%; }

.result-card { position: relative; min-height: 690px; overflow: hidden; padding: 57px 50px 48px; text-align: center; background: linear-gradient(145deg, #fffaf0, color-mix(in srgb, var(--level-accent), white 88%)); border: 3px solid #ded4b6; border-radius: 39px; box-shadow: var(--shadow); }
.result-card::before,
.result-card::after { position: absolute; border-radius: 50%; content: ''; }
.result-card::before { width: 220px; height: 220px; left: -80px; bottom: -80px; background: rgba(98, 172, 214, .15); }
.result-card::after { width: 180px; height: 180px; right: -60px; top: -70px; background: rgba(242, 189, 77, .18); }
.result-icon { display: grid; width: 84px; height: 84px; margin: 0 auto 15px; place-items: center; font-size: 43px; background: #fff7d4; border: 4px solid #e1ce8b; border-radius: 28px; box-shadow: 0 9px 18px rgba(64, 80, 73, .12); transform: rotate(-4deg); }
.result-card h1 { margin-bottom: 10px; font-size: clamp(44px, 6vw, 68px); font-weight: 900; line-height: 1; letter-spacing: -.04em; }
.result-lead { margin-bottom: 10px; color: var(--muted); font-weight: 700; }
.result-stars { color: #f1b83f; font-size: 42px; letter-spacing: 7px; text-shadow: 0 4px 0 #cf9125; }
.result-stars span { color: #d8d5c8; text-shadow: none; }
.result-boxes { position: relative; z-index: 2; display: flex; min-height: 180px; align-items: end; justify-content: center; gap: 12px; margin: 18px auto 24px; }
.result-box { position: relative; display: block; width: 150px; height: 160px; }
.result-box > i { position: absolute; z-index: 4; width: 126px; min-height: 52px; left: 12px; top: 0; display: grid; place-items: center; padding: 5px; background: #fffdf7; border: 3px solid #684b40; border-radius: 13px; }
.result-box > b { position: absolute; inset: 44px 4px 1px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; overflow: hidden; background: #dc9b68; border: 4px solid #684b40; border-radius: 5px 5px 22px 22px; }
.result-box:nth-child(2) > b { background: #80bddc; }
.result-box:nth-child(3) > b { background: #93c895; }
.result-box:nth-child(4) > b { background: #b499d7; }
.result-box > b .item-svg { width: 51px; height: 51px; margin: -5px; }
.result-stats { position: relative; z-index: 2; width: min(660px, 100%); justify-content: center; margin: 0 auto 28px; overflow: hidden; background: rgba(255, 255, 255, .7); border: 2px solid #ded7c0; border-radius: 22px; }
.result-stats span { flex: 1; padding: 13px 9px; border-right: 2px solid #e4dec9; }
.result-stats span:last-child { border-right: 0; }
.result-stats strong,
.result-stats small { display: block; }
.result-stats strong { font-family: Georgia, serif; font-size: 25px; }
.result-stats small { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.result-actions { position: relative; z-index: 2; justify-content: center; gap: 14px; }
.result-confetti i { position: absolute; z-index: 3; color: var(--gold); font-style: normal; animation: float 1.4s ease-in-out infinite alternate; }
.result-confetti i:nth-child(1) { left: 12%; top: 16%; color: var(--coral); }
.result-confetti i:nth-child(2) { left: 22%; top: 38%; color: var(--blue); animation-delay: -.5s; }
.result-confetti i:nth-child(3) { right: 15%; top: 28%; color: var(--green); animation-delay: -.8s; }
.result-confetti i:nth-child(4) { right: 8%; bottom: 19%; color: var(--gold); animation-delay: -.2s; }
.result-confetti i:nth-child(5) { left: 9%; bottom: 15%; color: var(--purple); animation-delay: -.7s; }

@keyframes float { to { transform: translateY(-9px) rotate(4deg); } }
@keyframes twinkle { 50% { opacity: .45; transform: scale(.76) rotate(20deg); } }
@keyframes point { to { transform: translateX(9px); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-18px) scale(.65) rotate(-9deg); } }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }
@keyframes hint-pulse { to { box-shadow: 0 0 0 13px rgba(255, 226, 132, .18); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 46px 40px 28px; }
  .hero-scene { min-height: 315px; }
  .hero-tray { left: calc(50% - 220px); top: 50px; }
  .hero-arrow { left: calc(50% - 10px); top: 135px; }
  .hero-boxes { right: calc(50% - 220px); top: 39px; }
  .levels-grid { grid-template-columns: 1fr; }
  .level-card { display: grid; min-height: 255px; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto; column-gap: 22px; }
  .level-top, .level-copy, .level-footer { grid-column: 1; }
  .level-preview { grid-column: 2; grid-row: 1 / 4; height: auto; margin: 0; }
  .steps-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 98px; }
  .items-grid { grid-template-columns: repeat(6, minmax(76px, 1fr)); }
  .boxes-grid[data-box-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .app { width: min(100% - 20px, 1120px); padding-top: 12px; }
  .topbar { min-height: 58px; margin-bottom: 13px; }
  .brand-mark { width: 48px; height: 48px; font-size: 24px; border-radius: 16px; }
  .brand strong { font-size: 18px; }
  .brand small { display: none; }
  .sound-button { width: 49px; padding: 0; justify-content: center; }
  .sound-button span:last-child { display: none; }
  .back-button { width: 46px; min-height: 46px; }
  .hero { border-radius: 29px; }
  .hero-copy { padding: 37px 23px 24px; }
  .hero h1 { font-size: clamp(39px, 13vw, 58px); }
  .hero-copy > p:not(.eyebrow) { font-size: 15px; }
  .hero-scene { min-height: 280px; transform: scale(.87); margin: -18px -25px -5px; }
  .how-section, .levels-section { margin-top: 45px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 11px; text-align: left; }
  .section-heading h2 { font-size: 38px; }
  .level-card { display: flex; min-height: 390px; }
  .level-preview { width: 100%; height: 122px; margin: 12px 0 17px; order: initial; }
  .game-heading { padding: 23px 20px; border-radius: 27px; }
  .game-heading h1 { font-size: 34px; }
  .game-heading > div > p:last-child { font-size: 13px; }
  .round-badge { flex-basis: 66px; height: 66px; border-radius: 20px; }
  .mission-strip { align-items: flex-start; flex-direction: column; }
  .mission-strip > span { align-self: flex-end; }
  .items-grid { grid-template-columns: repeat(4, 1fr); gap: 7px; padding: 9px; }
  .item-button { height: 85px; border-radius: 18px; }
  .item-button .item-svg { height: 72px; }
  .tray-card, .boxes-card { padding: 15px 13px 17px; border-radius: 25px; }
  .area-heading { align-items: flex-start; }
  .area-heading > div > span { width: 42px; height: 42px; }
  .hint-button { min-height: 43px; padding: 0 12px; font-size: 12px; }
  .control-tip { display: none; }
  .boxes-grid[data-box-count="3"],
  .boxes-grid[data-box-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sort-box { min-height: 233px; }
  .box-body { height: 145px; }
  .box-label { width: calc(100% - 20px); min-height: 60px; }
  .criterion-chip { padding-inline: 4px; }
  .criterion-chip em { font-size: 9px; }
  .box-item { width: 51px; height: 51px; }
  .feedback-card { align-items: flex-start; flex-wrap: wrap; }
  .feedback-card .primary-button { width: 100%; }
  .result-card { min-height: 650px; padding: 46px 18px 38px; border-radius: 30px; }
  .result-boxes { gap: 5px; overflow: hidden; }
  .result-box { width: 112px; height: 150px; }
  .result-box > i { width: 102px; left: 5px; }
  .result-box > b .item-svg { width: 45px; height: 45px; }
  .result-stats { display: grid; grid-template-columns: repeat(2, 1fr); }
  .result-stats span { border-bottom: 2px solid #e4dec9; }
  .result-stats span:nth-child(2) { border-right: 0; }
  .result-stats span:nth-child(3), .result-stats span:nth-child(4) { border-bottom: 0; }
  .result-actions { align-items: stretch; flex-direction: column-reverse; }
}

@media (max-width: 400px) {
  .brand strong { max-width: 155px; font-size: 16px; }
  .topbar-actions { gap: 5px; }
  .hero-copy { padding-inline: 18px; }
  .hero-scene { transform: scale(.78); margin: -29px -48px -18px; }
  .primary-button { width: 100%; }
  .item-button { height: 76px; }
  .item-button .item-svg { height: 65px; }
  .boxes-grid[data-box-count="2"],
  .boxes-grid[data-box-count="3"],
  .boxes-grid[data-box-count="4"] { grid-template-columns: 1fr; }
  .sort-box { min-height: 215px; }
  .box-body { height: 128px; }
  .box-items { padding-inline: 32px; }
  .box-label { width: min(250px, calc(100% - 30px)); }
  .criterion-chip em { font-size: 10px; }
  .feedback-card { padding: 13px; }
  .feedback-card .feedback-icon { flex-basis: 43px; height: 43px; }
  .result-card h1 { font-size: 42px; }
  .result-boxes { transform: scale(.88); margin-inline: -26px; }
}

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