
html {
  scrollbar-gutter: stable;
}

#fly-layer{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:9999;
}

#top-controls{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 0 20px;
  margin: 0;
  background: #ffffff;
  border: none;
  box-shadow: none;
  z-index: 300;
  overflow: hidden;
}

/* The header clips its overflow, so every disclosure panel inside it must be
   named here or its dropdown is invisible: the admin locale/country preview
   and the public language globe (php/locale.php renders one or the other —
   never both — into .top-right). */
#top-controls:has(:is(.locale-preview-control, .site-locale-globe)[open]){
  overflow: visible;
}

/* Academy brand color line */
.header-brand-line {
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 300;
}

/* Powered by Lingadoo footer (Academy with custom logo) */
.powered-by-lingadoo {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  z-index: 50;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.powered-by-lingadoo:hover {
  opacity: 1;
}

.powered-by-lingadoo a {
  color: #6b7280;
  text-decoration: none;
  font-weight: 600;
}

.powered-by-lingadoo a:hover {
  color: #374151;
  text-decoration: underline;
}

/* Push page content below fixed header (and brand line if present) */
body {
  padding-top: 64px;
}

/* ── Standard content gap below the fixed header ──────────────────────────
   Every data-view="page" <main> starts 20 px below the header.
   Individual tool/page containers must NOT add their own top padding.
   ──────────────────────────────────────────────────────────────────────── */
body[data-view="page"] main {
  padding-top: 20px;
}
/* Birthday Blast manages its own top gap in birthday-blast.css */
body.bb-page main {
  padding-top: 0;
}
/* Turn Taker's board view is a full-bleed tool — no extra top gap before
   the toolbar. Setup view keeps the sitewide 20px breathing room. */
body.tt-page.tt-board-active main {
  padding-top: 0;
}


/* Primary navigation */
.top-nav{
  display: flex;
  align-self: center;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.top-nav::-webkit-scrollbar{
  display: none;
}

.top-nav-link{
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.top-nav-link:hover{
  background: #F1F5F9;
  color: #111827;
}

.top-nav-link:focus-visible{
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 8px;
}

.top-nav-link.is-active{
  color: #1D4ED8;
  background: #EFF6FF;
}

.top-nav-link.is-active:hover{
  background: #DBEAFE;
  color: #1D4ED8;
}

/* Icon and label inside each nav link */
.nav-icon{
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex-shrink: 0;
  display: block;
  overflow: hidden;
}

.nav-icon--mysets{
  width: 36px;
  max-width: 36px;
}

.nav-label{
  white-space: nowrap;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
}

.top-nav-link.is-active .nav-label{
  text-decoration: none;
}


/* Upgrade button - visually distinct */
.top-nav-upgrade{
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #111827 !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}

.top-nav-upgrade:hover{
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
}

/* Flatten header background (match index.php home header) */
#top-controls::before{
  content: none;
}

/* Title block: logo on the left */
#header-title{
  position: static;
  transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Top-right: push to end of header */
.top-right{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sets is core product navigation, kept in the header itself immediately
   before Search instead of being folded into the account hamburger. */
.header-sets-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 9px 0 7px;
  border-radius: 10px;
  color: #374151;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-sets-link img { display: block; width: 30px; height: 30px; object-fit: contain; }
.header-sets-link:hover { background: #F1F5F9; color: #111827; }
.header-sets-link.is-active { background: #EFF6FF; color: #1D4ED8; }
.header-sets-link:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }

/* The guest-only conversion action in the header. Started on public Worksheets
   (hence the name) and is now the signed-out default on every page that renders
   php/header.php. Never shown to signed-in users. */
.worksheet-guest-cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:36px;
  padding:0 13px;
  border-radius:9px;
  background:#0F172A;
  color:#fff;
  font-family:"Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size:13px;
  font-weight:800;
  text-decoration:none;
  white-space:nowrap;
  box-shadow:0 2px 7px rgba(15,23,42,.18);
}
.worksheet-guest-cta:hover{ background:#020617; color:#fff; }
.worksheet-guest-cta:focus-visible{ outline:2px solid #0F172A; outline-offset:2px; }

/* Phone-only twin of the header CTA, rendered above the footer by
   php/footer.php. Hidden by default; the ≤640px block below swaps the two so
   only ever one of them is on the page. */
.footer-guest-cta-band{ display:none; }
.footer-guest-cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 22px;
  border-radius:11px;
  background:#0F172A;
  color:#fff;
  font-family:"Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size:15px;
  font-weight:800;
  text-decoration:none;
  box-shadow:0 2px 7px rgba(15,23,42,.18);
}
.footer-guest-cta:hover{ background:#020617; color:#fff; }
.footer-guest-cta:focus-visible{ outline:2px solid #0F172A; outline-offset:2px; }

/* Separates the Contribute link from Worksheets (last content-nav item) —
   signals "different category," not a content section like the others. */
.top-right-divider{
  align-self: center;
  width: 1px;
  height: 22px;
  background: rgba(148,163,184,0.45);
  flex-shrink: 0;
}

/* Account trigger / hamburger button */
.account-trigger.header-hamburger-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.account-trigger.header-hamburger-btn:hover{
  background: rgba(148,163,184,0.15);
}

.account-trigger.header-hamburger-btn[aria-expanded="true"]{
  background: rgba(148,163,184,0.22);
}

/* Hamburger image */
.header-hamburger-icon{
  display: block;
  width: 24px;
  height: auto;
  object-fit: contain;
}

/* Account links (My Account/Contact/legal/Sign out) now live at the bottom
   of .mobile-nav-drawer instead of a separate popover — see the
   .mobile-nav-link-small / .mobile-nav-signout variants further down. */

/* Game name sub-header — light blue bar fixed immediately below the main nav.
   Shown by JS when entering setup or play; hidden on home/picker.
   body.has-game-subheader adds extra padding-top to push content below it. */
.game-subheader {
  position: fixed;
  top: 54px;              /* flush below #top-controls (height: 54px) */
  left: 0;
  right: 0;
  z-index: 200;           /* below fixed nav (300) but above game content */
  background: #EFF6FF;
  border-bottom: 1px solid #DBEAFE;
  padding: 7px 24px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(30,64,175,0.06);
}

.game-subheader-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #1e40af;
}

/* When the game subheader is visible, push page content below both fixed bars */
body.has-game-subheader {
  padding-top: 96px;  /* 54px nav + 32px subheader + 10px gap (was 64px without subheader) */
}

.brand-link{
  display: block;
  line-height: 0;
  pointer-events: auto;
}

.brand-logo{
  height: 32px;        /* slightly taller so header title defines bar height */
  width: auto;
  object-fit: contain;
  display: block;
}

@media (max-width: 480px){
  .sound-hide-mobile{
    display: none;
  }
}

.brand-tagline{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin-left: 0;
  font-size: 16px;              /* match marketing/content pages */
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(20,20,20,.68);
  white-space: nowrap;
}

/* Top-left current game logo, same size as setup game icons */
.top-game-logo{
  display: none; /* no per-game logo in the top bar; keeps height consistent */
}

.top-game-logo img[data-role="top-game-logo-img"]{
  display: none;
}

/* Tagline is shared across home, setup, and play to keep top panel consistent */

body[data-view="app"]{
  --app-shell-top: 64px;
}

body[data-view="app"].has-game-subheader{
  --app-shell-top: 96px;
}

#layout{
  min-height: calc(100vh - var(--app-shell-top, 64px));
  min-height: calc(100dvh - var(--app-shell-top, 64px));
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;

  /* allow setup background art to sit behind content */
  position: relative;
  z-index: 0;
}

body[data-view="app"][data-route="play"] #layout{
  height: calc(100vh - var(--app-shell-top, 64px));
  height: calc(100dvh - var(--app-shell-top, 64px));
  min-height: 0;
  overflow: hidden;
}

/* In setup mode, ensure the main layout row spans the entire viewport
   width, independent of any outer max-width constraints. This makes the
   three setup columns line up with the full-width top bar. */
body[data-route="setup"] #layout{
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 0 18px; /* no horizontal padding so setup grid can reach the edges */
  box-sizing: border-box;
}

/* Home pages use the shared warm paper grid from base.css. */

/* Setup pages (game setup screens): background intentionally omitted —
   falls through to base.css's site-wide warm paper grid, matching home.php
   and other major pages. Was solid #e5e7eb grey. */

/* Disable legacy animated clouds layer for setup */
#setup-clouds{
  display: none;
}

/* WordDuel: brick wall background under the entire page (body + layout) */
body[data-route="play"][data-game="wordduel"]{
  background-color: #111827 !important;
  background-image: url("/img/ui/wall.svg") !important;
  background-position: 0 0 !important;
  background-size: auto !important; /* keep native SVG size */
  background-repeat: repeat !important;
  background-attachment: fixed !important;
}

/* Desktop play: prevent vertical scroll; game roots are scaled to fit instead. */
@media (min-width: 980px){
  body[data-route="play"]{
    overflow-y: hidden;
  }
}

body[data-route="play"][data-game="animal_challenge"]{
  background: radial-gradient(
    circle at top,
    #354927 0%,
    #0d1432 70%
  ) !important;
}




#layout[data-route="play"][data-game="wordduel"]::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: transparent;
  background-image: url("/img/ui/wall.svg");
  background-position: 0 0;
  background-size: auto;
  background-repeat: repeat;
}

/* Squares: dark brick-wall backdrop replaced with the site-wide cream
   background (same treatment as Lingo Bingo's reskin) so it falls through
   to base.css's warm gradient instead of a dark game-show scene. */
body[data-route="play"][data-game="squares"]{
  overflow-y: hidden; /* Squares game must always fit; no vertical scroll */
}

/* Columns: red brick wall under the entire page (body + layout) */
body[data-route="play"][data-game="columns"]{
  background-color: #111827 !important;
  background-image: url("/img/ui/redwall.svg") !important;
  background-position: 0 0 !important;
  background-size: auto !important; /* keep native SVG size */
  background-repeat: repeat !important;
  background-attachment: fixed !important;
  overflow-y: hidden; /* Columns game must always fit; no vertical scroll */
}

#layout[data-route="play"][data-game="columns"]::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: transparent;
  background-image: url("/img/ui/redwall.svg");
  background-position: 0 0;
  background-size: auto;
  background-repeat: repeat;
}

