:root {
  --color-bg: #f1f1f1;
  --color-panel: #ffffff;
  --color-border: #ccc;
  --color-border-light: #e7e7e7;
  --color-text: #1e1e1e;
  --color-muted: #888;
  --color-accent: #ff9800;
  --color-ok: #4caf50;
  --color-ok-bg: #eaffea;
  --color-error: #f44336;
  --color-error-bg: #ffecec;
  --color-link: #0077cc;
  --color-hover: #dfdfdf;
  --color-stats-bg: #f0fdf4;
  --color-stats-hover: #edfdf3;
  --color-focus-shadow: rgb(168 225 255);
  --color-placeholder: #666;
  --color-email: #666;
}

/* === Базовая структура === */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

/* === Кнопки === */
button {
  margin: 6px;
  padding: 10px 18px;
  font-size: clamp(14px, 2vw, 16px);
  cursor: pointer;
  border-radius: 10px;
  border: none;
  font-weight: 500;
  background: linear-gradient(to bottom, #ffffff, #e0e0e0);
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

/* Кнопка "Проверить" после проверки */
#check-btn.checked {
  opacity: 0.9;             /* стала тусклой */
  filter: grayscale(70%);   /* убрали цвет */
  cursor: default;
  box-shadow: none;
}

/* чтобы по hover она не оживала */
#check-btn.checked:hover {
  background: inherit;
  transform: none;
}


/* Подсветка "Новое предложение", когда нужно нажать именно её */
#new-btn.next-highlight {
  box-shadow: 0 0 0 2px var(--color-accent);
  transform: translateY(-1px);
  animation: pulse-next 1.1s ease-in-out infinite alternate;
}

/* лёгкий "пульс" */
@keyframes pulse-next {
  from {
    box-shadow: 0 0 0 1px rgb(159 243 255 / 26%);
  }
  to {
    box-shadow: 0 0 0 5px rgba(255, 152, 0, 0.0);
  }
}






button:hover {
  background: linear-gradient(to bottom, #eaeaea, #f3f3ff);
}

/* === Специальные кнопки === */
#random-theme-btn {
  background: linear-gradient(to bottom, #ffcc80, #ffa726);
  color: white;
}

#random-theme-btn:hover {
  background: linear-gradient(to bottom, #ffb74d, #fb8c00);
}

#clear-btn {
  background: linear-gradient(to bottom, #90a4ae, #607d8b);
  color: white;
}

#clear-btn:hover {
  background: linear-gradient(to bottom, #78909c, #546e7a);
}

/* === Слова-кнопки === */
#word-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 15px;
}

#word-buttons button {
  background: #fbfbfb;
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  box-shadow: inset 0 -1px 0 var(--color-border);
  padding: 10px 14px;
  font-size: clamp(15px, 5vw, 17px);
}

#word-buttons button:hover {
  background: var(--color-hover);
}

#word-buttons button.used {
  background-color: #e0e0e0;
  color: var(--color-muted);
  cursor: not-allowed;
  box-shadow: none;
  border-style: dashed;
}

#word-buttons button.hinted {

  border-color: var(--color-accent);
  animation: glowHintLight 1.5s ease-out;
}

@keyframes glowHintLight {
  0%   { box-shadow: 0 0 0 0 var(--color-accent); }
  50%  { box-shadow: 0 0 0 4px var(--color-accent); }
  100% { box-shadow: 0 0 0 0 var(--color-accent); }
}

/* === Текстовое поле ответа === */
textarea#answer {
  display: block;
  width: 95%;
  margin: 15px 0;
  padding: 14px 16px;
  font-size: clamp(16px, 2vw, 18px);
  font-weight: 500;
  line-height: 1.4;
  color: #333;
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: var(--color-panel);
  border: 2px solid var(--color-border);
  border-radius: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
  min-height: 48px;
}

textarea#answer:focus {
  border-color: #e9f7ed;
  outline: none;
  box-shadow: 0 0 0 1px var(--color-focus-shadow);
}

#answer.correct {
  border: 2px solid var(--color-ok);
  background-color: var(--color-ok-bg);
}

#answer.wrong {
  border: 2px solid var(--color-error);
  background-color: var(--color-error-bg);
}

/* === Статистика === */
#stats-box {
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #dfdfdf, #fefefe);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 25px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.08);
  font-size: 16px;
  position: relative;
}

#stats-box button {
  background: #f4f4f4;
}

#stats-box button:hover {
  background: #f4f4fe;
}

/* ПК: кнопка 📊 в линии справа */
#stats-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  margin-left: auto;
}

#stats-box label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  user-select: none;
}

#stats-box input[type="checkbox"] {
  width: 0.7em; height: 0.7em;
  accent-color: #ececec;
  cursor: pointer;
}

/* Сворачивание панели статистики (работает на всех экранах) */
#stats-box.collapsed span,
#stats-box.collapsed button:not(#stats-toggle),
#stats-box.collapsed label {
  display: none;
}

