/* ===== Ойқадам — оқушы беттерінің стильдері ===== */
.app-body { background: var(--bg-soft); min-height: 100vh; }

.app-header { position: sticky; top: 0; }
.app-header-row { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; gap: 12px; }
.app-nav { display: flex; gap: 18px; }
.app-nav a { text-decoration: none; font-weight: 600; font-size: 15px; }
.app-nav a:hover { color: var(--brand); }

.app-main { padding-top: 32px; padding-bottom: 64px; }

.app-card {
  background: #fff; border-radius: 14px; padding: 28px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08); margin-bottom: 24px;
}
.app-card.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.app-card h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; margin: 6px 0 12px; }
.app-card h2 { font-size: 20px; margin-bottom: 8px; }

.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-between.wrap { flex-wrap: wrap; }

/* Прогресс жолағы */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0 16px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.progress.big { height: 12px; }

/* Сұрақ */
.question {
  font-size: clamp(22px, 3vw, 30px); font-weight: 600; text-align: center;
  padding: 28px 12px; margin: 16px 0; background: var(--bg-soft); border-radius: 12px; line-height: 1.5;
}
.question.long { font-size: clamp(18px, 2vw, 22px); font-weight: 500; text-align: left; padding: 22px 24px; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .8em; margin: 0 .15em; line-height: 1.15; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .25em; }
.hint { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.answer-row { display: flex; gap: 10px; }
.answer-row input {
  flex: 1; min-width: 0; font-size: 18px; padding: 10px 14px;
  border: 2px solid #cbd5e1; border-radius: 8px; outline: none;
}
.answer-row input:focus { border-color: var(--brand); }
.answer-row .btn { white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn { cursor: pointer; font-family: inherit; }
.btn-sm { padding: 6px 16px; font-size: 13px; }

/* Деңгейлер */
.lv-badge {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  font-size: 14px; font-weight: 800; color: #fff; vertical-align: middle; letter-spacing: 0;
}
h1 .lv-badge { width: 32px; height: 32px; font-size: 17px; margin-left: 6px; vertical-align: 4px; }
.eyebrow .lv-badge { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; margin-right: 4px; vertical-align: -1px; }
.lv-A { background: #22c55e; }
.lv-B { background: #f59e0b; }
.lv-C { background: #ef4444; }

.level-pick { border: 0; display: grid; gap: 8px; margin: 10px 0 4px; }
.level-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.level-card {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 10px; padding: 10px 14px; transition: border-color .15s, background .15s;
}
.level-card:hover { border-color: #94a3b8; }
.level-card:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }
.level-card input { accent-color: var(--brand); }
.level-card .lv-badge { width: 34px; height: 34px; font-size: 17px; flex-shrink: 0; }
.lc-text { display: grid; }
.lc-text small { color: var(--muted); font-size: 13px; }

.level-track { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap; }
.lt-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lt-item.current { color: var(--ink); font-weight: 700; }
.lt-item.current .lv-badge { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--brand); }
.lt-item.locked .lv-badge { background: #cbd5e1; }
.lt-item.done small { color: #16a34a; font-weight: 700; }
.lt-line { width: 24px; height: 2px; background: var(--line); }
.lt-item.skipped { opacity: .35; }
.lt-item.done .lv-badge { box-shadow: none; }
/* Маршруттағы шағын жолақ */
.level-track.mini { gap: 4px; margin: 0; }
.level-track.mini .lv-badge { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }
.level-track.mini .lt-line { width: 8px; }
.level-track.mini .lt-item.current .lv-badge { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--brand); }
.level-track.mini small { font-size: 10px; }
.step-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.badge-list li { list-style: none; margin-left: -18px; line-height: 1.8; }
.badge-list .lv-badge { margin-right: 4px; vertical-align: -4px; }
.badge-list .lv-badge, .next-box b .lv-badge, .feedback .lv-badge, p .lv-badge { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }

.next-box.levelup { background: #fffbeb; border-color: #fcd34d; margin-top: 12px; }
.feedback .levelup { text-align: left; }
.level-note { background: #fef2f2; border-left: 4px solid #ef4444; padding: 8px 12px; border-radius: 6px; margin-top: 10px; font-size: 14px; line-height: 1.8; }

/* Математикалық редактор */
.mi { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.part .mi { max-width: 460px; }
.mi-box {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  border: 2px solid #cbd5e1; border-radius: 8px; padding: 6px 12px; background: #fff; min-height: 50px;
}
.mi-box:focus-within { border-color: var(--brand); }
.mi input { border: 0; outline: none; font: inherit; font-size: 18px; background: transparent; color: var(--ink); }
.mi-whole { flex: 1; min-width: 0; padding: 4px 0; }
.mi-frac { display: none; flex-direction: column; align-items: center; gap: 3px; }
.mi-bar { width: 100%; height: 2px; background: var(--ink); border-radius: 1px; }
.mi .mi-n, .mi .mi-d, .mi[data-mode="mixed"] .mi-whole {
  width: 60px; text-align: center; font-size: 17px; padding: 2px 4px;
  border: 1.5px dashed #94a3b8; border-radius: 5px;
}
.mi .mi-n:focus, .mi .mi-d:focus, .mi[data-mode="mixed"] .mi-whole:focus {
  border: 1.5px solid var(--brand); background: #f0fdfa;
}
.mi[data-mode="frac"] .mi-whole { display: none; }
.mi[data-mode="frac"] .mi-frac, .mi[data-mode="mixed"] .mi-frac { display: flex; }
.mi[data-mode="frac"] .mi-box, .mi[data-mode="mixed"] .mi-box { flex: 0 0 auto; }
.mi[data-mode="mixed"] .mi-whole { flex: 0 0 auto; }
.mi-tools {
  display: flex; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 5px; box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.mi-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 8px; cursor: pointer; display: grid; place-items: center; font-size: 15px;
}
.mi-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--brand-dark); stroke-width: 1.6; }
.mi-btn:hover:not(:disabled) { border-color: var(--brand); background: #f0fdfa; }
.mi-clear { color: #dc2626; }
.mi input:disabled, .mi-btn:disabled { opacity: .6; cursor: default; }

/* Көп бөлімді сұрақтар */
.parts { display: grid; gap: 14px; }
.parts > .btn { justify-self: start; margin-top: 4px; }
.part { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; transition: background .2s, border-color .2s; }
.part-q { margin-bottom: 10px; line-height: 1.7; }
.part .hint { text-align: left; margin-bottom: 8px; }
.part-input { width: 100%; max-width: 260px; font-size: 17px; padding: 8px 12px; border: 2px solid #cbd5e1; border-radius: 8px; outline: none; }
.part-input:focus { border-color: var(--brand); }
.part-ok { border-color: #86efac; background: #f0fdf4; }
.part-bad { border-color: #fca5a5; background: #fef2f2; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 2px solid #cbd5e1; border-radius: 8px; padding: 8px 14px; font-size: 15px; background: #fff;
}
.choice:hover { border-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: #f0fdfa; font-weight: 600; }
.choice input { accent-color: var(--brand); }
.data-list { font-family: Georgia, serif; letter-spacing: .5px; }

.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; margin-top: 14px; padding: 4px 0; }
.btn-link:hover { color: var(--ink); }
.btn-link.danger:hover { color: #dc2626; }
.error { color: #dc2626; font-size: 14px; margin-top: 8px; }

/* Қарсы алу */
.welcome h1 { font-size: clamp(28px, 4vw, 38px); }
.how-steps { list-style: none; counter-reset: s; margin: 24px 0; display: grid; gap: 12px; }
.how-steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; align-items: center; }
.how-steps li::before {
  content: counter(s); grid-row: span 2; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.how-steps span { color: var(--muted); font-size: 14px; }
.start-form { display: grid; gap: 8px; }
.start-form label { font-weight: 600; font-size: 14px; }
.start-form input { font-size: 17px; padding: 10px 14px; border: 2px solid #cbd5e1; border-radius: 8px; outline: none; }
.start-form input:focus { border-color: var(--brand); }
.start-form .btn { margin-top: 8px; justify-self: start; }

/* Білім картасы */
.pie-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.pie { width: 220px; height: 220px; flex-shrink: 0; }
.legend { list-style: none; display: grid; gap: 8px; font-size: 14px; min-width: 200px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-left: auto; padding-left: 12px; }
.dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.results-top { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; margin: 16px 0 28px; }
.big-stat { text-align: center; }
.big-num { font-size: 56px; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; }
.big-stat p { margin-bottom: 16px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.res-col { border-radius: 10px; padding: 16px; border-top: 4px solid; background: var(--bg-soft); }
.res-col.ok { border-color: #16a34a; }
.res-col.warn { border-color: #f59e0b; }
.res-col.bad { border-color: #dc2626; }
.res-col h3 { font-size: 16px; margin-bottom: 8px; }
.plain-list { padding-left: 18px; font-size: 15px; }
.plain-list li { margin-bottom: 4px; }
.plain-list a { color: var(--brand-dark); }

/* Маршрут */
.route-head {
  display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap;
  background: #fff; border-radius: 14px; padding: 28px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.route-head > div:first-child { flex: 1; min-width: 260px; }
.route-head h1 { font-size: clamp(26px, 3vw, 34px); margin: 4px 0; }
.next-box {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 12px; padding: 16px; margin-top: 8px;
}
.next-box b { font-size: 18px; }
.next-box .btn { margin-top: 6px; }

.route-list { list-style: none; margin-top: 20px; position: relative; }
.route-list::before { content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 16px; padding-bottom: 20px; position: relative; }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--c); color: #fff; position: relative; z-index: 1;
}
.step.is-locked .step-dot { background: #cbd5e1; }
.step-body { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.step.is-ready .step-body { border-color: #99f6e4; background: #f0fdfa; }
.step-body h3 { font-size: 16px; }
.step-body .btn { margin-top: 10px; }

.chip { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.chip.ready { background: #ccfbf1; color: #0f766e; }
.chip.info  { background: #e0e7ff; color: #4338ca; }
.chip.warn  { background: #fef3c7; color: #b45309; }
.chip.locked { background: #f1f5f9; color: #64748b; }
.chip.ok { background: #dcfce7; color: #15803d; }

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary h2 { display: inline; }
details summary::after { content: " ▾"; color: var(--muted); }
details[open] summary::after { content: " ▴"; }
.done-list { margin-top: 12px; }

.route-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.route-actions .btn-link { margin-top: 0; }

/* Тақырып беті */
.back { display: inline-block; margin-bottom: 16px; color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.back:hover { text-decoration: underline; }
.lesson { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; }
.lesson summary { padding: 12px 16px; font-weight: 700; }
.lesson-body { padding: 0 16px 16px; }
.lesson-body p, .lesson-body ol, .lesson-body ul { margin-bottom: 10px; }
.lesson-body ol, .lesson-body ul { padding-left: 22px; }
.example { background: #fffbeb; border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; margin: 10px 0; line-height: 1.9; }

.streak { display: flex; gap: 6px; }
.streak span { width: 16px; height: 16px; border-radius: 50%; background: var(--line); transition: background .3s; }
.streak span.on { background: var(--brand); }

.feedback { border-radius: 10px; padding: 14px 16px; margin: 16px 0 12px; line-height: 1.9; }
.feedback.ok { background: #dcfce7; color: #14532d; }
.feedback.bad { background: #fee2e2; color: #7f1d1d; }
.feedback.bad p { margin-top: 6px; }
.feedback.mastery { background: #f0fdfa; border: 2px solid var(--brand); text-align: center; padding: 28px; }
.feedback.mastery h3 { font-size: 22px; margin-bottom: 6px; }
.big-emoji { font-size: 48px; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

@media (max-width: 760px) {
  .app-card, .route-head { padding: 20px 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .answer-row { flex-direction: column; }
  .pie { width: 180px; height: 180px; }
  .results-top, .pie-wrap { justify-content: center; }
  .app-nav { gap: 12px; }
  .app-nav a { font-size: 14px; }
  .app-nav a:last-child { display: none; }
}

/* ===== Оқу мақсаттары ===== */
.obj-code {
  display: inline-block; font-size: .78em; font-weight: 700; font-variant-numeric: tabular-nums;
  background: #f1f5f9; color: #334155; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; vertical-align: 1px;
}
.obj-h1 { font-size: clamp(20px, 2.6vw, 26px) !important; line-height: 1.35; }
.obj-h1 .obj-code { font-size: 15px; }
.step-body h3 { font-size: 15px; line-height: 1.45; }
.weak-area { margin-top: 18px; }
.weak-area h3 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.big-of { font-size: 24px; color: var(--muted); font-weight: 700; }

/* Сынып таңдау */
.grade-pick { border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 6px; }
.grade-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.grade-card {
  display: grid; gap: 2px; text-align: left; cursor: pointer; font: inherit;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}
.grade-card b { font-size: 18px; }
.grade-card small { color: var(--muted); font-size: 13px; }
.grade-card:hover { border-color: #94a3b8; }
.grade-card.on { border-color: var(--brand); background: #f0fdfa; }

/* Суреттер мен суретті нұсқалар */
.question svg.fig, .part-q svg.fig { display: block; margin: 12px auto 0; max-width: 100%; height: auto; }
.choices.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choices.pics .choice { justify-content: center; padding: 8px; }
.choices.pics .choice svg { max-width: 100%; height: auto; }

/* Интерактив тапсырмалар */
.wg { width: 100%; max-width: 620px; border: 2px solid #cbd5e1; border-radius: 12px; background: #fff; padding: 8px; outline: none; }
.wg:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px #ccfbf1; }
.wg-plane { max-width: 380px; }
.wg-svg { width: 100%; height: auto; display: block; cursor: crosshair; touch-action: manipulation; }
.wg-readout { font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; }
.wg.wg-off .wg-svg { cursor: default; }
