/* UKG Senior KG Numeracy — centered 3D Pixar picture-first layout */
#gameScr .gbody {
  gap: 14px !important;
  padding-top: 16px !important;
  padding-bottom: 16px !important;
}
#gameScr .gbody:has(> .pgrid) {
  padding-top: clamp(18px, 2.6vh, 26px) !important;
  padding-bottom: clamp(22px, 3vh, 30px) !important;
}
#gameScr .gbody:not(:has(> .qimg)) > .pgrid {
  margin-top: auto !important;
  margin-bottom: auto !important;
}
#gameScr .gbody:not(:has(> .qimg)):has(> .lines) {
  padding-top: clamp(18px, 2.6vh, 26px) !important;
  padding-bottom: clamp(22px, 3vh, 30px) !important;
  gap: 16px !important;
}
#gameScr .gbody:not(:has(> .qimg)):has(> .lines) > .lines {
  margin-top: auto !important;
}
#gameScr .gbody:not(:has(> .qimg)):has(> .lines) > .bank {
  margin-bottom: auto !important;
}
#gameScr .gbody:not(:has(> .qimg)):has(> .mwrap) > .mwrap {
  margin-top: auto !important;
  margin-bottom: auto !important;
}
#gameScr .gbody > .qimg {
  max-width: min(680px, 94%) !important;
  height: auto !important;
  max-height: clamp(140px, 26vh, 235px) !important;
  object-fit: contain !important;
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 16px;
  border: 2px solid #efe2c6;
  box-shadow: 0 6px 18px rgba(30, 51, 87, 0.08);
}

/* Text-only quiz option cards below the question image */
#gameScr .cards3:has(.opt:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  max-width: 680px !important;
  gap: 16px !important;
}
#gameScr .cards3:has(.opt:nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  max-width: 820px !important;
  gap: 14px !important;
}

/* Text-only Order cards below the top image */
#gameScr .ogrid:has(> .ocard:nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  max-width: 760px !important;
  gap: 14px !important;
}
#gameScr .ogrid:has(> .ocard:nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  max-width: 840px !important;
  gap: 12px !important;
}
#gameScr .ogrid:has(> .ocard:nth-child(5):last-child) {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  max-width: 880px !important;
  gap: 10px !important;
}
#gameScr .ocard {
  min-height: 78px !important;
  padding: 14px 12px !important;
  justify-content: center;
}
#gameScr .ocard .ot { font-size: 17px !important; font-weight: 800; color: #213b60; }

/* Picture Pickset grid (3x2 for 6 cards) — images inside colorful cards */
#gameScr .pgrid:has(> .pick:nth-child(6):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  max-width: 800px !important;
  gap: 16px !important;
}
#gameScr .pick {
  min-height: 158px !important;
  justify-content: center;
  padding: 14px 12px 12px !important;
  border-radius: 18px !important;
  border: 2px solid #e6edf7 !important;
  border-bottom-width: 5px !important;
  background: #ffffff !important;
  box-shadow: 0 6px 14px rgba(30, 51, 87, 0.08) !important;
  gap: 8px;
}
#gameScr .pick:nth-child(3n+1) { background: #f3fcf6 !important; border-bottom-color: #16a34a !important; }
#gameScr .pick:nth-child(3n+2) { background: #fffbf0 !important; border-bottom-color: #f59e0b !important; }
#gameScr .pick:nth-child(3n+3) { background: #f9f5ff !important; border-bottom-color: #8b5cf6 !important; }
#gameScr .pick.good { background: #dcfce7 !important; border-color: #16a34a !important; }
#gameScr .pick img { width: auto !important; max-width: 92% !important; height: 104px !important; object-fit: contain !important; }
#gameScr .pick .pt { font-size: 16px !important; font-weight: 800; color: #213b60; text-align: center; }

/* Picture-only Memory cards (12 cards = 4x3) — centered in middle of page, NO top image, NO text inside cards */
#gameScr .gbody:has(> .ct-memory) {
  padding-top: clamp(16px, 2.4vh, 24px) !important;
  padding-bottom: clamp(18px, 2.6vh, 26px) !important;
}
#gameScr .gbody:has(> .ct-memory) > .ct-memory {
  margin-top: auto !important;
  margin-bottom: auto !important;
}
#gameScr .ct-memory {
  max-width: 760px !important;
  gap: 14px !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
