/* =================================================================
   Test pages — show / take / result
   ================================================================= */

/* ---- shared ---- */
.jb-test-page .jb-section__title { letter-spacing: -.02em; }
.jb-test-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  min-height: 52px;
  font-weight: 700;
  letter-spacing: .01em;
}
.jb-test-cta .material-symbols-rounded { font-size: 20px; }
.jb-test-cta.is-loading { opacity: .7; cursor: progress; }

/* ---- show (intro screen) ---- */
.jb-test-hero__main { position: relative; overflow: hidden; }
.jb-test-hero__main::after {
  content: '';
  position: absolute;
  right: -120px;
  top: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%);
  pointer-events: none;
}
.jb-test-hero__eyebrow {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.jb-test-hero__eyebrow .material-symbols-rounded { font-size: 16px; }
.jb-test-hero__aside .jb-keyfacts__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.jb-test-hero__aside .jb-keyfacts__label .material-symbols-rounded {
  font-size: 18px;
  color: var(--jb-primary);
}
.jb-test-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.jb-test-recap-section { padding-top: 0 !important; }
.jb-test-recap {
  position: relative;
  border: 1px solid var(--jb-border);
  background: var(--jb-surface);
  border-radius: 24px;
  padding: 28px;
  display: grid;
  gap: 22px;
  overflow: hidden;
}
.jb-test-recap::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--jb-primary);
}
.jb-test-recap[data-attempt-status="passed"]::before { background: #22c55e; }
.jb-test-recap[data-attempt-status="failed"]::before { background: #ef4444; }
.jb-test-recap[data-attempt-status="pending"]::before { background: #f59e0b; }

.jb-test-recap__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.jb-test-recap__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
}
.jb-test-recap__badge .material-symbols-rounded { font-size: 18px; }
.jb-test-recap__badge--passed { background: rgba(34,197,94,.14); color: #166534; }
.jb-test-recap__badge--failed { background: rgba(239,68,68,.14); color: #991b1b; }
.jb-test-recap__badge--pending { background: rgba(245,158,11,.14); color: #92400e; }
[data-theme='dark'] .jb-test-recap__badge--passed { color: #86efac; }
[data-theme='dark'] .jb-test-recap__badge--failed { color: #fca5a5; }
[data-theme='dark'] .jb-test-recap__badge--pending { color: #fcd34d; }

.jb-test-recap__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}
.jb-test-recap__stat {
  padding: 16px;
  border-radius: 16px;
  background: var(--jb-surface-soft);
  border: 1px solid var(--jb-border);
  display: grid;
  gap: 4px;
}
.jb-test-recap__score {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--jb-text);
}
.jb-test-recap__score span { font-size: 1.1rem; opacity: .55; font-weight: 700; }

/* ---- take (test in progress) ---- */
.jb-test-page--take main { padding-top: 0 !important; }
.jb-test-take { position: relative; }

.jb-test-timer {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--jb-surface) 92%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--jb-border);
  padding: 14px 0;
  transition: background .3s ease, border-color .3s ease;
}
.jb-test-timer.is-time-critical {
  background: color-mix(in srgb, #ef4444 18%, var(--jb-surface));
  border-color: rgba(239,68,68,.4);
}
.jb-test-timer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 24px;
}
.jb-test-timer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.jb-test-timer__brand > .material-symbols-rounded {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 59, 59, .12);
  color: var(--jb-primary);
}
.jb-test-timer__eyebrow {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--jb-text-rgb);
  opacity: .65;
}
.jb-test-timer__title {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.jb-test-timer__progress { display: grid; gap: 6px; }
.jb-test-timer__progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  opacity: .8;
}
.jb-test-progressbar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--jb-surface-soft);
  border: 1px solid var(--jb-border);
}
.jb-test-progressbar__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--jb-primary), color-mix(in srgb, var(--jb-primary) 60%, #ff9999));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}

.jb-test-timer__clocks { display: flex; gap: 14px; }
.jb-test-clock {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--jb-surface-soft);
  border: 1px solid var(--jb-border);
  transition: background .3s ease, color .3s ease, border-color .3s ease;
}
.jb-test-clock .material-symbols-rounded { font-size: 20px; color: var(--jb-primary); }
.jb-test-clock__label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .7;
}
.jb-test-clock strong { font-variant-numeric: tabular-nums; }
.jb-test-clock.is-warning {
  background: rgba(245,158,11,.14);
  border-color: rgba(245,158,11,.35);
}
.jb-test-clock.is-warning .material-symbols-rounded { color: #f59e0b; }
.jb-test-clock.is-critical {
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.4);
  animation: jb-test-pulse 1.1s ease-in-out infinite;
}
.jb-test-clock.is-critical .material-symbols-rounded { color: #ef4444; }

@keyframes jb-test-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.jb-test-take__section { padding-top: 32px !important; }
.jb-test-form {
  display: grid;
  gap: 18px;
}

.jb-test-question {
  border-radius: 22px;
  padding: 26px clamp(20px, 3vw, 32px);
  background: var(--jb-surface);
  border: 1px solid var(--jb-border);
  box-shadow: var(--jb-shadow-soft);
  display: grid;
  gap: 18px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.jb-test-question:focus-within {
  border-color: color-mix(in srgb, var(--jb-primary) 45%, var(--jb-border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--jb-primary) 12%, transparent);
}

.jb-test-question__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: flex-start;
}
.jb-test-question__index {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--jb-primary), color-mix(in srgb, var(--jb-primary) 65%, #ff7676));
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.jb-test-question__counter {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .65;
  font-weight: 600;
}
.jb-test-question__title {
  margin: 0;
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.4;
}
.jb-test-question__required {
  color: var(--jb-primary);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
}
.jb-test-question__body { display: grid; gap: 10px; }

/* Choices (radio / checkbox styled as cards) */
.jb-test-choices { display: grid; gap: 10px; }
.jb-test-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--jb-border);
  background: var(--jb-surface-soft);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.jb-test-choice:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--jb-primary) 35%, var(--jb-border));
}
.jb-test-choice input { position: absolute; opacity: 0; pointer-events: none; }
.jb-test-choice__marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--jb-border);
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  transition: border-color .2s ease, background .2s ease;
}
.jb-test-choice__marker::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jb-primary);
  transform: scale(0);
  transition: transform .2s ease;
}
.jb-test-choice--check .jb-test-choice__marker { border-radius: 6px; }
.jb-test-choice--check .jb-test-choice__marker::after { border-radius: 3px; }
.jb-test-choice input:checked + .jb-test-choice__marker {
  border-color: var(--jb-primary);
  background: color-mix(in srgb, var(--jb-primary) 8%, transparent);
}
.jb-test-choice input:checked + .jb-test-choice__marker::after { transform: scale(1); }
.jb-test-choice input:checked ~ .jb-test-choice__label { font-weight: 600; }
.jb-test-choice:has(input:checked) {
  border-color: color-mix(in srgb, var(--jb-primary) 55%, transparent);
  background: color-mix(in srgb, var(--jb-primary) 6%, var(--jb-surface));
}
.jb-test-choice__label { line-height: 1.4; flex: 1; }
.jb-test-choice--single { padding: 16px 20px; }

