/* Challenge mode styles extracted from cps-test.css. */
.test-panel.is-challenge-mode .tester-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(176px, 210px);
  gap: clamp(20px, 2.5vw, 28px);
}

.test-panel.is-challenge-mode .side-panel {
  height: auto;
  padding-top: clamp(54px, 5vw, 68px);
  padding-bottom: 0;
}

.mode-switch {
  position: absolute;
  top: -32px;
  right: 8px;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0;
}

.mode-switch-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #6b756f;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
}

.mode-switch-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  opacity: 0.92;
  transition: opacity 160ms ease, transform 160ms ease;
  transform-origin: center;
  animation: mode-switch-spin 5s linear infinite;
}

.mode-switch-visual img {
  display: block;
  width: 24px;
  height: 24px;
}

.mode-switch-button:hover .mode-switch-visual {
  opacity: 0.72;
}

@media (hover: hover) and (pointer: fine) {
  .mode-switch-button:hover .mode-switch-visual {
    animation-duration: 720ms;
  }
}

@keyframes mode-switch-spin {
  to {
    transform: rotate(1turn);
  }
}

.mode-switch-button.active .mode-switch-visual {
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 0.92;
  transform: none;
}

.mode-switch-button::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 50%;
  top: calc(100% + 7px);
  z-index: 12;
  width: max-content;
  max-width: 160px;
  padding: 6px 9px;
  color: #ffffff;
  background: #172a3b;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(23, 42, 59, 0.16);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateX(50%) translateY(-3px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.mode-switch-button:hover::after,
.mode-switch-button:focus-visible::after {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.mode-switch-button:focus-visible {
  outline: 3px solid rgba(107, 101, 220, 0.28);
  outline-offset: 2px;
}

.mode-new-dot {
  display: none;
}

.mode-switch-button.active .mode-new-dot {
  display: none;
}

.challenge-toolbar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(64px, 1fr));
  align-items: start;
  gap: clamp(8px, 1.2vw, 14px);
  width: min(680px, 100%);
  min-height: 86px;
  margin: 0 auto;
  padding: 10px 14px 8px;
  background: linear-gradient(180deg, #fbfcff, #f7f9fc);
  border: 1px solid rgba(108, 119, 137, 0.10);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.challenge-toolbar::before {
  content: "";
  position: absolute;
  top: 36px;
  right: 11%;
  left: 11%;
  height: 2px;
  background: linear-gradient(90deg, rgba(107, 101, 220, 0.28), rgba(93, 156, 236, 0.16));
  border-radius: 999px;
}

.challenge-toolbar[hidden] {
  display: none;
}

.test-panel.is-challenge-mode {
  --duration-toolbar-height: 86px;
}

.challenge-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 66px;
  padding: 0 3px 4px;
  color: #64736f;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.challenge-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 2px;
  background: transparent;
  border-radius: 999px;
  transform: translateX(-50%) scaleX(0.6);
  transition: transform 180ms ease, background-color 180ms ease;
}

.challenge-stage:hover:not(:disabled) {
  color: #172a3b;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 16px rgba(35, 55, 72, 0.06);
  transform: translateY(-2px);
}

.challenge-stage.active {
  color: #172a3b;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(35, 55, 72, 0.07);
}

.challenge-stage.active::after {
  background: rgba(107, 101, 220, 0.70);
  transform: translateX(-50%) scaleX(1);
}

.challenge-stage:focus-visible {
  outline: 3px solid rgba(107, 101, 220, 0.25);
  outline-offset: 2px;
}

.challenge-stage:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.challenge-stage-image {
  position: relative;
  display: block;
  width: 46px;
  height: 46px;
  overflow: hidden;
  background: #eef3f7;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(101, 112, 107, 0.14), 0 5px 14px rgba(35, 55, 72, 0.08);
  transition: box-shadow 180ms ease, filter 180ms ease;
}

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

