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: clamp(0.92rem, 0.84rem + 0.38vw, 1.1rem);
  line-height: 1.32;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0;
  color: #999999;
  min-width: 0;
}

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

.t849__title {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
}

.t849__content {
  padding: 12px;
  border-top: 1px solid #ccc;
  background: var(--answer-bg, #F1F1F1);
  border: 1px solid var(--answer-border, #e5e7eb);
  border-radius: 14px;
  box-shadow: var(--answer-shadow, inset 0 1px 3px rgba(0, 0, 0, 0.08));
}

#accordion-container.is-loading {
  min-height: 72vh;
}

.questions-skeleton {
  display: grid;
  gap: 1rem;
}

.questions-skeleton .article {
  padding: 1rem 1rem 0.9rem;
}

.questions-skeleton-card {
  display: grid;
  gap: 0.85rem;
}

.questions-skeleton-head {
  display: grid;
  gap: 0.6rem;
}

.questions-skeleton-line {
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(68, 187, 193, 0.08) 0%, rgba(68, 187, 193, 0.18) 50%, rgba(68, 187, 193, 0.08) 100%);
  background-size: 200% 100%;
  animation: questionsSkeletonPulse 1.4s ease-in-out infinite;
}

.questions-skeleton-line--title {
  width: min(62%, 420px);
  height: 1.1rem;
}

.questions-skeleton-line--progress {
  width: 100%;
  height: 0.7rem;
}

.questions-skeleton-line--item {
  width: 100%;
  height: 3rem;
  border-radius: 18px;
}

html[data-theme="dark"] .questions-skeleton-line {
  background: linear-gradient(90deg, rgba(120, 182, 186, 0.12) 0%, rgba(120, 182, 186, 0.24) 50%, rgba(120, 182, 186, 0.12) 100%);
  background-size: 200% 100%;
}

.t849__text {
  font-size: clamp(0.88rem, 0.83rem + 0.24vw, 1rem);
  line-height: 1.55;
}

