/* Вход, регистрация, старт, тест и результат */

.ap-section {
  font-family: "Jost", sans-serif;
  padding-top: 60px;
  padding-bottom: 100px;
}

.ap-section .container {
  position: relative;
  z-index: 1;
}

/* ---------- Карточка с боковой панелью ---------- */

.ap-auth {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 0 85px 0 #e9eefc;
  overflow: hidden;
}

.ap-auth.narrow {
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  max-width: 1020px;
  margin: 0 auto;
}

.ap-side {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #7b45ff 0%, #6f34fe 45%, #4b1cbd 100%);
  color: #fff;
  padding: 48px 40px 40px;
}

.ap-side::before,
.ap-side::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.ap-side::before {
  width: 260px;
  height: 260px;
  top: -110px;
  right: -90px;
  background: rgba(252, 166, 31, 0.3);
}

.ap-side::after {
  width: 200px;
  height: 200px;
  bottom: -90px;
  left: -70px;
  background: rgba(255, 255, 255, 0.08);
}

.ap-side > * {
  position: relative;
  z-index: 1;
}

.ap-side-logo {
  width: 120px;
  margin-bottom: 30px;
  filter: brightness(0) invert(1);
}

.ap-side h3 {
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  line-height: 38px;
  margin-bottom: 12px;
}

.ap-side p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 17px;
  line-height: 26px;
  margin-bottom: 0;
}

.ap-side-list {
  display: grid;
  gap: 18px;
  margin: 30px 0;
}

.ap-side-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  line-height: 22px;
}

.ap-side-item b {
  display: block;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}

.ap-side-item a {
  color: var(--accent);
  font-weight: 600;
}

.ap-side-icon {
  flex: 0 0 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.ap-side-foot {
  margin-top: auto;
  padding-top: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
}

.ap-side-foot a {
  color: var(--accent);
  font-weight: 600;
}

.ap-side-foot a:hover {
  color: #fff;
}

.ap-panel {
  padding: 44px 48px 40px;
}

.ap-panel-title {
  color: var(--primary-color);
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  margin-bottom: 6px;
}

.ap-panel-sub {
  color: var(--text-color);
  font-size: 17px;
  line-height: 25px;
  margin-bottom: 28px;
}

/* ---------- Поля формы ---------- */

.ap-fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 28px;
  min-width: 0;
}

.ap-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-color);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 16px;
}

.ap-legend-num {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3eeff;
  color: var(--light-purple-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

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

.ap-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ap-field {
  display: block;
  margin: 0;
  min-width: 0;
}

.ap-field.full {
  grid-column: 1 / -1;
}

.ap-label {
  display: block;
  color: var(--primary-color);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
  padding-left: 4px;
}

.ap-control {
  position: relative;
}

.ap-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #b4a4f3;
  font-size: 15px;
  pointer-events: none;
}

.ap-input {
  display: block;
  width: 100%;
  height: 54px;
  margin: 0;
  padding: 0 20px 0 48px;
  background: #fbfaff;
  border: 1px solid #e6e0fb;
  border-radius: 30px;
  box-shadow: none;
  color: var(--secondary-color);
  font-family: "Jost", sans-serif;
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.ap-input:focus {
  background: #fff;
  border-color: var(--light-purple-color);
  box-shadow: 0 0 0 4px rgba(111, 52, 254, 0.12);
}

.ap-input::placeholder {
  color: #b3adc4;
}

.ap-input.with-toggle {
  padding-right: 54px;
}

select.ap-input {
  padding-right: 46px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%236f34fe' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  text-overflow: ellipsis;
}

select.ap-input:invalid {
  color: #b3adc4;
}

input[type="date"].ap-input {
  padding-right: 16px;
}

.ap-field.invalid .ap-input,
.ap-field.invalid .ap-pill span {
  border-color: #e53935;
  background-color: #fff6f6;
}

.ap-field.invalid .ap-label {
  color: #e53935;
}

.ap-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9d8fd6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-toggle:hover,
.ap-toggle:focus-visible {
  background: #f3eeff;
  color: var(--light-purple-color);
  outline: none;
}

.ap-hint {
  color: var(--text-color);
  font-size: 14px;
  line-height: 20px;
  margin-top: 6px;
  padding-left: 4px;
}

.ap-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-pill {
  position: relative;
  margin: 0;
}

.ap-pill input {
  display: block;
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.ap-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #e6e0fb;
  border-radius: 23px;
  background: #fbfaff;
  color: var(--primary-color);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ap-pill span:hover {
  border-color: var(--light-purple-color);
}

.ap-pill input:checked + span {
  background: var(--light-purple-color);
  border-color: var(--light-purple-color);
  color: #fff;
}

.ap-pill input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(111, 52, 254, 0.18);
}

.ap-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-color);
  font-size: 15px;
  line-height: 22px;
  cursor: pointer;
  margin: 0 0 20px;
}

