/**
 * CrewLink Design System - Components
 */

/* =========================================================================
   TOP STICKY BAR & HEADER CARD
   ========================================================================= */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 10px;
  z-index: var(--z-header-card);
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  gap: var(--space-2);
  box-sizing: border-box;
}

.top-bar > * {
  pointer-events: auto;
}

.top-bar-left {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.runner-header-card {
  background: var(--color-bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--state-border);
  border-left: 4px solid var(--state-accent);
  border-radius: var(--radius-lg);
  padding: 0 0 0 8px;
  display: inline-flex;
  width: fit-content;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-md), 0 0 12px var(--state-glow);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.runner-header-card:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.runner-header-card:active {
  transform: scale(0.98);
}

/* Explicit Finished state glow */
[data-activity-state="finished"] .runner-header-card,
.runner-header-card.state-finished {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(6, 182, 212, 0.35);
}

@media (max-width: 640px) {
  .top-bar-left {
    flex: 1 1 auto;
    width: 100%;
  }

  .runner-header-card {
    width: 100%;
  }
}

.header-card-body {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
  width: 100%;
}

.header-card-actions {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-left: 1px solid var(--color-border-subtle);
  margin: 0 0 0 auto;
  padding: 3px;
  align-self: stretch;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
}

.header-card-actions .control-btn {
  width: var(--size-touch-target);
  min-width: var(--size-touch-target);
  min-height: var(--size-touch-target);
  align-self: stretch;
  padding: 0;
  margin: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  box-sizing: border-box;
  text-decoration: none;
}

.header-card-actions .control-btn::before {
  content: '';
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: -2px;
  right: -2px;
}

.header-card-actions .control-btn:first-child::before {
  left: -4px;
}

.header-card-actions .control-btn:last-child::before {
  right: -4px;
}

.header-card-actions .control-btn:last-child {
  border-top-right-radius: calc(var(--radius-lg) - 3px);
  border-bottom-right-radius: calc(var(--radius-lg) - 3px);
}

.header-card-actions .control-btn:hover {
  background: var(--color-bg-glass-input);
  color: var(--color-text-primary);
  border-color: var(--color-border-subtle);
}

.header-card-actions .control-btn:active {
  transform: scale(0.95);
}

.header-card-actions .control-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}

.header-card-actions .control-btn .crew-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--palette-sky);
  border: 1.5px solid var(--palette-slate-900);
  box-sizing: border-box;
}

.header-card-avatar-wrap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 0;
}

.header-card-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1.5px solid var(--color-border-glass);
}

.header-card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  padding: 5px 0;
  min-width: 0;
}

.header-card-row-top {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
}

.header-runner-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 40px;
  flex: 0 1 auto;
}


.activity-state-badge {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 0.78rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: none !important;
  flex-shrink: 0;
  min-width: 0;
  color: var(--state-badge-text);
}

.header-status-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-status-svg svg {
  width: 14px;
  height: 14px;
}

.header-status-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.9;
  margin-left: 2px;
  flex-shrink: 0;
}

.header-status-pin svg {
  width: 12px;
  height: 12px;
}

.header-card-row-bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  min-width: 0;
  max-width: 100%;
}

