:root {
  --cream: #fffaf0;
  --paper: #fffdf8;
  --ink: #234f46;
  --muted: #607b75;
  --line: #e2d4ac;
  --mint: #dff2e8;
  --green: #3d9d7d;
  --green-dark: #24775f;
  --coral: #f27662;
  --yellow: #f7bf45;
  --lilac: #8573bd;
  --shadow: 0 12px 0 rgba(105, 86, 41, 0.1), 0 25px 55px rgba(60, 74, 58, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(circle at 12px 12px, rgba(224, 195, 127, 0.17) 1.5px, transparent 2px) 0 0 / 24px 24px,
    #fbf4e2;
}

button, a { font: inherit; }
button { color: inherit; }

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.game-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.game-brand > span:last-child { display: grid; gap: 2px; }
.game-brand strong { font-size: 1.03rem; }
.game-brand small { color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; }

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: var(--coral);
  box-shadow: 0 6px 0 #c94e3c;
  font-size: 0.82rem;
  font-weight: 900;
}

.age-pill {
  padding: 10px 16px;
  border: 2px solid #d6e6dc;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  font-weight: 900;
}

.screen { display: none; }
.screen.is-active { display: block; }

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  min-height: 570px;
  border: 3px solid var(--line);
  border-radius: 42px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 58px;
}

