/* ==========================================
   TRAINING PAGE BASE STYLES
   ========================================== */
.training-hero {
  background: rgba(0, 0, 0, 0.85);
  padding: 120px 24px 80px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .training-hero { justify-content: center; }
  .training-card { margin-left: auto; margin-right: auto; }
}

.training-card {
  max-width: 820px;
  width: 100%;
  background: #000000;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: 32px;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.training-card h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
}

.training-card h1 span {
  background: linear-gradient(135deg, #facc15, #eab308);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.training-sub {
  color: #94a3b8;
  font-size: 1rem;
  margin-bottom: 2rem;
  border-left: 3px solid #eab308;
  padding-left: 1rem;
  line-height: 1.5;
}

/* ==========================================
   TRANSFORMATION SHOWCASE
   ========================================== */
.transformation-showcase {
  background: linear-gradient(135deg, #0b0d16, #111827);
  padding: 50px 24px 40px;
  border-bottom: 1px solid rgba(234, 179, 8, 0.1);
  margin-bottom: 30px;
  border-radius: 16px;
}
.transformation-inner { max-width: 100%; margin: 0 auto; text-align: center; }
.testimonial-badge {
  display: inline-block;
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  padding: 4px 16px;
  border-radius: 40px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.transformation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 520px;
  margin: 0 auto 20px;
}
.before-image, .after-image {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(234, 179, 8, 0.15);
  transition: transform 0.3s;
}
.before-image:hover, .after-image:hover { transform: scale(1.02); }
.before-image img, .after-image img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  background: #1e293b;
}
.before-image .label, .after-image .label {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.before-image .label { border: 1px solid rgba(255, 68, 68, 0.3); }
.after-image .label { border: 1px solid rgba(234, 179, 8, 0.3); }
.testimonial {
  max-width: 600px;
  margin: 0 auto 12px;
  color: #e2e8f0;
  font-size: 1.05rem;
  line-height: 1.8;
  font-style: italic;
  padding: 0 12px;
}
.testimonial cite {
  display: block;
  margin-top: 6px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 500;
}
.transformation-cta { color: #94a3b8; font-size: 0.95rem; margin-top: 12px; }

/* ==========================================
   QUESTIONNAIRE & RESULTS
   ========================================== */
.question {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.question:last-of-type { border-bottom: none; }
.q-label {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #e2e8f0;
}
.q-label .q-num {
  display: inline-block;
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.7rem;
  border-radius: 40px;
  margin-right: 0.6rem;
  letter-spacing: 0.3px;
}
.options { display: flex; flex-direction: column; gap: 0.6rem; }
.options label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: #1e293b;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  font-size: 0.95rem;
  color: #e2e8f0;
}
.options label:hover { background: #2d3a4f; border-color: rgba(234, 179, 8, 0.2); }
.options input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #475569;
  border-radius: 50%;
  flex-shrink: 0;
  transition: 0.15s;
  position: relative;
}
.options input[type="radio"]:checked {
  border-color: #eab308;
  background: #eab308;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2);
}
.options input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 6px; height: 6px;
  background: #111827;
  border-radius: 50%;
}
.btn-submit {
  background: #eab308;
  border: none;
  color: #111827;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.9rem 1.8rem;
  border-radius: 60px;
  width: 100%;
  cursor: pointer;
  transition: 0.15s;
  margin-top: 0.5rem;
}
.btn-submit:hover { background: #ca8a04; transform: scale(0.98); }

.result-box {
  margin-top: 2rem;
  padding: 1.8rem 1.5rem;
  background: #0f172a;
  border-radius: 24px;
  border: 1px solid rgba(234, 179, 8, 0.15);
  display: none;
}
.result-box.show { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
.result-title { font-size: 1.5rem; font-weight: 700; color: #facc15; margin-bottom: 0.5rem; }
.result-desc { color: #cbd5e1; line-height: 1.6; font-size: 0.98rem; }
.week-grid { margin-top: 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.week-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  border-left: 3px solid #eab308;
}
.week-card .week-label { font-weight: 700; color: #facc15; font-size: 0.8rem; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 0.3rem; }
.week-card .week-focus { font-size: 0.85rem; color: #e2e8f0; }
.week-card .week-focus span { display: inline-block; background: #0f172a; padding: 0.1rem 0.5rem; border-radius: 30px; font-size: 0.7rem; color: #94a3b8; margin-top: 0.3rem; }
.start-timer-btn {
  margin-top: 20px; width: 100%; padding: 14px;
  background: #eab308; color: #111827; border: none; border-radius: 12px;
  font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.start-timer-btn:hover { background: #ca8a04; transform: scale(0.98); }
.start-timer-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================
   PROGRESS TRACKER
   ========================================== */
.progress-tracker { background: #0f172a; border-radius: 16px; padding: 20px; margin-bottom: 24px; border: 1px solid rgba(234, 179, 8, 0.1); }
.progress-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.progress-header h3 { color: #fff; font-size: 1.1rem; line-height: 1.2; margin: 0; }
.progress-reset-btn { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); padding: 6px 14px; border-radius: 8px; font-size: 11px; cursor: pointer; flex-shrink: 0; white-space: nowrap; }
.date-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.date-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.date-field label { color: #94a3b8; font-size: 12px; font-weight: 500; text-transform: uppercase; }
.date-input { width: 100%; box-sizing: border-box; background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 10px 12px; color: #f1f5f9; font-size: 14px; outline: none; -webkit-appearance: none; appearance: none; display: block; font-family: inherit; }
.workout-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-item { background: #1e293b; border-radius: 12px; padding: 12px; text-align: center; }
.stat-number { display: block; color: #facc15; font-size: 24px; font-weight: 800; }
.stat-label { display: block; color: #94a3b8; font-size: 11px; text-transform: uppercase; margin-top: 2px; }
.progress-week-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 16px; }
.week-dot { aspect-ratio: 1; border-radius: 50%; border: 2px solid #334155; background: transparent; }
.week-dot.completed { border-color: #22c55e; background: #22c55e; }
.week-dot.missed { border-color: #ef4444; background: #ef4444; }
.week-dot.current { border-color: #eab308; }
.workout-status { background: #1e293b; border-radius: 12px; padding: 12px 16px; text-align: center; }
.workout-status p { color: #94a3b8; font-size: 14px; margin: 0; }

@media (max-width: 500px) {
  .date-selector { grid-template-columns: 1fr; }
}

/* ==========================================
   FULL-SCREEN TIMER (MAIN OVERLAY)
   ========================================== */
body.timer-active { overflow: hidden; }

#timerSection {
  position: fixed;
  top: 70px; /* Sits perfectly below the top nav */
  left: 0;
  width: 100vw;
  height: calc(100dvh - 145px); /* Fills the gap between top (70px) and bottom (75px) navs */
  z-index: 9999;
  background: #06160e; /* Solid background to prevent bleeding */
  padding: 0; 
  margin: 0;
  box-sizing: border-box;
  display: none;
  align-items: stretch;
  justify-content: center;
}

#timerSection.active, body.timer-active #timerSection { display: flex; }

.timer-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 0;
  margin: 0;
}

.timer-card-full {
  width: 100%;
  height: 100%;
  background: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}




/* ==========================================
   PREMIUM CONTROL BAR
   ========================================== */
.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #111310, #080908);
  border: 1px solid rgba(255, 204, 0, 0.2);
  box-sizing: border-box;
  gap: 10px;
  margin-bottom: 12px;
}

.timer-brand { flex-shrink: 0; }
.timer-total {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 30px;
  background: #0b0c09; border: 2px solid #d9ad00;
  color: #a9aaa7; font-size: 11px; font-weight: 600;
  text-transform: uppercase; margin: 0;
}
.timer-total span { color: white; font-size: 18px; font-weight: 800; background: transparent; padding: 0; line-height: 1; }

.timer-controls-group { display: flex; align-items: center; gap: 10px; flex-grow: 1; min-width: 0; }
#sb-volume-container { flex-grow: 1; display: flex; align-items: center; }
#sb-volume-slider { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 10px; background: #333; outline: none; cursor: pointer; }
#sb-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: white; border: 2px solid #ffcc00; cursor: pointer;
}

#musicToggle, #timerClose {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: #0b0c09; border: 2px solid #d9ad00;
  color: white; font-size: 15px; cursor: pointer;
  flex-shrink: 0; margin: 0; padding: 0;
}
#musicToggle:hover, #timerClose:hover { background: #d9ad00; color: black; }

/* ==========================================
   WORKOUT UI ELEMENTS
   ========================================== */
.demo-wrapper { width: 100%; height: 32vh; min-height: 180px; max-height: 280px; margin-bottom: 12px; border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); position: relative; flex-grow: 0; flex-shrink: 1; }
#exerciseDemo { position: absolute; inset: 0; width: 100%; height: 100%; background: #0a110c; border-radius: 12px; box-shadow: inset 0 0 20px rgba(0,0,0,0.6); }
#exerciseDemo img, #exerciseDemo canvas { width: 100%; height: 100%; object-fit: contain; }

.phase-badge { font-size: 13px; padding: 6px 20px; border-radius: 20px; margin: 0 auto 12px; font-weight: 800; letter-spacing: 1px; }
.phase-badge.work { background: #eab308; color: #000; }
.phase-badge.rest { background: #22c55e; color: #000; }
.phase-badge.preview { background: #3b82f6; color: #fff; }

.current-exercise-name { font-size: 42px; line-height: 1.1; color: #fff; text-align: center; margin-bottom: 4px; font-weight: 800; letter-spacing: -1px; }
.giant-timer { font-size: 86px; font-weight: 800; color: #fff; text-align: center; line-height: 1; margin: 8px 0 12px 0; letter-spacing: -3px; font-family: monospace; text-shadow: 0 4px 20px rgba(0,0,0,0.3); flex-shrink: 0; }
.rest-subtitle { font-size: 16px; color: #94a3b8; text-align: center; margin-bottom: 8px; font-weight: 500; }

.timer-progress-bar-full { margin-bottom: 12px; width: 100%; }
.progress-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); }
.progress-fill { background: #eab308; border-radius: 3px; transition: width 0.5s ease; }
.progress-labels { display: flex; justify-content: space-between; font-size: 13px; color: #94a3b8; margin-top: 6px; }
.progress-labels span:first-child { display: none; }

.timer-round-info { font-size: 16px; color: #eab308; font-weight: 700; text-align: center; margin-bottom: 20px; }

.next-up-card { cursor: pointer; display: flex; align-items: center; transition: transform 0.1s ease, background 0.2s; background: rgba(255,255,255,0.04); border-radius: 16px; padding: 12px; width: 100%; gap: 16px; margin-bottom: 20px; border: 1px solid rgba(255,255,255,0.06); text-align: left; flex-shrink: 0; }
.next-up-card:active { transform: scale(0.98); background: rgba(255,255,255,0.08); }
.next-thumb { width: 80px; height: 60px; border-radius: 8px; background-size: cover; background-position: center; background-color: #000; flex-shrink: 0; }
.next-info { flex: 1; display: flex; flex-direction: column; }
.next-label { font-size: 11px; color: #94a3b8; font-weight: 700; letter-spacing: 1px; margin-bottom: 2px; }
.next-name { font-size: 18px; color: #fff; font-weight: 700; }
.next-arrow { font-size: 28px; color: #94a3b8; margin-right: 8px; font-weight: 300; }

.timer-controls-full { display: flex; gap: 12px; width: 100%; margin-top: auto; align-items: stretch; z-index: 50; flex-shrink: 0; }
.timer-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,0.08); color: #fff; border-radius: 16px; padding: 8px 4px; font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,0.05); height: 70px; line-height: 1.1; gap: 4px; box-sizing: border-box; }
.timer-btn.primary { flex: 2; background: #eab308; color: #000; font-size: 18px; font-weight: 800; flex-direction: row; gap: 8px; }
.btn-icon { font-size: 18px; display: block; margin: 0; }

/* Hide old deprecated elements */
.timer-display-full, .timer-exercise-info, .rest-countdown { display: none; }

/* ==========================================
   MODALS (EXIT & GUIDE)
   ========================================== */
.guide-modal-overlay, .exit-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 999999; display: none; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity 0.3s ease;
}
.guide-modal-overlay.active, .exit-modal-overlay.active { display: flex; opacity: 1; }

.guide-modal-content, .exit-modal-card {
  background: #0f172a; border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 24px; max-width: 600px; width: 100%;
  padding: 32px 24px; text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  transform: translateY(20px); transition: transform 0.3s ease;
}
.guide-modal-overlay.active .guide-modal-content, .exit-modal-overlay.active .exit-modal-card { transform: translateY(0); }

.exit-modal-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.exit-modal-title { color: #fff; font-size: 1.5rem; font-weight: 800; margin-bottom: 12px; }
.exit-modal-text { color: #94a3b8; font-size: 0.95rem; line-height: 1.5; margin-bottom: 24px; }
.exit-modal-buttons { display: flex; gap: 12px; flex-direction: column; }
.exit-btn-keep { background: #eab308; color: #111827; border: none; padding: 16px; border-radius: 12px; font-size: 1rem; font-weight: 800; cursor: pointer; transition: 0.2s; }
.exit-btn-keep:hover { background: #ca8a04; transform: scale(0.98); }
.exit-btn-leave { background: rgba(255, 255, 255, 0.05); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); padding: 14px; border-radius: 12px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.exit-btn-leave:hover { background: rgba(239, 68, 68, 0.1); }

/* ==========================================
   MISC & CANVAS
   ========================================== */
#sb-orbital-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -10; pointer-events: none; }
.end-card-action-wrap { margin-bottom: 40px; }

/* ==========================================
   RESPONSIVE TIMER LAYOUT (MOBILE)
   ========================================== */
@media (max-width: 600px) {
  .demo-wrapper { flex: 0 1 30vh; height: 25vh; min-height: 120px; margin-bottom: 4px; border-radius: 12px; }
  .giant-timer { font-size: 64px; margin: 4px 0 4px 0; }
  .current-exercise-name { font-size: 28px; margin-bottom: 0; }
  .timer-progress-bar-full { margin-bottom: 4px; }
  .progress-labels { display: none; }
  .timer-round-info { margin-bottom: 8px; font-size: 14px; }
  
  .next-up-card { margin-bottom: 12px; padding: 8px 12px; }
  .next-thumb { width: 50px; height: 40px; }
  .next-name { font-size: 16px; }
  
  .timer-controls-full { margin-bottom: 0; flex-shrink: 0; }
  .timer-btn { height: 65px; font-size: 12px; }
  
  .end-card-action-wrap { margin-bottom: calc(85px + env(safe-area-inset-bottom, 20px)); }
}

@media (max-width: 400px) {
  .giant-timer { font-size: 72px; }
  .current-exercise-name { font-size: 32px; }
  .demo-wrapper { height: 28vh; min-height: 180px; }
  .next-up-card { padding: 8px; gap: 8px; }
  .timer-btn { height: 65px; font-size: 12px; }
}

@media (min-width: 768px) {
  .demo-wrapper { max-width: 100%; margin: 0 auto 24px auto; }
  .giant-timer { font-size: 120px; }
  .current-exercise-name { font-size: 54px; }
  .next-up-card { max-width: 600px; margin: 0 auto 24px auto; }
  .timer-controls-full { max-width: 600px; margin: 0 auto; }
  .timer-round-info { margin-bottom: 24px; }
}

/* Lock body scrolling so page content doesn't peek out below */
body.timer-active {
  overflow: hidden;
  height: 100dvh;
}

/* 1. Cover the whole screen, but use padding to clear the navs */
#timerSection {
  top: 0;
  height: 100dvh;
  padding-top: 70px; /* Clears top header */
  padding-bottom: 75px; /* Clears bottom nav */
  background: #06160e; /* Solid background */
}

/* 2. Make the card fill the padded space */
.timer-card-full {
  height: 100%;
  max-height: 100%;
}

/* 3. Desktop specific layout: Center the card like a modal */
@media (min-width: 769px) {
  #timerSection {
    padding: 90px 20px 90px 20px; /* More breathing room */
    background: rgba(6, 22, 14, 0.95); /* Slight transparency for modal feel */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    align-items: center; /* Center vertically */
  }

  .timer-overlay {
    align-items: center;
  }

  .timer-card-full {
    max-width: 800px; /* Constrain width */
    height: auto; /* Let it size to content */
    max-height: 90vh; /* Prevent it from touching edges */
    border-radius: 24px; /* Bring back rounded corners */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  }

  /* Fix the gap on desktop by pushing buttons up */
  .timer-controls-full {
    margin-top: 30px;
  }
  
  /* Make video bigger on desktop to fill the space better */
  .demo-wrapper {
    height: 40vh;
    max-height: 350px;
  }
}

/* Lock body scrolling */
body.timer-active {
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* Force both navs to stay fixed and above the timer */
body.timer-active .site-header,
body.timer-active .bottom-nav {
  display: flex;
  visibility: visible;
  opacity: 1;
  z-index: 10005;
  position: fixed;
}

body.timer-active .site-header {
  top: 0;
  left: 0;
  width: 100%;
}

body.timer-active .bottom-nav {
  bottom: 0;
  left: 0;
  width: 100%;
}

/* Position the timer perfectly between the two navs */
#timerSection {
  position: fixed;
  top: 70px; /* Height of top header */
  left: 0;
  width: 100vw;
  height: calc(100dvh - 145px); /* 70px top + 75px bottom nav */
  background-color: #06160e; /* Solid green so no bleeding */
  z-index: 9999;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  display: none; /* JS toggles this to flex */
  align-items: stretch;
  justify-content: center;
}

#timerSection.active, body.timer-active #timerSection {
  display: flex;
}

/* Ensure the inner card takes up exactly the remaining space */
.timer-card-full {
  width: 100%;
  height: 100%;
  background-color: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* Desktop Modal Override (keeps it looking nice on large screens) */
@media (min-width: 769px) {
  #timerSection {
    padding: 20px;
    background-color: rgba(6, 22, 14, 0.95);
  }
  
  .timer-card-full {
    max-width: 800px;
    height: 100%;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    margin: 0 auto;
  }
}

/* Lock scrolling when timer is active */
body.timer-active {
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* 1. Force navs to be fixed and visible above the green background */
body.timer-active .site-header {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10005;
  background-color: #000000;
}

body.timer-active .bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10005;
  background-color: #000000;
}

/* 2. Make the timer background cover the ENTIRE screen */
#timerSection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background-color: #06160e; /* Solid green everywhere */
  z-index: 9999;
  margin: 0;
  padding-top: 70px; /* Clears top header */
  padding-bottom: 75px; /* Clears bottom nav */
  box-sizing: border-box;
  display: none;
}

#timerSection.active, body.timer-active #timerSection {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* 3. Inner containers fill the space perfectly */
.timer-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 0;
  margin: 0;
}

.timer-card-full {
  width: 100%;
  height: 100%;
  background-color: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* 4. Desktop layout: Center the card as a modal on top of the green background */
@media (min-width: 769px) {
  #timerSection {
    padding-top: 90px;
    padding-bottom: 100px;
  }
  
  .timer-card-full {
    max-width: 800px;
    height: 100%;
    margin: 0 auto;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  }
}

/* 1. Force the navs to the absolute top layer with a solid black background */
body.timer-active .site-header,
body.timer-active .bottom-nav,
body.timer-active header,
body.timer-active nav.bottom-nav {
  display: flex; 
  visibility: visible;
  opacity: 1;
  position: fixed;
  z-index: 999999; /* Sit above the timer overlay */
  background-color: #000000; /* Solid black to cover the green */
}

body.timer-active .site-header,
body.timer-active header {
  top: 0;
  left: 0;
  width: 100%;
}

body.timer-active .bottom-nav,
body.timer-active nav.bottom-nav {
  bottom: 0;
  left: 0;
  width: 100%;
}

/* 2. The timer covers the whole screen but sits BELOW the navs */
#timerSection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background-color: #06160e; /* Solid green */
  z-index: 9999; /* Lower than navs */
  margin: 0;
  padding-top: 70px; /* Leave space for top nav */
  padding-bottom: 75px; /* Leave space for bottom nav */
  box-sizing: border-box;
  display: none;
}

#timerSection.active, body.timer-active #timerSection {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.timer-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 0;
  margin: 0;
}

.timer-card-full {
  width: 100%;
  height: 100%;
  background-color: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* 3. Desktop layout adjustment */
@media (min-width: 769px) {
  #timerSection {
    padding-top: 90px;
    padding-bottom: 100px;
  }
  
  .timer-card-full {
    max-width: 800px;
    height: 100%;
    margin: 0 auto;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  }
}

/* 
   Using 'html body.timer-active' gives us the highest possible specificity 
   without using !important. This guarantees the navs show up on top.
*/

/* Force the top header and bottom nav to the absolute top layer */
html body.timer-active .site-header,
html body.timer-active header,
html body.timer-active .bottom-nav,
html body.timer-active nav.bottom-nav {
  display: flex;
  visibility: visible;
  opacity: 1;
  position: fixed;
  z-index: 999999; /* Higher than the timer's 9999 */
  background-color: #000000; /* Solid black bar */
}

/* Pin the top header */
html body.timer-active .site-header,
html body.timer-active header {
  top: 0;
  left: 0;
  width: 100%;
}

/* Pin the bottom nav */
html body.timer-active .bottom-nav,
html body.timer-active nav.bottom-nav {
  bottom: 0;
  left: 0;
  width: 100%;
}

/* Ensure the timer sits BEHIND the navs and pads its content properly */
html body.timer-active #timerSection {
  z-index: 9999; 
  top: 0;
  height: 100dvh;
  padding-top: 70px; /* Pushes workout content below top nav */
  padding-bottom: 75px; /* Pushes workout content above bottom nav */
  background-color: #06160e;
}

/* 
   The JS hides the navs when the timer starts. 
   We must use !important to override the inline styles JS applies.
*/

html body.timer-active .site-header,
html body.timer-active header,
html body.timer-active .bottom-nav,
html body.timer-active nav.bottom-nav {
  display: flex !important; 
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  z-index: 999999 !important; /* Top layer */
  background-color: #000000 !important; /* Solid black */
}

/* Pin the top header */
html body.timer-active .site-header,
html body.timer-active header {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
}

/* Pin the bottom nav */
html body.timer-active .bottom-nav,
html body.timer-active nav.bottom-nav {
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
}

/* Ensure the timer sits perfectly between them */
#timerSection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background-color: #06160e;
  z-index: 9999; /* Below the navs */
  margin: 0;
  padding-top: 70px; /* Space for top nav */
  padding-bottom: 75px; /* Space for bottom nav */
  box-sizing: border-box;
  display: none;
}

#timerSection.active, body.timer-active #timerSection {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.timer-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 0;
  margin: 0;
}

.timer-card-full {
  width: 100%;
  height: 100%;
  background-color: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* 
   Drop the timer's z-index way down so it sits behind the navs 
   but above the main page content.
*/
#timerSection {
  z-index: 100 !important;
}

/* Force the nav containers AND their children to the absolute top layer */
body.timer-active .site-header,
body.timer-active .bottom-nav {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  z-index: 9999999 !important; /* Extremely high z-index */
  background-color: #000000 !important;
  transform: none !important; /* Breaks out of any 3D stacking contexts */
}

/* Ensure all elements INSIDE the navs are visible */
body.timer-active .site-header *,
body.timer-active .bottom-nav * {
  visibility: visible !important;
  opacity: 1 !important;
  display: flex !important; /* Forces icons/text to show */
}

/* Re-apply correct positioning */
body.timer-active .site-header {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
}

body.timer-active .bottom-nav {
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
}

/* Keep the timer padded so the workout content doesn't hide under the navs */
#timerSection {
  top: 0;
  height: 100dvh;
  padding-top: 70px; 
  padding-bottom: 75px; 
  background-color: #06160e;
}

/* Lock scrolling */
html body.timer-active {
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* 1. Position the timer to cover the whole screen (z-index stays low) */
html body.timer-active #timerSection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background-color: #06160e; 
  z-index: 9000; 
  margin: 0;
  padding-top: 70px; /* Space for top nav */
  padding-bottom: 75px; /* Space for bottom nav */
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* 2. Force the navs to the top layer (High specificity beats normal classes) */
html body.timer-active .site-header,
html body.timer-active .bottom-nav {
  display: flex;
  visibility: visible;
  opacity: 1;
  position: fixed;
  z-index: 9999; /* Sits above the timer (9000) */
  background-color: #000000;
}

/* 3. Pin the top header */
html body.timer-active .site-header {
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
}

/* 4. Pin the bottom nav */
html body.timer-active .bottom-nav {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75px;
}

/* 5. Ensure children inside the header are visible */
html body.timer-active .site-header > *,
html body.timer-active .bottom-nav > * {
  visibility: visible;
  opacity: 1;
}

/* 6. Restore the gold button styling inside the header */
html body.timer-active .site-header a {
  background-color: #facc15;
  color: #000000;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
}

/* 7. Desktop adjustment for modal look */
@media (min-width: 769px) {
  html body.timer-active #timerSection {
    padding-top: 90px;
    padding-bottom: 100px;
  }
  .timer-card-full {
    max-width: 800px;
    height: 100%;
    margin: 0 auto;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  }
}

/* 1. Lock scrolling */
html body.timer-active {
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* 2. Force the top header to show up (targets multiple possible class names) */
html body.timer-active header,
html body.timer-active #header,
html body.timer-active .site-header,
html body.timer-active .top-nav {
  display: flex;
  visibility: visible;
  opacity: 1;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  z-index: 9999;
  background-color: #000000;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
}

/* 3. Force the items INSIDE the header to be visible */
html body.timer-active header *,
html body.timer-active #header *,
html body.timer-active .site-header * {
  visibility: visible;
  opacity: 1;
}

/* 4. Restore the gold button styling inside the header */
html body.timer-active header a,
html body.timer-active .site-header a {
  background-color: #facc15;
  color: #000000;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* 5. Pin the bottom nav */
html body.timer-active .bottom-nav {
  display: flex;
  visibility: visible;
  opacity: 1;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75px;
  z-index: 9999;
  background-color: #000000;
}

/* 6. Keep the timer strictly between the navs */
html body.timer-active #timerSection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background-color: #06160e;
  z-index: 9000;
  margin: 0;
  padding-top: 70px; /* Clears top nav */
  padding-bottom: 75px; /* Clears bottom nav */
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* 
   We must use !important here because the global style.css 
   uses !important to hide the header. We also target 
   .header-inner which is the actual container inside the <header>.
*/

html body.timer-active header#siteHeader,
html body.workout-active header#siteHeader,
html body.timer-active .site-header,
html body.workout-active .site-header {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 70px !important;
  z-index: 2147483647 !important; /* Maximum possible z-index */
  background-color: #000000 !important;
  transform: none !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}

/* Force the inner container of the header to be visible */
html body.timer-active header#siteHeader .header-inner,
html body.workout-active header#siteHeader .header-inner {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure all children inside the header are visible */
html body.timer-active header#siteHeader *,
html body.workout-active header#siteHeader * {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Pin the bottom nav to the bottom */
html body.timer-active .bottom-nav,
html body.workout-active .bottom-nav {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 75px !important;
  z-index: 2147483647 !important;
  background-color: #000000 !important;
}

/* 
   Position the green timer background STRICTLY between the navs.
   This removes the need for padding hacks on the inside.
*/
html body.timer-active #timerSection,
html body.workout-active #timerSection {
  position: fixed !important;
  top: 70px !important; /* Below the header */
  left: 0 !important;
  width: 100vw !important;
  height: calc(100dvh - 145px) !important; /* Fills the gap between 70px header and 75px nav */
  background-color: #06160e !important;
  z-index: 9000 !important; /* Below the navs */
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
}

/* The inner card should fill the new height */
html body.timer-active #timerSection .timer-card-full,
html body.workout-active #timerSection .timer-card-full {
  width: 100% !important;
  height: 100% !important;
  background-color: #06160e !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  overflow-y: auto !important;
}

/* ==========================================
   CLEAN TIMER LAYOUT (MATCHING INDEX.HTML HEADER)
   ========================================== */

/* Ensure body doesn't scroll when timer is open */
html body.timer-active {
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* Position the timer perfectly between the top nav (70px) and bottom nav (75px) */
html body.timer-active #timerSection,
html body.workout-active #timerSection {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100vw;
  height: calc(100dvh - 145px);
  background-color: #06160e;
  z-index: 9999;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* The inner card fills the new height */
html body.timer-active #timerSection .timer-card-full,
html body.workout-active #timerSection .timer-card-full {
  width: 100%;
  height: 100%;
  background-color: #06160e;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* ==========================================
   15PX HEADER BOTTOM MARGIN
   ========================================== */

/* Add the requested 15px margin below the header container */
.site-header {
  margin-bottom: 15px;
}

/* Adjust the timer to account for the new header margin so it doesn't overlap */
html body.timer-active #timerSection,
html body.workout-active #timerSection {
  top: 85px; /* 70px header + 15px margin */
  height: calc(100dvh - 160px); /* 85px top + 75px bottom nav */
}


/* ==========================================
   INTRO CARD Z-INDEX & POSITIONING FIX
   ========================================== */

/* Ensure the card is the positioning context for the intro overlay */
.timer-card-full {
  position: relative;
}

/* Ensure the intro card sits completely on top of everything */
#introCard {
  position: absolute;
  inset: 0;
  z-index: 99999;
  /* The negative margin offsets the 16px padding of .timer-card-full to reach the edges */
  margin: -16px; 
}

/* ==========================================
   TIGHTEN SPACING & FIX TIMER TWITCH
   ========================================== */

/* Fix the number twitch by using tabular numbers (equal width) */
#masterClock {
  font-variant-numeric: tabular-nums;
  display: inline-block;
  text-align: right;
  min-width: 52px; /* Prevents shrinking on tiny numbers */
}

/* Tighten the outer header padding and gap */
.timer-header {
  padding: 8px 12px;
  gap: 8px;
}

/* Tighten the "TOTAL" pill padding */
.timer-total {
  padding: 6px 12px;
  gap: 4px;
}

/* Tighten the controls group gap */
.timer-controls-group {
  gap: 8px;
}

/* Slightly reduce the slider thumb size to match the tighter look */
#sb-volume-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
}

/* Slightly reduce the circular buttons size */
#musicToggle, #timerClose {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

/* Restore side padding so the X button doesn't clip the border */
.timer-header {
  padding: 8px 14px;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
}

/* Ensure the brand (TOTAL pill) never shrinks or gets pushed out */
.timer-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* The controls group fills the remaining space */
.timer-controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  min-width: 0; /* CRITICAL: Allows the slider to shrink instead of overflowing */
  justify-content: flex-end;
}

/* The slider container also needs min-width: 0 to shrink properly */
#sb-volume-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Ensure the slider itself respects the container width */
#sb-volume-slider {
  width: 100%;
  margin: 0;
}

/* Prevent the buttons from being squished */
#musicToggle, #timerClose {
  flex-shrink: 0;
}

/* Push the controls group to the right and center its contents vertically */
.timer-controls-group {
  flex-grow: 0; 
  margin-left: auto; 
  gap: 12px; 
  align-items: center;
}

/* Shrink the slider container to a fixed width */
#sb-volume-container {
  flex-grow: 0; 
  width: 100px; /* Adjust this value to make it slightly wider or narrower */
  display: flex;
  align-items: center;
}

/* Ensure the X button has a bit of breathing room on the right edge */
.timer-header {
  padding-right: 16px; 
}

/* Center the X inside its circle */
#timerClose {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   DEFINITIVE HEADER LAYOUT (PERFECT ALIGNMENT)
   ========================================== */

/* 1. The main header bar */
.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px 8px 16px; /* Left padding, right padding to clear the X */
  box-sizing: border-box;
  gap: 12px;
}

/* 2. The TOTAL pill stays on the left */
.timer-brand {
  flex-shrink: 0;
}

/* 3. The controls group fills the remaining space and aligns right */
.timer-controls-group {
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

/* 4. The slider container stretches to fill the middle */
#sb-volume-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

/* 5. Make sure the slider track fills its container */
#sb-volume-slider {
  width: 100%;
  margin: 0;
}

/* 6. Keep the circular buttons fixed and prevent shrinking */
#musicToggle, #timerClose {
  flex-shrink: 0;
  margin: 0;
}

/* 7. Add a tiny bit of margin to the X button so it never touches the border */
#timerClose {
  margin-right: 4px; 
}

/* ==========================================
   LOWER & CENTER THE X BUTTON
   ========================================== */

/* Ensure the header provides a proper flex context for vertical centering */
.timer-header {
  align-items: center; 
  padding-top: 8px;
  padding-bottom: 8px;
  min-height: 56px; /* Gives the bar enough height so the X doesn't clip */
}

/* Override any old absolute positioning or negative margins */
#timerClose, 
.timer-close {
  position: relative; /* Takes it out of absolute positioning if it was stuck there */
  top: auto;
  right: auto;
  margin: 0;
  align-self: center;
}

/* Optional: A tiny optical nudge if it still looks a pixel too high */
#timerClose {
  margin-top: 2px; 
}


/* ==========================================
   FINAL CLEAN PHASE COLORS (OVERRIDING ID SPECIFICITY)
   ========================================== */

/* WORK PHASE (#188C00) */
html body.timer-active #timerSection .timer-card-full.phase-work,
html body.workout-active #timerSection .timer-card-full.phase-work {
  background-color: #188C00 !important;
}

html body.timer-active #timerSection:has(.phase-work),
html body.workout-active #timerSection:has(.phase-work) {
  background-color: #188C00 !important;
}

/* REST PHASE (#EE4B2B) */
html body.timer-active #timerSection .timer-card-full.phase-rest,
html body.workout-active #timerSection .timer-card-full.phase-rest {
  background-color: #EE4B2B !important;
}

html body.timer-active #timerSection:has(.phase-rest),
html body.workout-active #timerSection:has(.phase-rest) {
  background-color: #EE4B2B !important;
}

/* ==========================================
   OPTIMIZE BOTTOM SPACE (GROUP UP NEXT & CONTROLS)
   ========================================== */

/* Stop spreading everything evenly vertically */
.timer-card-full {
  justify-content: flex-start;
}

/* Push the Up Next card to the bottom of the available space */
.next-up-card {
  margin-top: auto; /* Pushes it down */
  margin-bottom: 16px; /* Space between the card and the buttons */
}

/* Remove the auto margin from the controls so they sit right below the card */
.timer-controls-full {
  margin-top: 0; 
}

/* Optional: Make the Up Next card slightly taller to fill the new space better */
.next-up-card {
  padding: 16px 12px;
}

/* On mobile, reduce the gap slightly so it fits perfectly */
@media (max-width: 600px) {
  .next-up-card {
    padding: 10px 12px;
    margin-bottom: 12px;
  }
}

/* ==========================================
   TYPOGRAPHY & SPACE OPTIMIZATION
   ========================================== */

/* 1. Make the Round Info a massive visual anchor */
.timer-round-info {
  font-size: 28px; /* Much larger */
  font-weight: 800;
  color: #ffffff; /* High contrast white */
  text-align: center;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 24px 0 32px 0; /* Breathing room above and below */
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(234, 179, 8, 0.4); /* Gold underline */
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* Deep shadow for depth */
}

/* 2. Pull the Up Next card down to the bottom */
.next-up-card {
  margin-top: auto; /* Pushes the card and buttons to the bottom */
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25); /* Darker background to stand out */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 3. Make the Up Next text slightly larger to match the new scale */
.next-name {
  font-size: 20px;
  font-weight: 800;
}

.next-label {
  font-size: 12px;
  color: #facc15; /* Gold label for better hierarchy */
  letter-spacing: 1.5px;
}

/* 4. Mobile fine-tuning so the giant text doesn't break the layout */
@media (max-width: 600px) {
  .timer-round-info {
    font-size: 22px; /* Slightly smaller on phones */
    margin: 16px 0 20px 0;
    padding-bottom: 12px;
  }
  
  .next-up-card {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .next-name {
    font-size: 18px;
  }
}

/* ==========================================
   BLACK TYPOGRAPHY THEME (WORK PHASE)
   ========================================== */

/* 1. Round Info: Black text, no shadow, dark border */
.timer-round-info {
  color: #000000;
  text-shadow: none;
  border-bottom: 2px solid rgba(0, 0, 0, 0.2); 
}

/* 2. Up Next Card: Lighten the background so black text pops */
.next-up-card {
  background: rgba(255, 255, 255, 0.15); /* Semi-transparent white */
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 3. Up Next Text Colors */
.next-name {
  color: #000000;
}

.next-label {
  color: #000000;
  opacity: 0.7; /* Slightly softer black for the label */
}

/* 4. Up Next Arrow */
.next-arrow {
  color: #000000;
}

/* ==========================================
   FORCE MUSIC NOTE TO BE WHITE
   ========================================== */

/* 
   This filter inverts the emoji (turning it white), 
   but we have to re-force the background and border colors 
   so they don't get inverted as well.
*/
#musicToggle {
  color: #ffffff !important;
  filter: grayscale(1) invert(1) !important; 
  background-color: #0b0c09 !important; /* Keep the dark background */
  border-color: #d9ad00 !important;     /* Keep the gold border */
}

/* Fix the hover state so it also stays consistent */
#musicToggle:hover {
  background-color: #d9ad00 !important;
  border-color: #d9ad00 !important;
}

/* ==========================================
   PURE WHITE MUSIC NOTE (NO BACKGROUND INVERSION)
   ========================================== */

#musicToggle {
  /* Remove the previous invert filter that ruined the background */
  filter: none !important;
  
  /* Hide the original colored emoji */
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  
  /* Draw a solid white silhouette of the emoji */
  text-shadow: 0 0 0 #ffffff !important;
  
  /* Re-ensure the background and border are correct */
  background-color: #0b0c09 !important;
  border-color: #d9ad00 !important;
}

/* Keep the hover state clean */
#musicToggle:hover {
  background-color: #d9ad00 !important;
  border-color: #d9ad00 !important;
  text-shadow: 0 0 0 #000000 !important; /* Turn note black on hover */
}

/* Target the logo image specifically in the site header */
.site-header .logo-img {
  height: 50px; /* Increase this value if you want it even bigger (e.g., 55px or 60px) */
  width: auto;  /* Maintains the aspect ratio */
  max-height: 100%; 
  object-fit: contain;
}

/* Ensure the container allows the image to stretch properly */
.site-header .logo-link {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
}

/* ==========================================
   END CARD IMAGE FILL
   ========================================== */

/* Override the inline JS 'contain' style so the image fills the space */
#endCardImg {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important; /* Remove rounding so it hits the edges */
}

/* Ensure the card itself is edge-to-edge */
#endCard {
  border-radius: 0 !important;
  background-color: #000 !important;
}

