/* Calculation Master website. Tokens mirror the app: electric purple, lime highlight, deep indigo ink. */
:root {
  --chalk: #f6f4ff;
  --paper: #ffffff;
  --ink: #17112e;
  --graphite: #5b5873;
  --volt: #6750e8;
  --volt-deep: #4b35c9;
  --lime: #c7f464;
  --on-lime: #1a2400;
  --grid: #e6e1fa;
  --line: #dcd6f3;
  --good: #2f9e44;
  --bad: #d6336c;

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Hind", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius-l: 28px;
  --radius-m: 18px;
  --shadow: 0 1px 2px rgb(23 17 46 / 6%), 0 12px 32px -12px rgb(75 53 201 / 22%);
  --max: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

/* Dark theme: follows the device unless the visitor picks light or dark with the header toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chalk: #120d24;
    --paper: #1c1636;
    --ink: #f1eeff;
    --graphite: #b2abd3;
    --volt: #9d8cff;
    --volt-deep: #b7aaff;
    --grid: #221b40;
    --line: #2f2752;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 16px 40px -16px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --chalk: #120d24;
    --paper: #1c1636;
    --ink: #f1eeff;
    --graphite: #b2abd3;
    --volt: #9d8cff;
    --volt-deep: #b7aaff;
    --grid: #221b40;
    --line: #2f2752;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 16px 40px -16px rgb(0 0 0 / 60%);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--volt); outline-offset: 3px; border-radius: 8px; }

.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2.3rem, 5.6vw, 4.1rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--graphite); max-width: 34em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--volt);
  font-weight: 500;
}
/* Lime highlighter stroke, like a student marking the line that matters. */
.mark {
  background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%);
  padding-inline: 0.08em;
  color: inherit;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark { background: none; color: var(--lime); }
}
:root[data-theme="dark"] .mark { background: none; color: var(--lime); }
.deva { font-family: "Hind", var(--font-body); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--chalk) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.brand img { width: 36px; height: 36px; border-radius: 11px; background: #6b3cef; padding: 4px; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; font-weight: 500; color: var(--graphite); font-size: 0.98rem; }
.nav a:hover { color: var(--ink); }
.header-cta { margin-left: 0; }
.theme-toggle {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { border-color: var(--volt); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.brand, .btn { white-space: nowrap; }
@media (max-width: 860px) { .nav { display: none; } .theme-toggle { margin-left: auto; } }
@media (max-width: 420px) {
  .site-header .brand { font-size: 0.88rem; gap: 8px; }
  .site-header .brand img { width: 32px; height: 32px; }
  .site-header .wrap { gap: 12px; }
  /* The hero's Google Play button sits just below, so the header keeps only brand and theme. */
  .site-header .header-cta { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 10px 22px;
  border-radius: 999px; border: 0;
  font: 600 1rem/1 var(--font-body);
  text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-play { background: var(--ink); color: var(--chalk); padding: 10px 24px 10px 18px; }
.btn-play:hover { background: var(--volt-deep); color: #fff; }
.btn-play svg { width: 22px; height: 22px; flex: none; }
.btn-play .two { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.btn-play small { font-size: 0.7rem; font-weight: 500; opacity: 0.8; letter-spacing: 0.02em; }
.btn-play strong { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; }
.btn-small { min-height: 40px; padding: 8px 18px; font-size: 0.92rem; }
.btn-ghost { background: transparent; color: var(--volt); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--volt); }
.btn-lime { background: var(--lime); color: var(--on-lime); }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(48px, 8vw, 96px) 0 clamp(56px, 8vw, 104px); }
/* Squared exercise-book paper behind the hero. */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 75% at 70% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 70% 40%, #000 30%, transparent 78%);
}
.hero .wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-copy { display: grid; gap: 22px; justify-items: start; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.95rem; color: var(--graphite); padding: 0; margin: 0; list-style: none; }
.hero-facts li { display: flex; align-items: center; gap: 8px; }
.hero-facts li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--volt); }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; } }

/* ---------- drill (hero signature) ---------- */
.drill {
  position: relative;
  background:
    radial-gradient(120% 60% at 100% 0%, color-mix(in srgb, var(--volt) 10%, transparent), transparent 60%),
    var(--paper);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: clamp(18px, 3vw, 28px);
  display: grid; gap: 16px;
  width: 100%; max-width: 480px; justify-self: center;
}
.drill-top { display: flex; align-items: flex-start; gap: 12px; }
.drill-title { flex: 1; }
.drill-title p:first-child { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.drill-count { font-family: var(--font-mono); font-weight: 500; font-size: 0.78rem; color: var(--volt); letter-spacing: 0.03em; }
.timer {
  font-family: var(--font-mono); font-weight: 600; font-size: 1rem;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper);
  font-variant-numeric: tabular-nums; min-width: 96px; justify-content: center;
}
.timer::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.drill[data-state="running"] .timer { border-color: var(--volt); }
.drill[data-state="running"] .timer::before { background: var(--volt); animation: blink 1s steps(2, start) infinite; }
.drill[data-state="done"] .timer::before { background: var(--lime); }
@keyframes blink { to { opacity: 0.2; } }