.header-course-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: var(--color-text-primary);
  min-width: 30px;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-course-svg {
  width: 12px;
  height: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.header-course-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-card-row-recency {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  min-width: 0;
  max-width: 100%;
}

.header-recency-container {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
  color: var(--color-text-muted);
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-recency-svg {
  width: 11px;
  height: 11px;
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

.header-recency-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-battery-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--palette-mint);
  box-shadow: none;
  flex-shrink: 0;
}

.header-battery-badge.battery-low {
  color: var(--palette-red);
}

.header-battery-svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.header-alerts-container {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.header-alert-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.header-alert-svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.header-alert-pill.drift {
  background: var(--color-paused-bg);
  color: var(--color-status-paused);
  border: 1px solid var(--color-paused-border);
}

.header-alert-pill.off-course {
  background: var(--color-status-alert);
  color: var(--palette-white);
  border: 1px solid var(--color-status-alert-bright);
  box-shadow: 0 0 8px var(--color-alert-glow);
  font-weight: 700;
}

.header-alert-pill.sos {
  background: var(--color-alert-bg);
  color: var(--color-status-alert);
  border: 1px solid var(--color-status-alert);
  box-shadow: 0 0 8px var(--color-alert-glow);
  animation: pulse-sos 1s infinite alternate ease-in-out;
}

@keyframes pulse-sos {
  0% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 2px var(--color-alert-glow);
  }
  100% {
    opacity: 0.55;
    transform: scale(1.04);
    box-shadow: 0 0 10px var(--color-status-alert);
  }
}

/* =========================================================================
   TOP-RIGHT 4-BUTTON ACTION CAPSULE
   ========================================================================= */
.top-bar-icons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.top-bar-capsule {
  background: var(--color-bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  box-sizing: border-box;
}

.top-bar-capsule .control-btn {
  width: var(--size-touch-target);
  height: var(--size-touch-target);
  min-width: var(--size-touch-target);
  min-height: var(--size-touch-target);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  box-sizing: border-box;
}

.top-bar-capsule .control-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.top-bar-capsule .control-btn img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1.5px solid var(--palette-slate-500);
}

.top-bar-capsule .control-btn.control-btn-avatar {
  padding: 0;
}

.top-bar-avatar-monogram {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--palette-slate-800);
  color: var(--palette-slate-50);
  border: 1.5px solid var(--palette-slate-500);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.top-bar-capsule .control-btn .crew-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--palette-sky);
  border: 1.5px solid var(--palette-slate-900);
  box-sizing: border-box;
}

.top-bar-capsule .control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-primary);
}

.top-bar-capsule .control-btn:active {
  transform: scale(0.95);
}

/* =========================================================================
   HERO ONBOARDING LANDING (ROOT / DEMO)
   ========================================================================= */
.hero-landing {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 1800;
  display: flex;
  flex-direction: column;
  background-color: var(--palette-slate-950);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.hero-fold {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  padding: clamp(24px, 5vh, 48px) clamp(24px, 5vw, 56px);
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.hero-fold::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/hero.webp');
  background-size: cover;
  background-position: 56% 48%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  animation: fadeIn 0.4s ease;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  color: var(--palette-slate-50);
  letter-spacing: 1px;
  margin: 0;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.95);
  line-height: 1.05;
}

.hero-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--color-text-primary);
  margin: 10px 0 20px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  font-weight: 500;
  line-height: 1.45;
}

.hero-track-btn {
  background: var(--color-brand-primary);
  color: var(--palette-slate-50);
  border: 1px solid transparent;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px var(--color-brand-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
}

.hero-track-btn:hover {
  background: var(--color-brand-primary-hover);
  border-color: var(--color-brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(var(--palette-brand-rgb), 0.45);
  filter: brightness(1.1);
}

.hero-track-btn:active {
  background: var(--color-brand-primary-active);
  border-color: var(--color-brand-primary-active);
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(var(--palette-brand-rgb), 0.3);
  filter: brightness(0.95);
}

.hero-secondary-btn {
  background: rgba(30, 41, 59, 0.85);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-strong);
  padding: 12px 28px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
  backdrop-filter: blur(8px);
}

.hero-secondary-btn:hover {
  background: rgba(71, 85, 105, 0.95);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--palette-white);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  filter: brightness(1.15);
}

.hero-secondary-btn:active {
  background: rgba(51, 65, 85, 0.95);
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
  filter: brightness(0.95);
}

/* =========================================================================
   HOMESCREEN ACTION STACK & UNIFIED 44PX CAPSULES
   ========================================================================= */
.hero-action-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2); /* 8px consistent gap */
  width: 100%;
  max-width: 300px;
  margin-top: 18px;
}

