/* ============================================================
   CHALLENGE PAGES, shared components for /challenges/[slug]/
   Loaded after global.css, which still owns the base challenge
   template (.chall-preview-*, .chall-rule-*, .faq-*). Everything
   here is ch-* and was lifted from the KOTH event page via the
   Hot Lap page, so any challenge can opt in section by section.
   Cache-bust with ?v= like the globals.

   Heading conventions follow global.css: display headings get
   negative tracking and an explicit line-height; tiny uppercase
   labels get positive tracking.
   ============================================================ */

/* -- Post-install note under the store badges -- */
.ch-hero-note {
  margin: 18px auto 0;
  max-width: 520px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.ch-hero-note strong { color: var(--text-primary); font-weight: 700; }

/* -- HERO, the "stage" (Red Bull style). The challenge art is rebuilt
   as live layers so it is truly edge to edge at any screen size: the
   art's gradient in CSS, its character cut out on the right, and the
   title set as real text. All copy is white on the dark side of the
   gradient; the character sits on the bright side. Per page, the
   generator sets --stage-bg, --stage-bg-mobile and --stage-glow on the
   section (scripts/build-challenge-pages.py).
   On phones the gradient runs top to bottom: bright behind the
   character, dark behind the copy. -- */
.ch-stage {
  --stage-bg: linear-gradient(105deg, #0a2350 0%, #134b8c 30%, #1f7cc4 55%, #3dbbe9 80%, #75daf7 100%);
  --stage-bg-mobile: linear-gradient(180deg, #3dbbe9 0%, #1f7cc4 34%, #134b8c 58%, #0a2350 82%);
  --stage-glow: rgba(117, 218, 247, 0.55);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(640px, 100vh, 980px);
  padding: calc(72px + env(safe-area-inset-top)) 0 56px;
  background: var(--stage-bg);
}
.ch-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(42% 55% at 76% 42%, var(--stage-glow) 0%, transparent 70%),
    linear-gradient(90deg, rgba(4, 12, 32, 0.5) 0%, rgba(4, 12, 32, 0) 50%),
    linear-gradient(0deg, var(--bg-primary) 0%, rgba(8, 8, 8, 0) 22%);
}
.ch-stage-inner {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 500px);
  gap: 48px;
  align-items: center;
}
.ch-stage-copy { min-width: 0; }
.ch-stage-eyebrow {
  display: block;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.4px;
  line-height: 1.3;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
}
.ch-stage-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(56px, 8vw, 128px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 0.9;
  color: #fff;
  margin: 0 0 22px;
  text-wrap: balance;
  text-shadow: 0 4px 40px rgba(4, 12, 32, 0.35);
}
/* Long names step down so they never run past four lines */
.ch-stage-title--long { font-size: clamp(48px, 6.4vw, 100px); }
.ch-stage-title--xlong { font-size: clamp(40px, 5.2vw, 80px); }
.ch-stage-kicker {
  display: block;
  font-size: clamp(20px, 2.4vw, 30px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 6px;
}
.ch-stage-sub {
  max-width: 540px;
  margin: 0 0 28px;
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
}
.ch-stage .app-badges { justify-content: flex-start; }
.ch-stage .ch-hero-note { margin: 14px 0 0; max-width: none; text-align: left; color: rgba(255, 255, 255, 0.8); }
.ch-stage .ch-hero-note strong { color: #fff; }
.ch-stage-side {
  min-width: 0;
  display: grid;
  gap: 24px;
  justify-items: center;
}
.ch-stage-figure {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
  filter: drop-shadow(0 30px 50px rgba(4, 12, 32, 0.45));
}
/* The countdown fills the side column (it used to shrink to its digits) */
.ch-stage-countdown { width: 100%; max-width: 440px; justify-self: center; }
.ch-stage-side .ch-countdown { width: 100%; }
/* Compact countdown inside the stage */
.ch-stage .ch-countdown { padding: 20px 22px 22px; gap: 14px; --cd-num: clamp(30px, 3vw, 42px); }
.ch-stage .ch-countdown-item { gap: 8px; padding: 6px 0; }

/* Short laptop screens: shrink the figure and title so the store
   badges and countdown stay above the fold. */
@media (min-width: 901px) and (max-height: 820px) {
  .ch-stage-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
  .ch-stage-figure { max-width: 360px; }
  .ch-stage-title { font-size: clamp(52px, 7vw, 108px); }
  .ch-stage-title--long { font-size: clamp(44px, 5.6vw, 88px); }
  .ch-stage-title--xlong { font-size: clamp(38px, 4.6vw, 70px); }
  .ch-stage-numbers { padding: 22px 24px; }
  .ch-stage-side { gap: 18px; }
}

@media (max-width: 900px) {
  .ch-stage {
    background: var(--stage-bg-mobile);
    display: block;
    min-height: 0;
    /* clears the mobile nav: 56px + a safe-area floored at 60px (global.css) */
    padding: calc(56px + max(env(safe-area-inset-top), 60px) + 12px) 0 40px;
  }
  .ch-stage::before {
    background:
      radial-gradient(60% 30% at 50% 18%, var(--stage-glow) 0%, transparent 70%),
      linear-gradient(0deg, var(--bg-primary) 0%, rgba(8, 8, 8, 0) 14%);
  }
  .ch-stage-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 0 20px;
  }
  .ch-stage-side { display: contents; }
  .ch-stage-figure { order: -1; max-width: min(74vw, 320px); justify-self: center; }
  .ch-stage-title { font-size: clamp(48px, 14vw, 72px); margin-bottom: 16px; }
  .ch-stage-title--long { font-size: clamp(40px, 11vw, 58px); }
  .ch-stage-title--xlong { font-size: clamp(34px, 9.4vw, 48px); }
  .ch-stage--type .ch-stage-numbers { order: -1; }
}

/* -- TYPE STAGE, for challenges without a character badge. The right
   column becomes a glass panel of the challenge's defining numbers
   with its icon, over a faint oversized ghost of the same icon. -- */
.ch-stage-numbers {
  position: relative;
  width: 100%;
  display: grid;
  gap: 18px;
  padding: 28px 30px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 60px rgba(4, 12, 32, 0.3);
  overflow: hidden;
}
.ch-stage-numbers::after {
  content: '';
  position: absolute;
  right: -18%;
  bottom: -26%;
  width: 78%;
  aspect-ratio: 1 / 1;
  background: var(--stage-icon) center / contain no-repeat;
  opacity: 0.12;
  pointer-events: none;
}
.ch-stage-numbers-icon {
  width: auto;
  height: 52px;
  max-width: 120px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(4, 12, 32, 0.35));
}
.ch-stage-number {
  position: relative;
  display: grid;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.ch-stage-number-value {
  font-family: 'Inter', sans-serif;
  font-size: clamp(48px, 5.2vw, 76px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.ch-stage-number-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}
@media (max-width: 900px) {
  .ch-stage-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    padding: 22px 20px;
  }
  .ch-stage-numbers-icon { grid-column: 1 / -1; height: 40px; }
  .ch-stage-number-value { font-size: clamp(30px, 9vw, 44px); overflow-wrap: anywhere; }
}

/* -- COUNTDOWN, KOTH T-Minus card. js/challenge.js drives it from
   data-open / data-close (and data-day-one for a day ladder). -- */
.ch-countdown {
  position: relative;
  display: grid;
  gap: 20px;
  padding: 24px 36px 28px;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.92) 0%, var(--bg-card) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.ch-countdown::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, var(--accent-subtle) 0%, transparent 60%);
  pointer-events: none;
}
.ch-countdown [hidden] { display: none !important; }
.ch-countdown-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  position: relative;
  z-index: 1;
}
.ch-countdown-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent);
}
.ch-countdown-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: ch-pulse 2s ease-in-out infinite;
}
@keyframes ch-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.ch-countdown-when {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}
/* Numbers and colons share one size (--cd-num). Each colon is its own
   narrow grid column, so it can never sit on top of a digit however
   tight the card gets. */
