/* ======================================================
   SMART21BRAIN — CORE STYLESHEET
   Design system: tokens, typography, components
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700;800&display=swap');

/* Kill AOS's scroll-reveal fade/translate entirely. AOS's own CSS starts
   every [data-aos] element at opacity:0 with a transform offset until it
   scrolls into view and its JS adds .aos-animate. If a screenshot/PDF/
   capture tool (or a slow device, or a scroll-and-stitch "full page"
   capture) grabs the page mid-transition, content renders partially
   transparent and visually "ghosts" through whatever is behind it —
   exactly the double-exposed, overlapping look this was causing across
   the site. Forcing full opacity and no offset removes that risk
   completely; content is simply always visible, no reveal animation. */
[data-aos] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

:root {
  /* ---- Brand palette (from brief) ---- */
  --s21-primary: #0B6E4F;
  --s21-primary-dark: #084F39;
  --s21-primary-light: #E4F3EC;
  --s21-secondary: #FFD166;
  --s21-secondary-dark: #E8B334;
  --s21-secondary-tint: #FFF6E0;
  --s21-accent: #EF476F;
  --s21-accent-dark: #D22F58;
  --s21-accent-tint: #FDECF1;
  --s21-bg: #F1F7F3;
  --s21-text: #1E2A24;
  --s21-text-soft: #5B6470;
  --s21-white: #FFFFFF;
  --s21-border: #E7E9EC;

  /* ---- Subject accent colors (per learning strand) ---- */
  --subj-math: #3A86FF;
  --subj-science: #06A77D;
  --subj-language: #FF6B81;
  --subj-computer: #7B61FF;
  --subj-social: #FF9F1C;
  --subj-creative: #EF6C00;

  /* ---- Surfaces ---- */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --card-shadow: 0 6px 20px color-mix(in srgb, var(--s21-primary) 10%, transparent);
  --card-shadow-hover: 0 16px 36px color-mix(in srgb, var(--s21-primary) 18%, transparent);

  /* ---- Page background: a clearly visible soft blue → green wash
     instead of an almost-white gradient, so white cards read as a
     surface sitting on top of the page instead of melting into it. ---- */
  --s21-bg-image:
    radial-gradient(1200px 640px at 12% -8%, color-mix(in srgb, var(--subj-math) 16%, transparent), transparent 60%),
    radial-gradient(1000px 620px at 100% 0%, color-mix(in srgb, var(--s21-accent) 12%, transparent), transparent 55%),
    radial-gradient(1100px 700px at 50% 100%, color-mix(in srgb, var(--s21-primary) 14%, transparent), transparent 60%),
    linear-gradient(135deg, #E4F0FF 0%, #F3FBF6 45%, #E1F3E8 100%);

  /* ---- Type ---- */
  --font-display: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', sans-serif;

  /* ---- Radii / spacing ---- */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  /* ---- Transitions ---- */
  --ease: cubic-bezier(.22, 1, .36, 1);
}

[data-theme="dark"] {
  --s21-bg: #0F1712;
  --s21-text: #EDEFEC;
  --s21-text-soft: #9DA8A2;
  --s21-white: #17221C;
  --s21-border: #23302A;
  /* Tinted surfaces for dark mode, derived from the brand colors above
     instead of separately hand-picked dark values. */
  --s21-primary-light: color-mix(in srgb, var(--s21-primary) 22%, #0F1712 78%);
  --s21-secondary-tint: color-mix(in srgb, var(--s21-secondary) 20%, #0F1712 80%);
  --s21-accent-tint: color-mix(in srgb, var(--s21-accent) 20%, #0F1712 80%);
  --glass-bg: rgba(23, 34, 28, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.5);
  --s21-bg-image: none;
}

/* Bootstrap dropdowns + modals otherwise ignore dark mode entirely
   (Bootstrap ships its own white/black defaults) — fixed here so they
   read correctly in both light and dark mode. */
/* Bootstrap's .table sets its own hardcoded near-black text color via
   --bs-table-color, which it never inherits from the page — so table
   text (names, emails, dates in .dash-table/.yts-table) stayed dark and
   low-contrast even in dark mode. Point it at the theme's own text color
   instead, so it flips to white automatically like everything else. */
.table {
  --bs-table-color: var(--s21-text);
  --bs-table-bg: transparent;
  color: var(--s21-text);
}

.dropdown-menu {
  background: var(--s21-white);
  border: 1px solid var(--s21-border);
  color: var(--s21-text);
  box-shadow: var(--card-shadow-hover);
}
.dropdown-item {
  color: var(--s21-text);
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--s21-primary-light);
  color: var(--s21-primary);
}
.modal-content {
  background: var(--s21-white);
  color: var(--s21-text);
  border: 1px solid var(--s21-border);
}
.modal-header, .modal-footer { border-color: var(--s21-border); }
.btn-close { filter: var(--bs-btn-close-white-filter, none); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: var(--font-body);
  background-color: var(--s21-bg);
  background-image: var(--s21-bg-image);
  background-attachment: fixed;
  color: var(--s21-text);
  line-height: 1.6;
  transition: background .3s var(--ease), color .3s var(--ease);
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--s21-text);
}

a { color: var(--s21-primary); text-decoration: none; }
a:hover { color: var(--s21-accent); }

.text-soft { color: var(--s21-text-soft); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--s21-primary);
  background: var(--s21-primary-light);
  padding: .4rem .9rem;
  border-radius: var(--radius-pill);
}

.section {
  padding: 5rem 0;
}
.section-tight { padding: 3rem 0; }

.section-head {
  max-width: 640px;
  margin-bottom: 2.5rem;
}

/* ---- Buttons ---- */
.btn-s21 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .95rem;
  padding: .8rem 1.6rem;
  border-radius: var(--radius-pill);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.btn-s21:active { transform: translateY(1px); }

.btn-s21-primary {
  background: var(--s21-primary);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--s21-primary) 28%, transparent);
}
.btn-s21-primary:hover {
  background: var(--s21-primary-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--s21-primary) 34%, transparent);
}

.btn-s21-secondary {
  background: var(--s21-secondary);
  color: #3D2B00;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--s21-secondary) 35%, transparent);
}
.btn-s21-secondary:hover {
  background: var(--s21-secondary-dark);
  color: #3D2B00;
  transform: translateY(-2px);
}

.btn-s21-outline {
  background: transparent;
  color: var(--s21-text);
  border: 2px solid var(--s21-border);
}
.btn-s21-outline:hover {
  border-color: var(--s21-primary);
  color: var(--s21-primary);
  transform: translateY(-2px);
}

.btn-s21-ghost-white {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.5);
  backdrop-filter: blur(6px);
}
.btn-s21-ghost-white:hover { background: rgba(255,255,255,.28); color: #fff; }

/* ---- Guest CTA (login page) — big, warm, attention-grabbing ---- */
.btn-s21-guest-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.15rem 1.4rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  color: #3D2B00;
  background: linear-gradient(120deg, var(--s21-secondary) 0%, #FFB703 45%, var(--s21-accent) 100%);
  background-size: 220% 220%;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--s21-secondary) 45%, transparent);
  animation: s21GuestGlow 4.5s ease-in-out infinite;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-position .6s ease;
}
.btn-s21-guest-cta:hover, .btn-s21-guest-cta:focus-visible {
  transform: translateY(-3px) scale(1.012);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--s21-accent) 45%, transparent);
  background-position: 100% 50%;
  color: #3D2B00;
}
.btn-s21-guest-cta:active { transform: translateY(0) scale(1); }
.btn-s21-guest-cta .guest-cta-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.btn-s21-guest-cta .guest-cta-text {
  display: flex; flex-direction: column; text-align: left; flex-grow: 1; min-width: 0;
}
.btn-s21-guest-cta .guest-cta-text strong { font-size: 1.05rem; font-weight: 800; line-height: 1.25; }
.btn-s21-guest-cta .guest-cta-text small { font-size: .78rem; font-weight: 700; opacity: .82; }
.btn-s21-guest-cta .guest-cta-arrow { font-size: 1rem; transition: transform .25s var(--ease); flex-shrink: 0; }
.btn-s21-guest-cta:hover .guest-cta-arrow { transform: translateX(5px); }
@keyframes s21GuestGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-s21-guest-cta { animation: none; }
}

/* ---- Navbar ----
   Fixed (not sticky) so it always stays put at the very top of the
   viewport and never scrolls away or hides — main.js measures its
   height and pushes the page content down by that amount via the
   --s21-navbar-h variable below. */
.s21-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  padding: .7rem 0;
}

/* Fallback spacing (used before JS measures the real height, and if JS
   is disabled) — kept close to the navbar's natural height. */
body {
  padding-top: var(--s21-navbar-h, 78px);
}

.s21-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--s21-text);
}
.s21-logo .mark {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--s21-primary), var(--s21-primary-dark));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(11,110,79,.35);
  flex-shrink: 0;
}
.s21-logo .mark {
  background: url('../images/logo/coool.png') center / cover no-repeat;
  overflow: hidden;
}
.s21-logo .mark svg { display: none; }
.s21-logo .brand-21 { color: var(--s21-secondary); }