/* ==========================================
   BLACK TEXT FOR REST PHASE
   ========================================== */

/* Target the subtitle and main text specifically during the rest phase */
.timer-card-full.phase-rest .current-exercise-name,
.timer-card-full.phase-rest .rest-subtitle {
  color: #000000 !important;
}

/* ==========================================
   MOVE END CARD BUTTON DOWN
   ========================================== */

/* Override the flexbox and margins to force the button down */
#endCard .end-card-action-wrap {
  position: absolute !important;
  bottom: 2% !important; /* Change this percentage to move it up or down */
  left: 0 !important;
  width: 100% !important;
  margin: 0 !important; /* Clears out the old margin-top: auto and margin-bottom */
  z-index: 20001;
  text-align: center;
}

/* Ensure the button itself stays centered */
#endCardBtn {
  margin: 0 auto;
}

/* ==========================================
   DESKTOP MODAL OVERRIDE (MIN-WIDTH 769PX)
   ========================================== */

@media (min-width: 769px) {
  /* 1. Create the blurred backdrop */
  html body.timer-active #timerSection,
  html body.workout-active #timerSection {
    top: 0 !important;
    height: 100dvh !important;
    background: rgba(6, 22, 14, 0.85) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px 20px !important;
  }

  /* 2. Restore the centered card (Modal) */
  html body.timer-active #timerSection .timer-card-full,
  html body.workout-active #timerSection .timer-card-full {
    width: 100% !important;
    max-width: 850px !important;
    height: 90vh !important;
    max-height: 900px !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9) !important;
    padding: 24px !important;
    margin: 0 auto !important;
    overflow: hidden !important; /* Prevent scrollbars inside the card */
  }

  /* 3. Make the intro card fill the modal nicely */
  #introCard {
    margin: -24px !important; /* Offset the new 24px padding */
    border-radius: 24px !important;
  }
  
  #introCard img {
    border-radius: 24px !important;
    object-fit: cover !important; /* Fills the area completely without white edges */
  }
}