.code-block {
  background: var(--code-bg, #FAFAFA);
  color: var(--code-text, #111827);
  border: 1px solid var(--code-border, #e5e7eb);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  overflow-x: auto;
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  white-space: pre;
}

.code-block code {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0;
  color: inherit;
}

.code-inline {
  background: transparent;
  border-radius: 6px;
  padding: 2px 6px;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
}

.tok-keyword { color: #60a5fa; }
.tok-string  { color: #fbbf24; }
.tok-number  { color: #34d399; }
.tok-comment { color: #94a3b8; font-style: italic; }

html[data-theme="dark"] .t849__content {
  background: #1f1f1f;
  border: 1px solid #2b2b2b;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .code-block {
  background: #242424;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

html[data-theme="dark"] .code-inline {
  background: rgba(255, 255, 255, 0.12);
}

/* ================= Аккордеон: плюс-иконка ================= */
.t849__icon {
  display: inline-flex;         /* резервируем место, чтобы не было сдвига текста */
  align-items: center;
  justify-content: center;
  width: 1.25rem;               /* одинаковый размер в любых условиях */
  height: 1.25rem;
  flex: 0 0 1.25rem;
  transform-origin: center;     /* точка вращения по центру */
  transition: transform 0.3s ease; /* плавное вращение */
  opacity: 0;
  visibility: hidden;
  /* атрибут preserveAspectRatio мы прописали в HTML */
}

.t849__header:hover .t849__icon,
.t849__header.t849__opened .t849__icon {
  opacity: 1;
  visibility: visible;
}

.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 .t849__trigger-button {
  color: #44BBC1;
}
.t849__header.unclear .t849__trigger-button {
  color: #FFA500;
}
.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 {
  opacity: 1;
  visibility: visible;
}


/* Кнопки под ответом */
.answer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.answer-links .answer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 10px;
  border-radius: 10px;
  background-color: #8CD136;
  color: #F1F1F1;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background-color 0.2s, color 0.2s;
}

.answer-links .answer-link:hover {
  background-color: #1A1A1A;
  color: #F1F1F1;
}

.answer-links .answer-link.author-link {
  background-color: #64B8FF;
}

.answer-links.inline-links {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.answer-links .answer-link.read-link {
  background-color: #f2f2f2;
  color: #2d2d2d;
  border: 1px solid #e3e3e3;
}

.answer-links .answer-link.read-link:hover {
  background-color: #e8e8e8;
  color: #1a1a1a;
}

html[data-theme="dark"] .answer-links .answer-link.read-link {
  background-color: #2a2a2a;
  color: #d7d7d7;
  border: 1px solid #3a3a3a;
}

html[data-theme="dark"] .answer-links .answer-link.read-link:hover {
  background-color: #1f1f1f;
  color: #f1f1f1;
}

.answer-links .answer-link.author-link img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.answer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.answer-actions-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.answer-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.answer-actions-right .ai-append-btn {
  white-space: nowrap;
}

.answer-links .answer-link,
.ai-append-btn {
  height: 36px;
  line-height: 36px;
  padding: 0 12px;
}

.ai-append-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


@media (hover: none) and (pointer: coarse) {
  .t849__header:hover .t849__icon {
    opacity: 0;
    visibility: hidden;
  }

  .t849__header.studied:hover .t849__trigger-button,
  .t849__header.unclear:hover .t849__trigger-button {
    color: inherit;
  }

}
/* ================= Конец стилей аккордеона ================= */

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

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

/* 2) Сам инпут */
.search-container #search-input {
  display: inline-block;      /* чтобы margin: auto работал */
  width: 98%;                /* по ширине контейнера */
  padding: 0.85rem 2.5rem 0.85rem 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: 50%;
  right: 0.9rem;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 1.2rem;
  transform: translateY(-50%);
  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;
  }
}

/* 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);
}

.questions-load-status {
  display: none;
  max-width: 800px;
  margin: -0.35rem auto 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.35;
  color: #2d4f72;
  background: rgba(68, 187, 193, 0.14);
  border: 1px solid rgba(68, 187, 193, 0.25);
}

.questions-load-status.show {
  display: block;
}

html[data-theme="dark"] .questions-load-status {
  color: #bfd7ea;
  background: rgba(68, 187, 193, 0.16);
  border: 1px solid rgba(68, 187, 193, 0.34);
}

/* ===== Стили для выпадающего списка (как поле поиска) ===== */

@media (max-width: 600px) {
  .search-container {
    padding: 0rem;
  }
  .search-container #search-input {
    font-size: 0.9rem;
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    border-radius: 0.1rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .t849__content {
    padding: 10px;
  }
  .t849__text {
    line-height: 1.5;
  }
  .ai-supplement {
    padding: 0.75rem 0.85rem;
  }
  .ai-rich p {
    margin: 0.3rem 0;
  }
.ai-rich ul,
.ai-rich ol {
    margin: 0.3rem 0;
    padding-left: 0.6rem;
    list-style-position: inside;
}
  .ai-rich li {
    margin: 0.2rem 0;
  }
  .ai-rich br {
    line-height: 0.6;
  }
}

.answer-image {
  margin-top: 12px;
  text-align: center;
  min-height: 2.4rem;
}

.answer-image img {
  max-width: 100%;
  height: auto;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

/* ===== AI Loader ===== */
.ai-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: #FFF6E6;
  border-radius: 10px;
  color: #6b4e16;
  font-size: 0.95rem;
  min-height: 36px;
  max-width: 100%;
  box-sizing: border-box;
}

.ai-loader-text {
  display: inline-block;
}

.ai-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(107, 78, 22, 0.2);
  border-top-color: rgba(107, 78, 22, 0.8);
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== AI supplement block for accordion items ===== */
.ai-supplement {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: #EEF6FF;
  color: #153a63;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.ai-supplement.ai-supplement-public {
  background: #ECFAEE;
  color: #1f4f2d;
}

.ai-supplement-title {
  font-size: 0.9rem;
  color: #2f5c8a;
  margin-bottom: 0;
}
.ai-supplement.ai-supplement-public .ai-supplement-title {
  color: #2f7a43;
}

.ai-supplement-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ai-supplement-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.ai-nav-btn {
  border: none;
  background: transparent;
  color: rgba(47, 92, 138, 0.55);
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  line-height: 18px;
  font-size: 16px;
}

.ai-nav-btn:hover {
  color: rgba(47, 92, 138, 0.8);
}
.ai-supplement.ai-supplement-public .ai-nav-btn {
  color: rgba(47, 122, 67, 0.55);
}
.ai-supplement.ai-supplement-public .ai-nav-btn:hover {
  color: rgba(47, 122, 67, 0.85);
}

.ai-nav-index {
  min-width: 34px;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(47, 92, 138, 0.55);
  font-weight: 400;
}
.ai-supplement.ai-supplement-public .ai-nav-index {
  color: rgba(47, 122, 67, 0.6);
}

.ai-nav-delete {
  border: none;
  background: transparent;
  color: rgba(47, 92, 138, 0.36);
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
  line-height: 16px;
  font-size: 11px;
  opacity: 0.72;
}
.ai-nav-delete-placeholder {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  visibility: hidden;
  pointer-events: none;
}

.ai-nav-delete:hover {
  color: rgba(47, 92, 138, 0.58);
}
.ai-supplement.ai-supplement-public .ai-nav-delete {
  color: rgba(47, 122, 67, 0.34);
}
.ai-supplement.ai-supplement-public .ai-nav-delete:hover {
  color: rgba(47, 122, 67, 0.58);
}

.ai-supplement-title .ai-time {
  color: rgba(47, 92, 138, 0.55);
  font-weight: 400;
}
.ai-supplement.ai-supplement-public .ai-supplement-title .ai-time,
.ai-supplement.ai-supplement-public .ai-supplement-meta .ai-time,
.ai-supplement.ai-supplement-public .ai-supplement-inline-status {
  color: rgba(47, 122, 67, 0.58);
}

.ai-supplement-meta {
  margin-top: 0.35rem;
}
.ai-supplement-meta .ai-time {
  color: rgba(47, 92, 138, 0.55);
}

.ai-supplement-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  color: rgba(47, 92, 138, 0.55);
  white-space: nowrap;
}

.ai-inline-spinner {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(47, 92, 138, 0.22);
  border-top-color: rgba(47, 92, 138, 0.68);
  animation: spin 1.2s linear infinite;
}
.ai-supplement.ai-supplement-public .ai-inline-spinner {
  border-color: rgba(47, 122, 67, 0.2);
  border-top-color: rgba(47, 122, 67, 0.68);
}

.ai-append-btn {
  margin-top: 0.8rem;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  border: none;
  background: #ffb347;
  color: #2a1a05;
  cursor: pointer;
  font-size: 0.9rem;
}

.answer-actions .ai-append-btn {
  margin-top: 0;
}

.ai-append-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-rich p {
  margin: 0.4rem 0;
}

.ai-rich ul,
.ai-rich ol {
  margin: 0.4rem 0 0.4rem 1.25rem;
}

.ai-rich li {
  margin: 0.25rem 0;
}

.ai-rich code {
  background: #f2f2f2;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  font-family: "Fira Code", monospace;
  font-size: 0.9em;
}

/* ===== API Key Modal ===== */
.api-key-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  z-index: 1200;
}

.api-key-modal.show {
  display: flex;
}

.api-key-card {
  width: min(620px, 94vw);
  max-height: calc(100dvh - 24px);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.97) 0%, rgba(255, 255, 255, 0.94) 100%);
  border: 1px solid rgba(255, 170, 72, 0.22);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(6px) saturate(90%);
  -webkit-backdrop-filter: blur(6px) saturate(90%);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.api-key-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.28rem;
}

.api-key-body {
  padding: 1.2rem 1.2rem 0.7rem;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.api-key-head {
  margin-bottom: 0.9rem;
}

.api-key-text {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.55;
  color: #4f4b45;
}

.api-key-guide {
  border: 1px solid rgba(255, 176, 77, 0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at top left, rgba(255, 184, 77, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.78);
  padding: 0.95rem 1rem;
}

.api-key-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #d26a00;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
  border-radius: 0;
  text-decoration: none;
  font-weight: 700;
  transition: color 160ms ease;
}

.api-key-link:hover,
.api-key-link:focus-visible {
  color: #a95600;
  background: transparent !important;
  text-decoration: none;
}

.api-key-link::after {
  content: "->";
  font-size: 0.9em;
}

.api-key-steps {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.6rem;
  color: #2f2a25;
}

.api-key-steps li {
  padding-left: 0.15rem;
  line-height: 1.5;
}

.api-key-steps span {
  color: #62584c;
}

.api-key-steps strong {
  color: #16120d;
}

.api-key-input {
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.78rem 0.88rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #111;
  box-sizing: border-box;
  font-size: 0.98rem;
}

.api-key-status {
  min-height: 1.25rem;
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  color: #5f6368;
}

.api-key-status.is-error {
  color: #c62828;
}

.api-key-status.is-success {
  color: #1b7f3b;
}

.api-key-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: auto;
  padding: 0.9rem 1.2rem 1rem;
  border-top: 1px solid rgba(255, 170, 72, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 248, 239, 0.98) 100%);
  flex-shrink: 0;
}

.api-key-save,
.api-key-close {
  border: none;
  border-radius: 12px;
  padding: 0.68rem 1rem;
  cursor: pointer;
  font-weight: 700;
}

.api-key-save {
  background: #ffb347;
  color: #2a1a05;
}

.api-key-close {
  background: #e6e6e6;
  color: #1a1a1a;
}


html[data-theme="dark"] .api-key-card {
  background: linear-gradient(180deg, rgba(23, 19, 16, 0.96) 0%, rgba(20, 20, 20, 0.94) 100%);
  border: 1px solid rgba(255, 179, 71, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .api-key-actions {
  border-top-color: rgba(255, 179, 71, 0.12);
  background: linear-gradient(180deg, rgba(30, 25, 22, 0.78) 0%, rgba(18, 18, 18, 0.96) 100%);
}

html[data-theme="dark"] .api-key-text {
  color: #e6e6e6;
}

html[data-theme="dark"] .api-key-guide {
  background:
    radial-gradient(circle at top left, rgba(255, 179, 71, 0.14), transparent 42%),
    rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 179, 71, 0.14);
}

html[data-theme="dark"] .api-key-link {
  color: #ffbe6a;
}

html[data-theme="dark"] .api-key-link:hover,
html[data-theme="dark"] .api-key-link:focus-visible {
  color: #ffd092;
}

html[data-theme="dark"] .api-key-input {
  background: #1f1f1f;
  color: #f1f1f1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .api-key-status {
  color: #c7c7c7;
}

html[data-theme="dark"] .api-key-status.is-error {
  color: #ff8a80;
}

html[data-theme="dark"] .api-key-status.is-success {
  color: #8ee39a;
}

html[data-theme="dark"] .api-key-steps {
  color: #f2ede8;
}

html[data-theme="dark"] .api-key-steps span {
  color: #cabdae;
}

html[data-theme="dark"] .api-key-steps strong {
  color: #ffffff;
}

html[data-theme="dark"] .api-key-close {
  background: #2b2b2b;
  color: #f1f1f1;
}


.header-ai-notch {
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translate(-50%, 0) scale(1);
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.24rem 0.46rem;
  border-radius: 12px;
  border: var(--header-glass-border, 1px solid rgba(0,0,0,0.05));
  background: var(--header-glass-bg, rgba(255,255,255,0.22));
  backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  -webkit-backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0,0,0,0.08));
  color: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, background-color 180ms ease, transform 180ms ease;
  z-index: 2;
}

