/* Math Daily site: the indigo app colors, with Space Grotesk to match Sawir Studio. */
:root {
  --bg: #f4f4fb;
  --surface: #ffffff;
  --ink: #16151f;
  --muted: #5d5b6e;
  --rule: #e2e1ee;
  --accent: #5b4df2;
  --accent-ink: #ffffff;
  --radius: 18px;
  --maxw: 760px;
  --font: "Space Grotesk", system-ui, -apple-system, sans-serif;
  /* The Math Monsters' colors, as in the app. */
  --plumo: #3dc78c;
  --mino: #ff9440;
  --tixi: #f55c9e;
  --divvy: #4599fa;
  --brand-top: #544cf2;
  --brand-bottom: #9445ed;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e17;
    --surface: #1a1926;
    --ink: #f1f0fa;
    --muted: #a3a1b8;
    --rule: #2c2a3d;
    --accent: #8b80ff;
    --accent-ink: #0f0e17;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6; }
a { color: var(--accent); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
header.bar { border-bottom: 1px solid var(--rule); }
header.bar .wrap { display: flex; align-items: center; gap: 12px; padding-block: 14px; }
header.bar img { width: 36px; height: 36px; border-radius: 9px; }
header.bar a.home { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
header.bar nav { margin-left: auto; display: flex; gap: 18px; font-size: 15px; }
header.bar nav a { color: var(--muted); text-decoration: none; }
header.bar nav a:hover, header.bar nav a[aria-current] { color: var(--ink); }
main { padding-block: 48px 64px; }
h1 { font-size: clamp(32px, 7vw, 48px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { font-size: 22px; margin: 36px 0 8px; }
p.lede { font-size: 20px; color: var(--muted); margin: 0 0 28px; }
.muted { color: var(--muted); }
.button { display: inline-block; background: var(--accent); color: var(--accent-ink); padding: 14px 22px; border-radius: 14px; font-weight: 600; text-decoration: none; }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.shots img { width: 100%; height: auto; border-radius: 28px; border: 1px solid var(--rule); }
.features { display: grid; gap: 12px; margin: 28px 0; padding: 0; list-style: none; }
.features li { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; }
details { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
summary { font-weight: 600; cursor: pointer; }
footer { border-top: 1px solid var(--rule); padding-block: 24px; font-size: 14px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.gang { display: flex; gap: 12px; margin-bottom: 20px; }
.gang .monster { width: clamp(56px, 16vw, 84px); height: auto; }
.monsters { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.monsters li { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 16px; display: grid; justify-items: center; text-align: center; gap: 2px; align-content: start; }
.monsters .monster { width: 88px; height: 88px; object-fit: contain; margin-bottom: 6px; }
@media (min-width: 640px) { .monsters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
h1.with-monster { display: flex; align-items: center; gap: 12px; }
h1.with-monster .monster { width: 1.4em; height: auto; flex: none; }

/* Home */
main.home { padding-block: 0 64px; }
.hero { background: linear-gradient(135deg, var(--brand-top), var(--brand-bottom)); color: #fff; padding-block: 48px 56px; }
.hero h1 { color: #fff; }
.hero .lede { color: rgba(255, 255, 255, 0.85); }
.hero .button { background: #fff; color: var(--brand-top); }
.hero .note { margin: 14px 0 0; font-size: 15px; color: rgba(255, 255, 255, 0.8); }
.cards { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.card .monster { width: 48px; height: 48px; flex: none; }
.card strong { display: block; }
.card span { color: var(--muted); font-size: 15px; }
.card.plumo { box-shadow: inset 4px 0 0 var(--plumo); }
.card.mino { box-shadow: inset 4px 0 0 var(--mino); }
.card.tixi { box-shadow: inset 4px 0 0 var(--tixi); }
.card.divvy { box-shadow: inset 4px 0 0 var(--divvy); }
.pro { margin-top: 28px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 4px 20px 16px; }
.pro ul { padding-left: 20px; margin: 8px 0; }
.pro li { margin-bottom: 6px; }
.small { font-size: 14px; }
.gallery { margin-top: 40px; }
.gallery .strip { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 16px 12px; max-width: calc(var(--maxw) + 240px); margin: 0 auto; }
.gallery img { flex: none; width: min(62vw, 260px); height: auto; border-radius: 20px; scroll-snap-align: center; }
.cta { text-align: center; margin-top: 48px; }
.cta h2 { margin-bottom: 16px; }
@media (min-width: 900px) {
  .gallery .strip { justify-content: center; overflow-x: visible; }
  .gallery img { width: 220px; }
}

/* Times-table trick pages and the 1-minute test */
.crumbs { font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.crumbs a { color: var(--muted); }
.steps li { margin-bottom: 6px; }
.table-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px 16px; font-variant-numeric: tabular-nums; }
.tricks { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 10px; }
.tricks a { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.tricks span { color: var(--muted); font-size: 15px; }
.cta { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; margin: 36px 0 20px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 18px; }
.cta .monster { width: 56px; height: auto; }
.cta strong { display: block; }
.cta span { color: var(--muted); font-size: 15px; }
.cta .button { grid-column: 1 / -1; text-align: center; }
.quiz-form { display: grid; gap: 8px; }
.quiz-row { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-size: 19px; }
.quiz-row input, .test-form input { width: 6ch; font: inherit; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); }
.quiz-row.right input { border-color: var(--plumo); }
.quiz-row.wrong input { border-color: #e5484d; }
.quiz-row .answer { color: #e5484d; font-weight: 600; }
.button.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); margin-left: 8px; }
.quiz-form .button, .timed-test .button { border: 0; font: inherit; font-weight: 600; cursor: pointer; justify-self: start; }
.timed-test fieldset { border: 1px solid var(--rule); border-radius: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; }
.clock { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.test-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.prompt { font-size: 36px; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.test-form input { font-size: 28px; }
.score { font-size: 28px; font-weight: 700; }
.button[hidden] { display: none; }

/* The animated worked example on each trick page: lines appear one after another. */
.demo { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 24px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.demo .monster { width: 64px; height: auto; flex: none; }
.demo ol { flex: 1; white-space: nowrap; list-style: none; margin: 0; padding: 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.5; }
/* Visible by default; "backwards" hides each line only while its animation waits, so a browser that
   never runs the animation still shows the example. */
.demo li { animation: demo-in 0.45s ease-out backwards; animation-delay: calc(var(--step) * 0.9s + 0.3s); }
.demo li:first-child { color: var(--accent); }
.demo li:last-child { color: var(--plumo); }
.demo .replay { flex-basis: 100%; text-align: right; padding: 0; background: none; border: 0; color: var(--accent); font: inherit; font-size: 15px; cursor: pointer; }
@keyframes demo-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .demo li { animation: none; } }
.sheet { font-weight: 600; }

/* The list of other free practice pages at the end of each one. */
.tools ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tools a { display: inline-block; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 15px; }
.downloads { list-style: none; padding: 0; display: grid; gap: 8px; }

/* The multiplication chart: fits a phone; a tapped square lights up its row and column. */
.chart-wrap { overflow-x: auto; margin: 0 0 8px; }
.chart { border-collapse: collapse; table-layout: fixed; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; text-align: center; background: var(--surface); }
.chart th, .chart td { border: 1px solid var(--rule); padding: 6px 0; min-width: 2ch; }
.chart th { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-weight: 700; }
.chart td { cursor: pointer; }
.chart .sq { background: color-mix(in srgb, #ffc94d 22%, var(--surface)); }
.chart .hl { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.chart .on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chart-status { font-weight: 600; min-height: 1.5em; }
@media (max-width: 480px) { .chart { font-size: 12px; } .chart th, .chart td { padding: 4px 0; } }

/* Divisibility rules and mental math tricks. */
.rule, .trick { margin: 0 0 20px; }
.rule h3 { margin-bottom: 4px; }
.rule p { margin: 4px 0; }
.worked { color: var(--muted); font-variant-numeric: tabular-nums; }
.trick .demo { margin-bottom: 8px; }
.yes-no { border: 0; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.yes-no legend { float: left; margin-right: 8px; font-variant-numeric: tabular-nums; }
.yes-no.right legend { color: var(--plumo); }
.yes-no.wrong legend { color: #e5484d; }
.yes-no .answer { flex-basis: 100%; color: var(--muted); font-size: 15px; }
.yes-no.wrong .answer { color: #e5484d; font-weight: 600; }
