/* Квиз (#quiz) и ИИ-помощник (#chat). Токены и .btn задаёт styles.css. Все углы острые. */

/* ---------- Квиз ---------- */
.quiz { min-width: 0; }

.quiz__card {
  position: relative;
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 24px;
  color: var(--text);
  font-family: var(--f-body);
}

.quiz__head { margin-bottom: 20px; }

.quiz__step {
  margin: 0 0 10px;
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-2);
}

.quiz__bar {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
}

.quiz__sq {
  display: block;
  height: 10px;
  background: var(--line-2);
  transition: background-color .2s steps(2);
}
.quiz__sq.is-on { background: var(--sq, var(--cyan)); }

.quiz__title {
  margin: 0 0 18px;
  font-family: var(--f-pixel);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.15;
  color: var(--text);
}
.quiz__title:focus { outline: none; }
.quiz__title:focus-visible { outline: 2px dashed var(--cyan); outline-offset: 4px; }

.quiz__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  width: 100%;
  padding: 12px 16px;
  background: var(--panel-2);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 0;
  font: 500 16px/1.3 var(--f-body);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .1s;
}
.quiz__option:hover { border-color: var(--cyan); }
.quiz__option:active { transform: translate(2px, 2px); }
.quiz__option:focus-visible,
.quiz__input:focus-visible,
.quiz__checkbox:focus-visible,
.quiz__card a:focus-visible,
.chat__hint:focus-visible,
.chat__input:focus-visible,
.chat__log:focus-visible,
.chat__panel a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.quiz__option[aria-pressed="true"] {
  border-color: var(--cyan);
  background: rgba(34, 216, 240, .12);
}

.quiz__mark {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-3);
  background: transparent;
}
.quiz__option[aria-pressed="true"] .quiz__mark {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 3px 3px 0 var(--violet);
}

.quiz__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.quiz__submit { flex: 1 1 auto; }
.quiz__submit[disabled] { opacity: .7; cursor: progress; }

/* Поля */
.quiz__form { display: grid; gap: 16px; }
.quiz__field { display: grid; gap: 6px; }

.quiz__lbl {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.quiz__input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--line);
  border-radius: 0;
  font: 400 16px/1 var(--f-body);
  transition: border-color .15s;
}
.quiz__input::placeholder { color: var(--text-3); }
.quiz__input:hover { border-color: var(--text-3); }
.quiz__input:focus { border-color: var(--cyan); }
.quiz__input[aria-invalid="true"] { border-color: var(--error); }

.quiz__hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

.quiz__error {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--error);
}
.quiz__error::before { content: "! "; font-family: var(--f-mono); font-weight: 600; }

.quiz__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.quiz__checkbox {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--cyan);
  border-radius: 0;
  cursor: pointer;
}
.quiz__checkbox[aria-invalid="true"] { outline: 2px solid var(--error); outline-offset: 2px; }
.quiz__consent-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  cursor: pointer;
}
.quiz__card a,
.chat__panel a {
  color: var(--cyan-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.quiz__card a:hover,
.chat__panel a:hover { color: var(--cyan); }

/* Ловушка для ботов: визуально спрятана */
.quiz__trap {
  position: absolute !important;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.quiz__status {
  padding: 12px 14px;
  border: 2px solid var(--error);
  background: rgba(255, 122, 122, .08);
  font-size: 14px;
  line-height: 1.5;
}
.quiz__status p { margin: 0; }
.quiz__status p + p { margin-top: 6px; }

/* Успех */
.quiz__done { display: grid; gap: 12px; justify-items: start; }
.quiz__done .quiz__title { margin: 0; }
.quiz__check { width: 42px; height: 36px; fill: var(--cyan); shape-rendering: crispEdges; }
.quiz__done-text { margin: 0; font-size: 17px; color: var(--text-2); }
.quiz__recap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 8px 0 0;
  padding: 12px 14px;
  width: 100%;
  border: 2px dashed var(--line);
  font-size: 15px;
}
.quiz__recap dt { font-family: var(--f-mono); color: var(--text-3); }
.quiz__recap dd { margin: 0; color: var(--text); }

/* ---------- ИИ-помощник ---------- */
.chat { min-width: 0; }

.chat__panel {
  display: flex;
  flex-direction: column;
  background: #0B0A12;
  border: 1px solid var(--cyan);
  border-radius: 0;
  box-shadow: 8px 8px 0 var(--shadow);
  color: var(--text);
  font-family: var(--f-body);
  min-height: 460px;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}
.chat__status {
  width: 10px;
  height: 10px;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 216, 240, .2);
}
.chat__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--f-pixel);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.chat__log {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.chat__msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chat__msg--user {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
}
.chat__msg--bot {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  color: var(--text);
}
.chat__text { margin: 0; white-space: pre-line; }

.chat__extras { display: grid; gap: 8px; margin-top: 10px; justify-items: start; }
.chat__cta { min-height: 44px; }
.chat__contacts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; }
.chat__links { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.chat__links a::after { content: " ↗"; }

/* «печатает…»: три пиксельных квадратика */
.chat__typing { padding: 14px; }
.chat__dots { display: inline-flex; gap: 6px; }
.chat__dots > span {
  width: 8px;
  height: 8px;
  background: var(--cyan);
  animation: chat-blink 1s steps(1, end) infinite;
}
.chat__dots > span:nth-child(2) { animation-delay: .2s; }
.chat__dots > span:nth-child(3) { animation-delay: .4s; }
@keyframes chat-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .2; }
}

.chat__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}
.chat__hint {
  min-height: 40px;
  padding: 8px 12px;
  background: transparent;
  color: var(--cyan-2);
  border: 1px solid var(--line);
  border-radius: 0;
  font: 500 14px/1.2 var(--f-body);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.chat__hint:hover { border-color: var(--cyan); color: var(--cyan); }

.chat__form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-2);
}
.chat__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  font: 400 16px/1 var(--f-body);
}
.chat__input::placeholder { color: var(--text-3); }
.chat__input:focus { border-color: var(--cyan); }
.chat__send { flex: 0 0 auto; }

/* Скрыто визуально, доступно экранным чтецам */
.chat__sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Телефон ---------- */
@media (max-width: 767px) {
  .quiz__card { padding: 16px; box-shadow: 5px 5px 0 var(--shadow); }
  .quiz__options { grid-template-columns: 1fr; }
  .quiz__option { min-height: 56px; }
  .quiz__actions .btn { flex: 1 1 auto; }
  .chat__panel { min-height: 0; box-shadow: 5px 5px 0 var(--shadow); }
  .chat__log { height: 300px; }
  .chat__form { padding: 12px; }
  .chat__send { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Без движения ---------- */
@media (prefers-reduced-motion: reduce) {
  .quiz__sq,
  .quiz__option,
  .quiz__input,
  .chat__hint { transition: none; }
  .quiz__option:active { transform: none; }
  .chat__dots > span { animation: none; opacity: .8; }
}
