/* QLOBE Kids — the Game Chooser.
   Candy-toy aesthetic per the chooser concept: sky-blue doodle background,
   glossy sticker wordmark, category badge pills over white "sticker sheet"
   cards, bordered game tiles with label bars, carousel with big glossy arrows.
   Always light — a kids' page commits to daylight. */

@font-face {
  font-family: 'Fredoka';
  /* css url() resolves relative to this file at /css/, so climb to /shared/ */
  src: url('../shared/fonts/fredoka-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --sky: #bee3f5;
  --sky-deep: #a4d3ec;
  --navy: #17517e;
  --blue: #2d7dd2;
  --purple: #7c4fc4;
  --white: #ffffff;
  --shadow: 0 6px 0 rgba(23, 81, 126, .18), 0 14px 30px rgba(23, 81, 126, .18);
  --font: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --cat: var(--blue); /* per-slide category color, set inline from JS */
  --slide-w: min(560px, 88vw);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--navy);
  background-color: var(--sky);
  /* faint white doodles, like a classroom wall of chalk stickers */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.28' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M38 42l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z'/%3E%3Cpath d='M150 30c8-10 24-8 27 3 12-3 20 8 14 17-3 5-9 6-14 6h-31c-8 0-13-6-13-12 0-8 9-16 17-14z'/%3E%3Crect x='36' y='150' width='44' height='34' rx='6'/%3E%3Cpath d='M42 150v34M58 150v34'/%3E%3Ccircle cx='205' cy='170' r='20'/%3E%3Cpath d='M120 210l24-46 24 46z'/%3E%3Cpath d='M215 82l24 8-16 20-8-28zM222 90l9 12'/%3E%3Cpath d='M96 96q10-12 20 0'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px 260px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding: max(10px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---------- header ---------- */

.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 8px 16px 0;
}

.masthead { text-align: center; min-width: 0; }

.wordmark {
  width: min(340px, 62vw);
  height: auto;
  filter: drop-shadow(0 5px 10px rgba(23, 81, 126, .25));
}

.tagline {
  margin: 2px 0 0;
  font-size: clamp(16px, 2.6vw, 22px);
  color: var(--blue);
  text-shadow: 0 2px 0 rgba(255, 255, 255, .7);
}

/* glossy circular corner buttons */
.corner-btn {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 4px solid var(--white);
  box-shadow: var(--shadow);
  background-image: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0) 45%);
  touch-action: manipulation;
}
.corner-btn svg { width: 30px; height: 30px; }
.corner-grownups { background-color: var(--purple); }
.corner-gear { background-color: var(--blue); }
.corner-gear .gear-hole { fill: var(--blue); }
.corner-btn:active { transform: scale(.94); }

/* ---------- tier-2 context row (back button + category badge) ---------- */

.context {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px 0;
}
.context[hidden] { display: none; }
.context .badge {
  position: static;
  transform: none;
}

.back-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background-color: var(--cat, var(--blue));
  background-image: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0) 45%);
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.back-btn svg { width: 24px; height: 24px; }
.back-btn:active { transform: scale(.92); }
.back-btn:focus-visible { outline: 4px solid var(--navy); outline-offset: 2px; }

/* ---------- carousel ---------- */

.chooser {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 0;
  margin-top: 6px;
}

.carousel {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 26px calc((100% - var(--slide-w)) / 2) 30px;
  width: 100%;
  outline: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel:focus-visible { box-shadow: inset 0 0 0 4px rgba(45, 125, 210, .5); border-radius: 24px; }

.slide {
  flex: 0 0 var(--slide-w);
  scroll-snap-align: center;
  position: relative;
  padding-top: 24px; /* room for the badge to overlap the card */
}

/* category badge pill, overlapping the top of the sticker sheet */
.badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 94%;
  white-space: nowrap;
  padding: 8px 20px 9px;
  border-radius: 999px;
  border: 3.5px solid var(--white);
  background-color: var(--cat);
  background-image: linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0) 55%);
  color: var(--white);
  font-size: clamp(15px, 2.3vw, 20px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  box-shadow: 0 4px 0 rgba(23, 81, 126, .16), 0 8px 18px rgba(23, 81, 126, .16);
}
.badge-emoji { font-size: 1.15em; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }

/* tier 1: the big category tile IS the slide — no card behind it */
.slide-cat .tile-big {
  border-width: 5px;
  border-radius: 28px;
  /* white outer ring stands in for the removed card */
  box-shadow: 0 0 0 5px var(--white), var(--shadow);
}
.tile-big .tile-art { aspect-ratio: 16 / 13; }
.tile-big .tile-label { font-size: clamp(17px, 2.6vw, 23px); padding: 10px 8px 12px; }

