:root {
  color-scheme: light;
  font-family: "Trebuchet MS", Arial, sans-serif;
  --ink: #294b43;
  --muted: #6b817a;
  --paper: #fffdf7;
  --cream: #f8f0dc;
  --line: #dfd2b1;
  --green: #3f9875;
  --green-dark: #2f755d;
  --coral: #ef7866;
  --gold: #f1ba45;
  --teal: #4ba8a2;
  --purple: #8271ad;
  --shadow: 0 18px 42px rgba(65, 78, 63, .14);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #f7f1df; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(circle at 8% 7%, rgba(255,255,255,.84) 0 7%, transparent 22%),
    radial-gradient(circle at 92% 18%, rgba(241,186,69,.16) 0 8%, transparent 24%),
    linear-gradient(145deg, #f5edda, #fffaf0 55%, #edf5e5);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .13;
  background-image: radial-gradient(#708a78 1px, transparent 1.4px);
  background-size: 27px 27px;
  content: "";
}
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 4px solid rgba(241,186,69,.72); outline-offset: 4px; }
h1, h2, p { margin-top: 0; }
.app { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 46px; }
.game-topbar, .brand, .top-actions, .section-heading, .game-heading, .feedback, .scene-card-copy, .result-actions { display: flex; align-items: center; }
.game-topbar { min-height: 62px; 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: 54px; height: 54px; place-items: center; font-size: 29px; background: #fff5cf; border: 3px solid #dfcf9e; border-radius: 18px; box-shadow: 0 7px 15px rgba(65,80,70,.12); transform: rotate(-4deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 23px; font-weight: 900; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.top-actions { gap: 9px; }
.soft-button, .hint-button, .print-button {
  min-height: 48px;
  padding: 0 16px;
  font-weight: 900;
  background: rgba(255,253,247,.94);
  border: 2px solid var(--line);
  border-radius: 16px;
}
.sound-button { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.eyebrow { margin: 0 0 8px; color: #39775e; font-family: Georgia, serif; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.primary-button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 22px;
  color: white;
  font-weight: 900;
  background: var(--green);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 8px 0 var(--green-dark);
}
.primary-button:active { translate: 0 3px; box-shadow: 0 5px 0 var(--green-dark); }
.primary-button.compact { min-height: 48px; padding-inline: 17px; font-size: 14px; }

.hero {
  display: grid;
  height: 474px;
  overflow: hidden;
  grid-template-columns: .96fr 1.04fr;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 44px;
  box-shadow: var(--shadow);
}
.hero-copy { position: relative; display: grid; align-content: center; padding: clamp(32px,5vw,57px); }
.hero h1 { margin-bottom: 17px; font-family: Georgia, serif; font-size: clamp(45px,5.1vw,59px); line-height: 1.02; letter-spacing: -.035em; }
.hero h1 span { color: var(--coral); }
.hero-copy > p:not(.eyebrow) { max-width: 470px; margin-bottom: 25px; color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1.5; }
.hero-progress { position: absolute; right: 22px; bottom: 21px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #edf6e9; border-radius: 15px; }
.hero-progress strong { font: 900 27px Georgia, serif; }
.hero-progress span { color: var(--muted); font-size: 10px; font-weight: 900; line-height: 1.15; }
.hero-art { min-width: 0; background: #e6eddb; }
.hero-art img { width: 100%; height: 100%; display: block; object-fit: cover; }

.how, .gallery { margin-top: 44px; }
.section-heading { justify-content: space-between; gap: 22px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(33px,4vw,44px); line-height: 1.08; }
.section-heading > p { max-width: 390px; margin: 0; color: var(--muted); font-weight: 700; text-align: right; line-height: 1.45; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps article { display: grid; min-height: 126px; align-items: center; grid-template-columns: 58px 1fr; gap: 14px; padding: 19px; background: var(--paper); border: 2px solid var(--line); border-radius: 24px; }
.steps article > span { display: grid; width: 55px; height: 55px; place-items: center; color: white; font: 900 25px Georgia, serif; background: var(--coral); border: 5px solid #ffe1d9; border-radius: 50%; }
.steps article:nth-child(2) > span { color: #684a09; background: var(--gold); border-color: #fff0bd; }
.steps article:nth-child(3) > span { background: var(--teal); border-color: #d7f1ed; }
.steps strong, .steps small { display: block; }
.steps strong { margin-bottom: 5px; font-size: 17px; }
.steps small { color: var(--muted); font-weight: 700; line-height: 1.4; }
.scene-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.scene-card { min-width: 0; padding: 0; overflow: hidden; text-align: left; background: var(--paper); border: 2px solid var(--line); border-radius: 26px; box-shadow: 0 7px 0 #d9ceb0; }
.scene-card:hover { translate: 0 -2px; border-color: #b8d7c6; }
.scene-preview { display: block; height: 235px; overflow: hidden; background: #f3f8e9; border-bottom: 2px solid var(--line); }
.scene-preview svg { width: 100%; height: 100%; display: block; }
.scene-card-copy { justify-content: space-between; gap: 12px; padding: 16px 18px 19px; }
.scene-card-copy small, .scene-card-copy strong, .scene-card-copy em { display: block; }
.scene-card-copy small { color: var(--green-dark); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.scene-card-copy strong { margin-top: 3px; font-size: 20px; }
.scene-card-copy em { margin-top: 4px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 700; }
.scene-card-copy i { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; color: white; font-size: 19px; font-style: normal; background: var(--green); border-radius: 14px; }
.scene-card.is-done .scene-card-copy i { background: var(--gold); }

.game-shell { padding: clamp(22px,4vw,39px); background: var(--paper); border: 3px solid var(--line); border-radius: 40px; box-shadow: var(--shadow); }
.game-heading { justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.game-heading h1 { margin-bottom: 7px; font-family: Georgia, serif; font-size: clamp(37px,4.8vw,52px); line-height: 1.02; }
.game-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-weight: 700; }
.round-badge { display: grid; min-width: 76px; height: 76px; place-items: center; align-content: center; color: white; background: var(--purple); border: 6px solid #e4ddf4; border-radius: 50%; }
.round-badge strong { font: 900 27px Georgia, serif; }
.round-badge small { font-size: 9px; font-weight: 900; }
.play-layout { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 18px; }
.picture-panel, .palette-panel { min-width: 0; padding: 19px; border-radius: 29px; }
.picture-panel { background: #edf5e9; border: 2px solid #c8dbc1; }
.picture-wrap { overflow: hidden; background: white; border: 2px solid #d5cfb7; border-radius: 23px; }
.animal-picture { width: 100%; height: auto; display: block; touch-action: manipulation; }
.scene-paper { fill: #fffaf0; stroke: #e2d4b6; stroke-width: 3; }
.decor { pointer-events: none; }
.sun { fill: #f5d675; }
.moon { fill: #e9dce9; }
.grass { fill: #dcebc9; }
.water { fill: #d9eef0; }
.cloud { fill: #e7f0e9; }
.paint-zone { --paint: #fffaf0; cursor: pointer; outline: none; }
.paint-zone > :first-child { fill: var(--paint); stroke: #385b55; stroke-width: 4; stroke-linejoin: round; transition: fill .22s ease, filter .15s ease; }
.paint-zone:hover > :first-child, .paint-zone:focus-visible > :first-child { filter: brightness(.96); stroke-width: 6; }
.zone-number { fill: #385b55; font: 900 24px "Trebuchet MS", Arial, sans-serif; text-anchor: middle; pointer-events: none; }
.paint-zone.is-painted { cursor: default; }
.paint-zone.is-painted .zone-number { display: none; }
.paint-zone.is-painted > :first-child { fill: var(--paint); }
.paint-zone.is-wrong > :first-child { animation: shake .34s ease; stroke: #d8584e; }
.paint-zone.is-hint > :first-child { animation: hintPulse .8s ease-in-out infinite alternate; stroke: var(--gold); stroke-width: 8; }
.line-detail { fill: none; stroke: #385b55; stroke-width: 5; stroke-linecap: round; pointer-events: none; }
.line-detail.nose, .line-detail.eye-dot { fill: #385b55; }
.picture-meter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-top: 14px; }
.picture-meter > span { height: 13px; overflow: hidden; background: #dce5d6; border-radius: 999px; }
.picture-meter i { display: block; height: 100%; background: linear-gradient(90deg,var(--teal),var(--green)); border-radius: inherit; transition: width .25s ease; }
.picture-meter b { color: var(--muted); font-size: 12px; white-space: nowrap; }
.palette-panel { background: #fff6dc; border: 2px solid #e6d39d; }
.palette-panel h2 { margin-bottom: 8px; font-family: Georgia, serif; font-size: 31px; }
.palette-panel > p:not(.eyebrow) { margin-bottom: 17px; color: var(--muted); font-weight: 700; }
.palette { display: grid; gap: 9px; }
.color-button { display: grid; min-height: 57px; align-items: center; grid-template-columns: 43px 1fr; gap: 12px; padding: 6px 10px; text-align: left; background: rgba(255,253,247,.9); border: 2px solid #ded2b2; border-radius: 17px; }
.color-button > span { display: grid; width: 42px; height: 42px; place-items: center; color: white; font: 900 20px Georgia, serif; background: var(--swatch); border: 4px solid white; border-radius: 50%; box-shadow: 0 3px 0 rgba(60,70,55,.16); }
.color-button small { color: var(--muted); font-size: 12px; font-weight: 900; }
.color-button.active { border-color: var(--swatch); box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch) 24%, transparent); translate: -3px 0; }
.hint-button { width: 100%; margin-top: 14px; color: #755814; background: #fff1bd; border-color: #dfc165; }
.feedback { min-height: 88px; gap: 14px; margin-top: 18px; padding: 14px 17px; background: #edf5e9; border: 2px solid #bfd7c3; border-radius: 24px; }
.feedback > span { display: grid; width: 49px; height: 49px; flex: 0 0 auto; place-items: center; font-size: 23px; background: white; border-radius: 16px; }
.feedback > div:not(.feedback-actions) { flex: 1; min-width: 0; }
.feedback strong, .feedback small { display: block; }
.feedback small { margin-top: 4px; color: var(--muted); font-weight: 700; line-height: 1.35; }
.feedback[data-kind="error"] { background: #fff0eb; border-color: #efb2a6; }
.feedback[data-kind="hint"] { background: #fff5d6; border-color: #e4c86c; }
.feedback[data-kind="success"] { background: #e4f5e8; border-color: #95c8a3; }
.feedback-actions { margin-left: auto; }

.result-card { padding: clamp(28px,5vw,52px); text-align: center; background: var(--paper); border: 3px solid var(--line); border-radius: 40px; box-shadow: var(--shadow); }
.result-medal { display: grid; width: 74px; height: 74px; place-items: center; margin: 0 auto 17px; color: white; font-size: 36px; background: var(--gold); border: 7px solid #fff0bc; border-radius: 50%; transform: rotate(-5deg); }
.result-card h1 { margin-bottom: 13px; font: 900 clamp(39px,5vw,57px)/1.04 Georgia, serif; }
.result-card > p:not(.eyebrow) { max-width: 700px; margin: 0 auto 25px; color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1.5; }
.result-gallery { display: grid; grid-template-columns: repeat(4,1fr); gap: 11px; }
.result-gallery article { overflow: hidden; background: #f5f2e7; border: 2px solid var(--line); border-radius: 20px; }
.result-gallery article > div { height: 150px; overflow: hidden; }
.result-gallery svg { width: 100%; height: 100%; display: block; }
.result-gallery strong { display: block; padding: 10px; }
.result-actions { justify-content: center; flex-wrap: wrap; gap: 13px; margin-top: 25px; }
.print-button { color: var(--ink); }
.print-sheet { display: none; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; max-width: min(540px,calc(100% - 32px)); padding: 13px 18px; color: white; background: #294b43; border-radius: 15px; box-shadow: var(--shadow); font-weight: 900; translate: -50% 14px; opacity: 0; transition: .18s ease; }
.toast.show { translate: -50% 0; opacity: 1; }

@keyframes shake { 25% { translate: -7px 0; } 50% { translate: 7px 0; } 75% { translate: -4px 0; } }
@keyframes hintPulse { from { filter: brightness(1); } to { filter: brightness(.88) drop-shadow(0 0 7px #f1ba45); } }

@media (max-width: 900px) {
  .hero { height: auto; grid-template-columns: 1fr; }
  .hero-copy { min-height: 390px; }
  .hero-art { height: 330px; }
  .play-layout { grid-template-columns: 1fr; }
  .palette { grid-template-columns: repeat(5,1fr); }
  .color-button { min-height: 66px; display: grid; grid-template-columns: 1fr; justify-items: center; gap: 3px; text-align: center; }
  .color-button.active { translate: 0 -3px; }
  .result-gallery { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 680px) {
  .app { width: min(100% - 20px,1120px); padding: 12px 0 30px; }
  .game-topbar { margin-bottom: 13px; }
  .brand-mark { width: 47px; height: 47px; font-size: 24px; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 8px; }
  .soft-button { min-height: 44px; padding: 0 11px; }
  .sound-button b { display: none; }
  .hero { border-radius: 30px; }
  .hero-copy { min-height: 365px; padding: 30px 23px 70px; }
  .hero h1 { font-size: clamp(39px,12vw,51px); }
  .hero-art { height: 255px; }
  .how, .gallery { margin-top: 34px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .section-heading > p { text-align: left; }
  .steps, .scene-grid { grid-template-columns: 1fr; }
  .scene-preview { height: 205px; }
  .game-shell { padding: 17px; border-radius: 29px; }
  .game-heading { align-items: flex-start; }
  .round-badge { min-width: 58px; height: 58px; border-width: 4px; }
  .round-badge strong { font-size: 21px; }
  .picture-panel, .palette-panel { padding: 11px; border-radius: 22px; }
  .picture-wrap { border-radius: 17px; }
  .palette { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; }
  .color-button { min-height: 54px; padding: 4px 2px; border-radius: 13px; }
  .color-button > span { width: 37px; height: 37px; font-size: 17px; border-width: 3px; }
  .color-button small { display: none; }
  .feedback { align-items: flex-start; flex-wrap: wrap; }
  .feedback-actions { width: 100%; margin-left: 0; }
  .feedback-actions button { width: 100%; }
  .result-gallery article > div { height: 130px; }
}

@media (max-width: 390px) {
  .brand small { display: none; }
  .top-actions .soft-button[data-home] b { display: none; }
  .hero-copy { min-height: 350px; }
  .hero-art { height: 220px; }
  .picture-meter { grid-template-columns: 1fr; gap: 7px; }
  .result-card { padding-inline: 18px; }
}

@media print {
  body { background: white !important; }
  body::before, .ik-game-header, .ik-side-rail, .app > :not(.print-sheet), .ik-game-outro, .ik-game-footer, .toast { display: none !important; }
  .app { width: 100%; padding: 0; }
  .print-sheet { display: block; color: #294b43; font-family: "Trebuchet MS", Arial, sans-serif; text-align: center; }
  .print-sheet h1 { margin: 0 0 16px; font: 900 28px Georgia, serif; }
  .print-sheet > div { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
  .print-sheet article { break-inside: avoid; padding: 8px; border: 2px solid #cfc6ad; border-radius: 16px; }
  .print-sheet svg { width: 100%; max-height: 310px; }
  .print-sheet strong { display: block; margin-top: 4px; font-size: 16px; }
}

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