.ch-countdown {
  --cd-num: clamp(36px, 6vw, 64px);
}
.ch-countdown-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: 2px;
  position: relative;
  z-index: 1;
}
.ch-countdown-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
.ch-countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  min-width: 0;
}
.ch-countdown-sep {
  padding-top: 8px;
  font-family: 'Inter', sans-serif;
  font-size: var(--cd-num);
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  opacity: 0.5;
  transform: translateY(-0.06em);
  animation: ch-blink 1.5s ease-in-out infinite;
}
.ch-stage .ch-countdown-sep { padding-top: 6px; }
@keyframes ch-blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.15; }
}
.ch-countdown-number {
  font-family: 'Inter', sans-serif;
  font-size: var(--cd-num);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.ch-countdown-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* -- CHAPTER SPLIT, KOTH .koth-chapter-01: image one side, editorial
   column the other. Numbered eyebrow sits at the top of the copy. -- */
.ch-chapter {
  padding: 140px 0 120px;
  background: var(--bg-primary);
}
.ch-chapter--alt {
  padding: 120px 0;
  background: var(--bg-section);
  position: relative;
  overflow: hidden;
}
.ch-chapter--alt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(50% 60% at 0% 50%, var(--accent-subtle) 0%, transparent 60%);
  pointer-events: none;
}
.ch-split {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 64px;
  align-items: stretch;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
}
.ch-split--center { align-items: center; }
.ch-img {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  min-height: 520px;
}
.ch-img--square {
  min-height: 0;
  aspect-ratio: 1 / 1;
  max-width: 560px;
  width: 100%;
  justify-self: center;
  align-self: center;
}
/* Pinned to the frame so it fills it whether the frame's height comes
   from min-height, aspect-ratio or the grid row. */
