html, body {
  overflow-x: hidden;
}

/* Глобальные улучшения текста и ссылок */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 17px;
  background-color: #F1F1F1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Fira Code", monospace;
}


@media (max-width: 600px) {
  body {
    margin: 10px;
    padding: 0;
  }
}

.frame {
  border: 2px solid #44BBC1;
  background-color: #FAFAFA;
  padding: 1rem;
  margin: 1rem 0;
}

.article {
  border: none;
  background-color: #FAFAFA;
  padding: 1rem;
  margin: 0 auto;
  max-width: 800px;
  border-radius: 8px;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .article {
    padding: 0.2rem 0.5rem;
    border: none;
  }
}

.noneframe {
  padding: 1rem;
  margin: 1rem 0;
}

.custom-links {
  border: 2px solid #44BBC1;
  padding: 10px;
  margin-bottom: 10px;
}

.link-list {
  padding: 10px;
  list-style-type: none;
}

.link-item {
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .link-item span {
    display: none;
    padding: 10px;
    margin-bottom: 10px;
  }
}

.responsive-title {
  text-align: center;
  width: 100%;
  height: auto;
}

.responsive-title svg {
  width: 100%;
  height: auto;
  max-width: 600px;
}

@media (max-width: 600px) {
  .responsive-title svg {
    max-width: 80%;
  }
}

.counter {
  border: 2px solid #44BBC1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
  background-color: #FFE6D0;
  padding: 15px;
  font-size: 10px;
}

#userCount {
  margin: 10px 0;
}

#increaseCount {
  padding: 5px 10px;
  font-size: 24px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.7);
  color: #000;
  cursor: pointer;
  transition: background-color 0.2s;
}

#increaseCount:hover {
  background-color: rgba(255, 255, 255, 1);
}

@media (max-width: 600px) {
  .counter {
    font-size: 18px;
  }
  #increaseCount {
    font-size: 22px;
  }
}

.footer {
  border: 2px solid #44BBC1;
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  height: 60px;
  background-color: #FFE6D0;
  margin: 1rem 0;
}

.score-container {
  text-align: center;
  padding: 8px;
  font-size: 24px;
  color: #44BBC1;
}

.svg-container {
  position: relative;
  width: 100%;
  height: 140px;
}

.svg-container svg {
  position: absolute;
  width: 15%;
  height: auto;
}

@media (max-width: 600px) {
  .svg-container {
    height: 20px;
  }
  .svg-container svg {
    width: 30%;
  }
}

.qatodev {
  padding: 0.5rem;
  margin: 0;
  text-align: center;
}

:root {
  --text-color: #333;
  --input-background: #fff;
  --input-text-color: #000;
  --border-color: #007BFF;
  --focus-border-color: #007BFF;
  --button-background-color: rgba(255, 255, 255, 0.7);
  --button-text-color: #fff;
  --justify-content: center;
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.2rem;     /* уменьшение размера шрифта */
  font-weight: normal;   /* убираем жирность */
}

/* Замени существующие стили .main-content */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Изменено с center на flex-start */
  min-height: auto; /* Убрана фиксированная высота */
  box-sizing: border-box;
  padding: 80px 0; /* Вертикальные отступы */
  padding-top: 30px;
}

/* Добавь новые стили для чипов */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem auto 1rem; /* Уменьшенный верхний отступ */
  max-width: 800px;
}

/* Добавь медиа-запрос для мобильной адаптации */
@media (max-width: 800px) {
  .main-content {
    padding: 0px 0; /* Вертикальные отступы */
    padding-top: 25px;
  }

  .category-filters {
    margin-top: 0.2rem;
    margin-bottom: 0.5rem;
  }
}

/* Стили для карточек с вопросами */
.cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0;
  align-items: start;
}

@media (max-width: 800px) {
  .cards-container {
    grid-template-columns: repeat(1, 1fr);
  }
}

.card-questions ul {
  list-style-type: none;
  margin: 0;
  padding-left: 0;
}

.card-questions li {
  position: relative;
  padding-left: 1rem;
  list-style: none;
}

.card-questions li strong {
  font-weight: normal;
}

