:root {
  --bg: #f7f4ef;
  --bg-2: #eef5ff;
  --card: #ffffff;
  --ink: #172033;
  --muted: #4f5b70;
  --line: #e4e0d8;
  --accent: #6d4aff;
  --accent-ink: #5534e0;
  --accent-2: #0f9f8f;
  --accent-soft: #ede9fe;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-hi: "Noto Sans Devanagari", var(--font);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1221;
  --bg-2: #111c31;
  --card: #152038;
  --ink: #f3f7ff;
  --muted: #b3bfd6;
  --line: #273553;
  --accent: #9d8cff;
  --accent-ink: #b9adff;
  --accent-2: #5eead4;
  --accent-soft: #2b2555;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.65 var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 90% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
[lang="hi"] { font-family: var(--font-hi); }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--card); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 12px; }

.top { position: sticky; top: 0; z-index: 5; backdrop-filter: saturate(1.4) blur(12px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: inline-flex; flex: 0 1 182px; min-width: 104px; align-items: center; color: var(--ink); text-decoration: none; }
.wordmark { display: block; width: 100%; height: auto; }
.wordmark-dark { display: none; }
:root[data-theme="dark"] .wordmark-light { display: none; }
:root[data-theme="dark"] .wordmark-dark { display: block; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.nav a:hover { background: var(--accent-soft); }
.nav-signin { flex: none; margin-left: -14px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.nav-signin:hover { background: var(--accent-soft); }
.top .btn-sm { flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px; font-weight: 700; text-decoration: none; border: 2px solid transparent; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, #5b3df0, #0e8f82); box-shadow: 0 8px 22px rgba(91, 61, 240, 0.28); }
.btn-ghost { color: var(--ink); background: var(--card); border-color: var(--line); }
.btn-sm { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 0.95rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

main { padding-bottom: 40px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 22px 0 0; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }

.hero { padding: 40px 0 18px; max-width: 820px; }
.eyebrow { display: inline-block; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; }
h1 { font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.12; margin: 0 0 16px; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.25; margin: 36px 0 12px; }
h3 { font-size: 1.12rem; line-height: 1.35; margin: 0 0 6px; }
.lede { font-size: 1.12rem; color: var(--muted); margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 20px 0 0; }
.facts li { padding: 8px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.facts b { color: var(--ink); font-size: 1.1rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.grid-cls { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform 0.15s ease, border-color 0.15s ease; }
a.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card p { margin: 0 0 8px; }
.card ul { margin: 8px 0 12px; padding-left: 18px; color: var(--muted); font-size: 0.95rem; }
.card .books { font-weight: 700; color: var(--accent-ink); }
.meta { color: var(--muted); font-size: 0.92rem; }
.more { font-weight: 700; color: var(--accent-ink); }
.more::after { content: " \2192"; }
.cls .big { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; margin-bottom: 10px; font-size: 1.5rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6d4aff, #14b8a6); }
.cls p { color: var(--muted); font-size: 0.95rem; }

.problem { margin: 40px 0; padding: 26px 28px; border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--card)), color-mix(in srgb, var(--accent-2) 9%, var(--card))); border: 1px solid var(--line); }
.problem h2 { margin-top: 0; }
.problem p { max-width: 780px; }

.book h2 { padding-top: 8px; border-top: 1px solid var(--line); padding-top: 24px; }
.chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.chapters li { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.chapters p { margin: 4px 0; }
.num { display: inline-block; margin-right: 6px; padding: 1px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.85rem; vertical-align: 2px; }
.topics { color: var(--muted); font-size: 0.95rem; }

.sample { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin: 12px 0; }
.sample .q { margin: 0 0 8px; }
.opts { margin: 0 0 8px; padding-left: 28px; }
.opts li { margin: 4px 0; }
.sample summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); }
.sample details p { margin: 8px 0 0; }
.toc { margin: 18px 0 0; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.toc a { font-weight: 700; }
.guide h3 { margin: 22px 0 6px; font-size: 1.1rem; }
.guide .story { padding: 12px 16px; background: var(--accent-soft); border-radius: 14px; }
.guide .worked, .guide .try { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 18px 10px; margin: 14px 0; }
.guide .worked h3, .guide .try h3 { margin-top: 12px; }
.guide .worked ol { padding-left: 24px; }
.guide .note { padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 12px 12px 0; }
.guide caption { text-align: left; font-weight: 800; padding: 10px 14px; }
.terms { margin: 14px 0; }
.terms dt { font-weight: 800; margin-top: 10px; }
.terms dd { margin: 2px 0 0; }
.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }
.pager a { font-weight: 700; }
.chapter-links { padding-left: 24px; columns: 2 300px; column-gap: 36px; }
.chapter-links li { margin: 6px 0; break-inside: avoid; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.pills a { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-weight: 700; color: var(--ink); }
.pills a:hover { border-color: var(--accent); }

.cta { margin: 48px 0 10px; padding: 34px 28px; border-radius: 24px; text-align: center; color: #fff; background: linear-gradient(135deg, #4c2fd6, #0b7c71); }
.cta h2 { margin: 0 0 8px; color: #fff; }
.cta p { margin: 0 auto; max-width: 620px; color: #eef0ff; }
.cta .cta-row { justify-content: center; }
.cta .btn-primary { background: #fff; color: #3a22b8; box-shadow: none; }
.cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }

.article { max-width: 760px; padding-top: 30px; }
.article h1 { font-size: clamp(1.9rem, 3.8vw, 2.6rem); }
.article p, .article li { font-size: 1.08rem; }
.article ul { padding-left: 22px; }
.article li { margin: 6px 0; }
.byline { color: var(--muted); margin: 0 0 20px; }
.prose { max-width: 780px; }
.legal-hero { padding-bottom: 24px; }
.legal-version { color: var(--muted); font-size: 0.94rem; }
.legal-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 22px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.legal-nav a { font-weight: 700; font-size: 0.92rem; }
.legal-page { padding-bottom: 34px; }
.legal-page h2 { scroll-margin-top: 90px; }
.legal-page li { margin-bottom: 6px; }
.legal-warning { margin: 0 0 24px; padding: 18px 20px; border: 2px solid #d97706; border-radius: 18px; background: #fffbeb; color: #78350f; }
.legal-warning h2 { margin: 0 0 6px; font-size: 1.12rem; }
.legal-warning p { margin: 0; }
.legal-warning code { white-space: normal; }
.legal-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0 28px; }
.legal-card-grid .card { display: block; color: inherit; text-decoration: none; }
.legal-card-grid .card:hover { border-color: var(--accent); }
.legal-contacts { display: grid; gap: 8px; margin: 18px 0 28px; }
.legal-contacts div { display: grid; grid-template-columns: minmax(150px, 0.35fr) 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.legal-contacts dt { font-weight: 800; }
.legal-contacts dd { margin: 0; color: var(--muted); }
.books-table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); font-size: 0.98rem; }
.books-table th, .books-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.books-table th { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; margin: 8px 0 18px; }
.table-wrap > table { margin: 0; }
.guide-note { margin-top: 28px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.guide-note h2 { margin: 0 0 6px; font-size: 1.05rem; }
.guide-note p { margin: 0; color: var(--muted); }
.guide-list { padding-left: 20px; }
.guide-list li { margin: 8px 0; }

.oly-fig { margin: 4px 0 12px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; max-width: 520px; color: #172033; }
.oly-fig svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.oly-code { margin: 4px 0 12px; padding: 12px 14px; background: #f3f1fb; color: #172033; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; font: 0.92rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; tab-size: 4; }
.oly-code code { font: inherit; }
.oly-passage { margin: 18px 0 8px; padding: 14px 18px; background: var(--accent-soft); border-radius: 16px; }
.oly-passage h3 { margin: 0 0 6px; font-size: 1.05rem; }
.oly-passage p { margin: 6px 0; }
.oly-sheets { padding-left: 24px; }
.oly-sheets li { margin: 8px 0; }
.oly-pattern tfoot th, .oly-pattern tfoot td { font-weight: 800; border-bottom: 0; }
.oly-pattern td { font-variant-numeric: tabular-nums; }
.oly-note { margin: 28px 0 0; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 12px 12px 0; color: var(--muted); font-size: 0.95rem; max-width: 780px; }
.oly-block { margin: 36px 0 0; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.oly-block h2 { margin-top: 0; }
.oly-block p { margin: 0 0 12px; color: var(--muted); }
.oly-mention { margin: 18px 0 0; padding: 12px 16px; background: var(--accent-soft); border-radius: 14px; max-width: 780px; }
.oly-mention a { font-weight: 700; white-space: nowrap; }
/* Olympiad page titles get the full page width so they fit on one line on a laptop; the rest of the hero keeps a reading width. */
.hero.oly-hero { max-width: none; }
.oly-hero > :not(h1) { max-width: 820px; }
.oly-hero h1, .oly-article h1, .oly-article h2, .oly-guides h2 { text-wrap: balance; }
.oly-guides { grid-template-columns: 1fr; }
.oly-article h1 { font-size: clamp(1.9rem, 3.4vw, 2.3rem); margin-bottom: 8px; }
.oly-article .dek { margin: 0 0 14px; color: var(--muted); font-size: 1.2rem; }
:root[data-theme="dark"] .oly-code { background: #0f1830; color: #f3f7ff; }
/* Blog: titles stay short enough for one line in the reading column; screenshots and charts sit on white in both themes. */
.blog-article h1, .blog-article h2 { text-wrap: balance; }
.blog-article h1 { font-size: clamp(1.9rem, 3.4vw, 2.3rem); margin-bottom: 8px; }
.blog-article .dek { margin: 0 0 14px; color: var(--muted); font-size: 1.2rem; }
.blog-article h2 { margin-top: 36px; }
.blog-article h3 { margin-top: 28px; font-size: 1.25rem; }
.blog-cover { margin: 8px 0 24px; }
.blog-cover img, .blog-fig img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.blog-fig { margin: 22px auto 26px; }
.blog-fig figcaption { margin-top: 8px; color: var(--muted); font-size: 0.95rem; text-align: center; }
.blog-fig-chart { max-width: 600px; }
.blog-fig-loop { max-width: 440px; }
.blog-fig-tall { max-width: 480px; }
.blog-fig-phone { max-width: 300px; }
.blog-fig-phone img { border-radius: 22px; }
.blog-summary { margin: 0 0 8px; padding: 16px 20px; border: 1px solid var(--line); border-left: 4px solid var(--accent-2); border-radius: 0 14px 14px 0; background: var(--card); }
.blog-summary h2 { margin: 0 0 6px; font-size: 1.1rem; }
.blog-summary ul { margin: 0; }
.blog-article blockquote { margin: 18px 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--accent); }
.blog-article blockquote p { font-style: italic; }
.blog-article blockquote footer { color: var(--muted); font-size: 0.95rem; }
.blog-faq { margin-top: 36px; }
.blog-sources { margin-top: 36px; }
.blog-sources li, .blog-sources a { overflow-wrap: anywhere; }
.blog-article .blog-sources li { font-size: 0.95rem; color: var(--muted); }
.blog-list { display: grid; gap: 18px; max-width: 980px; }
.blog-card { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; align-items: center; }
.blog-card img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.blog-card h2 { margin: 0 0 8px; font-size: 1.3rem; text-wrap: balance; }
.blog-card .byline { margin: 0 0 6px; font-size: 0.92rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.ticks { list-style: none; padding: 0; }
.ticks li { position: relative; padding-left: 30px; margin: 10px 0; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.35em; width: 18px; height: 18px; border-radius: 6px; background: var(--accent-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }

.ticks li.tick-lead { margin: 6px 0 12px; padding: 10px 12px 10px 42px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.ticks li.tick-lead::before { left: 12px; top: 12px; }
.ticks li.tick-lead span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.92rem; }
.lab-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 0; }
.lab-list li { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.lab-list a, .lab-list b { font-weight: 700; color: var(--ink); text-decoration: none; }
.lab-list a:hover { color: var(--accent); }
.lab-list small { color: var(--muted); }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.plan { display: flex; flex-direction: column; }
.plan h2 { font-size: 1.15rem; }
.plan .price { margin: 6px 0 0; color: var(--muted); }
.plan .price b { font-size: 2rem; color: var(--ink); }
.plan .ticks { flex: 1; }
.plan-main { border: 2px solid var(--accent); box-shadow: 0 14px 36px color-mix(in srgb, var(--accent) 22%, transparent); }
.plan { position: relative; }
.plan-badge { position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%); padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
:root[data-theme="dark"] .plan-badge { color: #0c1221; }
.plan-for { margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.plan-main .plan-for { color: var(--accent); }
.paid-preview {
  border-color: var(--line);
  background: color-mix(in srgb, var(--card) 88%, var(--line));
  filter: saturate(0.3);
}
.plan-main.paid-preview { border-color: var(--accent); background: var(--card); filter: none; }
.lab-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin: 20px 0 0; padding: 0; list-style: none; }
.lab-shots li { display: grid; gap: 6px; min-width: 0; margin: 0; }
.lab-shots img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 14%, transparent); }
.lab-shots span { color: var(--muted); font-size: 0.86rem; font-weight: 600; line-height: 1.35; }
@media (max-width: 560px) { .lab-shots { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 72%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; } .lab-shots li { scroll-snap-align: start; } }
.billing[data-paid-plans-enabled="false"] .bill-tabs {
  opacity: 0.55;
  filter: saturate(0.25);
  pointer-events: none;
}
.btn-disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
  box-shadow: none;
}
.launch-note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
}
.prelaunch-price-summary {
  color: var(--ink);
}
.bill-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.bill-tabs { display: inline-flex; gap: 4px; padding: 5px; margin: 0 0 18px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.bill-tabs label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.bill-tabs label:hover { color: var(--ink); }
#bill-month:checked ~ .bill-tabs label[for="bill-month"], #bill-year:checked ~ .bill-tabs label[for="bill-year"] { background: var(--accent); color: #fff; }
#bill-month:focus-visible ~ .bill-tabs label[for="bill-month"], #bill-year:focus-visible ~ .bill-tabs label[for="bill-year"] { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.save-pill, .deal { font-size: 0.78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #dcfce7; color: #166534; }
:root[data-theme="dark"] #bill-month:checked ~ .bill-tabs label[for="bill-month"], :root[data-theme="dark"] #bill-year:checked ~ .bill-tabs label[for="bill-year"] { color: #0c1221; }
:root[data-theme="dark"] .save-pill, :root[data-theme="dark"] .deal { background: #14532d; color: #bbf7d0; }
.deal { position: absolute; top: 18px; right: 18px; }
#bill-month:checked ~ .plans .only-year, #bill-year:checked ~ .plans .only-month,
#bill-month:checked ~ .plan-totals .only-year, #bill-year:checked ~ .plan-totals .only-month { display: none; }
.only-month, .only-year { animation: price-in 0.25s ease; }
@keyframes price-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.was { color: var(--muted); font-weight: 400; text-decoration-thickness: 2px; }
.plan .price .was { font-size: 1.15rem; margin-right: 4px; }
.totals { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.totals + .meta { margin-top: auto; }
.totals th, .totals td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.totals th { text-align: left; font-weight: 700; }
.totals td { text-align: right; font-weight: 700; }
.totals .was { font-size: 0.9rem; margin-right: 4px; }
.plan-totals { max-width: 620px; margin: 16px auto 0; }
.plan-totals h2 { font-size: 1.15rem; }
.totals thead th { padding-top: 0; color: var(--muted); font-size: 0.85rem; text-align: right; }
.totals thead th:first-child { text-align: left; }
@media (prefers-reduced-motion: reduce) { .only-month, .only-year { animation: none; } }
.faq { max-width: 820px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin: 10px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 2px; color: var(--muted); }

.foot { margin-top: 30px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--card) 60%, transparent); }
.foot-in { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; padding-top: 32px; padding-bottom: 20px; }
.foot h2 { font-size: 1rem; margin: 0 0 10px; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin: 6px 0; }
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot p { color: var(--muted); font-size: 0.95rem; }
.foot-classes { display: grid; grid-template-columns: repeat(2, auto); column-gap: 18px; }
.foot-note { padding-bottom: 28px; color: var(--muted); font-size: 0.85rem; }
.foot-social a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.ig-icon { flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.ig-icon .ig-dot { fill: currentColor; stroke: none; }

@media (max-width: 860px) {
  .plans, .two { grid-template-columns: 1fr; }
  .plans .plan-main, .plans .plan-plus { order: -1; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-in > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .top-in { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1 0 104px; max-width: 150px; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .nav-signin { margin-left: auto; padding: 8px 6px; font-size: 0.9rem; }
  .nav a:first-child { padding-left: 0; }
  .nav a:last-child { padding-right: 0; }
  .nav a { padding: 6px 6px; font-size: 0.9rem; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .top-in { padding: 8px 16px; }
  .grid-cls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cls { padding: 16px; }
  .cls .big { width: 44px; height: 44px; font-size: 1.25rem; }
  .hero { padding-top: 26px; }
  .problem, .cta { padding: 22px 18px; }
  .cta .btn { width: 100%; }
  .legal-card-grid { grid-template-columns: 1fr; }
  .legal-contacts div { grid-template-columns: 1fr; gap: 2px; }
  .oly-pattern { font-size: 0.88rem; }
  .oly-pattern th, .oly-pattern td { padding: 8px 6px; }
  .oly-pattern tbody td { overflow-wrap: normal; hyphens: manual; }
  /* Wide guide tables scroll inside .table-wrap instead of squeezing every word onto its own line. */
  .article .table-wrap > table:has(tr > :nth-child(4)) { min-width: 34rem; }
  .oly-block { padding: 18px 16px; }
  .blog-card { grid-template-columns: 1fr; gap: 12px; }
}
/* Five nav links fit across a 360px phone without the last one scrolling out of view. */
@media (max-width: 380px) {
  .nav { gap: 2px; }
  .nav a { font-size: 0.85rem; }
}
/* A 320px phone fits four links; olympiad pages stay one tap away from the class pages. */
@media (max-width: 340px) {
  .nav .nav-oly { display: none; }
}
@media (max-width: 360px) {
  .top-in { gap: 8px; }
  .nav a { padding: 6px 4px; }
  .top .btn-sm { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