.ch-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ch-tag {
  position: absolute;
  top: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(8, 8, 8, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
}
.ch-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.ch-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 600px;
  min-width: 0;
}
.ch-eyebrow {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.ch-num {
  font-family: 'Inter', sans-serif;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--accent);
}
.ch-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.ch-heading {
  font-family: 'Inter', sans-serif;
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: var(--text-primary);
  margin: 0 0 20px;
  text-wrap: balance;
}
.ch-lede {
  font-size: clamp(17px, 1.6vw, 19px);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0 0 20px;
  font-weight: 600;
}
.ch-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin: 0 0 32px;
}

/* -- DISTANCE LADDER, a real table: day, that day's run, running total -- */
.ch-ladder {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.ch-ladder th {
  padding: 12px 24px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border);
}
.ch-ladder td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.ch-ladder tr:last-child td { border-bottom: 0; }
.ch-ladder th:last-child,
.ch-ladder td:last-child { text-align: right; }
.ch-ladder .ch-ladder-day {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}
.ch-ladder .ch-ladder-total { color: var(--text-secondary); }
.ch-ladder tr.is-final td { background: var(--accent-subtle); }
.ch-ladder tr.is-final .ch-ladder-total { color: var(--text-primary); }
.ch-ladder-who {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent);
}

/* -- DROP-OFF CHART, horizontal bars drawn to one scale. Width is set
   inline as a percentage of the day-one field. -- */