.card {
  border: 2px solid #000000;
  border-radius: 10px;
  background-color: #FAFAFA;
  padding: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.card-banner svg {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.card-title {
  text-align: center;
  margin: 0.5rem 0;
}

.card-questions {
  margin-top: 1rem;
  text-align: left;
}

/* Стили для кнопок переключения внутри вопросов */
.toggle-btn {
  margin-right: 8px;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.4em;
  outline: none;
}

.node-answer {
  margin-left: 1rem;
  padding: 0.5rem;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
}

/* ===== Стили для нового аккордеона (на основе devtools) ===== */
.t849__accordion {
  margin-bottom: 10px;
}

.t849__wrapper {
  overflow: hidden;
}

.t849__header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-radius: 20px;
}

.t849__header.t849__opened {
}

.t849__trigger-button {
  font-family: "Fira Code", monospace;
  word-spacing: -0.1em;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1.1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0;
  color: #999999;
}

/* где-то в конце Q2.css */
.t849__trigger-button {
  /* задаём плавный переход цвета текста и/или фона при наведении */
  transition: color 0.3s ease, background-color 0.3s ease;
}

.t849__title {
  display: inline-block;
}

.t849__content {
  padding: 10px;
  border-top: 1px solid #ccc;
}

/* ================= Аккордеон: плюс-иконка ================= */
.t849__icon {
  display: none;                /* по умолчанию скрыта */
  width: 1.25rem;               /* одинаковый размер в любых условиях */
  height: 1.25rem;
  transform-origin: center;     /* точка вращения по центру */
  transition: transform 0.3s ease; /* плавное вращение */
  /* атрибут preserveAspectRatio мы прописали в HTML */
}

.t849__header:hover .t849__icon,
.t849__header.t849__opened .t849__icon {
  display: inline-block;        /* показываем на hover или когда открыт */
}

.t849__header.t849__opened .t849__icon {
  transform: rotate(45deg);     /* превращаем + в × */
}

/* По-умолчанию иконка летит текущим цветом (на hover) */
.t849__icon {
  stroke: currentColor;
}

/* Если вопрос изучен — синяя «+» */
.t849__header.studied .t849__icon {
  color: #44BBC1;
}

/* Если вопрос непонятен — оранжевая «+» */
.t849__header.unclear .t849__icon {
  color: #FFA500;
}

/* Новое: подсветка текста вопроса при hover и открытом состоянии */
/* Для заголовка (вся кнопка-триггер наследует цвет) */
.t849__header.studied:hover .t849__trigger-button,
.t849__header.studied.t849__opened .t849__trigger-button {
  color: #44BBC1;
}

.t849__header.unclear:hover .t849__trigger-button,
.t849__header.unclear.t849__opened .t849__trigger-button {
  color: #FFA500;
}

/* Сохраняем прежнюю логику показа иконки */
.t849__header:hover .t849__icon,
.t849__header.t849__opened .t849__icon {
  display: inline-block;
}

.copy-icon {
  /* Иконка всегда «занимает» место, но изначально невидима */
  display: inline-block;
  width: 1.2em;          /* резервируем ширину */
  text-align: center;
  visibility: hidden;    /* невидима, но занимает место */
  opacity: 0;
  transition: opacity 0s ease;
  cursor: pointer;
}

.t849__header:hover .copy-icon {
  visibility: visible;
  opacity: 1;
}

.t849__header.t849__opened .copy-icon {
  visibility: visible;
  opacity: 1;
}
/* ================= Конец стилей аккордеона ================= */

/* ===================================================================
   Search bar styles
   =================================================================== */

/* 1) Контейнер строки поиска — такие же отступы, как у .article */
.search-container {
  position: relative;         /* для абсолютного позиционирования кнопки */
  width: 100%;                /* во весь доступный ряд */
  max-width: 800px;           /* ограничение по ширине */
  margin: 0 auto 1rem;        /* центровка + отступ снизу */
  box-sizing: border-box;     /* чтобы padding учитывался в ширине */
  text-align: center;         /* центрируем инпут, если он inline-block */
}

/* 2) Сам инпут */
.search-container #search-input {
  display: inline-block;      /* чтобы margin: auto работал */
  width: 98%;                /* по ширине контейнера */
  padding: 0.75rem 2.5rem 0.75rem 1rem; /* запас справа под кнопку */
  font-size: 1rem;
  border: none;
  border-radius: 0.5rem;
  background-color: #FAFAFA;
  color:  #000;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
  margin: 0 auto;
}

