/* «Водитель ИИ» — мобильный формат в духе обучающих игр:
   верхняя панель со стриком и опытом, путь уроков, нижняя навигация.
   Классы «Гаража» (прежний инженерный курс) сохранены ниже. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f4f3f8;
  --card: #ffffff;
  --text: #1d1a27;
  --muted: #736e85;
  --line: #e6e3ef;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --green: #22a06b;
  --green-bg: #e6f6ee;
  --amber: #d97706;
  --red: #dc2626;
  --dark: #17141f;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(23,20,31,.07), 0 8px 24px rgba(23,20,31,.05);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5;
}

/* ---------- каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.tb-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.tb-brand img { width: 34px; height: 34px; }
.tb-stats { display: flex; gap: 14px; font-weight: 700; font-size: 15px; }

.page {
  max-width: 560px; margin: 0 auto;
  padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px));
}

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 4px 8px; border-radius: 12px;
}
.bottomnav a span { font-size: 21px; line-height: 1.15; }
.bottomnav a.active { color: var(--accent); }

.page-title { font-size: 24px; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 18px; font-size: 14.5px; }

.today-chip {
  background: var(--green-bg); color: var(--green);
  border-radius: 99px; padding: 8px 16px; font-weight: 600; font-size: 14px;
  text-align: center; margin-bottom: 16px;
}

/* ---------- путь уроков ---------- */
.pblock { margin-bottom: 26px; }
.pblock-head {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(135deg, #2a1f4d, #4c1d95 60%, #6d28d9);
  color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.locked-block .pblock-head { background: #b7b2c6; }
.pblock-emoji { font-size: 30px; }
.pblock-title { font-weight: 700; font-size: 16.5px; }
.pblock-sub { font-size: 13px; opacity: .85; }
.pblock-locked {
  color: var(--muted); font-size: 14px; background: var(--card);
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 12px 16px;
}

.path { display: flex; flex-direction: column; gap: 4px; }
.node {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text);
  padding: 8px 6px; border-radius: 14px;
}
.node:nth-child(2) { margin-left: 26px; }
.node:nth-child(3) { margin-left: 44px; }
.node:nth-child(4) { margin-left: 26px; }
.node:nth-child(6) { margin-left: 26px; }
a.node:hover { background: #edeaf6; }
.node-circle {
  width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 800; color: #fff;
  background: var(--accent);
  box-shadow: 0 5px 0 #5a3fd6;
}
.node.done .node-circle { background: var(--green); box-shadow: 0 5px 0 #177a4e; }
.node.lock .node-circle { background: #cfcadd; box-shadow: 0 5px 0 #b3add0; font-size: 18px; }
.node.lock { color: var(--muted); }
.node-label { font-weight: 700; font-size: 15.5px; }
.node-label small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }

/* ---------- урок ---------- */
.lesson-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.lesson-quit { font-size: 20px; color: var(--muted); text-decoration: none; padding: 4px 8px; }
.lesson-progress { flex: 1; height: 12px; background: #e3dff0; border-radius: 99px; overflow: hidden; }
.lesson-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .25s; }

.stage { min-height: 280px; }
.card-info {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; font-size: 16.5px;
}
.ci-badge {
  display: inline-block; background: #efeaff; color: var(--accent);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-radius: 99px; padding: 3px 10px; margin-bottom: 12px;
}
.q-text { font-size: 18.5px; font-weight: 700; margin-bottom: 18px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; background: var(--card); border: 2px solid var(--line);
  border-radius: 14px; padding: 13px 16px; font-size: 15.5px; font-family: inherit;
  cursor: pointer; color: var(--text); box-shadow: 0 2px 0 var(--line);
}
.opt:hover:not(:disabled) { border-color: var(--accent-2); }
.opt.sel { border-color: var(--accent); background: #f4f0ff; }
.opt.right { border-color: var(--green); background: var(--green-bg); box-shadow: 0 2px 0 var(--green); }
.opt.wrong { border-color: var(--red); background: #fdeaea; box-shadow: 0 2px 0 var(--red); }
.opt:disabled { cursor: default; opacity: .95; }

.why { margin-top: 16px; border-radius: 14px; padding: 14px 16px; font-size: 14.5px; }
.why.ok { background: var(--green-bg); color: #14532d; }
.why.bad { background: #fdeaea; color: #7f1d1d; }

.lesson-actions { margin-top: 22px; }
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  border: none; border-radius: 14px; padding: 12px 22px;
  font-size: 15.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  font-family: inherit; box-shadow: 0 4px 0 #5a3fd6;
}
.btn:hover { background: #6a48f5; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #5a3fd6; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; }
.btn.small { padding: 8px 15px; font-size: 13.5px; box-shadow: 0 3px 0 #5a3fd6; }
.btn.gray { background: #e9e6f2; color: var(--text); box-shadow: 0 3px 0 #cfc9e0; }
.btn.gray:hover { background: #ddd8ec; }

.finish { text-align: center; padding: 40px 0; }
.finish-emoji { font-size: 64px; margin-bottom: 10px; }
.finish h2 { font-size: 34px; }

/* ---------- общие карточки / статистика ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { text-align: center; padding: 14px 8px; }
.stat .num { font-size: 22px; font-weight: 800; color: var(--accent); }
.stat .lbl { font-size: 12px; color: var(--muted); }

h1 { font-size: 24px; margin-bottom: 6px; }
h2 { font-size: 17px; margin: 20px 0 10px; }
.sub { color: var(--muted); margin-bottom: 18px; font-size: 14.5px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
table.plain td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }

textarea, input[type="number"], input[type="text"] {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-family: inherit; font-size: 14.5px; background: #fbfaff; color: var(--text);
}
textarea:focus, input:focus { outline: none; border-color: var(--accent); }
input[type="number"], input[type="text"] { width: auto; }
label.f { display: block; font-size: 13.5px; font-weight: 600; margin: 12px 0 5px; color: var(--muted); }

/* ---------- «Гараж» (прежний инженерный курс) ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.violet { background: #efeaff; color: var(--accent); }
.pill.amber { background: #fff3e0; color: var(--amber); }

.week-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.week-row:last-child { border-bottom: none; }
.wr-num {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: #eceafb; color: var(--accent);
}
.wr-num.done { background: var(--green-bg); color: var(--green); }
.wr-num.cur { background: var(--accent); color: #fff; }
.wr-title { font-weight: 600; font-size: 15px; }
.wr-sub { font-size: 12.5px; color: var(--muted); }
.wr-right { margin-left: auto; }

.lesson { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.lesson:last-child { border-bottom: none; }
.lesson-ico { width: 36px; height: 36px; border-radius: 10px; background: #efeaff; color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.lesson-title { font-weight: 600; font-size: 14.5px; }
.lesson-sub { font-size: 12px; color: var(--muted); word-break: break-all; }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task form { line-height: 0; }
.checkbox {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid #c9c3dc;
  background: none; cursor: pointer; font-size: 14px; color: #fff; line-height: 1;
}
.checkbox.on { background: var(--green); border-color: var(--green); }
.task.done-task .task-text { color: var(--muted); }

.artifact {
  border-left: 4px solid var(--accent); background: #f6f3ff;
  border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; margin: 12px 0;
}
.artifact .cap { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin-bottom: 6px; }

.risk-banner {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px; font-size: 14px;
}

.review-item { border-bottom: 1px solid var(--line); padding: 14px 0; }
.review-item:last-child { border-bottom: none; }
.review-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.review-body { font-size: 14px; }
.review-body .lbl { color: var(--muted); font-weight: 600; }

/* ---------- Академия: курсы для чтения ---------- */
.acad-course {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text);
  margin-bottom: 12px;
}
.acad-locked { opacity: .65; }
.ac-emoji { font-size: 34px; }
.ac-body { flex: 1; min-width: 0; }
.ac-title { font-weight: 700; font-size: 17px; }
.ac-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ac-meta { color: var(--accent); font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.acad-locked .ac-meta { color: var(--muted); font-weight: 500; }
.ac-arrow { color: var(--muted); font-size: 26px; }

.acad-back {
  display: inline-block; color: var(--accent); text-decoration: none;
  font-weight: 600; font-size: 14px; margin-bottom: 10px;
}
.acad-note { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.acad-note a { color: var(--accent); word-break: break-all; }

.acad-toc { margin-bottom: 20px; }
.ac-toc-title { font-weight: 700; margin-bottom: 8px; }
.acad-toc a {
  display: block; color: var(--text); text-decoration: none;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.acad-toc a:last-child { border-bottom: none; }

.acad-chapter {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 14px;
}
.acad-chapter h2 {
  font-size: 18px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.ac-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.acad-chapter p { margin-bottom: 12px; font-size: 15.5px; line-height: 1.65; }
.acad-chapter p:last-of-type { margin-bottom: 6px; }
.acad-up {
  color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600;
}
