:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #294f4b;
  --muted: #6d817d;
  --paper: #fffdf7;
  --cream: #fff5dc;
  --line: #ddd4b7;
  --green: #56a47c;
  --green-dark: #34745b;
  --gold: #efb642;
  --coral: #dd8959;
  --blue: #62abd0;
  --purple: #8a74b7;
  --shadow: 0 18px 44px rgba(57, 78, 70, .14);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  overflow-y: scroll;
  background: #fff8e9;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 10%, rgba(242, 188, 69, .2) 0 116px, transparent 118px),
    radial-gradient(circle at 94% 30%, rgba(93, 172, 208, .12) 0 170px, transparent 173px),
    linear-gradient(145deg, #fff7e5, #fffdf5 53%, #eef7e9);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .14;
  background-image: radial-gradient(#6f9186 1px, transparent 1px);
  background-size: 27px 27px;
  content: "";
}

button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible,
[role="button"]:focus-visible {
  outline: 4px solid rgba(239, 182, 66, .78);
  outline-offset: 4px;
}
h1, h2, h3, p { margin-top: 0; }

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

.topbar,
.brand,
.topbar-actions,
.hero-actions,
.section-heading,
.game-heading,
.game-meta,
.feedback-card,
.result-actions {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 64px;
  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: 28px;
  background: #fff0c8;
  border: 3px solid #e7cb91;
  border-radius: 18px;
  box-shadow: 0 7px 16px rgba(67, 87, 78, .12);
  transform: rotate(-3deg);
}

.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: .05em;
  text-transform: uppercase;
}

.topbar-actions { gap: 10px; }
.sound-button,
.back-button,
.secondary-button {
  min-height: 48px;
  color: var(--ink);
  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;
  padding: 0 16px;
  font-size: 13px;
}
.back-button { width: 48px; padding: 0; font-size: 22px; }
.secondary-button { padding: 0 18px; }

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

.primary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 21px;
  color: white;
  font-weight: 900;
  background: var(--green);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 8px 0 var(--green-dark);
}

