/* Kippi Math – website. Colors follow the app (src/ui/theme.ts). No external fonts or libraries.
   Light theme only, like the original site (the app art is drawn for a light background). */
:root {
  --bg1: #bfe4ff;
  --bg2: #e6ddff;
  --bg3: #ffe8d4;
  --ink: #2d2a4a;
  --soft: #5f5c84;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --card-border: rgba(255, 255, 255, 0.95);
  --hair: rgba(45, 42, 74, 0.1);
  --primary: #5b6cff;
  --primary-d: #3f4fd9;
  --on-primary: #ffffff;
  --link: #3f4fd9;
  --green: #1a9e55;
  --green-soft: #dff7e9;
  --gold: #ffb800;
  --gold-soft: #fff3c4;
  --pink: #ff6fb5;
  --purple: #9b5de5;
  --teal: #00bbd4;
  --orange: #ff9f1c;
  --shadow: 0 10px 30px rgba(58, 47, 122, 0.12);
  --radius: 28px;
  --radius-s: 16px;
  --header: rgba(255, 255, 255, 0.72);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0;
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg2) linear-gradient(170deg, var(--bg1) 0%, var(--bg2) 45%, var(--bg3) 100%) fixed;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 900; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.3rem, 7vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 4.6vw, 2.3rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin: 0.25em 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card-solid); padding: 8px 14px; border-radius: 12px; z-index: 100; }
.skip:focus { left: 8px; }
[id] { scroll-margin-top: 84px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hair);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 2px 8px rgba(58, 47, 122, 0.2); }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 8px 11px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--card); }
.nav a[aria-current="page"] { font-weight: 900; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--hair);
    background: var(--card); color: var(--ink); font-size: 1.3rem; cursor: pointer;
  }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch;
    padding: 10px 14px 16px; background: var(--card-solid); border-bottom: 1px solid var(--hair); box-shadow: var(--shadow);
    max-height: calc(100vh - 64px); overflow-y: auto; overscroll-behavior: contain;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1.05rem; border-radius: 12px; }
  .no-js .nav { display: flex; position: static; flex-direction: row; flex-wrap: wrap; box-shadow: none; background: none; border: 0; padding: 0; }
  .no-js .nav-toggle { display: none; }
  .no-js .site-header .wrap { flex-wrap: wrap; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  min-height: 52px; padding: 12px 22px; border-radius: 999px;
  font-weight: 900; font-size: 1.05rem; text-decoration: none; line-height: 1.2;
  background: var(--primary); color: var(--on-primary); border: 0;
  box-shadow: 0 6px 0 var(--primary-d), 0 10px 22px rgba(63, 79, 217, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--primary-d); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--hair); border: 1.5px solid var(--card-border); }