.setup-cloud{
  position: absolute;
  left: 0;
  top: 20%;

  /* JS sets: --w, --opacity, --scale, --img */
  width: var(--w, 520px);
  aspect-ratio: 3 / 1;

  background-image: var(--img);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  opacity: var(--opacity, 0.45);
  filter: blur(var(--blur, 0px));

  transform: translateX(-30vw) scale(var(--scale, 1.2));
  animation-name: setup-cloud-drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}

@keyframes setup-cloud-drift{
from { transform: translateX(-20vw) }
to   { transform: translateX(120vw) }
}

/* Setup plane: flies across the sky on its own loop. */
.setup-plane{
  position: absolute;
  top: 30%;
  left: 0;
  width: 120px; /* smaller plane on setup page */
  aspect-ratio: 3 / 1;
  background-image: url("/img/ui/plane.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;

  /* Base transform: keep the plane well off-screen until the first animation runs. */
  transform: translateX(-120vw) scale(var(--plane-scale, 0.6));
  will-change: transform;
}

@keyframes setup-plane-ltr{
  from { transform: translateX(-120vw) scale(var(--plane-scale, 0.8)); }
  to   { transform: translateX(120vw) scale(var(--plane-scale, 0.8)); }
}

/* Right-to-left: flip horizontally via scaleX(-1) while keeping the same size */
@keyframes setup-plane-rtl{
  from {
    transform:
      translateX(120vw)
      scaleX(-1)
      scale(var(--plane-scale, 0.8));
  }
  to {
    transform:
      translateX(-120vw)
      scaleX(-1)
      scale(var(--plane-scale, 0.8));
  }
}

@media (prefers-reduced-motion: reduce){
  .setup-cloud{ animation: none !important; }
  /* Keep the plane visible but static when reduced motion is requested. */
  .setup-plane{
    animation: none !important;
    transform: translateX(0) scale(var(--plane-scale, 0.8));
  }
}

/* --------------------------------------------------
   APP SPLASH LOADER
   -------------------------------------------------- */
.app-splash{
  position: fixed;
  inset: 0;
  z-index: 9999;

  /* Site-wide warm paper grid (see base.css), matching #app-splash's
     inline critical-CSS copy in index.php */
  background-color: #FBF6E9;
  background-image:
    repeating-linear-gradient(2deg, rgba(115, 91, 59, .018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(255,255,255,.15) 0 1px, transparent 1px 11px),
    radial-gradient(ellipse at 16% 19%, rgba(230, 174, 47, .055) 0 1px, transparent 1.7px),
    radial-gradient(ellipse at 78% 67%, rgba(91, 70, 43, .04) 0 .8px, transparent 1.5px),
    linear-gradient(105deg, rgba(255,255,255,.08), transparent 38%, rgba(126,98,62,.025));
  background-size: auto, auto, 23px 21px, 31px 29px, 100% 100%;
  background-repeat: repeat, repeat, repeat, repeat, no-repeat;
  background-attachment: fixed;

  pointer-events: all;
  transition: opacity 250ms ease, transform 250ms ease;
}

.app-splash.is-hidden{
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
}

/* Keep a board-producing game out of view until its first complete layout. */
body.is-game-loading #game-area{
  visibility: hidden;
}

.game-play-loader{
  z-index: 10000;
}

/* After splash, underlying layout behaves normally */

/* Setup page: remove grass/ground art; cards sit directly on base background */
#layout[data-route="setup"]::after{
  content: none;
}