.header-ai-notch::before {
  display: none;
  content: none;
}

.header-ai-notch.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.header-ai-notch.hiding {
  opacity: 0;
  transform: translate(-50%, 0) scale(0.98);
  pointer-events: none;
}

.header-ai-notch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.8;
}

.header-ai-notch.processing .header-ai-notch-icon {
  animation: authSyncSpin 0.95s linear infinite;
}

.header-ai-notch.attention-flash {
  animation: headerAiNotchAttentionFlash 1.25s ease;
}

.header-ai-notch-text {
  font-size: 0.68rem;
  opacity: 0.72;
  white-space: nowrap;
}

@keyframes headerAiNotchAttentionFlash {
  0%, 100% {
    background: var(--header-glass-bg, rgba(255,255,255,0.22));
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0,0,0,0.08));
  }
  18%, 58% {
    background: rgba(255, 179, 71, 0.35);
    border-color: rgba(255, 165, 0, 0.42);
    box-shadow: 0 10px 24px rgba(255, 165, 0, 0.18);
  }
  34%, 74% {
    background: var(--header-glass-bg, rgba(255,255,255,0.22));
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0,0,0,0.08));
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-ai-notch.attention-flash {
    animation: none;
  }
}

@media (max-width: 600px) {
  .header-ai-notch {
    transition: opacity 180ms ease, background-color 180ms ease, transform 180ms ease;
    display: inline-flex;
    transform: translate(-50%, 0) scale(1);
    top: calc(100% + 2px);
    border-radius: 12px;
    padding: 0.24rem 0.46rem;
  }
  .header-ai-notch::before {
    display: none;
  }
  .header-ai-notch.hiding {
    transform: translate(-50%, 0) scale(0.98);
    opacity: 0;
  }
  .header-ai-notch .header-ai-notch-text {
    font-size: 0.62rem;
  }
}

