/*
 * numba.pl: the app's palette (constants/brand.ts), its tinted keys that sink
 * onto a darker bottom edge, and the galaxy roadmap art on a white page.
 */

:root {
  --ink: #1B2559;
  --muted: #56607A;
  --blue: #0038C3;
  --blue-dark: #002A8F;
  --blue-mid: #2457E6;
  --blue-pale: #EEF3FF;
  --deep: #081E7A;
  --rim: #A9C0FF;
  --fox: #FF8B22;
  --fox-pale: #FFF3E4;
  --coral: #FD4E33;
  --coral-edge: #C2301B;
  --sun: #FFC233;
  --sun-edge: #C27F05;
  --sun-pale: #FFF5D9;
  --lavender-pale: #EEEFFC;
  --green: #19A974;
  --line: #E6EBF5;
  --line-dark: #D3DAE8;
  --track: #EDF1F8;
  --display: "Baloo 2", "Figtree", system-ui, sans-serif;
  --text: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --header: 76px;
  --galaxy: url("assets/sky.svg"), linear-gradient(180deg, var(--blue) 0%, #0A31B4 52%, var(--deep) 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 500 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, figure, blockquote { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 60;
  padding: 10px 16px; border-radius: 12px; background: #fff; color: var(--ink);
  font-weight: 800; text-decoration: none;
}
.skip:focus { top: 12px; }
.nowrap { white-space: nowrap; }

.wrap { width: min(1200px, 100% - 48px); margin-inline: auto; }

:focus-visible { outline: 3px solid var(--blue-mid); outline-offset: 3px; }
.on-dark :focus-visible, .top:not(.is-solid) :focus-visible { outline-color: var(--sun); }

/* --- Type --------------------------------------------------------------------- */

.h1 {
  font: 800 clamp(44px, 5.6vw, 74px)/0.98 var(--display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.h2 {
  font: 800 clamp(34px, 3.8vw, 54px)/1.03 var(--display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.lead {
  margin-top: 20px;
  max-width: 33rem;
  font-size: clamp(18px, 1.4vw, 20px);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* --- Keys and buttons: a face that sinks onto its darker bottom edge ---------- */

.key {
  background: #fff;
  border: 2px solid var(--line);
  border-bottom: 6px solid var(--line-dark);
  border-radius: 24px;
}
.key--fox { background: #FFF3E4; border-color: #FFD6A8; border-bottom-color: #FFBE78; }
.key--progress { background: #EEF3FF; border-color: #CDDAFF; border-bottom-color: #A3BCFF; }
.key--green { background: #E9F8F0; border-color: #B4E9CD; border-bottom-color: #7FD8A9; }
.key--lavender { background: var(--lavender-pale); border-color: #D6D8F7; border-bottom-color: #B6B9EE; }

.btn {
  --edge: var(--coral-edge);
  display: inline-flex; align-items: center; justify-content: center;
  height: 56px; padding: 0 26px;
  border: 0; border-radius: 16px;
  font: 800 18px/1 var(--text); letter-spacing: 0.01em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 5px 0 var(--edge);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge); }
.btn--coral { --edge: var(--coral-edge); background: var(--coral); color: #fff; }
.btn--sun { --edge: var(--sun-edge); background: var(--sun); color: var(--ink); }
.btn--blue { --edge: var(--blue-dark); background: var(--blue-mid); color: #fff; }
.btn--small { height: 44px; padding: 0 18px; border-radius: 14px; font-size: 16px; box-shadow: 0 4px 0 var(--edge); }
.btn--small:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--edge); }
.btn[disabled] { cursor: progress; filter: saturate(0.75); }

.link-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--blue-mid); font-weight: 800; font-size: 15px;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}

/* --- Header ------------------------------------------------------------------- */

.top {
  position: fixed; inset: 0 0 auto; z-index: 40;
  display: flex; align-items: center; height: var(--header);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
/* Over the galaxy the header turns blue once the page moves, then white past it. */
.top.is-scrolled {
  background: rgba(0, 47, 170, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: saturate(1.4) blur(12px);
}
.top.is-solid {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 0 var(--line);
  backdrop-filter: saturate(1.4) blur(12px);
}
.top__inner { display: flex; align-items: center; gap: 28px; }
.brand {
  display: inline-flex; margin-right: auto; padding: 9px 14px 8px;
  border-radius: 14px; background: #fff; color: var(--blue);
  box-shadow: 0 4px 0 rgba(4, 22, 110, 0.35);
  transition: box-shadow 0.2s ease;
}
.brand svg { width: 96px; height: auto; }
.top.is-solid .brand { box-shadow: none; }
.top__nav { display: flex; gap: 28px; }
.top__nav a {
  color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
  text-underline-offset: 6px; text-decoration-thickness: 2px;
}
.top__nav a:hover { text-decoration-line: underline; }
.top.is-solid .top__nav a { color: var(--ink); }

/* --- Hero: the galaxy band with the fox's rocket ------------------------------ */

.on-dark { color: #fff; }
.hero {
  position: relative;
  padding: calc(var(--header) + 36px) 0 128px;
  background: var(--galaxy);
  background-size: cover, auto;
  background-position: 50% 0, 0 0;
  background-repeat: no-repeat;
  overflow: hidden;
}
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(8px, 2vw, 32px);
}
.hero__copy { max-width: 580px; }
.hero__lead {
  margin-top: 22px; max-width: 31rem;
  font-size: clamp(18px, 1.45vw, 21px); line-height: 1.5;
  color: rgba(255, 255, 255, 0.86);
  text-wrap: pretty;
}

.stage { position: relative; aspect-ratio: 680 / 560; margin-right: -3%; }
.stage__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bubble {
  position: absolute; left: 50%; top: 23%;
  padding: 0.6em 1em;
  border-radius: 16px; background: #fff; color: var(--ink);
  font: 800 clamp(13px, 1.2vw, 17px)/1.2 var(--text); white-space: nowrap;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  animation: bubble-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 2.15s both;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 13px; height: 13px; border-radius: 3px; background: #fff;
  transform: translateX(-50%) rotate(45deg);
}

/* The rocket flies its last hop to the current stop, then hovers; the exhaust flickers. */
.rocket { transform-box: fill-box; transform-origin: 50% 50%; animation: fly-in 1.9s cubic-bezier(0.45, 0.05, 0.2, 1) 0.3s both; }
.rocket__bob { animation: bob 2.6s ease-in-out 2.2s infinite alternate; }
.boost { transform-box: fill-box; transform-origin: 100% 50%; animation: boost 1.9s ease-out 0.3s both; }
.flame { transform-box: fill-box; transform-origin: 100% 50%; animation: flicker 0.14s ease-in-out infinite alternate; }
.pulse { transform-box: fill-box; transform-origin: 50% 50%; animation: pulse 2.2s ease-out infinite; }
.rays { transform-box: fill-box; transform-origin: 50% 50%; animation: spin 48s linear infinite; }
.wiggle { transform-box: fill-box; transform-origin: 50% 60%; animation: wiggle 5s ease-in-out 3.4s infinite; }

@keyframes fly-in {
  0% { transform: translate(-250px, 22px) rotate(9deg); opacity: 0; }
  10% { opacity: 1; }
  46% { transform: translate(-124px, 40px) rotate(1deg); }
  78% { transform: translate(-24px, 6px) rotate(-9deg); }
  100% { transform: none; opacity: 1; }
}
@keyframes bob { to { transform: translateY(-7px); } }
@keyframes boost { 0%, 75% { transform: scaleX(1.6); } 100% { transform: scaleX(1); } }
@keyframes flicker { from { transform: scale(0.86, 0.94); } to { transform: scale(1.06, 1.03); } }
@keyframes pulse { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.75); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wiggle {
  0%, 82%, 100% { transform: rotate(0); }
  85% { transform: rotate(-7deg); }
  88% { transform: rotate(6deg); }
  91% { transform: rotate(-4deg); }
  94% { transform: rotate(2deg); }
}
@keyframes bubble-in { from { opacity: 0; scale: 0.5; } to { opacity: 1; scale: 1; } }

/* --- Waiting-list form ---------------------------------------------------------- */

.join { margin-top: 34px; max-width: 540px; }
.join__row {
  display: flex; gap: 8px; padding: 7px;
  border-radius: 22px; background: #fff;
  box-shadow: 0 6px 0 var(--rim);
}
.join__row:focus-within { outline: 3px solid var(--sun); outline-offset: 3px; }
.join.has-error .join__row { outline: 3px solid #FF9A85; outline-offset: 3px; }
.join__input {
  flex: 1; min-width: 0; height: 56px; padding: 0 14px;
  border: 0; background: transparent; outline: none;
  color: var(--ink); font-weight: 600; font-size: 18px;
}
.join__input::placeholder { color: #8A93AB; }
.join__submit { flex: none; }
.join__error { margin-top: 14px; font-weight: 700; font-size: 15px; color: #FFD3CA; }
.join__error:empty { display: none; }

.roles { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.roles legend { margin-bottom: 10px; padding: 0; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.72); }
.role { position: relative; cursor: pointer; }
.role input { position: absolute; inset: 0; opacity: 0; margin: 0; pointer-events: none; }
.role span {
  display: inline-block; padding: 8px 15px;
  border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 999px;
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.role:hover span { border-color: rgba(255, 255, 255, 0.65); }
.role input:checked + span { background: #fff; border-color: #fff; color: var(--ink); }
.role input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

.join__note { margin-top: 16px; max-width: 31rem; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.7); }
.join__note a { color: #fff; text-underline-offset: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.join__done {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px;
  border-radius: 22px; background: #fff; color: var(--ink);
  box-shadow: 0 6px 0 var(--rim); text-align: left;
}
.join__done[hidden] { display: none; }
.join__done img { flex: none; width: 68px; height: 68px; }
.join__done-title { font: 800 26px/1.1 var(--display); outline: none; }
.join__done p + p { margin-top: 2px; color: var(--muted); font-size: 16px; }
.join__done .link-btn { margin-top: 8px; }

/* --- The white sheet that rises over the galaxy ---------------------------------- */

.sheet { position: relative; z-index: 1; margin-top: -48px; border-radius: 48px 48px 0 0; background: #fff; }

/* Levels: every stage of school maths, then the topics from fractions to derivatives. */
.levels { padding: 64px 0 8px; text-align: center; }
.levels__title { font: 800 clamp(28px, 3vw, 42px)/1.1 var(--display); letter-spacing: -0.01em; }
.levels__list {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  max-width: 1040px; margin: 28px auto 0; padding: 0; list-style: none;
}
.level { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 14px 14px; }
.level img { flex: none; width: 76px; height: 76px; }
.level__name { font: 800 21px/1.15 var(--display); text-wrap: balance; }
.topics {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px;
  max-width: 1100px; margin: 24px auto 0; padding: 0 24px 6px; list-style: none;
}
.topic {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px;
  border: 2px solid var(--line); border-radius: 999px; background: #fff;
  box-shadow: 0 4px 0 var(--line-dark);
  font-weight: 700; font-size: 15px; line-height: 1.2; white-space: nowrap;
}
.topic__mark { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--tint); }
.topic__mark svg { width: 18px; height: 18px; }

/* --- Feature rows ---------------------------------------------------------------- */

.feature { padding-block: clamp(56px, 6.5vw, 96px); }
.feature__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center; gap: clamp(40px, 7vw, 112px);
}
.feature--flip .feature__art { order: -1; }
.panel {
  position: relative; display: grid; place-items: center;
  padding: clamp(28px, 4vw, 56px); border-radius: 44px;
}
.panel--fox { background: var(--fox-pale); padding-block: 0; }
.panel--sun { background: var(--sun-pale); }
.panel--lavender { background: var(--lavender-pale); }

/* Tutor: the three moves of a session, as stops on a short road. */
.steps { display: grid; gap: 22px; margin: 34px 0 0; padding: 0; list-style: none; }
.step { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
.step:not(:last-child)::before {
  content: ""; position: absolute; left: 22.5px; top: 58px; bottom: -16px;
  border-left: 3px dotted #A3BCFF;
}
.step__dot {
  display: grid; place-items: center; width: 48px; height: 48px; padding-top: 4px;
  border-radius: 50%; background: var(--blue-pale); color: var(--blue);
  box-shadow: 0 4px 0 #A3BCFF;
  font: 800 22px/1 var(--display);
}
.step h3 { margin-top: 2px; font-weight: 800; font-size: 19px; line-height: 1.3; }
.step p { margin-top: 4px; color: var(--muted); font-size: 16px; line-height: 1.5; }

.phone {
  width: min(328px, 100%); margin: -36px auto;
  padding: 10px; border-radius: 50px; background: var(--ink);
  box-shadow: 0 36px 60px -28px rgba(27, 37, 89, 0.55);
}
/* A phone at its natural proportions: the Rysik sheet slides up inside it and lifts the composer. */
.phone__screen {
  --pad: 288px;
  display: flex; flex-direction: column; aspect-ratio: 9 / 19.5; min-height: 0;
  overflow: hidden; border-radius: 40px; background: #fff;
}
.phone__status {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 26px 6px; font-weight: 800; font-size: 14px;
}
.phone__island { position: absolute; left: 50%; top: 10px; width: 90px; height: 26px; border-radius: 20px; background: var(--ink); transform: translateX(-50%); }
.phone__bars { position: relative; width: 24px; height: 12px; border: 2px solid var(--ink); border-radius: 4px; }
.phone__bars::after { content: ""; position: absolute; inset: 1.5px 5px 1.5px 1.5px; border-radius: 1.5px; background: var(--ink); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; border-bottom: 2px solid var(--line); }
.chat-head__back { width: 22px; height: 22px; }
.chat-head img { width: 38px; height: 38px; }
.chat-head b { display: block; font-weight: 800; font-size: 16px; line-height: 1.15; }
.chat-head span { display: block; color: var(--blue-mid); font-weight: 700; font-size: 12.5px; line-height: 1.3; }
/* Newest messages sit on the composer; older ones scroll off the top as the sheet rises. */
.chat { display: flex; flex: 1; flex-direction: column; justify-content: flex-end; min-height: 0; overflow: hidden; }
.chat__log { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 20px; font-weight: 600; font-size: 14.5px; line-height: 1.42; }
.msg--me { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--blue-mid); color: #fff; }
.msg--tutor { align-self: flex-start; border-bottom-left-radius: 6px; background: var(--blue-pale); }
.msg--photo { max-width: 92%; padding: 6px; }
.paper {
  padding: 12px 13px; border-radius: 15px;
  background: #FFFDF5; color: #262B40;
  font: 400 14px/1.45 Georgia, "Times New Roman", serif;
  transform: rotate(-1.2deg);
}
/* The reply being typed: words first, then the formula Rysik inserts as a pill. */
.composer {
  display: grid; gap: 4px; margin: 0 10px 8px; padding: 8px 8px 8px 14px;
  border: 2px solid var(--line); border-radius: 22px;
}
.composer__text { min-height: 27px; font-weight: 600; font-size: 14px; line-height: 1.9; }
.composer__placeholder { color: #8A93AB; }
.composer__caret { display: none; width: 2px; height: 1.15em; margin-left: 1px; background: var(--blue-mid); vertical-align: -0.2em; }
.pill {
  display: none; align-items: center; vertical-align: middle; margin-top: 2px; padding: 3px 8px;
  border: 1px solid #FFE0B2; border-radius: 12px; background: #FFF3E0;
}
.pill math { font-size: 14px; }
.composer__tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.composer__tool, .composer__send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.composer__tool { background: var(--blue-pale); color: var(--blue-mid); }
.composer__send { background: var(--coral); color: #fff; }
.composer__tool svg, .composer__send svg { width: 18px; height: 18px; }
.composer__pen { padding: 0; border: 0; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease; }
.composer__pen:hover { background: #DCE6FF; }
.rysik-hint {
  position: relative; margin-right: 4px; padding: 7px 10px; border-radius: 10px;
  background: var(--sun); color: var(--ink); font-weight: 800; font-size: 12.5px; line-height: 1; white-space: nowrap;
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s;
}
.rysik-hint::after {
  content: ""; position: absolute; top: 50%; right: -4px; width: 10px; height: 10px;
  border-radius: 2px; background: var(--sun); transform: translateY(-50%) rotate(45deg);
}

/* Demo states on [data-demo]: idle, typing, waiting (the pencil invites a tap), drawing, done. */
[data-state="idle"] [data-typed] { display: none; }
[data-demo]:not([data-state="idle"]) .composer__placeholder { display: none; }
[data-state="typing"] .composer__caret, [data-state="waiting"] .composer__caret, [data-state="drawing"] .composer__caret {
  display: inline-block; animation: caret 1s steps(1) infinite;
}
[data-state="waiting"] .rysik-hint { opacity: 1; visibility: visible; animation: nudge 1.2s ease-in-out infinite; }
[data-state="waiting"] .composer__pen { animation: pen-glow 1.5s ease-out infinite; }
[data-state="drawing"] .composer__pen { background: var(--blue-mid); color: #fff; }
[data-state="done"] .pill { display: inline-flex; animation: pill-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes caret { 50% { opacity: 0; } }
@keyframes nudge { 50% { translate: 4px 0; } }
@keyframes pen-glow { from { box-shadow: 0 0 0 0 rgba(255, 194, 51, 0.95); } to { box-shadow: 0 0 0 12px rgba(255, 194, 51, 0); } }
@keyframes pill-in { from { opacity: 0; scale: 0.6; } }

/* The Rysik sheet grows from the bottom edge, so its content slides up into view. */
.rysik {
  display: flex; flex: none; flex-direction: column; justify-content: flex-end;
  height: 0; overflow: hidden; transition: height 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-state="drawing"] .rysik { height: var(--pad); }
.rysik__sheet { flex: none; height: var(--pad); padding: 8px 10px 18px; border-top: 2px solid var(--line); background: var(--track); }
.rysik__bar { display: flex; align-items: center; gap: 6px; }
.rysik__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #fff; }
.rysik__icon svg { width: 17px; height: 17px; }
.rysik__insert, .rysik__send { padding: 7px 11px; border-radius: 10px; font-weight: 800; font-size: 12.5px; line-height: 1; }
.rysik__insert {
  margin-left: auto; background: #fff; color: var(--blue-mid); box-shadow: inset 0 0 0 2px var(--blue-mid);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.rysik__insert.is-pressed { background: #DCE6FF; transform: translateY(1px) scale(0.95); }
.rysik__send { background: var(--blue-mid); color: #fff; }
.rysik__ink { display: block; width: 100%; height: auto; margin-top: 8px; border-radius: 14px; background: #fff; }
/* Strokes start hidden (a round cap alone would still draw a dot), then each is drawn in turn. */
.rysik__ink path {
  fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0;
}
.rysik.is-writing .rysik__ink path { animation: write var(--t, 0.2s) linear var(--d, 0s) forwards; }
.rysik.is-written .rysik__ink path { stroke-dashoffset: 0; opacity: 1; }
@keyframes write { from { opacity: 1; stroke-dashoffset: 1; } to { opacity: 1; stroke-dashoffset: 0; } }
.rysik__preview {
  display: grid; place-items: center; height: 52px; margin-top: 8px; overflow: hidden;
  border-radius: 10px; background: #fff;
}
.rysik__preview > * { grid-area: 1 / 1; margin: 0; opacity: 0; transition: opacity 0.25s ease; }
.rysik__preview > .is-shown { opacity: 1; }
.rysik__status { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.rysik__preview math { font-size: 16px; }
math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math, serif; }

/* Journey: one stage of the road, then the chest you can open. */
.road { display: flex; max-width: 30rem; margin: 34px 0 0; padding: 0; list-style: none; }
.road__stop {
  position: relative; flex: 1; display: grid; justify-items: center; gap: 12px;
  color: var(--muted); font-weight: 700; font-size: 14px; text-align: center;
}
.road__stop:not(:last-child)::after {
  content: ""; position: absolute; top: 25px; left: calc(50% + 34px); right: calc(-50% + 34px);
  border-top: 3px dotted #A3BCFF;
}
.road__stop.is-done::after { border-top: 3px solid var(--blue-mid); }
.road__disc { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; }
.road__disc svg { width: 26px; height: 26px; }
.is-done .road__disc { background: var(--blue-pale); color: var(--blue); box-shadow: 0 5px 0 #A3BCFF; }
.is-current { color: var(--ink); }
.is-current .road__disc { background: var(--coral); color: #fff; box-shadow: 0 5px 0 var(--coral-edge); }
.is-chest .road__disc { background: var(--sun-pale); box-shadow: 0 5px 0 #F2C24F; }
.is-chest .road__disc svg { width: 32px; height: 32px; }

.porthole {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: clamp(28px, 4vw, 44px) 28px 34px; overflow: hidden;
  border-radius: 44px; text-align: center;
  background: url("assets/sky.svg") 18% 12% / 230% auto no-repeat, radial-gradient(120% 90% at 50% 38%, #2A5BEA 0%, var(--blue) 42%, var(--deep) 100%);
}
.porthole__scene { position: relative; width: min(76%, 400px); }
.porthole__stage { width: 100%; height: auto; overflow: visible; }
.porthole__label {
  display: flex; align-items: center; justify-content: center;
  max-width: 22rem; min-height: 2.6em;
  font-weight: 800; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.3;
}
.porthole .btn { position: relative; }
.chest { transform-box: fill-box; transform-origin: 50% 100%; }
.porthole:not(.is-open) .chest { animation: wiggle 4.6s ease-in-out 1s infinite; }
.chest__lid { transform-box: fill-box; transform-origin: 0% 100%; transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.porthole.is-open .chest__lid { transform: translate(-6px, -30px) rotate(-26deg); }
.chest__mouth { opacity: 0; transition: opacity 0.35s ease 0.1s; }
.porthole.is-open .chest__mouth { opacity: 1; }
.reward { position: absolute; left: 50%; top: 11%; width: 40%; aspect-ratio: 1; opacity: 0; pointer-events: none; translate: -50% -50%; scale: 0.2; }
.reward img, .reward svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 0 rgba(8, 30, 122, 0.35)); }
.porthole.is-open .reward { animation: reward-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.18s both; }
@keyframes reward-pop {
  from { opacity: 0; scale: 0.2; translate: -50% 20%; }
  to { opacity: 1; scale: 1; translate: -50% -50%; }
}

/* Streak: the week, today's goal and the shields, as keys from the app. */
.streak { display: grid; gap: 18px; width: min(430px, 100%); }
.week { padding: 20px 20px 18px; }
.week__top { display: flex; align-items: center; gap: 10px; }
.week__flame { width: 46px; height: 46px; }
.week__top p { color: var(--muted); font-weight: 700; font-size: 17px; }
.week__top b { margin-right: 4px; color: var(--ink); font: 800 42px/1 var(--display); vertical-align: -4px; }
.week__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.week__days li {
  display: grid; justify-items: center; gap: 6px; padding: 8px 0 10px;
  border-radius: 14px; color: var(--muted); font-weight: 800; font-size: 12px;
}
.week__days svg { width: 28px; height: 28px; }
.week__days .is-today { background: var(--fox-pale); box-shadow: inset 0 0 0 2px #FFBE78; color: var(--ink); }
.week__days .is-next i { width: 28px; height: 28px; border: 2.5px dashed var(--line-dark); border-radius: 50%; }
.goal { display: flex; align-items: center; gap: 14px; margin-left: clamp(0px, 4vw, 40px); padding: 14px 16px; }
.goal__patch {
  position: relative; display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--blue-mid), var(--blue) 60%, var(--deep));
}
.goal__patch > svg { width: 30px; height: 30px; }
.goal__check {
  position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 24px; height: 24px;
  border: 2.5px solid #fff; border-radius: 50%; background: var(--green); color: #fff;
}
.goal__check svg { width: 14px; height: 14px; }
.goal__text { min-width: 0; }
.goal__title { font-weight: 800; font-size: 16px; line-height: 1.25; }
.goal__meta { margin-top: 2px; color: var(--muted); font-weight: 600; font-size: 14px; line-height: 1.35; }
.goal__chest { flex: none; width: 40px; height: 40px; margin-left: auto; }
.shields { display: flex; align-items: center; gap: 4px; margin-right: clamp(0px, 6vw, 72px); padding: 12px 18px; }
.shields svg { width: 34px; height: 34px; }
.shields p { margin-left: 8px; color: var(--muted); font-weight: 600; font-size: 15px; line-height: 1.3; }
.shields b { color: var(--ink); font-weight: 800; }

/* Badges: the five ranks grow left to right. */
.badges { display: grid; justify-items: center; gap: 30px; width: 100%; }
.medals { display: flex; align-items: flex-end; justify-content: center; gap: clamp(4px, 1.1vw, 14px); margin: 0; padding: 0; list-style: none; }
.medals li { display: grid; justify-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.medals img { width: var(--w); height: auto; }
.medals li:nth-child(1) { --w: clamp(50px, 5.4vw, 72px); }
.medals li:nth-child(2) { --w: clamp(54px, 5.9vw, 79px); }
.medals li:nth-child(3) { --w: clamp(58px, 6.4vw, 86px); }
.medals li:nth-child(4) { --w: clamp(62px, 6.9vw, 93px); }
.medals li:nth-child(5) { --w: clamp(66px, 7.6vw, 104px); }
.rank { display: flex; align-items: center; gap: 14px; width: min(370px, 100%); padding: 14px 18px; }
.rank img { flex: none; width: 44px; height: auto; }
.rank__body { flex: 1; min-width: 0; }
.rank__name { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 16px; line-height: 1.2; }
.rank__name span { color: var(--rank, var(--sun-edge)); }
.rank__bar { height: 12px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: var(--track); }
.rank__bar i {
  display: block; width: calc(var(--p) * 100%); height: 100%; border-radius: inherit;
  background: var(--sun); box-shadow: inset 0 -3px 0 rgba(194, 127, 5, 0.35);
}
.rank__next { margin-top: 6px; color: var(--muted); font-weight: 600; font-size: 13.5px; }

/* --- Teachers and tutors --------------------------------------------------------- */

.teachers { padding: clamp(80px, 10vw, 136px) 0; background: var(--blue-pale); }
.teachers__head { max-width: 46rem; }
.reasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 48px 0 0; padding: 0; list-style: none; }
.reason { padding: 28px 26px 26px; }
.reason__art { width: 56px; height: 56px; object-fit: contain; }
.reason h3 { margin-top: 18px; font-weight: 800; font-size: 20px; line-height: 1.25; }
.reason p { margin-top: 8px; color: var(--muted); font-size: 16px; line-height: 1.5; }
/* --- What students and parents say ------------------------------------------------ */

.voices { padding-block: clamp(56px, 6.5vw, 96px) clamp(72px, 8vw, 120px); }
.voices__title { text-align: center; }
/* The shorter quote gets the narrower column, so both cards fill to a similar height. */
.quotes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; margin-top: 40px; }
.quote { display: grid; align-content: space-between; gap: 22px; padding: 30px 30px 26px; }
.quote blockquote { font-weight: 600; font-size: clamp(17px, 1.3vw, 19px); line-height: 1.55; }
.quote blockquote p + p { margin-top: 12px; }
.quote blockquote::before {
  content: ""; display: block; width: 40px; height: 30px; margin-bottom: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 36'%3E%3Cpath fill='%23FD4E33' d='M0 36V22C0 9.5 6.8 2 18.5 0l2 6.3C13.6 8.5 10.6 12.4 10.4 18H20v18zm27 0V22C27 9.5 33.8 2 45.5 0l2 6.3c-6.9 2.2-9.9 6.1-10.1 11.7H47v18z'/%3E%3C/svg%3E") 0 0 / contain no-repeat;
}
.quote figcaption { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14.5px; line-height: 1.35; }
.quote figcaption b { display: block; color: var(--ink); font-size: 16px; }
.quote__avatar {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; padding-top: 3px;
  border-radius: 50%; background: #fff; color: var(--fox); font: 800 21px/1 var(--display);
}
.quote__avatar--blue { color: var(--blue-mid); }
.teachers__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 44px; }
.teachers__cta p { font-weight: 700; font-size: 18px; }

/* --- Final call ---------------------------------------------------------------------- */

.final { padding: clamp(24px, 3vw, 40px) clamp(12px, 2vw, 24px) clamp(48px, 6vw, 80px); }
.final__card {
  position: relative; max-width: 1240px; margin: 0 auto; overflow: hidden;
  padding: clamp(52px, 7vw, 92px) 24px clamp(52px, 7vw, 84px);
  border-radius: 48px; text-align: center;
  background: var(--galaxy);
  background-size: cover, auto;
  background-position: 70% 50%, 0 0;
  background-repeat: no-repeat;
}
.final .h2 { color: #fff; }
.crew { display: flex; align-items: flex-end; justify-content: center; margin-bottom: 18px; }
.crew img { width: var(--s); height: var(--s); margin-inline: -5px; }
.crew img:nth-child(1), .crew img:nth-child(5) { --s: clamp(54px, 6vw, 76px); }
.crew img:nth-child(2), .crew img:nth-child(4) { --s: clamp(64px, 7vw, 88px); }
.crew img:nth-child(3) { --s: clamp(84px, 9vw, 116px); position: relative; z-index: 1; }
.final__lead { max-width: 30rem; margin: 16px auto 0; color: rgba(255, 255, 255, 0.86); font-size: clamp(18px, 1.45vw, 20px); }
.join--center { margin: 34px auto 0; }
.join--center .roles { justify-content: center; }
.join--center .roles legend { margin-inline: auto; }
.join--center .join__note { margin-inline: auto; }

/* --- Footer ----------------------------------------------------------------------- */

.foot { padding: 0 0 44px; }
.foot__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding-top: 32px; border-top: 2px solid var(--line); }
.foot__brand { display: flex; align-items: center; gap: 16px; color: var(--blue); }
.foot__brand svg { width: 92px; height: auto; }
.foot__brand p { color: var(--muted); font-weight: 600; font-size: 15px; }
.foot__links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot__links a { font-weight: 700; font-size: 15px; text-decoration: none; text-underline-offset: 4px; }
.foot__links a:hover { text-decoration-line: underline; }
.foot__copy { color: var(--muted); font-size: 14px; }

/* --- Smaller screens --------------------------------------------------------------- */

@media (max-width: 1023px) {
  .hero { padding: calc(var(--header) + 4px) 0 104px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr); }
  .hero__art { order: -1; margin: -8px -12% 0; }
  .stage { margin-right: 0; }
  .hero__copy { max-width: 640px; }
  .feature__grid { grid-template-columns: minmax(0, 1fr); }
  .feature--flip .feature__art { order: 0; }
  .feature__art { justify-self: center; width: 100%; max-width: 560px; }
  .quotes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .top__nav { display: none; }
  .reasons { grid-template-columns: minmax(0, 1fr); }
  .levels__list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; gap: 12px; }
  .level { padding: 14px 10px 12px; }
  .level img { width: 62px; height: 62px; }
  .level__name { font-size: 18px; }
  .topics {
    display: grid; grid-auto-flow: column; grid-template-rows: auto auto; justify-content: start;
    gap: 12px 10px; padding: 4px 20px 14px; overflow-x: auto;
    scrollbar-width: none; scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  }
  .topics::-webkit-scrollbar { display: none; }
  .topic { scroll-snap-align: start; }
}

@media (max-width: 599px) {
  :root { --header: 64px; }
  .wrap { width: calc(100% - 40px); }
  .brand { padding: 8px 12px 7px; }
  .brand svg { width: 82px; }
  .hero { padding-bottom: 88px; }
  .hero__art { margin-inline: -14% -2%; }
  .sheet { margin-top: -32px; border-radius: 32px 32px 0 0; }
  .join__row { flex-direction: column; padding: 6px; border-radius: 20px; }
  .join__input { height: 52px; }
  .join__submit { width: 100%; }
  .levels { padding-top: 48px; }
  .panel, .porthole { border-radius: 32px; }
  .panel--fox { margin-top: 24px; }
  .phone { margin-block: -28px; }
  .week__days li { padding-inline: 0; }
  .week__days svg { width: 24px; height: 24px; }
  .goal, .shields { margin-inline: 0; }
  .quote { padding: 24px 22px 22px; }
  .final__card { border-radius: 36px; padding-inline: 20px; }
  .foot__inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .rocket, .rocket__bob, .boost, .flame, .pulse, .rays, .wiggle, .chest, .porthole:not(.is-open) .chest { animation: none; }
  .bubble { animation: none; }
  .chest__lid, .chest__mouth { transition: none; }
  .porthole.is-open .reward { animation: none; opacity: 1; scale: 1; }
  .rysik, .composer__pen, .rysik-hint, .rysik__insert, .rysik__preview > * { transition: none; }
  [data-state] .composer__caret, [data-state="waiting"] .rysik-hint, [data-state="waiting"] .composer__pen, [data-state="done"] .pill { animation: none; }
  [data-state="waiting"] .composer__pen { box-shadow: 0 0 0 4px var(--sun); }
}