#layout[data-route="setup"] #setup-ui{ display:block; }
#layout[data-route="setup"] #game-area{ display:none; }
#layout[data-route="play"]  #setup-ui{ display:none; }
#layout[data-route="play"]  #game-area{ display:flex; }

/* Top bar already anchors the tagline on all views via #top-controls */

/* Squares: stack teams + board with fixed spacing; do not stretch
   vertical gaps when the browser height increases. */
#layout[data-route="play"][data-game="squares"] #game-area{
  display: block;
}

#layout[data-route="play"][data-game="squares"] #teams{
  margin-top: 4px;   /* fixed gap below top panel */
  margin-bottom: 8px; /* fixed gap above board */
}

/* Columns: stack teams + board with fixed spacing; do not stretch
   vertical gaps when the browser height increases. */
#layout[data-route="play"][data-game="columns"] #game-area{
  display: block;
}

#game-area{
  flex: 1 1 auto;
  min-width: 0;
  display:flex;
  flex-direction:column;
  gap: 0; /* prevent flex gap from stretching vertical spacing; games control their own spacing */
}

#setup-ui{
  flex: 1 1 auto;
  min-height: 0;
}

.board, #arena-bandit{ flex: 0 0 auto; min-height: 0; }
#footer{
  color: var(--muted);
  text-align: center;
  font-size: 12px;

  /* Always keep copyright near the bottom without affecting layout/scroll */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 10px;
  padding: 0 18px;
  z-index: 4;

  /* keep it subtle and non-blocking */
  pointer-events: none;
}