/* 3) Placeholder */
.search-container #search-input::placeholder {
  color: var(--search-placeholder);
}

/* 4) Focus */
.search-container #search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--search-focus);
}

/* 5) Кнопка “очистить” внутри инпута */
.search-container .clear-btn {
  position: absolute;
  top: 12%;
  right: 1rem;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 1.2rem;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--search-placeholder);
  cursor: pointer;
  display: none;             /* показываем при вводе текста */
  padding: 0;
  z-index: 1;
}

.search-container .ai-btn {
  position: absolute;
  top: 20%;
  right: 3rem;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 1rem;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--search-placeholder);
  cursor: pointer;
  display: none;             /* показываем при вводе текста */
  padding: 0;
  z-index: 1;
}

#search-results-title {
  display: none;
  margin: 1.5rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

/* ===================================================================
   Мобильная адаптация (обновлённая часть)
   =================================================================== */
@media (max-width: 600px) {
  .search-container {
    padding: 0.9rem;
  }
  .search-container #search-input {
    font-size: 0.9rem;
    overflow: hidden;           /* обрезка длинного текста */
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

/* 1) Скрываем по умолчанию */
#ai-response {
  display: none;
}

/* 2) Показываем, когда есть класс .show */
#ai-response.show {
  display: block; /* или flex/inline-block, как вам нужно */
}

/* Если #ai-response пуст, прячем его */
#ai-response:empty {
  display: none !important;
}

/* 3) И — самое главное! — принудительно скрываем даже .show,
      когда input пустой (placeholder-shown) */
.search-container #search-input:placeholder-shown ~ #ai-response {
  display: none !important;
}

/* 6) Показать кнопку, когда в инпуте есть текст или он в фокусе */
.search-container #search-input:not(:placeholder-shown) + .clear-btn,
.search-container #search-input:focus + .clear-btn {
  display: block;
}

/* 7) Hover-эффект для кнопки */
.search-container .clear-btn:hover {
  color: var(--search-text);
}

/* 7) Hover-эффект для кнопки */
.search-container .ai-btn:hover {
  color: var(--search-text);
}

/* ===== Стили для выпадающего списка (как поле поиска) ===== */
.search-container #model-select {
  /* Подложка и размеры как у инпута */
  padding: 0.15rem 1rem;
  width: auto;                 /* подгоняйте под нужную ширину */
  border: none;
  background-color: var(--search-bg);
  color:             var(--search-text);
  box-sizing: border-box;
  cursor: pointer;
  margin-top: 0.75rem;

  /* плавный переход, как у инпута */
  transition: background-color .2s ease,
              color .2s ease,
              box-shadow .2s ease;

  /* убрать нативный стилизованный стрелочный вид */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  /* (опционально) добавить свою стрелку справа, если нужна */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

/* Показываем его по той же логике, что и кнопки */
.search-container #search-input:not(:placeholder-shown) ~ #model-select,
.search-container #search-input:focus ~ #model-select {
  display: inline-block;
}

/* Фокус — такое же выделение, как у поля */
.search-container #model-select:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--search-focus);
}

/* 1) Делаем отступ в инпуте, чтобы текст не доходил до кнопки */
.search-container #search-input {
  /* вместо 4rem подберите значение, равное ширине кнопки + отступ */
  padding-right: 5rem;
}

@media (max-width: 600px) {
  .search-container {
    padding: 0rem;
  }
  .search-container #search-input {
    font-size: 0.9rem;
    padding: 0.75rem 5rem 0.75rem 1rem; /* ширина кнопки + запас */
    border-radius: 0.1rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.answer-image {
  margin-top: 12px;
  text-align: center;
}

.answer-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* На экранах шире 800px прячем только картинку, но оставляем сам блок и заголовок */
@media (min-width: 800px) {
  .answer-image {
    /* сбрасываем фиксированную высоту, чтобы блок подстраивался под содержимое */
    height: auto;
    overflow: visible;
  }
  .answer-image img {
    display: none; /* прячем только <img> */
  }
}

/* === Стили для прогресс-бара === */
.progress-container {
  position: relative;
  background-color: #e7e7e7;
  border-radius: 8px;
  height: 0.8rem;
  width: 50%;
  margin: 0.5rem auto;
}

.progress-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background-color: #44BBC1;
  transition: width 0.1s ease;
  z-index: 1;
  /* убрали все border-radius отсюда */
}