.ch-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  min-width: 0;
}
.ch-chart-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}
.ch-chart-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ch-chart-row {
  display: grid;
  grid-template-columns: 64px 1fr 48px;
  gap: 14px;
  align-items: center;
}
.ch-chart-day {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.ch-chart-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.ch-chart-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
}
.ch-chart-value {
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ch-chart-row.is-last .ch-chart-day,
.ch-chart-row.is-last .ch-chart-value { color: var(--cta); }
.ch-chart-row.is-last .ch-chart-fill { background: var(--cta); box-shadow: 0 0 12px var(--cta-glow); }
.ch-chart-note {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* -- PRESS CARD, one story about the challenge (KOTH "As seen on").
   The whole card is the link; hover lifts it with transform only. -- */
.ch-press {
  max-width: 1300px;
  margin: 64px auto 0;
  padding: 0 24px;
  position: relative;
}
.ch-press-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s ease;
}
.ch-press-card:hover,
.ch-press-card:focus-visible {
  transform: translate3d(0, -3px, 0);
  border-color: var(--border-accent);
}
.ch-press-img { min-width: 0; }
.ch-press-img img {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.ch-press-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 32px 36px;
  min-width: 0;
}
.ch-press-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.ch-press-meta img { height: 20px; width: auto; display: block; }
.ch-press-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  margin: 0;
  text-wrap: balance;
}
.ch-press-quote {
  margin: 4px 0 0;
  font-size: clamp(17px, 1.6vw, 19px);
  font-weight: 600;
  line-height: 1.45;
  color: var(--accent-light);
}
.ch-press-cite {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.ch-press-link {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.ch-press-link::after { content: ' \2192'; }

/* -- RULES, KOTH split header + rule rows with an outcome pill -- */
.ch-rules {
  padding: 140px 0 120px;
  background: var(--bg-primary);
}
.ch-rules-header {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 80px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto 64px;
  padding: 0 24px;
}
.ch-rules-chapter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ch-rules-chapter .ch-num { font-size: clamp(56px, 7vw, 88px); }
.ch-rules-chapter .ch-label {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ch-rules-header .ch-body {
  font-size: clamp(17px, 1.6vw, 19px);
  line-height: 1.6;
  max-width: 580px;
  margin: 0;
}
.ch-rules-list {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
.ch-rules-list-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.ch-rule {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 40px;
  padding: 30px 40px 30px 56px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.4s ease;
}
.ch-rule:last-child { border-bottom: 0; }
.ch-rule:hover {
  background: linear-gradient(90deg, rgba(255, 58, 58, 0.14) 0%, rgba(255, 58, 58, 0.10) 18%, rgba(255, 58, 58, 0.05) 50%, transparent 85%);
}
.ch-rule-num {
  font-family: 'Inter', sans-serif;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.ch-rule-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin: 0;
}
.ch-rule-outcome {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--danger-light);
  padding: 8px 14px;
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  border-radius: 999px;
  white-space: nowrap;
}
.ch-rule-outcome::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
}
.ch-rules-after {
  max-width: 1100px;
  margin: 32px auto 0;
  padding: 0 24px;
}
.ch-rules-after .chall-rules-grid { margin-top: 0; }
.ch-rule-block-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* "Already in the app?" deep link. It only opens the app on a phone
   that has it; desktop (same test as the store picker in global.js)
   would land on the home page, so it is hidden there. */
.ch-app-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ch-app-link:hover { color: var(--accent-light); }
@media (hover: hover) and (pointer: fine) {
  .ch-app-link { display: none; }
}

/* -- FAQ wrapper, the accordion itself is global .faq-* -- */
.ch-faq {
  padding: 120px 0;
  background: var(--bg-section);
}
.ch-faq-head {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 0 24px;
  text-align: center;
}
.ch-faq-head .ch-label { display: block; margin-bottom: 14px; color: var(--accent); }
.ch-faq-head .ch-heading {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 52px);
  letter-spacing: -0.04em;
  line-height: 0.98;
}
.ch-faq .faq-list { max-width: 800px; margin: 0 auto; padding: 0 24px; }

@media (prefers-reduced-motion: reduce) {
  .ch-countdown-tag::before,
  .ch-countdown-sep { animation: none; }
}
@media (max-width: 900px) {
  .ch-chapter, .ch-chapter--alt, .ch-rules, .ch-faq { padding: 80px 0; }
  .ch-split { grid-template-columns: 1fr; gap: 32px; }
  .ch-img { min-height: 0; aspect-ratio: 4 / 3; }
  .ch-img--square { aspect-ratio: 1 / 1; max-width: 420px; }
  .ch-press { margin-top: 40px; }
  .ch-press-card { grid-template-columns: 1fr; }
  .ch-press-body { padding: 24px 22px 26px; }
}
@media (max-width: 768px) {
  .ch-countdown { padding: 22px 16px 24px; --cd-num: clamp(30px, 9vw, 40px); }
  .ch-stage .ch-countdown { --cd-num: clamp(30px, 9vw, 40px); }
  .ch-rules-header { grid-template-columns: 1fr; gap: 24px; margin-bottom: 40px; }
  .ch-rules-chapter { flex-direction: row; align-items: baseline; gap: 16px; }
  .ch-rules-chapter .ch-label { padding-top: 0; border-top: 0; }
  .ch-rule { grid-template-columns: 1fr; gap: 14px; padding: 26px 24px; align-items: start; }
  .ch-rule-outcome { justify-self: start; }
  .ch-ladder th, .ch-ladder td { padding-left: 16px; padding-right: 16px; }
  .ch-chart { padding: 20px 18px; }
  .ch-chart-row { grid-template-columns: 56px 1fr 40px; gap: 10px; }
}

/* -- SPECS ROW, three cells with rule dividers (KOTH course specs) -- */
.ch-specs {
  display: grid;
  grid-template-columns: repeat(var(--ch-specs, 3), minmax(0, 1fr));
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.ch-spec { padding: 0 20px; border-left: 1px solid var(--border); min-width: 0; }
.ch-spec:first-child { padding-left: 0; border-left: 0; }
.ch-spec-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.ch-spec-value {
  font-family: 'Inter', sans-serif;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text-primary);
}
.ch-spec-alt {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-secondary);
}