.hero-capsule,
.hero-action-stack .hero-capsule {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 300px !important;
  height: 44px !important;
  padding: 0 16px 0 12px !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-lg) !important; /* 12px sleek rounded corners */
  font-family: var(--font-sans) !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.2px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  color: var(--palette-slate-100);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease, filter 0.16s ease;
}

.hero-capsule-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.hero-capsule-visual,
.runner-pill-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-capsule-visual {
  width: 32px;
  height: 32px;
}

.runner-pill-visual {
  width: 22px;
  height: 22px;
}

.hero-capsule-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1px solid var(--color-border-glass);
  flex-shrink: 0;
}

.hero-capsule-monogram {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--palette-slate-800);
  color: var(--palette-slate-50);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--palette-slate-500);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
}

.hero-capsule.is-primary .hero-capsule-monogram,
.hero-capsule.is-athlete-idle .hero-capsule-monogram {
  background: var(--color-bg-glass-frosted);
  border: 1.5px solid var(--color-border-glass-frosted);
  color: var(--palette-slate-50);
  box-shadow: none;
}

.hero-capsule-visual .runner-pill-dot,
.runner-pill-visual .runner-pill-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  border: 1px solid var(--palette-slate-900);
  z-index: 2;
}

.hero-capsule.is-demo .hero-capsule-visual .runner-pill-dot {
  position: static;
  border: 1px solid var(--palette-slate-900);
}

.hero-capsule-icon,
.hero-capsule-visual .act-svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--palette-slate-300);
}

.hero-capsule-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1.2;
  color: inherit;
}

.hero-capsule:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--palette-slate-50);
  border-color: var(--color-border-strong);
  background: var(--color-bg-surface-elevated);
}

.hero-capsule:active {
  transform: translateY(0);
}

/* =========================================================================
   2-TIER COLOR ARCHITECTURE:
   Tier 1 (Primary CTA): Solid Brand Orange
   Tier 2 (Supporting Actions): Neutral Dark Slate Glass
   ========================================================================= */

/* Primary Action Capsule (Solid Brand Orange) */
.hero-capsule.is-primary,
.hero-capsule.is-athlete-idle {
  background: var(--color-brand-primary) !important;
  border-color: var(--color-brand-primary) !important;
  color: var(--palette-slate-50) !important;
  box-shadow: 0 4px 16px var(--color-brand-glow) !important;
}

.hero-capsule.is-primary .hero-capsule-icon,
.hero-capsule.is-primary .hero-capsule-visual .act-svg,
.hero-capsule.is-primary .hero-capsule-label {
  color: var(--palette-slate-50) !important;
}

.hero-capsule.is-primary:hover,
.hero-capsule.is-athlete-idle:hover {
  background: var(--color-brand-primary-hover) !important;
  border-color: var(--color-brand-primary-hover) !important;
  box-shadow: 0 6px 20px rgba(var(--palette-brand-rgb), 0.45) !important;
  filter: brightness(1.08);
}

/* Secondary Buttons & Supporting Capsules (Neutral Dark Slate Glass) */
.hero-capsule.is-secondary {
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--color-border-strong);
  color: var(--palette-slate-100);
}

.hero-capsule.is-secondary .hero-capsule-icon,
.hero-capsule.is-secondary .hero-capsule-visual .act-svg {
  color: var(--palette-slate-300);
}

.hero-capsule.is-secondary:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--palette-white);
}

.hero-capsule.is-secondary:hover .hero-capsule-icon,
.hero-capsule.is-secondary:hover .hero-capsule-visual .act-svg {
  color: var(--palette-slate-100);
}

/* Secondary runner pills with active/completed status keep clean hover states */
.hero-capsule.is-secondary.is-active:hover {
  border-color: var(--palette-lime);
  box-shadow: var(--shadow-md), 0 0 10px var(--color-active-glow);
}

.hero-capsule.is-secondary.is-completed:hover {
  border-color: var(--palette-cyan);
  box-shadow: var(--shadow-md), 0 0 10px rgba(var(--palette-cyan-rgb), 0.35);
}

