:root {
  color-scheme: light;
  --ink: #234f46;
  --muted: #617a74;
  --paper: #fffaf0;
  --line: #dfcfaa;
  --mint: #dff1e7;
  --green: #3e9d7d;
  --green-dark: #26765e;
  --coral: #f17363;
  --yellow: #f8bf49;
  --purple: #8068b3;
  font-family: Inter, Nunito, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12px 12px, rgba(224, 198, 142, .22) 0 2px, transparent 2.5px) 0 0 / 28px 28px,
    #fbf6e8;
}
button, a { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}
.screen { display: none; }
.screen.is-active { display: block; animation: appear .28s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }

.game-topbar, .play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(179, 151, 91, .22);
  color: var(--coral);
  font-size: 26px;
  font-weight: 900;
}
.brand b, .brand small { display: block; }
.brand b { font-size: 20px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.collection-link {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 2px solid #cbded4;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  background: #fff;
  box-shadow: 0 4px 0 rgba(65, 114, 96, .16);
  font-weight: 800;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  min-height: 460px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 40px;
  background: var(--paper);
  box-shadow: 0 15px 0 rgba(182, 151, 86, .14), 0 26px 45px rgba(71, 66, 46, .12);
}
.hero-copy { padding: 64px 46px 54px; }
.eyebrow {
  display: block;
  color: #9b6a29;
  font: 800 13px/1.3 Georgia, serif;
  letter-spacing: .14em;
}
.hero-copy h1, .play-heading h1, .result-card h1 {
  margin: 12px 0 20px;
  font: 800 clamp(52px, 7vw, 80px)/.96 Georgia, serif;
  letter-spacing: -.03em;
}
.hero-copy p { max-width: 600px; margin: 0; color: #4f6964; font-size: 21px; line-height: 1.55; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.hero-facts span { padding: 10px 14px; border-radius: 99px; background: #fff; box-shadow: 0 5px 15px rgba(55, 73, 63, .08); font-weight: 700; }

.hero-scene {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.72) 0 8%, transparent 8.5%),
    linear-gradient(145deg, #cee9df, #a9d2c0 67%, #91b990);
}
.hero-scene::before {
  content: "";
  position: absolute;
  inset: auto -80px -85px -70px;
  height: 210px;
  border-radius: 50% 50% 0 0;
  background: #79ad75;
}
.hero-shelf {
  position: absolute;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: end;
  width: 300px;
  height: 145px;
  padding: 14px 18px 20px;
  border: 7px solid rgba(255,255,255,.86);
  border-radius: 26px;
  background: rgba(255,250,239,.94);
  box-shadow: 0 13px 0 rgba(72, 98, 79, .16), inset 0 -12px #e8c888;
}
.hero-shelf span { display: grid; place-items: center; width: 122px; height: 102px; }
.hero-shelf img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 7px 5px rgba(42, 72, 61, .16)); }
.hero-shelf--top { top: 36px; left: 34px; transform: rotate(-2deg); }
.hero-shelf--bottom { right: 24px; bottom: 28px; transform: rotate(2deg); }
.swap-mark {
  position: absolute;
  z-index: 4;
  top: 194px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%) rotate(-4deg);
  color: #fff;
}
.swap-mark i { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: var(--coral); box-shadow: 0 4px 0 #c95749; font-style: normal; font-weight: 900; }
.swap-mark b { font-size: 42px; text-shadow: 0 4px 0 rgba(37, 79, 70, .2); }

.routes-section { margin-top: 58px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin: 5px 0 0; font: 800 clamp(34px, 5vw, 50px)/1.05 Georgia, serif; }
.section-heading p { margin: 0 0 6px; color: var(--muted); }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.route-card {
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: #fffaf2;
  box-shadow: 0 9px 0 rgba(185, 153, 83, .15);
}
.route-preview { display: grid; place-items: center; height: 185px; padding: 20px; background: var(--route-bg); }
.mini-shelf {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: end;
  width: 92%;
  height: 130px;
  padding: 12px 10px 18px;
  border: 6px solid #fff;
  border-radius: 22px;
  background: rgba(255,255,255,.76);
  box-shadow: inset 0 -11px #dfbd7b, 0 8px 0 rgba(67, 98, 82, .1);
}
.mini-shelf img { width: 92px; height: 100px; margin: 0 -9px; object-fit: contain; filter: drop-shadow(0 6px 4px rgba(46, 78, 63, .14)); }
.mini-shelf img:nth-child(2) { z-index: 2; width: 108px; height: 112px; }
.route-body { padding: 24px; }
.route-body > span { color: var(--route-accent); font-weight: 900; letter-spacing: .1em; font-size: 12px; }
.route-body h3 { margin: 7px 0 8px; font: 800 28px/1.1 Georgia, serif; }
.route-body p { min-height: 72px; margin: 0; color: var(--muted); line-height: 1.5; }
.route-progress { height: 8px; margin: 18px 0; overflow: hidden; border-radius: 99px; background: #eee8d8; }
.route-progress i { display: block; height: 100%; border-radius: inherit; background: var(--route-accent); }
.route-body button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--route-accent);
  box-shadow: 0 5px 0 rgba(41, 78, 66, .42);
  font-weight: 900;
  cursor: pointer;
}
.route-body button b { padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.2); }