/* Difficulty switch */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 4px; border-radius: 999px; background: var(--chalk); border: 1px solid var(--line); }
.levels button {
  min-height: 34px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--graphite);
  font: 600 0.88rem/1 var(--font-body);
}
.levels button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgb(23 17 46 / 12%); }
.levels button:hover:not([aria-checked="true"]) { color: var(--ink); }
.drill[data-state="running"] .levels { opacity: 0.55; }

/* One segment per question */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.steps li { height: 6px; border-radius: 99px; background: var(--grid); transition: background-color 0.2s ease; }
.steps li.done { background: var(--volt); }
.steps li.now { background: color-mix(in srgb, var(--volt) 35%, var(--grid)); }
.drill[data-state="done"] .steps li.good { background: var(--good); }
.drill[data-state="done"] .steps li.bad { background: var(--bad); }

.equation {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.3rem, 6.6vw, 3.3rem);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.18em 0.24em;
  letter-spacing: -0.03em; line-height: 1.1;
  padding: clamp(16px, 3.4vw, 30px) 0;
  font-variant-numeric: tabular-nums;
  min-height: 2.3em;
}
.equation.long { font-size: clamp(1.8rem, 5vw, 2.5rem); }
.equation .op { color: var(--volt); font-weight: 600; }
.equation .word { font-family: var(--font-body); font-weight: 600; font-size: 0.5em; color: var(--graphite); letter-spacing: 0; }
.equation .blank {
  display: inline-grid; place-items: center;
  min-width: 1.25em; height: 1.2em; padding: 0 0.12em;
  border-radius: 0.24em; background: var(--lime); color: var(--on-lime);
  font-size: 0.86em;
}
.equation.swap { animation: pop 0.24s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  position: relative;
  display: grid; place-items: center;
  min-height: 64px; padding: 10px 44px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 1px 0 var(--line);
  font: 700 1.4rem/1 var(--font-display); letter-spacing: -0.02em;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
}
.opt:hover { border-color: var(--volt); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgb(103 80 232 / 45%); }
.opt:active { transform: translateY(0) scale(0.98); }
.opt b {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 0.78rem/1 var(--font-mono);
  background: color-mix(in srgb, var(--volt) 12%, transparent); color: var(--volt);
}
.opt.chosen { border: 2px solid var(--volt); background: color-mix(in srgb, var(--volt) 12%, var(--paper)); }
.opt.chosen b { background: var(--volt); color: #fff; }
.drill-hint { font-size: 0.85rem; color: var(--graphite); text-align: center; margin-top: 14px; }
.drill-hint kbd { font-family: var(--font-mono); font-size: 0.76rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--paper); }

/* Ready screen, shown before the clock starts */
.ready { display: none; justify-items: center; text-align: center; gap: 10px; padding: clamp(28px, 6vw, 52px) 8px; border-radius: var(--radius-m); border: 1.5px dashed var(--line); }
.drill[data-state="ready"] .ready { display: grid; }
.drill[data-state="ready"] .play-area { display: none; }
.ready-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.2rem, 3vw, 1.45rem); letter-spacing: -0.02em; }
.ready-sub { color: var(--graphite); font-size: 0.95rem; max-width: 30ch; }
.ready .btn { margin-top: 8px; min-width: 180px; justify-content: center; font-size: 1.02rem; }
.ready .btn:hover { filter: brightness(0.96); }

