* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  min-height: 100vh;
  font-family: 'Comic Sans MS', 'Trebuchet MS', sans-serif;
  text-align: center;
  background: linear-gradient(135deg, #ffe6f2, #e6f7ff, #f0fff0);
}

body.game-play {
  background: linear-gradient(135deg, #ff9ecb 0%, #ffd866 25%, #87ddff 60%, #c19cff 100%);
}

h1 {
  font-size: 2.5rem;
  margin: 16px 0 8px;
  color: #5a3e8c;
  text-shadow: 2px 2px 0 #fff;
}

.subtitle {
  font-size: 1.3rem;
  color: #555;
  margin-bottom: 24px;
}

.back-link {
  display: inline-block;
  background: #fff;
  color: #5a3e8c;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}
.back-link:hover { background: #f3e6ff; }

/* ---- Grade buttons (home page) ---- */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.grade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  border-radius: 20px;
  font-size: 1.6rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
}
.grade-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.grade-btn.prek { background: #ff7eb9; }
.grade-btn.k    { background: #ff9a3c; }
.grade-btn.g1   { background: #ffd23c; color: #5a3e8c; }
.grade-btn.g2   { background: #5cd65c; }
.grade-btn.g3   { background: #4dc3ff; }
.grade-btn.g4   { background: #b366ff; }
.grade-btn.g5   { background: #ff5c8a; }

/* ---- Game menu buttons ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
}

.game-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 140px;
  border-radius: 20px;
  font-size: 1.3rem;
  font-weight: bold;
  text-decoration: none;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  padding: 8px;
  line-height: 1.3;
}
.game-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}
.game-btn small {
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: normal;
}

.game-btn.color   { background: #ff7eb9; }
.game-btn.count   { background: #4dc3ff; }
.game-btn.abc     { background: #ff9a3c; }
.game-btn.animal  { background: #5cd65c; }
.game-btn.shape   { background: #b366ff; }
.game-btn.rainbow { background: linear-gradient(45deg,#ff5c8a,#ffd23c,#5cd65c,#4dc3ff,#b366ff); }
.game-btn.draw    { background: #2da8a8; }

.game-btn.coming { opacity: 0.6; cursor: not-allowed; }

/* ---- Color Match game ---- */
.score-bar {
  font-size: 1.4rem;
  font-weight: bold;
  color: #5a3e8c;
  margin-bottom: 12px;
}

.prompt {
  font-size: 1.4rem;
  margin: 12px 0;
}

.target-color {
  width: 200px;
  height: 200px;
  border-radius: 30px;
  margin: 0 auto 24px;
  border: 6px solid #fff;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.color-choices {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  gap: 16px;
  justify-content: center;
}

.color-choice {
  width: 130px;
  height: 130px;
  border-radius: 20px;
  border: 4px solid #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.color-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.message {
  font-size: 1.6rem;
  font-weight: bold;
  margin-top: 24px;
  min-height: 40px;
}
.message.correct { color: #2da82d; }
.message.wrong   { color: #d44; }

/* ---- Animal Sounds game ---- */
.play-btn {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 16px 32px;
  border-radius: 30px;
  border: none;
  background: #ff9a3c;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  margin: 16px 0 24px;
  font-family: inherit;
}
.play-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.animal-choices {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  gap: 16px;
  justify-content: center;
}

.animal-choice {
  width: 130px;
  height: 130px;
  border-radius: 20px;
  border: 4px solid #fff;
  background: #fff8e6;
  font-size: 4.5rem;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.animal-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Counting game ---- */
.count-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto 24px;
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  min-height: 100px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.count-item { font-size: 2.5rem; }

.number-choices {
  display: grid;
  grid-template-columns: repeat(2, 110px);
  gap: 12px;
  justify-content: center;
}
.number-choice {
  width: 110px;
  height: 110px;
  border-radius: 20px;
  border: 4px solid #fff;
  background: #4dc3ff;
  font-size: 3rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.number-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- ABC game ---- */
.target-letter {
  display: inline-block;
  background: #ff9a3c;
  color: #fff;
  padding: 4px 16px;
  border-radius: 12px;
  font-size: 2rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.letter-choices {
  display: grid;
  grid-template-columns: repeat(2, 110px);
  gap: 12px;
  justify-content: center;
}
.letter-choice {
  width: 110px;
  height: 110px;
  border-radius: 20px;
  border: 4px solid #fff;
  background: #ff9a3c;
  font-size: 3.5rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.letter-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Shapes game ---- */
.target-shape-name {
  color: #b366ff;
  font-weight: bold;
  text-transform: uppercase;
}

.shape-choices {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  gap: 16px;
  justify-content: center;
}
.shape-choice {
  width: 130px;
  height: 130px;
  border-radius: 20px;
  border: 4px solid #fff;
  background: #fff8e6;
  font-size: 4.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.shape-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Rainbow Tap game ---- */
.next-color {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 16px;
}
#nextColor {
  text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
  font-size: 1.8rem;
}

.rainbow-choices {
  display: grid;
  grid-template-columns: repeat(4, 90px);
  gap: 12px;
  justify-content: center;
}
.rainbow-choice {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  border: 4px solid #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.rainbow-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.rainbow-choice.done {
  opacity: 0.3;
  border-color: #ddd;
}

/* ---- Draw a Shape game ---- */
.draw-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.small-btn {
  font-size: 1rem;
  padding: 10px 18px;
  margin: 0;
}
.play-btn.clear { background: #d44; }
.play-btn.done  { background: #2da82d; }

.color-picker {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}
.crayon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}
.crayon.selected {
  border-color: #5a3e8c;
  transform: scale(1.15);
}

.draw-canvas {
  display: block;
  margin: 0 auto;
  background: #fffef7;
  border: 4px solid #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  touch-action: none;
  cursor: crosshair;
  max-width: 100%;
}

/* ---- Draw a Shape judge buttons ---- */
.judge-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.judge-btn {
  font-size: 1.4rem;
  font-weight: bold;
  font-family: inherit;
  padding: 14px 28px;
  border-radius: 24px;
  border: 4px solid #fff;
  color: #fff;
  cursor: pointer;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.judge-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.judge-btn.yes { background: #2da82d; }
.judge-btn.no  { background: #d44; }

/* ---- Kindergarten game menu colors ---- */
.game-btn.k-bigger  { background: #4dc3ff; }
.game-btn.k-lower   { background: #ff9a3c; }
.game-btn.k-add     { background: #5cd65c; }
.game-btn.k-sound   { background: #ff7eb9; }
.game-btn.k-pattern { background: #b366ff; }
.game-btn.k-sight   { background: #ff5c8a; }
.game-btn.k-rhyme   { background: #2da8a8; }

/* ---- Bigger Number ---- */
.big-number-choices {
  display: grid;
  grid-template-columns: repeat(2, 160px);
  gap: 20px;
  justify-content: center;
}
.big-number-choice {
  width: 160px;
  height: 160px;
  border-radius: 24px;
  border: 4px solid #fff;
  background: #4dc3ff;
  font-size: 5rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.big-number-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Adding ---- */
.math-problem {
  font-size: 3.5rem;
  font-weight: bold;
  color: #5a3e8c;
  margin: 16px 0 24px;
  text-shadow: 2px 2px 0 #fff;
}

/* ---- First Sound ---- */
.big-word {
  font-size: 5rem;
  font-weight: bold;
  color: #5a3e8c;
  margin: 12px 0;
  line-height: 1.1;
}
.big-word br + * { font-size: 0.5em; }

/* ---- Patterns ---- */
.pattern-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.pattern-item {
  font-size: 3rem;
}
.pattern-item.question {
  background: #ffd23c;
  color: #5a3e8c;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: bold;
}

.pattern-choices {
  display: grid;
  grid-template-columns: repeat(2, 110px);
  gap: 12px;
  justify-content: center;
}
.pattern-choice {
  width: 110px;
  height: 110px;
  border-radius: 20px;
  border: 4px solid #fff;
  background: #fff;
  font-size: 3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.pattern-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Word choices (Sight Words, Rhyming) ---- */
.word-choices {
  display: grid;
  grid-template-columns: repeat(2, 160px);
  gap: 14px;
  justify-content: center;
}
.word-choice {
  width: 160px;
  min-height: 70px;
  border-radius: 18px;
  border: 4px solid #fff;
  background: #ff5c8a;
  font-size: 1.8rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  padding: 10px;
}
.word-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- 1st Grade menu colors ---- */
.game-btn.g1-sub     { background: #ff5c8a; }
.game-btn.g1-tens    { background: #4dc3ff; }
.game-btn.g1-time    { background: #b366ff; }
.game-btn.g1-money   { background: #5cd65c; }
.game-btn.g1-words   { background: #ff9a3c; }
.game-btn.g1-compare { background: #ff7eb9; }
.game-btn.g1-skip    { background: #2da8a8; }

/* ---- 2nd Grade menu colors ---- */
.game-btn.g2-add     { background: #5cd65c; }
.game-btn.g2-sub     { background: #ff5c8a; }
.game-btn.g2-frac    { background: #ff944d; }
.game-btn.g2-time    { background: #b366ff; }
.game-btn.g2-money   { background: #4dc3ff; }
.game-btn.g2-words   { background: #ff7eb9; }

/* ---- 3rd Grade menu colors ---- */
.game-btn.g3-mult    { background: #ff7eb9; }
.game-btn.g3-div     { background: #4dc3ff; }
.game-btn.g3-area    { background: #5cd65c; }
.game-btn.g3-elapsed { background: #b366ff; }
.game-btn.g3-syn     { background: #ff944d; }
.game-btn.g3-ant     { background: #ff5c8a; }
.game-btn.g3-frac    { background: #2da8a8; }

/* ---- Area ---- */
.area-svg {
  width: 320px;
  height: 240px;
  display: block;
  margin: 12px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---- Compare Fractions ---- */
.fraction-compare-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 12px 0;
}
.fraction-mini {
  width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.fraction-labels {
  display: grid;
  grid-template-columns: 140px 60px 140px;
  gap: 18px;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}
.fraction-label {
  font-size: 1.8rem;
  font-weight: bold;
  color: #5a3e8c;
}

/* ---- 4th Grade menu colors ---- */
.game-btn.g4-mult   { background: #ff7eb9; }
.game-btn.g4-div    { background: #4dc3ff; }
.game-btn.g4-place  { background: #ffd23c; color: #5a3e8c; }
.game-btn.g4-angle  { background: #5cd65c; }
.game-btn.g4-roman  { background: #b366ff; }
.game-btn.g4-states { background: #ff944d; }
.game-btn.g4-equiv  { background: #2da8a8; }

/* ---- Place Value ---- */
.place-number {
  font-size: 4.5rem;
  font-weight: bold;
  color: #5a3e8c;
  margin: 16px 0 24px;
  text-shadow: 2px 2px 0 #fff;
  letter-spacing: 4px;
}
.place-digit { display: inline-block; padding: 0 4px; }
.place-digit.highlight {
  background: #ffd23c;
  border-radius: 12px;
  color: #b30000;
  padding: 0 12px;
}

/* ---- Angles ---- */
.angle-svg {
  width: 280px;
  height: 220px;
  display: block;
  margin: 12px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---- Equivalent fraction blank ---- */
.blank {
  background: #ffd23c;
  color: #b30000;
  border-radius: 10px;
  padding: 0 12px;
}

/* ---- 5th Grade menu colors ---- */
.game-btn.g5-dec    { background: #4dc3ff; }
.game-btn.g5-frac   { background: #ff944d; }
.game-btn.g5-pemdas { background: #b366ff; }
.game-btn.g5-vol    { background: #5cd65c; }
.game-btn.g5-coord  { background: #ff7eb9; }
.game-btn.g5-pct    { background: #ff5c8a; }
.game-btn.g5-idiom  { background: #2da8a8; }

/* ---- Coordinates ---- */
.coord-svg {
  width: 360px;
  height: 360px;
  display: block;
  margin: 12px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 100%;
}

/* ---- Fractions ---- */
.fraction-svg {
  width: 240px;
  height: 240px;
  margin: 12px auto;
  display: block;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.coin.dollar {
  width: 100px;
  border-radius: 8px;
}

/* ---- Time input bar ---- */
.time-input-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.time-input {
  font-size: 2rem;
  font-weight: bold;
  font-family: inherit;
  text-align: center;
  width: 180px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 4px solid #fff;
  background: #fff;
  color: #5a3e8c;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  outline: none;
}
.time-input:focus {
  border-color: #b366ff;
}

/* ---- Tens & Ones blocks ---- */
.block-display {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.ten-stick {
  font-size: 1.5rem;
  letter-spacing: -2px;
  margin: 4px 0;
}
.ones-row {
  font-size: 1.5rem;
  margin-top: 8px;
}

/* ---- Telling Time ---- */
.clock-svg {
  width: 220px;
  height: 220px;
  margin: 12px auto;
  display: block;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---- Money ---- */
.coin-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  background: #fff8e6;
  border-radius: 16px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  min-height: 100px;
}
.coin {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  border: 3px solid rgba(0,0,0,0.15);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ---- Greater/Less ---- */
.compare-problem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 16px 0 24px;
}
.compare-num {
  font-size: 4rem;
  font-weight: bold;
  color: #5a3e8c;
  background: #fff;
  border-radius: 16px;
  padding: 8px 24px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  min-width: 80px;
  text-align: center;
}
.compare-q {
  font-size: 4rem;
  color: #ffd23c;
  font-weight: bold;
}

.compare-choices {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  gap: 14px;
  justify-content: center;
}
.compare-choice {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  border: 4px solid #fff;
  background: #ff7eb9;
  font-size: 3.5rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.compare-choice:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ---- Skip Counting ---- */
.skip-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.skip-num {
  font-size: 2.5rem;
  font-weight: bold;
  color: #5a3e8c;
  padding: 4px 12px;
}
.skip-num.question {
  background: #ffd23c;
  border-radius: 12px;
}