/* ==========================================
   DEFINITIVE DESKTOP MODAL FIX (OVERRIDES SPECIFICITY)
   ========================================== */

@media (min-width: 769px) {
  /* 
    1. Beat the :has() specificity to force a blurred backdrop.
    We target :has() directly here so it loses the specificity war.
  */
  html body.timer-active #timerSection,
  html body.workout-active #timerSection,
  html body.timer-active #timerSection:has(.phase-work),
  html body.workout-active #timerSection:has(.phase-work),
  html body.timer-active #timerSection:has(.phase-rest),
  html body.workout-active #timerSection:has(.phase-rest) {
    top: 0 !important;
    height: 100dvh !important;
    width: 100vw !important;
    background: rgba(6, 22, 14, 0.9) !important; /* Dark transparent backdrop */
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    margin: 0 !important;
  }

  /* 2. Restore the centered card and remove the scrollbar */
  html body.timer-active #timerSection .timer-card-full,
  html body.workout-active #timerSection .timer-card-full {
    width: 100% !important;
    max-width: 850px !important;
    height: 85vh !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9) !important;
    padding: 24px !important;
    margin: 0 auto !important;
    overflow: hidden !important; /* Kills the white scrollbar */
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background-color: #06160e !important; /* Card background */
  }

  /* 3. Force intro images to fill the modal and override inline HTML styles */
  #introCard {
    margin: -24px !important; /* Offset the card padding */
    border-radius: 24px !important;
    overflow: hidden !important; /* Stops the scrollbar */
  }

  #introCard img {
    width: 100% !important; /* Overrides the inline 103% */
    height: 100% !important;
    object-fit: cover !important; /* Removes the black side bars */
    border-radius: 24px !important;
  }
}