/* Demo Capsule */
.hero-capsule.is-demo {
  color: var(--palette-slate-200);
}

.hero-demo-trigger {
  margin-top: 18px;
  display: flex;
  align-items: center;
}

/* Unified Runner Pill & Switcher Foundation */
.runner-pill,
.hero-demo-pill,
.runner-switcher-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 5px 14px 5px 6px;
  color: var(--palette-slate-100);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  max-width: 240px;
}

/* Pills without avatar/monogram get balanced left padding */
.runner-pill:not(:has(.runner-pill-avatar)):not(:has(.runner-pill-monogram)),
.hero-demo-pill:not(:has(.runner-pill-avatar)):not(:has(.runner-pill-monogram)) {
  padding-left: 12px;
}

/* Consistent Base Hover */
.runner-pill:hover,
.hero-demo-pill:hover,
.runner-switcher-pill:hover {
  background: var(--color-bg-surface-elevated);
  border-color: var(--color-border-strong);
  color: var(--palette-slate-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.runner-pill:active,
.hero-demo-pill:active,
.runner-switcher-pill:active {
  transform: translateY(0);
}

/* Active workout pill (recording or paused workout) */
.runner-pill.is-active,
.hero-demo-pill.is-active {
  border-color: var(--color-active-border);
}

.runner-pill.is-active:hover,
.hero-demo-pill.is-active:hover {
  border-color: var(--palette-lime);
  box-shadow: var(--shadow-md), 0 0 10px var(--color-active-glow);
}

/* Completed workout pill (finished workout within 14h grace window) */
.runner-pill.is-completed {
  border-color: rgba(var(--palette-cyan-rgb), 0.4);
}

.runner-pill.is-completed:hover {
  border-color: var(--palette-cyan);
  box-shadow: var(--shadow-md), 0 0 10px rgba(var(--palette-cyan-rgb), 0.35);
}

/* Channel Active Runners Stack (Nested directly under runner-header-card in top-bar-left) */
.channel-floating-runner-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  pointer-events: auto;
  margin-top: 0;
}

.runner-pill-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1px solid var(--color-border-glass);
  flex-shrink: 0;
}

.runner-pill-monogram {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--palette-slate-800);
  color: var(--palette-slate-50);
  font-weight: 700;
  font-size: 0.62rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--palette-slate-500);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
}

.runner-pill-dot,
.hero-demo-live-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--color-status-active);
  box-shadow: 0 0 6px var(--color-active-glow);
  border: 1px solid var(--palette-slate-900);
  box-sizing: border-box;
  flex-shrink: 0;
  animation: pulse-live-dot 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Solid cyan dot for completed workouts (no pulsing animation) */
.runner-pill-dot.is-completed {
  background: var(--palette-cyan);
  box-shadow: 0 0 6px rgba(var(--palette-cyan-rgb), 0.5);
  border: 1px solid var(--palette-slate-900);
  animation: none;
}

.runner-pill .runner-pill-name,
.hero-demo-pill .runner-pill-name,
.runner-switcher-pill .runner-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

/* Hero Floating Scroll Cue (Frameless High-Contrast Outline & Shadow) */
.hero-scroll-cue {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  align-self: center;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--palette-white);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.hero-scroll-cue:hover {
  color: var(--palette-cyan);
  transform: translateY(3px);
}

.hero-scroll-arrow {
  width: 38px;
  height: 38px;
  stroke: currentColor;
  stroke-width: 2.8;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
  animation: floatArrow 2.2s ease-in-out infinite;
}

@keyframes floatArrow {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.85;
  }
  50% {
    transform: translateY(6px);
    opacity: 1;
  }
}

/* =========================================================================
   HERO HOW IT WORKS SECTION (ON-PAGE)
   ========================================================================= */