@keyframes questionsSkeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 600px) {
  .api-key-card {
    width: min(100%, 94vw);
    border-radius: 18px;
    max-height: calc(100dvh - 24px);
  }
  .api-key-body {
    padding: 0.95rem 0.9rem 0.65rem;
  }
  .api-key-card h3 {
    font-size: 1rem;
  }
  .api-key-text {
    font-size: 0.85rem;
  }
  .api-key-guide {
    padding: 0.82rem 0.84rem;
    border-radius: 14px;
  }
  .api-key-link {
    font-size: 0.95rem;
  }
  .api-key-steps {
    gap: 0.5rem;
    margin-top: 0.7rem;
    padding-left: 1rem;
    font-size: 0.88rem;
  }
  .api-key-input {
    padding: 0.74rem 0.8rem;
    font-size: 0.95rem;
  }
  .api-key-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 0.72rem 0.9rem 0.9rem;
  }
  .api-key-save,
  .api-key-close {
    width: 100%;
    justify-content: center;
  }
}

.ai-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.ai-supplement.ai-swipe-next {
  animation: aiSupplementSwipeNext 220ms ease;
}

.ai-supplement.ai-swipe-prev {
  animation: aiSupplementSwipePrev 220ms ease;
}

@keyframes authSyncSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes aiSupplementSwipeNext {
  from { opacity: 0.78; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes aiSupplementSwipePrev {
  from { opacity: 0.78; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.ai-table th,
.ai-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  vertical-align: top;
}

.ai-table th {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.75);
}

html[data-theme="dark"] .ai-table {
  background: rgba(36, 36, 36, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .ai-table th,
html[data-theme="dark"] .ai-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .ai-table th {
  background: rgba(36, 36, 36, 0.9);
}

html[data-theme="dark"] .ai-supplement {
  background: #1c2b3a;
  color: #e6f0ff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public {
  background: #1d2f23;
  color: #d8f1de;
}

html[data-theme="dark"] .ai-supplement-title {
  color: #9ec3ff;
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-supplement-title {
  color: #9ee3b0;
}

html[data-theme="dark"] .ai-supplement-title .ai-time {
  color: rgba(158, 195, 255, 0.55);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-supplement-title .ai-time,
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-supplement-meta .ai-time,
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-nav-index,
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-supplement-inline-status {
  color: rgba(158, 227, 176, 0.58);
}

html[data-theme="dark"] .ai-supplement-meta .ai-time {
  color: rgba(158, 195, 255, 0.55);
}

html[data-theme="dark"] .ai-nav-btn {
  color: rgba(158, 195, 255, 0.55);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-nav-btn {
  color: rgba(158, 227, 176, 0.58);
}

html[data-theme="dark"] .ai-nav-delete {
  color: rgba(158, 195, 255, 0.42);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-nav-delete {
  color: rgba(158, 227, 176, 0.42);
}

html[data-theme="dark"] .ai-nav-delete:hover {
  color: rgba(158, 195, 255, 0.65);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-nav-delete:hover {
  color: rgba(158, 227, 176, 0.65);
}

html[data-theme="dark"] .ai-nav-btn:hover {
  color: rgba(158, 195, 255, 0.85);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-nav-btn:hover {
  color: rgba(158, 227, 176, 0.85);
}

html[data-theme="dark"] .ai-nav-index {
  color: rgba(158, 195, 255, 0.55);
}

html[data-theme="dark"] .ai-supplement-inline-status {
  color: rgba(158, 195, 255, 0.6);
}

html[data-theme="dark"] .ai-inline-spinner {
  border-color: rgba(158, 195, 255, 0.2);
  border-top-color: rgba(158, 195, 255, 0.7);
}
html[data-theme="dark"] .ai-supplement.ai-supplement-public .ai-inline-spinner {
  border-color: rgba(158, 227, 176, 0.2);
  border-top-color: rgba(158, 227, 176, 0.7);
}

/* ===== AI Refine Action ===== */
.ai-refine-action {
  position: absolute;
  z-index: 1300;
  border: var(--header-glass-border, 1px solid rgba(0, 0, 0, 0.05));
  background: var(--header-glass-bg, rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  -webkit-backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0, 0, 0, 0.08));
  color: inherit;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  align-items: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-refine-panel {
  position: absolute;
  z-index: 1300;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: var(--header-glass-border, 1px solid rgba(0, 0, 0, 0.05));
  background: var(--header-glass-bg, rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  -webkit-backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  padding: 8px;
  max-width: min(720px, 92vw);
  box-sizing: border-box;
  width: min(720px, 92vw);
}

.ai-refine-input {
  flex: 1 1 auto;
  min-width: 260px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
}

.ai-refine-send,
.ai-refine-cancel {
  border: none;
  border-radius: 8px;
  padding: 0.46rem 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.ai-refine-send {
  background: #ffb347;
  color: #2a1a05;
}

.ai-refine-cancel {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

html[data-theme="dark"] .ai-refine-input {
  background: rgba(22, 27, 35, 0.62);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f6ff;
}

html[data-theme="dark"] .ai-refine-cancel {
  background: rgba(255, 255, 255, 0.12);
  color: #dce7ff;
}

@media (max-width: 600px) {
  .ai-refine-action {
    font-size: 0.74rem;
    padding: 5px 8px;
  }
  .ai-refine-panel {
    width: min(94vw, 520px);
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 7px;
  }
  .ai-refine-input {
    min-width: 100%;
    font-size: 0.82rem;
  }
  .ai-refine-send,
  .ai-refine-cancel {
    font-size: 0.74rem;
    padding: 0.42rem 0.62rem;
  }
}

html[data-theme="dark"] .ai-loader {
  background: #2b2214;
  color: #ffd49a;
}

html[data-theme="dark"] .ai-spinner {
  border-color: rgba(255, 212, 154, 0.2);
  border-top-color: rgba(255, 212, 154, 0.9);
}

html[data-theme="dark"] .ai-rich code {
  background: #1f2937;
  color: #e5e7eb;
}

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

@media (max-width: 600px) {
  .ai-loader {
    width: 100%;
    justify-content: flex-start;
    font-size: clamp(0.72rem, 2.6vw, 0.9rem);
  }
  .ai-loader-text {
    white-space: normal;
    word-break: break-word;
  }
  .ai-nav-delete {
    width: 15px;
    height: 15px;
    font-size: 10px;
  }
  .ai-supplement-inline-status {
    font-size: 0.72rem;
    gap: 0.22rem;
  }
  .ai-inline-spinner {
    width: 8px;
    height: 8px;
    border-width: 1.3px;
  }
}

/* === Стили для прогресс-бара === */
.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);
}

   /* Добавить в конец файла */
   .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: rgba(250, 250, 250, 0.55);
     color: #333;
     cursor: pointer;
     border: 1px solid rgba(0, 0, 0, 0.06);
     transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
     font-size: 0.7rem;
     backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
     -webkit-backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
   }

   .filter-chip:hover {
     background-color: rgba(242, 250, 251, 0.65);
   }

   .filter-chip.active {
     background-color: rgba(68, 187, 193, 0.55);
     color: white;
     border-color: rgba(68, 187, 193, 0.4);
   }

   /* Темная тема */
   html[data-theme="dark"] .filter-chip {
     background-color: rgba(35, 35, 35, 0.5);
     color: #eee;
     border: 1px solid rgba(255, 255, 255, 0.08);
   }

   html[data-theme="dark"] .filter-chip:hover {
     background-color: rgba(58, 58, 58, 0.55);
   }

   html[data-theme="dark"] .filter-chip.active {
     background-color: rgba(68, 187, 193, 0.45);
     color: white;
     border-color: rgba(68, 187, 193, 0.4);
   }

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

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

/* Нижняя панель категорий */
.bottom-filters {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: auto;
  max-width: min(620px, 92vw);
  bottom: 10px;
  z-index: 1100;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--header-glass-bg, rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  -webkit-backdrop-filter: blur(var(--header-glass-blur, 3px)) saturate(var(--header-glass-saturate, 90%));
  border: var(--header-glass-border, 1px solid rgba(0, 0, 0, 0.05));
  box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0, 0, 0, 0.08));
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateX(-50%) translateY(10px);
  overflow-x: auto;
  white-space: nowrap;
  gap: 6px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  padding-left: 16px;
  padding-right: 16px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.bottom-filters::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.bottom-filters.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.bottom-filters .filter-chip {
  font-size: 0.72rem;
  padding: 5px 8px;
  flex: 0 0 auto;
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .bottom-filters {
  background: var(--header-glass-bg, rgba(18, 18, 18, 0.2));
  border: var(--header-glass-border, 1px solid rgba(255, 255, 255, 0.12));
  box-shadow: var(--header-glass-shadow, 0 10px 24px rgba(0, 0, 0, 0.4));
}

@media (max-width: 600px) {
  .bottom-filters {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(360px, 92vw);
    bottom: 8px;
    padding: 6px 8px;
  }
  .bottom-filters .filter-chip {
    font-size: 0.7rem;
    padding: 5px 8px;
  }
}

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

  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"] .site-header nav a {
        background-color: transparent;
        color: #F1F1F1;
  }

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

  @media (hover: none) and (pointer: coarse) {
    html[data-theme="dark"] .site-header nav a:hover {
          background-color: transparent;
          color: inherit;
    }
  }

  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"] :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"] .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;
  }