/* ==========================================
   ABSOLUTE DESKTOP MODAL OVERRIDE (WINS SPECIFICITY WAR)
   ========================================== */

@media (min-width: 769px) {
  /* 
    1. Force the backdrop to blur and darken.
    We must include the :has() selectors so we beat the phase color rules.
  */
  html body.timer-active #timerSection,
  html body.workout-active #timerSection,
  html body.timer-active #timerSection:has(.phase-work),
  html body.workout-active #timerSection:has(.phase-work),
  html body.timer-active #timerSection:has(.phase-rest),
  html body.workout-active #timerSection:has(.phase-rest) {
    top: 0 !important;
    height: 100dvh !important;
    width: 100vw !important;
    background: rgba(0, 0, 0, 0.85) !important; /* Dark glass effect */
    -webkit-backdrop-filter: blur(15px) !important;
    backdrop-filter: blur(15px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* 2. Lock the card size and kill the scrollbar */
  html body.timer-active #timerSection .timer-card-full,
  html body.workout-active #timerSection .timer-card-full {
    width: 100% !important;
    max-width: 850px !important;
    height: 90vh !important;
    max-height: 900px !important;
    border-radius: 24px !important;
    background-color: #06160e !important;
    border: 1px solid rgba(255, 204, 0, 0.2) !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 1) !important;
    padding: 24px !important;
    margin: 0 auto !important;
    overflow: hidden !important; /* This kills the white scrollbar */
  }

  /* 3. Force the intro card to fit perfectly */
  #introCard {
    margin: -24px !important; /* Offset the card padding */
    width: calc(100% + 48px) !important;
    height: calc(100% + 48px) !important;
    border-radius: 24px !important;
    overflow: hidden !important;
  }

  /* 4. Override the inline 103% width to stop horizontal overflow */
  #introCard img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 24px !important;
  }
}

