/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --navy:          #001a23;
  --navy-card:     #0a2535;
  --navy-card-alt: #0e2e3e;
  --cyan:          #52d1f2;
  --cyan-faint:    rgba(82, 209, 242, 0.12);
  --white:         #ffffff;
  --muted:         #94a3b8;
  --border:        rgba(255, 255, 255, 0.07);
  --text-dark:     #0f172a;
  --text-mid:      #475569;
  --gray-bg:       #f1f5f9;
  --gray-border:   #e2e8f0;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius:        16px;
  --radius-sm:     10px;
  --shadow-card:   0 2px 16px rgba(0, 0, 0, 0.25);
  --transition:    all 0.18s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  height: 100%;
  background: var(--navy);
  font-family: var(--font);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

button {
  border: none;
  cursor: pointer;
  font-family: var(--font);
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ============================================================
   BOOT SCREEN
   ============================================================ */
.boot-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

/* ============================================================
   SHARED: LOADING SPINNER
   ============================================================ */
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   VIEW: LIBRARY
   ============================================================ */
.view-library {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
}

/* HEADER */
.library-header {
  padding: 24px 24px 16px;
  text-align: center;
  position: relative;
}

.library-header::after {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 16px auto 0;
}

.bbc-logo {
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
}

.bbc-logo img {
  width: 225px;
  height: 225px;
  object-fit: contain;
}

.logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--navy-card);
  border: 1.5px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -1px;
}

.library-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--white);
  line-height: 1.2;
}

.library-tagline {
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.6px;
  margin-top: 6px;
}

/* SECTION HEADERS */
.library-section-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 6px 4px 2px;
  margin-top: 10px;
}

.library-section-header:first-child {
  margin-top: 0;
}

/* RUN CARDS */
.library-main {
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.run-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.run-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan-faint);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.run-card:active::before {
  opacity: 1;
}

.run-card:active {
  border-color: rgba(0, 180, 216, 0.4);
  transform: scale(0.99);
}

.run-card-body {
  flex: 1;
  min-width: 0;
}

.run-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.difficulty-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid currentColor;
  flex-shrink: 0;
}

.difficulty-easy     { color: #4ade80; }
.difficulty-moderate { color: var(--cyan); }
.difficulty-hard     { color: #fb923c; }

.run-card-duration {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: auto;
  flex-shrink: 0;
}

.run-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-card-desc {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.run-card-arrow {
  color: var(--muted);
  font-size: 16px;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.run-card:active .run-card-arrow {
  color: var(--cyan);
}

/* LIBRARY STATES */
.library-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 24px;
  text-align: center;
}

.library-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.library-state strong {
  color: var(--white);
  font-weight: 600;
}

/* ============================================================
   VIEW: PLAYER
   ============================================================ */
.view-player {
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

/* PROGRESS BAR */
.player-progress-bar {
  height: 3px;
  background: #e2e8f0;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.player-progress-fill {
  height: 100%;
  background: var(--cyan);
  transition: width 0.6s ease;
  will-change: width;
}

/* HEADER */
.player-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 10px;
  flex-shrink: 0;
  gap: 8px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gray-bg);
  color: var(--text-mid);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: var(--transition);
  font-weight: 300;
}

.close-btn:active {
  background: var(--gray-border);
}

.player-run-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-spacer {
  width: 34px;
  flex-shrink: 0;
}

/* PLAYER CONTENT */
.player-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 28px;
  overflow: hidden;
}

/* CIRCLE TIMER */
.timer-container {
  position: relative;
  width: min(272px, calc(100vw - 56px));
  height: min(272px, calc(100vw - 56px));
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  touch-action: manipulation;
}

.timer-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.timer-track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 8;
}

.timer-fill {
  fill: var(--cyan);
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.timer-fill.faded {
  opacity: 0;
}

.timer-progress {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 8;
  stroke-linecap: round;
  /* rotation handled via SVG transform attribute */
  transition: stroke-dashoffset 0.98s linear;
  will-change: stroke-dashoffset;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  gap: 6px;
  padding: 20px;
}

.timer-press-label {
  font-size: 21px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.timer-sub-label {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  line-height: 1.3;
}

.timer-countdown {
  font-size: 52px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -2.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* INTERVAL LABEL */
.interval-label {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  letter-spacing: -0.4px;
  flex-shrink: 0;
  line-height: 1.3;
}

/* PAUSE / PLAY BUTTON */
.pause-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--gray-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  touch-action: manipulation;
}

.pause-btn:active {
  background: var(--gray-border);
  transform: scale(0.94);
}

.pause-icon {
  width: 22px;
  height: 22px;
  color: var(--text-dark);
}

/* NEXT UP CARD */
.next-up-card {
  background: var(--gray-bg);
  border-radius: 14px;
  padding: 14px 18px;
  width: 100%;
  flex-shrink: 0;
}

.next-up-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.next-up-content {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}

/* SKIP BUTTON */
.skip-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px 32px;
  flex-shrink: 0;
  transition: color 0.15s ease;
  letter-spacing: 0.1px;
  touch-action: manipulation;
  margin-top: 16px;
}

.skip-btn:active {
  color: var(--text-dark);
}

/* ============================================================
   VIEW: COMPLETION
   ============================================================ */
.view-completion {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 48px;
  overflow-y: auto;
}

.completion-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}