#gameScr .ct-memory-card {
  min-height: 108px !important;
  height: 108px !important;
  padding: 8px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px !important;
  font-weight: 800;
  border-radius: 18px !important;
}
#gameScr .ct-memory-card.revealed {
  background: #ffffff !important;
  padding: 8px !important;
}
#gameScr .ct-memory-card img {
  width: auto !important;
  max-width: 90% !important;
  height: 84px !important;
  object-fit: contain !important;
  display: block;
  margin: auto;
}
#gameScr .ct-memory-card span { display: none !important; }

/* Text-only Match columns — wide boxes & compact balanced gaps matching About Me reference */
#gameScr .gbody:has(> .mwrap.notebook-match) {
  padding: clamp(18px, 2.8vh, 28px) clamp(24px, 3.6vw, 44px) clamp(20px, 3vh, 30px) !important;
  gap: clamp(16px, 2.4vh, 24px) !important;
  justify-content: flex-start !important;
}
#gameScr .gbody:has(> .mwrap.notebook-match) > .mwrap.notebook-match {
  max-width: 920px !important;
  width: 100% !important;
  margin: auto !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
  align-items: center !important;
  gap: clamp(72px, 10vw, 120px) !important;
}
#gameScr .mwrap.notebook-match .mcol {
  flex: 1 1 0 !important;
  width: auto !important;
  max-width: 420px !important;
  justify-content: center !important;
  gap: clamp(22px, 3.2vh, 30px) !important;
}
#gameScr .mwrap.notebook-match .mitem {
  height: clamp(66px, 9.4vh, 78px) !important;
  min-height: 64px !important;
  max-height: 80px !important;
  padding: 10px 20px !important;
  gap: 10px;
}
#gameScr .mwrap.notebook-match:has(.mcol > .mitem:nth-child(5)) .mcol {
  gap: clamp(14px, 2vh, 20px) !important;
}
#gameScr .mwrap.notebook-match:has(.mcol > .mitem:nth-child(5)) .mitem {
  height: clamp(56px, 8vh, 66px) !important;
  min-height: 54px !important;
}
#gameScr .mwrap.notebook-match .mitem .mtext { font-size: 17px !important; font-weight: 700 !important; color: #1e3357; }

/* Single-image Sortbins cards + bins — question cleanly at TOP, items + boxes centered below */
#gameScr .gbody:has(> .bins) {
  justify-content: flex-start !important;
  padding-top: clamp(16px, 2.4vh, 24px) !important;
  padding-bottom: clamp(18px, 2.6vh, 26px) !important;
  gap: 12px !important;
}
#gameScr .gbody:has(> .bins) > .bank {
  margin-top: auto !important;
}
#gameScr .gbody:has(> .bins) > .bins {
  margin-bottom: auto !important;
}
#gameScr .bank { gap: 12px !important; max-width: 840px; justify-content: center; align-items: stretch; }
#gameScr .bank:has(> .chip:nth-child(7)) { max-width: 620px; }
#gameScr .bank .chip:has(img) {
  background: #ffffff !important;
  color: #213b60 !important;
  border: 2px solid #e6edf7 !important;
  border-bottom: 5px solid #851013 !important;
  border-radius: 16px !important;
  padding: 8px 12px 7px !important;
  min-width: 118px;
  min-height: 104px;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  box-shadow: 0 6px 14px rgba(30, 51, 87, 0.08) !important;
  font-size: 14.5px !important;
  font-weight: 800 !important;
}
#gameScr .bank .chip img {
  width: auto !important;
  max-width: 92px !important;
  height: 68px !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}
#gameScr .bins { max-width: 760px !important; gap: 18px !important; }
#gameScr .bin { min-height: 112px !important; padding: 14px !important; }
#gameScr .bin h4 { font-size: 18px !important; }

/* Fillbank compact lines */
#gameScr .lines { max-width: 760px; gap: 8px; }
#gameScr .line { padding: 8px 14px; font-size: 17px !important; }

/* Hub chapter card image */
#chapCards .ic .book-card-img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }

@media (max-width: 600px) {
  #gameScr .gbody > .qimg { max-height: 165px !important; padding: 6px 10px; }
  #gameScr .cards3:has(.opt:nth-child(3):last-child) { grid-template-columns: 1fr !important; }
  #gameScr .ogrid:has(> .ocard:nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  #gameScr .pgrid:has(> .pick:nth-child(6):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #gameScr .mitem { height: 54px !important; padding: 6px 10px !important; }
  #gameScr .mitem .mtext { font-size: 14px; }
}