/* Results */
.result { display: none; gap: 14px; }
.drill[data-state="done"] .result { display: grid; animation: pop 0.28s ease; }
.drill[data-state="done"] .play-area { display: none; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-stats div { display: grid; gap: 2px; padding: 12px 10px; border-radius: var(--radius-m); background: var(--chalk); border: 1px solid var(--line); text-align: center; }
.result-stats strong { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.25rem, 3.4vw, 1.55rem); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.result-stats div:first-child strong { color: var(--volt); }
.result-stats span { font-size: 0.78rem; color: var(--graphite); }
.verdict { font-weight: 600; font-size: 1rem; }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review li {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; background: var(--chalk);
  font-family: var(--font-mono); font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.review .mark-ok, .review .mark-no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: #fff; }
.review .mark-ok { background: var(--good); }
.review .mark-no { background: var(--bad); }
.review .fix { color: var(--bad); font-weight: 600; }
.review time { color: var(--graphite); font-size: 0.82rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- sections ---------- */
section { padding: clamp(64px, 9vw, 112px) 0; scroll-margin-top: 68px; }
.section-head { display: grid; gap: 14px; margin-bottom: clamp(32px, 5vw, 52px); max-width: 720px; }
.band { background: var(--paper); border-block: 1px solid var(--line); }

/* screens */
.screens {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr);
  gap: clamp(16px, 2.4vw, 28px);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 8px 4px 20px; margin-inline: -4px;
  scrollbar-width: thin;
}
.screen { scroll-snap-align: start; display: grid; gap: 14px; align-content: start; margin: 0; }
.phone {
  border-radius: 34px; padding: 9px; background: var(--ink);
  box-shadow: var(--shadow);
}
.phone img { border-radius: 26px; width: 100%; height: auto; aspect-ratio: 9 / 20; object-fit: cover; object-position: top; background: var(--chalk); }
.screen figcaption { display: grid; gap: 2px; font-size: 0.95rem; color: var(--graphite); line-height: 1.45; }
.screen figcaption strong { color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }
@media (max-width: 700px) { .screens { grid-auto-columns: 68%; } }

/* topics */
.topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.topic-group {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 22px; display: grid; gap: 14px; align-content: start;
}
.topic-group header { display: flex; align-items: baseline; gap: 10px; }
.topic-group h3 { flex: 1; }
.count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--graphite); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chips li { font-size: 0.9rem; padding: 4px 11px; border-radius: 999px; background: var(--chalk); border: 1px solid var(--line); line-height: 1.5; }
@media (max-width: 960px) { .topics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .topics { grid-template-columns: 1fr; } }

/* exams */
.exams { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; background: var(--paper); }
.exam { display: grid; grid-template-columns: 1.3fr 2fr auto; gap: 18px 28px; align-items: center; padding: 22px clamp(18px, 3vw, 30px); }
.exam + .exam { border-top: 1px solid var(--line); }
.exam h3 { font-size: 1.05rem; }
.exam p { color: var(--graphite); font-size: 0.98rem; }
.exam-meta { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 0.85rem; }
.exam-meta span { padding: 5px 10px; border-radius: 8px; background: var(--chalk); border: 1px solid var(--line); white-space: nowrap; }
.disclaimer { margin-top: 16px; font-size: 0.88rem; color: var(--graphite); }
@media (max-width: 760px) { .exam { grid-template-columns: 1fr; gap: 8px; } }

/* adapts + facts */
.split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.split article { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; display: grid; gap: 10px; align-content: start; }
.split article p { color: var(--graphite); font-size: 0.98rem; }
.icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--volt) 12%, transparent); color: var(--volt); }
.icon svg { width: 22px; height: 22px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* faq */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 4px 22px; }
.faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 0; font-weight: 600; font-size: 1.05rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font-family: var(--font-mono); font-size: 1.3rem; color: var(--volt); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 18px; color: var(--graphite); }

/* closing cta */
.cta-band { padding: 0 0 clamp(64px, 9vw, 112px); }
.cta-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #7b5cff, #5b3ee6 55%, #3f24b8);
  color: #fff; border-radius: 36px;
  padding: clamp(36px, 6vw, 64px);
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center;
}
.cta-card::after {
  content: "×"; position: absolute; right: -20px; top: -90px;
  font-family: var(--font-display); font-weight: 800; font-size: 300px; line-height: 1;
  color: rgb(255 255 255 / 7%); pointer-events: none;
}
.cta-card h2 { color: #fff; }
.cta-card p { color: rgb(255 255 255 / 82%); margin-top: 10px; }
.cta-card .btn-play { background: var(--lime); color: var(--on-lime); position: relative; z-index: 1; justify-self: start; }
.cta-card .btn-play:hover { background: #fff; color: var(--ink); }
@media (max-width: 760px) { .cta-card { grid-template-columns: 1fr; } }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; font-size: 0.92rem; color: var(--graphite); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: center; }
.site-footer nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.site-footer .note { flex-basis: 100%; font-size: 0.85rem; }

/* legal pages */
.legal { padding: clamp(48px, 7vw, 88px) 0; }
.legal .wrap { max-width: 760px; }
.legal h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin: 10px 0 8px; }
.legal .updated { font-family: var(--font-mono); font-size: 0.85rem; color: var(--graphite); }
.legal h2 { font-size: 1.15rem; margin: 36px 0 10px; letter-spacing: -0.01em; }
.legal p, .legal li { color: var(--graphite); }
.legal p + p { margin-top: 12px; }
.legal a { color: var(--volt); }

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