/* Setup screens can grow taller than the viewport (teachers adding custom
   topics/questions), so a fixed footer would float on top of that content
   instead of sitting after it. Keep it in normal flow at every width here —
   only the play route (fixed-height canvas, never page-scrolls) keeps the
   fixed footer above. */
body[data-route="setup"] #footer{
  position: static;
  padding: 20px 18px 12px;
}

#footer small{
  display: inline;
}

/* ── Shared site-wide copyright footer (php/footer.php) ────────────────────
   Static in normal document flow — never fixed/sticky. The scoped views
   below are switched to a column flexbox and their other direct children
   get flex-grow, so .site-footer is pinned to the bottom of the viewport
   on short pages while long pages simply push it below the content.
   #top-controls (header), the mobile nav drawer/backdrop, and the feedback
   modal are all position:fixed or [hidden] already, so turning their
   parent into a flex container doesn't move or resize them.
   Deliberately excluded: individual lesson pages ([data-content-type=
   "lesson"]), which lock <body> to height:100vh/overflow:hidden on desktop
   for the video/rail shell — a bottom-pinned footer would sit behind that
   layout there, so those just get the footer appended in plain static flow
   instead (see php/footer.php include site). Same reasoning for the solo/*
   live game canvases (solo-generator, solo-answer-fall, etc.) — full-height
   play surfaces are left untouched; the footer still renders, just below
   the game area in normal flow, never overlapping controls. ─────────────── */
body[data-view="page"]:not([data-content-type="lesson"]),
body[data-view="auth"],
body[data-view="signup"],
body[data-view="signup-confirm"],
body[data-view="signup-password"],
body[data-view="reset"],
body[data-view="account"],
body[data-view="account-exists"],
body[data-view="update-password"],
body[data-view="set-password"],
body[data-view="plans"],
body[data-view="games-library"],
body[data-view="solo-games"],
body[data-view="game-page"] {
  display: flex;
  flex-direction: column;
}

