@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Literata:opsz,wght@7..72,400;7..72,500;7..72,600&display=swap');

:root {
  --green: #397460;
  --ink: #293e35;
  --muted: #7b8378;
  --cream: #faf9f5;
  --line: #e8e9e1;
  --serif: 'Literata', georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  transition:
    transform 0.18s,
    background 0.18s;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #c59f43;
  outline-offset: 4px;
}

button:not(:disabled):active {
  transform: translateY(2px);
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  vertical-align: middle;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
}

p {
  line-height: 1.7;
}

button .icon {
  pointer-events: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: #f4f5ed;
  border-right: 1px solid #e4e8dd;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: #e6ebd9;
  width: 37px;
  height: 40px;
  border-radius: 12px;
  color: #6e8458;
}

.brand-mark .icon {
  width: 28px;
  height: 28px;
}

.brand-sub {
  display: block;
  font: 8px var(--sans);
  letter-spacing: 1.7px;
  margin-top: 6px;
  color: #8a917d;
}

.side-label {
  font-size: 9px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: #939b87;
  margin: 57px 12px 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 13px;
  background: transparent;
  color: #77806e;
  border-radius: 9px;
  width: 100%;
  text-align: left;
  margin: 5px 0;
  font-size: 13px;
}

.nav-item.active {
  color: #35694e;
  background: #e5ebdc;
  font-weight: 650;
}

.nav-item:hover {
  background: #e9ecdf;
}

.nav-dot {
  margin-left: auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #68815d;
}

.sidebar-bottom {
  margin-top: auto;
}

.growing {
  text-align: center;
  padding: 28px 0 25px;
  border-bottom: 1px solid #e0e5d6;
  margin-bottom: 18px;
}

.growing > .icon {
  width: 34px;
  height: 34px;
  color: #a8b38d;
  display: block;
  margin: 0 auto 18px;
}

.growing strong {
  font: 20px/1.5 var(--serif);
  color: #6d7a5b;
}

.growing p {
  font-size: 10px;
  color: #8b927f;
  margin: 12px 0;
}

.growing > span {
  color: #bdb795;
}

.parent-link {
  font-size: 12px;
  color: #8a917e;
}

.workspace {
  margin-left: 236px;
}

/* Treasure stays visible while the player crosses, even when the page scrolls. */
.topbar {
  height: 89px;
  padding: 0 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #faf9f5f5;
  backdrop-filter: blur(10px);
}

.breadcrumb {
  font-size: 12px;
  color: #92988b;
  display: flex;
  gap: 16px;
}

.breadcrumb strong {
  font-weight: 500;
  color: #596653;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.gem-count {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #8d794d;
  font-size: 12px;
  position: relative;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 20px;
  transition:
    background 0.2s,
    box-shadow 0.2s;
}

.gem-count .icon {
  color: #bb9a58;
  width: 19px;
}

.gem-count b {
  font-weight: 600;
  display: inline-block;
  min-width: 1ch;
}

.gem-count span {
  font-size: 11px;
  color: #919484;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #e1e5d8;
  background: transparent;
  border-radius: 50%;
  color: #7a856c;
}

.icon-button:hover {
  background: #edf0e5;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid white;
  background: #e9deca;
  color: #907b5c;
  border-radius: 50%;
  font: 15px var(--serif);
}

main {
  max-width: 1220px;
  margin: auto;
  padding: 35px 48px 25px;
}

.eyebrow {
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: #87927a;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 27px;
}

.page-heading h1 {
  font-size: 30px;
  letter-spacing: -0.8px;
  margin: 9px 0 7px;
}

.page-heading p {
  font-size: 12px;
  color: #8a9083;
}

.greeting-star {
  font-size: 31px;
  color: #c3a56c;
  display: inline-block;
  margin-left: 6px;
}

.grade-badge {
  border: 1px solid #e4e6da;
  padding: 10px 12px;
  display: flex;
  gap: 7px;
  align-items: center;
  border-radius: 7px;
  font-size: 9px;
  color: #8a927b;
  letter-spacing: 1px;
}

.grade-badge .icon {
  width: 15px;
  height: 15px;
}

.hero {
  height: 318px;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
  background: #dce9dd;
  border: 1px solid #dce4d4;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 56%;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #e7eedbe8 0%,
    #e7eedbc9 30%,
    #e7eedb00 63%
  );
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding: 30px 34px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8faebad;
  border: 1px solid #ffffff85;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #657853;
}

.hero-tag .icon {
  width: 13px;
  height: 13px;
}

.hero h2 {
  font-size: 39px;
  letter-spacing: -1.4px;
  line-height: 1.19;
  margin: 15px 0 12px;
  color: #355340;
}

.hero p {
  font-size: 11px;
  line-height: 1.7;
  color: #6c7e62;
  margin-bottom: 20px;
}

.primary {
  background: var(--green);
  color: #fff;
  padding: 13px 20px;
  border-radius: 8px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 21px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 3px 0 #1e4c3b16;
}

