/* ============================================================
   Concept pages (Academy, coach overlay, Support, iRacing account).
   Previews of planned features: same tokens and components as the
   rest of the app, plus a few pieces of their own, all prefixed cx-.
   Phone first: nothing here is wider than the screen at 375px.
   ============================================================ */

/* ---------- the Concept badge ---------- */
.cx-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 1.25rem;
  padding: 8px 12px;
  border: 1px dashed rgba(229, 181, 103, 0.45);
  border-radius: var(--radius);
  background: var(--warm-soft);
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.cx-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 2px;
  background: var(--warm);
  color: #1d1708;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* "via the Podium 1 equipment API": the partner's part, called out. */
.cx-partner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  background: var(--surface-2);
  font-size: 0.78rem;
  color: var(--ink);
  white-space: nowrap;
}
.cx-partner::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
}
.cx-partner-note {
  padding: 10px 12px;
  border-left: 3px solid var(--accent-deep);
  background: var(--surface-2);
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.cx-partner-note strong { color: var(--ink); font-weight: 600; }

/* ---------- section headings ---------- */
.cx-h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  color: #fff;
}
.cx-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ---------- Academy ---------- */
.cx-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 768px) { .cx-progress { grid-template-columns: 2fr 1fr 1fr 1.4fr; } }
.cx-bar {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--edge);
}
.cx-bar > span { display: block; height: 100%; background: var(--accent-deep); }