.hero-how-section {
  position: relative;
  z-index: 1;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(30, 41, 59, 0.4) 0%, var(--palette-slate-950) 80%);
  border-top: 1px solid var(--color-border-subtle);
  padding: clamp(48px, 8vh, 72px) clamp(20px, 5vw, 56px) 48px;
  box-sizing: border-box;
}

.hero-how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.hero-how-card {
  background: var(--color-bg-glass-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-how-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-lg);
}

.hero-how-step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--palette-sky);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-how-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--palette-slate-50);
  margin: 0;
  letter-spacing: 0.3px;
}

.hero-how-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

.hero-how-desc code {
  color: var(--palette-sky);
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 5px;
  border-radius: 4px;
}

.hero-connectiq-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: var(--palette-sky);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.hero-connectiq-btn:hover {
  color: var(--palette-cyan);
  text-decoration: underline;
}

.hero-how-demo-card {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-how-demo-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.hero-how-demo-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-how-demo-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--palette-sky);
  letter-spacing: 0.3px;
}

.hero-how-demo-desc {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.hero-how-demo-btn {
  background: rgba(56, 189, 248, 0.12);
  color: var(--palette-sky);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.hero-how-demo-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  color: var(--palette-slate-50);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .hero-how-demo-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 20px;
    gap: 14px;
  }
  .hero-how-demo-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================================================
   HERO FEATURE HIGHLIGHTS SECTION
   ========================================================================= */
.hero-features-section {
  position: relative;
  z-index: 1;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(30, 41, 59, 0.3) 0%, var(--palette-slate-950) 80%);
  border-top: 1px solid var(--color-border-subtle);
  padding: clamp(48px, 8vh, 72px) clamp(20px, 5vw, 56px) 60px;
  box-sizing: border-box;
}

.hero-features-container {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hero-features-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hero-features-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--palette-slate-50);
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.15;
}

.hero-features-subtitle {
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.hero-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.hero-feature-card {
  background: var(--color-bg-glass-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-lg);
}

.hero-feature-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-feature-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.hero-feature-icon.lime { color: var(--palette-lime); }
.hero-feature-icon.sky { color: var(--palette-sky); }
.hero-feature-icon.amber { color: var(--palette-amber); }
.hero-feature-icon.brand { color: var(--palette-brand); }
.hero-feature-icon.cyan { color: var(--palette-cyan); }
.hero-feature-icon.mint { color: var(--palette-mint); }

.hero-feature-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--palette-slate-50);
  margin: 0;
  letter-spacing: 0.3px;
}

.hero-feature-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Call To Action Banner */
.hero-cta-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 4vh, 36px) clamp(20px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
  margin-top: 10px;
}

.hero-cta-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 580px;
}

.hero-cta-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--palette-slate-50);
  margin: 0;
}

.hero-cta-desc {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.4;
}

.hero-cta-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Landing Footer */
.hero-landing-footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: 24px 20px;
  width: 100%;
  box-sizing: border-box;
  background: var(--palette-slate-950);
}

.hero-footer-content {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-footer-links {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero-footer-links a {
  color: var(--palette-sky);
  text-decoration: none;
  transition: color 0.15s;
}

.hero-footer-links a:hover {
  color: var(--palette-cyan);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .hero-fold {
    padding: clamp(20px, 4vh, 32px) clamp(16px, 4vw, 24px);
  }
  .hero-fold::before {
    inset: 0;
    background-image: url('/hero.webp');
    background-position: 56% 50%;
    background-size: cover;
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-actions {
    width: 100%;
  }
  .hero-track-btn,
  .hero-secondary-btn {
    width: 100%;
  }
  .hero-scroll-cue {
    margin-top: 24px;
    margin-bottom: 8px;
    align-self: center;
  }
  .hero-cta-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-cta-buttons {
    width: 100%;
  }
  .hero-cta-buttons .hero-track-btn,
  .hero-cta-buttons .hero-secondary-btn {
    width: 100%;
  }
}

/* =========================================================================
   APP LOADING OVERLAY
   ========================================================================= */
.channel-loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--palette-slate-950);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.channel-loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.channel-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.channel-loading-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-brand-primary);
  letter-spacing: 1.5px;
  text-shadow: 0 2px 10px rgba(255, 87, 34, 0.4);
}