/* ==========================================
   DESKTOP-ONLY PERFECTION (MIN-WIDTH 769PX)
   ========================================== */

@media (min-width: 769px) {
  /* 1. HIDE THE BOTTOM NAV on desktop */
  html body.timer-active .bottom-nav,
  html body.workout-active .bottom-nav {
    display: none !important;
  }

  /* 2. RESTORE TOP NAV TO ORIGINAL STYLES */
  /* Undo the forced gold background on the blue button */
  html body.timer-active .site-header a.btn-solid2,
  html body.workout-active .site-header a.btn-solid2 {
    background-color: #002fd9 !important;
    color: #fdfdfd !important;
    padding: 12px 26px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }
  
  /* Undo the gold background on standard nav links */
  html body.timer-active .site-header .nav-link,
  html body.workout-active .site-header .nav-link {
    background: transparent !important;
    color: #94a3b8 !important;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
  }
  
  /* Ensure the active link looks correct */
  html body.timer-active .site-header .nav-link.active,
  html body.workout-active .site-header .nav-link.active {
    background: rgba(234, 179, 8, 0.08) !important;
    color: #facc15 !important;
  }

  /* 3. FIX THE MODAL LAYOUT & SCROLLBAR */
  html body.timer-active #timerSection,
  html body.workout-active #timerSection,
  html body.timer-active #timerSection:has(.phase-work),
  html body.workout-active #timerSection:has(.phase-work),
  html body.timer-active #timerSection:has(.phase-rest),
  html body.workout-active #timerSection:has(.phase-rest) {
    top: 70px !important; /* Sits right below the header */
    height: calc(100dvh - 70px) !important; /* Fills to bottom of screen (no bottom nav) */
    background: rgba(6, 22, 14, 0.9) !important; /* Dark glass backdrop */
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    margin: 0 !important;
    width: 100vw !important;
  }

  /* The Modal Card */
  html body.timer-active #timerSection .timer-card-full,
  html body.workout-active #timerSection .timer-card-full {
    width: 100% !important;
    max-width: 850px !important;
    height: 100% !important;
    max-height: 850px !important;
    border-radius: 24px !important;
    background-color: #06160e !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 1) !important;
    padding: 24px !important;
    margin: 0 auto !important;
    overflow: hidden !important; /* KILLS THE SCROLLBAR */
  }

  /* 4. FIX THE INTRO IMAGES (Overriding the 103% inline styles) */
  #introCard {
    margin: -24px !important; /* Offset the card padding */
    width: calc(100% + 48px) !important;
    height: calc(100% + 48px) !important;
    border-radius: 24px !important;
    overflow: hidden !important;
  }
  
  #introCard img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 24px !important;
  }
}