.primary:hover {
  background: #2b634e;
}

.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.primary .icon {
  width: 17px;
  height: 17px;
}

.hero-note {
  display: block;
  font-size: 9px;
  margin-top: 10px;
  color: #839070;
}

.floating-star {
  position: absolute;
  z-index: 1;
  color: #f8df8d;
}

.star-one {
  left: 43%;
  top: 35px;
  font-size: 30px;
  animation: twinkle 4s ease-in-out infinite;
}

.theme-section {
  margin: 27px 0 28px;
  display: flex;
  align-items: center;
  gap: 25px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.section-label h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
}

.number-chip {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #dce3d5;
  border-radius: 50%;
  color: #849377;
  font-size: 10px;
}

.theme-tabs {
  display: flex;
  gap: 10px;
  flex: 1;
}

.theme-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid #e6e7df;
  border-radius: 7px;
  background: transparent;
  color: #9b9d91;
  font-size: 11px;
  min-height: 43px;
  white-space: nowrap;
}

.theme-tab > .icon {
  width: 18px;
  height: 18px;
}

.theme-tab.selected {
  color: #486c51;
  background: #edf1e6;
  border-color: #b6c4a5;
}

.theme-tab.selected > .icon:last-child {
  width: 13px;
  height: 13px;
  margin-left: 7px;
}

.theme-tab small {
  font-size: 6px;
  letter-spacing: 1px;
  background: #edeee6;
  border-radius: 3px;
  padding: 3px 4px;
  color: #969c8c;
}

.theme-tab:disabled {
  opacity: 0.7;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}

.section-title > span {
  font-size: 10px;
  color: #909783;
}

.module-grid {
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 20px;
}

.module-card {
  background: #fffefa;
  border: 1px solid #e3e5d9;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 42% 58%;
}

.module-illustration {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 27px 14px 35px;
  background: #eff0df;
}

.module-illustration > svg {
  width: 100%;
  max-width: 280px;
}

.lesson-badge {
  position: absolute;
  bottom: 19px;
  font-size: 6px;
  letter-spacing: 1.3px;
  color: #8d9475;
  background: #ffffff73;
  border: 1px solid #dfe3ce;
  padding: 5px 7px;
  border-radius: 4px;
}

.module-body {
  padding: 24px 20px 16px;
}

.module-meta {
  font-size: 6.5px;
  letter-spacing: 1px;
  color: #9a9d85;
  display: flex;
  gap: 7px;
  align-items: center;
}

.module-body h3 {
  font-size: 20px;
  letter-spacing: -0.6px;
  margin: 11px 0 10px;
}

.module-body p {
  font-size: 10px;
  color: #8a907e;
}

.module-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 19px;
}

.module-bottom > span {
  font-size: 8px;
  color: #929983;
  display: flex;
  align-items: center;
  gap: 5px;
}

.module-bottom .icon {
  width: 12px;
  height: 12px;
}

.module-bottom i {
  font-style: normal;
  margin: 0 2px;
}

.round-button {
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  flex-shrink: 0;
}

.round-button .icon {
  width: 16px;
  height: 16px;
}

.tip-card {
  position: relative;
  padding: 21px 23px;
  background: #f4f0e5;
  border: 1px solid #e8e3d4;
  border-radius: 12px;
  overflow: hidden;
}

.tip-icon {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid #ded4b7;
  border-radius: 50%;
  color: #ad9558;
  margin-right: 7px;
}

.tip-icon .icon {
  width: 17px;
  height: 17px;
}

.tip-card .eyebrow {
  font-size: 7px;
  letter-spacing: 1.4px;
  color: #9c9275;
  vertical-align: middle;
}

.tip-card h3 {
  font-size: 20px;
  line-height: 1.4;
  margin: 12px 0 9px;
  letter-spacing: -0.6px;
  color: #6c674e;
}

.tip-card p {
  font-size: 10px;
  color: #9a927c;
  line-height: 1.8;
  max-width: 240px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #637956;
  padding: 8px 0;
  font-size: 10px;
  font-weight: 600;
}

.text-button .icon {
  width: 14px;
  height: 14px;
}

.tip-card .text-button {
  margin-top: 7px;
  color: #8b805e;
}

.tip-sparkle {
  position: absolute;
  right: 18px;
  top: 48px;
  font-size: 25px;
  color: #cabd91;
}

.journey-strip {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 19px 22px;
  border: 1px dashed #dfe3d3;
  border-radius: 10px;
  margin-top: 22px;
  background: #f5f6ed;
}

.journey-icon {
  display: grid;
  place-items: center;
  background: #ecefdf;
  border-radius: 50%;
  width: 37px;
  height: 37px;
  color: #99a173;
}

.journey-icon .icon {
  width: 22px;
}

.journey-strip h3 {
  font-size: 14px;
  color: #6c775c;
}

.journey-strip p {
  font-size: 9px;
  color: #9a9e8a;
  margin-top: 4px;
}