body[data-view="page"]:not([data-content-type="lesson"]) > *:not(.site-footer),
body[data-view="auth"] > *:not(.site-footer),
body[data-view="signup"] > *:not(.site-footer),
body[data-view="signup-confirm"] > *:not(.site-footer),
body[data-view="signup-password"] > *:not(.site-footer),
body[data-view="reset"] > *:not(.site-footer),
body[data-view="account"] > *:not(.site-footer),
body[data-view="account-exists"] > *:not(.site-footer),
body[data-view="update-password"] > *:not(.site-footer),
body[data-view="set-password"] > *:not(.site-footer),
body[data-view="plans"] > *:not(.site-footer),
body[data-view="games-library"] > *:not(.site-footer),
body[data-view="solo-games"] > *:not(.site-footer),
body[data-view="game-page"] > *:not(.site-footer) {
  flex: 1 0 auto;
}

.site-footer{
  flex-shrink: 0;
  text-align: center;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-top: 1px solid var(--border);
}

.site-footer p{ margin: 0; }

/* Public section nav — rendered only when a page sets $showFooterNav before
   including php/footer.php (see that file for why it is opt-in). Inherits the
   footer's existing muted 12px treatment so it reads as part of the same
   trust line rather than a new UI band. */
.site-footer-nav{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 0 0 10px;
}

.site-footer-nav a{
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-footer-nav a:hover,
.site-footer-nav a:focus-visible{
  color: var(--ink, #0f172a);
  border-bottom-color: currentColor;
}

#top-controls .top-left{ display:flex; gap: 20px; align-items:center; justify-content:flex-start; }
#top-controls .top-left > *{ margin: 0; }

/* In setup, hide the legacy top-left cluster so the bar is just
   header-title on the left and right controls on the right. */
body[data-route="setup"] #top-controls .top-left{
  display: none;
}
#top-controls .top-right{
  display:flex;
  gap: 10px;
  align-items:center;
}

/* Top-right: reuse home PREMIUM / Sign in styles from index header */
#top-controls .top-premium{
  padding: 0 12px;      /* no vertical padding so it touches top/bottom of bar */
  height: 100%;         /* stretch full bar height */
  display: flex;
  align-items: center;
  border-radius: 0;     /* no extra rounding so it fills the bar vertically */
  font-size: 12px;
}

#top-controls .top-login{
  font-size: 13px;
}

/* Hide hamburger menu button on desktop - replaced by account dropdown */
.top-menu-btn{
  display: none;
}

.top-menu-btn span{
  display: none;
}

/* Global styling for the Sign in/Sign out button in the top bar */
.home-login.top-login{
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

/* Old hamburger site menu - hidden on desktop, replaced by account dropdown */
.site-menu-backdrop,
.site-menu{
  display: none !important;
}

.site-menu-card{
  /* Silvery gradient to match panels */
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.0) 60%),
    radial-gradient(900px 700px at 100% 100%, rgba(148,163,184,0.45) 0%, rgba(148,163,184,0.0) 70%),
    linear-gradient(160deg, #f9fafb 0%, #e5e7eb 45%, #d1d5db 100%);
  border-radius: 0;    /* sharp edges */
  box-shadow: 0 18px 40px rgba(15,23,42,0.35);
  border: 1px solid rgba(148,163,184,0.35);
  padding: 18px 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 110px;
}