.ap-check input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--light-purple-color);
  cursor: pointer;
}

.ap-check a {
  color: var(--light-purple-color);
}

.ap-captcha {
  min-height: 102px;
  margin-bottom: 20px;
}

.ap-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 16px;
  line-height: 22px;
}

.ap-alert i {
  margin-top: 3px;
}

.ap-alert.error {
  background: #ffecec;
  color: #c62828;
}

.ap-alert.success {
  background: #e8f8ee;
  color: #1e8a4c;
}

.ap-alert.info {
  background: #f3eeff;
  color: var(--light-purple-color);
}

.ap-alert.warn {
  background: #fff4e3;
  color: #b26a00;
}

.ap-submit {
  width: 100%;
  min-height: 56px;
}

.ap-alt {
  margin-top: 22px;
  text-align: center;
  color: var(--text-color);
  font-size: 16px;
}

.ap-alt a {
  color: var(--light-purple-color);
  font-weight: 600;
}

.ap-alt a:hover {
  color: var(--accent);
}

.ap-link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--light-purple-color);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ap-link-btn:hover:not(:disabled) {
  color: var(--accent);
}

.ap-link-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ap-panel .ap-recover-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 4px 0 24px;
  padding: 24px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, #f7f4ff 0%, #eef4ff 100%);
  border: 1px solid #e4ddff;
  text-align: center;
}

.ap-panel .ap-recover-avatar-wrap {
  width: 112px;
  height: 112px;
  max-width: 112px;
  max-height: 112px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 112px;
  box-shadow: 0 10px 28px rgba(79, 33, 184, 0.18);
  background: #fff;
  border: 4px solid #fff;
}

.ap-panel .ap-recover-avatar-wrap img,
.ap-panel .ap-recover-avatar {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 50%;
}

.ap-panel .ap-recover-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary-color);
  line-height: 1.3;
  text-align: center;
}

.ap-recover-actions {
  display: grid;
  gap: 12px;
}

.ap-recover-actions .pf-btn {
  width: 100%;
  min-height: 52px;
}

.ap-recover-actions .pf-btn.outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #fff;
  color: var(--light-purple-color) !important;
  border: 2px solid #d9cdff;
  box-shadow: none;
}

.ap-recover-actions .pf-btn.outline:hover {
  background: var(--light-purple-color);
  color: #fff !important;
  border-color: var(--light-purple-color);
}

/* ---------- Простая карточка-заглушка ---------- */

.ap-notice {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 0 85px 0 #e9eefc;
  padding: 50px 44px;
  text-align: center;
}