.challenge-stage.active .challenge-stage-image {
  box-shadow: 0 0 0 3px rgba(107, 101, 220, 0.28), 0 8px 18px rgba(35, 55, 72, 0.12);
}

.challenge-stage.is-complete .challenge-stage-image {
  box-shadow: 0 0 0 3px rgba(240, 184, 77, 0.28), 0 8px 18px rgba(35, 55, 72, 0.10);
}

.challenge-stage:disabled .challenge-stage-image img {
  filter: grayscale(0.42) saturate(0.75);
}

.challenge-stage-name {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-stage-lock {
  position: absolute;
  top: 34px;
  left: calc(50% + 11px);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  box-shadow: 0 3px 9px rgba(23, 42, 59, 0.10);
}

.challenge-stage:not(:disabled) .challenge-stage-lock {
  display: none;
}

.challenge-stage-lock img {
  width: 13px;
  height: 13px;
}

.challenge-animal {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-bottom: 4px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.challenge-animal[hidden] {
  display: none;
}

.challenge-animal img {
  display: block;
  width: clamp(94px, 8vw, 118px);
  height: clamp(94px, 8vw, 118px);
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(107, 101, 220, 0.18), 0 14px 28px rgba(35, 55, 72, 0.14);
}

.challenge-stage-kicker {
  padding: 5px 9px;
  color: #5f5bc1;
  background: rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.01em;
}

.test-panel.is-challenge-mode .click-area-icon {
  display: none;
}

.test-panel.is-challenge-mode .click-stack {
  grid-template-rows: minmax(360px, 1fr) auto;
  gap: 14px;
  padding: clamp(16px, 2.3vw, 24px);
  background: linear-gradient(180deg, #ffffff, #fcfdff);
  border: 1px solid rgba(107, 101, 220, 0.06);
}

.test-panel.is-challenge-mode .click-area {
  min-height: 390px;
  padding: clamp(28px, 4vw, 44px);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.96), transparent 32%),
    radial-gradient(circle at 12% 88%, rgba(117, 207, 184, 0.12), transparent 28%),
    linear-gradient(145deg, #edf7ff 0%, #f3f5ff 58%, #fbf4ff 100%);
  border: 1px solid rgba(101, 132, 185, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 16px 32px rgba(50, 82, 118, 0.07);
}

.test-panel.is-challenge-mode .challenge-animal img {
  width: clamp(112px, 9vw, 138px);
  height: clamp(112px, 9vw, 138px);
  border-width: 5px;
  box-shadow:
    0 0 0 4px rgba(107, 101, 220, 0.13),
    0 18px 38px rgba(35, 55, 72, 0.17);
}

.test-panel.is-challenge-mode .challenge-stage-kicker {
  padding: 6px 11px;
  color: #544fc0;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 14px rgba(35, 55, 72, 0.06);
}

.test-panel.is-challenge-mode .click-area-title {
  max-width: 90%;
  font-size: clamp(2.45rem, 4.8vw, 4.25rem);
  font-weight: 680;
  letter-spacing: -0.035em;
}

.test-panel.is-challenge-mode .click-area-subtitle {
  max-width: 580px;
  color: #5f706d;
  line-height: 1.55;
}

.test-panel.is-challenge-mode .challenge-live-status {
  left: 20px;
  top: 20px;
  padding: 8px 12px;
  color: #514bc5;
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(107, 101, 220, 0.13);
  box-shadow: 0 8px 20px rgba(35, 55, 72, 0.08);
}

.click-area[data-state="running"] .challenge-animal {
  opacity: 0;
  transform: translateY(4px) scale(0.96);
}

.challenge-live-status {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 7;
  padding: 7px 10px;
  color: #504bb8;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(107, 101, 220, 0.14);
  border-radius: 999px;
  box-shadow: 0 7px 18px rgba(35, 55, 72, 0.07);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
}

.challenge-live-status[hidden] {
  display: none;
}

.test-panel.is-challenge-mode .stats-grid {
  grid-template-rows: repeat(2, auto);
  gap: 14px;
  align-content: start;
  height: auto;
}

.test-panel.is-challenge-mode .stat-card-cps {
  display: none;
}

.test-panel.is-challenge-mode .stat-card {
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  min-height: 96px;
  padding: 16px;
  background: linear-gradient(145deg, #ffffff, #f8faff);
  border: 1px solid rgba(105, 118, 137, 0.09);
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(35, 55, 72, 0.06);
}

.test-panel.is-challenge-mode .stat-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  width: 44px;
  height: 44px;
}

.test-panel.is-challenge-mode .stat-label {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  color: #6b7772;
  font-size: 0.76rem;
}

.test-panel.is-challenge-mode .stat-value {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  color: #172a3b;
  font-size: clamp(1.65rem, 2.4vw, 2.2rem);
  text-align: left;
}

.test-panel.is-challenge-mode .stat-value::after {
  width: 30px;
  height: 2px;
  margin: 4px auto 0 0;
}

.challenge-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.challenge-result-actions[hidden] {
  display: none;
}

.challenge-result-button {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 820;
  transition: transform 170ms ease, box-shadow 170ms ease, background-color 170ms ease, border-color 170ms ease;
}

.challenge-result-button.primary {
  color: #ffffff;
  background: linear-gradient(135deg, #6b65dc, #8e67df);
  box-shadow: 0 9px 22px rgba(107, 101, 220, 0.22);
}

.challenge-result-button.secondary {
  color: #514bc5;
  background: #f5f3ff;
  border-color: rgba(107, 101, 220, 0.16);
}

.challenge-result-button:hover {
  transform: translateY(-1px);
}

.challenge-result-button:focus-visible {
  outline: 3px solid rgba(107, 101, 220, 0.28);
  outline-offset: 2px;
}

@media (max-width: 760px) {

  .mode-switch {
      justify-content: center;
      padding: 0;
    }

  .challenge-toolbar {
      grid-template-columns: repeat(5, minmax(0, 1fr));
      overflow: visible;
      width: 100%;
      padding: 3px 4px 8px;
      gap: 5px;
    }

  .test-panel.is-challenge-mode {
      --duration-toolbar-height: 90px;
    }

  .test-panel.is-challenge-mode .tester-workspace {
      grid-template-columns: minmax(0, 1fr);
      gap: 16px;
    }

  .test-panel.is-challenge-mode .side-panel {
      order: -1;
      min-height: 0;
      height: auto;
      padding: 44px 0 0;
    }

  .test-panel.is-challenge-mode .stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto;
      gap: 10px;
    }

  .test-panel.is-challenge-mode .stat-card {
      min-height: 82px;
      padding: 12px;
      column-gap: 9px;
    }

  .test-panel.is-challenge-mode .stat-icon {
      width: 38px;
      height: 38px;
    }

  .test-panel.is-challenge-mode .click-area {
      min-height: 330px;
    }
}

@media (max-width: 460px) {

  .challenge-toolbar {
      margin-inline: -2px;
  }

  .challenge-stage {
      min-height: 76px;
      padding-inline: 0;
  }

  .challenge-stage-image {
      width: 44px;
      height: 44px;
  }

  .challenge-stage-name {
      font-size: 0.68rem;
  }

  .challenge-stage-lock {
      top: 29px;
      left: calc(50% + 9px);
  }

  .challenge-animal img {
      width: 82px;
      height: 82px;
    }

  .challenge-live-status {
      left: 10px;
      top: 10px;
      font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
  .mode-switch-visual,
  .mode-switch-button::after,
  .challenge-stage,
  .challenge-stage::after,
  .challenge-stage-image,
  .challenge-animal,
  .challenge-result-button {
    transition: none;
  }

  .mode-switch-visual {
    animation: none;
    transform: none;
  }

  .mode-switch-button:hover .mode-switch-visual {
    animation: none;
    transform: none;
  }
}

@media (min-width: 761px) {
  body .test-panel.is-challenge-mode .stat-card {
    column-gap: 18px;
  }
}

@media (min-width: 981px) {
  body .test-panel.is-challenge-mode .tester-workspace {
    grid-template-columns: minmax(190px, 0.8fr) minmax(480px, 2.45fr) minmax(220px, 0.95fr);
  }
}

body .test-panel.is-challenge-mode .stat-value::after {
  display: none;
}

body .test-panel.is-challenge-mode .stat-card {
  overflow: visible;
}

body .test-panel.is-challenge-mode .challenge-animal {
  display: none;
}

body .test-panel.is-challenge-mode .challenge-live-status {
  left: 0;
  top: 46px;
  width: 100%;
  padding: 0;
  color: #666f86;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  transform: none;
}

body .test-panel.is-challenge-mode .click-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 27px;
}

body .test-panel.is-challenge-mode .click-area-icon {
  display: grid;
  flex: 0 0 auto;
  width: 118px;
  height: 118px;
  margin: 0 0 4px;
  color: #203548;
}

body .test-panel.is-challenge-mode .click-source-icon {
  display: block;
}

body .test-panel.is-challenge-mode .click-area-title {
  max-width: 86%;
  font-size: clamp(2.45rem, 3.35vw, 3.15rem);
  line-height: 1.05;
}

body .test-panel.is-challenge-mode .click-area-subtitle {
  max-width: 360px;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

body .test-panel.is-challenge-mode .click-area-subtitle:empty {
  display: none;
}

@media (min-width: 981px) {
  body .test-panel.is-challenge-mode .click-area-shell {
    width: min(100%, 500px);
  }
}

@media (max-width: 760px) {
  body .test-panel.is-challenge-mode .click-area {
    gap: 18px;
  }

  body .test-panel.is-challenge-mode .click-area-icon {
    width: 86px;
    height: 86px;
  }

  body .test-panel.is-challenge-mode .click-area-title {
    font-size: 2.2rem;
  }
}

@media (max-width: 760px) {
  body .test-panel.is-challenge-mode .challenge-live-status {
    top: 42px;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
  }
}

body .test-panel.is-challenge-mode .click-area::after {
  content: none;
  display: none;
}

body .test-panel.is-challenge-mode .tool-controls {
  display: none;
}

/* Challenge alignment refinement: rounded-square play field and shared row baselines. */
.test-panel.is-challenge-mode .click-area {
  border-radius: 28px;
  clip-path: inset(0 round 28px);
}

.test-panel.is-challenge-mode .challenge-stage-copy {
  align-self: center;
  width: 100%;
}

.test-panel.is-challenge-mode .challenge-stage-name,
.test-panel.is-challenge-mode .challenge-stage-goal {
  width: 100%;
  text-align: left;
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .tester-workspace {
    grid-template-columns: minmax(166px, 0.7fr) minmax(480px, 2.45fr) minmax(220px, 0.95fr);
  }

  .test-panel.is-challenge-mode .click-area-shell {
    width: min(100%, 560px);
  }
}

/* Restore live CPS as the middle challenge statistic. */
.test-panel.is-challenge-mode .stat-card-cps {
  display: grid;
}

.test-panel.is-challenge-mode .stats-grid {
  grid-template-rows: repeat(3, auto);
}

@media (min-width: 761px) and (max-width: 980px) {
  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}

@media (max-width: 760px) {
  .test-panel {
    overflow-anchor: none;
  }

  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 6px;
    min-height: 120px;
    align-content: center;
  }

  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    row-gap: 4px;
    column-gap: 0;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    width: 42px;
    height: 42px;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    align-self: auto;
    font-size: 0.7rem;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    text-align: center;
  }
}

/* Keep the full 44px mode controls inside the clipped mobile test panel. */
@media (max-width: 760px) {
  .test-panel .mode-switch {
    top: 0;
    right: 0;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .test-panel.is-challenge-mode .tester-workspace {
    transform: translateY(-32px);
  }

  .test-panel.is-challenge-mode .mode-switch {
    transform: translateY(32px);
  }
}

@media (min-width: 761px) {
  .test-panel.is-challenge-mode .stat-card {
    column-gap: 18px;
  }
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .tester-workspace {
    grid-template-columns: minmax(178px, 0.74fr) minmax(480px, 2.45fr) minmax(220px, 0.95fr);
  }
}

@media (min-width: 761px) {
  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    justify-items: start;
    column-gap: 11px;
    row-gap: 4px;
  }

  .test-panel.is-challenge-mode .stat-meta {
    display: contents;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    text-align: left;
  }

  .test-panel.is-challenge-mode .stat-value::after {
    margin-right: 0;
    margin-left: 0;
  }

  .test-panel.is-challenge-mode .challenge-stage {
    grid-template-columns: 54px minmax(0, 1fr) 24px;
    min-height: 72px;
  }

  .test-panel.is-challenge-mode .challenge-stage-image {
    width: 54px;
    height: 54px;
  }
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .tester-workspace {
    position: relative;
    grid-template-columns: minmax(132px, 0.62fr) minmax(430px, 2.45fr) minmax(205px, 0.9fr);
    grid-template-rows: minmax(500px, auto);
    gap: clamp(24px, 2.6vw, 38px);
    align-items: center;
    padding-top: 0;
  }

  .test-panel.is-challenge-mode .click-stack {
    display: contents;
  }

  .test-panel.is-challenge-mode .click-area-shell {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: min(100%, 520px);
    height: auto;
    aspect-ratio: 1;
  }

  .test-panel.is-challenge-mode .side-panel {
    position: static;
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    min-height: 0;
    height: 428px;
    padding: 0;
  }

  .test-panel.is-challenge-mode .challenge-toolbar {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
  }
}

.test-panel.is-challenge-mode {
  --challenge-surface-gradient: linear-gradient(145deg, #eef7ff 0%, #e6f1fb 100%);
  --challenge-surface-gradient-hover: linear-gradient(145deg, #e8f3fc 0%, #deebf6 100%);
}

.test-panel.is-challenge-mode .click-area {
  min-height: 0;
  padding: clamp(36px, 4vw, 54px);
  background: #f8fafc;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 22px 52px rgba(61, 87, 125, 0.09);
  clip-path: circle(50% at 50% 50%);
}

.test-panel.is-challenge-mode .click-area:hover {
  background: var(--challenge-surface-gradient-hover);
  box-shadow: 0 26px 58px rgba(61, 87, 125, 0.12);
}

.test-panel.is-challenge-mode .click-area::after {
  width: min(190px, 42%);
  bottom: 42px;
  opacity: 0.13;
}

.test-panel.is-challenge-mode .challenge-animal img {
  width: clamp(106px, 8.2vw, 132px);
  height: clamp(106px, 8.2vw, 132px);
  border: 5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(107, 101, 220, 0.11), 0 16px 34px rgba(35, 55, 72, 0.16);
}

.test-panel.is-challenge-mode .challenge-stage-kicker {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: none;
}

.test-panel.is-challenge-mode .click-area-title {
  max-width: 92%;
  font-size: clamp(2.35rem, 3.7vw, 3.65rem);
  font-weight: 680;
  line-height: 0.98;
}

.test-panel.is-challenge-mode .click-area-subtitle {
  max-width: 390px;
  font-size: clamp(0.9rem, 1.15vw, 1rem);
  line-height: 1.5;
  text-align: center;
}

.test-panel.is-challenge-mode .challenge-live-status {
  left: 50%;
  top: 30px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.88);
  border: 0;
  box-shadow: none;
  transform: translateX(-50%);
}

.test-panel.is-challenge-mode .stats-grid {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, auto);
  gap: clamp(78px, 10vh, 116px);
  align-content: center;
  height: 100%;
}

.test-panel.is-challenge-mode .stat-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  justify-items: center;
  gap: 8px;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}

.test-panel.is-challenge-mode .stat-card:hover {
  transform: none;
  box-shadow: none;
}

.test-panel.is-challenge-mode .stat-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.test-panel.is-challenge-mode .stat-icon {
  width: 42px;
  height: 42px;
  background: color-mix(in srgb, var(--stat-accent) 13%, #ffffff);
}

.test-panel.is-challenge-mode .stat-label {
  color: #66746f;
  font-size: 0.79rem;
  font-weight: 800;
  white-space: nowrap;
}

.test-panel.is-challenge-mode .stat-value {
  grid-column: 1;
  grid-row: auto;
  justify-self: center;
  color: #172a3b;
  font-size: clamp(2rem, 2.2vw, 2.45rem);
  line-height: 1;
  text-align: center;
}

.test-panel.is-challenge-mode .stat-value::after {
  width: 34px;
  margin: 8px auto 0;
  opacity: 0.24;
}

.test-panel.is-challenge-mode .challenge-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.test-panel.is-challenge-mode .challenge-toolbar::before {
  content: none;
}

.challenge-toolbar-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 8px;
}

.challenge-toolbar-heading strong {
  color: #172a3b;
  font-size: 1.05rem;
  line-height: 1.1;
}

html[lang="en"] .challenge-toolbar-heading strong {
  white-space: nowrap;
}

.challenge-toolbar-heading span {
  flex: 0 0 auto;
  color: #8a9591;
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.test-panel.is-challenge-mode .challenge-stage {
  grid-template-columns: 52px minmax(0, 1fr) 24px;
  grid-template-rows: 1fr;
  align-items: center;
  justify-items: start;
  gap: 11px;
  min-height: 68px;
  padding: 8px 9px;
  color: #64736f;
  background: transparent;
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}

.test-panel.is-challenge-mode .challenge-stage::after {
  content: none;
}

.test-panel.is-challenge-mode .challenge-stage:hover:not(:disabled) {
  color: #172a3b;
  background: var(--challenge-surface-gradient-hover);
  box-shadow: none;
  transform: translateX(2px);
}

.test-panel.is-challenge-mode .challenge-stage.active {
  color: #172a3b;
  background: var(--challenge-surface-gradient);
  box-shadow: none;
}

.test-panel.is-challenge-mode .challenge-stage-image {
  grid-column: 1;
  width: 52px;
  height: 52px;
  border: 0;
  box-shadow: 0 7px 16px rgba(35, 55, 72, 0.12);
}

.test-panel.is-challenge-mode .challenge-stage.active .challenge-stage-image,
.test-panel.is-challenge-mode .challenge-stage.is-complete .challenge-stage-image {
  box-shadow: 0 7px 16px rgba(35, 55, 72, 0.14);
}

.challenge-stage-copy {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.test-panel.is-challenge-mode .challenge-stage-name {
  font-size: 0.82rem;
  line-height: 1.1;
}

.challenge-stage-goal {
  color: #8a9591;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.test-panel.is-challenge-mode .challenge-stage-lock {
  position: static;
  grid-column: 3;
  width: 24px;
  height: 24px;
  background: rgba(238, 242, 246, 0.88);
  box-shadow: none;
}

@media (min-width: 761px) and (max-width: 980px) {
  .test-panel.is-challenge-mode .tester-workspace {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 0.38fr);
    gap: 24px;
    padding-top: 48px;
  }

  .test-panel.is-challenge-mode .click-stack {
    display: contents;
  }

  .test-panel.is-challenge-mode .click-area-shell {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    width: min(100%, 500px);
    aspect-ratio: 1;
  }

  .test-panel.is-challenge-mode .side-panel {
    position: static;
    grid-column: 1 / -1;
    grid-row: 1;
    height: auto;
    padding: 0;
  }

  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    height: auto;
  }

  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: auto auto;
    justify-content: center;
    column-gap: 12px;
  }

  .test-panel.is-challenge-mode .challenge-toolbar {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }
}