.eyebrow {
  margin: 0 0 14px;
  color: #9d6f29;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 0.98; }
h1, h2 { font-family: Georgia, serif; }
h1 { max-width: 600px; font-size: clamp(2.7rem, 4.4vw, 3.9rem); }
h2 { font-size: clamp(2.2rem, 4vw, 3.6rem); }

.hero-copy > p:not(.eyebrow) {
  max-width: 590px;
  margin: 26px 0 32px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.62;
}

.primary, .secondary, .route-card button, .feedback button {
  min-height: 58px;
  padding: 14px 23px;
  border: 0;
  border-radius: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.primary {
  color: #fff;
  background: var(--coral);
  box-shadow: 0 7px 0 #c9513e;
}

.secondary {
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: 0 5px 0 rgba(107, 83, 38, 0.12);
}

button:hover { transform: translateY(-2px); }
button:active { transform: translateY(2px); }
button:focus-visible { outline: 4px solid rgba(61, 157, 125, 0.28); outline-offset: 3px; }

.hero-scene {
  position: relative;
  overflow: hidden;
  min-height: 570px;
  background: linear-gradient(180deg, #cfece9 0 68%, #8bc28d 68% 100%);
}

.hero-scene::after {
  position: absolute;
  right: -80px;
  bottom: -72px;
  width: 340px;
  height: 220px;
  border-radius: 50%;
  background: #64a96f;
  content: "";
}

.hero-cloud { position: absolute; border-radius: 999px; background: rgba(255,255,255,0.73); }
.hero-cloud::before, .hero-cloud::after { position: absolute; border-radius: 50%; background: inherit; content: ""; }
.hero-cloud--one { top: 70px; left: 55px; width: 110px; height: 35px; }
.hero-cloud--one::before { left: 18px; bottom: 0; width: 55px; height: 55px; }
.hero-cloud--one::after { right: 10px; bottom: 0; width: 46px; height: 46px; }
.hero-cloud--two { top: 128px; right: 50px; width: 80px; height: 26px; }
.hero-cloud--two::before { left: 12px; bottom: 0; width: 40px; height: 40px; }

.hero-box {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 76px;
  width: 250px;
  height: 180px;
  transform: translateX(-50%);
  border: 10px solid #fff2c6;
  border-radius: 30px;
  background: #edae5c;
  box-shadow: 0 15px 0 #b8743c;
}

.hero-box::before {
  position: absolute;
  left: -24px;
  top: -32px;
  width: 278px;
  height: 45px;
  border: 9px solid #fff2c6;
  border-radius: 22px;
  background: #f5c876;
  content: "";
}

.hero-box img { position: absolute; left: 50%; bottom: 25px; width: 160px; height: 160px; object-fit: contain; transform: translateX(-50%); }
.hero-ball { position: absolute; z-index: 4; right: 25px; bottom: 82px; width: 110px; height: 110px; object-fit: contain; }
.hero-word { position: absolute; z-index: 5; right: 36px; bottom: 204px; padding: 10px 15px; border-radius: 999px; color: #fff; background: var(--lilac); font-weight: 900; box-shadow: 0 5px 0 #65549a; }

.rule-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 28px 0 72px;
  padding: 22px 28px;
  border: 2px dashed #dcc99a;
  border-radius: 24px;
  background: rgba(255,253,248,0.84);
}

.rule-card > span { display: grid; flex: 0 0 52px; height: 52px; place-items: center; border-radius: 17px; background: #fff0b8; font-size: 1.45rem; }
.rule-card strong { font-size: 1.1rem; }
.rule-card p { margin: 5px 0 0; color: var(--muted); line-height: 1.55; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 25px; }
.section-head > p { max-width: 260px; margin: 0; color: var(--muted); text-align: right; line-height: 1.5; }

.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.route-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; min-width: 0; border: 3px solid var(--line); border-radius: 30px; background: var(--paper); box-shadow: 0 9px 0 rgba(100, 80, 38, 0.1); }
.route-preview { display: grid; min-height: 230px; place-items: center; background: var(--mint); }
.route-card--sunny .route-preview { background: #fff0c8; }
.route-card--lilac .route-preview { background: #ebe5fa; }

.preview-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  width: min(80%, 310px);
  height: 155px;
  padding: 15px 18px 34px;
  border: 8px solid #fff7de;
  border-radius: 24px;
  background: #e7aa5b;
  box-shadow: 0 10px 0 #bd7640;
}

.preview-box::after { position: absolute; inset: auto -15px -3px; height: 45px; border-radius: 17px; background: #f4c97a; content: ""; }
.preview-box img { position: relative; z-index: 2; width: 29%; height: 105px; object-fit: contain; }
.route-copy { display: flex; flex-direction: column; min-width: 0; padding: 28px 25px 30px; }
.route-copy > span { display: block; margin-bottom: 12px; color: #aa6739; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.14em; }
.route-copy h3 { font-family: Georgia, serif; font-size: clamp(1.7rem, 2.2vw, 2.15rem); }
.route-copy p { margin: 15px 0 22px; color: var(--muted); font-size: 1.03rem; line-height: 1.55; }
.route-meter { overflow: hidden; height: 10px; margin-top: auto; margin-bottom: 20px; border-radius: 999px; background: #e8eddf; }
.route-meter i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.route-card button { display: flex; align-items: center; justify-content: space-between; width: 100%; color: #fff; background: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.route-card button b { font-size: 0.82rem; opacity: 0.86; }

.play-card { padding: 34px; border: 3px solid var(--line); border-radius: 36px; background: var(--paper); box-shadow: var(--shadow); }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 0 4px 28px; }
.round-progress { display: flex; align-items: center; gap: 14px; min-width: 250px; }
.round-progress > span { flex: 1; overflow: hidden; height: 12px; border-radius: 999px; background: #e4ebdf; }
.round-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 0.25s ease; }
.round-progress b { font-style: normal; }
.round-progress em { font-style: normal; }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr); gap: 24px; }
.scene-panel, .answer-panel { min-width: 0; border: 2px solid #cadfd1; border-radius: 28px; }
.scene-panel { padding: 22px; background: #e3f3ec; }
.scene-panel[data-room="sunny"] { background: #fff1c9; border-color: #ecd79a; }
.scene-panel[data-room="lilac"] { background: #ede8fa; border-color: #d7cdec; }
.scene-caption { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.scene-caption span, .answer-kicker { color: #9b6f2c; font-size: 0.75rem; font-weight: 900; letter-spacing: 0.16em; }
.scene-caption b { font-size: 1.05rem; }

.placement-scene {
  position: relative;
  overflow: hidden;
  height: 470px;
  border: 7px solid #fff;
  border-radius: 24px;
  background: linear-gradient(180deg, #fbfaf3 0 72%, #d9c99b 72% 74%, #e9d8a9 74% 100%);
}

.wall-dot { position: absolute; width: 52px; height: 52px; border: 9px solid rgba(245,190,69,0.45); border-radius: 50%; }
.wall-dot--one { top: 45px; left: 48px; }
.wall-dot--two { top: 95px; right: 62px; width: 34px; height: 34px; border-color: rgba(130,111,188,0.3); }
.floor-line { position: absolute; right: 50px; bottom: 48px; left: 50px; height: 3px; border-radius: 99px; background: rgba(107,84,49,0.15); }

.toy-box { position: absolute; z-index: 3; left: 50%; top: 55%; width: 230px; height: 155px; transform: translate(-50%, -50%); }
.toy-box__back, .toy-box__front { position: absolute; display: block; }
.toy-box__back { inset: 0; border: 8px solid #fff0c6; border-radius: 24px; background: #e6a959; box-shadow: 0 10px 0 #bb743d; }
.toy-box__front { z-index: 4; right: -10px; bottom: -5px; left: -10px; height: 76px; border: 8px solid #fff0c6; border-radius: 18px 18px 24px 24px; background: #f1c16e; }
.toy-box__front::after { position: absolute; top: 17px; left: 50%; width: 68px; height: 18px; transform: translateX(-50%); border-radius: 999px; background: #d18c49; content: ""; }
.toy-box-cover { position: absolute; z-index: 6; top: calc(55% + 5px); left: 50%; display: none; width: 250px; height: 76px; transform: translateX(-50%); border: 8px solid #fff0c6; border-radius: 18px 18px 24px 24px; background: #f1c16e; }
.toy-box-cover::after { position: absolute; top: 17px; left: 50%; width: 68px; height: 18px; transform: translateX(-50%); border-radius: 999px; background: #d18c49; content: ""; }
.placement-scene[data-placement="in"] .toy-box-cover { display: block; }

.placed-toy { position: absolute; z-index: 5; width: 150px; height: 150px; object-fit: contain; transition: inset 0.2s ease, transform 0.2s ease; }
.placement-scene[data-placement="in"] .placed-toy { top: 56%; left: 50%; width: 135px; height: 135px; transform: translate(-50%, -50%); }
.placement-scene[data-placement="on"] .placed-toy { top: 4%; left: 50%; transform: translateX(-50%); }
.placement-scene[data-placement="under"] .placed-toy { z-index: 2; bottom: 0; left: 50%; width: 130px; height: 130px; transform: translateX(-50%); }
.placement-scene[data-placement="next-to"] .placed-toy { right: 4%; bottom: 28px; }

.answer-panel { display: flex; flex-direction: column; padding: 28px; background: #fff9e8; border-color: #ead69d; }
.answer-panel h3 { margin: 8px 0 12px; font-family: Georgia, serif; font-size: clamp(1.8rem, 3.1vw, 2.65rem); line-height: 1.05; }
.sentence { margin: 0 0 22px; padding: 14px 16px; border-radius: 16px; color: #4f6762; background: #fff; font-size: 1.1rem; line-height: 1.45; }
.sentence b { color: var(--coral); }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-grid button { display: grid; min-height: 88px; place-items: center; padding: 12px; border: 3px solid #dfd6bd; border-radius: 18px; background: #fff; box-shadow: 0 5px 0 #d1c4a4; cursor: pointer; transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease; }
.answer-grid button b { font-family: Georgia, serif; font-size: 1.35rem; }
.answer-grid button small { color: var(--muted); font-size: 0.76rem; font-weight: 800; }
.answer-grid button.is-wrong { border-color: #e87b70; background: #fff0ed; animation: shake 0.3s ease; }
.answer-grid button.is-correct { color: #fff; border-color: var(--green); background: var(--green); box-shadow: 0 5px 0 var(--green-dark); }
.answer-grid button.is-correct small { color: rgba(255, 255, 255, 0.84); }
.answer-grid button.is-hint { border-color: var(--yellow); box-shadow: 0 0 0 5px rgba(247,191,69,0.22), 0 5px 0 #d1a037; }
.answer-grid button:disabled { cursor: default; }

.hint-button { min-height: 53px; margin-top: 24px; padding: 12px 18px; border: 2px solid #e7c86c; border-radius: 16px; background: #fff1bb; font-weight: 900; cursor: pointer; }

.feedback { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-top: 22px; padding: 18px 20px; border: 2px solid #c2dfd2; border-radius: 22px; background: #e7f6ef; }
.feedback > span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 15px; background: #fff; font-size: 1.5rem; }
.feedback strong { font-size: 1.07rem; }
.feedback p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.feedback button { color: #fff; background: var(--green); box-shadow: 0 5px 0 var(--green-dark); }
.feedback.is-error { border-color: #f0b7ae; background: #fff0ed; }
.feedback.is-hint { border-color: #e8ce79; background: #fff6d5; }

.play-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; color: var(--muted); font-size: 0.83rem; }
.play-actions button { min-height: 46px; padding: 10px 17px; border: 2px solid #d8d1ba; border-radius: 14px; background: #fff; font-weight: 900; cursor: pointer; }

.result-card { max-width: 850px; margin: 28px auto; padding: 56px; border: 3px solid var(--line); border-radius: 38px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.result-star { display: grid; width: 90px; height: 90px; margin: 0 auto 22px; place-items: center; border-radius: 50%; color: #fff; background: var(--yellow); box-shadow: 0 9px 0 #d79d2e; font-size: 2.9rem; }
.result-card > p:not(.eyebrow) { max-width: 620px; margin: 20px auto 26px; color: var(--muted); font-size: 1.1rem; line-height: 1.55; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin: 24px 0; }
.result-stats div { padding: 20px 12px; border: 2px solid #d5e3da; border-radius: 20px; background: #f2faf5; }
.result-stats b { display: block; font-family: Georgia, serif; font-size: 2rem; }
.result-stats span { color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.reward-note { display: flex; align-items: center; gap: 17px; max-width: 620px; margin: 22px auto 30px; padding: 17px; border: 2px dashed #d8c58d; border-radius: 22px; background: #fff9e7; text-align: left; }
.reward-note img { width: 82px; height: 82px; object-fit: contain; filter: grayscale(1); opacity: 0.55; }
.reward-note div { display: grid; gap: 5px; }
.reward-note small { color: var(--muted); line-height: 1.4; }
.reward-note.is-unlocked { border-style: solid; border-color: #a9d6c2; background: #eaf7f0; }
.reward-note.is-unlocked img { filter: none; opacity: 1; }
.result-actions { display: flex; justify-content: center; gap: 14px; }

@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 46px; }
  .hero-scene { min-height: 430px; }
  .lesson-layout { grid-template-columns: 1fr; }
  .answer-panel { min-height: 390px; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { grid-template-columns: 0.9fr 1.1fr; }
  .route-preview { min-height: 270px; }
}

@media (max-width: 720px) {
  .app { width: min(100% - 20px, 1120px); padding-top: 10px; }
  .hero { min-height: 0; border-radius: 30px; }
  .hero-copy { padding: 34px 24px; }
  h1 { font-size: clamp(2.35rem, 11vw, 3.2rem); }
  .hero-scene { min-height: 360px; }
  .hero-box { bottom: 58px; transform: translateX(-50%) scale(0.85); }
  .hero-ball { right: 8px; bottom: 58px; width: 90px; height: 90px; }
  .hero-word { right: 15px; bottom: 155px; }
  .rule-card { align-items: flex-start; margin-bottom: 50px; padding: 18px; }
  .section-head, .play-head { align-items: flex-start; flex-direction: column; }
  .section-head > p { text-align: left; }
  .route-card { grid-template-columns: 1fr; }
  .route-card { grid-template-rows: auto 1fr; }
  .route-preview { min-height: 240px; }
  .route-copy { padding: 28px 24px; }
  .play-card { padding: 22px 14px; border-radius: 28px; }
  .round-progress { width: 100%; min-width: 0; }
  .scene-panel { padding: 13px; }
  .placement-scene { height: 400px; }
  .answer-panel { min-height: 370px; padding: 22px 16px; }
  .feedback { grid-template-columns: auto 1fr; }
  .feedback button { grid-column: 1 / -1; width: 100%; }
  .result-card { padding: 42px 20px; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}

@media (max-width: 430px) {
  .game-brand strong { font-size: 0.9rem; }
  .game-brand small { font-size: 0.63rem; }
  .age-pill { padding: 8px 10px; font-size: 0.78rem; }
  .hero-scene { min-height: 330px; }
  .hero-box { left: 47%; transform: translateX(-50%) scale(0.72); }
  .hero-ball { width: 76px; height: 76px; }
  .hero-word { bottom: 137px; font-size: 0.8rem; }
  .placement-scene { height: 355px; }
  .toy-box { transform: translate(-50%, -50%) scale(0.8); }
  .toy-box-cover { transform: translateX(-50%) scale(0.8); }
  .placed-toy { width: 120px; height: 120px; }
  .placement-scene[data-placement="in"] .placed-toy { width: 110px; height: 110px; }
  .placement-scene[data-placement="under"] .placed-toy { width: 105px; height: 105px; }
  .answer-grid button { min-height: 78px; }
  .answer-grid button b { font-size: 1.14rem; }
  .play-actions { align-items: flex-start; flex-direction: column; }
  .result-stats { grid-template-columns: 1fr; }
}

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