/* ==========================================
   FINAL DESKTOP POLISH
   ========================================== */

@media (min-width: 769px) {
  /* 1. Show the buttons by allowing internal scrolling if the screen is short */
  html body.timer-active #timerSection .timer-card-full,
  html body.workout-active #timerSection .timer-card-full {
    overflow-y: auto !important; /* Bring back scroll inside the card only */
    height: auto !important;
    max-height: 90vh !important;
  }

  /* 2. Fix the unreadable black text */
  .timer-card-full .timer-round-info {
    color: #facc15 !important; /* Gold text for high contrast */
    border-bottom: 2px solid rgba(234, 179, 8, 0.4) !important;
    text-shadow: none !important;
    font-size: 24px !important; /* Slightly smaller so it fits on one line */
    margin: 16px 0 24px 0 !important;
  }

  /* 3. Fix the cropped Intro Card */
  #introCard {
    margin: 0 !important; /* Remove the negative margin hack */
    width: 100% !important;
    height: 100% !important;
    border-radius: 24px !important;
    top: 0 !important;
    left: 0 !important;
    position: absolute !important;
  }

  #introCard img {
    object-fit: contain !important; /* Contain ensures the whole image is visible */
    background-color: #000 !important; /* Black bars instead of white */
    border-radius: 24px !important;
  }
}