.jb-test-instructions {
  display: grid;
  gap: 10px;
  margin: 18px 0 4px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--jb-primary) 22%, var(--jb-border));
  background: color-mix(in srgb, var(--jb-primary) 5%, var(--jb-surface));
}
.jb-test-instructions__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--jb-text);
}
.jb-test-instructions__title .material-symbols-rounded { color: var(--jb-primary); }
.jb-test-instructions__body { color: var(--jb-text-muted); line-height: 1.6; }

.jb-test-submit {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  padding: 26px clamp(20px, 3vw, 32px);
  border-radius: 22px;
  background: var(--jb-surface);
  border: 1px solid var(--jb-border);
  box-shadow: var(--jb-shadow-soft);
  margin-top: 8px;
}

/* ---- result (score + review) ---- */
.jb-test-result-hero { padding-top: 40px !important; }
.jb-test-result-card {
  border-radius: 28px;
  border: 1px solid var(--jb-border);
  background: var(--jb-surface);
  padding: clamp(24px, 3vw, 40px);
  display: grid;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.jb-test-result-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--jb-primary);
}
.jb-test-result-hero[data-result-status="passed"] .jb-test-result-card::before { background: #22c55e; }
.jb-test-result-hero[data-result-status="failed"] .jb-test-result-card::before { background: #ef4444; }
.jb-test-result-hero[data-result-status="pending"] .jb-test-result-card::before { background: #f59e0b; }

.jb-test-result-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}
.jb-test-result-card__verdict {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
}
.jb-test-result-card__verdict .material-symbols-rounded { font-size: 22px; }
.jb-test-result-card__verdict--passed { background: rgba(34,197,94,.16); color: #166534; }
.jb-test-result-card__verdict--failed { background: rgba(239,68,68,.16); color: #991b1b; }
.jb-test-result-card__verdict--pending { background: rgba(245,158,11,.16); color: #92400e; }
[data-theme='dark'] .jb-test-result-card__verdict--passed { color: #86efac; }
[data-theme='dark'] .jb-test-result-card__verdict--failed { color: #fca5a5; }
[data-theme='dark'] .jb-test-result-card__verdict--pending { color: #fcd34d; }

.jb-test-score {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}

.jb-test-score__ring {
  position: relative;
  width: 180px;
  height: 180px;
}
.jb-test-score__ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.jb-test-score__track {
  fill: none;
  stroke: var(--jb-border);
  stroke-width: 10;
}
.jb-test-score__progress {
  fill: none;
  stroke: var(--jb-primary);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1);
}
.jb-test-result-hero[data-result-status="passed"] .jb-test-score__progress { stroke: #22c55e; }
.jb-test-result-hero[data-result-status="failed"] .jb-test-score__progress { stroke: #ef4444; }
.jb-test-result-hero[data-result-status="pending"] .jb-test-score__progress { stroke: #f59e0b; }

.jb-test-score__value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  line-height: 1;
}
.jb-test-score__value strong {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
}
.jb-test-score__value strong span {
  font-size: 1rem;
  font-weight: 700;
  opacity: .55;
  letter-spacing: 0;
}
.jb-test-score__value .jb-job-copy {
  margin: 0;
  font-size: .85rem;
  line-height: 1.2;
}

.jb-test-score__details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.jb-test-score__detail {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--jb-surface-soft);
  border: 1px solid var(--jb-border);
  display: grid;
  gap: 4px;
}
.jb-test-score__detail .jb-keyfacts__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.jb-test-score__detail .material-symbols-rounded {
  font-size: 18px;
  color: var(--jb-primary);
}

.jb-test-result-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  margin: 0;
  font-weight: 600;
}
.jb-test-result-message .material-symbols-rounded { font-size: 22px; }
.jb-test-result-message--passed { background: rgba(34,197,94,.12); color: #166534; }
.jb-test-result-message--failed { background: rgba(239,68,68,.12); color: #991b1b; }
.jb-test-result-message--pending { background: rgba(245,158,11,.12); color: #92400e; }
[data-theme='dark'] .jb-test-result-message--passed { color: #86efac; }
[data-theme='dark'] .jb-test-result-message--failed { color: #fca5a5; }
[data-theme='dark'] .jb-test-result-message--pending { color: #fcd34d; }

.jb-test-result-actions { margin: 0; }

/* Review section */
.jb-test-review-section { padding-top: 0 !important; }
.jb-test-review {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.jb-test-review__item {
  padding: 22px 24px;
  border-radius: 18px;
  background: var(--jb-surface);
  border: 1px solid var(--jb-border);
  display: grid;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.jb-test-review__item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--jb-border);
}
.jb-test-review__item--correct::before { background: #22c55e; }
.jb-test-review__item--incorrect::before { background: #ef4444; }
.jb-test-review__item--neutral::before { background: #f59e0b; }

.jb-test-review__head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.jb-test-review__index {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--jb-surface-soft);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.jb-test-review__title { margin: 0; font-size: 1.05rem; flex: 1; }
.jb-test-review__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.jb-test-review__tag .material-symbols-rounded { font-size: 16px; }
.jb-test-review__tag--bad { background: rgba(239,68,68,.14); color: #991b1b; }
[data-theme='dark'] .jb-test-review__tag--bad { color: #fca5a5; }

.jb-test-review__body { display: grid; gap: 8px; }
.jb-test-review__answer {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--jb-surface-soft);
  border: 1px dashed var(--jb-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Responsive */
@media (max-width: 880px) {
  .jb-test-timer__inner {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .jb-test-timer__title { max-width: none; }
  .jb-test-timer__clocks { justify-content: flex-start; flex-wrap: wrap; }
  .jb-test-score { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .jb-test-score__details { width: 100%; }
}

@media (max-width: 600px) {
  .jb-test-question__head { grid-template-columns: auto 1fr; }
  .jb-test-question__required { grid-column: 2; justify-self: flex-end; margin-top: -36px; }
  .jb-test-result-card__head { flex-direction: column; align-items: flex-start; }
  .jb-test-result-card__verdict { width: 100%; justify-content: center; }
}

/* ---- application page: permanent test access cards ---- */
.jb-test-access-panel {
  display: grid;
  gap: 22px;
}
.jb-test-access__head {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}
.jb-test-access__head .jb-section__title { margin: 0; }
.jb-test-access__head .jb-job-copy {
  margin: 0;
  opacity: .8;
}
.jb-test-access__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.jb-test-access__card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--jb-border);
  background: var(--jb-surface);
  box-shadow: var(--jb-shadow-soft);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.jb-test-access__card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--jb-primary) 35%, var(--jb-border));
}
.jb-test-access__card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--jb-border);
}
.jb-test-access__card[data-test-card-status="passed"]::before { background: #22c55e; }
.jb-test-access__card[data-test-card-status="failed"]::before { background: #ef4444; }
.jb-test-access__card[data-test-card-status="in_progress"]::before { background: #3b82f6; }
.jb-test-access__card[data-test-card-status="pending"]::before { background: #f59e0b; }
.jb-test-access__card[data-test-card-status="todo"]::before { background: var(--jb-primary); }

.jb-test-access__card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.jb-test-access__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--jb-primary) 12%, transparent);
  color: var(--jb-primary);
}
.jb-test-access__step-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.jb-test-access__verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.jb-test-access__verdict .material-symbols-rounded { font-size: 16px; }
.jb-test-access__verdict--passed { background: rgba(34,197,94,.14); color: #166534; }
.jb-test-access__verdict--failed { background: rgba(239,68,68,.14); color: #991b1b; }
.jb-test-access__verdict--in_progress { background: rgba(59,130,246,.14); color: #1e40af; }
.jb-test-access__verdict--pending { background: rgba(245,158,11,.14); color: #92400e; }
[data-theme='dark'] .jb-test-access__verdict--passed { color: #86efac; }
[data-theme='dark'] .jb-test-access__verdict--failed { color: #fca5a5; }
[data-theme='dark'] .jb-test-access__verdict--in_progress { color: #93c5fd; }
[data-theme='dark'] .jb-test-access__verdict--pending { color: #fcd34d; }

.jb-test-access__score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--jb-surface-soft);
  border: 1px solid var(--jb-border);
}
.jb-test-access__score strong {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.jb-test-access__score .jb-keyfacts__label { flex: none; }
.jb-test-access__score .jb-job-copy { margin: 0; font-size: .85rem; }

.jb-test-access__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}
.jb-test-access__actions .jb-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.jb-test-access__actions .jb-section__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.jb-test-access__actions .jb-section__link .material-symbols-rounded { font-size: 16px; }

.jb-test-access__card .jb-job-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: .9rem;
  opacity: .85;
}
.jb-test-access__card .jb-job-copy .material-symbols-rounded { font-size: 18px; opacity: .7; }
