:root {
  --indigo: #1e3a8a;
  --indigo-dark: #172d6e;
  --indigo-light: #3b5bd6;
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 8px 24px rgba(30, 58, 138, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", "Arial", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* ============ ШАПКА ============ */
.scientist-strip {
  background: linear-gradient(90deg, #0f2a63 0%, #1e3a8a 50%, #2b4bb0 100%);
  border-bottom: 2px solid rgba(245, 158, 11, 0.6);
  overflow-x: auto;
  scrollbar-width: thin;
}

.strip-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 20px;
  white-space: nowrap;
}

.strip-label {
  color: #fde68a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  flex: 0 0 auto;
  max-width: 260px;
  white-space: normal;
  line-height: 1.3;
}

.scientist-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex: 0 0 auto;
}

.scientist-chip:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

.scientist-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fbbf24;
}

.scientist-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.scientist-card img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  flex: 0 0 auto;
  box-shadow: 0 6px 18px rgba(30, 58, 138, 0.25);
}

.scientist-role { margin-top: 0; color: var(--indigo); font-size: 16px; }

@media (max-width: 560px) {
  .scientist-card { flex-direction: column; }
  .scientist-card img { width: 100%; height: auto; max-width: 220px; }
}

/* ============ ШАПКА ============ */
.site-header {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-light) 100%);
  color: #fff;
  padding: 18px 20px 0;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-logo {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--amber);
  color: var(--indigo-dark);
  font-size: 30px;
  font-weight: 700;
  border-radius: 12px;
  text-decoration: none;
}

.brand-text h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.brand-text p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }

.main-nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.nav-btn {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px 10px 0 0;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.22); }

.nav-btn.active {
  background: var(--bg);
  color: var(--indigo);
  font-weight: 600;
}

/* ============ ВКЛАДКИ ============ */
main { max-width: 1100px; margin: 0 auto; padding: 26px 20px 40px; }

.tab { display: none; animation: fadein 0.25s ease; }
.tab.active { display: block; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-head h2 { margin: 0 0 6px; color: var(--indigo); }
.tab-head p { margin: 0 0 20px; color: var(--muted); }

/* ============ КНОПКИ ============ */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-primary:hover { background: var(--indigo-dark); }

.btn-outline {
  background: #fff;
  color: var(--indigo);
  border: 1.5px solid var(--indigo);
}

.btn-outline:hover { background: #eef2ff; }

.link-btn {
  border: none;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
}

/* ============ ГЛАВНАЯ ============ */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 26px;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 13px;
  color: var(--amber);
  font-weight: 700;
  margin: 0 0 6px;
}

.hero-text h2 { margin: 0 0 8px; font-size: 30px; line-height: 1.15; color: var(--indigo); }
.hero-sub { margin: 0 0 10px; font-size: 16px; color: var(--muted); }
.hero-quote { font-style: italic; color: var(--muted); margin: 0 0 18px; }

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius);
}