@media (min-width: 761px) {
  .test-panel.is-challenge-mode .click-area-title {
    font-size: clamp(2.25rem, 3.2vw, 3.2rem);
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .test-panel.is-challenge-mode .tester-workspace {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-top: 44px;
  }

  .test-panel.is-challenge-mode .click-stack {
    display: contents;
  }

  .test-panel.is-challenge-mode .side-panel {
    position: static;
    order: initial;
    grid-column: 1;
    grid-row: 1;
    padding: 0;
  }

  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    height: auto;
  }

  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    column-gap: 10px;
    row-gap: 2px;
    min-height: 68px;
  }

  .test-panel.is-challenge-mode .stat-meta {
    display: contents;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
    width: 38px;
    height: 38px;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    font-size: clamp(1.6rem, 8vw, 2rem);
    text-align: left;
  }

  .test-panel.is-challenge-mode .stat-value::after {
    display: none;
  }

  .test-panel.is-challenge-mode .click-area-shell {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: 350px;
    aspect-ratio: auto;
  }

  .test-panel.is-challenge-mode .click-area {
    min-height: 350px;
    padding: 30px 20px 38px;
    border-radius: 28px;
    clip-path: inset(0 round 28px);
  }

  .test-panel.is-challenge-mode .click-area::after {
    bottom: 26px;
  }

  .test-panel.is-challenge-mode .challenge-live-status {
    top: 18px;
  }

  .test-panel.is-challenge-mode .challenge-toolbar {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin-top: 12px;
  }

  .challenge-toolbar-heading {
    grid-column: 1 / -1;
    margin: 0 0 4px;
    padding: 0 2px;
  }

  .test-panel.is-challenge-mode .challenge-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    justify-items: center;
    gap: 4px;
    min-height: 88px;
    padding: 4px 1px 6px;
    border-radius: 14px;
  }

  .test-panel.is-challenge-mode .challenge-stage:hover:not(:disabled) {
    transform: none;
  }

  .test-panel.is-challenge-mode .challenge-stage-image {
    grid-column: 1;
    width: 43px;
    height: 43px;
  }

  .test-panel.is-challenge-mode .challenge-stage-copy {
    justify-items: center;
    gap: 2px;
  }

  .test-panel.is-challenge-mode .challenge-stage-name {
    font-size: 0.64rem;
    text-align: center;
  }

  .test-panel.is-challenge-mode .challenge-stage-goal {
    display: block;
    font-size: 0.55rem;
    line-height: 1;
    text-align: center;
  }

  .test-panel.is-challenge-mode .challenge-stage-lock {
    position: absolute;
    top: 31px;
    left: calc(50% + 9px);
    width: 18px;
    height: 18px;
  }
}