/* tier 2: one smaller game tile per slide */
.carousel.tier-games { --slide-w: min(340px, 72vw); }
.slide-game { padding-top: 4px; }
.slide-game .tile { box-shadow: 0 0 0 4px var(--white), 0 6px 0 rgba(23, 81, 126, .14), 0 12px 24px rgba(23, 81, 126, .14); }

/* ---------- game tiles ---------- */

.tile {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 4px solid var(--cat);
  background: var(--white);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 4px 0 rgba(23, 81, 126, .12);
  transition: transform .15s ease;
  touch-action: manipulation;
  position: relative;
  min-height: 44px;
}
a.tile:active { transform: scale(.96); }
a.tile:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }

.tile-art {
  position: relative;
  aspect-ratio: 6 / 5;
  background-color: var(--sky);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.tile-art > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile-art > img.contain { object-fit: contain; padding: 10%; }

.tile-label {
  display: block;
  padding: 8px 6px 9px;
  text-align: center;
  font-size: clamp(14px, 2.2vw, 19px);
  color: var(--cat);
  background: var(--white);
  border-top: 2px solid rgba(23, 81, 126, .08);
}

/* beta games: playable, placeholder-dressed — friendly sprout chip */
.tile-beta {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 249, 219, 0.95);
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(23, 81, 126, 0.25);
}

/* still-growing games: full color per the concept, with a sprout chip */
.tile-soon { cursor: default; }
.tile-soon .tile-art::after {
  content: '🌱 growing';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(23, 81, 126, .25);
}

/* ---------- arrows ---------- */

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background-color: var(--blue);
  background-image: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0) 45%);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  transition: opacity .2s ease, transform .15s ease;
}
.arrow svg { width: 30px; height: 30px; }
.arrow-prev { left: max(8px, env(safe-area-inset-left)); }
.arrow-next { right: max(8px, env(safe-area-inset-right)); }
.arrow:active { transform: translateY(-50%) scale(.92); }
.arrow:focus-visible { outline: 4px solid var(--navy); outline-offset: 2px; }
.arrow.is-off { opacity: 0; pointer-events: none; }

/* ---------- dots ---------- */

.dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  padding: 0 0 6px;
}
.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid var(--white);
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 2px 4px rgba(23, 81, 126, .18);
  padding: 0;
  cursor: pointer;
}
.dot.is-active { background: var(--blue); }

/* ---------- bottom bar ---------- */

.bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 4px 18px 6px;
  position: relative;
}

.chooser-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  font: inherit;
  font-size: clamp(20px, 3vw, 28px);
  color: var(--white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  background-color: var(--blue);
  background-image: linear-gradient(180deg, rgba(255,255,255,.4), rgba(255,255,255,0) 50%);
  border: 4px solid var(--white);
  border-radius: 999px;
  padding: 12px 34px;
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
}
.chooser-pill svg { width: 30px; height: 30px; }
.chooser-pill:active { transform: scale(.96); }
.chooser-pill:focus-visible { outline: 4px solid var(--navy); outline-offset: 2px; }

.ages-badge {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background-color: var(--purple);
  background-image: linear-gradient(180deg, rgba(255,255,255,.4), rgba(255,255,255,0) 50%);
  color: var(--white);
  box-shadow: var(--shadow);
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.ages-word { font-size: 16px; }
.ages-num { font-size: 30px; }

/* ---------- noscript ---------- */

.noscript-links { display: flex; flex-direction: column; gap: 14px; padding: 30px; }
.noscript-links a { color: var(--navy); font-size: 22px; }

/* ---------- responsive ---------- */

/* wide/landscape tablets: two slides in view */
@media (min-width: 1000px) {
  :root { --slide-w: min(470px, 42vw); }
}

/* keep the whole chooser on one screen: on shorter viewports, shrink the
   masthead and the big tiles instead of pushing the bottom bar off */
@media (max-height: 900px) {
  .wordmark { width: min(250px, 46vw); }
  .tagline { font-size: clamp(14px, 2vw, 18px); }
  :root { --slide-w: min(430px, 40vw); }
  .tile-big .tile-art { aspect-ratio: 16 / 11; }
}
@media (max-height: 900px) and (max-width: 999px) {
  :root { --slide-w: min(430px, 74vw); }
}

/* small phones: tighter chrome */
@media (max-width: 480px) {
  .corner-btn { width: 48px; height: 48px; border-width: 3px; }
  .corner-btn svg { width: 24px; height: 24px; }
  .arrow { width: 52px; height: 52px; }
  .ages-badge { width: 68px; height: 68px; }
  .ages-num { font-size: 24px; }
  .chooser-pill { padding: 10px 24px; }
}

/* short landscape (e.g. phones): shrink the masthead so tiles fit */
@media (max-height: 560px) {
  .wordmark { width: min(220px, 30vw); }
  .tagline { display: none; }
  .slide { padding-top: 20px; }
  .card { padding: 26px 10px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .arrow, .chooser-pill, .corner-btn { transition: none; }
}