.section-block { margin-bottom: 26px; }
.section-block h3 { color: var(--indigo); margin: 0 0 12px; font-size: 20px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel h3 { margin-top: 0; }

.news-list { margin: 0; padding-left: 20px; }
.news-list li { margin-bottom: 8px; }

/* ============ КАРТОЧКИ ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
}

.card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(30, 58, 138, 0.18); }

.card-icon { font-size: 30px; }
.card h4 { margin: 8px 0 6px; color: var(--indigo); font-size: 17px; }
.card p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ============ МАТЕРИАЛЫ ============ */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.material-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.material-card h4 { margin: 0; color: var(--indigo); font-size: 16px; line-height: 1.3; }
.material-card .mat-tags { font-size: 12px; color: var(--muted); }
.material-card .btn { align-self: flex-start; margin-top: auto; padding: 8px 14px; font-size: 14px; }

/* ============ МОДАЛЬНОЕ ОКНО ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay[hidden], .ai-panel[hidden] { display: none; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 820px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 10px;
}

.modal-head h3 { margin: 0; color: var(--indigo); font-size: 19px; line-height: 1.3; }

.modal-close {
  border: none;
  background: #eef2f7;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  flex: 0 0 auto;
}

.modal-close:hover { background: #e0e7f0; }

.modal-body {
  padding: 6px 22px 18px;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 15px;
}

.modal-body h4 { color: var(--indigo); margin: 16px 0 6px; }
.modal-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
.modal-body th, .modal-body td { border: 1px solid #d7dee9; padding: 6px 9px; text-align: left; }
.modal-body th { background: #eef2ff; }
.modal-body ul, .modal-body ol { padding-left: 22px; }

.modal-foot {
  display: flex;
  gap: 10px;
  padding: 12px 22px 18px;
}

/* ============ ТРЕНАЖЁРЫ ============ */
.trainer-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.trainer-menu {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trainer-menu h3 { margin: 0 0 4px; color: var(--indigo); }
.trainer-menu hr { border: none; border-top: 1px solid #e5eaf2; margin: 8px 0; }

.trainer-btn {
  border: none;
  background: #eef2ff;
  color: var(--indigo);
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14.5px;
  font-family: inherit;
  transition: background 0.12s;
}

.trainer-btn:hover { background: #e0e7ff; }
.trainer-btn.active { background: var(--indigo); color: #fff; font-weight: 600; }
.trainer-btn.btn-manage { background: var(--amber); color: #fff; }

.trainer-btn.btn-manage:hover { background: #d97706; }

.trainer-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }

.trainer-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  min-height: 320px;
}

.setup-fields { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }

.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-row label { font-size: 14.5px; min-width: 210px; }

.field-row input[type="number"], .field-row select {
  padding: 7px 10px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.checkbox-list { display: flex; gap: 12px; flex-wrap: wrap; }
.checkbox-list label { font-size: 14px; min-width: 0; display: flex; align-items: center; gap: 5px; }

.quiz-top {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #e5eaf2;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--indigo-light), var(--amber));
  transition: width 0.25s;
}

.quiz-question {
  font-size: 26px;
  font-weight: 700;
  color: var(--indigo);
  margin-bottom: 16px;
  text-align: center;
  padding: 14px;
  background: #eef2ff;
  border-radius: 12px;
}

#quiz-form { display: flex; gap: 10px; }

#quiz-input {
  flex: 1;
  padding: 11px 14px;
  border: 2px solid #d7dee9;
  border-radius: 10px;
  font-size: 18px;
  font-family: inherit;
}

#quiz-input:focus { outline: none; border-color: var(--indigo-light); }

.quiz-feedback { margin-top: 14px; font-size: 15px; min-height: 24px; }
.quiz-feedback.ok { color: var(--green); font-weight: 600; }
.quiz-feedback.bad { color: var(--red); font-weight: 600; }

.result-score { font-size: 42px; font-weight: 800; color: var(--indigo); }
.result-grade { font-size: 22px; margin: 6px 0 14px; }
.result-grade.good { color: var(--green); }
.result-grade.mid { color: var(--amber); }
.result-grade.bad { color: var(--red); }

#result-mistakes { margin: 10px 0 18px; font-size: 14.5px; color: var(--muted); }
#result-mistakes li { margin-bottom: 4px; }

/* ============ УПРАВЛЕНИЕ ЗАДАНИЯМИ ============ */
.tasks-manager {
  margin-top: 22px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.tasks-manager h3 { color: var(--indigo); margin-top: 0; }

.tm-block { margin-bottom: 18px; }

.tm-block label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.tm-block input, .tm-block select, .tm-block textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
}

.tm-block textarea { min-height: 70px; resize: vertical; }

.tm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}

.task-item .del { border: none; background: none; color: var(--red); cursor: pointer; font-size: 16px; }

.task-item .q { display: block; }
.task-item .a { color: var(--muted); font-size: 13px; }

/* ============ ПОИСК ============ */
.search-block {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.search-block h3 { color: var(--indigo); margin: 0 0 4px; }
.search-block p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.search-row { display: flex; gap: 10px; margin-bottom: 10px; }

.search-row input {
  flex: 1;
  padding: 11px 14px;
  border: 2px solid #d7dee9;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}

.search-row input:focus { outline: none; border-color: var(--indigo-light); }

.engine-row { display: flex; gap: 10px; flex-wrap: wrap; }

.engine-link {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--indigo);
}

.engine-link:nth-child(2) { background: #4285f4; }
.engine-link:nth-child(3) { background: #005ff9; }
.engine-link:hover { opacity: 0.88; }

.engine-link[disabled] { opacity: 0.45; pointer-events: none; }

.search-results { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.search-hit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  padding: 10px 14px;
}

.search-hit .hit-info { min-width: 0; }
.search-hit .hit-title { font-weight: 600; color: var(--indigo); }
.search-hit .hit-snippet { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit .badge { font-size: 11px; background: #eef2ff; color: var(--indigo); padding: 2px 8px; border-radius: 99px; margin-right: 6px; }
.search-hit .btn { padding: 7px 12px; font-size: 13px; flex: 0 0 auto; }

.search-empty { color: var(--muted); font-size: 14px; }

/* ============ ЧАТ ============ */
.chat-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 6px;
  margin-bottom: 14px;
}

.chat-msg {
  background: #eef2ff;
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 80%;
  align-self: flex-start;
  animation: fadein 0.2s;
}

.chat-msg .nick { font-weight: 700; color: var(--indigo); font-size: 13.5px; }
.chat-msg .time { color: var(--muted); font-size: 11.5px; margin-left: 8px; }
.chat-msg .txt { margin-top: 2px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }

.chat-empty { color: var(--muted); text-align: center; padding: 20px 0; font-size: 14px; }

.chat-input-row { display: flex; gap: 10px; margin-bottom: 10px; }

.chat-input-row input {
  padding: 10px 13px;
  border: 2px solid #d7dee9;
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
}

#chat-nick { flex: 0 0 170px; }
#chat-text { flex: 1; }
.chat-input-row input:focus { outline: none; border-color: var(--indigo-light); }

.chat-actions { margin-bottom: 6px; }

/* ============ ПОДВАЛ ============ */
.site-footer {
  background: var(--indigo-dark);
  color: #dbe2f3;
  margin-top: 20px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 20px 10px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.site-footer strong { color: #fff; font-size: 16px; }
.site-footer p { margin: 4px 0; font-size: 13.5px; }

.footer-nav { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.footer-link {
  border: none;
  background: none;
  color: #dbe2f3;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 0;
}

.footer-link:hover { color: var(--amber-light); }

.footer-copy {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px 18px;
  font-size: 12.5px;
  opacity: 0.8;
}

/* ============ КОНСТРУКТОР ТЕСТОВ ============ */
.ctor-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--indigo);
  background: #eef2ff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.ctor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px dashed #e5eaf2;
}

.ctor-check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  min-width: 0;
  cursor: pointer;
}

.ctor-check input { width: 18px; height: 18px; cursor: pointer; }

.ctor-count {
  width: 70px;
  padding: 7px 10px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.ctor-unit { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ============ ФИЛЬТРЫ МАТЕРИАЛОВ ============ */
.filter-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.filter-item { display: flex; flex-direction: column; gap: 5px; min-width: 170px; }
.filter-item label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.filter-item select,
.filter-item input {
  padding: 9px 11px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
}

.filter-item select:focus, .filter-item input:focus { outline: none; border-color: var(--indigo-light); }
.filter-search { flex: 1; min-width: 220px; }

.mat-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

.badge {
  font-size: 11px;
  background: #eef2ff;
  color: var(--indigo);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-class { background: #fef3c7; color: #92400e; }

/* ============ ПУБЛИКАЦИИ ============ */
.publications-list { display: flex; flex-direction: column; gap: 14px; }

.pub-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: transform 0.12s, box-shadow 0.15s;
}

.pub-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30, 58, 138, 0.16); }

.pub-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }

.pub-date { font-size: 13px; color: var(--muted); }

.pub-card h3 { margin: 0 0 10px; color: var(--indigo); font-size: 18px; line-height: 1.35; }

.pub-external { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; line-height: 1.4; }

/* ============ КОНТАКТЫ ============ */
.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.contact-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.contact-card h3 { color: var(--indigo); margin: 0 0 14px; }

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { margin-bottom: 14px; font-size: 14.5px; line-height: 1.4; }

.muted { color: var(--muted); font-size: 12px; }

.form-row { margin-bottom: 12px; }

.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--indigo-light); }
.form-row textarea { min-height: 100px; resize: vertical; }

/* ============ ИИ-ПОМОЩНИК ============ */
.ai-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.ai-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(30, 58, 138, 0.4);
  transition: transform 0.12s;
}

.ai-toggle:hover { transform: scale(1.06); }

.ai-panel {
  width: 310px;
  max-width: calc(100vw - 40px);
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadein 0.2s ease;
}

.ai-panel[hidden] { display: none; }

.ai-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
  color: #fff;
  padding: 12px 14px;
  font-weight: 600;
}

.ai-close { border: none; background: rgba(255,255,255,0.18); color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }

.ai-log {
  padding: 12px;
  height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
}

.ai-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-user { align-self: flex-end; background: var(--indigo); color: #fff; border-bottom-right-radius: 4px; }
.ai-reply { align-self: flex-start; background: #eef2ff; color: var(--text); border-bottom-left-radius: 4px; }

.ai-input {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5eaf2;
  background: #fff;
}

.ai-input input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #d7dee9;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
}

.ai-input input:focus { outline: none; border-color: var(--indigo-light); }

.ai-input button {
  border: none;
  background: var(--indigo);
  color: #fff;
  width: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

@media (max-width: 860px) {
  .contacts-grid { grid-template-columns: 1fr; }
}

/* ============ МОБИЛЬНАЯ ВЕРСИЯ ============ */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .trainer-layout { grid-template-columns: 1fr; }
  .tm-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .brand-text h1 { font-size: 18px; }
  #chat-nick { flex: 0 0 100%; }
  .chat-input-row { flex-direction: column; }
  .chat-msg { max-width: 95%; }
}

@media (max-width: 520px) {
  .hero-text h2 { font-size: 24px; }
  .search-row { flex-direction: column; }
}