/**
 * The syllabus look, for the pages that came before it.
 *
 * index.html and kids.html are drawn with src/learn/learn.css:
 * white surfaces on a pale sky, indigo for the thing to press, soft blue
 * shadows instead of a coloured rim, and the content across the whole screen.
 * The older pages — the teacher console, the class report, progress, sign-in,
 * install, privacy and the tracing lesson — were each drawn in the cream-card,
 * coral-button style that came first, and every one of them carries its own
 * copy of the same handful of custom properties (--card, --card-edge, --candy,
 * --on-sky, --shadow…).
 *
 * So this file does not restyle them one rule at a time. It is linked last on
 * each page, after the page's own <style>, and it:
 *
 *   1. maps those shared properties onto learn.css's palette, which recolours
 *      most of every page at once;
 *   2. puts the syllabus's sky behind them — the gradient, two clouds and the
 *      hills — as one fixed layer, in place of each page's own `.scene`;
 *   3. replaces the rims and cream gradients the properties cannot reach, on
 *      the components the pages share: the header, buttons, fields, cards;
 *   4. lets the narrow pages (install, privacy, progress) use the screen.
 *
 * learn.css itself is not linked here: its class names (.card, .page, .btn,
 * .letter, .star, .chip…) are the same words these pages already use for
 * different things.
 *
 * Opt-in by class: `body.sky` for the six teacher and info pages, and
 * `body.sky-lesson` for trace.html, which keeps its four scenes (the child
 * picks one) and only gets the palette and the new sky for the classroom one.
 */

:root {
  --ink: #1A1B4B;
  --ink-soft: #4A4B72;
  --muted: #5F6088;
  --faint: #9A99B5;
  --line: #E6E2F7;

  /* The old cream card, and its edge, become learn.css's white surface and
     its hairline. */
  --card: #FFFFFF;
  --card-edge: #ECE9F8;

  /* The coral "press me" colour becomes the syllabus's indigo. */
  --candy: #3B3FD8;
  --candy-dark: #2A2DB0;
  --accent2: #E8357E;

  /* Text that sat straight on the sky. The sky is pale now, so it is ink. */
  --on-sky: #1A1B4B;
  --on-sky-soft: #4A4B72;
  --on-sky-line: rgba(26, 27, 75, .12);

  --brand-navy: #1A1B4B;
  --brand-blue: #3B3FD8;

  --sky-shadow: 0 14px 28px -14px rgba(40, 60, 140, .45);
  --sky-shadow-lg: 0 24px 50px -22px rgba(40, 60, 140, .55);
  --shadow: var(--sky-shadow);
  --shadow-sm: var(--sky-shadow);
  --shadow-md: var(--sky-shadow-lg);

  --sky-gutter: clamp(14px, 2.4vw, 32px);   /* learn.css --gutter */
}

/* ================================================================== the sky */

/* On <html>, so the body can be transparent and the layer below can sit
   between them. Only the themed pages link this file, so it is unconditional
   (no :has(), which older Android WebViews lack). */