.journey-stars {
  margin-left: auto;
  color: #c9c8ac;
  font-size: 26px;
  letter-spacing: 7px;
  white-space: nowrap;
}

.journey-stars b {
  font-weight: 400;
  font-size: 38px;
  color: #b3b68c;
}

footer {
  max-width: 1220px;
  margin: auto;
  padding: 8px 48px 25px;
  display: flex;
  justify-content: space-between;
  color: #a2a791;
  font-size: 8px;
}

footer span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

footer .icon {
  width: 11px;
  height: 11px;
}

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

.pill {
  font-size: 9px;
  letter-spacing: 1px;
  color: #839173;
  border: 1px solid #dfe5d5;
  background: #f1f4e9;
  border-radius: 20px;
  padding: 8px 12px;
}

.game-intro {
  position: relative;
  text-align: left;
  border: 1px solid #dfe6d5;
  border-radius: 12px;
  padding: 24px 28px;
  overflow: hidden;
  background-image:
    linear-gradient(90deg, #e8efde 0%, #e8efdeed 45%, #e8efde00 80%),
    var(--theme-art);
  background-size: cover;
  background-position:
    center,
    center 65%;
  min-height: 148px;
}

.game-intro h1 {
  margin: 8px 0 10px;
  font-size: 29px;
  max-width: 70%;
}

.game-intro p {
  font-size: 12px;
  max-width: 430px;
  color: #647a56;
}

.quest-progress {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin: 22px auto;
  position: relative;
}

.quest-progress > span {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaece2;
  color: #c4c9b5;
}

.quest-progress > span .icon {
  width: 15px;
}

.quest-progress .now {
  background: #f5e6b7;
  color: #b29244;
  box-shadow: 0 0 0 4px #faf2d8;
}

.quest-progress .complete {
  background: #dfeadd;
  color: #48734e;
}

.game-card {
  max-width: 760px;
  margin: 0 auto;
  background: #fffefa;
  border: 1px solid #e3e5d8;
  border-radius: 16px;
  padding: 18px 32px 24px;
  box-shadow: 0 8px 30px #3b493905;
}

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #899477;
  font-size: 11px;
}

.game-card-top > span {
  display: flex;
  gap: 8px;
  align-items: center;
}

.game-card-top > span .icon {
  width: 18px;
}

.equation {
  text-align: center;
  font: 48px var(--serif);
  margin: 9px 0;
}

.equation > span {
  color: #b0b6a0;
  margin: 0 10px;
}

.equation > b {
  font-weight: 500;
  color: var(--green);
  display: inline-block;
  min-width: 55px;
}

.countup-note {
  text-align: center;
  font-size: 12px;
  color: #929783;
}

.countup-note strong {
  color: #5d7253;
}

.number-line {
  display: block;
  width: 100%;
  max-width: 650px;
  margin: 5px auto 0;
  overflow: visible;
}

.jump {
  fill: none;
  stroke: #d7ddc8;
  stroke-width: 3;
  stroke-dasharray: 6 5;
}

.jump.current {
  stroke: #bc9b52;
}

.step-labels {
  display: flex;
  gap: 10px;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 23px;
}

.step-labels > span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 8px;
  color: #b0b59f;
}

.step-labels b {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f0f1e8;
  font-size: 8px;
}

.step-labels .active {
  color: #957e45;
}

.step-labels .active b {
  background: #f3e7c3;
}

.step-labels .done {
  color: #7a9970;
}

.question-area {
  text-align: center;
}

.question-area h2 {
  font-size: 23px;
  margin: 11px 0 20px;
}

#answer-form {
  display: flex;
  justify-content: center;
  gap: 12px;
}

#answer {
  font: 25px var(--serif);
  width: 90px;
  border: 2px solid #c9d5be;
  border-radius: 8px;
  text-align: center;
  color: var(--green);
  background: #fcfdf7;
  height: 49px;
}

#answer::placeholder {
  color: #b2bea1;
}

.feedback {
  min-height: 38px;
  padding-top: 14px;
  font-size: 11px;
  color: #9c8b6a;
}

.feedback.correct {
  color: var(--green);
  font-weight: 600;
}

.hint-button {
  font-size: 11px;
}

.hint-box {
  font-size: 12px;
  line-height: 1.7;
  max-width: 450px;
  margin: 8px auto 0;
  padding: 12px 20px;
  border: 1px solid #e6ddbf;
  border-radius: 10px;
  background: #fbf5e4;
  color: #8d7d53;
}

.sum-jumps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  color: #a9ae98;
}

.sum-jumps > span {
  font-size: 23px;
  color: var(--green);
  background: #ecf1e4;
  padding: 8px 17px;
  border-radius: 8px;
}

.game-reassurance {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #99a18c;
  margin-top: 19px;
}

.game-reassurance .icon {
  width: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 30px 0;
}

.stats-grid article {
  background: #f1f3e8;
  border: 1px solid #e1e6d4;
  border-radius: 14px;
  text-align: center;
  padding: 27px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #8b9b72;
}