.site-menu-main{
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.site-menu-column{
  min-width: 110px;
}

.site-menu-column h3{
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 800;
}

.site-menu-link{
  display: block;
  padding: 4px 0;
  border: 0;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  color: #353940;           /* darker base grey */
  cursor: pointer;
  text-decoration: none;    /* no underline on any menu links */
  transition:
    color 120ms ease,
    transform 120ms ease;
}

.site-menu-link:hover{
  color: #0A0B0C;           /* darker on hover */
  transform: translateX(2px);
}

.site-menu-link.is-active{
  color: #111827;
  cursor: pointer;
  text-decoration: none;
}

.site-menu-link.is-active:hover{
  color: #0f172a;
  transform: translateX(1px);
}

.site-menu-link[disabled],
.site-menu-link.is-disabled{
  opacity: 0.6;
}

.site-menu-social{
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.site-menu-social-btn{
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
  color: #4b5563;           /* darker icon grey */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background-color 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.site-menu-social-btn:hover{
  background: #f3f4f6;
  border-color: rgba(148,163,184,0.9);
  transform: translateY(-1px);
}

.site-menu-footer{
  border-top: 1px solid rgba(229,231,235,1);
  padding-top: 12px;
  display: flex;
  flex-direction: column;   /* stack Privacy Policy over Terms of Use */
  gap: 4px;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.site-menu-footer-link{
  border: 0;
  background: transparent;
  padding: 2px 0;
  font-size: 13px;          /* smaller than main menu items */
  font-weight: 700;
  color: #6b7280;           /* darker footer grey */
  cursor: pointer;
  text-decoration: none;    /* no underline on footer links */
  transition:
    color 120ms ease,
    transform 120ms ease;
}

.site-menu-footer-link:hover{
  color: #4b5563;
  transform: translateY(-1px);
}

@media (max-width: 640px){
  .site-menu-card{
    padding: 18px 18px 14px;
  }
  .site-menu-main{
    gap: 24px;
  }
}

/* Top-bar icon buttons (question + sound) */
#top-controls .top-img-btn{
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
}

#top-controls .top-img-btn:focus-visible{
  outline: 3px solid rgba(37,99,235,0.55);
  outline-offset: 4px;
  border-radius: 12px;
}

#top-controls .top-img{
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(15,23,42,0.14));
}

#top-controls .sound-img{
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* Help button — now a plain icon+label like its siblings (see .top-nav-link
   in this file); the old circular badge look is gone. */

/* Hide help button on home/game selection page */
body[data-view="home"] #help-toggle{
  display: none;
}

/* Auth buttons: setup shows both; play shows sign out only */
body[data-route="play"] #top-controls [data-role="auth-free"]{
  display: none;
}

.auth-btn{
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.auth-btn-ghost{
  background: rgba(255,255,255,0.85);
  color: #111827;
}

.auth-btn-primary{
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed); /* solid-ish purple */
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(15,23,42,0.65);
}

/* Jiggle on hover like the START button (text only) */
#top-controls .auth-btn-primary:hover .auth-free-label{
  display: inline-block;
  animation: setupStartWave 700ms ease-in-out infinite;
}

.auth-btn:focus-visible{
  outline: 3px solid rgba(37,99,235,0.55);
  outline-offset: 3px;
}

.mixed-levels-toggle{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
}

/* Keep checkbox accessible but invisible; the image is the UI */
.mixed-levels-toggle input{
  position: absolute;
  opacity: 0;
  pointer-events: auto;
}

.mixed-levels-img{
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

[data-route="play"][data-game="squares"] #game-area {
  width: 100% !important;
  max-width: none !important;
  display: block;
}

/* Auth pages hide the right-hand icon buttons, which are redundant next to the
   form itself. signup.php is the exception: it keeps its own Sign in link next
   to the hamburger (login.php IS the sign-in page, so it still hides its copy).
   The .top-nav section links are NOT hidden here — Games and Tools are
   the site's public sections and stay reachable from every page.
   Direct-child combinator only (`>`), matching css/auth.css's copy of this
   same rule: the admin locale-preview control (php/locale.php) is a nested
   <details>/<summary>; a descendant selector here would hide its summary. */
body[data-view="auth"] .top-right > .top-nav-link,
body[data-view="signup"] .top-right > .top-nav-link:not([href="/login.php"]){
  display: none;
}

/* ==================================================================
   SLIDE-IN MENU — opened by #account-trigger at every viewport width.
   Markup is server-rendered by header.php but only occupies space /
   intercepts input while .is-open (drawer) or unhidden (backdrop).
   Holds nav shortcuts (admin only, hidden on phones via
   .top-nav.has-mobile-drawer below) plus the account/legal links
   everyone gets.
   ================================================================== */

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.32);
  z-index: 398;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(56vw, 210px); /* fit the content (icon + label + chevron), not the full 85vw spec */
  background: #f7faff;
  box-shadow: -8px 0 32px rgba(15,23,42,0.22);
  border-radius: 16px 0 0 16px;
  z-index: 399;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-drawer.is-open {
  transform: translateX(0);
}

.mobile-nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148,163,184,0.25);
  flex-shrink: 0;
}

.mobile-nav-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 100ms ease, color 100ms ease;
}

.mobile-nav-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 20px;
}