html {
  background: linear-gradient(180deg, #DDF3FF 0%, #EEF8FF 45%, #FBF8F3 100%) fixed;
}
body.sky, body.sky.brand-bg {
  background: transparent;
  color: var(--ink);
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Devanagari', sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* The syllabus's clouds and hills, as one fixed layer behind the page. Drawn
   with the same paths so the two skies are the same sky. */
body.sky::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 220'%3E%3Cpath d='M620 150a22 22 0 0 1 4-43 30 30 0 0 1 56-6 24 24 0 0 1 40 10 20 20 0 0 1 20 39z' fill='%23fff' opacity='.9'/%3E%3Cpath d='M300 118a16 16 0 0 1 3-31 22 22 0 0 1 40-4 17 17 0 0 1 29 7 14 14 0 0 1 14 28z' fill='%23fff' opacity='.9'/%3E%3Cpath d='M1000 90a16 16 0 0 1 3-31 22 22 0 0 1 40-4 17 17 0 0 1 29 7 14 14 0 0 1 14 28z' fill='%23fff' opacity='.8'/%3E%3C/svg%3E") top center / 100% auto no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 200' preserveAspectRatio='none'%3E%3Cpath d='M0 60 C 220 0 420 20 620 60 S 980 -10 1280 50 V200 H0z' fill='%23C3EFC9'/%3E%3Cpath d='M0 115 C 260 55 480 75 720 105 S 1080 55 1280 95 V200 H0z' fill='%238FE0A8'/%3E%3C/svg%3E") bottom center / 100% min(26vh, 200px) no-repeat;
}
/* Each page's own painted sky, now drawn once by the layer above. */
body.sky .scene { display: none; }

/* ================================================================ the header */

body.sky .app-header {
  background: rgba(255, 255, 255, .82);
  border-bottom: 0;
  box-shadow: 0 10px 24px -20px rgba(40, 60, 140, .6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-left: max(var(--sky-gutter), env(safe-area-inset-left));
  padding-right: max(var(--sky-gutter), env(safe-area-inset-right));
  min-height: 64px;
}
body.sky .ah-name, body.sky .ah-name span { color: var(--ink); text-shadow: none; }
body.sky .ah-name span { color: var(--candy); }
body.sky .ah-class { color: var(--muted); }
/* learn.css's .pill-btn: white, round, lifted by a shadow rather than a rim. */
body.sky .ah-btn {
  min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px;
  background: var(--card); color: var(--ink);
  box-shadow: var(--sky-shadow);
  font-size: 14.5px;
}
body.sky .ah-btn:hover { background: #F7F6FC; }
body.sky .ah-btn:active { transform: translateY(2px) scale(.98); }
body.sky .ah-btn.accent { background: var(--candy); color: #fff; box-shadow: 0 14px 24px -12px var(--candy); }
body.sky .ah-btn.accent:hover { background: #4C50E6; }

/* ============================================================ type on the sky */

body.sky h1, body.sky .page-title { color: var(--ink); text-shadow: none; letter-spacing: -.02em; }
body.sky .sub, body.sky .page-sub { color: var(--muted); }

/* ================================================================ the buttons */

body.sky .primary-btn,
body.sky .link-btn:not(.subtle) {
  border: 0; border-radius: 999px;
  min-height: 54px;
  background: var(--candy); color: #fff;
  box-shadow: 0 14px 24px -12px var(--candy);
  font-weight: 800;
}
body.sky .primary-btn:hover, body.sky .link-btn:not(.subtle):hover { background: #4C50E6; }
body.sky .primary-btn:active, body.sky .link-btn:active { transform: translateY(2px) scale(.98); box-shadow: 0 8px 16px -12px var(--candy); }
body.sky .link-btn.subtle {
  border: 0; border-radius: 999px;
  background: var(--card); color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line);
}

/* The teacher console's own buttons (home.html). */
body.sky .btn-dark { background: var(--candy); color: #fff; border-color: transparent; box-shadow: 0 14px 24px -12px var(--candy); }
body.sky .btn-dark:hover { background: #4C50E6; }
body.sky .btn-ghost { background: var(--card); color: var(--ink); border-color: transparent; box-shadow: inset 0 0 0 2px var(--line); }
body.sky .btn-ghost:hover { background: #F7F6FC; }
body.sky .btn-light { background: var(--card); color: var(--ink); box-shadow: var(--sky-shadow); }

/* ================================================================= the fields */

body.sky .field-label { color: var(--ink); }
body.sky .field input, body.sky .field select, body.sky .pin-input {
  border: 2px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--ink);
  min-height: 52px;
}
body.sky .field input:focus, body.sky .field select:focus, body.sky .pin-input:focus {
  outline: none; border-color: var(--candy);
  box-shadow: 0 0 0 4px rgba(59, 63, 216, .14);
}
body.sky .field input::placeholder { color: var(--faint); }
body.sky .form-error { background: #FFE9E4; color: #A12A20; border: 0; border-radius: 14px; }

/* ================================================================== the cards */

/* Every surface the pages draw — sign-in, install and privacy cards, report
   tiles and panels, progress totals and lessons, the console's lesson cards
   and stats — becomes learn.css's: white, a hairline, a soft blue shadow. */
body.sky .login-card,
body.sky .card,
body.sky .tile,
body.sky .panel,
body.sky .total,
body.sky .lesson,
body.sky .stats,
body.sky .pin-gate,
body.sky .addr {
  background: var(--card);
  border-color: var(--card-edge);
  box-shadow: var(--sky-shadow);
}
body.sky .login-card, body.sky .pin-gate { box-shadow: var(--sky-shadow-lg); border: 0; border-radius: 32px; }

/* Notes and warnings: learn.css's warn colours. */
body.sky .note, body.sky .empty, body.sky .never, body.sky .advice {
  background: #FFF4D2; color: #6B4A00; border-color: #FFC21A;
}
body.sky code { background: #F3F1FA; color: var(--ink); }
body.sky .bar, body.sky .goal-bar { background: var(--line); }

body.sky a { color: inherit; }
body.sky .privacy-note a, body.sky .privacy-line a, body.sky .foot a, body.sky .back,
body.sky .contact a, body.sky .console-foot a, body.sky p a { color: var(--candy); }

/* The mark on its own, as on the syllabus pages: no chip behind it. */
body.sky .brand-mark { background: none; box-shadow: none; border-radius: 0; }
body.sky .brand-tag { color: var(--muted); }
body.sky .brand-badge { color: #13804F; background: #E7F7EE; border-color: #C9EFD9; }
body.sky .version-note { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  body.sky .ah-btn:active, body.sky .primary-btn:active { transform: none; }
}

/* ============================================================== the lesson */

/* trace.html. The board, the canvases and the four scenes are the lesson's
   own; only the palette and the classroom scene's sky change. */
body.sky-lesson {
  --ink: #1A1B4B;
  --muted: #4A4B72;
  --card: rgba(255, 255, 255, .96);
  --shadow: 0 24px 50px -22px rgba(40, 60, 140, .55);
  --accent: #3B3FD8;
}
body.sky-lesson .scene-classroom {
  background: linear-gradient(180deg, #DDF3FF 0%, #EEF8FF 45%, #FBF8F3 100%);
}
body.sky-lesson .scene-classroom::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 220'%3E%3Cpath d='M620 150a22 22 0 0 1 4-43 30 30 0 0 1 56-6 24 24 0 0 1 40 10 20 20 0 0 1 20 39z' fill='%23fff' opacity='.9'/%3E%3Cpath d='M300 118a16 16 0 0 1 3-31 22 22 0 0 1 40-4 17 17 0 0 1 29 7 14 14 0 0 1 14 28z' fill='%23fff' opacity='.9'/%3E%3Cpath d='M1000 90a16 16 0 0 1 3-31 22 22 0 0 1 40-4 17 17 0 0 1 29 7 14 14 0 0 1 14 28z' fill='%23fff' opacity='.8'/%3E%3C/svg%3E") top center / 100% auto no-repeat;
  filter: none;
}
body.sky-lesson .scene-classroom::after {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1280 200' preserveAspectRatio='none'%3E%3Cpath d='M0 60 C 220 0 420 20 620 60 S 980 -10 1280 50 V200 H0z' fill='%23C3EFC9'/%3E%3Cpath d='M0 115 C 260 55 480 75 720 105 S 1080 55 1280 95 V200 H0z' fill='%238FE0A8'/%3E%3C/svg%3E") bottom center / 100% min(26vh, 200px) no-repeat;
}

/* ========================================================= the teacher console */

/* home.html's class tiles: the cream gradient and gold rim become a white
   card, and the "next up" banner takes the indigo of the syllabus's own
   closing band. */
body.sky .class-tile {
  background: var(--card);
  border-color: transparent;
  box-shadow: var(--sky-shadow-lg);
}
body.sky .class-tile:hover { box-shadow: 0 30px 56px -24px rgba(40, 60, 140, .6); }
body.sky .class-tile:active { box-shadow: var(--sky-shadow); }
body.sky .next-up {
  background: linear-gradient(120deg, #4C6FFF, #3B3FD8 55%, #7445E8);
  border-color: transparent;
  box-shadow: 0 30px 50px -28px rgba(59, 63, 216, .9);
}
body.sky .section-chip {
  background: var(--card); color: var(--ink);
  border-color: transparent; border-radius: 999px;
  box-shadow: inset 0 0 0 2px var(--line);
  min-height: 40px;
}
body.sky .section-chip[aria-pressed="true"] { background: var(--candy); color: #fff; box-shadow: 0 10px 18px -10px var(--candy); }
body.sky .ring-track { stroke: var(--line); }
body.sky .heat-0 { background: #F3F1FA; color: var(--faint); border-color: var(--line); }