.stats-grid strong {
  font: 36px var(--serif);
  color: var(--green);
}

.stats-grid span {
  font-size: 12px;
}

.treasure-card,
.celebration {
  text-align: center;
  background: #fffef8;
  border: 1px solid #e6e6d5;
  border-radius: 16px;
  padding: 45px 24px;
  position: relative;
  overflow: hidden;
}

.reward-medal {
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #f5e9bd;
  border: 7px double #e7cf81;
  color: #b09144;
  margin: 0 auto 28px;
  box-shadow: 0 0 0 12px #faf5e4;
}

.reward-medal .icon {
  width: 50px;
  height: 50px;
}

.reward-medal.locked {
  filter: grayscale(0.7);
  opacity: 0.65;
}

.treasure-card h2 {
  font-size: 28px;
}

.treasure-card p {
  color: #8a937a;
  margin: 16px auto 25px;
  max-width: 420px;
  font-size: 13px;
}

.celebration {
  padding: 55px 24px;
  min-height: 620px;
}

.celebration h1 {
  font-size: 37px;
  margin: 18px 0;
}

.celebration p {
  color: #8a937b;
  font-size: 14px;
}

.celebration h3 {
  font-size: 22px;
  margin: 20px 0 10px;
}

.reward-count {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f6edd3;
  border-radius: 30px;
  color: #ab8f40;
  padding: 13px 22px;
  margin-top: 25px;
  font-size: 22px;
}

.celebration-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.secondary {
  padding: 13px 20px;
  border: 1px solid #d7dfcd;
  border-radius: 8px;
  background: #f4f6ec;
  color: #6e825b;
  font-size: 12px;
}

.muted {
  font-size: 11px !important;
  color: #9a9e8b !important;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  width: 7px;
  height: 13px;
  background: #c5d1a1;
  left: calc(var(--i) * 4.2%);
  top: -20px;
  animation: fall 3.5s calc(var(--i) * 0.07s) ease-out both;
}

.confetti i:nth-child(3n) {
  background: #e4c778;
}

.confetti i:nth-child(3n + 1) {
  background: #eab6a1;
  border-radius: 50%;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #243b3266;
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  background: #fffef9;
  padding: 35px;
  border-radius: 20px;
  max-width: 510px;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
}

.modal h2 {
  font-size: 27px;
  margin: 18px 0;
}

.modal p {
  font-size: 13px;
  margin: 14px 0;
  color: #829075;
}

.example {
  font-size: 17px;
  text-align: center;
  line-height: 2;
  background: #edf2e5;
  color: #6b8059;
  padding: 15px;
  border-radius: 10px;
}

.modal > .primary {
  margin-top: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes twinkle {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }

  100% {
    transform: translateY(650px) rotate(450deg);
    opacity: 0;
  }
}

@media (width >=1500px) {
  main {
    padding-top: 45px;
  }

  .hero {
    height: 365px;
  }

  .hero-copy {
    padding: 39px;
  }

  .hero h2 {
    font-size: 46px;
  }

  .hero p {
    font-size: 13px;
  }

  .module-body {
    padding: 28px;
  }

  .module-body h3 {
    font-size: 23px;
  }

  .module-body p {
    font-size: 12px;
  }

  .tip-card p {
    font-size: 12px;
  }

  .theme-section {
    margin-top: 32px;
    margin-bottom: 32px;
  }
}

@media (width <=1190px) {
  .sidebar {
    width: 205px;
    padding: 30px 18px;
  }

  .brand {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 7px;
  }

  .workspace {
    margin-left: 205px;
  }

  .topbar {
    padding: 0 30px;
  }

  main {
    padding: 30px;
  }

  .theme-section {
    gap: 15px;
    align-items: flex-start;
    flex-direction: column;
  }

  .module-card {
    grid-template-columns: 1fr;
  }

  .module-illustration {
    min-height: 150px;
    padding: 15px 30px 25px;
  }

  .module-illustration > svg {
    max-width: 230px;
  }

  .lesson-badge {
    bottom: 8px;
  }

  .module-body {
    padding: 22px;
  }

  .module-meta {
    font-size: 8px;
  }

  .module-body p {
    font-size: 12px;
  }

  .module-grid {
    grid-template-columns: 1.7fr 1fr;
  }

  .tip-card {
    padding: 24px;
  }

  .tip-card p {
    font-size: 12px;
  }

  .tip-card h3 {
    font-size: 23px;
  }

  .tip-card .text-button {
    font-size: 12px;
    margin-top: 20px;
  }

  .module-body h3 {
    font-size: 24px;
  }

  footer {
    padding-left: 30px;
    padding-right: 30px;
  }
}