/* Google Play button – our own design, not the official badge */
.play {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 10px 22px 10px 16px; border-radius: 16px;
  background: #1f1d2e; color: #fff; text-decoration: none; border: 1.5px solid #4a4766;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.play svg { width: 28px; height: 28px; flex: none; }
.play small { display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85; }
.play strong { display: block; font-size: 1.2rem; font-weight: 800; line-height: 1.15; }
.play:hover { background: #2b2840; }
.soon-note { font-size: 0.95rem; color: var(--soft); font-weight: 700; margin: 10px 0 0; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 24px; overflow: hidden; }
.hero .wrap { display: grid; gap: 24px; align-items: center; }
@media (min-width: 860px) { .hero .wrap { grid-template-columns: 1.1fr 0.9fr; } .hero { padding: 64px 0 40px; } }
.hero .kicker { display: inline-block; font-weight: 900; font-size: 0.9rem; color: var(--primary-d); background: var(--card); border: 1.5px solid var(--card-border); padding: 6px 14px; border-radius: 999px; margin-bottom: 14px; }
.hero .tagline { font-size: clamp(1.25rem, 3.6vw, 1.6rem); font-weight: 800; color: var(--soft); margin-bottom: 0.6em; }
.hero .lead { font-size: 1.12rem; max-width: 34em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 22px; }
.hero-art { position: relative; justify-self: center; width: min(420px, 88vw); aspect-ratio: 1; }
@media (max-width: 859px) { .hero { padding-top: 16px; } .hero-art { order: -1; width: min(240px, 66vw); margin-bottom: -12px; } }
.hero-art::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.5) 65%, transparent); }
.hero-art .mascot { position: absolute; inset: 4%; width: 92%; animation: bob 3.2s ease-in-out infinite; }
.hero-art .sym { position: absolute; font-weight: 900; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15); animation: float 5s ease-in-out infinite; }
.sym.s1 { left: 2%; top: 8%; color: var(--pink); }
.sym.s2 { right: 4%; top: 4%; color: var(--orange); animation-delay: -1.5s; }
.sym.s3 { left: 0; bottom: 14%; color: var(--purple); animation-delay: -3s; }
.sym.s4 { right: 2%; bottom: 18%; color: var(--teal); animation-delay: -2s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 18px 0 0; }
.chips li { margin: 0; background: var(--card); border: 1.5px solid var(--card-border); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 0.92rem; }