/* Games/Tools shortcuts inside the drawer duplicate the top-nav row above
   640px (see .top-nav.has-mobile-drawer below, which hides that row only
   on phones) — so keep them out of the drawer except at that same width. */
.mobile-nav-shortcuts {
  display: none;
}

/* ...unless the drawer is carrying the whole nav. A variant that empties the
   top-nav row (php/homepage_variant.php) leaves this list as the only route to
   Games, Tools and Contribute, so it shows at every width, not just on a
   phone. See $_drawerShortcutsAtAllWidths in php/header.php. */
.mobile-nav-drawer--carries-nav .mobile-nav-shortcuts {
  display: block;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  min-height: 50px;
  border-radius: 10px;
  text-decoration: none;
  color: #374151;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid rgba(148,163,184,0.16);
}

.mobile-nav-links .mobile-nav-link:last-of-type {
  border-bottom: none;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible {
  background: rgba(148,163,184,0.14);
  outline: none;
}

.mobile-nav-link .nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mobile-nav-link .nav-icon--mysets {
  width: 33px;
}

.mobile-nav-label {
  flex: 0 1 auto;
}

.mobile-nav-chevron {
  flex-shrink: 0;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1;
}

.mobile-nav-link.is-active {
  color: #1d4ed8;
  background: rgba(59,130,246,0.08);
}

.mobile-nav-link.is-active .mobile-nav-label {
  text-decoration: underline;
  text-decoration-color: #3b82f6;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.mobile-nav-link.is-active .mobile-nav-chevron {
  color: #3b82f6;
}

.mobile-nav-divider {
  height: 1px;
  margin: 10px 12px;
  border: none;
  background: rgba(148,163,184,0.35);
}

/* Account section: My Account/Contact use the standard .mobile-nav-link
   look; legal links are de-emphasized, Sign out is flagged red. */
.mobile-nav-link-small {
  min-height: 38px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.mobile-nav-signout {
  color: #dc2626;
}

.mobile-nav-signout:hover,
.mobile-nav-signout:focus-visible {
  background: rgba(220,38,38,0.08);
}

/* Body scroll lock while the drawer is open */
body.mobile-nav-open {
  overflow: hidden;
}

/* ==================================================================
   MOBILE HEADER — phones (≤640px)
   ================================================================== */

@media (max-width: 640px) {
  /* Tighten header padding on phones */
  #top-controls {
    padding: 0 10px;
    gap: 10px;
  }

  /* Ensure right-side icons have comfortable spacing */
  .top-right {
    gap: 10px;
  }

  .header-sets-link { min-height: 34px; padding: 0 5px 0 3px; font-size: 12px; }
  .header-sets-link img { width: 27px; height: 27px; }

  /* Header space is scarcest here, so the account CTA moves out of the header
     and down above the footer (php/footer.php). Kept in the DOM rather than
     removed server-side so the footer copy is a pure CSS swap. */
  .worksheet-guest-cta { display:none; }
  .footer-guest-cta-band {
    display:flex;
    justify-content:center;
    /* Sits above .site-footer's border-top, so it reads as the last thing on
       the page rather than as part of the copyright strip. */
    padding:28px 16px 24px;
  }

  /* Shrink sound icon slightly so it doesn't crowd hamburger */
  #top-controls .sound-img {
    height: 24px;
  }

  .top-nav {
    gap: 6px;
  }

  .top-nav .top-nav-link {
    flex-direction: row;
    justify-content: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 9px;
  }


  .top-nav .nav-icon {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
  }

  .top-nav .nav-icon--mysets {
    width: 33px;
    max-width: 33px;
  }

  .top-nav .nav-label {
    line-height: 1.1;
  }

  /* Full teacher nav (Home…Contribute) collapses into the hamburger drawer
     below instead of a horizontally-scrolling icon strip. */
  .top-nav.has-mobile-drawer {
    display: none;
  }

  /* ...and the drawer's Games/Tools shortcuts (hidden by default, above)
     take its place here. */
  .mobile-nav-shortcuts {
    display: block;
  }
}

/* ── Section divider (filter → results on Worksheets / Lessons) ── */
.section-divider {
  display: block;
  width: min(720px, 78%);
  height: 2px;
  margin: 20px auto 0;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.65) 25%, rgba(255,255,255,0.65) 75%, transparent);
  border: none;
  box-shadow: 0 0 10px rgba(255,255,255,0.35);
}