@media (width <=850px) {
  .sidebar {
    width: 82px;
    padding: 25px 14px;
    align-items: center;
  }

  .brand > span:last-child,
  .side-label,
  .nav-item span,
  .growing,
  .parent-link {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 44px;
  }

  .sidebar nav {
    margin-top: 38px;
  }

  .nav-item {
    width: 48px;
    height: 48px;
    justify-content: center;
    padding: 0;
    margin-bottom: 12px;
  }

  .nav-item .nav-dot {
    display: none;
  }

  .workspace {
    margin-left: 82px;
  }

  .header-actions {
    gap: 15px;
  }

  .hero h2 {
    font-size: 35px;
  }

  .page-heading h1 {
    font-size: 27px;
  }

  .hero-copy {
    padding: 30px 25px;
  }

  .hero-art {
    object-position: 65% 50%;
  }

  .module-grid {
    gap: 15px;
  }

  .section-title > span {
    display: none;
  }

  .theme-tabs {
    width: 100%;
  }

  .theme-tab {
    flex: 1;
  }

  .theme-tab small {
    font-size: 5px;
  }

  .journey-stars {
    display: none;
  }

  .game-card {
    padding: 18px;
  }

  .step-labels {
    gap: 6px;
  }

  .step-labels > span {
    font-size: 7px;
  }
}

@media (width <=600px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: 72px;
    flex-direction: row;
    justify-content: space-between;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    font-size: 17px;
  }

  .brand > span:last-child {
    display: block;
  }

  .brand-sub {
    font-size: 6px;
    letter-spacing: 1.4px;
  }

  .brand-mark {
    width: 34px;
    height: 37px;
  }

  .brand-mark .icon {
    width: 25px;
  }

  .sidebar nav {
    margin: 0;
    display: flex;
    gap: 6px;
  }

  .nav-item {
    width: 37px;
    height: 37px;
    margin: 0;
    border-radius: 8px;
  }

  .sidebar-bottom {
    margin: 0;
  }

  .parent-link {
    display: flex;
    width: 35px;
    font-size: 0;
  }

  .parent-link .icon {
    width: 20px;
  }

  .workspace {
    margin: 0;
  }

  .topbar {
    height: 57px;
    padding: 0 20px;
  }

  .breadcrumb {
    font-size: 10px;
    gap: 10px;
  }

  .header-actions {
    gap: 10px;
  }

  .avatar {
    display: none;
  }

  .gem-count {
    font-size: 11px;
  }

  .gem-count span {
    display: none;
  }

  .icon-button {
    width: 33px;
    height: 33px;
  }

  .icon-button .icon {
    width: 17px;
  }

  main {
    padding: 25px 20px 18px;
  }

  .eyebrow {
    font-size: 7px;
    letter-spacing: 1.4px;
  }

  .page-heading {
    margin-bottom: 22px;
  }

  .page-heading h1 {
    font-size: 24px;
    letter-spacing: -0.8px;
    margin: 9px 0 6px;
  }

  .greeting-star {
    font-size: 25px;
    margin-left: 1px;
  }

  .page-heading p {
    font-size: 11px;
  }

  .grade-badge {
    display: none;
  }

  .hero {
    height: 405px;
  }

  .hero-art {
    object-position: 66% bottom;
    height: 80%;
    top: auto;
  }

  .hero::after {
    background: linear-gradient(
      180deg,
      #e4eddb 0%,
      #e4eddbfa 25%,
      #e4eddb66 55%,
      #e4eddb00 80%
    );
  }

  .hero-copy {
    padding: 23px;
  }

  .hero h2 {
    font-size: 34px;
    line-height: 1.18;
    letter-spacing: -1px;
    margin: 15px 0 10px;
  }

  .hero p {
    max-width: 215px;
    font-size: 10px;
    margin-bottom: 15px;
  }

  .desktop-break {
    display: none;
  }

  .hero-tag {
    font-size: 7px;
  }

  .hero-note {
    display: none;
  }

  .hero .primary {
    font-size: 11px;
    padding: 12px 17px;
    min-height: 42px;
  }

  .star-one {
    left: auto;
    right: 23px;
    top: 30px;
  }

  .theme-section {
    margin: 24px 0;
    gap: 15px;
    padding-bottom: 23px;
  }

  .section-label h2 {
    font-size: 18px;
  }

  .theme-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }

  .theme-tab {
    flex-wrap: wrap;
    padding: 10px 5px;
    gap: 5px;
    font-size: 10px;
    min-height: 66px;
  }

  .theme-tab > .icon {
    width: 19px;
    height: 19px;
  }

  .theme-tab span {
    width: 100%;
    order: 2;
    white-space: normal;
    font-size: 9px;
  }

  .theme-tab.selected > .icon:last-child {
    margin: 0;
    width: 12px;
  }

  .theme-tab small {
    font-size: 5px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-card {
    grid-template-columns: 1fr;
  }

  .module-illustration {
    min-height: 168px;
  }

  .module-illustration > svg {
    max-width: 250px;
  }

  .lesson-badge {
    bottom: 13px;
    font-size: 6px;
  }

  .module-body {
    padding: 23px;
  }

  .module-meta {
    font-size: 7px;
  }

  .module-body h3 {
    font-size: 24px;
  }

  .module-body p {
    font-size: 12px;
  }

  .module-bottom > span {
    font-size: 10px;
  }

  .round-button {
    width: 44px;
    height: 44px;
  }

  .round-button .icon {
    width: 19px;
    height: 19px;
  }

  .tip-card {
    padding: 22px;
  }

  .tip-card h3 {
    font-size: 22px;
  }

  .tip-card h3 br {
    display: none;
  }

  .tip-card p {
    max-width: 100%;
    font-size: 12px;
  }

  .tip-card .text-button {
    margin-top: 10px;
    font-size: 12px;
  }

  .tip-card .eyebrow {
    font-size: 8px;
  }

  .tip-sparkle {
    top: 20px;
  }

  .journey-strip {
    padding: 17px 14px;
    gap: 12px;
  }

  .journey-icon {
    width: 32px;
    flex-shrink: 0;
  }

  .journey-strip h3 {
    font-size: 13px;
    line-height: 1.5;
  }

  .journey-strip p {
    font-size: 9px;
  }

  footer {
    padding: 5px 20px 20px;
    gap: 15px;
    font-size: 7px;
  }

  footer > span:last-child {
    max-width: 120px;
    text-align: right;
  }

  .game-heading {
    margin-bottom: 22px;
  }

  .game-intro h1 {
    font-size: 27px;
  }

  .game-intro p {
    font-size: 11px;
  }

  .quest-progress {
    gap: 22px;
  }

  .game-card {
    padding: 15px 12px 22px;
    border-radius: 12px;
  }

  .game-card-top {
    font-size: 9px;
  }

  .equation {
    font-size: 39px;
    margin: 20px 0 10px;
  }

  .equation > span {
    margin: 0 4px;
  }

  .countup-note {
    font-size: 10px;
  }

  .number-line {
    margin-top: 13px;
  }

  .step-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 15px 12px;
  }

  .step-labels > span {
    font-size: 9px;
  }

  .question-area h2 {
    font-size: 21px;
    line-height: 1.45;
    margin: 12px 8px 20px;
  }

  .question-area .eyebrow {
    font-size: 8px;
  }

  #answer-form {
    gap: 8px;
  }

  #answer {
    width: 70px;
  }

  #answer-form .primary {
    padding: 12px 14px;
    font-size: 11px;
    gap: 9px;
  }

  .feedback {
    font-size: 10px;
    padding: 14px 8px 0;
  }

  .game-reassurance {
    font-size: 8px;
    gap: 5px;
  }

  .hint-box {
    font-size: 11px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stats-grid article {
    padding: 18px 5px;
    gap: 10px;
  }

  .stats-grid strong {
    font-size: 29px;
  }

  .stats-grid span {
    font-size: 9px;
  }

  .treasure-card {
    padding: 36px 20px;
  }

  .treasure-card h2 {
    font-size: 24px;
  }

  .celebration {
    padding: 40px 18px;
    min-height: 550px;
  }

  .celebration h1 {
    font-size: 29px;
    line-height: 1.4;
  }

  .celebration-actions {
    flex-direction: column;
  }

  .modal {
    padding: 25px;
    max-height: 85vh;
  }

  .modal h2 {
    font-size: 24px;
  }

  .modal p {
    font-size: 12px;
  }

  .reward-medal {
    width: 85px;
    height: 85px;
  }
}

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

