/* ============================================================
   Jugnu Jar — theme: colours, typography, buttons
   ============================================================ */

:root {
  /* playful palette */
  --c-bg-1: #6a4bd6;
  --c-bg-2: #b06ae0;
  --c-bg-3: #ff8fb1;

  --c-card: #ffffff;
  --c-ink: #2d2150;
  --c-ink-soft: #6b6390;

  --c-telugu: #ff9f1c;
  --c-telugu-2: #ffbf69;
  --c-hindi: #2ec4b6;
  --c-hindi-2: #7be0d6;
  --c-maths: #5b7cfa;
  --c-maths-2: #9db3ff;
  --c-code: #3f7ee8;
  --c-code-2: #9fd0ff;

  --c-good: #35c46a;
  --c-good-dark: #1f9c4d;
  --c-warn: #ffcf3f;
  --c-oops: #ff6b6b;

  /* Jugnu Jar brand — the cream of the logo's label, used behind the mark on
     the home page. The app's twilight gradient already supplies the dusk sky. */
  --c-cream: #fdf8e8;

  --c-learn: #4ea8ff;
  --c-match: #ff7ac0;
  --c-listen: #ffb02e;
  --c-trace: #7ed957;
  --c-solve: #a06bff;

  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 32px;
  --r-pill: 999px;

  --shadow-1: 0 4px 0 rgba(45, 33, 80, .18), 0 8px 18px rgba(45, 33, 80, .18);
  --shadow-2: 0 8px 0 rgba(45, 33, 80, .20), 0 14px 30px rgba(45, 33, 80, .22);
  --shadow-in: inset 0 3px 10px rgba(45, 33, 80, .12);

  --tap: 68px;              /* minimum touch target */
  --font-ui: "Baloo 2", "Comic Sans MS", "Segoe UI Rounded", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-indic: "Nirmala UI", "Noto Sans Telugu", "Noto Sans Devanagari",
                "Gautami", "Mangal", "Telugu Sangam MN", "Devanagari Sangam MN", sans-serif;
}

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

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--c-ink);
  background: linear-gradient(160deg, var(--c-bg-1) 0%, var(--c-bg-2) 55%, var(--c-bg-3) 100%);
  background-attachment: fixed;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* floating bubbles in the backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255,255,255,.16) 0 42px, transparent 43px),
    radial-gradient(circle at 84% 14%, rgba(255,255,255,.12) 0 62px, transparent 63px),
    radial-gradient(circle at 72% 78%, rgba(255,255,255,.10) 0 90px, transparent 91px),
    radial-gradient(circle at 22% 86%, rgba(255,255,255,.13) 0 52px, transparent 53px);
  animation: float-bg 18s ease-in-out infinite alternate;
}

/* ---------- typography ---------- */

.indic {
  font-family: var(--font-indic);
  line-height: 1.35;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: .5px; }

.screen-title {
  color: #fff;
  font-size: clamp(24px, 5vw, 40px);
  text-align: center;
  text-shadow: 0 3px 0 rgba(45, 33, 80, .28);
  margin-bottom: 4px;
}

/* The home page already carries the logo and slogan, so its heading is a
   prompt rather than a banner — kept smaller so the tiles start higher up. */
.screen.home .screen-title {
  font-size: clamp(20px, 4.2vw, 30px);
  margin-bottom: 2px;
}

.screen-subtitle {
  color: rgba(255,255,255,.92);
  font-size: clamp(15px, 2.6vw, 21px);
  text-align: center;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ---------- buttons ---------- */

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  color: var(--c-ink);
}

button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}

.icon-btn {
  min-width: 52px;
  min-height: 52px;
  font-size: 26px;
  line-height: 1;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-1);
  display: grid;
  place-items: center;
  transition: transform .12s ease;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn.gear { font-size: 22px; opacity: .55; }

