:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #2d504d;
  --muted: #70837e;
  --paper: #fffdf7;
  --line: #ded7be;
  --green: #58a97b;
  --gold: #efb84d;
  --coral: #e97b68;
  --blue: #65a9ce;
  --purple: #8b78b4;
  --shadow: 0 18px 44px rgba(57, 78, 70, .14);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #f5f8ed; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(243, 196, 94, .18) 0 120px, transparent 122px),
    radial-gradient(circle at 92% 25%, rgba(114, 184, 147, .15) 0 160px, transparent 162px),
    linear-gradient(145deg, #f4f8ec, #fffaf1 56%, #f2effa);
}
body::before { position: fixed; inset: 0; z-index: -1; opacity: .14; background-image: radial-gradient(#709086 1.2px, transparent 1.2px); background-size: 28px 28px; content: ""; }
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible { outline: 4px solid rgba(239, 184, 77, .75); outline-offset: 4px; }
h1, h2, p { margin-top: 0; }

.app { width: min(1120px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; padding: 20px 0 48px; }
.loading-card { display: grid; min-height: 320px; place-items: center; align-content: center; gap: 12px; margin-top: 60px; background: var(--paper); border: 3px solid var(--line); border-radius: 42px; box-shadow: var(--shadow); }
.loading-card span { font-size: 64px; }
.loading-card p { color: var(--muted); font-weight: 900; }
.topbar, .brand, .topbar-actions, .section-heading, .game-head, .answer-heading, .feedback-card, .animal-note { display: flex; align-items: center; }
.topbar { min-height: 68px; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.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: #fff3c9; border: 3px solid #decf9f; border-radius: 19px; box-shadow: 0 7px 16px rgba(65, 84, 76, .12); transform: rotate(-4deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 24px; font-weight: 900; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { gap: 10px; }
.top-flower { color: var(--coral); font-size: 28px; }
.sound-button, .back-button { min-width: 48px; min-height: 48px; font-weight: 900; background: rgba(255, 253, 247, .94); border: 2px solid var(--line); border-radius: 17px; }
.sound-button { display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: 13px; }
.back-button { padding: 0; font-size: 22px; }
.eyebrow { margin: 0 0 8px; color: #3b7d64; font-family: Georgia, serif; font-size: 12px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.primary-button, .secondary-button, .hint-button { min-width: 44px; min-height: 52px; border-radius: 17px; font-weight: 900; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; color: white; background: #3e9875; border: 0; box-shadow: 0 8px 0 #2d795d; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 4px 0 #2d795d; }
.primary-button.compact { min-height: 46px; margin-left: auto; box-shadow: none; }
.secondary-button { padding: 0 21px; background: white; border: 2px solid var(--line); }
.hint-button { padding: 0 18px; background: #fff3c8; border: 2px solid #dfc76f; }
.hint-button:hover:not(:disabled) { background: #ffeaa3; }

.hero { display: grid; min-height: 500px; align-items: center; grid-template-columns: 1.02fr .98fr; gap: 52px; padding: clamp(42px, 6vw, 70px); overflow: hidden; background: rgba(255, 253, 247, .97); border: 3px solid var(--line); border-radius: 46px; box-shadow: var(--shadow); }
.hero h1 { max-width: 560px; margin-bottom: 19px; font-size: clamp(48px, 5.7vw, 70px); font-weight: 900; letter-spacing: -.055em; line-height: .98; }
.hero-copy > p:not(.eyebrow) { max-width: 520px; margin-bottom: 27px; color: var(--muted); font-size: 18px; font-weight: 800; line-height: 1.52; }
.hero-facts { display: flex; gap: 9px; margin-top: 27px; }
.hero-facts span { padding: 9px 13px; color: var(--muted); font-size: 12px; font-weight: 900; background: #f4f5eb; border-radius: 13px; }
.hero-facts strong { color: var(--ink); font-size: 17px; }
.hero-art { position: relative; min-height: 360px; }
.hero-board { position: absolute; inset: 0 10px 30px 0; padding: 30px 25px; background: #eaf4e5; border: 7px solid white; border-radius: 38px; box-shadow: 0 20px 38px rgba(57, 75, 70, .18); transform: rotate(2deg); }
.hero-label { display: block; margin-bottom: 16px; color: #55766c; font-family: Georgia, serif; font-size: 12px; font-weight: 900; letter-spacing: .13em; text-align: center; }
.hero-pictures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.hero-pictures .object-picture { width: 100%; }
.hero-answer { display: flex; min-height: 60px; align-items: center; justify-content: center; gap: 10px; margin: 17px auto 0; color: white; font-size: 18px; background: var(--green); border-radius: 18px; box-shadow: 0 6px 0 #3e8260; }
.hero-answer span { font-size: 28px; }
.hero-animal { position: absolute; right: -24px; bottom: 0; z-index: 2; width: 145px; height: 145px; object-fit: contain; filter: drop-shadow(0 12px 12px rgba(57, 75, 70, .2)); }

.how-section, .levels-section { margin-top: 48px; }
.section-heading { justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(33px, 4vw, 46px); font-weight: 900; letter-spacing: -.035em; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 800; text-align: right; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.step-card { display: grid; min-height: 135px; align-items: center; grid-template-columns: 66px 1fr; gap: 14px; padding: 20px; background: var(--paper); border: 2px solid var(--line); border-radius: 25px; }
.step-number { display: grid; width: 62px; height: 62px; place-items: center; color: white; font-family: Georgia, serif; font-size: 29px; font-weight: 900; line-height: 1; background: var(--green); border: 5px solid #d8efdf; 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: #e7def7; }
.step-card strong, .step-card small { display: block; }
.step-card strong { margin-bottom: 6px; font-size: 18px; }
.step-card small { color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.4; }
.levels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.level-card { min-width: 0; padding: 18px; text-align: left; background: var(--paper); border: 3px solid var(--line); border-radius: 29px; box-shadow: 0 8px 0 #d8d1b7; transition: transform .16s ease, border-color .16s ease; }
.level-card:hover { border-color: var(--level); transform: translateY(-3px); }
.level-card.green { --level: var(--green); }
.level-card.gold { --level: var(--gold); }
.level-card.purple { --level: var(--purple); }
.level-head, .level-go { display: flex; align-items: center; justify-content: space-between; }
.level-number { display: grid; width: 46px; height: 46px; place-items: center; color: white; font-family: Georgia, serif; font-weight: 900; background: var(--level); border-radius: 15px; }
.level-best { color: #aa7b20; font-size: 14px; font-weight: 900; }
.level-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 15px 0; padding: 9px; background: color-mix(in srgb, var(--level) 12%, white); border-radius: 20px; }
.level-preview .object-picture { width: 100%; }
.level-copy small, .level-copy strong, .level-copy span { display: block; }
.level-copy small { color: var(--level); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.level-copy strong { margin: 6px 0; font-size: 23px; }
.level-copy span { min-height: 42px; color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.4; }
.level-go { margin-top: 16px; color: var(--level); font-weight: 900; }
.animal-note { gap: 16px; margin-top: 32px; padding: 18px 22px; background: #eef4e8; border: 2px solid #ceddc7; border-radius: 25px; }
.animal-note img { width: 76px; height: 76px; object-fit: contain; }
.animal-note p { margin: 0; }
.animal-note strong, .animal-note span { display: block; }
.animal-note span { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.45; }

.game-shell { padding: clamp(24px, 4vw, 44px); background: var(--paper); border: 3px solid var(--line); border-radius: 42px; box-shadow: var(--shadow); }
.game-head { justify-content: space-between; gap: 25px; }
.game-head h1 { margin-bottom: 8px; font-size: clamp(36px, 5vw, 54px); font-weight: 900; letter-spacing: -.045em; }
.game-head > div > p:last-child { margin: 0; color: var(--muted); font-weight: 800; }
.round-badge { display: grid; min-width: 82px; height: 82px; place-items: center; align-content: center; color: white; background: var(--accent); border: 6px solid color-mix(in srgb, var(--accent) 25%, white); border-radius: 50%; }
.round-badge strong { font-family: Georgia, serif; font-size: 29px; line-height: 1; }
.round-badge span { margin-top: 2px; font-size: 10px; font-weight: 900; }
.progress-dots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 24px 0; }
.progress-dots span { height: 7px; background: #e2ded0; border-radius: 999px; }
.progress-dots .done { background: var(--green); }
.progress-dots .current { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.object-board { padding: 22px; background: #f0f6eb; border: 3px solid #cfe0c8; border-radius: 31px; }
.board-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; color: #56746b; font-weight: 900; }
.board-label small { padding: 6px 10px; background: white; border-radius: 10px; }
.objects-grid { display: grid; gap: 12px; }
.objects-grid.count-3 { grid-template-columns: repeat(3, 1fr); }
.objects-grid.count-4 { grid-template-columns: repeat(4, 1fr); }
.objects-grid.count-5 { grid-template-columns: repeat(5, 1fr); }
.object-card { position: relative; min-width: 0; min-height: 150px; padding: 10px 8px 13px; background: white; border: 3px solid #ddd7c4; border-radius: 23px; }
.object-card:not(:disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.object-card:disabled { opacity: 1; }
.object-card.is-selectable { box-shadow: 0 6px 0 #d6d2c1; }
.object-card.is-wrong { border-color: var(--coral); background: #fff0ed; animation: shake .22s ease; }
.object-card.is-outside { opacity: .45; border-style: dashed; }
.object-card.is-hinted { border-color: var(--gold); box-shadow: 0 0 0 6px rgba(239, 184, 77, .25); animation: pulse 1s ease infinite; }
.object-picture { display: block; width: min(122px, 100%); height: auto; margin: 0 auto; overflow: visible; }
.object-card strong { display: block; margin-top: 4px; font-size: 15px; }
.object-mark { position: absolute; top: 7px; right: 7px; display: grid; width: 30px; height: 30px; place-items: center; color: white; font-size: 19px; font-weight: 900; background: var(--coral); border-radius: 50%; }
.object-card.is-outside .object-mark { background: var(--green); }
.object-mark:empty { display: none; }
.answer-panel { margin-top: 18px; padding: 20px; background: #fff9e9; border: 3px solid #ead9a6; border-radius: 28px; }
.answer-heading { justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.answer-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); }
.category-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.category-option { position: relative; display: flex; min-width: 0; min-height: 76px; align-items: center; gap: 9px; padding: 10px 12px; text-align: left; background: white; border: 3px solid #ddd6bf; border-radius: 20px; box-shadow: 0 5px 0 #ddd6bf; }
.category-option > span { display: grid; min-width: 42px; height: 42px; place-items: center; font-size: 25px; background: color-mix(in srgb, var(--category) 18%, white); border-radius: 13px; }
.category-option strong { font-size: 14px; line-height: 1.15; }
.category-option small { position: absolute; top: 5px; right: 7px; color: #a6a08d; font-size: 10px; font-weight: 900; }
.category-option:hover:not(:disabled) { border-color: var(--category); }
.category-option.is-wrong { color: #a95349; background: #fff0ed; border-color: var(--coral); box-shadow: none; }
.category-option.is-hinted { border-color: var(--gold); box-shadow: 0 0 0 6px rgba(239, 184, 77, .25); animation: pulse 1s ease infinite; }
.closed-basket { display: flex; min-height: 76px; align-items: center; justify-content: center; gap: 13px; padding: 12px; background: rgba(255, 255, 255, .7); border: 2px dashed #d6c897; border-radius: 19px; }
.closed-basket > span { font-size: 34px; }
.closed-basket p { margin: 0; }
.closed-basket strong, .closed-basket small { display: block; }
.closed-basket small { margin-top: 3px; color: var(--muted); font-weight: 800; }
.feedback-card { min-height: 84px; gap: 13px; margin-top: 18px; padding: 14px 16px; background: #f4f6f0; border: 2px solid #d8ded4; border-radius: 22px; }
.feedback-card > span { display: grid; min-width: 52px; height: 52px; place-items: center; font-size: 27px; background: white; border-radius: 16px; }
.feedback-card p { margin: 0; }
.feedback-card strong, .feedback-card small { display: block; }
.feedback-card small { margin-top: 4px; color: var(--muted); font-weight: 800; }
.feedback-card.success { background: #eaf6ed; border-color: #a9d2b6; }
.feedback-card.retry { background: #fff1ed; border-color: #e7b4aa; }

.result-card { max-width: 790px; margin: 38px auto; padding: clamp(30px, 5vw, 55px); text-align: center; background: var(--paper); border: 3px solid var(--line); border-radius: 42px; box-shadow: var(--shadow); }
.result-art { position: relative; width: 180px; height: 150px; margin: 0 auto 6px; }
.result-art img { width: 100%; height: 100%; object-fit: contain; }
.result-art span { position: absolute; right: 5px; bottom: 16px; display: grid; width: 48px; height: 48px; place-items: center; color: white; font-size: 27px; font-weight: 900; background: var(--green); border: 5px solid white; border-radius: 50%; }
.result-card h1 { margin-bottom: 13px; font-size: clamp(42px, 6vw, 65px); letter-spacing: -.05em; }
.result-card > p:not(.eyebrow) { color: var(--muted); font-size: 17px; font-weight: 800; }
.result-stars { margin: 22px 0; color: var(--gold); font-size: 42px; letter-spacing: 6px; }
.result-stars span { color: #dedbcf; }
.learned-groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.learned-groups span { display: flex; align-items: center; gap: 7px; padding: 9px 13px; font-weight: 900; background: #f1f5eb; border-radius: 14px; }
.learned-groups b { font-size: 23px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 25px 0; }
.result-stats span { padding: 14px; background: #f5f3e9; border-radius: 17px; }
.result-stats strong, .result-stats small { display: block; }
.result-stats strong { font-family: Georgia, serif; font-size: 27px; }
.result-stats small { color: var(--muted); font-weight: 800; }
.result-actions { display: flex; justify-content: center; gap: 12px; }

@keyframes shake { 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
@keyframes pulse { 50% { transform: translateY(-3px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 44px; }
  .hero-copy { text-align: center; }
  .hero-copy > p:not(.eyebrow), .hero h1 { margin-right: auto; margin-left: auto; }
  .hero-facts { justify-content: center; }
  .hero-art { width: min(540px, 100%); margin: 0 auto; }
  .steps-grid, .levels-grid { grid-template-columns: 1fr; }
  .level-card { display: grid; align-items: center; grid-template-columns: 130px 1fr; gap: 8px 18px; }
  .level-head { grid-column: 1 / -1; }
  .level-preview { grid-row: 2 / 4; margin: 0; }
  .level-go { margin-top: 6px; }
  .objects-grid.count-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .app { width: min(1120px, calc(100% - 20px)); padding-top: 10px; }
  .topbar { min-height: 54px; margin-bottom: 12px; }
  .brand-mark { width: 46px; height: 46px; font-size: 23px; border-radius: 15px; }
  .brand strong { font-size: 18px; }
  .brand small, .sound-button span:last-child, .top-flower { display: none; }
  .sound-button { width: 48px; padding: 0; justify-content: center; }
  .hero { min-height: auto; padding: 34px 20px; border-radius: 31px; }
  .hero h1 { font-size: 43px; }
  .hero-art { min-height: 320px; }
  .how-section, .levels-section { margin-top: 36px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .section-heading > p { text-align: left; }
  .level-card { display: block; }
  .level-preview { margin: 13px 0; }
  .game-shell { padding: 20px 13px; border-radius: 29px; }
  .game-head { align-items: flex-start; }
  .game-head h1 { font-size: 35px; }
  .round-badge { min-width: 64px; height: 64px; border-width: 4px; }
  .object-board { padding: 13px; }
  .objects-grid.count-3, .objects-grid.count-4, .objects-grid.count-5 { grid-template-columns: repeat(2, 1fr); }
  .object-card { min-height: 132px; }
  .category-options { grid-template-columns: repeat(2, 1fr); }
  .feedback-card { align-items: flex-start; flex-wrap: wrap; }
  .feedback-card .primary-button { width: 100%; margin-left: 0; }
  .animal-note { align-items: flex-start; }
}

@media (max-width: 420px) {
  .hero-facts { flex-wrap: wrap; }
  .hero-board { inset-right: 0; padding: 25px 13px; }
  .hero-animal { right: -6px; width: 116px; height: 116px; }
  .answer-heading { align-items: flex-start; flex-direction: column; }
  .hint-button { width: 100%; }
  .category-option { min-height: 70px; padding: 8px; }
  .category-option > span { min-width: 37px; height: 37px; font-size: 22px; }
  .result-stats { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
}

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