/* ==========================================
   DESKTOP END CARD FIX
   ========================================== */

@media (min-width: 769px) {
  /* 1. Show the full image instead of zooming in and cutting off text */
  #endCardImg {
    object-fit: contain !important;
    background-color: #000 !important; /* Fill empty space with black */
  }

  /* 2. Position the button near the bottom, clear of the nav */
  #endCard .end-card-action-wrap {
    bottom: 40px !important; /* Fixed pixel value looks better on desktop than % */
  }
}

/* ==========================================
   MOBILE TITLE RESIZING & ALIGNMENT
   ========================================== */

@media (max-width: 767px) {
  /* 1. Shrink the main title so it fits on one or two clean lines */
  .training-card h1 {
    font-size: 1.3rem; /* Reduced from 2.2rem */
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px; /* Space between the emoji and the text */
  }

  /* 2. Align the subtitle text properly next to its border */
  .training-sub {
    font-size: 0.95rem; /* Slightly smaller text */
    padding-left: 12px; /* Adjust padding to match the smaller font */
    margin-bottom: 1.5rem;
    line-height: 1.4;
  }
}

/* ==========================================
   DEFINITIVE MOBILE TITLE FIX
   ========================================== */

@media (max-width: 767px) {
  /* Force the main H1 to be a block so the text wraps naturally */
  .training-card h1 {
    font-size: 1.3rem !important;
    line-height: 1.2 !important;
    display: block !important; /* Overrides flexbox wrap */
    margin-bottom: 0.5rem !important;
  }

  /* Ensure the span inherits the new smaller size and stays inline */
  .training-card h1 span {
    font-size: 1.3rem !important;
    display: inline !important;
  }

  /* Clean up the subtitle spacing */
  .training-sub {
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    padding-left: 12px !important;
    margin-bottom: 1.5rem !important;
  }
}

