/* Compare games (Math, Pre-K to Grade 3): one stylesheet for all seven games. Built Oct 29 2026;
   updated Oct 29 2026 (Brandie's play-test fixes): the question sentence is large, the symbol tiles
   drag into the box, the number line / chart are tappable counting references, Pre-K sits on ONE row,
   every How to play page has a demo, and the summary shows small answer-sheet cards.
   Buttons are at least 44px tall; tablet width 820px works (everything stays on its row). */
.cg-screen h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 4px 0 6px; }
.cg-lead { margin: 0 0 10px; }
/* The full-sentence question, large and readable (Brandie, Oct 29 2026) */
.cg-prompt { margin: 8px 0 12px; text-align: center; color: var(--ink); font-weight: 800; font-size: clamp(1.3rem, 3vw, 1.7rem); }
.cg-prompt .cchelp-speaker { display: inline-grid; vertical-align: middle; margin-left: 10px; }

/* The two sides (groups of pictures / big-small pictures / numbers) */
.cg-sides, .cg-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; justify-items: center; margin: 0 auto 14px; max-width: 860px; }
.cg-compare { grid-template-columns: 1fr auto 1fr; align-items: center; }
/* Pre-K: [group 1] [group 2] [They are the same] all on the SAME row (laptop 1024 and tablet 820;
   phones may wrap) */