.s21-nav-link {
  font-weight: 600;
  font-size: .95rem;
  color: var(--s21-text);
  padding: .55rem 1rem !important;
  border-radius: var(--radius-pill);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.s21-nav-link:hover, .s21-nav-link.active {
  background: var(--s21-secondary);
  color: #3D2B00;
}

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--s21-border);
  background: var(--s21-white);
  color: var(--s21-text);
  transition: all .2s var(--ease);
}
.icon-btn:hover { border-color: var(--s21-primary); color: var(--s21-primary); transform: translateY(-2px); }

/* ---- Nav account icon (replaces Log In / Get Started once signed in) ---- */
.nav-account-link {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--s21-secondary);
  overflow: hidden;
  transition: all .2s var(--ease);
}
.nav-account-link:hover { border-color: var(--s21-primary); transform: translateY(-2px); }
.nav-account-photo { width: 100%; height: 100%; object-fit: cover; }
.nav-account-initials {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--s21-primary-light); color: var(--s21-primary);
  font-weight: 800; font-size: .85rem;
}
.nav-account-link-wide {
  border-radius: var(--radius-pill);
  justify-content: flex-start; gap: .6rem;
  padding: .3rem .9rem .3rem .3rem;
  height: auto; width: auto;
  border: 1px solid var(--s21-border);
  background: var(--s21-white);
  color: var(--s21-text);
  font-weight: 700; font-size: .85rem;
}
.nav-account-link-wide .nav-account-photo,
.nav-account-link-wide .nav-account-initials { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.nav-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 7rem 0 4.5rem;
  min-height: 640px;
  display: flex;
  align-items: center;
  background-color: var(--s21-primary-dark);
  background-size: cover;
  background-position: center;
  color: #fff;
  isolation: isolate;
}
/* Photo hero: dark brand-tinted gradient so white text stays readable over any image */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(6,20,15,.94) 8%, rgba(8,45,33,.86) 42%, rgba(11,110,79,.5) 75%, rgba(8,45,33,.4) 100%);
  z-index: -2;
}
/* Fine dot texture on top of the overlay for depth */
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.12) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: .5;
  z-index: -1;
  pointer-events: none;
}
/* Hero without a photo (interior pages) falls back to the brand gradient */
.hero.hero-plain {
  min-height: 0;
  background-image: none !important;
}
.hero.hero-plain::before {
  background: radial-gradient(120% 100% at 15% 0%, #0E8060 0%, var(--s21-primary) 45%, var(--s21-primary-dark) 100%);
}
/* Game detail pages: same plain-hero green wash, now with a background video instead of a photo */
.hero.hero-plain.hero-game-bg {
  background-image: none !important;
}
.hero-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
  pointer-events: none;
}
/* Per-game themed hero photos. The green wash above (.hero.hero-plain::before)
   still sits on top of every one of these, so the "shadow" stays green. */