/* когда нет оранжевого — скругляем полностью */
.progress-bar.full {
  border-radius: 8px;
}

/* когда есть оранжевый — скругляем только слева */
.progress-bar.split {
  border-radius: 8px 0 0 8px;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.55rem;
  color: #1A1A1A;
  z-index: 3;
}

/* чтобы кнопка-галочка была просто символом без фона */
button.study-btn {
  background: none;       /* убираем фон */
  border: none;           /* убираем рамку */
  padding: 0;             /* сбрасываем отступы */
  box-shadow: none;       /* убираем тени */
  font-size: 1.2rem;      /* чуть больше для видимости */
  cursor: pointer;        /* как кнопка */
  color: #44BBC1;         /* тот же цвет, что и прогресс-бар */
  line-height: 1;         /* чтобы не было лишней высоты */
}

button.study-btn:hover {
  transform: scale(1.2);
}

/* «Непонятно» */
.progress-bar-unclear {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background-color: #FFA500;
  border-radius: 0 8px 8px 0;
  transition: left 0.1s ease, width 0.1s ease;
  z-index: 2;
}

/* Кнопка «?» оранжевая, без плашки */
button.unclear-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.5rem;
  font-size: 1.2rem;
  line-height: 1;
  color: #FFA500;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}
button.unclear-btn:hover {
  transform: scale(1.2);
}

/* ===================================================================
   Цветовые переменные
   =================================================================== */
/* Светлая тема */
:root {
  --search-bg:          #f5f5f5;
  --search-text:        #333;
  --search-placeholder: #777;
  --search-shadow:      0 2px 4px rgba(0, 0, 0, 0.1);
  --search-focus:       rgba(255, 160, 1, 0.5);
}

/* Обязательно: header уже position: relative; */

.theme-switcher {
  position: absolute;
  top: -55px;
  right: 16px;
  z-index: 10;
  transform: none;
}

@media (max-width: 600px) {
  .theme-switcher {
    top: -55px;
    right: 8px;
  }
}

/* Убираем лишний margin-left, задаём отступы внутри */
.theme-switcher button {
  color: #1A1A1A;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  margin: 0;       /* сброс margin-left: auto */
  padding: 6px;    /* можно подогнать паддинги */
}

/* Подсветка при активной теме */
.theme-switcher button.active {
  color: #F1F1F1;
}

/* Подсветка при наведении */
.theme-switcher button:hover {
  background: rgba(255, 165, 0, 0.1); /* лёгкий оранжевый фон */
  color: #FFA001;                     /* окрашиваем иконку в оранжевый */
}

/* Размер кнопки */
.toggleButton_gllP {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: none;
  border: none;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  transition: background 0.2s;
}
.toggleButton_gllP:hover {
  background: var(--ifm-color-emphasis-200);
}

/* Иконки */
.lightToggleIcon_pyhR,
.darkToggleIcon_wfgR {
  display: none;
}
html[data-theme="light"] .lightToggleIcon_pyhR {
  display: block;
}
html[data-theme="dark"] .darkToggleIcon_wfgR {
  display: block;
}

   /* сразу после ваших общих правил для svg-hidden */
   @media (prefers-color-scheme: light) {
     html:not([data-theme]) .lightToggleIcon_pyhR {
       display: block;
     }
   }
   @media (prefers-color-scheme: dark) {
     html:not([data-theme]) .darkToggleIcon_wfgR {
       display: block;
     }
   }

   /* Добавить в конец файла */
   .category-filters {
     display: flex;
     flex-wrap: wrap;
     justify-content: center;
     gap: 0.4rem;
     margin: 0 auto 1rem;
     max-width: 800px;
   }

   .filter-chip {
     padding: 0.5rem 1rem;
     border-radius: 20px;
     background-color: #FAFAFA;
     color: #333;
     cursor: pointer;
     border: none;
     transition: background-color 0.2s;
     font-size: 0.7rem;
   }

   .filter-chip:hover {
     background-color: #f2fafb;
   }

   .filter-chip.active {
     background-color: #44BBC1;
     color: white;
   }

   /* Темная тема */
   html[data-theme="dark"] .filter-chip {
     background-color: #2b2b2b;
     color: #eee;
   }

   html[data-theme="dark"] .filter-chip:hover {
     background-color: #3a3a3a;
   }

   html[data-theme="dark"] .filter-chip.active {
     background-color: #44BBC1;
     color: white;
   }

   @media (max-width: 600px) {
     .category-filters {
       padding: 0 0.5rem;
     }

     .filter-chip {
       padding: 0.4rem 0.8rem;
       font-size: 0.8rem;
     }
   }

