/* ============ Мини-репетитор: тёмная тема с акцентами ============ */
:root {
  --bg: #0d1220;
  --bg-2: #131a2c;
  --panel: #172038;
  --panel-2: #1d2845;
  --line: #28334f;
  --text: #eaf0ff;
  --muted: #93a0c2;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --green: #2fd48a;
  --yellow: #ffc857;
  --red: #ff6b7a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1b2a55 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #2a1b55 0%, transparent 55%),
    var(--bg);
  color: var(--text);
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(13, 18, 32, .75);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo { font-size: 30px; filter: drop-shadow(0 4px 10px rgba(91,140,255,.5)); }
.brand__text h1 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.brand__text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.streak {
  font-size: 14px; padding: 8px 14px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,200,87,.15), rgba(255,107,122,.12));
  border: 1px solid rgba(255,200,87,.35);
}
.streak strong { color: var(--yellow); }
.topbar__right { display: flex; align-items: center; gap: 10px; }

.knowcheck {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: rgba(110,231,183,.08); border: 1px solid rgba(110,231,183,.28);
  font-size: 14px; line-height: 1.55;
}

/* ---------- Раскладка ---------- */
.layout {
  flex: 1; display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px; padding: 18px 22px; min-height: 0;
}

/* ---------- Боковая панель ---------- */
.sidebar { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.panel__title {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted);
}

.subjects, .topics { display: flex; flex-direction: column; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid transparent;
  color: var(--text); font-size: 14.5px; cursor: pointer;
  transition: .18s transform, .18s background, .18s border;
  text-align: left; width: 100%;
}
.chip:hover { background: rgba(91,140,255,.12); transform: translateX(3px); }
.chip.active {
  background: linear-gradient(135deg, rgba(91,140,255,.25), rgba(124,91,255,.18));
  border-color: rgba(91,140,255,.6);
  box-shadow: 0 6px 18px rgba(91,140,255,.25);
}
.chip__icon { font-size: 18px; }
.chip small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.topics .chip { font-size: 13.5px; padding: 9px 12px; }
.topic-done { margin-left: auto; color: var(--green); font-size: 13px; }

