/* Mathfun — лэндинг.
   Язык самого приложения: серо-голубой фон #edf0f2, белые «таблетки» с серой
   чертой #ccc, один жёлтый #ffcf00 — выбранное и главная кнопка, чернила #111.
   Примеры — Golos Text Bold крупно, счёт — Bender Bold, как у звезды в игре.
   Страница светлая от начала до конца: тёмное — только экран в режиме инверсии
   внутри ноутбука. Прокрутку ничего не перехватывает. */

@font-face { font-family: "Bender"; src: url("/mathfun/brand/bender-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #edf0f2;
  --surface: #fff;
  --surface-hover: #fffbcc;
  --line: #ccc;
  --ink: #111;
  --ink-2: rgb(17 17 17 / 74%);
  --dim: #8b9096;
  --accent: #ffcf00;
  --accent-hover: #ffc400;
  --pad: clamp(20px, 4.4vw, 72px);
  --max: 1200px;
  --sans: "Golos Text", system-ui, -apple-system, sans-serif;
  --num: "Bender", "Golos Text", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .15, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, video, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
figure { margin: 0; }
::selection { background: var(--accent); color: var(--ink); }

.wrap { max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }
.h1 { margin: 0; font: 700 clamp(40px, 4.6vw, 68px)/1.02 var(--sans); letter-spacing: -.035em; text-wrap: balance; }
.h2 { margin: 0; font: 700 clamp(30px, 3.4vw, 50px)/1.05 var(--sans); letter-spacing: -.03em; text-wrap: balance; }
.lead { margin: 0; max-width: 48ch; font: 400 clamp(17px, 1.35vw, 20px)/1.5 var(--sans); color: var(--ink-2); text-wrap: pretty; }
.note { margin: 12px 0 0; font-size: 14px; line-height: 1.45; color: var(--dim); max-width: 56ch; text-wrap: pretty; }
.sec { padding: clamp(80px, 9vw, 136px) 0 0; }
.copy { display: grid; gap: 18px; max-width: 760px; margin-bottom: clamp(28px, 3.4vw, 48px); }
/* Заметка автора: почему сделано так — абзац с жёлтой чертой, как выбранная таблетка */
.why { margin: clamp(28px, 3vw, 40px) 0 0; padding-left: 16px; border-left: 4px solid var(--accent); max-width: 62ch; font-size: 16px; line-height: 1.6; text-wrap: pretty; }

/* ── Таблетки и кнопки: как в приложении ───────────────────────────────── */
.pills { display: flex; width: max-content; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); gap: 1px; }
.pill { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; padding: 9px 16px; border: 0; background: var(--surface); font: 400 15px/1.2 var(--sans); cursor: pointer; transition: background-color .3s; }
.pill:hover { background: var(--surface-hover); }
.pill.is-on { background: var(--accent); }
.pill:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 50px; padding: 0 22px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font: 500 17px/1 var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .15s var(--ease), background-color .3s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(.95); } /* как «Next Examples» в игре */
.btn--accent { border-color: var(--accent); background: var(--accent); }
.btn--accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--quiet { height: 44px; padding: 0 16px; font-size: 15px; }
.btn__icon { width: 20px; height: 20px; flex: none; }
.btn:focus-visible, .top a:focus-visible, .q:focus-visible, .tip:focus-visible, .board__next:focus-visible, .invert__spot:focus-visible, .ops:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  height: 64px; padding: 0 max(var(--pad), calc((100vw - var(--max)) / 2));
  background: rgb(237 240 242 / 88%); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.top.is-scrolled { border-bottom-color: var(--line); }
