:root {
  /* Цвета */
  --color-bg: #eeeeee;
  --color-text: #222222;
  --color-text-muted: #3c3c43;
  --color-heading: #2792d6;
  --color-strong: #686868;
  --color-border: #dddddd;
  --color-border-soft: rgba(200, 200, 200, 0.25);
  --color-checkbox: #fcd800;
  --color-hover-bg: #f7f7f7;
  --color-hover-border: #e0c000;
  --color-hover-text: #b58900;
  --modal-overlay: rgba(0, 0, 0, 0.4);

  /* Размеры */
  --font-base: 1rem;
  --font-modal: 1.16rem;
  --modal-max-width: 670px;
  --modal-padding: 28px;
  --modal-radius: 16px;
  --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(100, 100, 100, 0.1);
}

/* === Общая модалка === */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay);
}

.modal-content {
  margin: 5vh auto 24px;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.94);
  color: var(--color-text);
  border-radius: var(--modal-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: var(--modal-padding);
  border: 1px solid var(--color-border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: var(--font-base);
  font-family: system-ui, sans-serif;
  box-sizing: border-box;
  width: 90%;
  max-width: var(--modal-max-width);
}

/* === Модалка экзамена === */
.exam-modal-content {
  box-shadow: var(--box-shadow);
  padding: var(--modal-padding);
  color: var(--color-text);
  font-size: var(--font-modal);
  width: 90%;
  max-width: var(--modal-max-width);
  margin: 5vh auto 24px;
  overflow-y: auto;
  max-height: 88vh;
  border: 1px solid var(--color-border);
  font-family: system-ui, sans-serif;
  box-sizing: border-box;
  background: var(--color-bg);
  border-radius: var(--modal-radius);
}


.exam-modal-content h2{
  font-size: 1rem;      /* <--заголовок когда нажимаешь экзамен*/
  line-height: 1.2;
  margin: 0 0 14px;
}

/* === Закрыть === */
.close {
  float: right;
  font-size: 24px;
  cursor: pointer;
}

/* === Контент правил === */
#rules-modal-content {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-muted);
  padding: 0.25em 0;
}

#rules-modal-content h1,
#rules-modal-content h2,
#rules-modal-content h3 {
  color: var(--color-heading);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  font-weight: bold;
  line-height: 1.3;
}

#rules-modal-content p {
  margin-bottom: 1.2em;
}

#rules-modal-content strong {
  color: var(--color-strong);
}

#rules-modal-content ul {
  padding-left: 1.5em;
  list-style-type: disc;
  margin-bottom: 1em;
}

#rules-modal-content li {
  margin-bottom: 0.3em;
}

#rules-modal-content code {
  background-color: #ffffff;
  color: #1c1c1e;
  padding: 3px 6px;
  border-radius: 5px;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 100%;
}

#rules-modal-content pre {
  background-color: #f5f5f7;
  border: 1px solid #d1d1d6;
  padding: 12px 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1em;
}

#rules-modal-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-top: 1em;
  margin-bottom: 1em;
  background-color: #fff;
}

#rules-modal-content th {
  background-color: #f5f5f7;
  color: #1c1c1e;
  font-weight: 600;
}

#rules-modal-content th,
#rules-modal-content td {
  border: 1px solid #e0e0e0;
  padding: 10px 12px;
  text-align: left;
  min-width: 120px;
  white-space: nowrap;
}

/* === Форма экзамена === */
#exam-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Сетка чекбоксов */
#exam-form > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px 18px;
}

/* Чекбоксы */
#exam-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-size: 0.9em;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

#exam-form label:hover {
  background: var(--color-hover-bg);
  color: var(--color-hover-text);
  border-color: var(--color-hover-border);
}

#exam-form input[type="checkbox"] {
  accent-color: var(--color-checkbox);
  width: 0.6em;
  height: 0.6em;
  margin-right: 6px;
  transition: box-shadow 0.12s;
}

/* Чекбокс + input */
#exam-form > label {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Кнопка запуска */
#start-exam-btn {
  background: linear-gradient(90deg, #ffe600 30%, #ffc400 100%);
  border: none;
  color: #222;
  font-weight: 700;
  padding: 13px 0;
  border-radius: 12px;
  box-shadow: 0 1.5px 10px 0 #00000015;
  font-size: 0.8em;
  cursor: pointer;
  width: 43%;
  transition: background 0.18s, transform 0.14s, color 0.15s;
  margin-top: 8px;
  letter-spacing: 0.01em;
}

#start-exam-btn:hover {
  background: linear-gradient(90deg, #ffd600 70%, #ffc400 100%);
  transform: translateY(-2px) scale(1.04);
  color: #111;
}

/* === Адаптив Настройки модальных окон на мобильных устройствах  === */
@media (max-width: 600px) {
  .modal-content,
  .exam-modal-content {
    padding: 12px 3vw;   /*внешний */
    font-size: 1rem;
    width: 97%; 
    max-width: 99vw;
    border-radius: 11px;
    max-height: 94vh;
  }

  .exam-modal-content h2{
    font-size: 1rem;
  }

  #exam-form > div {
    grid-template-columns: 1fr;
    gap: 10px 0;
  }

  #exam-form label {
    font-size: 1em;
    padding: 8px;
  }

  #start-exam-btn {
    width: 100%;
    padding: 8px 0;
    font-size: 0.8em;
    margin-top: 12px;
  }
}


/* ============================
   Гостевые сообщения в rules-modal
   (Правила / Экзамен / Подсказка)
   ============================ */

/* Общий контейнер */
#rules-modal-content .auth-message {
  text-align: center;
  line-height: 1.4;
}

/* Заголовок только в гостевых сообщениях (общий базовый вид) */
#rules-modal-content .auth-message h2 {
  margin-top: 0;
  margin-bottom: 0.6em;
  color: #386ea2; /* базовый цвет по умолчанию */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0,);
  font-size: clamp(0.85rem, 1.1vw, 1rem);
}


/* Правила */
#rules-modal-content .auth-message--rules h2 {
  color: #03A9F4;   
}

/* Экзамен */
#rules-modal-content .auth-message--exam h2 {
  color:  #9C27B0;
}

/* Подсказка */
#rules-modal-content .auth-message--hint h2 {
  color: #7a7a7a;
}