/* =========================================================================
   Student portal — landing, quiz and result screens.
   ========================================================================= */

/* ------------------------------------------------------------ chrome */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  /* Opaque first: older browsers without backdrop-filter still need the bar
     to hide the content scrolling beneath it. */
  background: var(--bg);
  background: rgb(10 11 10 / 82%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

/* Sub-navigation across result / review / leaderboard. Sits inside the header
   so the three pages read as one place rather than three destinations. */
.subnav {
  border-top: 1px solid var(--line);
}

.site-footer {
  padding-block: 28px;
  border-top: 1px solid var(--line);
  margin-top: 64px;
  font-size: 13.5px;
}

.page-intro {
  margin-bottom: 20px;
}

.page-intro__title {
  font-size: clamp(24px, 4vw, 31px);
  margin-bottom: 4px;
}

/* Landing-page pointer to the leaderboard, shown only when it is switched on. */
.board-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 600;
}

.section-sub {
  margin-bottom: 18px;
  font-size: 14px;
}

/* ----------------------------------------------------------- landing */

.landing {
  padding-block: clamp(40px, 7vw, 76px);
}

.landing__intro {
  max-width: 640px;
}

.landing__title {
  margin-top: 12px;
  font-size: clamp(38px, 7vw, 60px);
  letter-spacing: -0.035em;
}

.landing__lede {
  margin-top: 16px;
  color: var(--ink-2);
  font-size: clamp(16px, 2vw, 18.5px);
}

.facts {
  display: grid;
  padding: 0;
  margin-top: 32px;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--line);
  list-style: none;
  overflow: hidden;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: var(--surface);
}

.fact__value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.fact__label {
  color: var(--ink-3);
  font-size: 13px;
}