.hero.hero-plain.hero-game-bg-humanbody {
  background-image: url('https://images.unsplash.com/photo-1716996236828-18583f5abe5d?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-animals {
  background-image: url('https://images.unsplash.com/photo-1523805009345-7448845a9e53?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-brain {
  background-image: url('https://images.unsplash.com/photo-1730804518415-75297e8d2a41?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-maze {
  background-image: url('https://images.unsplash.com/photo-1534517284575-ce1520e615e3?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-math {
  background-image: url('https://images.unsplash.com/photo-1634128221889-82ed6efebfc3?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-shapes {
  background-image: url('https://images.unsplash.com/photo-1710244182004-1c708b3f146d?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-solar {
  background-image: url('https://images.unsplash.com/photo-1711560217836-f42ac4a11a4f?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-plant {
  background-image: url('https://images.unsplash.com/photo-1466692476868-aef1dfb1e735?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-books {
  background-image: url('https://images.unsplash.com/photo-1550399105-c4db5fb85c18?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}
.hero.hero-plain.hero-game-bg-cartoons {
  background-image: url('https://images.unsplash.com/photo-1698340350386-e90b8673030f?w=1800&q=75&auto=format&fit=crop') !important;
  background-size: cover;
  background-position: center;
}

.hero-badge {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  backdrop-filter: blur(6px);
  font-family: var(--font-body);
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .5rem 1rem;
}
.hero h1 {
  color: #fff;
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  line-height: 1.1;
}
.hero h1 em {
  font-style: italic;
  font-weight: 700;
  color: var(--s21-secondary);
}
.hero .lead {
  color: rgba(255,255,255,.88);
  font-size: 1.15rem;
  max-width: 540px;
}
.hero .lead-sub {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  max-width: 560px;
}

/* Divider link under the CTA row, e.g. "View all subjects" */
.hero-divider-link {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(255,255,255,.25);
  width: 100%;
  max-width: 300px;
}
.hero-divider-link a {
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: var(--radius-pill);
  padding: .6rem 1.3rem;
  transition: all .2s var(--ease);
}
.hero-divider-link a:hover { background: rgba(255,255,255,.14); color: #fff; border-color: #fff; }
.hero-search {
  background: #fff;
  border-radius: var(--radius-pill);
  padding: .5rem .5rem .5rem 1.4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-shadow: 0 20px 44px rgba(0,0,0,.22);
  max-width: 560px;
}
.hero-search input {
  border: none; outline: none; flex: 1; min-width: 0;
  font-family: var(--font-body); font-size: .98rem;
  padding: .6rem 0;
  background: transparent;
  color: #000 !important;                 /* typed words are always black (bar is always white) */
  -webkit-text-fill-color: #000;
  caret-color: #000;
}
.hero-search input::placeholder { color: #6B7280; opacity: 1; -webkit-text-fill-color: #6B7280; }
.hero-search > button {
  background: var(--s21-accent);
  color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Learning-path signature element in hero */
.hero-path { position: relative; }
.path-node {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  color: #fff; font-weight: 700; font-size: .78rem; text-align: center;
  width: 92px;
}
.path-node .dot {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  border: 3px solid rgba(255,255,255,.55);
}
.hero-visual-card {
  background: var(--glass-bg);
  border: 1px solid rgba(255,255,255,.4);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  color: var(--s21-text);
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}

.stat-strip {
  display: flex; flex-wrap: wrap; gap: 2.2rem;
  margin-top: 2.6rem;
}
.stat-strip .num {
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 700; color: #fff;
}
.stat-strip .label { color: rgba(255,255,255,.75); font-size: .82rem; }

/* ---- Cards ---- */
.s21-card {
  background: var(--s21-white);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--s21-primary) 10%, var(--s21-border));
  box-shadow: var(--card-shadow);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  overflow: hidden;
  height: 100%;
}
/* Use on any .s21-card placed inside a Bootstrap .row alongside a taller
   sibling column (e.g. a sticky sidebar next to long article content).
   .s21-card's own `height: 100%` combined with the row's default flex
   stretch makes the card match the TALLEST column in the row — if that
   card is also `position: sticky`, it becomes a giant sticky box that
   overlaps content/footer far below it as the page scrolls. This class
   opts a card out of that stretch so it only sticks to its own content. */
.sticky-card {
  height: auto;
  align-self: flex-start;
}
.s21-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--card-shadow-hover);
}

/* ---- Popular Subjects section background ---- */
.section-subjects-bg {
  position: relative;
  isolation: isolate;
  background-image: url('https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=1920&q=70&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
}
.section-subjects-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(90, 10, 20, .68); /* wine-red overlay, kept translucent so the photo still shows through */
}
.section-subjects-bg > .container {
  position: relative;
  z-index: 1;
}
.section-subjects-bg .eyebrow {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(4px);
}
.section-subjects-bg .section-head h2 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.section-subjects-bg .btn-s21-outline {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(6px);
}
.section-subjects-bg .btn-s21-outline:hover {
  background: rgba(255, 255, 255, .28);
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
}

/* ---- Educational Games section background ---- */
.section-games-bg {
  position: relative;
  isolation: isolate;
  background-image: url('https://images.unsplash.com/photo-1550439062-609e1531270e?w=1920&q=70&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
}
.section-games-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(219, 39, 119, .62); /* pink overlay, kept translucent so the photo still shows through */
}
.section-games-bg > .container {
  position: relative;
  z-index: 1;
}
.section-games-bg .eyebrow {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(4px);
}
.section-games-bg .section-head h2 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.section-games-bg .btn-s21-outline {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(6px);
}
.section-games-bg .btn-s21-outline:hover {
  background: rgba(255, 255, 255, .28);
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
}

/* ---- Learn page (subjects.html) — per-subject section background photos ---- */
.subj-section-bg {
  position: relative;
  isolation: isolate;
  background-size: cover;
  background-position: center;
}
.subj-section-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}
.subj-section-bg > .container {
  position: relative;
  z-index: 1;
}
.subj-section-bg .eyebrow {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(4px);
}
.subj-section-bg h2 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.subj-section-bg p.text-soft {
  color: rgba(255, 255, 255, .85);
}
.subj-section-bg .btn-s21-outline {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(6px);
}
.subj-section-bg .btn-s21-outline:hover {
  background: rgba(255, 255, 255, .28);
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
}
.subj-section-bg .subject-icon {
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.subj-math-bg { background-image: url('https://images.unsplash.com/photo-1635070041078-e363dbe005cb?w=1920&q=70&auto=format&fit=crop'); }
.subj-math-bg::before { background: rgba(15, 35, 80, .78); } /* navy overlay, tinted toward --subj-math */

.subj-science-bg { background-image: url('https://images.unsplash.com/photo-1559757148-5c350d0d3c56?w=1920&q=70&auto=format&fit=crop'); }
.subj-science-bg::before { background: rgba(4, 55, 44, .78); } /* deep teal overlay, tinted toward --subj-science */

.subj-language-bg { background-image: url('https://images.unsplash.com/photo-1455390582262-044cdead277a?w=1920&q=70&auto=format&fit=crop'); }
.subj-language-bg::before { background: rgba(110, 18, 34, .75); } /* deep rose overlay, tinted toward --subj-language */

.subj-computer-bg { background-image: url('https://images.unsplash.com/photo-1517245386807-bb43f82c33c4?w=1920&q=70&auto=format&fit=crop'); }
.subj-computer-bg::before { background: rgba(32, 18, 90, .78); } /* deep violet overlay, tinted toward --subj-computer */

.subj-social-bg { background-image: url('https://images.unsplash.com/photo-1524661135-423995f22d0b?w=1920&q=70&auto=format&fit=crop'); }
.subj-social-bg::before { background: rgba(92, 52, 8, .78); } /* deep amber overlay, tinted toward --subj-social */

.subj-creative-bg { background-image: url('https://images.unsplash.com/photo-1513364776144-60967b0f800f?w=1920&q=70&auto=format&fit=crop'); }
.subj-creative-bg::before { background: rgba(102, 40, 4, .78); } /* deep burnt-orange overlay, tinted toward --subj-creative */

.subj-memory-bg { background-image: url('https://images.unsplash.com/photo-1550439062-609e1531270e?w=1920&q=70&auto=format&fit=crop'); }
.subj-memory-bg::before { background: rgba(28, 18, 64, .8); } /* deep indigo overlay for Memory & Logic games */

.subj-geo-bg { background-image: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=1920&q=70&auto=format&fit=crop'); }
.subj-geo-bg::before { background: rgba(10, 66, 62, .8); } /* deep teal-green overlay for Geography games */

/* ---- Testimonials ("Loved by families") section background ---- */
.section-testimonials-bg {
  position: relative;
  isolation: isolate;
  background-color: var(--s21-primary-light);
  background-image: url('https://images.unsplash.com/photo-1476703993599-0035a21b17a9?w=1920&q=70&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
}
.section-testimonials-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  /* red overlay, kept translucent so the photo still shows through */
  background: rgba(200, 30, 30, .62);
}
.section-testimonials-bg > .container {
  position: relative;
  z-index: 1;
}
.section-testimonials-bg .eyebrow {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(4px);
}
.section-testimonials-bg .section-head h2 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .45);
}

.subject-card {
  padding: 1.6rem;
  display: flex; flex-direction: column; gap: .9rem;
  border-left: 5px solid var(--tint, var(--s21-primary));
}
.subject-card .subject-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: color-mix(in srgb, var(--tint, var(--s21-primary)) 14%, white);
  color: var(--tint, var(--s21-primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

.media-card { position: relative; }
.media-card .thumb-wrap { position: relative; aspect-ratio: 16/9; overflow: hidden; background: var(--s21-primary-light); }
.media-card .thumb-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s var(--ease);
}
.media-card:hover .thumb-wrap img { transform: scale(1.08); }
.media-card .play-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.media-card .play-btn span {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--s21-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  transform: scale(.85);
  transition: transform .3s var(--ease);
}
.media-card:hover .play-btn span { transform: scale(1); }
.media-card .duration-badge {
  position: absolute; bottom: .6rem; right: .6rem;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: .18rem .5rem; border-radius: 6px;
}
.media-card .cat-badge {
  position: absolute; top: .6rem; left: .6rem;
  background: var(--s21-secondary); color: #3D2B00;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .25rem .6rem; border-radius: var(--radius-pill);
}
.media-card .body { padding: 1rem 1.1rem 1.2rem; }
.media-card .body h3 { font-size: 1rem; margin-bottom: .35rem; }
.media-card .meta { font-size: .82rem; color: var(--s21-text-soft); display: flex; align-items: center; gap: .5rem; }

.book-card .cover-wrap { aspect-ratio: 3/4; overflow: hidden; background: var(--s21-primary-light); position: relative; }
.book-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.book-card:hover .cover-wrap img { transform: scale(1.06) rotate(-.5deg); }

.game-card { text-align: center; padding: 1.6rem 1.2rem; position: relative; }
.game-emoji {
  width: 68px; height: 68px; margin: 0 auto .9rem;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--s21-secondary), #FFB703);
  box-shadow: 0 10px 22px rgba(255,183,3,.35);
}

.badge-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .75rem; font-weight: 700;
  padding: .3rem .7rem; border-radius: var(--radius-pill);
  /* Brand pink (--s21-accent #EF476F) with white text; works in light and dark mode. */
  background: linear-gradient(180deg, var(--s21-accent), var(--s21-accent-dark)); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 2px 6px rgba(239,71,111,.30);
}
.badge-pill.pink, .badge-pill.gold { background: linear-gradient(180deg, var(--s21-accent), var(--s21-accent-dark)); color: #fff; }

/* Breadcrumb links: yellow (brand yellow on dark, a deeper gold on light so it stays readable). */
.breadcrumb-item a { color: #A66A00; font-weight: 600; text-decoration: none; }
.breadcrumb-item a:hover, .breadcrumb-item a:focus-visible { color: var(--s21-accent); text-decoration: underline; }
[data-theme="dark"] .breadcrumb-item a { color: var(--s21-secondary); }
[data-theme="dark"] .breadcrumb-item a:hover, [data-theme="dark"] .breadcrumb-item a:focus-visible { color: #fff; }
.breadcrumb-item.active { color: var(--s21-text-soft); }

.progress-s21 {
  height: 8px; border-radius: var(--radius-pill);
  background: var(--s21-border); overflow: hidden;
}
.progress-s21 span {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--s21-primary), #16A76B);
}

/* ---- Testimonials ---- */
.testimonial-card {
  padding: 1.8rem;
  position: relative;
}
.testimonial-card .quote-mark {
  font-family: var(--font-display);
  font-size: 3rem; color: var(--s21-secondary);
  line-height: 1; margin-bottom: -.6rem;
}
.avatar-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid var(--s21-secondary); padding: 2px;
}
.avatar-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ---- Newsletter / CTA ---- */
.cta-band {
  background: linear-gradient(120deg, var(--s21-accent), #FF6B8B);
  border-radius: var(--radius-lg);
  padding: 3rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* ---- Footer ---- */
.s21-footer {
  background: #0C1712;
  color: #C8D2CC;
  padding: 4rem 0 1.5rem;
}
.s21-footer h6 {
  color: #fff; font-family: var(--font-body); font-weight: 700;
  font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 1.1rem;
}
.s21-footer a { color: #A9B7AF; }
.s21-footer a:hover { color: var(--s21-secondary); }
.s21-footer .social-circle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid #2A3A32;
  display: flex; align-items: center; justify-content: center;
  color: #C8D2CC;
}
.s21-footer .social-circle:hover { background: var(--s21-primary); border-color: var(--s21-primary); color: #fff; }
.footer-bottom { border-top: 1px solid #1C2921; padding-top: 1.5rem; font-size: .85rem; color: #7E8C84; }

/* ---- Floating actions ---- */
.floating-stack {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 1200;
  display: flex; flex-direction: column; gap: .7rem; align-items: flex-end;
}
.fab {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.25rem; border: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  transition: transform .25s var(--ease);
}
.fab:hover { transform: scale(1.08); }
.fab.whatsapp { background: #25D366; }
.fab.facebook { background: #1877F2; }
.fab.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.fab.tiktok { background: #010101; }
.fab.ai { background: linear-gradient(135deg, var(--s21-accent), #FF7A9C); }
.fab.top {
  background: #2ECC71; width: 44px; height: 44px; font-size: 1rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(8px);
  transition: opacity .25s var(--ease), visibility .25s var(--ease), transform .25s var(--ease);
}
.fab.top.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }

/* ---- Guest game access prompt ---- */
.game-access-modal {
  position: fixed; inset: 0; z-index: 2000; display: none;
  align-items: center; justify-content: center; padding: 1.25rem;
  background: rgba(18, 32, 25, .58);
}
.game-access-modal.is-open { display: flex; }
.game-access-dialog {
  position: relative; width: min(100%, 430px); padding: 2rem;
  background: var(--s21-white); border: 1px solid var(--s21-border);
  border-radius: var(--radius-md); box-shadow: 0 24px 70px rgba(0,0,0,.24);
  text-align: center;
}
.game-access-close {
  position: absolute; top: .65rem; right: .8rem; border: 0; background: none;
  color: var(--s21-text-soft); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.game-access-icon {
  width: 54px; height: 54px; margin: 0 auto 1rem; display: flex;
  align-items: center; justify-content: center; border-radius: 50%;
  background: var(--s21-primary-light); color: var(--s21-primary); font-size: 1.35rem;
}
.game-access-dialog h2 { margin-bottom: .5rem; font-size: 1.5rem; }
.game-access-dialog p { margin-bottom: 1.5rem; color: var(--s21-text-soft); }
.game-access-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

.fab-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid var(--s21-secondary);
  padding: 0; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  transition: transform .25s var(--ease);
  position: relative;
}
.fab-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fab-avatar:hover { transform: scale(1.08); }

/* ---- Search dropdown ---- */
.s21-search-wrap { position: relative; }
.s21-search-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + .7rem);
  background: #fff; color: #111;
  border-radius: var(--radius-md);
  border: 1px solid #E7E9EC;
  box-shadow: 0 20px 48px rgba(0,0,0,.18);
  padding: 1rem;
  display: none;
  z-index: 50;
  text-align: left;
  max-height: 420px;
  overflow-y: auto;
}
.s21-search-panel.open { display: block; }
.s21-search-group { margin-bottom: .8rem; }
.s21-search-group span {
  display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #5B6470; margin-bottom: .4rem;
}
.s21-search-item {
  display: flex; align-items: center; gap: .55rem;
  width: 100%; text-align: left; background: none; border: none;
  padding: .5rem .6rem; border-radius: 10px; font-size: .9rem; color: #111; text-decoration: none;
}
.s21-search-item i { color: #0B6E4F; width: 1.1rem; text-align: center; flex-shrink: 0; }
.s21-search-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s21-search-item:hover, .s21-search-item:focus-visible { background: #E4F3EC; color: #084F39; }
.s21-search-all {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: .3rem; padding: .65rem .8rem; border-radius: 10px; font-weight: 700; font-size: .88rem;
  background: #0B6E4F; color: #fff !important; text-decoration: none;
}
.s21-search-all:hover { background: #084F39; }
.s21-search-item em { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 600; color: #5B6470; background: #F1F3F5; padding: .1rem .5rem; border-radius: 999px; flex-shrink: 0; }
/* Popular-now chips: tidy wrapping pills instead of a stacked list */
.s21-chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.s21-search-chip {
  width: auto; display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: #E4F3EC; color: #0B6E4F;
  border: 1px solid transparent; white-space: nowrap; cursor: pointer;
}
.s21-search-chip:hover { border-color: var(--s21-primary); }
.s21-search-chip i { font-size: .7rem; opacity: .75; }
.s21-search-empty { font-size: .85rem; color: #5B6470; padding: .4rem .6rem; }

/* ---- Favorite / heart buttons ---- */
.fav-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.92); color: var(--s21-text-soft);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
}
.fav-btn.is-fav { color: var(--s21-accent); }
.fav-btn.is-fav i { font-weight: 900; }

@keyframes s21-heart-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  60% { transform: scale(.9); }
  100% { transform: scale(1); }
}
.fav-btn.is-popping i,
[data-fav-id].is-popping i { animation: s21-heart-pop .45s var(--ease); }

/* ---- Toast notifications ---- */
.s21-toast-stack {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  z-index: 2400;
  display: flex;
  flex-direction: column-reverse;
  gap: .6rem;
  width: min(92vw, 380px);
  pointer-events: none;
}
.s21-toast {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: var(--s21-white);
  color: var(--s21-text);
  border: 1px solid var(--s21-border);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 32px rgba(0,0,0,.28);
  padding: .75rem 1rem;
  font-size: .88rem;
  font-weight: 600;
  pointer-events: auto;
  animation: s21-toast-in .35s var(--ease) both;
}
.s21-toast.is-leaving { animation: s21-toast-out .3s var(--ease) both; }
.s21-toast .s21-toast-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  background: var(--s21-primary-light); color: var(--s21-primary);
}
.s21-toast.is-success .s21-toast-icon { background: var(--s21-primary-light); color: var(--s21-primary); }
.s21-toast.is-error .s21-toast-icon { background: var(--s21-accent-tint); color: var(--s21-accent); }
.s21-toast.is-info .s21-toast-icon { background: var(--s21-secondary-tint); color: #A66A00; }

@keyframes s21-toast-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes s21-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(.96); }
}

@media (max-width: 575.98px) {
  .s21-toast-stack { bottom: 5.5rem; } /* clear the floating action buttons on mobile */
}

/* ---- A touch more tactile feedback on interactive chrome ---- */
.icon-btn:active,
.fav-btn:active,
[data-fav-id]:active { transform: scale(.9); }
.badge-pill { transition: transform .18s var(--ease); }
a.badge-pill:hover, button.badge-pill:hover { transform: translateY(-1px); }

/* ---- Inline button spinner (form submit / async actions) ---- */
.btn-s21.is-loading { pointer-events: none; opacity: .85; }
.btn-s21 .btn-spinner { display: inline-block; }

/* ---- AI Assistant panel ---- */
#s21-ai-panel {
  position: fixed; right: 1.4rem; bottom: 6rem; z-index: 1300;
  width: min(360px, 90vw); max-height: 480px;
  background: var(--s21-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  border: 1px solid var(--s21-border);
  display: flex; flex-direction: column;
  transform: translateY(16px) scale(.97); opacity: 0; pointer-events: none;
  transition: all .25s var(--ease);
  overflow: hidden;
}
#s21-ai-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
#s21-ai-panel .ai-head {
  background: var(--s21-primary); color: #fff; padding: 1rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.ai-head-logo {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover; margin-right: .4rem; flex-shrink: 0;
  vertical-align: middle; border: 1.5px solid rgba(255,255,255,.6);
}
#s21-ai-panel .ai-log { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.ai-bubble { padding: .6rem .9rem; border-radius: 14px; font-size: .88rem; max-width: 85%; }
.ai-bubble-user { align-self: flex-end; background: var(--s21-primary-light); color: var(--s21-primary-dark); }
.ai-bubble-ai { align-self: flex-start; background: var(--s21-accent-tint); color: #fff; }
#s21-ai-panel form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--s21-border); }
#s21-ai-panel form input { flex: 1; border: 1px solid var(--s21-border); border-radius: var(--radius-pill); padding: .55rem 1rem; font-size: .88rem; }
#s21-ai-panel form button { border: none; background: var(--s21-accent); color: #fff; width: 40px; border-radius: 50%; }
.ai-disclaimer { font-size: .72rem; color: #fff; padding: 0 1.2rem .7rem; }

/* ---- AI assistant: ChatGPT-style replies (Markdown, code, streaming) ---- */
#s21-ai-panel { width: min(420px, 92vw); max-height: min(640px, 82dvh); }
#s21-ai-panel.ai-expanded { width: min(900px, 96vw) !important; height: 88dvh; max-height: 88dvh !important; right: 50% !important; bottom: 1rem !important; transform: translate(50%, 0) scale(1); }
#s21-ai-panel.ai-expanded:not(.open) { transform: translate(50%, 16px) scale(.97); }
#s21-ai-panel .ai-head-tools { margin-left: auto; margin-right: .5rem; display: inline-flex; gap: .15rem; }
#s21-ai-panel .ai-head-tools button, #s21-ai-panel .ai-head-btn { background: none; border: 0; color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; opacity: .9; }
#s21-ai-panel .ai-head-tools button:hover, #s21-ai-panel .ai-head-btn:hover { background: rgba(255,255,255,.18); opacity: 1; }
#s21-ai-panel .ai-log { gap: .9rem; scroll-behavior: smooth; }
#s21-ai-panel .ai-bubble { overflow-wrap: anywhere; line-height: 1.55; }
/* user = soft bubble on the right; AI = clean full-width text (no coloured box) */
#s21-ai-panel .ai-bubble-user { max-width: 85%; background: var(--s21-primary-light); color: var(--s21-text); border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
#s21-ai-panel .ai-bubble-ai { align-self: stretch; max-width: 100%; background: transparent; color: var(--s21-text); padding: .15rem .1rem; border-radius: 0; }
#s21-ai-panel .ai-disclaimer { color: var(--s21-text-soft); text-align: center; }
#s21-ai-panel form { align-items: flex-end; }
#s21-ai-panel form textarea { flex: 1; border: 1px solid var(--s21-border); background: var(--s21-white); color: var(--s21-text); border-radius: 20px; padding: .6rem 1rem; font-size: .9rem; resize: none; max-height: 140px; line-height: 1.4; font-family: inherit; outline: none; }
#s21-ai-panel form textarea:focus { border-color: var(--s21-primary); }
#s21-ai-panel form button[type=submit].is-stop { background: var(--s21-text); }
.ai-md > :first-child { margin-top: 0; } .ai-md > :last-child { margin-bottom: 0; }
.ai-md p { margin: 0 0 .65rem; }
.ai-md h3, .ai-md h4, .ai-md h5, .ai-md h6 { font-weight: 800; margin: 1rem 0 .4rem; line-height: 1.25; color: var(--s21-text); }
.ai-md h3 { font-size: 1.08rem; } .ai-md h4 { font-size: 1rem; } .ai-md h5, .ai-md h6 { font-size: .92rem; }
.ai-md ul, .ai-md ol { margin: 0 0 .65rem; padding-left: 1.3rem; } .ai-md li { margin: .15rem 0; } .ai-md li > ul, .ai-md li > ol { margin: .2rem 0 .2rem; }
.ai-md strong { font-weight: 800; }
.ai-md a { color: var(--s21-primary); text-decoration: underline; text-underline-offset: 2px; }
.ai-md hr { border: 0; border-top: 1px solid var(--s21-border); margin: .9rem 0; }
.ai-md blockquote { margin: 0 0 .65rem; padding: .35rem .8rem; border-left: 3px solid var(--s21-primary); background: var(--s21-primary-light); border-radius: 0 8px 8px 0; color: var(--s21-text); }
.ai-md :not(pre) > code { background: var(--s21-primary-light); color: var(--s21-primary-dark); padding: .08rem .38rem; border-radius: 6px; font-size: .84em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
[data-theme="dark"] .ai-md :not(pre) > code { color: #bff0d9; }
.ai-table { overflow-x: auto; margin: 0 0 .75rem; border: 1px solid var(--s21-border); border-radius: 10px; }
.ai-table table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.ai-table th, .ai-table td { padding: .45rem .7rem; border-bottom: 1px solid var(--s21-border); text-align: left; vertical-align: top; }
.ai-table th { background: var(--s21-primary-light); font-weight: 800; white-space: nowrap; }
.ai-table tr:last-child td { border-bottom: 0; }
.ai-code { margin: .6rem 0 .8rem; border-radius: 12px; overflow: hidden; background: #0d1512; border: 1px solid rgba(255,255,255,.12); }
.ai-code-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .7rem; background: #16231d; font-size: .72rem; color: #a9c7b9; text-transform: lowercase; }
.ai-code-actions { display: inline-flex; gap: .35rem; }
.ai-code-actions button { background: transparent; color: #cfe8dc; border: 0; border-radius: 6px; padding: .18rem .5rem; font-size: .72rem; cursor: pointer; }
.ai-code-actions button:hover { background: rgba(255,255,255,.14); color: #fff; }
.ai-code pre { margin: 0; padding: .75rem .9rem; overflow-x: auto; max-height: 360px; background: transparent; border: 0; }
.ai-code pre code { background: none; padding: 0; color: #e6f3ec; font-size: .8rem; line-height: 1.55; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hl-k { color: #ff8fb1; } .hl-s { color: #a5e075; } .hl-c { color: #7f9a8c; font-style: italic; } .hl-n { color: #ffcb6b; }
.hl-f { color: #82cfff; } .hl-t { color: #ff8fb1; } .hl-y { color: #c8a6ff; }
.ai-cursor { display: inline-block; width: .55em; height: 1.05em; margin-left: 2px; vertical-align: text-bottom; background: var(--s21-primary); border-radius: 2px; animation: ai-blink 1s steps(2, start) infinite; }
@keyframes ai-blink { to { visibility: hidden; } }
.ai-typing { display: inline-flex; gap: 4px; padding: .35rem 0; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--s21-text-soft); animation: ai-bounce 1.1s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.ai-actions { display: flex; gap: .2rem; margin-top: .45rem; }
.ai-actions button { background: transparent; border: 0; color: var(--s21-text-soft); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: .8rem; }
.ai-actions button:hover { background: var(--s21-primary-light); color: var(--s21-primary); }
.ai-starters { display: flex; flex-direction: column; gap: .4rem; }
.ai-starters button { text-align: left; border: 1px solid var(--s21-border); background: var(--s21-white); color: var(--s21-text); border-radius: 12px; padding: .55rem .8rem; font-size: .84rem; cursor: pointer; transition: border-color .15s, background .15s; }
.ai-starters button:hover { border-color: var(--s21-primary); background: var(--s21-primary-light); }
.ai-chips { display: flex; gap: .4rem; overflow-x: auto; padding: .5rem .8rem 0; border-top: 1px solid var(--s21-border); scrollbar-width: thin; }
.ai-chips button { flex: 0 0 auto; border: 1px solid var(--s21-border); background: var(--s21-white); color: var(--s21-text); border-radius: 999px; padding: .25rem .7rem; font-size: .75rem; font-weight: 700; cursor: pointer; }
.ai-chips button:hover { border-color: var(--s21-primary); color: var(--s21-primary); }
.ai-chips + form { border-top: 0; }
@media (prefers-reduced-motion: reduce) { .ai-cursor, .ai-typing i { animation: none; } #s21-ai-panel .ai-log { scroll-behavior: auto; } }

/* ---- Game screen (Addition Race, etc.) ---- */
.game-panel {
  background: linear-gradient(160deg, var(--s21-primary) 0%, var(--s21-primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 2.4rem;
  color: #fff;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.game-panel::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.1) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  z-index: 0;
}
.game-panel > * { position: relative; z-index: 1; }

.game-hud {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin-bottom: 1.6rem; flex-wrap: wrap; gap: .8rem;
}
.game-hud .hud-chip {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-pill);
  padding: .4rem 1rem;
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; gap: .4rem;
}

.game-problem-display {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.6rem;
}

.game-answer-input {
  width: 160px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: .6rem;
  color: var(--s21-text);
}

.game-emoji-lg { font-size: 4.5rem; line-height: 1; margin-bottom: 1rem; }

/* ---- Book reader ---- */
.reader-shell {
  background: var(--s21-white);
  border: 1px solid var(--s21-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.reader-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem;
  padding: .8rem 1.1rem;
  background: var(--s21-primary-light);
  border-bottom: 1px solid var(--s21-border);
}
.reader-toolbar .grp { display: flex; align-items: center; gap: .3rem; }
.reader-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--s21-border);
  background: var(--s21-white);
  color: var(--s21-text);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: all .2s var(--ease);
}
.reader-btn:hover:not(:disabled) { border-color: var(--s21-primary); color: var(--s21-primary); }
.reader-btn:disabled { opacity: .4; cursor: not-allowed; }
.reader-btn.is-active { background: var(--s21-primary); color: #fff; border-color: var(--s21-primary); }
.reader-page-indicator { font-size: .85rem; font-weight: 700; color: var(--s21-text-soft); min-width: 90px; text-align: center; }

.reader-page-area {
  min-height: 420px;
  max-height: 560px;
  overflow-y: auto;
  padding: 3rem 3.5rem;
  background: #FFFDF7;
  transition: font-size .2s var(--ease), transform .2s var(--ease);
}
[data-theme="dark"] .reader-page-area { background: #10241C; }
.reader-page-area h2 {
  font-size: 1.4em;
  margin-bottom: .8rem;
}
.reader-page-area p {
  line-height: 1.9;
  margin-bottom: 1rem;
}
.reader-page-area mark {
  background: var(--s21-secondary);
  color: #3D2B00;
  border-radius: 3px;
  padding: 0 .1em;
}

@media (max-width: 575.98px) {
  .reader-page-area { padding: 1.6rem 1.2rem; max-height: 440px; }
}

/* ---- Quiz ---- */
.quiz-option {
  display: flex; align-items: center; gap: .8rem;
  width: 100%; text-align: left;
  padding: .9rem 1.1rem;
  border: 2px solid var(--s21-border);
  border-radius: var(--radius-md);
  background: var(--s21-white);
  font-weight: 600; font-size: .95rem;
  color: var(--s21-text);
  transition: all .18s var(--ease);
}
.quiz-option:hover:not(:disabled) { border-color: var(--s21-primary); background: var(--s21-primary-light); }
.quiz-option .opt-letter {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--s21-primary-light); color: var(--s21-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 800; flex-shrink: 0;
}
.quiz-option.is-correct { border-color: #0B6E4F; background: #E4F3EC; }
.quiz-option.is-correct .opt-letter { background: #0B6E4F; color: #fff; }
.quiz-option.is-wrong { border-color: var(--s21-accent); background: var(--s21-accent-tint); }
.quiz-option.is-wrong .opt-letter { background: var(--s21-accent); color: #fff; }
.quiz-option:disabled { cursor: default; opacity: .85; }

.quiz-progress-track {
  display: flex; gap: .35rem; margin-bottom: 1.6rem;
}
.quiz-progress-track span {
  flex: 1; height: 6px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.25);
}
.quiz-progress-track span.done { background: var(--s21-secondary); }
.quiz-progress-track span.current { background: #fff; }

/* ---- Auth pages ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
}
.auth-visual {
  flex: 1;
  background: linear-gradient(160deg, var(--s21-primary) 0%, var(--s21-primary-dark) 100%);
  background-image: linear-gradient(160deg, rgba(6,20,15,.7), rgba(11,110,79,.55)), url('https://images.unsplash.com/photo-1544776193-352d25ca82cd?w=1200&q=70&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background-color: var(--s21-bg);
  background-image: var(--s21-bg-image);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-role-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: 1.6rem;
}
.auth-role-tabs input { display: none; }
.auth-role-tabs label {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  border: 2px solid var(--s21-border);
  border-radius: var(--radius-md);
  padding: .7rem .3rem;
  font-size: .74rem; font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.auth-role-tabs input:checked + label {
  border-color: var(--s21-primary);
  background: var(--s21-primary-light);
  color: var(--s21-primary);
}
.auth-input-group { position: relative; }
.auth-input-group .toggle-pw {
  position: absolute; right: .9rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--s21-text-soft);
}
.form-control.s21-input, .form-select.s21-input {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--s21-border);
  padding: .7rem 1rem;
}
.form-control.s21-input:focus, .form-select.s21-input:focus {
  border-color: var(--s21-primary);
  box-shadow: 0 0 0 3px var(--s21-primary-light);
}
.was-validated .form-control:invalid { border-color: var(--s21-accent); }

@media (max-width: 991.98px) {
  .auth-visual { display: none; }
}

/* ---- Dashboard ---- */
.dash-welcome {
  background: linear-gradient(120deg, var(--s21-primary) 0%, #0E8060 100%);
  border-radius: var(--radius-lg);
  padding: 2rem 2.2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.dash-welcome::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.12) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
}
.dash-welcome > * { position: relative; z-index: 1; }
.dash-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid var(--s21-secondary);
  object-fit: cover;
}
.dash-stat-card {
  padding: 1.4rem;
  text-align: center;
}
.dash-stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .7rem; font-size: 1.15rem;
}
.dash-stat-card .stat-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.streak-flame {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-pill);
  padding: .4rem 1rem;
  font-weight: 700; font-size: .85rem;
}
.badge-earned {
  text-align: center;
}
.badge-earned .badge-icon {
  width: 64px; height: 64px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin: 0 auto .5rem;
  box-shadow: 0 8px 18px rgba(0,0,0,.1);
}
.badge-earned.locked .badge-icon { background: #EEF0F2 !important; color: #B7BEC7; filter: grayscale(1); opacity: .7; }
.badge-earned .badge-name { font-size: .78rem; font-weight: 700; }

/* ---- Teacher / Parent dashboard extras ---- */
/* Framed, zebra-striped table treatment — used for .dash-table (admin/teacher
   dashboards) and .yts-table (admin video manager). Wrapping container gets a
   border + rounded corners so the table reads as one tidy panel instead of
   bare rows floating on the card's white background. */
.table-responsive:has(.dash-table),
.yts-table-wrap {
  border: 1px solid var(--s21-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dash-table, .yts-table { font-size: .88rem; margin-bottom: 0; width: 100%; border-collapse: collapse; }
.dash-table thead th, .yts-table thead th {
  text-align: left;
  background: color-mix(in srgb, var(--s21-primary) 8%, var(--s21-bg));
  color: var(--s21-text-soft);
  font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--s21-border);
  white-space: nowrap;
}
.dash-table td, .yts-table td {
  padding: .8rem 1rem;
  background: var(--s21-white);
  border-bottom: 1px solid var(--s21-border);
  vertical-align: middle;
}
.dash-table tbody tr:last-child td, .yts-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:nth-child(even) td, .yts-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--s21-bg) 65%, var(--s21-white));
}
.dash-table tbody tr, .yts-table tbody tr { transition: background-color .15s var(--ease); }
.dash-table tbody tr:hover td, .yts-table tbody tr:hover td { background: var(--s21-primary-light); }
.status-chip { font-size: .72rem; font-weight: 700; padding: .25rem .65rem; border-radius: var(--radius-pill); }
.status-chip.active { background: var(--s21-primary-light); color: var(--s21-primary); }
.status-chip.pending { background: var(--s21-secondary-tint); color: #A66A00; }

.s21-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.s21-switch input { opacity: 0; width: 0; height: 0; }
.s21-switch .slider { position: absolute; inset: 0; background: #D9DEE3; border-radius: 999px; transition: .2s; cursor: pointer; }
.s21-switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.s21-switch input:checked + .slider { background: var(--s21-primary); }
.s21-switch input:checked + .slider::before { transform: translateX(20px); }

.child-tab {
  display: flex; align-items: center; gap: .6rem;
  border: 2px solid var(--s21-border);
  border-radius: var(--radius-pill);
  padding: .5rem 1.1rem .5rem .5rem;
  font-weight: 700; font-size: .85rem;
  background: var(--s21-white);
  transition: all .18s var(--ease);
}
.child-tab img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.child-tab.active { border-color: var(--s21-primary); background: var(--s21-primary-light); color: var(--s21-primary); }

/* ---- Pricing ---- */
.pricing-card {
  padding: 2.2rem 1.8rem;
  text-align: center;
  position: relative;
  border-width: 2px;
  overflow: visible; /* .s21-card sets overflow:hidden, which would clip .popular-tag (positioned above the card's own top edge) */
}
.pricing-card.featured {
  border-color: var(--s21-primary);
  box-shadow: var(--card-shadow-hover);
}
.pricing-card .popular-tag {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--s21-primary); color: #fff;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: .35rem 1rem; border-radius: var(--radius-pill);
}
.pricing-card .price {
  font-family: var(--font-display); font-weight: 700;
  font-size: 2.4rem; margin: .6rem 0 .2rem;
}
.pricing-card .price span { font-size: .95rem; font-weight: 600; color: var(--s21-text-soft); }
.pricing-feature-list { text-align: left; font-size: .88rem; }
.pricing-feature-list li { display: flex; align-items: flex-start; gap: .6rem; padding: .45rem 0; }

/* ---- Contact ---- */
.contact-info-card {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.1rem;
}
.contact-info-card .icon-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--s21-primary-light); color: var(--s21-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* .map-placeholder removed — contact.html now embeds a real Google Map
   via the key-free google.com/maps?...&output=embed URL format. */

/* ---- Admin dashboard ---- */
.admin-topbar .admin-console-badge {
  margin-left: .75rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--s21-text-soft);
  border: 1px solid var(--s21-border);
  border-radius: var(--radius-pill);
  padding: .3rem .8rem;
}
.admin-shell { display: flex; min-height: calc(100vh - 76px); }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--s21-white);
  border-right: 1px solid var(--s21-border);
  padding: 1.6rem 1rem;
  position: sticky; top: 76px;
  height: calc(100vh - 76px);
  overflow-y: auto; overflow-x: hidden;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.admin-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .9rem; gap: .5rem;
}
.admin-sidebar-title { white-space: nowrap; overflow: hidden; }
.admin-sidebar-toggle {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  color: var(--s21-text-soft); cursor: pointer;
  transition: background .2s, color .2s;
}
.admin-sidebar-toggle:hover { background: var(--s21-primary-light); color: var(--s21-primary); }
.admin-sidebar .nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem .9rem; border-radius: 10px;
  color: var(--s21-text-soft); font-weight: 600; font-size: .88rem;
  white-space: nowrap; overflow: hidden;
}
.admin-sidebar .nav-link.active, .admin-sidebar .nav-link:hover {
  background: var(--s21-primary-light); color: var(--s21-primary);
}
.admin-sidebar .nav-link i {
  width: 20px; flex-shrink: 0; text-align: center; font-size: .95rem;
}
.admin-sidebar .nav-label {
  opacity: 1; transition: opacity .35s ease .05s;
}
/* Collapsed state: narrow icon-only rail. The label must lose its
   width (not just fade out) or it keeps reserving space in the flex
   row — with justify-content:center that pushes the icon off to one
   side and clips it entirely against the rail's overflow:hidden,
   which is why links were rendering blank/broken when collapsed. */
.admin-sidebar.is-collapsed { width: 76px; }
.admin-sidebar.is-collapsed .nav-label,
.admin-sidebar.is-collapsed .admin-sidebar-title {
  opacity: 0; width: 0; margin: 0; overflow: hidden;
  pointer-events: none;
  transition: opacity .15s ease, width .15s ease, margin .15s ease;
}
.admin-sidebar.is-collapsed .nav-link { justify-content: center; padding-inline: 0; gap: 0; }
.admin-sidebar.is-collapsed .admin-sidebar-head { justify-content: center; gap: 0; }
.admin-content { flex: 1; padding: 1.8rem; min-width: 0; }
.admin-content .dash-stat-card { text-align: left; display: flex; align-items: center; gap: 1rem; }
.admin-content .dash-stat-card .stat-icon { margin: 0; flex-shrink: 0; }
.moderation-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem; border-radius: var(--radius-md);
  border: 1px solid var(--s21-border);
  margin-bottom: .7rem;
}
.moderation-row img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }

.admin-search {
  position: relative; display: flex; align-items: center;
}
.admin-search i {
  position: absolute; left: .7rem; font-size: .8rem; color: var(--s21-text-soft); pointer-events: none;
}
.admin-search input {
  border: 1px solid var(--s21-border); background: var(--s21-bg);
  border-radius: var(--radius-pill); padding: .4rem .8rem .4rem 2rem;
  font-size: .82rem; width: 190px; color: var(--s21-text);
}
.admin-search input:focus { outline: 2px solid var(--s21-primary); outline-offset: 1px; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem;
}
.user-avatar.role-user { background: var(--s21-primary-light); color: var(--s21-primary); }
.user-avatar.role-teacher { background: var(--s21-accent-tint); color: var(--s21-accent); }
.user-avatar.role-parent { background: var(--s21-secondary-tint); color: #A66A00; }
.user-avatar.role-admin { background: var(--s21-text); color: var(--s21-white); }

.role-select {
  border: none; font-weight: 700; font-size: .78rem;
  border-radius: var(--radius-pill); padding: .35rem 1.7rem .35rem .8rem;
  cursor: pointer; appearance: none;
  background-repeat: no-repeat; background-position: right .6rem center; background-size: .6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235B6470' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.role-select.role-user { background-color: var(--s21-primary-light); color: var(--s21-primary); }
.role-select.role-teacher { background-color: var(--s21-accent-tint); color: var(--s21-accent); }
.role-select.role-parent { background-color: var(--s21-secondary-tint); color: #A66A00; }
.role-select.role-admin { background-color: var(--s21-text); color: var(--s21-white); }
@media (max-width: 991.98px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: 1.2rem; }
}

/* ---- Gallery / lightbox ---- */
.gallery-grid {
  columns: 4 220px;
  column-gap: 1rem;
}
.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}
.gallery-item img { width: 100%; display: block; transition: transform .4s var(--ease); }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item .gallery-cat {
  position: absolute; bottom: .5rem; left: .5rem;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: var(--radius-pill);
}
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(6,20,15,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.lightbox-overlay.open { opacity: 1; pointer-events: auto; }
.lightbox-overlay img { max-width: 90vw; max-height: 82vh; border-radius: var(--radius-md); box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.lightbox-close, .lightbox-nav {
  position: absolute; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
}
.lightbox-close { top: 1.4rem; right: 1.4rem; }
.lightbox-nav.prev { left: 1.4rem; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 1.4rem; top: 50%; transform: translateY(-50%); }
.lightbox-caption { position: absolute; bottom: 1.4rem; left: 0; right: 0; text-align: center; color: #fff; font-size: .88rem; }
@media (max-width: 767.98px) {
  .gallery-grid { columns: 2 160px; }
}

/* ---- Custom video player ---- */
.player-shell {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
}
.player-shell video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.player-shell.theater { aspect-ratio: 21/9; }

.player-big-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.15);
  border: none; cursor: pointer;
}
.player-big-play span {
  width: 76px; height: 76px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--s21-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.player-shell.is-playing .player-big-play { opacity: 0; pointer-events: none; }

.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.85), rgba(0,0,0,0));
  padding: 2.2rem .9rem .7rem;
  opacity: 1;
  transition: opacity .25s var(--ease);
}
.player-shell.controls-hidden .player-controls { opacity: 0; pointer-events: none; }

.player-seek {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; border-radius: 999px;
  background: rgba(255,255,255,.3);
  margin-bottom: .6rem;
  cursor: pointer;
}
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--s21-secondary);
  box-shadow: 0 0 0 3px rgba(255,209,102,.25);
}
.player-seek::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--s21-secondary); border: none; }

.player-row { display: flex; align-items: center; gap: .6rem; color: #fff; }
.player-btn {
  background: none; border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
}
.player-btn:hover { background: rgba(255,255,255,.14); }
.player-time { font-size: .78rem; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.9); min-width: 92px; }
.player-volume { -webkit-appearance: none; appearance: none; width: 70px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.3); }
.player-volume::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.player-spacer { flex: 1; }
.player-menu {
  position: relative;
}
.player-menu-list {
  position: absolute; bottom: 44px; right: 0;
  background: rgba(20,20,20,.96);
  border-radius: 10px;
  padding: .4rem;
  min-width: 130px;
  display: none;
}
.player-menu-list.open { display: block; }
.player-menu-list button {
  width: 100%; text-align: left; background: none; border: none; color: #fff;
  padding: .45rem .6rem; border-radius: 6px; font-size: .8rem;
}
.player-menu-list button:hover, .player-menu-list button.active { background: rgba(255,255,255,.14); }
.player-menu-list button.active { color: var(--s21-secondary); }

.chapter-marker {
  cursor: pointer; padding: .6rem .7rem; border-radius: 10px;
  display: flex; justify-content: space-between; font-size: .85rem;
}
.chapter-marker:hover { background: var(--s21-primary-light); }
.chapter-marker.active { background: var(--s21-primary-light); color: var(--s21-primary); font-weight: 700; }

/* ---- Onboarding flow (language / level / referral / goals) ---- */
.onboard-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.2rem;
  background: radial-gradient(120% 100% at 50% 0%, #0E8060 0%, var(--s21-primary-dark) 55%, #061410 100%);
}
.onboard-card {
  width: 100%;
  max-width: 560px;
  background: var(--s21-white);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.8rem;
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.onboard-progress {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.8rem;
}
.onboard-progress span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--s21-border);
  overflow: hidden;
}
.onboard-progress span::after {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--s21-primary), #16A76B);
  transition: width .3s var(--ease);
}
.onboard-progress span.done::after,
.onboard-progress span.current::after { width: 100%; }

.onboard-step { display: none; }
.onboard-step.active { display: block; animation: s21-fade-up .4s var(--ease) both; }

.onboard-eyebrow {
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--s21-primary);
}
.onboard-title { font-size: 1.5rem; margin: .4rem 0 .3rem; }
.onboard-sub { color: var(--s21-text-soft); font-size: .92rem; margin-bottom: 1.6rem; }

.onboard-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin-bottom: 1.8rem;
}
.onboard-option {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--s21-border);
  border-radius: var(--radius-md);
  background: var(--s21-white);
  text-align: left;
  font-weight: 700;
  font-size: .92rem;
  color: var(--s21-text);
  transition: all .18s var(--ease);
}
.onboard-option i { font-size: 1.2rem; color: var(--s21-primary); flex-shrink: 0; }
.onboard-option:hover { border-color: var(--s21-primary); background: var(--s21-primary-light); }

/* Colorful rounded icon badges for each option's leading icon — keeps the
   check-mark badge on the right (`.check`) completely untouched. */
.onboard-option .opt-icon {
  --opt-color: var(--s21-primary);
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--opt-color) 16%, transparent);
  transition: transform .18s var(--ease);
}
.onboard-option .opt-icon i { font-size: 1.02rem; color: var(--opt-color) !important; }
.onboard-option:hover .opt-icon { transform: scale(1.06); }
.onboard-option.selected .opt-icon { background: var(--opt-color); }
.onboard-option.selected .opt-icon i { color: #fff !important; }
.onboard-option.selected {
  border-color: var(--s21-primary);
  background: var(--s21-primary-light);
  box-shadow: 0 0 0 3px var(--s21-primary-light);
}
.onboard-option.selected i { color: var(--s21-primary); }
.onboard-option .check {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--s21-border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .65rem; color: #fff;
}
.onboard-option.selected .check { background: var(--s21-primary); border-color: var(--s21-primary); }

.onboard-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.onboard-skip { font-size: .82rem; color: var(--s21-text-soft); background: none; border: none; }

/* Big two-way fork (Guest vs Join) — distinct from the grid-of-options
   pattern since this is a branching decision, not a multiple-choice pick. */
.onboard-choice-row {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  margin-bottom: 1.6rem;
}
.onboard-choice {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.3rem;
  border: 2px solid var(--s21-border);
  border-radius: var(--radius-lg);
  background: var(--s21-white);
  text-align: left;
  transition: all .18s var(--ease);
}
.onboard-choice:hover { border-color: var(--s21-primary); background: var(--s21-primary-light); transform: translateY(-2px); }
.onboard-choice .choice-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
}
.onboard-choice .choice-text { flex: 1; }
.onboard-choice .choice-title { font-weight: 800; font-size: 1rem; color: var(--s21-text); }
.onboard-choice .choice-sub { font-size: .82rem; color: var(--s21-text-soft); }
.onboard-choice .fa-chevron-right { color: var(--s21-text-soft); }
.onboard-choice.join .choice-icon { background: linear-gradient(135deg, var(--s21-primary), #16A76B); }
.onboard-choice.guest .choice-icon { background: linear-gradient(135deg, var(--s21-secondary), #FFB703); color: #3D2B00; }

@media (max-width: 480px) {
  .onboard-options { grid-template-columns: 1fr; }
  .onboard-card { padding: 1.8rem 1.3rem; }
}

/* ---- Splash screen ---- */
.splash-shell {
  position: relative;
  min-height: 100vh;
  background: #000;
  overflow: hidden;
}
.splash-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Utility ---- */
.divider-soft { height: 1px; background: var(--s21-border); border: none; }
.rounded-xl { border-radius: var(--radius-lg) !important; }
.bg-primary-soft { background: var(--s21-primary-light); }
.bg-secondary-soft { background: var(--s21-secondary-tint); }
.bg-accent-soft { background: var(--s21-accent-tint); }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--s21-primary); color: #fff;
  padding: .7rem 1.2rem; z-index: 2000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--s21-accent);
  outline-offset: 2px;
}

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

/* ---- Cookie notice banner (js/cookie-consent.js) ---- */
.s21-cookie-notice {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1500;
  padding: 0 1rem 1rem;
  transform: translateY(120%);
  transition: transform .3s var(--ease);
}
.s21-cookie-notice.s21-cookie-notice-show { transform: translateY(0); }
.s21-cookie-notice-inner {
  max-width: 900px;
  margin: 0 auto;
  background: var(--s21-white);
  border: 1px solid var(--s21-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow-hover);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
}
.s21-cookie-notice-icon { font-size: 1.4rem; color: var(--s21-secondary-dark); flex-shrink: 0; }
.s21-cookie-notice-text { margin: 0; flex: 1 1 320px; font-size: .88rem; color: var(--s21-text-soft); }
.s21-cookie-notice-text a { color: var(--s21-primary); font-weight: 700; }
.s21-cookie-notice-btn { flex-shrink: 0; padding: .55rem 1.3rem; }

@media (max-width: 575.98px) {
  .s21-cookie-notice-inner { flex-direction: column; align-items: flex-start; text-align: left; }
  .s21-cookie-notice-btn { width: 100%; justify-content: center; }
}

/* Mobile menu toggler (three-bar / hamburger icon) — force white on every page */
.navbar-toggler {
  color: #ffffff !important;
  background-color: transparent !important;
  border-color: transparent !important;
}
.navbar-toggler:focus {
  box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .5);
}
.navbar-toggler i.fa-bars,
.navbar-toggler .fa-bars {
  color: #ffffff !important;
}

/* Mobile top-bar quick actions (language + dark/light mode) — always visible next to the hamburger icon */
.s21-mobile-actions { margin-left: auto; }
.icon-btn-sm { width: 36px; height: 36px; }

/* Hamburger (offcanvas) menu panel — brand green background, white text/icons */
#mobileNav.offcanvas {
  background: var(--s21-primary);
  color: #ffffff;
}
#mobileNav .offcanvas-header {
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
#mobileNav .offcanvas-header h5,
#mobileNav #mobileNavLabel {
  color: #ffffff;
}
#mobileNav .btn-close {
  filter: brightness(0) invert(1);
  opacity: .9;
}
#mobileNav .s21-nav-link {
  color: #ffffff;
}
#mobileNav .s21-nav-link:hover,
#mobileNav .s21-nav-link.active {
  background: rgba(255, 255, 255, .16);
  color: #ffffff;
}
#mobileNav .btn-s21-outline {
  color: #ffffff;
  border-color: rgba(255, 255, 255, .55);
  background: transparent;
}
#mobileNav .btn-s21-outline:hover {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(255, 255, 255, .12);
}
#mobileNav .btn-s21-primary {
  background: var(--s21-secondary);
  color: #3D2B00;
}