/* Final challenge geometry and alignment overrides. */
.test-panel.is-challenge-mode .click-area {
  border-radius: 28px;
  clip-path: inset(0 round 28px);
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .tester-workspace {
    grid-template-columns: minmax(166px, 0.7fr) minmax(480px, 2.45fr) minmax(220px, 0.95fr);
  }

  .test-panel.is-challenge-mode .click-area-shell {
    width: min(100%, 560px);
  }
}

@media (min-width: 761px) {
  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    justify-items: start;
    column-gap: 11px;
    row-gap: 4px;
  }

  .test-panel.is-challenge-mode .stat-meta {
    display: contents;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    text-align: left;
  }

  .test-panel.is-challenge-mode .stat-value::after {
    margin-right: 0;
    margin-left: 0;
  }

  .test-panel.is-challenge-mode .challenge-stage {
    grid-template-columns: 54px minmax(0, 1fr) 24px;
    min-height: 72px;
  }

  .test-panel.is-challenge-mode .challenge-stage-image {
    width: 54px;
    height: 54px;
  }

  .test-panel.is-challenge-mode .challenge-stage-copy {
    align-self: center;
    width: 100%;
  }

  .test-panel.is-challenge-mode .challenge-stage-name,
  .test-panel.is-challenge-mode .challenge-stage-goal {
    width: 100%;
    text-align: left;
  }
}