.landing__grid {
  display: grid;
  gap: 24px;
  margin-top: 44px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 900px) {
  .landing__grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.rules__list {
  padding-left: 20px;
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.rules__list li {
  padding-left: 4px;
  margin-top: 9px;
}

.rules__list strong {
  color: var(--ink);
  font-weight: 600;
}

.rules__note {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--accent-soft);
  margin-top: 20px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.start-card__hint {
  margin-bottom: 20px;
  font-size: 14px;
}

.start-form {
  display: grid;
  gap: 16px;
}

.start-form__row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.start-form__legal {
  font-size: 12.5px;
  text-align: center;
}

.form-error {
  padding: 10px 13px;
  border: 1px solid var(--danger);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
}

/* -------------------------------------------------------------- quiz */

.page-test {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.quiz {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.quiz__bar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  /* Opaque first: color-mix() only landed in Safari 16.2 / Firefox 113, and
     without this the sticky timer bar renders transparent over the scrolling
     question on an older phone. */
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.quiz__bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}

.quiz__identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.quiz__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.quiz__stage {
  color: var(--ink-3);
  font-size: 12.5px;
}

.quiz__meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.quiz__counter {
  font-size: 14px;
  white-space: nowrap;
}

.quiz__counter strong {
  font-weight: 600;
}

/* Timer: an SVG ring that drains, with the seconds in the middle. */
.timer {
  position: relative;
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  line-height: 1;
}

.timer__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer__track,
.timer__progress {
  fill: none;
  stroke-width: 3.5;
}

.timer__track {
  stroke: var(--line);
}

.timer__progress {
  stroke: var(--accent);
  stroke-dasharray: 119.4;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.3s ease;
}

.timer__value {
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.timer__unit {
  color: var(--ink-3);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timer[data-state="warning"] .timer__progress {
  stroke: var(--warn);
}

.timer[data-state="warning"] .timer__value {
  color: var(--warn);
}

.timer[data-state="critical"] .timer__progress {
  stroke: var(--danger);
}

.timer[data-state="critical"] .timer__value {
  color: var(--danger);
}

.progress {
  height: 3px;
  background: rgb(255 255 255 / 8%);
}

.progress__fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.35s ease;
}

.quiz__main {
  flex: 1;
  padding-block: clamp(32px, 6vw, 60px);
}

.quiz__subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

/* Subject tag on mixed papers — top-right of the question. */
.subject-badge {
  --tint: var(--ink-2);
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--tint) 40%, transparent);
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--tint) 12%, transparent);
  color: var(--tint);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.subject-badge[data-subject="html"] { --tint: #e0a472; }
.subject-badge[data-subject="css"] { --tint: #7fb3e8; }
.subject-badge[data-subject="js"] { --tint: #e5ce7b; }
.subject-badge[data-subject="react"] { --tint: #6fd3e8; }

.quiz__topic {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quiz__question {
  margin-top: 10px;
  font-size: clamp(21px, 3.2vw, 27px);
  letter-spacing: -0.025em;
  /* Receives focus on each new question so screen readers announce it; it is
     not a control, so it draws no ring. */
  outline: none;
}

.quiz__code {
  margin-top: 20px;
}

.quiz__code code {
  font: inherit;
}

.options {
  display: grid;
  padding: 0;
  border: 0;
  gap: 11px;
  margin: 28px 0 0;
}

/* Real radio inputs kept in the DOM for keyboard and screen-reader support. */
.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.option:hover {
  border-color: var(--ink-3);
  background: var(--surface-2);
}

.option__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option__key {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  place-items: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.option__text {
  font-size: 15.5px;
  line-height: 1.5;
}

.option__text code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.option--selected,
.option:has(.option__input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.option--selected .option__key,
.option:has(.option__input:checked) .option__key {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.option:has(.option__input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  margin-top: 28px;
}

.quiz__hint {
  font-size: 13px;
}

.quiz__footnote {
  padding: 0 var(--gutter) 32px;
  font-size: 12.5px;
  text-align: center;
}

@media (max-width: 560px) {
  .quiz__bar-inner {
    flex-wrap: wrap;
  }

  .quiz__meta {
    width: 100%;
    justify-content: space-between;
  }

  .quiz__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .quiz__hint {
    text-align: center;
  }
}

/* ------------------------------------------------------------ loading */

.loading {
  display: grid;
  min-height: 60vh;
  gap: 16px;
  place-content: center;
  justify-items: center;
}

.loading__spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.net-banner {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 100%;
  padding: 9px 16px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13.5px;
  text-align: center;
}

/* ------------------------------------------------------------- result */

.result {
  --flow: 24px;
  padding-block: clamp(36px, 6vw, 64px);
}

.result > * + * {
  margin-top: var(--flow);
}

.score-card {
  text-align: center;
}

.score-card__heading {
  margin-top: 10px;
  font-size: clamp(22px, 3.4vw, 28px);
}

.score-card__figure {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.score-card__score {
  font-size: clamp(52px, 11vw, 76px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-card__of {
  color: var(--ink-3);
  font-size: 0.36em;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.score-card__pct {
  padding: 5px 14px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

/* Pass/fail verdict. Only rendered for a test that defines a pass mark —
   tests without one show a score and a message and no badge at all. */
.verdict {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px auto 0;
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.verdict__note {
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  opacity: 0.8;
}

.verdict--pass {
  border-color: var(--accent-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.verdict--fail {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.score-meter {
  width: min(420px, 100%);
  height: 6px;
  border-radius: var(--r-full);
  background: rgb(255 255 255 / 8%);
  margin: 26px auto 0;
  overflow: hidden;
}

.score-meter__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.score-card__message {
  max-width: 52ch;
  margin: 22px auto 0;
  color: var(--ink-2);
  font-size: 15.5px;
}

.stats {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--line);
  overflow: hidden;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
}

.stat__label {
  color: var(--ink-3);
  font-size: 12.5px;
}

.stat__value {
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.topics {
  display: grid;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.topic {
  display: grid;
  gap: 6px 14px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.topic__name {
  font-size: 14.5px;
  font-weight: 500;
}

.topic__band {
  font-size: 12.5px;
}

.topic__bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: var(--r-full);
  background: rgb(255 255 255 / 8%);
  overflow: hidden;
}

.topic__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.6s ease;
}

.topic--strong .topic__fill {
  background: var(--ok);
}

.topic--good .topic__fill {
  background: var(--warn);
}

.topic--weak .topic__fill {
  background: var(--danger);
}

.locked {
  border-style: dashed;
  background: var(--surface-2);
}

.locked__action {
  margin-top: 16px;
}

/* --------------------------------------------------------- review list */

.review {
  display: grid;
  padding: 0;
  gap: 16px;
  margin-top: 6px;
  list-style: none;
}

.review__item {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.review__item--correct {
  border-left-color: var(--ok);
}

.review__item--wrong {
  border-left-color: var(--danger);
}

.review__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.review__order {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.review__question {
  font-size: 15px;
  font-weight: 500;
}

.review__code {
  margin-top: 12px;
  font-size: 12.5px;
}

.review__answers {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-size: 14px;
}

.review__answers dt {
  color: var(--ink-3);
  font-size: 12.5px;
}

.review__answers dd {
  margin: 0;
}

.review__explanation {
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 14px;
}

.review__explanation code,
.review__answers code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* --------------------------------------------------------- leaderboard */

/* Overall / this-test switch. Hidden when only one view is available. */
.board-switch {
  display: flex;
  gap: 6px;
  margin: 18px 0 10px;
}

.board-switch[hidden] {
  display: none;
}

.board-switch__btn {
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 15px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.board-switch__btn:hover {
  border-color: var(--line-strong, var(--line));
  color: var(--ink-1);
}

.board-switch__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.board-switch__btn[aria-selected='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink, #fff);
}

.board-switch__btn[hidden] {
  display: none;
}

.board-note {
  font-size: 12.5px;
  margin: 0 0 4px;
}

.leaderboard__list {
  display: grid;
  padding: 0;
  gap: 8px;
  margin-top: 14px;
  list-style: none;
  counter-reset: rank;
}

.leader {
  display: grid;
  gap: 12px;
  grid-template-columns: 34px 1fr auto auto;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 14.5px;
}

.leader__rank {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-weight: 600;
}

.leader--top .leader__rank {
  color: var(--accent);
}

.leader__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader__score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.leader__time {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* On a narrow phone the name is what a student is looking for, so the trailing
   detail (time, or how many tests) gives up its column rather than clipping
   "Rahul Sharma" down to "Rahul S…". */
@media (max-width: 420px) {
  .leader {
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    padding: 11px 12px;
  }

  .leader__time {
    display: none;
  }
}

.result__footer {
  font-size: 12.5px;
  text-align: center;
}

/* =====================================================================
   Accounts, catalogue & profile (multi-test platform)
   ===================================================================== */

/* --- header auth area ------------------------------------------------ */

.auth-area {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-chip {
  align-items: center;
  border-radius: var(--r-full);
  color: inherit;
  display: inline-flex;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.auth-chip:hover,
.auth-chip:focus-visible {
  background: var(--surface-sunken);
}

.auth-chip__avatar {
  align-items: center;
  background: var(--accent);
  border-radius: var(--r-full);
  color: var(--accent-ink);
  display: inline-flex;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.auth-chip__avatar--lg {
  font-size: 24px;
  height: 56px;
  width: 56px;
}

.auth-chip__name {
  font-weight: 600;
}

/* --- auth pages ------------------------------------------------------- */

.auth {
  padding-block: clamp(32px, 7vh, 72px);
}

.auth-card {
  margin-inline: auto;
  max-width: 460px;
}

.auth-card__title {
  font-size: 26px;
  margin-top: 4px;
}

.auth-card .start-form {
  margin-top: 20px;
}

.auth-card__alt {
  font-size: 14px;
  margin-top: 18px;
  text-align: center;
}

.auth-card__alt a {
  color: var(--accent);
  font-weight: 600;
}

/* --- access / enrolment state ----------------------------------------- */

.access-card {
  max-width: 520px;
}

.access-card__body {
  line-height: 1.65;
  margin-top: 10px;
}

.access-card__meta {
  background: var(--surface-sunken);
  border-radius: var(--r-md);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 20px;
  padding: 12px 14px;
}

.access-card__meta dt {
  color: var(--ink-3);
  font-size: 13px;
}

.access-card__meta dd {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.access-card__actions {
  margin-top: 22px;
}

/* --- start page identity --------------------------------------------- */

.start-identity {
  align-items: center;
  background: var(--surface-sunken);
  border-radius: var(--r-md);
  display: flex;
  gap: 12px;
  margin-block: 14px 18px;
  padding: 12px 14px;
}

.start-identity .auth-chip__avatar {
  height: 40px;
  width: 40px;
}

.start-identity__name {
  font-weight: 600;
}

.start-identity__email {
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* --- profile ----------------------------------------------------------- */

.profile {
  display: grid;
  gap: 28px;
  padding-block: clamp(24px, 5vh, 48px);
}

.profile-card {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.profile-card__info {
  flex: 1 1 220px;
  min-width: 0;
}

.profile-card__name {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
}

.profile-card__info .muted {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.profile-card__stats {
  display: flex;
  gap: 10px;
}

.profile-card__stats .stat {
  min-width: 88px;
}

.attempt-list {
  display: grid;
  gap: 14px;
  list-style: none;
  margin-top: 16px;
  padding: 0;
}

.attempt {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.attempt__main {
  flex: 1 1 240px;
  min-width: 0;
}

.attempt__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.attempt__meta {
  font-size: 13px;
  margin-top: 4px;
}

.attempt__score {
  align-items: center;
  display: flex;
  gap: 10px;
}

.attempt__figure {
  font-family: var(--font-mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.attempt__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 560px) {
  .attempt__actions {
    width: 100%;
  }

  .profile-card__stats {
    width: 100%;
  }
}

/* Catalogue page rhythm — space between the intro and each section. */
.landing > section + section {
  margin-top: clamp(28px, 5vw, 44px);
}

/* --- show/hide password ------------------------------------------------ */

.pw-wrap {
  display: block;
  position: relative;
}

.pw-wrap .input {
  padding-right: 64px;
  width: 100%;
}

.pw-toggle {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 8px;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Inputs must be at least 16px on mobile or iOS zooms the page on focus. */
.auth .input,
.pw-change .input {
  font-size: 16px;
}

.form-error a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* =====================================================================
   Practice hub (index.html)
   The landing page: a hero, three tabbed panels, and the cards, rows and
   figures they share.
   ===================================================================== */

.hub {
  padding: clamp(36px, 6vw, 48px) var(--gutter) clamp(72px, 10vw, 112px);
}

.hub__intro {
  max-width: 620px;
}

.hub__title {
  margin-top: 16px;
  font-size: clamp(34px, 6vw, 46px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.hub__lede {
  margin-top: 16px;
  color: var(--ink-3);
  font-size: 15.5px;
  line-height: 1.6;
}

/* A single live figure under the hero: what is open right now, or the test
   this student is part-way through. */
.track-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  margin-top: 16px;
  font-size: 12.5px;
}

.track-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.track-pill__label {
  color: var(--ink-3);
}

.track-pill__sep {
  color: var(--line-strong);
}

.track-pill__value {
  color: var(--ink);
  font-weight: 600;
}

.hub__tabs {
  margin: 32px 0;
}

.tab__count {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
}

.hub__panel {
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 5vw, 48px);
}

.hub__heading {
  margin-bottom: 16px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.hub__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.hub__section-head .hub__heading {
  margin-bottom: 14px;
}

.hub__split {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(296px, 1fr));
}

/* A text-only forward link, used in every panel header. */
.link-btn {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--accent-hover);
}

/* --- shared pieces ----------------------------------------------------- */

/* The small square that carries a technology initial. */
.glyph {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgb(255 255 255 / 5%);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  place-items: center;
}

.glyph--sm {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 10px;
}

.meter {
  height: 4px;
  border-radius: 4px;
  background: rgb(255 255 255 / 8%);
  overflow: hidden;
}

.meter--card {
  margin: 24px 0;
}

.meter--thin {
  height: 3px;
}

.meter--grow {
  flex: 1;
  min-width: 200px;
}

.meter__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.5s ease;
}

.figure-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.figure-line__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.figure-line__unit {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 14px;
}

.empty-note {
  display: grid;
  gap: 8px;
  padding: 56px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  text-align: center;
}

.empty-note strong {
  font-size: 17px;
  font-weight: 600;
}

/* --- continue practicing ----------------------------------------------- */

.resume-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.resume-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  background: #101413;
}

.resume-card__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.resume-card__eyebrow {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.resume-card__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.resume-card__sub {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.resume-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

/* --- figures strip ------------------------------------------------------ */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border-left: 1px solid var(--line);
}

.stat-cell:first-child {
  border-left: 0;
}

.stat-cell__value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stat-cell__label {
  color: var(--ink-3);
  font-size: 12.5px;
}

/* --- panel + rows ------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  padding: 24px 26px 20px;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.panel__head .section-title {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.panel__head .section-sub {
  margin: 6px 0 0;
  font-size: 13px;
}

.panel .figure-line {
  margin-top: 22px;
}

.panel .meter {
  margin-top: 12px;
}

.panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.panel__foot-label {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel__foot-value {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 500;
}

.row-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 11px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.16s ease;
}

.row:hover {
  background: var(--surface-sunken);
}

.row--tight {
  justify-content: space-between;
  padding: 11px 12px;
  border-radius: var(--r-md);
}

.row__main {
  flex: 1;
  min-width: 0;
}

.row__title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.row__ratio {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.row__side {
  flex: 0 0 auto;
  min-width: 82px;
  text-align: right;
}

.row__action {
  display: block;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.row__action--ok {
  color: var(--accent);
}

.row__state {
  display: block;
  margin-top: 3px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

/* --- recent activity ---------------------------------------------------- */

.activity {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.activity__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.16s ease;
}

.activity__row:first-child {
  border-top: 0;
}

.activity__row:hover {
  background: var(--surface-hover);
}

.activity__row .glyph {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 10px;
}

.activity__title {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity__result {
  flex: 0 0 auto;
  min-width: 58px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
}

.activity__when {
  flex: 0 0 auto;
  min-width: 86px;
  color: var(--ink-4);
  font-size: 12.5px;
  text-align: right;
  white-space: nowrap;
}

.activity__empty {
  padding: 32px 22px;
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
}

/* --- technology filter --------------------------------------------------- */

.chips {
  display: flex;
  gap: 8px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}

.chip:hover {
  border-color: var(--ink-4);
}

.chip--on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip__count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
}

/* --- grouped test / set cards -------------------------------------------- */

.group + .group {
  margin-top: 40px;
}

/* Mixed-subject papers sit apart from the per-technology groups above. */
.group + .group--combined {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--line-strong);
}

.group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.group__name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.group__meta {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.16s ease;
}

.tile:hover {
  border-color: var(--line-strong);
}

.tile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tile__ident {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.tile__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.tile__desc {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.tile__facts {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.tile__dot {
  color: var(--line-strong);
}

.tile__score {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: rgb(255 255 255 / 4%);
}

.tile__score-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.tile__score-note {
  color: var(--ink-3);
  font-size: 12px;
}

.tile__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

/* --- code lab panel ------------------------------------------------------ */

.lab-banner {
  padding: 28px 30px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  background: #101613;
}

.lab-banner__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.lab-banner__text {
  max-width: 540px;
}

.lab-banner__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lab-banner__text .muted {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.6;
}

.lab-banner__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 26px;
  margin-top: 26px;
}

@media (max-width: 560px) {
  /* The strip always holds four figures, so at this width it is a 2x2 grid:
     keep the vertical rule between the pair and rule off each new row. */
  .stat-cell {
    border-top: 1px solid var(--line);
  }

  .stat-cell:nth-child(odd) {
    border-left: 0;
  }

  .stat-cell:nth-child(-n + 2) {
    border-top: 0;
  }

  .activity__row {
    flex-wrap: wrap;
  }

  .activity__title {
    flex: 1 1 auto;
  }

  .resume-card .btn,
  .lab-banner .btn {
    width: 100%;
  }
}

/* On a phone the header has to stay one line: the wordmark alone identifies
   the app, and the student's name is already on the avatar. */
@media (max-width: 460px) {
  .site-header__inner {
    gap: 10px;
  }

  .brand__sub,
  .auth-chip__name {
    display: none;
  }

  .auth-chip {
    padding: 4px;
  }

  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }
}

/* ------------------------------------------------ code lab set groups */

/* Practice and graded sets each get their own section, on the hub and on
   the Code Lab page. */
.lab-group {
  margin-top: 64px;
}

.lab-group + .lab-group {
  margin-top: 76px;
}

/* The hub panel already spaces its children with a gap. */
.hub__panel .lab-group {
  margin-top: 0;
}

.lab-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  padding-bottom: 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--line-strong) 70%, transparent) 1;
}

.lab-group__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.lab-group__eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: currentColor;
}

.lab-group--graded .lab-group__eyebrow {
  color: var(--ink-2);
}

.lab-group__title {
  margin-top: 12px;
  font-size: clamp(22px, 3vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lab-group__lede {
  max-width: 54ch;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.6;
}

.lab-group__count {
  padding-bottom: 4px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 12px;
}