/* ==========================================
   HOW IT WORKS MODAL ALIGNMENT
   ========================================== */

/* 1. Force all body text to be white and left-aligned */
.guide-body {
  color: #ffffff !important;
  text-align: left !important;
}

/* 2. Style the headings to stand out (Gold) */
.guide-body h3 {
  color: #facc15 !important;
  text-align: left !important;
  margin-top: 24px !important;
  margin-bottom: 12px !important;
}

/* 3. Fix the bullet points to align cleanly left */
.guide-body ul {
  padding-left: 20px !important;
  margin-bottom: 16px !important;
  list-style-position: outside !important;
}

.guide-body li {
  margin-bottom: 10px !important;
  line-height: 1.5 !important;
  text-align: left !important;
}

/* 4. Keep the "Strong Bands" text in the title white */
.guide-header h2 {
  text-align: center !important;
  width: 100% !important;
}

/* ==========================================
   GUIDE MODAL DESIGN FIX (TITLE & BUTTON)
   ========================================== */

/* 1. Fix the Title */
.guide-header h2 {
  color: #ffffff !important; /* Make main title white */
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* Make the span inside the title Gold */
.guide-header h2 span {
  color: #facc15 !important; 
}

/* 2. Fix the Close (X) Button */
.guide-close {
  color: #94a3b8 !important;
  font-size: 24px !important;
  background: transparent !important;
  border: none !important;
}
.guide-close:hover {
  color: #ffffff !important;
}

/* 3. Fix the "Got it" Footer Button */
.guide-footer button {
  background-color: #eab308 !important; /* Strong Bands Gold */
  color: #000000 !important;            /* Black text */
  font-weight: 800 !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 14px !important;
  font-size: 1.1rem !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: transform 0.2s, background-color 0.2s !important;
}

.guide-footer button:hover {
  background-color: #ca8a04 !important; /* Slightly darker gold on hover */
  transform: scale(0.98) !important;
}
