/*
 * All games (task PH3, all-games-for-kids.html). Its own small sheet, so the
 * page needs no Tailwind rebuild: today's look (the yellow page, cream cards,
 * Fredoka headings) with tiles like the home page's.
 *
 * Phone: two tiles across, the age chips scroll sideways, nothing sticky,
 * and room at the bottom for the signed-in bottom bar (PH1) and the panda.
 */
.ag-main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6.5rem 16px 112px;
  box-sizing: border-box;
  color: #1e2a4a;
}
.ag-top { text-align: center; margin-bottom: 1rem; }
.ag-top h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 .35rem; }
.ag-lead { margin: 0; font-size: 1rem; }

.ag-tools { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; min-width: 0; }
/* The row scrolls inside itself and never widens the page: with the kid's
   chip first it is wider than a phone, and the chips' "Age"/"Ages" words
   (sr-only, position: absolute) would otherwise be placed against the page,
   not the chip, and stick out past the right edge (the page then scrolled
   sideways and a Pixel zoomed out, clipping the header). */
.ag-ages {
  position: relative;
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}
.ag-chip {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
  padding: .5rem 1rem;
  border-radius: 9999px;
  border: 2px solid #1e2a4a;
  background: #fffaf0;
  color: #1e2a4a;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.ag-chip[aria-pressed="true"] { background: #1e2a4a; color: #fff; }
.ag-chip:focus-visible, .ag-search:focus-visible, .ag-jump:focus-visible, .ag-tile:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
}
.ag-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: .6rem 1rem;
  border-radius: 1rem;
  border: 2px solid #1e2a4a;
  background: #fff;
  color: #1e2a4a;
  font: inherit;
  font-size: 1rem;
}

.ag-jumps { background: rgba(255, 250, 240, .7); border-radius: 1.25rem; padding: .75rem; margin-bottom: 1.25rem; }
.ag-jumps-title { margin: 0 0 .5rem; font-weight: 700; font-size: .95rem; }
.ag-jumps ul { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.ag-jump {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 40px;
  padding: .35rem .85rem;
  border-radius: 9999px;
  background: #fffaf0;
  color: #1e2a4a;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

.ag-section { margin: 0 0 1.75rem; scroll-margin-top: 96px; }
.ag-heading { display: flex; align-items: center; gap: .6rem; margin: 0 0 .75rem; font-family: 'Fredoka One', 'Fredoka', cursive, sans-serif; font-weight: 400; font-size: 1.5rem; }
.ag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  font-size: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  flex-shrink: 0;
}
.ag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 640px) { .ag-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1024px) { .ag-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .ag-top h1 { font-size: 2.5rem; } }
@media (min-width: 1280px) { .ag-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* A group inside a topic (task LT1: "Letters A–Z", the 26 letter pages):
   a small heading, then smaller tiles, more across, so 26 stay compact
   (3 across on a phone). */
.ag-sub { margin-top: 1.25rem; }
.ag-subheading { margin: 0 0 .6rem; font-family: 'Fredoka One', 'Fredoka', cursive, sans-serif; font-weight: 400; font-size: 1.2rem; }
.ag-grid.ag-grid-sub { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 640px) { .ag-grid.ag-grid-sub { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; } }
@media (min-width: 1024px) { .ag-grid.ag-grid-sub { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .ag-grid.ag-grid-sub { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
.ag-grid-sub .ag-tile { min-height: 0; font-size: .95rem; border-radius: 1.1rem; }
.ag-grid-sub .ag-tile:has(.ag-pic) { gap: .35rem; padding: .5rem .4rem 1.5rem; }
.ag-grid-sub .ag-pic { border-radius: .9rem; }

.ag-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 128px;
  height: 100%;
  box-sizing: border-box;
  padding: 1rem .5rem 1.6rem;
  border-radius: 1.5rem;
  background: #fffaf0;
  color: #1e2a4a;
  text-align: center;
  text-decoration: none;
  font-family: 'Fredoka One', 'Fredoka', cursive, sans-serif;
  font-size: 1.05rem;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .15);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ag-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 20px rgba(0, 0, 0, .22); }
.ag-emoji { font-size: 2.6rem; line-height: 1; }
/* The tile's picture (task AG-PIC): square, rounded, scales with the tile. */
.ag-pic { display: block; width: 100%; max-width: 132px; height: auto; aspect-ratio: 1; border-radius: 1.25rem; box-shadow: 0 3px 8px rgba(0, 0, 0, .12); }
.ag-tile:has(.ag-pic) { justify-content: flex-start; padding: .75rem .6rem 1.7rem; }
.ag-label { overflow-wrap: anywhere; }
.ag-played {
  position: absolute;
  bottom: .45rem;
  left: 50%;
  transform: translateX(-50%);
  padding: .1rem .55rem;
  border-radius: 9999px;
  background: #237a55;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: .75rem;
  white-space: nowrap;
}
.ag-played[hidden], .ag-main [hidden] { display: none !important; }

.ag-empty { text-align: center; background: #fffaf0; border-radius: 1.5rem; padding: 1.5rem 1rem; margin-bottom: 1.5rem; }
.ag-empty p { font-size: 1.4rem; margin: 0 0 .75rem; }

@media (prefers-reduced-motion: reduce) {
  .ag-tile { transition: none; }
  .ag-tile:hover { transform: none; }
}