.channel-loading-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--color-brand-primary);
  border-radius: 50%;
  animation: spin-loader 0.8s linear infinite;
}

.control-btn.btn-loading svg,
.btn-icon-loading svg {
  animation: spin-loader 0.8s linear infinite;
  opacity: 0.85;
}

.recents-loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.recents-loading-container .loading-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-top-color: var(--palette-cyan);
}

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

/* =========================================================================
   TOAST NOTIFICATION
   ========================================================================= */
.toast-container {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 90vw;
}

.toast-item {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--palette-white);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--color-border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.toast-item.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-item.toast-success {
  border-color: rgba(var(--palette-lime-rgb), 0.5);
  background: rgba(6, 78, 59, 0.94);
  color: var(--palette-white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 15px rgba(var(--palette-lime-rgb), 0.25);
}

.toast-item.toast-error {
  border-color: rgba(var(--palette-red-rgb), 0.5);
  background: rgba(127, 29, 29, 0.94);
  color: var(--palette-white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 15px rgba(var(--palette-red-rgb), 0.25);
}

.toast-item.toast-warning {
  border-color: rgba(var(--palette-amber-rgb), 0.5);
  background: rgba(120, 53, 15, 0.94);
  color: var(--palette-white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 15px rgba(var(--palette-amber-rgb), 0.25);
}

.toast-item.toast-info {
  border-color: rgba(var(--palette-sky-rgb), 0.5);
  background: rgba(15, 23, 42, 0.95);
  color: var(--palette-sky);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 15px rgba(var(--palette-sky-rgb), 0.2);
}

.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 87, 34, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 1.1rem;
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.toast.show {
  opacity: 1;
}

/* =========================================================================
   GENERIC BUTTONS & BADGES
   ========================================================================= */
.btn-save, .btn-primary {
  height: 38px;
  padding: 0 16px;
  box-sizing: border-box;
  background-color: var(--color-brand-primary);
  color: var(--palette-white);
  border: 1px solid var(--color-brand-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-save:hover, .btn-primary:hover {
  background-color: var(--color-brand-primary-hover);
  border-color: var(--color-brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--color-brand-glow);
}

.btn-save:active, .btn-primary:active {
  background-color: var(--color-brand-primary-active);
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  height: 38px;
  padding: 0 16px;
  box-sizing: border-box;
  background-color: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:hover {
  background-color: var(--palette-slate-600);
  border-color: var(--color-border-strong);
  color: var(--palette-white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-secondary:active {
  background-color: var(--color-bg-elevated);
  transform: translateY(0);
  box-shadow: none;
}

.btn-cancel, .btn-dismiss {
  height: 38px;
  padding: 0 16px;
  box-sizing: border-box;
  background-color: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-cancel:hover, .btn-dismiss:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.btn-cancel:active, .btn-dismiss:active {
  transform: scale(0.98);
}

.btn-danger {
  height: 38px;
  padding: 0 16px;
  box-sizing: border-box;
  background-color: transparent;
  color: var(--color-status-alert);
  border: 1px solid var(--color-alert-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-danger:hover {
  background-color: rgba(var(--palette-red-rgb), 0.12);
  border-color: var(--color-status-alert);
  color: var(--palette-red);
}

.btn-danger:active {
  transform: scale(0.98);
}

.btn-lg {
  height: 42px !important;
  font-size: 0.95rem !important;
  padding: 0 20px !important;
}

.btn-sm {
  height: 30px !important;
  font-size: 0.78rem !important;
  padding: 0 10px !important;
}

.btn-full {
  width: 100% !important;
}

.pairing-code-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pairing-code-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--color-brand-primary);
  letter-spacing: 2px;
}

/* iOS Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--color-bg-elevated);
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--color-status-active);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