.big-btn {
  min-height: var(--tap);
  padding: 14px 30px;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 800;
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform .12s ease, box-shadow .12s ease;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(45,33,80,.18); }
.big-btn.primary { background: var(--c-good); color: #fff; }
.big-btn.ghost { background: rgba(255,255,255,.22); color: #fff; box-shadow: none; border: 3px solid rgba(255,255,255,.6); }

/* ---------- generic card ---------- */

.card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}

/* ---------- stars ---------- */

.stars { display: inline-flex; gap: 2px; font-size: 20px; line-height: 1; }
.stars .star { filter: grayscale(1) opacity(.45); }
.stars .star.on { filter: none; }

/* ---------- hard/soft, short/long disambiguator badge ---------- */

.flash-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: #efe9ff;
  color: var(--c-ink-soft);
  font-size: .5em;
  font-weight: 800;
  vertical-align: middle;
  letter-spacing: .5px;
}
.match-tile.done .flash-tag { background: rgba(255, 255, 255, .28); color: #fff; }

/* ---------- brand: the logo plate and slogan ---------- */

.brand-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 0 6px;
}

.brand-plate {
  position: relative;
  padding: 4px;
  border-radius: var(--r-lg);
  background: var(--c-cream);
  box-shadow: var(--shadow-2);
  line-height: 0;
}

.brand-logo {
  display: block;
  /* Deliberately modest. The logo is the welcome, not the page: at 360px it
     pushed the first subject tile past halfway down a phone screen, so a child
     had to scroll before seeing anything to tap. */
  width: min(230px, 56vw);
  /* The source image carries wide cream margins; cropping to a tighter
     aspect makes the jar and wordmark read larger without touching the file.
     1.5 is safe — the wordmark only spans the middle ~36% of the source. */
  aspect-ratio: 1.5;
  height: auto;
  object-fit: cover;
  border-radius: calc(var(--r-lg) - 6px);
}

/* fireflies drifting out of the jar */
.spark {
  position: absolute;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  animation: spark-drift 3.8s ease-in-out infinite;
}
.spark.s1 { top: 12%; left: 9%; }
.spark.s2 { top: 58%; right: 11%; animation-delay: 1.3s; }
.spark.s3 { bottom: 14%; left: 20%; animation-delay: 2.5s; }

.brand-slogan {
  margin: 0;
  max-width: 42ch;
  color: #fff;
  font-size: clamp(13px, 2.5vw, 18px);
  font-weight: 800;
  font-style: italic;
  text-align: center;
  letter-spacing: .3px;
  text-shadow: 0 2px 0 rgba(45, 33, 80, .32);
}

/* Only ever seen with JavaScript off, but it should still be readable rather
   than raw unstyled markup on a dark gradient. */
.noscript-note {
  max-width: 46rem;
  margin: 0 auto;
  padding: 24px 20px 40px;
  color: #fff;
  line-height: 1.55;
}
.noscript-note h1 { font-size: clamp(28px, 6vw, 44px); margin-bottom: 4px; }
.noscript-note h2 { font-size: clamp(19px, 3.4vw, 26px); margin: 22px 0 8px; }
.noscript-note ul { padding-left: 1.2em; }
.noscript-note li { margin-bottom: 10px; }
.noscript-note strong { color: #f5d544; }

/* ---------- age badge & filter chips ---------- */

.age-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  background: #efe9ff;
  color: #6b5bb5;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.age-badge.on-dark { background: rgba(255, 255, 255, .25); color: #fff; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 4px 0 10px;
}
.filter-chip {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .22);
  border: 3px solid rgba(255, 255, 255, .45);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  transition: transform .12s ease;
}
.filter-chip:active { transform: scale(.94); }
.filter-chip.on { background: #fff; color: var(--c-ink); border-color: #fff; box-shadow: var(--shadow-1); }

/* Out-of-age content is de-emphasised, never hidden. */
.dimmed { opacity: .42; filter: saturate(.55); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(560px, 92vw);
  padding: 14px 22px;
  border-radius: var(--r-pill);
  background: rgba(45, 33, 80, .93);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-2);
  z-index: 60;
}

/* ---------- misc ---------- */

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
