/* ============================================================
   Bloom — site styles · "Meadow" v1 (see Bloom_Style_Sheet_Meadow)
   Khan Kids' warm structure × Toca Boca's bold play ×
   Teach Your Monster's adventure magic:
   cool morning-sky paper · white cards with soft offset shadows ·
   Fredoka display + Andika (literacy typeface) body ·
   leaf green = grow/done · sky blue = video things ·
   coral = today/celebrate · sunny gold = reward ·
   midnight reserved for special moments
   ============================================================ */

/* ---------- Self-hosted fonts (no CDN — school filters) ---------- */
@font-face {
  font-family: 'Andika';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/andika-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Andika';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/andika-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/fredoka-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/fredoka-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/fredoka-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/fredoka-latin-700-normal.woff2') format('woff2');
}

/* ---------- Tokens (Meadow) ---------- */
:root {
  /* surfaces & ink */
  --paper: #e9f1f9;          /* morning sky — deepened 29 Jul so white
                                cards visibly float (projectors crush
                                the old near-white contrast) */
  --paper-2: #e9f1f9;        /* soft wells (was the faf7ef tint) */
  --ink:   #2e2c45;          /* soft indigo, never pure black */
  --ink-soft: #5c5877;
  --card:  #ffffff;
  --line-c: rgba(46, 44, 69, 0.16);

  /* brights + text-safe deeps */
  --green: #4caf6e;          /* leaf — grow, go, done */
  --green-deep: #1f7a46;
  --green-soft: rgba(76, 175, 110, 0.16);
  --sky: #3fa9e0;            /* video things */
  --sky-deep: #17709f;
  --coral: #f4606c;          /* today, celebrate */
  --coral-deep: #d63a4e;
  --sunny: #ffb733;          /* reward gold */
  --violet: #8b6fd6;         /* imagine — SOS group colour (30 Jul) */
  --violet-deep: #6b4fc0;
  --midnight: #232a56;       /* special moments only */
  --midnight-2: #2f3a75;

  /* legacy alias — "beige" is now the paper shade */
  --beige: #e4eef6;
  --beige-press: #d6e5f1;

  /* shape, depth, motion */
  --line:  2px solid var(--line-c);
  --radius: 16px;
  --shadow: 0 3px 0 rgba(46, 44, 69, 0.10);
  --shadow-press: 0 1px 0 rgba(46, 44, 69, 0.10);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --hand: 'Fredoka', 'Segoe UI Rounded', 'Comic Sans MS', system-ui, sans-serif;
  --body: 'Andika', 'Segoe UI', 'Comic Sans MS', system-ui, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  /* sticky footer: the meadow horizon sits at the bottom of the
     viewport on short pages, and after the content on long ones */
  display: flex; flex-direction: column;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }

/* ---------- Top navigation ---------- */
.nav {
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap; /* five tabs since the nav redo (29 Jul) — wrap, never clip, on narrow screens */
  padding: 12px 22px;
  background: var(--card); /* white bar over the deeper paper — the
                              nav reads as its own layer */
  border-bottom: var(--line);
  position: sticky; top: 0; z-index: 50;
}
.nav .brand {
  font-family: var(--hand);
  font-weight: 700; font-size: 27px; line-height: 1;
  margin-right: 22px; color: var(--green-deep);
}
.nav .tab {
  padding: 6px 14px;
  white-space: nowrap;
  font-family: var(--hand); font-weight: 500;
  font-size: 16px; color: var(--ink-soft);
  border-radius: 999px;
  border-bottom: 3px solid transparent;
}
.nav .tab:hover { color: var(--ink); background: var(--beige); }
.nav .tab.on { color: #fff; background: var(--green-deep); }
.nav .spacer { margin-left: auto; }

/* ---------- Page scaffold ---------- */
/* near full-width (Krish, 29 Jul): the content uses the whole
   screen with breathing room at the edges — played on desktops
   and tablets in landscape */
.page { width: 100%; margin: 0 auto; padding: 30px clamp(20px, 3.5vw, 48px) 60px; }
.page-title {
  font-family: var(--hand);
  font-size: 33px; font-weight: 600; line-height: 1.1; margin-bottom: 4px;
}
.page-sub { color: var(--ink-soft); font-size: 17px; margin-bottom: 26px; }

.card {
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* sentence case, never ALL CAPS — beginner readers learn word
   shapes (Meadow reskin, 29 Jul) */
.kicker {
  font-family: var(--hand); font-weight: 500;
  font-size: 15px; letter-spacing: 0.3px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 22px; font-size: 17px;
  font-family: var(--hand); font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--bounce), box-shadow 0.12s;
}
.btn:hover { background: var(--beige); }
.btn:active { transform: translateY(2px) scale(0.97); box-shadow: var(--shadow-press); }

.note { color: var(--ink-soft); font-size: 15px; }

/* ---------- Home ---------- */
.hero-card { padding: 26px 28px; }
.hero-card .week-title {
  font-family: var(--hand);
  font-size: 38px; font-weight: 600; line-height: 1.05; margin: 4px 0 8px;
}
.watched-tag { color: var(--green-deep); font-size: 18px; }
.watch-cta {
  font-size: 20px; padding: 14px 32px; margin-top: 14px;
  background: var(--green-deep); border-color: var(--green-deep); color: #fff;
}
.watch-cta:hover { background: #24894f; }

.tick-btn {
  width: 100%; margin-top: 14px;
  font-size: 22px; padding: 12px;
  background: var(--card);
  border: 2px solid var(--ink); border-radius: var(--radius);
}
.tick-btn:hover { background: var(--beige); }
.tick-btn.done { background: var(--green-soft); color: var(--green-deep); border-color: var(--green-deep); }

.dots { display: flex; gap: 10px; margin-top: 18px; }
.dot  { flex: 1; text-align: center; }
.dot .bubble {
  width: 36px; height: 36px; margin: 0 auto 4px;
  border-radius: 50%;
  border: 2px solid var(--line-c);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: transparent; background: var(--card);
}
.dot.on .bubble { background: var(--green); border-color: var(--green-deep); color: #fff; }
.dot .lbl { font-size: 14px; color: var(--ink-soft); }

/* --- Home: the week as a calendar (Home Calendar wireframes, 29 Jul) ---
   One "this week" section; five calendar-day tiles; hanging sticker
   tags. The colour code is a product decision, not a styling whim:
   sky blue = video things · leaf green = done · coral = today. */

/* section header: week number big, adventure title beside it,
   w/c date quiet on the right */
.sechead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.sechead .wk { font-family: var(--hand); font-size: 31px; font-weight: 600; line-height: 1; }
.sechead .advt { font-family: var(--hand); font-size: 23px; font-weight: 500; color: var(--ink-soft); }
.sechead .wc { margin-left: auto; font-size: 14px; color: var(--ink-soft); }

/* the Mon–Fri strip. Top margin leaves air for the hanging tags;
   wrapping keeps calendar order on narrow screens. */
.cal-strip { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* a day tile: head band + date number, like a real calendar page */
.cal {
  flex: 1 1 0; min-width: 56px; min-height: 122px;
  border: 2px solid var(--line-c); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
  display: flex; flex-direction: column; position: relative;
}
.cal .head {
  background: var(--beige); border-bottom: 2px solid var(--line-c);
  border-radius: 14px 14px 0 0;
  font-family: var(--hand); font-weight: 500;
  text-align: center; font-size: 13px; padding: 3px 0; letter-spacing: 0.5px;
}
.cal .num { font-size: 19px; text-align: center; padding: 2px 0 0; font-family: var(--hand); }
.cal .body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px;
}
.cal .body.pad { padding: 10px; }

/* future: white and warm with a "still growing" sprout — never
   grey, never locked-looking (Meadow reskin). missed: nothing at
   all — the quiet gap in the chain is the only signal (no ✗, no
   red, no word). */
.cal.future { box-shadow: none; color: var(--ink-soft); }
.cal.future .num { opacity: 0.7; }
.cal .sprout { font-size: 22px; line-height: 1; }
.cal .grow-lbl { font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.25; padding: 0 4px; }

/* missed days are tap targets → the Lesson page while the video
   is unwatched, the Daily Quests page (steps, catch-up ticks)
   once it is */
.cal.tap { transition: transform 0.24s var(--bounce); }
.cal.tap:hover { background: var(--paper-2); transform: scale(1.02); }
.cal.tap:active { transform: scale(0.98); }

/* done: the activated button — solid leaf, pressed in */
.cal.done {
  background: var(--green); border: 3px solid var(--green-deep);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.22);
}
.cal.done .head { background: var(--green-deep); color: #fff; border-bottom-color: var(--green-deep); }
.cal.done .num { color: #fff; opacity: 0.85; }
.cal.done .body { color: #fff; font-size: 34px; font-weight: 700; }

/* today: the wide, warm tile — the day's one action lives here */
.cal.today {
  flex: 3 1 240px; min-height: 172px;
  border: 3px solid var(--ink); background: #fffdf6; opacity: 1;
}
.cal.today .head { background: var(--sunny); font-weight: 600; font-size: 14px; border-bottom-color: var(--line-c); }
.cal.today.ticked {
  background: var(--green); border-color: var(--green-deep);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.22);
}
.cal.today.ticked .head { background: var(--green-deep); color: #fff; border-bottom-color: var(--green-deep); }

/* hanging sticker tags, top-right: coral TODAY / sky ADVENTURE ✓
   (t-adv rides higher and smaller so the day name stays legible
   on the narrow tiles) */
.cal-tag {
  position: absolute; top: -13px; right: -8px; transform: rotate(3deg);
  font-family: var(--hand); font-weight: 600;
  color: #fff; font-size: 13px; letter-spacing: 0.3px;
  padding: 2px 10px; border-radius: 999px; border: 2px solid #fff;
  box-shadow: var(--shadow);
  white-space: nowrap; z-index: 2;
}
.cal-tag.t-today { background: var(--coral); font-size: 14px; padding: 3px 13px; }
.cal-tag.t-adv {
  background: var(--sky-deep); top: -17px;
  font-size: 11px; letter-spacing: 0.2px; padding: 2px 9px;
}

/* video thumbnails — always sky blue (real thumbnails: a later pass) */
.cal .thumb {
  flex: 1; min-height: 0; margin: 5px 6px 6px;
  border: 2px solid var(--sky-deep); border-radius: 10px;
  background: repeating-linear-gradient(45deg, var(--sky-deep), var(--sky-deep) 6px, #1e85bc 6px, #1e85bc 12px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
  transition: transform 0.24s var(--bounce);
}
.cal .thumb:hover { transform: scale(1.03) rotate(-0.5deg); }
.cal .thumb.big {
  width: 100%; margin: 0; flex-direction: column; gap: 6px;
  font-size: 36px; min-height: 96px;
}
.cal .thumb .thumb-sub { font-size: 15px; text-align: center; line-height: 1.2; font-family: var(--hand); font-weight: 500; }

/* the slim ADVENTURE ✓ line on the watch day (order: video first) */
.cal .advline {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--sky-deep); font-weight: 700; letter-spacing: 0.2px;
  font-family: var(--hand);
}
.cal .advline .mini {
  width: 26px; height: 16px; border: 2px solid var(--sky-deep); border-radius: 4px;
  background: repeating-linear-gradient(45deg, var(--sky-deep), var(--sky-deep) 4px, #1e85bc 4px, #1e85bc 8px);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 8px;
}

/* inside the today tile */
.cal .eyebrow { font-family: var(--hand); font-weight: 500; font-size: 14px; letter-spacing: 0.3px; color: var(--ink-soft); }
.cal .cardname {
  font-family: var(--hand); font-size: 24px; font-weight: 600;
  line-height: 1.1; text-align: center;
}
.cal .cardname:hover { text-decoration: underline; }
.cal.today.ticked .advline { color: #e4eef6; }
.cal .cal-tick {
  font-family: var(--hand); font-weight: 600;
  border: 2px solid var(--green-deep); border-radius: 999px;
  background: var(--green-deep); color: #fff;
  padding: 8px 22px; font-size: 17px;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--bounce), box-shadow 0.12s;
}
.cal .cal-tick:hover { background: #24894f; }
.cal .cal-tick:active { transform: translateY(2px) scale(0.97); box-shadow: var(--shadow-press); }
.cal .done-big { font-size: 44px; font-weight: 700; color: #fff; line-height: 1; animation: bloom-pop 0.6s var(--bounce); }
@keyframes bloom-pop {
  from { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); }
  to   { transform: scale(1); opacity: 1; }
}
.cal .done-sub { font-size: 16px; color: #fff; font-family: var(--hand); font-weight: 500; }
.cal .cal-undo { font-size: 13px; color: #e2f4e9; text-decoration: underline; }

/* section footer: only line the section ever speaks (weekdone),
   or the weekend catch-up link when the video was never watched */
.cal-foot { text-align: center; font-size: 16px; color: var(--ink-soft); padding-top: 14px; }
.cal-foot .watch-late { color: var(--sky-deep); font-weight: 700; }
.cal-foot .watch-late:hover { text-decoration: underline; }

/* the day that's up next is outlined heavier (2d) */
.dot.today .bubble { border-width: 3.5px; border-color: var(--ink); }
.dot.tappable { cursor: pointer; }
.dot.tappable:hover .bubble { background: var(--beige); }
.dot.tappable.on:hover .bubble { background: var(--green); opacity: 0.85; }
.dot.future { opacity: 0.45; }

/* weekdone: the week closes calmly (2e) */
.weekdone { text-align: center; padding: 14px 0 6px; }
.weekdone .wd-title { font-family: var(--hand); font-size: 33px; font-weight: 600; }
.weekdone .wd-dots { justify-content: center; margin: 14px 0 4px; }
.weekdone .wd-sub { font-size: 18px; color: var(--ink); margin-top: 8px; }
.weekdone .dash-slot { display: inline-block; }

/* welcome back — one line, shown once, dismisses itself (2h) */
.welcome-line {
  background: var(--paper-2);
  border: var(--line); border-radius: var(--radius);
  padding: 10px 16px; font-size: 17px;
  margin-bottom: 16px;
  animation: welcome-fade 9s forwards;
}
@keyframes welcome-fade {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ---------- Lab (admin-only dev controls + pinned-day banner) ---------- */

/* Unmissable thin strip along the bottom whenever a day is pinned.
   The whole strip is a button: tap to clear the pin. */
.lab-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  width: 100%; border: none; cursor: pointer;
  background: var(--midnight); color: #fff;
  padding: 6px 14px; font-size: 14px; font-family: var(--body);
  text-align: center; letter-spacing: 0.02em;
}
.lab-banner:hover { background: var(--midnight-2, #2F3A75); }
body.lab-pinned { padding-bottom: 34px; }

/* The tiny flask — quiet until hovered. Rendered only when an
   admin auth session exists on the device (app.js BloomLab). */
.lab-btn {
  position: fixed; left: 12px; bottom: 12px; z-index: 210;
  width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--line-c); background: var(--card);
  font-size: 16px; line-height: 1; cursor: pointer;
  opacity: 0.45; padding: 0;
}
.lab-btn:hover, .lab-btn:focus-visible { opacity: 1; box-shadow: var(--shadow, 0 3px 0 rgba(46,44,69,.12)); }
body.lab-pinned .lab-btn { bottom: 44px; }

/* The panel: one card, right-hand side, over whatever page is open */
.bl-overlay.lab-overlay { align-items: stretch; justify-content: flex-end; padding: 0; z-index: 300; }
.lab-panel {
  width: 100%; max-width: 380px; margin: 0;
  border-radius: 0; overflow-y: auto;
  padding: 18px 20px 26px;
}
.lab-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lab-title { font-family: var(--hand); font-weight: 600; font-size: 21px; }
.lab-who { color: var(--ink-soft); font-size: 13px; margin-left: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.lab-x { border: none; background: none; font-size: 17px; cursor: pointer; color: var(--ink-soft); padding: 4px; }
.lab-sec { border-top: 1px solid var(--line-c); padding: 12px 0; }
.lab-k { font-family: var(--hand); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 6px; }
.lab-line { font-size: 15px; padding: 2px 0; }
.lab-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.lab-date { font: inherit; font-size: 15px; padding: 6px 10px;
  border: var(--line); border-radius: var(--radius); background: var(--card); }
.lab-small { font-size: 14px; padding: 7px 14px; }
.lab-note { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-top: 8px; }
.lab-errors { max-height: 240px; overflow-y: auto; font-size: 13px; }
.lab-err-row { padding: 7px 0; border-bottom: 1px solid var(--line-c); }
.lab-err-meta { color: var(--ink-soft); font-size: 12px; }
.lab-err-msg { word-break: break-word; }
.lab-err-dev { color: var(--ink-soft); font-size: 11px; word-break: break-word; }
.lab-foot { border-top: 1px solid var(--line-c); padding-top: 12px; font-size: 14px; }

/* ---------- Adventures ---------- */
.adv-list { display: flex; flex-direction: column; gap: 12px; }
.adv-row {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 20px;
  position: relative;
}
.adv-row .wk {
  flex: 0 0 56px; height: 56px; border-radius: var(--radius);
  background: var(--beige); border: var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--hand);
  line-height: 1;
}
.adv-row .wk small { font-size: 11px; letter-spacing: 0.3px; }
.adv-row .wk big   { font-size: 22px; font-weight: 600; }
/* week coins carry their state (Meadow reskin): done = leaf,
   this week = coral, still growing = quiet paper */
.adv-row.watched .wk { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.adv-row.current .wk { background: var(--coral); border-color: var(--coral-deep); color: #fff; }
.adv-row.current { border: 3px solid var(--green); }
.adv-row { transition: transform 0.24s var(--bounce); }
.adv-row:hover { transform: scale(1.015) rotate(-0.3deg); }
.adv-row:active { transform: scale(0.99); }
.adv-row .adv-name { font-family: var(--hand); font-size: 23px; font-weight: 500; line-height: 1.15; }
.adv-row .adv-meta { display: flex; gap: 6px; margin-top: 5px; }
/* quest dots grow into seeds-then-flowers (Meadow reskin) */
.adv-row .mini-dot {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-c); background: var(--beige);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.adv-row .mini-dot.on { background: transparent; border-color: transparent; }
.adv-row .mini-dot.on::after {
  content: '🌸'; font-size: 14px; line-height: 1;
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.adv-row .adv-tick {
  margin-left: auto;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.adv-tick .tick-circle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--line-c);
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 20px;
  position: relative;
}
.adv-row.watched .tick-circle { background: var(--green); border-color: var(--green-deep); }
.adv-row.watched .tick-circle::after {
  content: '🌼'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; color: #fff;
}
/* "this week" — a coral sticker resting on the card edge,
   sentence case (was floating red text) */
.here-tag {
  font-family: var(--hand);
  position: absolute; top: -15px; left: 18px; transform: rotate(-2deg);
  background: var(--coral); color: #fff;
  font-size: 15px; font-weight: 600;
  padding: 4px 15px; border-radius: 999px; border: 2px solid #fff;
  box-shadow: var(--shadow);
  white-space: nowrap; z-index: 2;
}
/* future weeks: never grey, never locked-looking — a sprout,
   still growing */
.adv-row.future .adv-name { color: var(--ink); }
.adv-row.future .tick-circle { border-color: var(--line-c); background: var(--card); }
.adv-row.future .tick-circle::after {
  content: '🌱'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}
.adv-row.future .adv-tick::after {
  content: 'still growing';
  font-size: 12.5px; color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- Lesson ---------- */
.back-link { display: inline-block; font-size: 17px; color: var(--ink-soft); margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
/* the story stage (Meadow reskin): the week's video sits on a
   starred midnight panel — the special-moment register, reserved
   for exactly this */
.story-stage {
  /* the one width cap that stays: an uncapped 16:9 video grows
     taller than the screen on wide monitors */
  max-width: 1280px;
  background:
    radial-gradient(circle 2.5px at 6% 22%, rgba(255,255,255,0.55) 98%, transparent),
    radial-gradient(circle 2px at 13% 62%, rgba(255,255,255,0.4) 98%, transparent),
    radial-gradient(circle 3px at 91% 18%, rgba(255,255,255,0.55) 98%, transparent),
    radial-gradient(circle 2px at 84% 70%, rgba(255,255,255,0.4) 98%, transparent),
    radial-gradient(circle 2.5px at 96% 46%, rgba(255,255,255,0.45) 98%, transparent),
    linear-gradient(180deg, var(--midnight) 0%, var(--midnight-2) 100%);
  border-radius: 22px;
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
}
.stage-label {
  font-family: var(--hand); font-weight: 600;
  color: #fff; font-size: 18px; margin-bottom: 12px;
}
.video-frame {
  background: #101430; border: none; border-radius: 14px;
  aspect-ratio: 16 / 9; width: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #e4eef6; font-size: 20px;
  overflow: hidden;
}
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.lesson-note { color: var(--ink-soft); font-size: 15px; margin-top: 10px; }

/* ---------- SOS (icon-tile redesign, 30 Jul — Wireframes v2) ----------
   Shelves: each group is a full-width row on a 3-column grid,
   padded to three slots by sos.html. Tiles are GENERATED: group
   colour gradient + white library icon (icons.js) + name on a
   scrim. Within a shelf the gradient cycles three shade steps by
   sort order. Uploaded images (games.tile_url) remain a dormant
   full-bleed override for games with no icon. */
.sos-group { margin-bottom: 44px; }
.sos-group h2 {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--hand);
  font-size: 27px; font-weight: 600; margin-bottom: 14px;
}
.grp-dot { width: 15px; height: 15px; border-radius: 50%; flex: none; }
.grp-dot.sky    { background: var(--sky); }
.grp-dot.violet { background: var(--violet); }
.grp-dot.coral  { background: var(--coral); }
.grp-dot.leaf   { background: var(--green); }
.grp-dot.sunny  { background: var(--sunny); }

.tile-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
@media (min-width: 860px) {
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
}

.game-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 24px;             /* Meadow's touchable register */
  overflow: hidden;
  display: block;
  box-shadow: var(--shadow);
  transition: transform 0.24s var(--bounce);
}
.game-tile:hover { transform: scale(1.04) rotate(-1deg); }
.game-tile:active { transform: scale(0.98); box-shadow: var(--shadow-press); }
.game-tile .art {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
/* the icon is the hero: ~64% of the tile, nudged above the scrim */
.game-tile .art svg {
  width: 64%; height: 64%; margin-bottom: 9%;
  filter: drop-shadow(0 2px 0 rgba(35, 42, 86, 0.15));
}
/* dormant override: admin-uploaded art fills the frame (cover
   crops, never squashes) */
.game-tile .art.photo img { width: 100%; height: 100%; object-fit: cover; }
.game-tile .scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52%;
  background: linear-gradient(180deg, rgba(35, 42, 86, 0) 0%, rgba(35, 42, 86, 0.55) 85%);
}
.game-tile .name {
  position: absolute; left: 16px; right: 16px; bottom: 12px;
  color: #fff;
  font-family: var(--hand); font-weight: 600;
  font-size: 21px; line-height: 1.2;
  text-shadow: 0 1px 2px rgba(35, 42, 86, 0.4);
}

/* group gradients — three shade steps per colour, assigned by
   sort order (tg-<colour>-<1|2|3> from sos.html). Deterministic:
   a game keeps its exact look day after day. */
.tg-sky-1    { background: linear-gradient(180deg, #9ad4f5 0%, #3fa9e0 100%); }
.tg-sky-2    { background: linear-gradient(180deg, #7fc6ef 0%, #2e93cc 100%); }
.tg-sky-3    { background: linear-gradient(180deg, #b4dff8 0%, #55b4e6 100%); }
.tg-violet-1 { background: linear-gradient(180deg, #c4b4ee 0%, #8b6fd6 100%); }
.tg-violet-2 { background: linear-gradient(180deg, #b29ce8 0%, #7a5bcb 100%); }
.tg-violet-3 { background: linear-gradient(180deg, #d4c8f4 0%, #9c82de 100%); }
.tg-coral-1  { background: linear-gradient(180deg, #fbaab2 0%, #f4606c 100%); }
.tg-coral-2  { background: linear-gradient(180deg, #f98e99 0%, #e24a58 100%); }
.tg-coral-3  { background: linear-gradient(180deg, #fcc1c7 0%, #f77680 100%); }
.tg-leaf-1   { background: linear-gradient(180deg, #a9dcbb 0%, #4caf6e 100%); }
.tg-leaf-2   { background: linear-gradient(180deg, #8fd0a6 0%, #3d9a5e 100%); }
.tg-leaf-3   { background: linear-gradient(180deg, #bfe5cc 0%, #5fba7d 100%); }
.tg-sunny-1  { background: linear-gradient(180deg, #ffd48a 0%, #ffb733 100%); }
.tg-sunny-2  { background: linear-gradient(180deg, #ffc95f 0%, #f0a41e 100%); }
.tg-sunny-3  { background: linear-gradient(180deg, #ffdfa6 0%, #ffc14d 100%); }

/* per-game flower pill — the class's harvest from this game
   (🌼 top-right; added by sos.html when get_game_flowers answers;
   absent entirely on pre-SQL servers / offline) */
.game-tile .tile-flowers {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink); font-weight: 800; font-size: 14px;
  box-shadow: 0 2px 6px rgba(35, 42, 86, 0.18);
  pointer-events: none;
}

/* "a new game is growing" — shelf padding to three slots (things
   that aren't ready are still growing, never locked) */
.game-tile.soon {
  box-shadow: none; cursor: default;
  border: 2.5px dashed var(--line-c);
  background: var(--beige);
}
.game-tile.soon:hover { transform: none; }
.game-tile.soon .inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-soft);
}
.game-tile.soon .em { font-size: 32px; }
.game-tile.soon .tx { font-family: var(--hand); font-weight: 500; font-size: 16px; }

/* ---------- Pupil mode ---------- */
body.pupil .teacher-only { display: none !important; }
.kit-btn {
  display: none;
  align-items: center; gap: 8px;
  background: var(--beige); border: var(--line);
  border-radius: 999px; padding: 5px 16px;
  font-size: 16px;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
body.pupil .kit-btn { display: inline-flex; }
.hold-ring { font-size: 13px; color: var(--ink-soft); }

/* ---------- Help ---------- */
.help-list { display: flex; flex-direction: column; gap: 10px; max-width: 700px; }
.help-item { padding: 0; overflow: hidden; }
.help-item summary {
  list-style: none; cursor: pointer;
  padding: 14px 20px; font-size: 19px;
  font-family: var(--hand); font-weight: 500;
  display: flex; align-items: center;
}
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary::after { content: "▸"; margin-left: auto; color: var(--ink-soft); transition: transform 0.15s; }
.help-item[open] summary::after { transform: rotate(90deg); }
.help-item .answer { padding: 0 20px 16px; color: var(--ink-soft); font-size: 16px; }

/* ---------- Term plan (print) ---------- */
.plan-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.plan-table th, .plan-table td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--line-c); font-size: 17px;
}
.plan-table th { font-family: var(--hand); font-weight: 500; font-size: 14px; letter-spacing: 0.3px; color: var(--ink-soft); }
@media print {
  .nav, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border-color: #999; box-shadow: none; }
  .footer { background: none; padding: 20px 0; }
  .footer::before { content: none; }
}

/* ---------- Footer — the meadow horizon (Meadow reskin) ----------
   Soft hills and a flower row instead of dead whitespace; one
   weird element (the ladybird) lives in every meadow. Pure CSS,
   so every page gets it for free. */
.footer {
  font-family: var(--hand); font-weight: 500;
  text-align: center; color: var(--ink-soft);
  font-size: 17px; padding: 46px 0 34px;
  margin-top: auto; /* sticky footer — always at the bottom */
  width: 100%;
  background:
    radial-gradient(62% 130% at 22% 100%, #cde8d6 60%, transparent 61%),
    radial-gradient(64% 140% at 80% 100%, #b9dfc6 60%, transparent 61%);
  background-repeat: no-repeat;
}
.footer::before {
  content: '🌷 \00a0\00a0 🌼 \00a0\00a0 🌻 \00a0\00a0 🐞 \00a0\00a0 🌸 \00a0\00a0 🌼';
  display: block;
  font-size: 21px; line-height: 1;
  margin-bottom: 12px;
}

/* ---------- Class badge + menu (added by app.js) ---------- */
/* The round badge button top-right: which class this device belongs
   to, and the door to help / support / log out. The school name sits
   as quiet text beside it — always visible, pupil mode included;
   long names truncate with an ellipsis rather than wrapping the bar.
   Only the button + menu are teacher-only. */
.badge-wrap { position: relative; margin-left: 8px; display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.badge-school {
  font-size: 15px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 32vw;
}
@media (max-width: 760px) { .badge-school { max-width: 24vw; } }
.badge-btn {
  min-width: 44px; height: 44px; padding: 0 10px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--beige);
  font-family: var(--hand); font-size: 16px; font-weight: 600;
  letter-spacing: 1.5px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--bounce), box-shadow 0.12s;
}
.badge-btn:hover { background: var(--beige-press); }
.badge-btn:active { transform: translateY(1px) scale(0.95); box-shadow: var(--shadow-press); }
.badge-btn[aria-expanded="true"] { background: var(--green-soft); }

.badge-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 250px; z-index: 60;
  background: var(--card); border: var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(46, 44, 69, 0.10);
  overflow: hidden;
}
.badge-menu .bm-head {
  padding: 12px 16px 10px;
  background: var(--paper-2); border-bottom: 2px dashed #c9d8e6;
}
.badge-menu .bm-class { font-family: var(--hand); font-size: 20px; font-weight: 600; line-height: 1.1; }
.badge-menu .bm-school { font-size: 14px; color: var(--ink); margin-top: 2px; }
.badge-menu .bm-teacher { font-size: 13px; color: var(--ink-soft); }
.badge-menu .bm-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 11px 16px; font-size: 16px; color: var(--ink);
  border-top: 1px solid var(--line-c);
}
.badge-menu .bm-item:first-of-type { border-top: none; }
.badge-menu .bm-item:hover { background: var(--beige); }

/* small overlay shared by the logout confirm + support form */
.bl-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(35, 42, 86, 0.38);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.bl-modal { width: 100%; max-width: 420px; padding: 22px 24px; }
.bl-modal h2 { font-family: var(--hand); font-size: 23px; font-weight: 600; line-height: 1.15; margin-bottom: 8px; }
.bl-modal p { font-size: 16px; color: var(--ink-soft); line-height: 1.55; }
.bl-modal .bl-sub { font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; }
.bl-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.bl-quiet { background: var(--paper-2); border-color: var(--line-c); }
.bl-label { display: block; font-size: 14px; color: var(--ink-soft); margin: 10px 0 3px; }
.bl-input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: 12px;
  padding: 8px 12px; resize: vertical;
}
.bl-input:focus { outline: 3px solid var(--green-soft); }
.bl-err {
  border: 2px solid var(--coral-deep); background: #fdecee; border-radius: 12px;
  padding: 8px 12px; font-size: 14px; color: #a02332; margin-top: 10px;
}

/* ---------- The flower pot (rewards, 29 Jul) ----------
   Count + fill bar toward the goal; after the unlock it just
   keeps counting. Rebuilt 29 Jul PM — the original pot styles
   were lost when two same-day sessions both touched this file. */
.pot-card { margin: 16px 0 0; padding: 16px 22px; position: relative; }
.pot-row { display: flex; align-items: center; gap: 14px; }
.pot-flower { font-size: 34px; line-height: 1; }
.pot-main { flex: 1; min-width: 0; }
.pot-count { font-size: 18px; }
.pot-count b { font-size: 21px; }
.pot-sub { font-size: 14px; color: var(--ink-soft); }
.pot-bar {
  height: 14px; margin-top: 6px;
  border: 2px solid var(--line-c); border-radius: 999px;
  background: var(--beige); overflow: hidden;
}
.pot-fill { height: 100%; background: linear-gradient(90deg, var(--green) 0%, var(--green-deep) 100%); border-radius: 999px; transition: width 0.6s var(--bounce); }
.pot-goal { font-size: 15px; color: var(--ink-soft); }
.pot-replay {
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--beige); padding: 6px 14px; font-size: 14px;
  font-family: var(--hand); font-weight: 500;
}
.pot-replay:hover { background: var(--beige-press); }

/* "+100 🌼" drifting up from the pot when a tick lands */
.pot-float {
  position: absolute; right: 26px; top: 6px;
  font-size: 20px; font-weight: 700; color: var(--green-deep);
  pointer-events: none;
  animation: pot-float 1.5s forwards;
}
@keyframes pot-float {
  from { opacity: 0; transform: translateY(8px); }
  20%  { opacity: 1; }
  to   { opacity: 0; transform: translateY(-28px); }
}

/* the unlock celebration — full screen, petals falling.
   Midnight, gold and white: the special-moment register, used
   nowhere else on the everyday pages. */
.celebrate {
  position: fixed; inset: 0; z-index: 120;
  background: linear-gradient(180deg, rgba(35, 42, 86, 0.92), rgba(47, 58, 117, 0.92));
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow: hidden;
}
.petal { position: absolute; top: -50px; animation: petal-fall linear infinite; }
@keyframes petal-fall {
  from { transform: translateY(-6vh) rotate(0deg); }
  to   { transform: translateY(112vh) rotate(320deg); }
}
.cel-card {
  position: relative; z-index: 1;
  background: var(--card); border: var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  padding: 30px 38px; text-align: center; max-width: 440px;
  animation: cel-pop 0.6s var(--bounce);
}
@keyframes cel-pop {
  from { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.08); }
  to   { transform: scale(1); opacity: 1; }
}
.cel-pot { font-size: 56px; line-height: 1; }
.cel-title { font-family: var(--hand); font-size: 34px; font-weight: 600; line-height: 1.05; margin-top: 6px; }
.cel-sub { font-size: 18px; margin-top: 8px; }
.cel-btn {
  margin-top: 20px;
  background: var(--sunny); border-color: var(--sunny); color: var(--ink);
  font-weight: 600; font-size: 18px; padding: 12px 28px;
}
.cel-btn:hover { background: #ffc95c; }

/* ---------- The school garden ----------
   Every class's pot growing together. Name order, never ranked;
   our own row highlighted. */
.garden-card { margin: 16px 0 0; }
.garden-total { font-size: 18px; margin-bottom: 12px; }
.garden-rows { display: flex; flex-direction: column; gap: 8px; }
.garden-row { display: flex; align-items: center; gap: 12px; }
.garden-row.me {
  background: var(--green-soft); border-radius: 10px;
  padding: 5px 8px; margin: 0 -8px;
}
.g-name {
  flex: 0 0 170px; font-size: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-us { color: var(--green-deep); font-size: 14px; }
.g-bar {
  flex: 1; height: 12px; display: block;
  border: 2px solid var(--line-c); border-radius: 999px;
  background: var(--beige); overflow: hidden;
}
.g-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--green) 0%, var(--green-deep) 100%); border-radius: 999px; }
.g-n { flex: 0 0 auto; min-width: 66px; text-align: right; font-size: 15px; color: var(--ink-soft); }
@media (max-width: 560px) { .g-name { flex-basis: 110px; } }

/* ---------- Home identity (added by app.js) ---------- */
/* Whose page this is: the class name, big. The school name lives
   in the nav (always visible) — not repeated here. */
.home-ident { margin: 0 0 14px; line-height: 1.1; }
.home-ident .hi-class {
  display: block;
  font-family: var(--hand); font-size: 26px; font-weight: 600;
}