.game-intro .eyebrow {
  color: #718563;
}

@media (width <=600px) {
  .game-intro {
    padding: 20px;
    min-height: 175px;
    background-position:
      center,
      70% 62%;
  }

  .game-intro h1 {
    font-size: 24px;
    max-width: 75%;
    line-height: 1.3;
  }

  .game-intro p {
    max-width: 69%;
    font-size: 10px;
    line-height: 1.65;
  }

  .game-intro .eyebrow {
    font-size: 6px;
    letter-spacing: 1px;
  }

  .question-area h2 {
    font-size: 22px;
  }

  .hint-button {
    min-height: 44px;
  }

  .primary {
    min-height: 44px;
  }
}

/* A solid overlay traces the existing dotted path; finished jumps never replay. */
.jump-solid {
  fill: none;
  stroke: var(--green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.revealing .jump-solid {
  animation: complete-jump 900ms ease-in-out both;
}

.revealing .jump-badge {
  animation: complete-badge 900ms steps(1, end) both;
}

.revealing .jump-value {
  transform-box: fill-box;
  transform-origin: center;
  animation: reveal-number 300ms 850ms ease-out both;
}

.sum-reveal {
  animation: reveal-number 400ms ease-out both;
}

.auto-advance-note {
  font-size: 11px;
  color: #637956;
  padding: 8px 0;
  min-height: 32px;
}

@keyframes complete-jump {
  from {
    stroke-dashoffset: 1;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes complete-badge {
  from {
    fill: #f1d48c;
  }

  to {
    fill: var(--green);
  }
}

@keyframes reveal-number {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Theme-independent river crossing. Each theme supplies its three character poses. */
.river-scene {
  margin: 14px -12px 8px;
  border: 1px solid #c8dfcf;
  border-radius: 18px;
  overflow: hidden;
  background: #c9e4dc;
  isolation: isolate;
}

.river-art {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--sans);
}

.river-art .jump {
  stroke: #91b8a3;
  stroke-width: 3;
  stroke-dasharray: 6 6;
}

.river-art .jump.current {
  stroke: #b39046;
}

.river-art .jump-solid {
  stroke-width: 4;
}

.character-pose {
  pointer-events: none;
}

.pose-jump,
.pose-wet {
  opacity: 0;
}

.motion-jumping .pose-jump,
.motion-shore-jumping .pose-jump {
  opacity: 1;
  animation: jump-pose 1200ms linear both;
}

.motion-jumping .pose-idle,
.motion-shore-jumping .pose-idle {
  animation: standing-pose 1200ms linear both;
}

.motion-jumping .character-motion {
  animation: stone-hop 1200ms cubic-bezier(0.3, 0.1, 0.6, 1) both;
}

.motion-shore-jumping .character-motion {
  animation: stone-hop 1200ms cubic-bezier(0.3, 0.1, 0.6, 1) both;
}

.motion-falling .character-motion {
  animation: river-tumble 650ms ease-in both;
  transform-origin: 0 -55px;
}

.motion-wet .pose-idle {
  opacity: 0;
}

.motion-wet .pose-wet {
  opacity: 1;
}

.motion-wet .character-motion {
  animation: soggy-bob 850ms ease-in-out infinite;
}

.motion-resetting .character-motion {
  animation: back-to-stone 650ms ease-out both;
}

/* A missed landing ruffles the character in every world, not just water. */
.river-scene:not(.scene-river) .motion-falling .pose-idle {
  opacity: 0;
}

.river-scene:not(.scene-river) .motion-falling .pose-wet {
  opacity: 1;
}

.river-scene:not(.scene-river) .motion-falling .character-motion {
  animation-name: adventure-tumble;
}

.river-scene:not(.scene-river) .motion-wet .character-motion {
  transform-origin: 0 -55px;
  animation: rumpled-wobble 900ms ease-out both;
}

.river-currents {
  animation: river-drift 6s ease-in-out infinite alternate;
}

.stone-ripple {
  transform-box: fill-box;
  transform-origin: center;
  animation: river-ripple 3.8s ease-in-out infinite;
}

.river-stone:nth-of-type(2n) .stone-ripple {
  animation-delay: -1.8s;
}

.splash-effect:not(.settled) .splash-crown,
.splash-effect:not(.settled) .splash-droplets {
  animation: splash-up 250ms 400ms ease-out both;
  transform-origin: center bottom;
}

.splash-effect:not(.settled) .splash-ring {
  animation: splash-ring 300ms 350ms ease-out both;
  transform-origin: center;
}

.splash-effect.settled .splash-crown {
  opacity: 0.45;
  transform: scaleY(0.25);
}

.splash-effect.settled .splash-droplets {
  animation: dripping 700ms ease-in infinite;
}

.splash-effect.settled .splash-ring {
  animation: river-ripple 1.2s ease-in-out infinite;
  transform-origin: center;
}

.game-card:has(.river-scene) .equation {
  font-size: 39px;
  margin: 3px 0;
}

.game-card:has(.river-scene) .step-labels {
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.game-card:has(.river-scene) .question-area h2 {
  margin: 9px 0 15px;
}

@keyframes stone-hop {
  0% {
    transform: translate(0, 0) scale(1);
  }

  12% {
    transform: translate(0, 3px) scale(1.04, 0.95);
  }

  50% {
    transform: translate(var(--half-jump), -85px) rotate(-6deg);
  }

  88% {
    transform: translate(var(--jump-x), 0) scale(1.06, 0.94);
  }

  100% {
    transform: translate(var(--jump-x), 0) scale(1);
  }
}

@keyframes jump-pose {
  0%,
  88% {
    opacity: 1;
  }

  89%,
  100% {
    opacity: 0;
  }
}

@keyframes standing-pose {
  0%,
  88% {
    opacity: 0;
  }

  89%,
  100% {
    opacity: 1;
  }
}

@keyframes river-tumble {
  0% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }

  25% {
    transform: translate(var(--half-fall), -22px) rotate(12deg);
    opacity: 1;
  }

  75% {
    transform: translate(var(--fall-x), 58px) rotate(24deg);
    opacity: 1;
  }

  100% {
    transform: translate(var(--fall-x), 94px) rotate(18deg);
    opacity: 0;
  }
}

@keyframes soggy-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }

  50% {
    transform: translateY(3px) rotate(1deg);
  }
}

@keyframes adventure-tumble {
  0% {
    transform: translate(0, 0) rotate(-10deg);
  }

  30% {
    transform: translate(var(--half-fall), -24px) rotate(28deg);
  }

  70% {
    transform: translate(var(--fall-x), 38px) rotate(55deg);
  }

  88% {
    transform: translate(var(--fall-x), 62px) rotate(-12deg) scale(1.06, 0.94);
  }

  100% {
    transform: translate(var(--fall-x), 57px) rotate(0);
  }
}

@keyframes rumpled-wobble {
  0%,
  100% {
    transform: rotate(0);
  }

  25% {
    transform: rotate(-7deg);
  }

  55% {
    transform: rotate(5deg);
  }

  80% {
    transform: rotate(-2deg);
  }
}

@keyframes back-to-stone {
  0% {
    transform: translate(var(--fall-x), 57px);
    opacity: 0.65;
  }

  45% {
    transform: translate(var(--half-fall), -30px);
    opacity: 1;
  }

  85% {
    transform: translate(0, 0) scale(1.05, 0.95);
  }

  100% {
    transform: translate(0, 0);
  }
}

@keyframes river-drift {
  from {
    transform: translateX(-6px);
  }

  to {
    transform: translateX(8px);
  }
}

@keyframes river-ripple {
  0%,
  100% {
    opacity: 0.4;
    scale: 0.95 1;
  }

  50% {
    opacity: 0.9;
    scale: 1.08 1.12;
  }
}

@keyframes splash-up {
  from {
    opacity: 0;
    transform: scale(0.4, 0.1);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes splash-ring {
  from {
    opacity: 0;
    transform: scale(0.2);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dripping {
  from {
    opacity: 0.8;
    transform: translateY(-4px);
  }

  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

@media (width <=600px) {
  .river-scene {
    margin: 12px -7px 6px;
    border-radius: 12px;
  }

  .game-card:has(.river-scene) {
    padding: 12px 10px 18px;
  }

  .game-card:has(.river-scene) .equation {
    font-size: 34px;
    margin: 9px 0;
  }

  .game-card:has(.river-scene) .step-labels {
    margin-bottom: 14px;
  }

  .game-card:has(.river-scene) .question-area h2 {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-jumping .character-motion,
  .motion-shore-jumping .character-motion {
    transform: translate(var(--jump-x), 0);
  }

  .motion-jumping .pose-idle,
  .motion-shore-jumping .pose-idle {
    opacity: 1;
  }

  .motion-jumping .pose-jump,
  .motion-shore-jumping .pose-jump {
    opacity: 0;
  }
}

.motion-ashore .character-motion {
  transform: translate(var(--jump-x), 0);
}

/* The two middle stones are built before the character crosses. */
.river-stone.stone-sinking .stone-body {
  transform-box: fill-box;
  transform-origin: center;
  animation: stone-sink 1700ms ease-in both;
}

.river-stone.stone-rising .stone-body {
  animation: stone-rise 600ms ease-out both;
}

.river-stone.stone-ready .stone-body {
  transform-box: fill-box;
  transform-origin: center;
  animation: stone-settle 850ms ease-out both;
}

.river-stone.stone-ready .stone-ripple {
  animation: stone-success-ring 1100ms ease-out both;
}

.river-stone.stone-sinking .stone-ripple {
  animation: stone-success-ring 1700ms ease-out both;
}

.river-scene[data-phase='stones'] .jump-group {
  opacity: 0.5;
}

.river-stone.stone-ready .stone-marker {
  fill: var(--green);
  font-size: 20px;
}

@keyframes stone-sink {
  0%,
  25% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }

  40% {
    transform: translateY(5px) rotate(-5deg);
    opacity: 1;
  }

  65% {
    transform: translateY(30px) rotate(7deg);
    opacity: 0.9;
  }

  90%,
  100% {
    transform: translateY(85px) rotate(9deg);
    opacity: 0;
  }
}

@keyframes stone-rise {
  0% {
    transform: translateY(80px);
    opacity: 0;
  }

  75% {
    transform: translateY(-6px);
    opacity: 1;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes stone-settle {
  0% {
    transform: translateY(0) scale(1);
  }

  35% {
    transform: translateY(-12px) scale(1.08);
  }

  70% {
    transform: translateY(2px) scale(1.02);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes stone-success-ring {
  0% {
    scale: 0.9;
    opacity: 0.8;
  }

  70% {
    scale: 1.3 1.5;
    opacity: 0.6;
  }

  100% {
    scale: 1.4 1.7;
    opacity: 0;
  }
}

.gem-count.collecting {
  background: #e7f4e5;
  box-shadow: 0 0 0 5px #eaf3dd66;
  color: #397460;
}

.gem-bonus {
  display: inline-block !important;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #397460;
  color: white !important;
  border-radius: 12px;
  padding: 3px 9px;
  white-space: nowrap;
  font-size: 11px !important;
  font-weight: 700;
}

.gem-flight-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.flying-gem {
  position: absolute;
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 3px 5px #375b4533);
}

.flying-gem svg {
  width: 100%;
  height: 100%;
}

.shore-gems {
  transition: opacity 0.3s;
}

.shore-gems.collected {
  opacity: 0;
}
