:root {
  --bg: #f3f5f9; --card: #ffffff; --text: #18202c; --muted: #5d6878; --line: #dde2ea;
  --brand: #1f5fbf; --brand-2: #174a96; --brand-soft: #e7effb;
  --ok: #187a3e; --ok-soft: #e3f4e9; --bad: #b42318; --bad-soft: #fdecea; --warn: #9a5b00; --warn-soft: #fff4e0;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select { font: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.wrap { max-width: 880px; margin: 0 auto; padding: 16px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.logo { font-weight: 800; font-size: 20px; color: var(--brand); letter-spacing: -.3px; }
.spacer { flex: 1; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 4px 10px; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.lang button.on { background: var(--brand); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; background: var(--brand); color: #fff; min-height: 44px; }
.btn:hover { background: var(--brand-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: #f7f8fb; }
.btn.danger { background: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--muted); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 18px 0 10px; }

/* Вход */
.login { max-width: 400px; margin: 8vh auto 0; }
.login .card { padding: 24px; }
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 17px; }
.field input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }

/* Главная */
.who { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.subj { display: flex; flex-direction: column; gap: 8px; }
.subj .name { font-weight: 700; font-size: 18px; }
.subj .st { font-size: 14px; }
.subj .badge { align-self: flex-start; }
.subj .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.subj .bar i { display: block; height: 100%; background: var(--brand); }
.subj .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.score { font-size: 28px; font-weight: 800; }

/* Тест */
.testhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-2); }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin: 12px 0; }
.nav button { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; color: var(--muted); }
.nav button.done { background: var(--brand-soft); border-color: #b9cdf0; color: var(--brand-2); }
.nav button.cur { outline: 2px solid var(--brand); outline-offset: 1px; color: var(--text); }
.qnum { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.stem { font-size: 18px; margin: 0 0 14px; white-space: normal; word-wrap: break-word; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font-size: 16px; color: var(--text); min-height: 52px; }
.opt:hover { border-color: #9fb6dc; }
.opt .L { flex: 0 0 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef1f6; font-weight: 700; color: var(--muted); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .L { background: var(--brand); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .L { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .L { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }
.qfoot { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.qfoot .spacer { min-width: 8px; }
.qfoot .btn { white-space: nowrap; }
.saving { font-size: 13px; color: var(--muted); }
.saving.bad { color: var(--bad); font-weight: 600; }
.explain { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #f6f8fc; border-left: 4px solid var(--ok); }

/* Модальное окно */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal .box { background: var(--card); border-radius: 16px; max-width: 480px; width: 100%; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .box h3 { margin: 0 0 10px; font-size: 19px; }
.modal .box .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal .warnline { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 15px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
sup, sub { line-height: 0; }
@media (max-width: 560px) {
  .wrap { padding: 12px 16px; }
  .stem { font-size: 17px; }
  .qfoot .btn { flex: 1 1 40%; }
  .qfoot .btn.danger { flex-basis: 100%; }
  .qfoot .spacer { display: none; }
}

/* ===== Главная (лендинг перед входом) ===== */
html { scroll-behavior: smooth; }
.toplink { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.toplink:hover { color: var(--brand); }
.landing { overflow-x: hidden; }
.landing .wrap { max-width: 1120px; }
.small { font-size: 13px; margin: 12px 0 0; }
.btn.big { min-height: 50px; padding: 12px 22px; font-size: 16px; border-radius: 12px; text-decoration: none; }
.btn.ghost.big { background: rgba(255,255,255,.7); backdrop-filter: blur(6px); }
.btn.light { background: #fff; color: var(--brand-2); }
.btn.light:hover { background: #eef3fc; }
.ico { width: 24px; height: 24px; flex: none; }
.ico.sm { width: 16px; height: 16px; }

.hero { position: relative; padding: 48px 0 90px; background: linear-gradient(180deg, #eaf1fd 0%, #f6f8fd 60%, var(--bg) 100%); isolation: isolate; }
.deco { position: absolute; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.b1 { width: 380px; height: 380px; right: -90px; top: -110px; background: radial-gradient(circle at 30% 30%, #8fb3ff, #3d73e0 70%); opacity: .35; animation: drift 14s ease-in-out infinite; }
.b2 { width: 220px; height: 220px; left: -70px; bottom: 30px; background: radial-gradient(circle at 40% 40%, #ffd28a, #ff9d4d 75%); opacity: .35; animation: drift 17s ease-in-out infinite reverse; }
.b3 { width: 140px; height: 140px; left: 44%; top: 30px; background: radial-gradient(circle, #a7f0cf, #2fbf86 75%); opacity: .25; animation: drift 12s ease-in-out infinite; }
.b4 { width: 260px; height: 260px; right: -60px; top: -80px; background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 70%); opacity: 1; }
.dots { position: absolute; width: 180px; height: 140px; left: 6%; top: 18px; background-image: radial-gradient(#3d73e0 1.6px, transparent 1.6px); background-size: 16px 16px; opacity: .22; }
.dots.d2 { left: auto; right: 24%; top: auto; bottom: 10px; background-image: radial-gradient(#fff 1.6px, transparent 1.6px); opacity: .3; }
.ring { position: absolute; width: 90px; height: 90px; right: 40%; bottom: 70px; border: 10px solid #ff9d4d; border-radius: 50%; opacity: .18; }
@keyframes drift { 0%,100% { transform: translate(0,0) } 50% { transform: translate(14px,-18px) } }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--brand-2); border: 1px solid #cfdcf5; border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.h-big { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.12; letter-spacing: -.8px; margin: 18px 0 14px; font-weight: 800; }
.grad { background: linear-gradient(90deg, #1f5fbf, #6a4bd8 55%, #e0672f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 0 24px; }
.hero-acts { display: flex; gap: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 30px; max-width: 560px; }
.stats div { background: rgba(255,255,255,.75); border: 1px solid #dfe7f5; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.stats b { font-size: 22px; color: var(--brand-2); line-height: 1.2; }
.stats span { font-size: 13px; color: var(--muted); }

.hero-side { position: relative; padding: 30px 10px; }
.login-card { position: relative; z-index: 2; padding: 26px; border-radius: 20px; box-shadow: 0 20px 50px rgba(31,95,191,.18), 0 2px 6px rgba(16,24,40,.06); border-color: #dbe5f6; }
.lc-title { margin: 0 0 6px; font-size: 22px; }
.float { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; box-shadow: 0 8px 24px rgba(16,24,40,.12); white-space: nowrap; animation: bob 5s ease-in-out infinite; }
.f1 { top: -2px; left: -18px; color: var(--ok); }
.f2 { top: 34%; right: -22px; color: var(--brand-2); animation-delay: -1.5s; }
.f3 { bottom: 0; left: 8px; color: #c2560f; animation-delay: -3s; }

.wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 60px; fill: var(--bg); }

.sect { padding: 56px 0; }
.sect.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.h-sect { font-size: clamp(24px, 3vw, 32px); margin: 0 0 6px; letter-spacing: -.4px; }
.sub { color: var(--muted); margin: 0 0 26px; font-size: 17px; }
.feats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feat { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; transition: transform .2s, box-shadow .2s; }
.feat:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(16,24,40,.1); }
.feat h3 { font-size: 17px; margin: 14px 0 6px; }
.feat p { margin: 0; color: var(--muted); font-size: 15px; }
.fi { display: inline-flex; width: 48px; height: 48px; border-radius: 14px; align-items: center; justify-content: center; }
.fi0 { background: #e7effb; color: #1f5fbf; } .fi1 { background: #efe9fd; color: #6a4bd8; }
.fi2 { background: #e3f6ee; color: #18865a; } .fi3 { background: #fff0e3; color: #c2560f; }

.steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; position: relative; }
.steps li { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 18px; background: linear-gradient(160deg, #f4f7fd, #fff); border: 1px solid var(--line); }
.steps li:not(:last-child)::after { content: '→'; position: absolute; right: -14px; top: 30px; color: #9fb6dc; font-weight: 800; }
.steps .num { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #1f5fbf, #6a4bd8); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 8px; box-shadow: 0 6px 14px rgba(31,95,191,.3); }
.steps b { font-size: 17px; }
.steps li > span:last-child { color: var(--muted); font-size: 15px; }

.subjrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 18px; }
.sch { border-radius: 16px; padding: 18px 16px; color: #fff; display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; min-height: 92px; justify-content: flex-end; }
.sch::before { content: ''; position: absolute; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.18); right: -24px; top: -28px; }
.sch b { font-size: 17px; position: relative; } .sch span { font-size: 13px; opacity: .9; position: relative; }
.sch.c1 { background: linear-gradient(135deg, #1f5fbf, #3d8bff); } .sch.c2 { background: linear-gradient(135deg, #0f8f8a, #2fc2a6); }
.sch.c3 { background: linear-gradient(135deg, #5b3fd0, #8f73ff); } .sch.c4 { background: linear-gradient(135deg, #d0542a, #ff9452); }
.sch.c5 { background: linear-gradient(135deg, #2f8a3c, #6cc94f); }
.sch.c6 { background: linear-gradient(135deg, #b0306a, #f06292); } .sch.c7 { background: linear-gradient(135deg, #0d6e9e, #29b6f6); }
.sch.c8 { background: linear-gradient(135deg, #8a5a12, #e0a43a); }

.school { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 24px; justify-content: space-between; border-radius: 24px; padding: 36px; color: #fff; background: linear-gradient(120deg, #17448c, #1f5fbf 50%, #5b3fd0); box-shadow: 0 20px 50px rgba(31,95,191,.25); }
.school p { margin: 8px 0 0; opacity: .92; max-width: 640px; }
.school .h-sect { color: #fff; }
.foot { padding: 26px 0 34px; color: var(--muted); font-size: 14px; text-align: center; }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero-side { max-width: 440px; width: 100%; margin: 0 auto; }
  .feats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .steps li::after { display: none; }
  .subjrow { grid-template-columns: repeat(3, 1fr); }
  .school { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .hero { padding: 26px 0 70px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .feats, .steps { grid-template-columns: 1fr; }
  .subjrow { grid-template-columns: repeat(2, 1fr); }
  .lead { font-size: 16px; }
  .f1 { left: 0; } .f2 { right: 0; }
  .school { padding: 24px; }
  .hero-acts .btn { flex: 1 1 auto; }
  .toplink { display: none; }
}
@media (prefers-reduced-motion: reduce) { .blob, .float { animation: none; } html { scroll-behavior: auto; } .feat { transition: none; } }
@media (max-width: 960px) { .hero-side { order: -1; } }
.f2 { top: auto; bottom: 0; right: 4px; }
.f3 { bottom: 0; left: 4px; }
.hero-side { padding: 30px 10px 44px; }
.topbar:has(+ .landing) .wrap { max-width: 1120px; }
@media (max-width: 560px) { .f2 { right: 0; } .f3 { left: 0; } .hero-side { padding: 26px 0 40px; } }

/* Шрифт: Times New Roman (Windows/Mac), PT Serif — где его нет (Android, Linux); оба с казахскими буквами */
:root { --serif: "Times New Roman", "PT Serif", Times, "Liberation Serif", serif; }
html, body, button, input, select { font-family: var(--serif); }
html, body { font-size: 17px; }
.h-big { font-weight: 700; letter-spacing: -.3px; line-height: 1.08; }
.h-sect, h1, h2, h3, .logo, .lc-title { font-weight: 700; letter-spacing: 0; }
.logo { font-size: 24px; font-style: italic; }
.lead, .sub { font-size: 19px; }
.stats b, .score, .steps .num { font-variant-numeric: lining-nums tabular-nums; }
.btn, .pill, .float, .badge, .lang button { letter-spacing: .1px; }
.stem { font-size: 19px; line-height: 1.55; }
.opt { font-size: 17px; }
@media (max-width: 560px) { .lead { font-size: 17px; } .stem { font-size: 18px; } }
/* кнопки «Сменить предмет» / «Завершить» в правом верхнем углу теста */
.headacts { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 560px) { .headacts { width: 100%; justify-content: flex-end; } }

/* прошлые тестирования */
.hist { margin-top: 8px; } .hrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line, #e5e7eb); }