/* ---------- Прогресс ---------- */
.meters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.meter span { font-size: 12.5px; color: var(--muted); }
.meter strong { font-size: 13px; float: right; color: var(--text); }
.bar {
  height: 9px; margin-top: 6px; border-radius: 999px;
  background: rgba(255,255,255,.07); overflow: hidden; clear: both;
}
.bar__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--green), #9ef7cf);
  border-radius: 999px; transition: width .5s ease;
}
.bar__fill--blue { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Кнопки ---------- */
.btn {
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; padding: 11px 18px;
  transition: .18s transform, .18s filter, .18s box-shadow;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(91,140,255,.35);
}
.btn--ghost {
  width: 100%; background: transparent; color: var(--muted);
  border: 1px dashed var(--line); font-weight: 500;
}
.btn--ghost:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Чат ---------- */
.chat {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(23,32,56,.65), rgba(29,40,69,.45));
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.chat__scroll { flex: 1; overflow-y: auto; padding: 20px 22px; }
.chat__messages { display: flex; flex-direction: column; gap: 14px; max-width: 860px; margin: 0 auto; }

.msg { display: flex; }
.msg--user { justify-content: flex-end; }
.msg__bubble {
  max-width: 88%; padding: 13px 16px; border-radius: 16px;
  font-size: 15px; line-height: 1.55;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  animation: pop .25s ease;
}
.msg--user .msg__bubble {
  background: linear-gradient(135deg, rgba(91,140,255,.3), rgba(124,91,255,.22));
  border-color: rgba(91,140,255,.5);
  border-bottom-right-radius: 6px;
}
.msg--bot .msg__bubble { border-bottom-left-radius: 6px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Разбор ---------- */
.lesson { display: flex; flex-direction: column; gap: 12px; }
.lesson__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: rgba(91,140,255,.18); border: 1px solid rgba(91,140,255,.45);
  color: #bcd2ff; letter-spacing: .4px;
}
.badge--warn { background: rgba(255,107,122,.14); border-color: rgba(255,107,122,.45); color: #ffc2c9; }
.badge--ok { background: rgba(47,212,138,.14); border-color: rgba(47,212,138,.45); color: #a9f3d3; }
.lesson__title { margin: 0; font-size: 17px; }

.card {
  background: rgba(13,18,32,.6);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.card h4 {
  margin: 0 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent);
}
.card p { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }

.step {
  display: flex; gap: 12px; padding: 12px 14px;
  background: rgba(91,140,255,.07);
  border: 1px solid rgba(91,140,255,.28);
  border-radius: 14px;
  animation: pop .3s ease backwards;
}
.step__num {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700; font-size: 14px;
}
.step__body { font-size: 14.7px; line-height: 1.55; }
.step__body strong { color: #ffd98a; }

.mistakes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mistakes li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 12px; border-radius: 10px; font-size: 14.3px;
  background: rgba(255,107,122,.08); border: 1px solid rgba(255,107,122,.3);
}
.mistakes b { color: #ffb3bc; }
.mistakes .fix { color: #a9f3d3; }

/* ---------- Проверь себя ---------- */
.quiz { border-color: rgba(255,200,87,.4); background: rgba(255,200,87,.06); }
.quiz h4 { color: var(--yellow); }
.quiz__q { font-size: 15.5px; font-weight: 600; margin-bottom: 10px; }
.quiz__opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  text-align: left; padding: 11px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  color: var(--text); font-size: 14.5px; transition: .15s;
}
.opt:hover:not(:disabled) { border-color: var(--accent); background: rgba(91,140,255,.12); }
.opt:disabled { cursor: default; opacity: .75; }
.opt.correct { background: rgba(47,212,138,.2); border-color: var(--green); opacity: 1; }
.opt.wrong { background: rgba(255,107,122,.2); border-color: var(--red); opacity: 1; }
.quiz__explain {
  margin-top: 10px; font-size: 14px; line-height: 1.5;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(0,0,0,.28); border: 1px dashed var(--line);
}
.quiz__nav { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- Итог ---------- */
.verdict { border-color: rgba(124,91,255,.45); background: rgba(124,91,255,.08); }
.verdict h4 { color: #c9b8ff; }
.verdict__score { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.verdict__lvl { display: inline-block; margin-left: 10px; font-size: 14px; padding: 5px 12px; border-radius: 999px; }
.lvl-good { background: rgba(47,212,138,.18); color: #a9f3d3; border: 1px solid rgba(47,212,138,.5); }
.lvl-mid { background: rgba(255,200,87,.18); color: #ffe1a1; border: 1px solid rgba(255,200,87,.5); }
.lvl-low { background: rgba(255,107,122,.18); color: #ffc2c9; border: 1px solid rgba(255,107,122,.5); }
.verdict ul { margin: 10px 0 0; padding-left: 18px; font-size: 14.4px; line-height: 1.6; }

/* ---------- Форма и подсказки ---------- */
.composer {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--line); background: rgba(13,18,32,.5);
}
.composer__input {
  flex: 1; padding: 12px 16px; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  color: var(--text); font-size: 15px; outline: none; transition: .2s;
}
.composer__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,.2); }
.composer__input::placeholder { color: #6d7ba3; }

.quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 14px; background: rgba(13,18,32,.5); }
.quick .btn {
  font-size: 12.8px; font-weight: 500; padding: 7px 12px;
  background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--line);
}
.quick .btn:hover { color: var(--text); border-color: var(--accent); }

.empty {
  text-align: center; color: var(--muted); padding: 40px 20px; font-size: 15px;
}
.empty .big { font-size: 46px; display: block; margin-bottom: 10px; }

/* ---------- Блок «нет в базе» ---------- */
.suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.suggest__item {
  width: 100%; text-align: left; justify-content: flex-start;
  font-size: 14px; padding: 10px 14px;
}
.suggest__group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.suggest__group strong { width: 100%; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.suggest__link {
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  color: var(--text); font-size: 12.8px; padding: 6px 11px; border-radius: 999px;
  cursor: pointer; font-family: inherit; transition: .18s;
}
.suggest__link:hover { border-color: var(--accent); color: #fff; }

/* ---------- Скроллбары ---------- */
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: rgba(110,231,183,.08); border: 1px solid rgba(110,231,183,.28);
  font-size: 14px; line-height: 1.55;
}

/* ---------- Скроллбары ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2c3a5e; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .sidebar { order: 2; flex-direction: column; }
  .chat { order: 1; min-height: 55vh; }
  .brand__text p { display: none; }
}