/* The four-level path: a row of steps, the member's level lit. */
.cx-path {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
@media (min-width: 640px) { .cx-path { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cx-path { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cx-path-step {
  padding: 12px 14px 14px;
  border-top: 3px solid var(--edge-strong);
  border-right: 1px solid var(--edge);
}
.cx-path-step:last-child { border-right: 0; }
.cx-path-step.is-done { border-top-color: var(--accent-deep); }
.cx-path-step.is-here { border-top-color: var(--accent); background: var(--accent-soft); }
.cx-path-n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.cx-path-step.is-here .cx-path-n { color: var(--accent); }

.cx-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  counter-reset: cx-step;
}
@media (min-width: 640px) { .cx-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cx-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cx-step { position: relative; padding: 14px 14px 14px 52px; }
.cx-step::before {
  counter-increment: cx-step;
  content: counter(cx-step);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.cx-lessons {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .cx-lessons { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cx-lessons { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cx-lesson { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.cx-lesson-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #050608;
  border-bottom: 1px solid var(--edge);
}
.cx-lesson-thumb .cx-play { width: 44px; height: 44px; }
.cx-lesson-thumb .chip { position: absolute; left: 8px; top: 8px; background: rgba(8, 9, 11, 0.85); }
.cx-lesson-thumb .cx-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 0 6px;
  background: rgba(8, 9, 11, 0.85);
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink);
}
.cx-lesson-done { color: var(--pb); font-size: 0.8rem; }

/* The video placeholder: a dark 16:9 panel with a play glyph. */
.cx-video {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #030405;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
}
.cx-video-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(8, 9, 11, 0.9);
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.cx-video-track { flex: 1; height: 3px; background: var(--edge-strong); }
.cx-video-track > span { display: block; width: 18%; height: 100%; background: var(--accent); }
.cx-play { width: 64px; height: 64px; color: var(--ink); }
.cx-video-caption {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.cx-chapters { counter-reset: none; }
.cx-chapter {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
}
.cx-chapter:last-child { border-bottom: 0; }
.cx-chapter:hover { background: rgba(255, 255, 255, 0.02); }
.cx-chapter-at { font-family: var(--font-display); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

.cx-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 2.25rem;
  font-size: 0.9rem;
  color: var(--ink);
}
.cx-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.cx-rigs { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-rig {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  background: var(--surface-2);
  font-size: 0.875rem;
  cursor: pointer;
}
.cx-rig:has(input:checked) { border-color: var(--accent-edge); background: var(--accent-soft); color: #fff; }
.cx-rig input { accent-color: var(--accent); }

/* ---------- Coach overlay ---------- */
.cx-sim {
  position: relative;
  background:
    linear-gradient(180deg, #0b0d10 0%, #0b0d10 55%, #15181c 55%, #1a1d21 100%);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 560px;
}
/* A road, drawn flat: the "game" behind the overlay. */
.cx-sim-road {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 70%;
  height: 45%;
  transform: translateX(-50%);
  background: #22262b;
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}
.cx-sim-road::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, #5b626b 0 22px, transparent 22px 44px);
}
.cx-sim-board {
  position: absolute;
  bottom: 44%;
  right: 33%;
  padding: 2px 6px;
  background: #e8ebef;
  color: #08090b;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.cx-hud {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}
@media (min-width: 900px) {
  .cx-hud { grid-template-columns: 15rem minmax(0, 1fr) 15rem; align-items: start; }
}
.cx-panel {
  background: rgba(5, 6, 8, 0.86);
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  padding: 10px 12px;
}
.cx-prompt { border-left: 4px solid var(--accent); text-align: left; }
.cx-prompt-text {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
  color: #fff;
}
.cx-delta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cx-delta.is-ahead { color: var(--pb); }
.cx-delta.is-behind { color: var(--danger); }
.cx-coachcam {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #030405;
  border: 1px solid var(--edge);
}
.cx-coachcam .cx-play { width: 34px; height: 34px; }
.cx-map { width: 100%; height: auto; display: block; }
.cx-map-line { fill: none; stroke: #5b626b; stroke-width: 6; stroke-linejoin: round; }
.cx-map-line-in { fill: none; stroke: #0b0d10; stroke-width: 2; }
.cx-map-car { fill: var(--accent); }
.cx-map-next { fill: var(--warm); }
.cx-guided {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}
@media (min-width: 900px) { .cx-guided { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cx-meter {
  position: relative;
  height: 12px;
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--edge);
}
.cx-meter > .cx-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--wet); }
.cx-meter > .cx-ref { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; }
.cx-go {
  display: grid;
  place-items: center;
  height: 44px;
  margin-top: 8px;
  background: var(--pb);
  color: #04130d;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.08em;
}
/* On a phone the prompt leads, the coach video shrinks and the painted
   brake board (which sits behind the stacked panels) is left out. */
@media (max-width: 899px) {
  .cx-hud > :nth-child(2) { order: -1; }
  .cx-coachcam { aspect-ratio: 16 / 7; }
  .cx-sim-board { display: none; }
}
.cx-mono { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }

.cx-layers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 768px) { .cx-layers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cx-loss { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--edge); }
.cx-loss-n {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  font-family: var(--font-display);
  font-weight: 700;
}

/* ---------- Support ---------- */
.cx-section-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.cx-section-nav::-webkit-scrollbar { display: none; }
.cx-anchor { scroll-margin-top: 90px; }
.cx-guides {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 900px) { .cx-guides { grid-template-columns: 18rem minmax(0, 1fr); } }
.cx-symptom {
  display: block;
  padding: 8px 10px;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.cx-symptom:hover { color: var(--ink); background: var(--surface-2); }
.cx-symptom[aria-current] { color: #fff; border-left-color: var(--accent); background: var(--accent-soft); }
.cx-steps-list { list-style: none; counter-reset: cx-li; }
.cx-steps-list li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-bottom: 1px solid var(--edge);
  font-size: 0.925rem;
}
.cx-steps-list li:last-child { border-bottom: 0; }
.cx-steps-list li::before {
  counter-increment: cx-li;
  content: counter(cx-li);
  position: absolute;
  left: 0;
  top: 9px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge-strong);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}
.cx-update { color: var(--warm); }
.cx-uptodate { color: var(--pb); }

.cx-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 30rem;
  overflow-y: auto;
  padding: 14px;
}
.cx-msg { max-width: 85%; padding: 8px 12px; border-radius: 2px; font-size: 0.9rem; line-height: 1.45; }
.cx-msg-member { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-edge); color: var(--ink); }
.cx-msg-ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--edge-strong); color: var(--ink); }
.cx-msg-system {
  align-self: center;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: var(--pb-soft);
  color: var(--pb);
  font-size: 0.8rem;
}
.cx-msg-who { display: block; margin-bottom: 2px; font-size: 0.72rem; color: var(--ink-faint); }

.cx-consent {
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.07);
  border-radius: var(--radius);
  padding: 12px 14px;
}

/* ---------- iRacing ---------- */
.cx-licenses {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .cx-licenses { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cx-license-class {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: #08090b;
}
.cx-lic-R { background: #e05252; }
.cx-lic-D { background: #f08a24; }
.cx-lic-C { background: #f2c94c; }
.cx-lic-B { background: #4caf50; }
.cx-lic-A { background: #2f80ed; color: #fff; }
.cx-btn-iracing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 1.1rem;
  border: 1px solid #fff;
  border-radius: 2px;
  background: #fff;
  color: #0b1a33;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.cx-btn-iracing:hover { background: #e8ebef; }
.cx-splits {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 900px) { .cx-splits { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- This week ---------- */
/* Under the hero: the watch party and challenge cards beside the board. */
.cx-tw-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 900px) { .cx-tw-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.cx-tw-card { border-left: 3px solid var(--accent); }
.tower tbody tr.cx-tw-you td { background: var(--accent-soft); }
.cx-tw-you .tower-pos { box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 640px) {
  #this_week_board .tower-driver { font-size: 1.1rem; }
  #this_week_board .tower-time { font-size: 1.15rem; }
  #this_week_board .tower tbody td { padding-inline: 8px; }
}

.cx-tw-calendar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .cx-tw-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cx-tw-calendar { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cx-tw-tile { border-top: 3px solid var(--edge-strong); min-width: 0; }
.cx-tw-tile.is-lead { border-top-color: var(--accent); }
.cx-tw-series {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  color: #fff;
}
.cx-tw-plan {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  font-size: 0.875rem;
}
.cx-tw-plan dt { color: var(--ink-faint); }
.cx-tw-plan dd { color: var(--ink); overflow-wrap: anywhere; }
.cx-tw-plan dd.is-yes { color: var(--pb); font-weight: 600; }
.cx-tw-plan dd.is-no { color: var(--ink-faint); }

/* The loop: six steps left to right with arrows between them, stacked
   with arrows pointing down below 1024px. Plain CSS, no drawing. */
.cx-tw-loop {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  list-style: none;
}
@media (min-width: 1024px) { .cx-tw-loop { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 26px; } }
.cx-tw-step {
  position: relative;
  padding: 12px 14px 14px;
  border: 1px solid var(--edge);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.cx-tw-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -21px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--accent);
}
@media (min-width: 1024px) {
  .cx-tw-step:not(:last-child)::after {
    left: auto;
    right: -20px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 10px solid var(--accent);
    border-right: 0;
  }
}
.cx-tw-step:last-child { border-top-style: dashed; }
.cx-tw-step-n {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.cx-tw-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 768px) { .cx-tw-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cx-tw-stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cx-tw-stat-main {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--accent);
}
.cx-tw-stat-vs {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