@media (min-width: 761px) {
  .test-panel.is-challenge-mode .click-area {
    border-radius: 50%;
    clip-path: circle(50% at 50% 50%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 20px 48px rgba(61, 87, 125, 0.1);
  }

  .test-panel.is-challenge-mode .click-area:hover {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.94),
      0 24px 54px rgba(61, 87, 125, 0.13);
  }
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .click-area-shell {
    width: min(100%, 520px);
    transform: none;
  }

  .test-panel.is-challenge-mode:fullscreen .click-area-shell,
  .test-panel.is-app-fullscreen.is-challenge-mode .click-area-shell {
    width: min(86dvh, 720px);
    transform: none;
  }
}

/* Keep animal photography in the progression UI, not inside the click target. */
.test-panel.is-challenge-mode .challenge-animal img {
  display: none;
}

.test-panel.is-challenge-mode .challenge-animal {
  gap: 0;
  margin-bottom: 12px;
}

@media (min-width: 981px) {
  .test-panel.is-challenge-mode .tester-workspace {
    grid-template-columns: minmax(220px, 1fr) minmax(480px, 520px) minmax(220px, 1fr);
    column-gap: 32px;
  }

  .test-panel.is-challenge-mode .side-panel {
    justify-self: end;
    width: 220px;
    margin-top: 36px;
    padding: 0;
  }

  .test-panel.is-challenge-mode .challenge-toolbar {
    justify-self: start;
    width: 220px;
  }

  .test-panel.is-challenge-mode .stats-grid {
    align-content: space-between;
    gap: 0;
    padding-block: 12px 32px;
  }

  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 42px 56px max-content;
    grid-template-rows: auto;
    align-items: center;
    justify-content: end;
    column-gap: 6px;
    row-gap: 0;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    font-size: 0.88rem;
    line-height: normal;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: start;
    min-width: 0;
    font-size: clamp(1.7rem, 1.8vw, 2rem);
    line-height: 1.1;
    text-align: right;
    font-variant-numeric: tabular-nums;
    transform: none;
  }

  html[lang^="ja"] .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 42px 56px max-content;
    column-gap: 8px;
  }

  html[lang^="ja"] .test-panel.is-challenge-mode .stat-label {
    font-size: 0.8rem;
  }

  html[lang^="ja"] .test-panel.is-challenge-mode .stat-value {
    transform: none;
  }
}