.cg-prekrow { grid-template-columns: 1fr 1fr auto; align-items: center; max-width: 980px; }
.cg-side { display: flex; align-items: center; justify-content: center; min-height: 150px; width: 100%; padding: 12px; border: 3px solid var(--border); border-radius: 18px; background: white; font-family: inherit; cursor: pointer; touch-action: manipulation; }
button.cg-side { min-height: 150px; }
.cg-side:focus-visible { outline: 4px solid var(--blue-action); outline-offset: 2px; }
.cg-side.cg-picked, .cg-same-btn.cg-picked { border-color: #d9a800; background: #fff8dc; }
.cg-side.cg-right, .cg-actions .cg-right, .cg-prekrow .cg-right { border-color: var(--green-dark); background: #e6f6ec; }
/* Groups are drawn in tidy rows of 5 (like ten-frames) so counting is easy; never overlap. */
.cg-grid { display: grid; grid-template-columns: repeat(5, 44px); gap: 6px; justify-content: center; }
.cg-grid img { width: 40px; height: 40px; display: block; }
.cg-sizeside img.cg-sizepic { display: block; max-width: 100%; height: auto; }
.cg-numpanel .cg-bignum { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 900; color: var(--ink); }
.cg-exprpanel .cg-bignum { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.cg-panel { cursor: default; }

/* The symbol box in the middle (K and up): the drop target of the drag */
.cg-box { display: flex; align-items: center; justify-content: center; width: 84px; height: 84px; border: 4px dashed var(--blue-action); border-radius: 16px; background: white; font-size: 2.6rem; font-weight: 900; color: var(--ink); }
.cg-box-done { border-style: solid; border-color: var(--green-dark); background: #e6f6ec; }
.cg-box-over { border-color: var(--green-dark); background: #e6f6ec; transform: scale(1.06); }

/* Answer buttons: big, at least 44px (rule: tablet-friendly) */
.cg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 10px 0; }
.cg-actions .btn { min-width: 120px; min-height: 56px; font-size: 1.3rem; font-weight: 900; }
.cg-sym { min-width: 96px; touch-action: none; cursor: grab; user-select: none; }
/* Dragging a symbol tile (the Sort Even and Odd pattern): the tile follows the finger/mouse */
.cg-sym.cg-dragging { position: relative; z-index: 30; cursor: grabbing; box-shadow: 0 10px 18px rgba(37, 49, 44, .28); }
.cg-sym.cg-return { transition: transform .3s ease; }
.cg-same-btn { min-width: 170px; }

/* Feedback + points + Next (same rhythm as Find the Missing Number) */
.cg-feedback { min-height: 2.6em; margin: 4px 0 6px; text-align: center; font-weight: 800; font-size: 1.1rem; }
.cg-earned { margin: 0 0 8px; text-align: center; font-weight: 900; color: var(--green-dark); font-size: 1.2rem; }
.cg-next { min-width: 180px; min-height: 54px; font-size: 1.1rem; }

/* Reference pulldowns: Number line / Number chart. Both closed by default; only one open at a time.
   The open pulldown scrolls INSIDE its own box so the answer tiles stay visible without page
   scrolling at 768px height (Semira's check, Oct 29 2026). */
.cg-pulls { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.cg-pull { border: 2px solid var(--border); border-radius: 14px; background: white; flex: 1 1 340px; min-width: 280px; max-width: 760px; }
.cg-pull-sum { list-style: none; margin: 0; min-height: 44px; }
.cg-pull-sum::-webkit-details-marker { display: none; }
.cg-pull[open] .cg-pull-sum { border-bottom: 2px solid var(--border); border-radius: 12px 12px 0 0; }
.cg-pull-body { padding: 10px; max-width: 720px; max-height: 120px; overflow-y: auto; }
/* Tappable number line (K: 0, 1, 2 ... 10; Grade 1: 1, 2 ... 20): same cells, green highlight and red
   count badge as the Find the Missing Number chart (mn-cell / mn-tapped / mn-count classes reused — no
   new colours) */
.cg-line { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.cg-line-cell { width: 52px; flex: 0 0 auto; }
/* The 20-number Grade 1 line wraps into TWO tidy rows of 10 (Brandie, Oct 29 2026, round 3) at laptop
   1024 and tablet 820. Its cells are 46px (>= the 44px tap minimum) at EVERY width so both rows
   (2 x 46 + 6 = 118px) fit the standard 120px pulldown box with no inner scrollbar. The K 0-10 line
   (11 cells, 52px) keeps its single row and its cell size. */
.cg-line-wide { max-width: 514px; margin: 0 auto; } /* 10 x 46px + 9 x 6px gaps */
.cg-line-wide .cg-line-cell { width: 46px; }
.cg-pull[open]:has(.cg-line-wide) { flex: 1 0 538px; } /* only while OPEN: 514px of numbers + padding/borders. At laptop 1024 both pulldown buttons stay side by side; at tablet 820 the chart button wraps to its own row below. Closed buttons are untouched. */
/* the open box keeps its standard 120px max-height and still scrolls inside itself if ever needed:
   the answer tiles stay visible at 768px height (rule, checked by the browser test) */
.cg-demo-line.cg-line-wide { max-width: 494px; } /* demo cells are 44px: 10 x 44px + 9 x 6px gaps */
.cg-chart-wrap .mn-chart { max-width: 560px; margin: 0 auto; }

/* Summary page (same style family as the other Math games) */
.cg-end { text-align: center; }
.cg-end-piko { width: 140px; height: auto; }
.cg-total { font-size: 1.6rem; font-weight: 900; color: var(--green-dark); margin: 6px 0 14px; }
.cg-practice { text-align: left; max-width: 640px; margin: 0 auto 14px; background: var(--paper); border: 2px solid var(--border); border-radius: 14px; padding: 12px 18px; }
.cg-practice h2 { margin: 4px 0 8px; font-size: 1.2rem; }
.cg-practice ul { margin: 0; padding-left: 1.3em; font-weight: 700; }
.cg-practice li { margin: 6px 0; }
.cg-practice ul.cg-prac-wrap { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; justify-content: center; }
.cg-practice .cg-prac-eq { background: white; border: 2px solid var(--border); border-radius: 12px; padding: 8px 14px; font-weight: 900; font-size: 1.1rem; margin: 0; }
/* Small answer-sheet cards (Pre-K and K picture questions): question, tiny pictures, right answer */
.cg-prac-card { width: 250px; margin: 0; background: white; border: 2px solid var(--border); border-radius: 12px; padding: 8px 10px; text-align: center; }
.cg-prac-ask { margin: 0 0 6px; font-weight: 800; font-size: .9rem; color: var(--ink); }
.cg-prac-pics { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cg-prac-grid { grid-template-columns: repeat(5, 20px); gap: 3px; }
.cg-prac-grid img { width: 18px; height: 18px; }
.cg-prac-sym { font-size: 1.6rem; font-weight: 900; color: var(--ink); }
.cg-prac-sizepic { display: block; }
.cg-prac-answer { margin: 6px 0 0; font-weight: 800; font-size: .9rem; color: var(--green-dark); }

/* How to play page (rule 18): Piko top-right (rule 15), speaker right after the heading (rule 18.4) */
.cg-help { position: relative; }
.cg-help-piko { position: absolute; top: 10px; right: 12px; width: 92px; height: auto; }
.cg-help h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cg-help-text { font-size: 1.2rem; font-weight: 700; max-width: 640px; }

/* The demo on the How to play page: a mini copy of the game screen inside a bordered box.
   Cosmetic only — it never touches the score, the tries or the question. */
.cg-demo { position: relative; max-width: 640px; margin: 14px 0 0; padding: 14px; border: 2px solid var(--border); border-radius: 16px; background: white; overflow: hidden; }
.cg-demo-sentence { text-align: center; color: var(--ink); font-weight: 800; font-size: 1.1rem; margin: 0 0 10px; }
.cg-demo .cg-compare, .cg-demo .cg-sides { max-width: 520px; margin-bottom: 10px; }
.cg-demo .cg-side { min-height: 90px; }
.cg-demo .cg-grid { grid-template-columns: repeat(5, 32px); gap: 4px; }
.cg-demo .cg-grid img { width: 30px; height: 30px; }
.cg-demo .cg-numpanel .cg-bignum { font-size: 1.8rem; }
.cg-demo .cg-box { width: 60px; height: 60px; font-size: 1.9rem; }
.cg-demo .cg-actions .btn { min-width: 72px; min-height: 48px; font-size: 1.2rem; }
.cg-demo-line .cg-line-cell { width: 44px; }
.cg-demo-chart .mn-chart { max-width: 340px; margin: 0 auto; }
.cg-demo-cap { min-height: 3em; margin: 10px 0 6px; text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.cg-demo .button-row { justify-content: center; }
.cg-demo-steps { margin: 0; padding-left: 1.4em; font-weight: 700; }
.cg-demo-steps li { margin: 8px 0; }
.cchelp-demo-cap { color: var(--ink); }

/* Tablet 820px and narrower phones: keep two sides visible, shrink the art a little */
@media (max-width: 820px) {
  .cg-grid { grid-template-columns: repeat(5, 38px); gap: 4px; }
  .cg-grid img { width: 34px; height: 34px; }
  .cg-side { min-height: 120px; }
  .cg-box { width: 64px; height: 64px; font-size: 2rem; }
  .cg-prekrow .cg-grid { grid-template-columns: repeat(5, 30px); }
  .cg-prekrow .cg-grid img { width: 28px; height: 28px; }
  .cg-prekrow .cg-same-btn { min-width: 150px; }
  .cg-line-cell { width: 46px; }
}
@media (max-width: 560px) {
  .cg-sides, .cg-compare { grid-template-columns: 1fr; }
  .cg-compare .cg-box { justify-self: center; }
  /* Phone widths: the Pre-K row may wrap (task allows it; laptop 1024 and tablet 820 keep one row) */
  .cg-prekrow .cg-same-btn { justify-self: center; }
}