/* LOGO BLOCK */
.completion-logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.completion-logo-img {
  width: 180px;
  height: auto;
  display: block;
  margin: 0 auto 8px auto;
}

.completion-logo-placeholder {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  background: var(--navy-card);
  border: 1.5px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -1px;
}

.completion-club-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4.5px;
  text-transform: uppercase;
  color: var(--cyan);
}

/* HEADING */
.completion-heading {
  font-size: 30px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.8px;
  line-height: 1.2;
}

/* STATS CARD */
.completion-card {
  width: 100%;
  background: var(--navy-card);
  border: 1px solid var(--cyan);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.stat-row + .stat-row {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  text-align: right;
}

/* COMPARISON CALLOUT */
.comparison-block {
  width: 100%;
  background: var(--navy-card-alt);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.comparison-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}

.comparison-text {
  font-size: 19px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.45;
  letter-spacing: -0.3px;
}

/* BACK BUTTON */
.back-btn {
  background: transparent;
  border: 1.5px solid var(--cyan);
  color: var(--cyan);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 32px;
  border-radius: 100px;
  width: 100%;
  max-width: 260px;
  letter-spacing: 0.2px;
  transition: var(--transition);
  touch-action: manipulation;
}

.back-btn:active {
  background: var(--cyan);
  color: var(--navy);
  transform: scale(0.98);
}

/* ============================================================
   RESPONSIVE — SHORT SCREENS
   ============================================================ */
@media (max-height: 700px) {
  .timer-container {
    width: min(220px, calc(100vw - 56px));
    height: min(220px, calc(100vw - 56px));
  }

  .timer-countdown {
    font-size: 42px;
  }

  .timer-press-label {
    font-size: 17px;
  }

  .interval-label {
    font-size: 16px;
  }

  .player-header {
    padding: 10px 16px 8px;
  }

  .player-content {
    padding: 6px 20px 20px;
  }

  .next-up-card {
    padding: 11px 16px;
  }

  .pause-btn {
    width: 46px;
    height: 46px;
  }
}

@media (max-height: 580px) {
  .timer-container {
    width: min(180px, calc(100vw - 48px));
    height: min(180px, calc(100vw - 48px));
  }

  .timer-countdown {
    font-size: 34px;
  }

  .skip-btn {
    display: none;
  }
}

/* ============================================================
   TIER TOGGLE (shared: library + program view)
   ============================================================ */
.tier-toggle {
  display: flex;
  gap: 8px;
  padding: 0 0 14px;
}

.tier-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1.5px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
  transition: var(--transition);
  touch-action: manipulation;
  font-family: var(--font);
  cursor: pointer;
}

.tier-btn.active {
  background: var(--cyan);
  color: var(--navy);
}

.tier-btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}

/* ============================================================
   RUN STRONG FEATURED BLOCK
   ============================================================ */
.run-strong-block {
  background: var(--navy-card);
  border: 1.5px solid var(--cyan);
  border-radius: var(--radius);
  padding: 22px 20px;
  cursor: pointer;
  touch-action: manipulation;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.run-strong-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan-faint);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.run-strong-block:active::before { opacity: 1; }
.run-strong-block:active { transform: scale(0.99); }

.run-strong-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}

.run-strong-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.run-strong-desc {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 18px;
}

.run-strong-cta {
  display: inline-block;
  background: var(--cyan);
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 24px;
  border-radius: 100px;
  letter-spacing: 0.2px;
}

/* ============================================================
   VIEW: PROGRAM (RUN STRONG week list)
   ============================================================ */
.view-program {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
}

.program-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 10px;
  flex-shrink: 0;
  gap: 8px;
}

.program-title {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.program-tier-row {
  padding: 4px 16px 0;
  flex-shrink: 0;
}

.program-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 48px;
  -webkit-overflow-scrolling: touch;
}

.week-group {
  margin-bottom: 4px;
}

.week-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 10px 4px 8px;
  position: sticky;
  top: 0;
  background: var(--navy);
  z-index: 10;
}