.play-screen { max-width: 1060px; margin: 0 auto; }
.icon-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border: 2px solid #cbded4;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 rgba(65,114,96,.14);
  font-size: 24px;
  cursor: pointer;
}
.play-heading { flex: 1; }
.play-heading h1 { margin: 4px 0 0; font-size: clamp(34px, 5vw, 56px); }
.round-badge { display: grid; place-items: center; min-width: 82px; min-height: 64px; padding: 8px; border: 2px solid #cfe2d7; border-radius: 18px; background: #fff; }
.round-badge b { font-size: 25px; }
.round-badge span { color: var(--muted); font-size: 12px; font-weight: 800; }
.progress-track { height: 10px; margin-bottom: 18px; overflow: hidden; border-radius: 99px; background: #e7e1d2; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #62b7a0); transition: width .3s ease; }

.memory-stage, .answer-tools, .feedback, .result-card {
  border: 2px solid var(--line);
  border-radius: 30px;
  background: rgba(255,250,240,.97);
  box-shadow: 0 9px 0 rgba(185,153,83,.14);
}
.memory-stage { padding: 28px; text-align: center; }
.stage-copy span { color: #9b6a29; font-weight: 900; letter-spacing: .11em; font-size: 12px; }
.stage-copy h2 { margin: 6px 0; font: 800 clamp(29px, 4vw, 42px)/1.1 Georgia, serif; }
.stage-copy p { margin: 0; color: var(--muted); }
.toy-shelf {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 24px;
  padding: 22px 20px 34px;
  border: 3px solid #d5bd87;
  border-radius: 28px;
  background: linear-gradient(#f8e8bc, #f4dfa8);
  box-shadow: inset 0 -15px #d5aa62, 0 8px 0 rgba(125, 93, 43, .15);
}
.toy-shelf::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 12px;
  left: 16px;
  height: 6px;
  border-radius: 99px;
  background: rgba(138, 92, 38, .2);
}
.toy-shelf[data-count="3"] { --count: 3; max-width: 790px; margin-right: auto; margin-left: auto; }
.toy-shelf[data-count="4"] { --count: 4; }
.toy-shelf[data-count="5"] { --count: 5; }
.shelf-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 260px;
  grid-template-rows: 174px 42px;
  gap: 14px;
  place-items: center;
  padding: 12px 10px 13px;
  border: 3px solid #d0dfd6;
  border-radius: 24px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 7px 0 rgba(71, 111, 94, .15);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
button.shelf-slot { cursor: pointer; }
button.shelf-slot:hover { transform: translateY(-3px); border-color: var(--green); }
.slot-number {
  position: absolute;
  top: 9px;
  left: 9px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #527069;
  background: #edf5ef;
  font-size: 13px;
  font-weight: 900;
}
.toy-picture { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; }
.toy-picture img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 5px rgba(43, 70, 60, .12)); }
.shelf-slot b {
  position: relative;
  z-index: 2;
  display: grid;
  width: calc(100% - 8px);
  min-height: 42px;
  place-items: center;
  padding: 6px 8px;
  border-radius: 13px;
  background: #edf7f1;
  font-size: 15px;
  line-height: 1.15;
}
.shelf-slot.is-selected { transform: translateY(-5px); border-color: var(--purple); background: #f1edf9; box-shadow: 0 8px 0 #a79ac7; }
.shelf-slot.is-wrong { border-color: #e88375; background: #fff0ed; box-shadow: 0 7px 0 #e6aaa1; animation: shake .3s ease; }
.shelf-slot.is-correct { border-color: var(--green); background: #e6f6ed; box-shadow: 0 7px 0 #8abda8; }
.shelf-slot.is-hint { border-color: #e3bd45; background: #fff6d1; box-shadow: 0 7px 0 #d8b94f; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.primary-button, .secondary-button, .hint-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
}
.primary-button { border: 0; color: #fff; background: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.secondary-button { border: 2px solid #c8ddd2; color: inherit; text-decoration: none; background: #fff; box-shadow: 0 4px 0 rgba(65,114,96,.14); }
.ready-button { min-width: 235px; }
.answer-tools { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; padding: 23px 26px; }
.answer-tools h2 { margin: 5px 0 3px; font: 800 32px Georgia, serif; }
.answer-tools p { margin: 0; color: var(--muted); }
.hint-button { flex: 0 0 auto; border: 2px solid #e2c56c; background: #fff1b9; box-shadow: 0 4px 0 #d9b951; }

.feedback { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 18px 20px; }
.feedback > span { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border-radius: 16px; background: #fff; font-size: 25px; }
.feedback div { flex: 1; }
.feedback b { font-size: 20px; }
.feedback p { margin: 3px 0 0; color: var(--muted); line-height: 1.4; }
.feedback button { min-height: 48px; padding: 10px 20px; border: 0; border-radius: 14px; color: #fff; background: var(--green); box-shadow: 0 5px 0 var(--green-dark); font-weight: 900; cursor: pointer; }
.feedback.is-success { border-color: #9bcdb7; background: #e5f5ec; }
.feedback.is-error { border-color: #ebbaaf; background: #fff1ed; }
.feedback.is-hint { border-color: #e4cd7d; background: #fff6d7; }
.feedback.is-pick { border-color: #c7d9e6; background: #edf6fa; }

.result-screen { max-width: 840px; margin: 60px auto 0; }
.result-card { padding: 50px 40px; text-align: center; }
.result-stars { font-size: 46px; }
.result-card h1 { font-size: clamp(45px, 7vw, 68px); }
.result-card > p { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 19px; line-height: 1.5; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 590px; margin: 28px auto 18px; }
.result-stats span { padding: 16px; border-radius: 18px; background: #eef6ef; }
.result-stats b, .result-stats small { display: block; }
.result-stats b { font: 800 32px Georgia, serif; }
.result-stats small { color: var(--muted); }
.reward-note { display: flex; max-width: 590px; align-items: center; gap: 14px; margin: 0 auto 25px; padding: 15px 17px; border: 2px dashed #d9c380; border-radius: 20px; text-align: left; background: #fff5d6; }
.reward-note > span { display: grid; place-items: center; width: 55px; height: 55px; flex: 0 0 auto; border-radius: 17px; background: #fff; font-size: 29px; }
.reward-note p, .reward-note b, .reward-note small { display: block; margin: 0; }
.reward-note small { margin-top: 3px; color: var(--muted); line-height: 1.35; }
.reward-note.is-unlocked { border-style: solid; border-color: #91c5ad; background: #e3f4ea; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

@media (max-width: 900px) {
  .hero-card { grid-template-columns: 1fr; }
  .hero-copy { padding: 48px 34px; }
  .hero-scene { min-height: 400px; }
  .hero-shelf--top { left: 12%; }
  .hero-shelf--bottom { right: 12%; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { display: grid; grid-template-columns: 290px 1fr; }
  .route-preview { height: 100%; min-height: 250px; }
  .route-body p { min-height: 0; }
  .toy-shelf[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf-slot { min-height: 238px; grid-template-rows: 154px 42px; }
}

@media (max-width: 650px) {
  .app { width: min(100% - 18px, 1120px); padding-top: 12px; }
  .game-topbar { align-items: flex-start; }
  .collection-link span:last-child { display: none; }
  .brand small { display: none; }
  .hero-card { border-radius: 27px; }
  .hero-copy { padding: 36px 24px; }
  .hero-copy h1 { font-size: 49px; }
  .hero-copy p { font-size: 17px; }
  .hero-facts span { font-size: 13px; }
  .hero-scene { min-height: 350px; }
  .hero-shelf { width: 250px; height: 125px; }
  .hero-shelf span { width: 98px; height: 86px; }
  .hero-shelf--top { top: 24px; left: 14px; }
  .hero-shelf--bottom { right: 14px; bottom: 24px; }
  .swap-mark { top: 153px; }
  .routes-section { margin-top: 42px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 10px; }
  .route-card { display: block; }
  .route-preview { min-height: 190px; }
  .route-body { padding: 21px; }
  .play-header { align-items: flex-start; gap: 10px; }
  .play-heading h1 { font-size: 31px; }
  .round-badge { min-width: 63px; min-height: 57px; }
  .memory-stage { padding: 18px 10px 22px; border-radius: 24px; }
  .toy-shelf, .toy-shelf[data-count="3"], .toy-shelf[data-count="4"], .toy-shelf[data-count="5"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
    padding: 14px 10px 28px;
    border-radius: 22px;
  }
  .toy-shelf[data-count="3"] .shelf-slot:last-child,
  .toy-shelf[data-count="5"] .shelf-slot:last-child { grid-column: 1 / -1; width: calc(50% - 5px); justify-self: center; }
  .shelf-slot { min-height: 198px; grid-template-rows: 126px 38px; gap: 9px; padding: 9px 7px 10px; border-radius: 19px; }
  .shelf-slot b { font-size: 13px; }
  .slot-number { top: 6px; left: 6px; width: 27px; height: 27px; }
  .answer-tools { display: block; padding: 20px; }
  .answer-tools h2 { font-size: 27px; }
  .hint-button { width: 100%; margin-top: 16px; }
  .feedback { align-items: flex-start; flex-wrap: wrap; padding: 16px; }
  .feedback div { min-width: calc(100% - 70px); }
  .feedback button { width: 100%; }
  .result-screen { margin-top: 18px; }
  .result-card { padding: 38px 18px; }
  .result-stats { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .result-actions > * { width: 100%; }
}

@media (max-width: 390px) {
  .hero-copy h1 { font-size: 43px; }
  .hero-scene { min-height: 325px; }
  .hero-shelf { width: 225px; height: 115px; }
  .hero-shelf--top { left: 6px; }
  .hero-shelf--bottom { right: 6px; }
  .swap-mark { top: 141px; }
  .shelf-slot { min-height: 184px; grid-template-rows: 114px 38px; }
  .brand b { font-size: 17px; }
}