.top__brand { display: inline-flex; align-items: center; gap: 9px; font: 700 20px/1 var(--sans); letter-spacing: -.02em; text-decoration: none; }
.top__star { width: 24px; height: 24px; fill: var(--accent); }
.top__home { font: 500 15px/1 var(--sans); text-decoration: none; padding: 11px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.top__home:hover { background: var(--surface-hover); }

/* ── Устройства ────────────────────────────────────────────────────────── */
/* Телефон: снимки и записи 390 × 844 точек */
.phone { width: 100%; padding: 3.4%; border-radius: 14% / 6.6%; background: var(--ink); }
.phone__screen { position: relative; aspect-ratio: 390 / 844; border-radius: 10.5% / 4.9%; overflow: hidden; background: var(--bg); }
.phone__screen img, .phone__screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Ноутбук: экран 1440 × 900, приложение во весь экран */
/* левый край экрана — на линии заголовков, основание выступает на пару процентов */
.laptop { position: relative; margin-bottom: 1.4%; }
.laptop__screen { position: relative; aspect-ratio: 1440 / 900; border: clamp(8px, 1.3vw, 16px) solid var(--ink); border-bottom-width: clamp(14px, 2.2vw, 26px); border-radius: clamp(10px, 1.5vw, 18px) clamp(10px, 1.5vw, 18px) 4px 4px; overflow: hidden; background: var(--bg); }
.laptop::after { content: ""; position: absolute; left: -2%; right: -2%; top: 100%; height: clamp(8px, 1.1vw, 14px); border-radius: 0 0 12px 12px / 0 0 100% 100%; background: #2b2b2b; }

/* ── Первый экран ──────────────────────────────────────────────────────── */
.hero { padding: clamp(28px, 3.6vw, 56px) 0 0; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 13fr); gap: 32px clamp(28px, 4vw, 64px); align-items: center; }
.hero__copy { display: grid; gap: 26px; }
.hero__photo img { width: 100%; border-radius: 14px; }

/* ── Живая доска ───────────────────────────────────────────────────────── */
.hold { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 21vw, 280px); gap: clamp(24px, 4vw, 64px); align-items: start; }
.board {
  position: relative; display: grid; gap: 10px; padding: clamp(14px, 1.6vw, 22px); border-radius: 16px;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; -webkit-user-select: none; user-select: none;
}
.board__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pills--ops .pill { padding: 8px 18px; font-size: 22px; line-height: 1; }
.pills--rows, .pills--ranges { width: 100%; max-width: 560px; }
.pills--rows .pill { padding: 9px 4px; }
.pills[hidden] { display: none; }
.board__score { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 10px 12px; border-radius: 6px; background: #f7f7f7; font: 700 22px/1 var(--num); font-variant-numeric: tabular-nums; }
.star { width: 22px; height: 22px; fill: var(--accent); }
.board__qs { display: grid; margin: 4px 0; }
.q {
  display: block; min-height: 1.3em; padding: 0 6px; border: 0; background: none; text-align: left;
  font: 700 clamp(38px, 4.6vw, 70px)/1.3 var(--sans); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease;
}
.q:hover { color: #a80000; } /* цвет наведения из приложения */
.q.is-answered { cursor: default; transition: opacity .5s ease, transform .5s ease, color var(--ink-s, 3s) linear; }
.q.is-answered:hover { color: inherit; }
.q.is-out { opacity: 0; transform: translateY(-20px); }
.q.is-in { opacity: 0; transform: translateY(20px); transition: none; }
.board__next { height: 48px; border: 0; border-radius: 10px; background: var(--accent); font: 400 16px/1 var(--sans); cursor: pointer; transition: background-color .3s, transform .15s var(--ease); }
.board__next:hover { background: var(--accent-hover); }
.board__next:active { transform: scale(.97); }
.tip { display: grid; justify-items: center; gap: 10px; padding: 14px 0 16px; border: 0; border-radius: 10px; background: none; color: var(--dim); font: 400 16px/1.3 var(--sans); cursor: pointer; touch-action: none; transition: background-color .3s; -webkit-touch-callout: none; }
.tip:hover { background: var(--surface-hover); }
.tip__hand { width: 44px; height: 65px; fill: var(--dim); transition: transform .2s, fill .2s; }
.tip.is-down .tip__hand { transform: scale(.95); fill: var(--ink); }
.board__confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hold__phone { position: sticky; top: 96px; }

/* ── Проверка себя ─────────────────────────────────────────────────────── */
.check { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 20vw, 260px); gap: clamp(28px, 5vw, 96px); align-items: center; }
.check .copy { margin-bottom: 0; }

/* ── Очки по рядам ─────────────────────────────────────────────────────── */
.points { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: clamp(28px, 5vw, 80px); align-items: end; }
.pts { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 1px; align-items: end; margin: 0; padding: 0; list-style: none; }
.pts__col { display: grid; justify-items: stretch; gap: 8px; }
.pts__col b { justify-self: center; font: 700 clamp(16px, 1.6vw, 22px)/1 var(--num); }
.pts__col i { height: calc(var(--h) * clamp(160px, 22vw, 300px)); margin: 0 18%; border-radius: 4px 4px 0 0; background: var(--ink); }
.pts__col .pill { padding: 9px 2px; border-radius: 0; box-shadow: 0 0 0 1px var(--line); cursor: default; }
.pts__col .pill:hover { background: var(--surface); }
.pts__col:first-child .pill { border-radius: 10px 0 0 10px; }
.pts__col:last-child .pill { border-radius: 0 10px 10px 0; }
.points__phones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }

/* ── Четыре действия ───────────────────────────────────────────────────── */
.ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 36px); }
.op figcaption { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 16px; }
.op figcaption .pill { flex: none; width: 40px; height: 36px; padding: 0; border-radius: 8px; font-size: 20px; cursor: default; }

/* ── Инверсия ──────────────────────────────────────────────────────────── */
.invert { max-width: 1040px; }
.invert img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .6s ease; }
.invert__dark { opacity: 0; }
.invert.is-dark .invert__dark { opacity: 1; }
/* кнопка лежит ровно на кнопке снимка — нажимается там же, где в приложении */
.invert__spot { position: absolute; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; box-shadow: 0 0 0 0 rgb(255 207 0 / 0); transition: box-shadow .25s; }
.invert__spot:hover { box-shadow: 0 0 0 3px var(--accent); }
.invert__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: clamp(26px, 3vw, 36px) 0 0; }
.invert__bar .note { margin: 0; }
.invert__icon { width: 20px; height: 20px; }
.btn--quiet[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #f4f4f4; }

/* ── Конец ─────────────────────────────────────────────────────────────── */
.end { padding: clamp(96px, 11vw, 168px) 0 clamp(72px, 8vw, 120px); }
.end .wrap { display: grid; gap: 24px; justify-items: start; }
.end__star { width: 72px; height: 72px; fill: var(--accent); }
.foot { border-top: 1px solid var(--line); }
.foot__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 22px; padding-bottom: 28px; font-size: 14px; color: var(--dim); }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ── Ширины ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .points { grid-template-columns: 1fr; align-items: start; }
  .points__phones { max-width: 520px; }
}
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hold { grid-template-columns: 1fr; }
  .hold__phone { position: static; width: min(260px, 70%); }
  .check { grid-template-columns: 1fr; }
  .check__phone { width: min(280px, 72%); }
  /* четыре телефона уходят в ленту — её листает сам посетитель */
  .ops { display: flex; gap: 16px; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 8px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: var(--pad); overscroll-behavior-x: contain; }
  .op { flex: none; width: min(240px, 62vw); scroll-snap-align: start; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top__home { padding: 10px 13px; font-size: 14px; }
  .btn { height: 46px; padding: 0 18px; font-size: 16px; }
  .board { padding: 12px; }
  .pills--ops .pill { padding: 8px 12px; font-size: 20px; }
  .pills--rows .pill { padding: 9px 0; font-size: 14px; }
  .q { font-size: clamp(34px, 11vw, 48px); }
  .pts__col b { font-size: 14px; }
  .pts__col .pill { font-size: 13px; }
}

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