/* ---- Home hero: "Ask Smart21brain AI" button ---- */
.s21-ai-hero-btn {
  background: linear-gradient(135deg, #7c5cff 0%, #0B6E4F 100%);
  color: #fff; border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 8px 22px rgba(124,92,255,.38);
}
.s21-ai-hero-btn:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(124,92,255,.5); }
.s21-ai-hero-btn i { animation: s21-ai-sparkle 2.4s ease-in-out infinite; }
@keyframes s21-ai-sparkle { 0%,100% { transform: rotate(0) scale(1); } 50% { transform: rotate(14deg) scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .s21-ai-hero-btn i { animation: none; } }

#s21-ai-panel .ai-head-link { color: #fff; width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; opacity: .9; }
#s21-ai-panel .ai-head-link:hover { background: rgba(255,255,255,.18); opacity: 1; }

.ai-code-prev { background: #fff; border-top: 1px solid rgba(255,255,255,.12); }
.ai-code-prev iframe { display: block; width: 100%; height: 260px; border: 0; background: #fff; }
.ai-code pre[hidden], .ai-code-prev[hidden] { display: none; }
.ai-code-note { padding: .8rem .9rem; font-size: .8rem; color: #333; background: #f3f6f4; }


/* ---- Search results page (search.html) ---- */
.s21-res-count { font-weight: 700; margin-bottom: 1rem; }
.s21-res-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.s21-res-filter {
  border: 1px solid var(--s21-border); background: var(--s21-white); color: var(--s21-text);
  border-radius: 999px; padding: .35rem .9rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.s21-res-filter b { font-weight: 700; opacity: .65; margin-left: .2rem; }
.s21-res-filter.active { background: var(--s21-primary); border-color: var(--s21-primary); color: #fff; }
.s21-res-group { margin-bottom: 2rem; }
.s21-res-group[hidden] { display: none; }
.s21-res-head { font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; margin-bottom: .8rem; }
.s21-res-head i { color: var(--s21-primary); }
.s21-res-head small { font-size: .75rem; background: var(--s21-primary-light); color: #0B6E4F; padding: .1rem .55rem; border-radius: 999px; }
.s21-res-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.s21-res-card {
  display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; text-decoration: none;
  background: var(--s21-white); color: var(--s21-text); border: 1px solid var(--s21-border);
  border-radius: var(--radius-md); transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.s21-res-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); color: var(--s21-text); }
.s21-res-ico { width: 40px; height: 40px; border-radius: 12px; background: #E4F3EC; color: #0B6E4F; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.s21-res-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.s21-res-body small { color: var(--s21-text-soft); font-size: .78rem; line-height: 1.3; margin-top: .15rem; }
.s21-res-go { color: var(--s21-text-soft); font-size: .75rem; }
.s21-res-empty { text-align: center; padding: 3rem 1rem; color: var(--s21-text-soft); }


/* Search dropdown must never be clipped by the banner/section it sits in (library, courses, games, videos, search…).
   search.js tags every clipping ancestor of a search bar with .s21-search-host. */
.s21-search-host {
  overflow-x: clip !important;
  overflow-y: visible !important;
  position: relative;
  z-index: 20;
}
.s21-search-wrap .s21-search-panel { z-index: 60; }

/* Logo mark inside the home hero badge (replaces the old location pin) */
.hero-badge-logo { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: -5px; margin-right: .35rem; }

/* Mobile menu: account/login block sits at the top (no "Menu" label) */
#mobileNav .s21-mobile-user { min-width: 0; }
#mobileNav .s21-mobile-user .btn-s21 { padding: .5rem .75rem; font-size: .85rem; white-space: nowrap; }
#mobileNav .s21-mobile-user .nav-account-link { min-width: 0; max-width: 100%; }

/* "Learn at every level" section: illustrated background with a readable dark wash */
.section-levels-bg {
  background-color: #0b1d16;
  background-image:
    linear-gradient(180deg, rgba(9,22,16,.55) 0%, rgba(9,22,16,.25) 50%, rgba(9,22,16,.55) 100%),
    url('../images/backgrounds/levels-bg.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Desktop nav has 14 items: keep it on one line. Below 1280px it switches to the
   hamburger menu (same offcanvas as phones); between 1280 and 1599px it is compacted. */
@media (min-width: 992px) {
  .s21-navbar .s21-nav-link { white-space: nowrap; }
  .s21-navbar .btn-s21 { white-space: nowrap; }
}
@media (min-width: 992px) and (max-width: 1279px) {
  .s21-navbar .navbar-collapse { display: none !important; }
  .s21-navbar .navbar-toggler { display: block !important; }
  .s21-navbar nav > .d-none.d-lg-flex { display: none !important; }
  .s21-navbar .s21-mobile-actions { display: flex !important; margin-left: auto; }
}
@media (min-width: 1280px) and (max-width: 1799px) {
  .s21-navbar .s21-nav-link { padding: .4rem .42rem !important; font-size: .78rem; }
  .s21-navbar .s21-nav-link .fa-solid { display: none; }
  .s21-navbar .navbar-nav { gap: 0 !important; }
  .s21-navbar .btn-s21 { padding: .4rem .8rem; font-size: .78rem; }
  .s21-navbar .s21-logo { font-size: 1.05rem; }
}

/* Course curriculum: module header bar (readable in light and dark themes) */
.cd-module-head {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--s21-text);
  background: var(--s21-primary-light);
  border-left: 4px solid var(--s21-primary);
}