.day-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.tier-prompt {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  line-height: 1.7;
  padding: 48px 16px;
}

.program-tier-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  font-weight: 300;
}

.week-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid currentColor;
  background: transparent;
  flex-shrink: 0;
}

/* ============================================================
   VIEW: COACHING SCREEN
   ============================================================ */
.view-coaching {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px 48px;
  position: relative;
}

.coaching-back {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-card);
  color: var(--white);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  touch-action: manipulation;
  transition: var(--transition);
}

.coaching-back:active {
  background: var(--navy-card-alt);
}

.coaching-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  padding: 80px 0 40px;
}

.coaching-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.coaching-logo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 14px;
  background: var(--navy-card);
  border: 1.5px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
}

.coaching-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.coaching-cue {
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.75;
  max-width: 340px;
}

.coaching-cta {
  background: var(--cyan);
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
  padding: 17px 40px;
  border-radius: 100px;
  width: 100%;
  max-width: 300px;
  letter-spacing: -0.2px;
  transition: var(--transition);
  touch-action: manipulation;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
}

.coaching-cta:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* ============================================================
   VIEW: SEGMENT PLAYER
   ============================================================ */
.view-segment-player {
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

.segment-counter {
  text-align: center;
  font-size: 12px;
  color: var(--text-mid);
  padding: 2px 0 4px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.seg-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 24px 12px;
  gap: 6px;
}

.seg-ring-area {
  align-self: center;
  flex-shrink: 0;
  margin: 4px 0;
}

.seg-ring-pct {
  font-size: 36px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -1px;
  line-height: 1;
}

.seg-distance-primary {
  font-size: 32px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -1px;
  text-align: center;
  padding: 0 24px;
  flex-shrink: 0;
  line-height: 1.1;
}

.seg-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: -0.3px;
  line-height: 1.3;
  text-align: center;
  padding: 4px 24px 0;
  flex-shrink: 0;
}

.seg-coaching-note {
  font-size: 14px;
  font-style: italic;
  color: #9ca3af;
  text-align: center;
  line-height: 1.55;
  padding: 16px 0;
  flex-shrink: 0;
}

.seg-next-btn {
  background: var(--cyan);
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
  padding: 18px 48px;
  border-radius: 100px;
  letter-spacing: -0.2px;
  touch-action: manipulation;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  width: 85%;
}

.seg-next-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.seg-next-up {
  font-size: 13px;
  color: var(--text-mid);
  text-align: center;
  flex-shrink: 0;
  margin-top: 12px;
}

.seg-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 24px 24px;
  flex-shrink: 0;
}

.view-segment-player .timer-container {
  flex-shrink: 0;
}

@media (max-height: 700px) {
  .view-segment-player .seg-ring-area,
  .view-segment-player .timer-container {
    width: min(200px, calc(100vw - 56px));
    height: min(200px, calc(100vw - 56px));
  }
  .seg-ring-pct { font-size: 28px; }
  .seg-distance-primary { font-size: 26px; }
  .seg-label { font-size: 16px; }
  .seg-controls { padding: 6px 24px 16px; }
}

@media (max-height: 580px) {
  .view-segment-player .seg-ring-area,
  .view-segment-player .timer-container {
    width: min(160px, calc(100vw - 48px));
    height: min(160px, calc(100vw - 48px));
  }
  .seg-coaching-card { display: none; }
}

/* ============================================================
   PROGRAM CARDS (Library)
   ============================================================ */
.program-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.program-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: var(--transition);
  position: relative;
}

.program-card:active {
  transform: scale(0.99);
  border-color: rgba(82, 209, 242, 0.35);
}

.program-card-image {
  height: 120px;
  background:
    radial-gradient(circle at 90% 20%, rgba(82, 209, 242, 0.18) 0%, transparent 60%),
    var(--navy-card);
  position: relative;
}

.program-card-body {
  padding: 16px 20px 20px;
}

.program-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}

.program-card-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1.1;
}

.program-card-desc {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 16px;
}

.program-card-cta {
  display: inline-block;
  background: var(--cyan);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 100px;
  letter-spacing: 0.2px;
  pointer-events: none;
}

/* ============================================================
   FOUNDATION RUNS VIEW (sub-categories)
   ============================================================ */
.foundation-section {
  margin-bottom: 6px;
}

.foundation-section-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 12px 4px 8px;
  opacity: 0.85;
}

.coming-soon-card {
  border: 1.5px dashed rgba(82, 209, 242, 0.3);
  border-radius: var(--radius);
  padding: 22px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.55;
  text-align: center;
  margin-bottom: 8px;
}