/* ---------- sections and cards ---------- */
section { padding: 40px 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 28px; }
.section-head p { color: var(--soft); font-size: 1.1rem; font-weight: 600; }
.card {
  background: var(--card); border: 1.5px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.grid { display: grid; gap: 16px; }
@media (min-width: 600px) { .grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.feature { display: flex; flex-direction: column; gap: 6px; }
.feature .ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 1.8rem; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--soft); font-weight: 600; }
.ico.c1 { background: #e3e7ff; } .ico.c2 { background: #dff7e9; } .ico.c3 { background: #fff0d6; }
.ico.c4 { background: #ffe1f0; } .ico.c5 { background: #efe3ff; } .ico.c6 { background: #d9f6fb; }

/* Kippi grows */
.grow { display: grid; gap: 22px; align-items: center; }
@media (min-width: 760px) { .grow { grid-template-columns: 220px 1fr; } }
.grow img { width: 200px; margin: 0 auto; }
.grow p:last-child { margin-bottom: 0; }

/* Video */
.vid { max-width: 380px; margin: 0 auto; }
.vid-play { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer; border-radius: var(--radius); overflow: hidden; aspect-ratio: 9 / 16; background: #1f1d2e; box-shadow: var(--shadow); }
.vid-play img { width: 100%; height: 100%; object-fit: cover; }
.vid-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; padding-left: 6px; font-size: 2rem; color: var(--on-primary); background: var(--primary); box-shadow: 0 6px 0 var(--primary-d), 0 12px 28px rgba(0, 0, 0, 0.35); transition: transform 0.15s; }
.vid-play .vid-btn { top: 38%; }
.vid-play:hover .vid-btn { transform: translate(-50%, -50%) scale(1.07); }
.vid video { display: block; width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius); box-shadow: var(--shadow); background: #000; max-height: 85vh; }

/* Screenshot gallery */
.shots { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 18px; margin: 0 -4px; list-style: none; -webkit-overflow-scrolling: touch; }
.shots li { flex: 0 0 auto; width: min(62vw, 240px); scroll-snap-align: center; margin: 0; }
.shots picture { display: block; }
.shots img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 22px; border: 4px solid var(--card-solid); box-shadow: var(--shadow); background: var(--card); -webkit-user-drag: none; user-select: none; }
.shots li.missing { display: none; }
.shots.pinned { overflow-x: hidden; scroll-snap-type: none; scroll-behavior: auto; }

/* Grades and topics */
.grades { display: grid; gap: 14px; }
@media (min-width: 700px) { .grades { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grades { grid-template-columns: repeat(5, 1fr); } }
.grade { padding: 18px; border-top: 6px solid var(--gc, var(--primary)); }
.grade h3 { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.grade .tag { font-size: 0.75rem; font-weight: 900; padding: 3px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.grade ul { margin: 0; padding-left: 1.1em; font-size: 0.95rem; font-weight: 600; }
.grade .isle-name { font-size: 0.85rem; color: var(--soft); font-weight: 800; margin: -4px 0 8px; }
.grade-1 { --gc: #5b6cff; } .grade-2 { --gc: #22b866; } .grade-3 { --gc: #ff9f1c; } .grade-4 { --gc: #00bbd4; } .grade-5 { --gc: #9b5de5; }

/* Pricing */
.prices { display: grid; gap: 16px; }
@media (min-width: 760px) { .prices { grid-template-columns: repeat(3, 1fr); } }
.price { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.price .amount { font-size: 2rem; font-weight: 900; line-height: 1.1; }
.price.best { border: 3px solid var(--gold); background: linear-gradient(180deg, var(--gold-soft), var(--card)); }
.price .badge { font-size: 0.8rem; font-weight: 900; background: var(--gold); color: #2d2a4a; padding: 4px 10px; border-radius: 999px; }
.note { color: var(--soft); font-weight: 600; font-size: 0.98rem; }
.center { text-align: center; }

/* Teachers */
.school { display: grid; gap: 18px; align-items: center; }
@media (min-width: 760px) { .school { grid-template-columns: 160px 1fr; } }
.school img { width: 140px; margin: 0 auto; }
.school p:last-child { margin-bottom: 0; }

/* FAQ */
.faq details { background: var(--card); border: 1.5px solid var(--card-border); border-radius: var(--radius-s); margin-bottom: 10px; box-shadow: 0 4px 14px rgba(58, 47, 122, 0.06); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; font-weight: 900; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--primary); transition: transform 0.2s; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details > div { padding: 0 18px 14px; color: var(--soft); font-weight: 600; }
.faq details > div p:last-child { margin-bottom: 0; }

/* Contact */
.contact { text-align: center; }
.contact .mail { font-size: clamp(1.3rem, 5vw, 1.8rem); font-weight: 900; word-break: break-word; }

/* Text pages (privacy, terms, support) */
.doc { padding: 32px 0 48px; }
.doc .card { padding: clamp(20px, 4vw, 40px); }
.doc h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.doc h2 { font-size: 1.4rem; margin-top: 1.6em; }
.doc h3 { margin-top: 1.2em; }
.doc .meta { color: var(--soft); font-weight: 700; }
.toc { background: rgba(91, 108, 255, 0.07); border-radius: var(--radius-s); padding: 14px 18px; margin: 0 0 1.4em; }
.toc ul { margin: 0.4em 0 0; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 44px; margin: 0 0 12px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 0.9rem; }
.path { font-weight: 800; background: rgba(91, 108, 255, 0.1); border-radius: 8px; padding: 1px 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.help-nav { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 1.4em; }
.help-nav li { margin: 0; }
.help-nav a { display: inline-block; padding: 6px 12px; border-radius: 999px; background: rgba(91, 108, 255, 0.1); font-weight: 800; text-decoration: none; }
address { font-style: normal; margin: 0 0 1em; }

/* 404 */
.lost { text-align: center; padding: 60px 0; }
.lost img { width: 180px; margin: 0 auto 10px; }

/* ---------- footer ---------- */
.site-footer { padding: 32px 0 40px; border-top: 1px solid var(--hair); margin-top: 24px; background: var(--header); }
.site-footer .wrap { display: grid; gap: 18px; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: 1.2fr 1fr 1fr; } }
.site-footer h2 { font-size: 1rem; margin-bottom: 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.site-footer p, .site-footer small { color: var(--soft); font-weight: 600; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; margin-bottom: 6px; }
.foot-brand img { width: 34px; height: 34px; border-radius: 10px; }