.ap-notice-icon {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  margin: 0 auto 22px;
  background: #f3eeff;
  color: var(--light-purple-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.ap-notice-icon.orange {
  background: #fff4e3;
  color: var(--accent);
}

.ap-notice-icon.green {
  background: #e8f8ee;
  color: #24a35a;
}

.ap-notice-icon.red {
  background: #ffecec;
  color: #fe3434;
}

.ap-notice h3 {
  color: var(--primary-color);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ap-notice p {
  color: var(--text-color);
  font-size: 17px;
  line-height: 26px;
  margin-bottom: 24px;
}

.ap-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ---------- Вступление перед тестом ---------- */

.ap-start {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 30px;
  align-items: start;
}

.ap-card {
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 0 85px 0 #e9eefc;
  overflow: hidden;
}

.ap-cover {
  position: relative;
  aspect-ratio: 7 / 3;
  background: #211e39;
}

.ap-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ap-cover-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 60px 32px 24px;
  background: linear-gradient(transparent, rgba(7, 0, 59, 0.85));
  color: #fff;
}

.ap-cover-title span {
  display: block;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ap-cover-title h2 {
  color: #fff;
  font-size: 34px;
  line-height: 40px;
  font-weight: 700;
  margin: 0;
}

.ap-card-body {
  padding: 30px 32px 32px;
}

.ap-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.ap-fact {
  background: #f8f7ff;
  border-radius: 18px;
  padding: 16px 18px;
}

.ap-fact-value {
  color: var(--light-purple-color);
  font-size: 26px;
  font-weight: 700;
  line-height: 30px;
}

.ap-fact-label {
  color: var(--text-color);
  font-size: 14px;
  line-height: 19px;
  margin-top: 4px;
}

.ap-rules-title {
  color: var(--primary-color);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.ap-rules {
  display: grid;
  gap: 14px;
}

.ap-rule {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: var(--text-color);
  font-size: 16px;
  line-height: 24px;
}

.ap-rule b {
  display: block;
  color: var(--primary-color);
  font-size: 17px;
  font-weight: 600;
}

.ap-rule-icon {
  flex: 0 0 42px;
  height: 42px;
  border-radius: 14px;
  background: #f3eeff;
  color: var(--light-purple-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.ap-gate {
  position: sticky;
  top: 120px;
  padding: 34px 32px;
  text-align: center;
}

.ap-gate .ap-notice-icon {
  margin-bottom: 18px;
}

.ap-gate h3 {
  color: var(--primary-color);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ap-gate p {
  color: var(--text-color);
  font-size: 16px;
  line-height: 24px;
  margin-bottom: 22px;
}

.ap-gate .pf-btn + .pf-btn {
  margin-top: 12px;
}

.ap-gate-note {
  margin-top: 16px;
  color: var(--text-color);
  font-size: 14px;
  line-height: 20px;
}

/* ---------- Тест ---------- */

.ap-quiz {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 30px;
  align-items: start;
}

.ap-quiz-main {
  min-width: 0;
}

.ap-quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ap-quiz-step {
  color: var(--primary-color);
  font-size: 18px;
  font-weight: 700;
}

.ap-quiz-step span {
  color: var(--text-color);
  font-weight: 400;
}

.ap-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f3eeff;
  color: var(--light-purple-color);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 14px;
  font-weight: 600;
}

.ap-type.code {
  background: #1e1e2e;
  color: #c8b8ff;
}

.ap-type.text {
  background: #fff4e3;
  color: #b26a00;
}

.ap-type.multi {
  background: #e8f7ef;
  color: #1f7a4d;
}

.ap-multi-hint {
  margin: 0 0 4px;
  color: var(--text-color);
  font-size: 14px;
  line-height: 20px;
}

.ap-option.multi .ap-option-letter {
  border-radius: 10px;
}

.ap-option.multi.selected .ap-option-check {
  color: #1f7a4d;
}

.ap-progress {
  height: 8px;
  border-radius: 8px;
  background: #eeeaff;
  overflow: hidden;
  margin-bottom: 24px;
}

.ap-progress > div {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--light-purple-color), #9d6bff);
  transition: width 0.3s;
}

.ap-question-card {
  padding: 34px 36px 32px;
}

.ap-question {
  color: var(--secondary-color);
  font-size: 20px;
  line-height: 31px;
  margin-bottom: 26px;
}

.ap-options {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.ap-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: #fbfaff;
  border: 2px solid #ece8fb;
  border-radius: 20px;
  padding: 14px 18px;
  color: var(--secondary-color);
  font-family: "Jost", sans-serif;
  font-size: 17px;
  line-height: 25px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.ap-option:hover {
  border-color: #c9b6ff;
  background: #fff;
}

.ap-option:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(111, 52, 254, 0.15);
}

.ap-option.selected {
  border-color: var(--light-purple-color);
  background: #f5f0ff;
}

.ap-option-letter {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2dbfb;
  color: var(--light-purple-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}

.ap-option.selected .ap-option-letter {
  background: var(--light-purple-color);
  border-color: var(--light-purple-color);
  color: #fff;
}

.ap-option-text {
  flex: 1;
  min-width: 0;
}

.ap-option-check {
  color: var(--light-purple-color);
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}

.ap-option.selected .ap-option-check {
  opacity: 1;
}

.ap-text-answer {
  position: relative;
  margin-bottom: 8px;
}

.ap-text-answer .ap-input {
  height: 60px;
  font-size: 18px;
  padding-left: 52px;
}

.ap-text-answer .ap-icon {
  left: 22px;
}

.ap-code-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.ap-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2dbfb;
  background: #fff;
  color: var(--light-purple-color);
  border-radius: 22px;
  padding: 9px 18px;
  font-family: "Jost", sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.ap-tool:hover:not(:disabled) {
  background: var(--light-purple-color);
  border-color: var(--light-purple-color);
  color: #fff;
}

.ap-tool:disabled {
  opacity: 0.55;
  cursor: default;
}

.ap-quiz-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid #f0edfb;
}

.ap-quiz-nav .spacer {
  flex: 1;
}

.ap-saved {
  color: #9b95ad;
  font-size: 14px;
}

.ap-saved i {
  color: #24a35a;
  margin-right: 4px;
}

.ap-map {
  position: sticky;
  top: 120px;
  padding: 26px 24px;
}

.ap-map-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--primary-color);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.ap-map-title span {
  color: var(--text-color);
  font-size: 15px;
  font-weight: 400;
}

.ap-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-color);
  font-size: 13px;
  margin-bottom: 16px;
}

.ap-map-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: 0;
}

.ap-map-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.ap-dot {
  aspect-ratio: 1;
  border: 1px solid #e6e0fb;
  border-radius: 12px;
  background: #fff;
  color: var(--text-color);
  font-family: "Jost", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.ap-dot:hover {
  border-color: var(--light-purple-color);
}

.ap-dot.answered {
  background: #efe8ff;
  border-color: #efe8ff;
  color: var(--light-purple-color);
}

.ap-dot.current {
  background: var(--light-purple-color);
  border-color: var(--light-purple-color);
  color: #fff;
}

.ap-dot.missing {
  border-color: #e53935;
  color: #e53935;
}

/* ---------- Окно подтверждения ---------- */

.ap-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 0, 59, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ap-modal {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 28px;
  padding: 34px 30px 28px;
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(7, 0, 59, 0.5);
}

.ap-modal h3 {
  color: var(--primary-color);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ap-modal p {
  color: var(--text-color);
  font-size: 16px;
  line-height: 24px;
  margin-bottom: 22px;
}

/* ---------- Результат ---------- */

.ap-result {
  max-width: 880px;
  margin: 0 auto;
}

.ap-result-body {
  padding: 34px 40px 38px;
  text-align: center;
}

.ap-result-body h3 {
  color: var(--primary-color);
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ap-result-body > p {
  color: var(--text-color);
  font-size: 17px;
  line-height: 26px;
  max-width: 560px;
  margin: 0 auto 26px;
}

.ap-result-score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.ap-result-score .pf-ring {
  flex-basis: 170px;
  width: 170px;
  height: 170px;
}

.ap-result-score .pf-ring-inner {
  width: 136px;
  height: 136px;
}

.ap-result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
  text-align: left;
}

.ap-loading {
  text-align: center;
  color: var(--text-color);
  font-size: 18px;
  padding: 60px 0;
}

.ap-loading i {
  display: block;
  font-size: 34px;
  color: var(--light-purple-color);
  margin-bottom: 14px;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1199px) {
  .ap-quiz {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .ap-map-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 991px) {
  .ap-section {
    padding-top: 30px;
    padding-bottom: 70px;
  }

  .ap-auth,
  .ap-auth.narrow {
    grid-template-columns: 1fr;
  }

  .ap-side {
    padding: 32px 30px;
  }

  .ap-side-list {
    margin: 20px 0;
  }

  .ap-side-logo {
    display: none;
  }

  .ap-start {
    grid-template-columns: 1fr;
  }

  .ap-gate,
  .ap-map {
    position: static;
  }

  .ap-quiz {
    grid-template-columns: 1fr;
  }

  .ap-map {
    order: -1;
    padding: 18px 18px 16px;
  }

  .ap-map-grid {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 0;
    scrollbar-width: thin;
  }

  .ap-dot {
    flex: 0 0 40px;
    height: 40px;
    aspect-ratio: auto;
  }

  .ap-map .ap-map-finish {
    display: none;
  }
}

@media (max-width: 767px) {
  .ap-panel {
    padding: 30px 22px 28px;
  }

  .ap-panel-title {
    font-size: 26px;
    line-height: 32px;
  }

  .ap-grid,
  .ap-grid.three {
    grid-template-columns: 1fr;
  }

  .ap-facts {
    gap: 8px;
  }

  .ap-fact {
    padding: 12px;
    border-radius: 14px;
  }

  .ap-fact-value {
    font-size: 22px;
    line-height: 26px;
  }

  .ap-fact-label {
    font-size: 13px;
    line-height: 17px;
  }

  .ap-cover-title {
    padding: 40px 20px 16px;
  }

  .ap-cover-title h2 {
    font-size: 24px;
    line-height: 30px;
  }

  .ap-card-body {
    padding: 24px 20px 26px;
  }

  .ap-question-card {
    padding: 24px 18px 22px;
  }

  .ap-question {
    font-size: 18px;
    line-height: 28px;
  }

  .ap-option {
    padding: 12px 14px;
    gap: 12px;
    font-size: 16px;
  }

  .ap-option-letter {
    flex-basis: 34px;
    height: 34px;
  }

  .ap-quiz-nav {
    flex-wrap: wrap;
  }

  .ap-quiz-nav .pf-btn {
    flex: 1 1 140px;
  }

  .ap-quiz-nav .spacer {
    display: none;
  }

  .ap-saved {
    order: 5;
    width: 100%;
    text-align: center;
  }

  .ap-notice {
    padding: 36px 22px;
    border-radius: 24px;
  }

  .ap-result-body {
    padding: 26px 20px 30px;
  }

  .ap-result-stats {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .ap-result-stats .pf-stat-value {
    font-size: 18px;
    white-space: nowrap;
  }

  .ap-gate {
    padding: 28px 22px;
  }
}

@media (max-width: 575px) {
  .ap-side {
    padding: 26px 22px;
  }

  .ap-side h3 {
    font-size: 24px;
    line-height: 30px;
  }

  .ap-side-list {
    gap: 12px;
  }

  .pf-stat-value {
    font-size: 17px;
  }
}

/* ---------- Cookie bar + footer contact + policy ---------- */

.site-cookie-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid rgba(77, 25, 204, 0.14);
  border-radius: 18px;
  box-shadow: 0 18px 50px -18px rgba(7, 0, 59, 0.45);
}

.site-cookie-bar p {
  margin: 0;
  flex: 1 1 260px;
  color: #3d2f7a;
  font-size: 14px;
  line-height: 1.45;
}

.site-cookie-bar a {
  color: #4d19cc;
  font-weight: 600;
  text-decoration: underline;
}

.site-cookie-bar .pf-btn.small {
  padding: 10px 18px;
  font-size: 14px;
  white-space: nowrap;
}

.site-footer-contact {
  position: relative;
  margin: -68px 0 36px;
  padding: 28px 0 32px;
  border: none;
  background: transparent;
  background-image: none;
}

.site-footer-contact-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 22px 36px;
  text-align: left;
  padding: 22px 28px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(77, 25, 204, 0.28) 0%, rgba(63, 57, 109, 0.55) 55%, rgba(37, 99, 235, 0.18) 100%);
  border: 1px solid rgba(252, 166, 31, 0.28);
  box-shadow: 0 16px 40px -24px rgba(0, 0, 0, 0.55);
}

.site-footer-contact-btn {
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 36px;
  padding: 14px 30px;
  background: var(--accent);
  color: #fff;
  font-family: "Jost", sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.3s ease-out, background 0.3s;
}

.site-footer-contact-btn:hover {
  background: var(--light-purple-color, #6d28d9);
  transform: translateY(-3px);
}

.site-footer-contact-text {
  margin: 0;
  flex: 1 1 280px;
  max-width: 620px;
  color: #f3efff;
  font-family: "Jost", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.site-footer-contact-text a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.site-footer-contact-text a:hover {
  text-decoration: underline;
  color: #ffc45c;
}

@media (max-width: 767px) {
  .site-footer-contact {
    margin-top: -40px;
    padding: 22px 0 24px;
  }

  .site-footer-contact-inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 20px 18px;
  }

  .site-footer-contact-text {
    font-size: 15px;
  }
}

.site-contact-modal {
  max-width: 520px;
  text-align: left;
}

.site-contact-lead {
  margin-bottom: 18px !important;
}

.site-contact-form {
  display: grid;
  gap: 12px;
}

.site-contact-form label {
  display: grid;
  gap: 6px;
  text-align: left;
}

.site-contact-form label span {
  font-size: 13px;
  font-weight: 600;
  color: #4b3b8c;
}

.site-contact-form input,
.site-contact-form select,
.site-contact-form textarea {
  width: 100%;
  border: 1px solid #d9d2f5;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  color: #1e1b4b;
  background: #fff;
}

.site-contact-form input:disabled {
  background: #f5f3ff;
  color: #5b4b9a;
}

.site-contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.site-contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.site-contact-error {
  margin: 0;
  color: #c62828;
  font-size: 14px;
}

.site-contact-ok {
  margin: 0;
  color: #1b7a3d;
  font-size: 14px;
}

.site-contact-done {
  text-align: center;
  padding: 8px 4px 0;
}

.site-contact-done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e8f8f0;
  color: #1b7a3d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.site-contact-done .site-contact-actions {
  justify-content: center;
}

.policy-page .generic-title {
  margin-bottom: 28px;
}

.policy-layout {
  display: grid;
  gap: 28px;
  align-items: start;
}

@media (min-width: 992px) {
  .policy-layout {
    grid-template-columns: 260px 1fr;
  }
}

.policy-toc {
  position: sticky;
  top: 90px;
  padding: 18px 18px 14px;
  border-radius: 18px;
  background: #f7f4ff;
  border: 1px solid rgba(77, 25, 204, 0.1);
}

.policy-toc-title {
  margin: 0 0 10px;
  font-weight: 700;
  color: #4d19cc;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.policy-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.policy-toc li {
  margin: 0 0 8px;
}

.policy-toc li.nested {
  padding-left: 12px;
}

.policy-toc a {
  color: #3d2f7a;
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.policy-toc a:hover {
  color: #4d19cc;
  text-decoration: underline;
}

.policy-body {
  background: #fff;
  border-radius: 22px;
  padding: 28px 30px;
  border: 1px solid rgba(77, 25, 204, 0.08);
  box-shadow: 0 12px 40px -24px rgba(7, 0, 59, 0.35);
}

.policy-body h2,
.policy-body h3,
.policy-body h4 {
  color: #4d19cc;
  scroll-margin-top: 100px;
}

.policy-body h2 {
  font-size: 24px;
  margin: 28px 0 12px;
}

.policy-body h2:first-child {
  margin-top: 0;
}

.policy-body p,
.policy-body li {
  color: #3d2f7a;
  font-size: 16px;
  line-height: 1.65;
}

.ap-school-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fff;
  border: 1px solid #e6e0fb;
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(80, 50, 160, 0.16);
  max-height: 280px;
  overflow: auto;
}

.ap-school-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--primary-color);
  font-family: "Jost", sans-serif;
  font-size: 16px;
  line-height: 1.3;
  cursor: pointer;
}

.ap-school-option.active {
  background: #6f34fe;
  color: #fff;
}

.ap-school-option.add {
  color: #6f34fe;
  font-weight: 600;
}

.ap-school-option.add.active {
  color: #fff;
}

.ap-school-empty {
  padding: 12px 14px;
  color: #8d86a8;
  font-size: 15px;
}

.phone-fix {
  margin: 12px 0 16px;
}

.phone-fix-form {
  margin-top: 12px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: #fbfaff;
  border: 1px solid #e6e0fb;
}

.phone-fix-form p {
  margin: 0 0 10px;
}

.phone-fix-input {
  padding-left: 20px;
  margin-bottom: 10px;
}

.phone-fix .pf-msg {
  margin: 8px 0;
}