/* Restore live CPS as the middle challenge statistic. */
.test-panel.is-challenge-mode .stat-card-cps {
  display: grid;
}

.test-panel.is-challenge-mode .stats-grid {
  grid-template-rows: repeat(3, auto);
}

@media (min-width: 761px) and (max-width: 980px) {
  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}

/* A completed stage keeps the standard card styling and shows a check at the trailing edge. */
.challenge-stage-complete {
  position: static;
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  display: block;
  width: 24px;
  height: 24px;
  background: url("../../images/icons/stage-check.svg") center / 20px 20px no-repeat;
}

.challenge-stage-complete[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .challenge-stage-complete {
    position: absolute;
    top: 31px;
    left: calc(50% + 9px);
    width: 18px;
    height: 18px;
    background-size: 15px 15px;
  }
}

body .test-panel.is-challenge-mode .challenge-live-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .test-panel.is-challenge-mode .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 6px;
  }

  .test-panel.is-challenge-mode .stat-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    row-gap: 4px;
    column-gap: 0;
  }

  .test-panel.is-challenge-mode .stat-icon {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    width: 42px;
    height: 42px;
  }

  .test-panel.is-challenge-mode .stat-label {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    align-self: auto;
    font-size: 0.7rem;
  }

  .test-panel.is-challenge-mode .stat-value {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    text-align: center;
  }
}