/* === Тема и статистика темы === */
#topic-stats {
  font-size: 14.5px;
  color: #2e7d32;
  background: linear-gradient(135deg, #e6f4ea, var(--color-stats-bg));
  border-radius: 10px;
  padding: 6px 12px;
  margin-left: 6px;
  display: inline-block;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow:
    inset 0 0 0 1px rgba(46, 125, 50, 0.1),
    0 2px 5px rgba(0, 0, 0, 0.05);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
  opacity: 0.96;
}

#topic-stats:hover {
  background: linear-gradient(135deg, #dff9e4, var(--color-stats-hover));
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  opacity: 1;
  cursor: default;
}

/* === Заголовки === */
.main-title {
  font-size: clamp(1.4rem, 1.6vw, 2.2rem);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
  margin: 0 0 0.3em 0;
  color: #222;
}

.sub-title {
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  color: #aaa;
  text-align: center;
  margin: 0 0 1.5em 0;
  font-weight: 400;
}

/* === Адаптивность === */
@media (max-width: 600px) {

  #stats-box {
    flex-direction: column;
    align-items: center;
    text-align: center;

    /* компактнее отступы и gap */
    padding: 10px 14px 25px; /* сверху место под 📊, по бокам и снизу поменьше */
    gap: 6px 10px;
    margin: 12px 0;         /* вместо 20px, чтобы меньше пустоты между блоками */
  }

  /* мобилка: 📊 сверху справа */
  #stats-toggle {
    position: absolute;
    top: 10px;
    right: 10px;

    width: 42px;
    height: 42px;
    padding: 0;
    margin: 0;
    display: grid;
    place-items: center;
    margin-left: 0;
  }

  #stats-box span,
  #stats-box button {
    font-size: 15px;
  }
  /* Растягиваем все кнопки, кроме 📊 */
  #stats-box button:not(#stats-toggle) {
    width: 100%;
    max-width: 280px;
  }

  #question {
    font-size: 20px;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
  }
}


/* === Хедер и авторизация === */
.header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding-block: 0.5rem;
  padding-inline: clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid #e0e0e0;
}

#auth-block {
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: #444;
}

#auth-block a,
#auth-block .linklike {
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

:is(#auth-block a, #auth-block .linklike):hover {
  color: var(--color-link);
  text-decoration: underline;
}

/* Выход в виде ссылки */
.linklike {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
  vertical-align: baseline;
  background: none;
  border: none;
}

/* === Блок пользователя === */
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.user-email {
  font-size: 0.85rem;
  color: var(--color-email);
  font-style: italic;
}

.logout-button {
  background: none;
  color: #333;
  text-decoration: none;
  padding: 4px;
  font-size: 1.1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.logout-button:hover {
  background-color: #eee;
}

/* === Цветовые состояния === */
.result-ok { color: #1b8f3a; }
.result-warn { color: #771b87; }
.result-muted { color: #888; }
.result-err { color: #d32f2f; }

.text-ok { color: #1b8f3a; font-weight: 600; }
.text-err { color: #d32f2f; font-weight: 600; }
.text-muted { color: #555; }

.theme-select-label{
  font-size: clamp(0.7rem, 1vw, 1rem);
}

#task-container .exam-theme-label,
#task-container .exam-theme-value{
  font-size: clamp(0.65rem, 1vw, 0.9rem);
  line-height: 1.2;
  color: #afafaf;
}

.exam-title{
  font-weight: 700;
  margin-bottom: 8px;
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  color: #afafaf;
}

.exam-theme-line{
  margin-bottom: 6px;
}


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

.exam-progress{
  margin-top: 10px;
}

.exam-result{
  min-height: 20px;
}


.consent-block p,
.consent-block label,
.consent-block a {
    font-size: 0.8rem;   /* можно 0.85rem или 0.75rem – как больше нравится */
    line-height: 1.4;
}


.main-title a { color: inherit; text-decoration: none; }
.main-title a:hover { text-decoration: none; }

.main-title a {
  text-decoration: none;
  color: #334155;
  font-weight: 500;
  display: inline-block;
  background: linear-gradient(110deg, #FFC107 40%, #fff 50%, #f49236 60%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  transition: 0.3s;
}

.main-title a:hover {
  -webkit-text-fill-color: transparent;
  animation: shine 1.2s infinite linear;
  transform: translateY(-1px);
}

@keyframes shine {
  to { background-position: -200% center; }
}

/* === шкала === */

.streak-bar {
  display: flex;
  justify-content: center;

  /* расстояние между полосками */
  gap: clamp(1px, 0.4vw, 3px);

  margin-top: 40px;
  flex-wrap: wrap;
}

.streak-square {
  width: clamp(10px, 1vw, 11px);  /* длина полоски */
  height: clamp(3px, 0.5vw, 5px);   /* толщина полоски */

  border-radius: clamp(2px, 0.5vw, 4px); /* чуть скруглить */
  display: inline-block;

  transition: background-color 0.2s ease;
}

.streak-ok    { background: #3bb273; }
.streak-bad   { background: #ffa92a; }
.streak-empty { background: #d7d7d7; }

  /* подсказки, закончились */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  /* стеклянный фон */
  background: rgb(27 117 182 / 40%);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgb(154 137 137 / 25%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  font-size: 14px;
  z-index: 1000;

  /* эффект стекла */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgb(204 204 204);
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