.primary-button:hover { background: #459873; }
.secondary-button:hover { border-color: var(--green); background: #f8fff8; }
.primary-button:active,
.secondary-button:active,
.route-card:active { translate: 0 2px; }

.hero {
  display: grid;
  min-height: 460px;
  align-items: center;
  grid-template-columns: 1.04fr .96fr;
  gap: 46px;
  padding: clamp(38px, 5vw, 64px);
  overflow: hidden;
  background: rgba(255, 253, 247, .97);
  border: 3px solid var(--line);
  border-radius: 44px;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 650px;
  margin-bottom: 17px;
  font-size: clamp(44px, 5.4vw, 68px);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 620px;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.52;
}

.hero-actions { flex-wrap: wrap; gap: 12px; }

.hero-preview {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background:
    linear-gradient(154deg, transparent 0 58%, rgba(88, 143, 77, .38) 58% 100%),
    linear-gradient(#bfe6e5 0 50%, #91bf72 50% 100%);
  border: 8px solid white;
  border-radius: 34px;
  box-shadow: 0 20px 38px rgba(57, 75, 70, .2);
}

.hero-preview::before {
  position: absolute;
  top: 28px;
  right: 34px;
  width: 62px;
  height: 62px;
  background: #f6c95b;
  border: 7px solid #fff0b4;
  border-radius: 50%;
  content: "";
}

.hero-preview::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  height: 24px;
  background: #719454;
  content: "";
}

.farm-preview-cloud {
  position: absolute;
  top: 46px;
  left: 38px;
  width: 92px;
  height: 28px;
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
}

.farm-preview-cloud::before,
.farm-preview-cloud::after {
  position: absolute;
  bottom: 8px;
  width: 38px;
  height: 38px;
  background: inherit;
  border-radius: 50%;
  content: "";
}
.farm-preview-cloud::before { left: 15px; }
.farm-preview-cloud::after { right: 12px; width: 48px; height: 48px; }

.farm-preview-barn {
  position: absolute;
  bottom: 42px;
  left: 30px;
  z-index: 2;
  width: 142px;
  height: 116px;
  background:
    linear-gradient(45deg, transparent 45%, #fff3cf 46% 52%, transparent 53%) 50% 70% / 54px 54px no-repeat,
    linear-gradient(-45deg, transparent 45%, #fff3cf 46% 52%, transparent 53%) 50% 70% / 54px 54px no-repeat,
    linear-gradient(#b85645, #c8664e);
  border: 6px solid #8e4c3a;
  border-radius: 8px 8px 4px 4px;
}
.farm-preview-barn::before {
  position: absolute;
  top: -48px;
  left: -14px;
  width: 158px;
  height: 78px;
  background: #9c4c3b;
  clip-path: polygon(50% 0, 100% 72%, 92% 100%, 8% 100%, 0 72%);
  content: "";
}
.farm-preview-barn::after {
  position: absolute;
  bottom: -6px;
  left: 44px;
  width: 54px;
  height: 68px;
  background: #744536;
  border: 5px solid #fff1c5;
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  content: "";
}

.farm-preview-fence {
  position: absolute;
  right: -10px;
  bottom: 46px;
  z-index: 2;
  width: 235px;
  height: 70px;
  background:
    linear-gradient(#986440, #986440) 0 14px / 100% 12px no-repeat,
    linear-gradient(#986440, #986440) 0 48px / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 40px, #845536 41px 57px, transparent 58px 76px);
  transform: rotate(-3deg);
}

.farm-preview-hay {
  position: absolute;
  right: 22px;
  bottom: 28px;
  z-index: 3;
  width: 96px;
  height: 49px;
  background:
    repeating-linear-gradient(8deg, transparent 0 8px, rgba(171, 116, 38, .35) 9px 11px),
    #e4b74f;
  border: 5px solid #bd8434;
  border-radius: 15px;
}

.farm-preview-animal {
  position: absolute;
  z-index: 4;
  display: block;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 7px rgba(60, 70, 47, .18));
}
.farm-preview-animal--piglet {
  right: 126px;
  bottom: 20px;
  width: 118px;
}
.farm-preview-animal--pig {
  right: 20px;
  bottom: 57px;
  width: 154px;
}

.routes-section { margin-top: 44px; }
.section-heading {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 900;
  letter-spacing: -.035em;
}
.section-heading > p {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-align: right;
}

.routes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.route-card {
  display: grid;
  min-height: 220px;
  align-content: space-between;
  gap: 18px;
  padding: 25px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 27px;
  box-shadow: 0 8px 0 #d9d4c1;
}
.route-card:hover { border-color: var(--green); translate: 0 -2px; }
.route-card:nth-child(2) { background: #f3f9fc; }
.route-card:nth-child(3) { background: #f4f1fa; }
.route-icon {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  font-size: 31px;
  background: white;
  border-radius: 19px;
}
.route-card strong,
.route-card small,
.route-card em { display: block; }
.route-card strong { margin-bottom: 8px; font-size: 23px; }
.route-card small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}
.route-card em {
  margin-top: 15px;
  color: #39775f;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 26px;
}
.how-card {
  display: grid;
  min-height: 108px;
  align-items: center;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 18px;
  background: rgba(255, 253, 247, .88);
  border: 2px solid var(--line);
  border-radius: 23px;
}
.how-card span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: white;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 900;
  background: var(--green);
  border-radius: 50%;
}
.how-card:nth-child(2) span { background: var(--gold); }
.how-card:nth-child(3) span { background: var(--purple); }
.how-card strong { display: block; margin-bottom: 4px; }
.how-card small { color: var(--muted); font-weight: 600; line-height: 1.35; }

.game-shell {
  padding: clamp(22px, 3.7vw, 42px);
  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: 20px;
}
.game-heading h1 {
  margin-bottom: 7px;
  font-size: clamp(32px, 4.5vw, 50px);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.04;
}
.game-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}
.game-meta {
  min-width: 230px;
  justify-content: flex-end;
  gap: 13px;
}
.progress-track {
  width: 170px;
  height: 14px;
  overflow: hidden;
  background: #e5e2d7;
  border-radius: 20px;
}
.progress-fill {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}
.progress-label { min-width: 42px; font-weight: 900; }

.scene-instruction {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 13px 17px;
  background: #fff6da;
  border: 2px solid #ead17e;
  border-radius: 19px;
}
.scene-instruction strong { font-size: 17px; }
.found-counter {
  min-width: 124px;
  color: #2f765b;
  font-weight: 900;
  text-align: right;
}

.scenes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.scene-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #edf6ed;
  border: 3px solid #c8d9c8;
  border-radius: 24px;
  transition: border-color .16s, box-shadow .16s;
}
.scene-card[data-side="right"] { border-color: #dfcda1; }
.scene-card.is-miss {
  border-color: var(--coral);
  box-shadow: 0 0 0 5px rgba(232, 120, 104, .14);
}
.scene-label {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 8;
  padding: 7px 11px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 253, 247, .92);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(36, 62, 53, .12);
  pointer-events: none;
}
.forest-scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 14 / 9;
  touch-action: manipulation;
  user-select: none;
}
.difference-target { cursor: pointer; }
.hit-area { fill: transparent; stroke: transparent; }
.found-ring,
.hint-ring {
  fill: none;
  pointer-events: none;
}
.found-ring {
  stroke: #fff;
  stroke-width: 6;
  filter: drop-shadow(0 2px 2px rgba(39, 79, 67, .38));
}
.found-check {
  fill: #2f8e6a;
  stroke: white;
  stroke-width: 3;
  pointer-events: none;
}
.found-checkmark {
  fill: none;
  stroke: white;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.hint-ring {
  stroke: #ffd763;
  stroke-width: 8;
  filter: drop-shadow(0 0 8px #fff1a0);
}

.game-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.feedback-card {
  gap: 14px;
  min-height: 84px;
  margin-top: 16px;
  padding: 15px 17px;
  background: #f4f7f2;
  border: 2px solid #d5ded4;
  border-radius: 22px;
}
.feedback-card[data-kind="error"] { background: #fff1ed; border-color: #e9a89d; }
.feedback-card[data-kind="hint"] { background: #fff8da; border-color: #e5c960; }
.feedback-card[data-kind="success"] { background: #eaf7ed; border-color: #96c9a7; }
.feedback-icon {
  display: grid;
  min-width: 50px;
  height: 50px;
  place-items: center;
  font-size: 25px;
  background: white;
  border-radius: 15px;
}
.feedback-copy { flex: 1; }
.feedback-copy strong,
.feedback-copy small { display: block; }
.feedback-copy strong { margin-bottom: 4px; font-size: 17px; }
.feedback-copy small { color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.4; }
.feedback-card .primary-button { margin-left: auto; }

.result-card {
  max-width: 820px;
  margin: 70px auto 0;
  padding: clamp(34px, 6vw, 64px);
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 40px;
  box-shadow: var(--shadow);
}
.result-icon { display: block; margin-bottom: 12px; font-size: 70px; }
.result-card h1 {
  margin-bottom: 14px;
  font-size: clamp(39px, 5.5vw, 62px);
  letter-spacing: -.04em;
}
.result-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}
.stars { margin: 20px 0 6px; color: var(--gold); font-size: 48px; letter-spacing: 8px; }
.result-actions { justify-content: center; flex-wrap: wrap; gap: 13px; margin-top: 25px; }

.journal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.journal-card {
  min-height: 126px;
  padding: 18px;
  text-align: center;
  background: #f0eee6;
  border: 2px solid #d9d5c2;
  border-radius: 22px;
}
.journal-card.is-open { background: #edf8ed; border-color: #acd0b5; }
.journal-card span { display: block; margin-bottom: 7px; font-size: 35px; }
.journal-card strong { display: block; font-size: 15px; }
.journal-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.qa-active { background: #eef4ec; }
.qa-report {
  max-width: 880px;
  margin: 30px auto;
  padding: clamp(24px, 4vw, 44px);
  background: white;
  border: 3px solid #b8d5bf;
  border-radius: 32px;
  box-shadow: var(--shadow);
}
.qa-report.has-failures { border-color: #e5a49a; }
.qa-report h1 { font-size: clamp(36px, 5vw, 56px); }
.qa-summary { color: var(--muted); font-weight: 900; }
.qa-report ul { display: grid; gap: 7px; margin: 22px 0; padding: 0; list-style: none; }
.qa-report li {
  display: grid;
  align-items: center;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  padding: 10px 13px;
  background: #f3f8f1;
  border-radius: 12px;
}
.qa-report li.fail { background: #fff0ed; }
.qa-report li > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: white;
  font-weight: 900;
  background: #4b9b70;
  border-radius: 50%;
}
.qa-report li.fail > span { background: var(--coral); }
.qa-report li small { color: var(--muted); }

.qa-scenes {
  width: min(1680px, calc(100% - 32px));
  margin: 24px auto 70px;
}
.qa-scenes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.qa-scene-card {
  padding: 18px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 10px 0 rgba(67, 83, 65, .12);
}
.qa-scene-card h2 {
  min-height: 52px;
  margin: 5px 0 13px;
  font-size: 22px;
}
.qa-scene-card .forest-scene {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 42px; }
  .hero-copy { text-align: center; }
  .hero-copy > p:not(.eyebrow) { margin-right: auto; margin-left: auto; }
  .hero-actions { justify-content: center; }
  .hero-preview { width: min(540px, 100%); margin: 0 auto; }
  .routes-grid { grid-template-columns: 1fr; }
  .route-card { min-height: 165px; }
  .how-grid { grid-template-columns: 1fr; }
  .journal-grid { grid-template-columns: repeat(2, 1fr); }
  .game-heading { align-items: flex-start; }
  .game-meta { min-width: 180px; }
  .progress-track { width: 120px; }
  .qa-scenes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .app { width: min(1120px, calc(100% - 20px)); padding-top: 11px; }
  .topbar { min-height: 52px; 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 { display: none; }
  .sound-button { width: 46px; min-height: 46px; justify-content: center; padding: 0; }
  .back-button { width: 46px; min-height: 46px; }
  .hero { min-height: 0; padding: 32px 20px; border-radius: 30px; }
  .hero h1 { font-size: clamp(38px, 12vw, 49px); }
  .hero-copy > p:not(.eyebrow) { font-size: 16px; }
  .hero-preview { min-height: 245px; }
  .farm-preview-barn { left: 10px; width: 118px; height: 96px; }
  .farm-preview-barn::before { left: -11px; width: 132px; height: 66px; }
  .farm-preview-barn::after { left: 36px; width: 44px; height: 57px; }
  .farm-preview-fence { right: -18px; width: 195px; }
  .farm-preview-hay { right: 11px; width: 72px; height: 41px; }
  .farm-preview-animal--piglet { right: 91px; width: 92px; }
  .farm-preview-animal--pig { right: 4px; bottom: 53px; width: 121px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .section-heading > p { text-align: left; }
  .route-card { padding: 20px; }
  .game-shell { padding: 18px 12px; border-radius: 28px; }
  .game-heading { flex-direction: column; gap: 13px; }
  .game-meta { width: 100%; min-width: 0; justify-content: flex-start; }
  .progress-track { flex: 1; }
  .scene-instruction { align-items: flex-start; flex-direction: column; gap: 5px; }
  .found-counter { min-width: 0; text-align: left; }
  .scenes-grid { grid-template-columns: 1fr; }
  .scene-card { border-radius: 18px; }
  .game-controls { flex-direction: column-reverse; }
  .game-controls .secondary-button { width: 100%; }
  .feedback-card { align-items: flex-start; flex-wrap: wrap; }
  .feedback-card .primary-button { width: 100%; margin-left: 0; }
  .journal-grid { grid-template-columns: 1fr; }
  .result-card { margin-top: 28px; padding: 31px 19px; border-radius: 29px; }
  .stars { font-size: 39px; }
  .qa-report li { grid-template-columns: 30px 1fr; }
  .qa-report li small { grid-column: 2; }
  .qa-scenes-grid { grid-template-columns: 1fr; }
}

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