/* -- REWARD TIERS, KOTH medal-tier scoreboard -- */
.ch-tiers {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.ch-tier {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 24px;
  padding: 18px 28px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.ch-tier:last-child { border-bottom: 0; }
.ch-tier--lead { padding: 26px 28px; background: linear-gradient(90deg, var(--accent-subtle) 0%, transparent 80%); }
.ch-tier-value {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ch-tier--lead .ch-tier-value { font-size: 40px; }
.ch-tier-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.ch-tier-group {
  padding: 12px 28px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.ch-tier-note { margin: 16px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* -- RESULTS, a finished challenge: stat band + top 3 men and women -- */
.ch-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0;
  margin: 8px 0 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  overflow: hidden;
}
/* Rule lines between cells: every cell gets a top and left line, and the
   card's own border and overflow hide the ones on its outer edges, so the
   lines stay right however many cells fit on a row. */
.ch-stat { padding: 20px 22px; border-left: 1px solid var(--border); border-top: 1px solid var(--border); margin: -1px 0 0 -1px; min-width: 0; }
.ch-stat-value {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: clamp(26px, 2.8vw, 34px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ch-stat-label {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.8px;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.ch-podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.ch-podium-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  min-width: 0;
}
.ch-podium-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent);
}
.ch-podium-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ch-podium-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: baseline;
  font-size: 15px;
  line-height: 1.3;
}
.ch-podium-rank { font-weight: 900; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ch-podium-name { font-weight: 800; color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }
.ch-podium-score { font-weight: 700; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* -- Image tag that is a label, not a link, and image frames with a set shape -- */
.ch-tag--static::after { content: none; }
.ch-img--ratio { min-height: 0; aspect-ratio: var(--ch-ratio, 4 / 3); align-self: center; max-width: 620px; width: 100%; justify-self: center; }

/* -- Finished challenges: a second, quieter link under the CTA button -- */
.ch-cta-alt {
  display: inline-block;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ch-cta-alt:hover { color: var(--text-primary); }

/* -- HUB: /challenges/ cards, grouped Live / Upcoming / Finished -- */
.ch-hub { padding: 72px 0 120px; background: var(--bg-primary); }
.ch-hub-group { max-width: 1300px; margin: 0 auto 64px; padding: 0 24px; }
.ch-hub-group[hidden] { display: none; }
.ch-hub-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.ch-hub-head .ch-heading { font-size: clamp(32px, 4vw, 52px); letter-spacing: -0.04em; line-height: 0.95; margin: 0; }
.ch-hub-count { font-size: 12px; font-weight: 800; letter-spacing: 2px; line-height: 1.2; text-transform: uppercase; color: var(--text-secondary); }
.ch-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.ch-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s ease;
}
.ch-card:hover, .ch-card:focus-visible { transform: translate3d(0, -3px, 0); border-color: var(--border-accent); }
.ch-card-art { aspect-ratio: 2220 / 1200; background: var(--bg-section); }
.ch-card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-card-body { display: grid; gap: 8px; padding: 18px 20px 22px; }
.ch-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  line-height: 1.2;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.ch-chip[data-phase="live"] { color: var(--cta); border-color: rgba(100, 255, 233, 0.35); background: rgba(100, 255, 233, 0.08); }
.ch-chip[data-phase="upcoming"] { color: var(--accent-light); border-color: var(--border-accent); background: var(--accent-subtle); }
.ch-card-dates { font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--text-secondary); }
.ch-card-name {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin: 0;
}
.ch-card-line { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin: 0; }

@media (max-width: 768px) {
  .ch-specs { grid-template-columns: 1fr; padding-top: 8px; }
  .ch-spec { padding: 14px 0; border-left: 0; border-top: 1px solid var(--border); }
  .ch-spec:first-child { border-top: 0; }
  .ch-tier { grid-template-columns: 92px 1fr; gap: 16px; padding: 16px 20px; }
  .ch-tier--lead { padding: 22px 20px; }
  .ch-tier-group { padding: 12px 20px; }
  .ch-hub { padding: 48px 0 80px; }
}

/* -- Layout helpers used by the generator -- */
/* Hyphenated words in names (Pull-Up, 1-Hour) never break at the hyphen */
.ch-nowrap { white-space: nowrap; }
/* A chapter with no image: one centred editorial column */
.ch-split--solo { grid-template-columns: minmax(0, 820px); justify-content: center; }
/* A stage with no right column (the hub) */
.ch-stage--solo { min-height: 0; padding-top: calc(132px + env(safe-area-inset-top)); padding-bottom: 72px; }
.ch-stage--solo .ch-stage-inner { grid-template-columns: minmax(0, 900px); }
@media (max-width: 900px) {
  .ch-stage--solo { padding-bottom: 40px; }
}

/* -- 04 THE FORMAT: explainer copy beside a card of key terms -- */
.ch-terms {
  margin: 0;
  display: grid;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-width: 0;
}
.ch-term { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.ch-term:last-child { border-bottom: 0; }
.ch-term dt {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--accent);
  margin: 0 0 6px;
}
.ch-term dd { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.ch-content .ch-body + .ch-body { margin-top: -16px; }

/* -- HOW IT WORKS IN THE APP: four steps beside the app mockup -- */
.ch-app {
  padding: 120px 0;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}
.ch-app::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(45% 60% at 85% 50%, var(--accent-subtle) 0%, transparent 70%);
  pointer-events: none;
}
.ch-app-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 64px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.ch-app-copy { min-width: 0; }
.ch-app-copy > .ch-label { display: block; margin-bottom: 14px; color: var(--accent); }
.ch-app-copy > .ch-heading { margin-bottom: 32px; }
.ch-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.ch-step {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.ch-step:last-child { border-bottom: 1px solid var(--border); }
.ch-step-num {
  font-family: 'Inter', sans-serif;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ch-step-title {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
  margin: 2px 0 6px;
}
.ch-step-body { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-secondary); }
.ch-step-body strong { color: var(--text-primary); }
.ch-app-visual { min-width: 0; justify-self: center; width: 100%; max-width: 440px; }
.ch-app-visual img { width: 100%; height: auto; display: block; filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55)); }

/* -- SIMILAR CHALLENGES: three hub cards before the closing CTA -- */
.ch-similar { padding: 100px 0 110px; background: var(--bg-section); }
.ch-similar-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.ch-similar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 28px;
}
.ch-similar-head .ch-label { display: block; margin-bottom: 12px; color: var(--accent); }
.ch-similar-head .ch-heading { margin: 0; font-size: clamp(32px, 4.4vw, 52px); letter-spacing: -0.04em; line-height: 0.98; }
.ch-similar-all { font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.ch-similar-all::after { content: ' \2192'; }
.ch-similar-all:hover { color: var(--accent-light); }
.ch-similar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

@media (max-width: 900px) {
  .ch-app { padding: 80px 0; }
  .ch-app-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .ch-app-visual { max-width: 320px; order: -1; }
  .ch-similar { padding: 72px 0 80px; }
  .ch-similar-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 640px) and (max-width: 900px) {
  .ch-similar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .ch-step { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
  .ch-step-num { font-size: 32px; }
  .ch-term { padding: 18px 20px; }
}

/* -- VIDEO: the challenge's YouTube Short, cover until pressed -- */
.ch-video { margin: 0; justify-self: center; width: 100%; max-width: 340px; min-width: 0; }
.ch-video-play,
.ch-video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.ch-video-play { position: relative; padding: 0; cursor: pointer; }
.ch-video-play img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.ch-video-play:hover img, .ch-video-play:focus-visible img { transform: scale(1.03); }
.ch-video-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ch-video-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
}
.ch-video-icon svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
.ch-video-cap {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-secondary);
}
@media (max-width: 900px) {
  .ch-video { max-width: 300px; }
}