/* НАСТРОЙКА ТЕМНОГО ОФОРМЛЕНИЯ */

  html[data-theme="dark"] body {
    background-color: #1A1A1A;
    color: #e7e7e7;
  }

  html[data-theme="dark"] .frame {
      border: 2px solid #44BBC1;
      background-color: #1A1A1A;
  }

  html[data-theme="dark"] .article {
      background-color: #242424;
  }

  html[data-theme="dark"] .noneframe {
      color: #FFFFFF;
  }

  html[data-theme="dark"] .new-year-counter {
      color: #FFFFFF;
  }

  html[data-theme="dark"] .welcome {
      color: #44BBC1;
  }

  html[data-theme="dark"] .site-title {
      color: #FFFFFF;
  }

  html[data-theme="dark"] a {
        background-color: #1A1A1A;
        color: #FFFFFF;
  }

  html[data-theme="dark"] a:hover {
      background-color: #F1F1F1;
      color: #1A1A1A;
  }

  html[data-theme="dark"] a.answer-link {
        background-color: #8CD136;
        color: #1A1A1A;
  }

  html[data-theme="dark"] a.answer-link:hover {
        background-color: #F1F1F1;
        color: #1A1A1A;
  }

  html[data-theme="dark"] .footer {
      background-color: #1C2E40;
      border: 2px solid #44BBC1;
      color: #FFFFFF;
  }

  html[data-theme="dark"] .qatodev {
      color: #FFFFFF;
  }

  html[data-theme="dark"] :root {
      --background-color: #1e1e1e;
      --text-color: #f5f5f5;
      --input-background: #2e2e2e;
      --input-text-color: #fff;
      --border-color: #555;
      --focus-border-color: #66afe9;
      --button-background: #66afe9;
      --button-text-color: #fff;
      --input-justify-content: center;
  }

  html[data-theme="dark"] .card {
      background-color: #1A1A1A;
      border: 2px solid #ffffff;
  }

  html[data-theme="dark"] .toggle-btn {
      color: white;
  }

  html[data-theme="dark"] .node-answer {
      background-color: #1A1A1A;
      border: 1px solid #555;
      color: #f5f5f5;
  }

  html[data-theme="dark"] .t849__trigger-button:hover {
      color: #F1F1F1;
  }

  html[data-theme="dark"] .search-container #model-select {
      background-color: var(--search-bg);
      color: var(--search-text);
  }

  html[data-theme="dark"] :root {
      --search-bg:          #2b2b2b;
      --search-text:        #eee;
      --search-placeholder: #aaa;
      --search-shadow:      0 2px 4px rgba(0, 0, 0, 0.6);
      --search-focus:       rgba(255, 160, 1, 0.8);
  }

  html[data-theme="dark"] .search-container #search-input {
    background-color: #242424;
    color: #e7e7e7;
  }

  html[data-theme="dark"] .search-container #model-select {
    background-color: #242424;
    color: #e7e7e7;
  }

  html[data-theme="dark"] .progress-container {
    background-color: #1A1A1A
  }

  html[data-theme="dark"] .progress-text {
  color: #f0f0f0;
  }

  /* НАСТРОЙКА СВЕТЛОГО ОФОРМЛЕНИЯ */

  html[data-theme="light"] .toggle-btn {
    color: black;
  }

  html[data-theme="light"] .t849__trigger-button:hover {
    color: #1A1A1A;
  }