/* ==========================================
   PITSTOP FITNESS — 80s Neon Retro Theme
   "Richard Simmons Energy, Calculator Clarity"
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Boogaloo&display=swap');

:root {
  --neon-pink:    #ff2d78;
  --neon-blue:    #00d4ff;
  --neon-yellow:  #fff200;
  --neon-green:   #39ff14;
  --neon-purple:  #bf00ff;
  --neon-orange:  #ff6b00;
  --dark-bg:      #0d001a;
  --card-bg:      #1a0036;
  --card-border:  #2d0055;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--dark-bg);
  /* Diagonal grid overlay for VHS feel */
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 40px,
      rgba(255, 45, 120, 0.04) 40px,
      rgba(255, 45, 120, 0.04) 41px
    ),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(0, 212, 255, 0.03) 40px,
      rgba(0, 212, 255, 0.03) 41px
    );
  color: white;
  font-family: 'Boogaloo', cursive;
  display: flex;
  flex-direction: column;
}

/* =====================
   SCREENS
   ===================== */
.screen {
  display: none;
  flex-direction: column;
  height: 100dvh; /* dynamic viewport height — handles mobile browser bars */
  width: 100%;
  position: absolute;
  top: 0; left: 0;
}

.screen.active {
  display: flex;
}

/* =====================
   MAIN SCREEN
   ===================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 1.5rem 1.25rem 0.75rem;
  min-height: 0;
}

/* TITLE BLOCK */
.title-block {
  text-align: center;
}

.title-deco {
  font-size: 1rem;
  color: var(--neon-pink);
  letter-spacing: 8px;
  text-shadow: 0 0 10px var(--neon-pink);
  margin-bottom: 0.25rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

h1 {
  font-family: 'Bangers', cursive;
  font-size: clamp(2.8rem, 14vw, 5rem);
  line-height: 0.88;
  letter-spacing: 4px;
  color: var(--neon-yellow);
  text-shadow:
    4px 4px 0px var(--neon-pink),
    8px 8px 0px rgba(255, 45, 120, 0.25),
    0 0 40px rgba(255, 242, 0, 0.4);
}

.subtitle {
  font-family: 'Boogaloo', cursive;
  font-size: clamp(0.85rem, 4.5vw, 1.1rem);
  color: var(--neon-blue);
  letter-spacing: 5px;
  margin-top: 0.4rem;
  text-shadow: 0 0 12px var(--neon-blue);
}

/* MODE SECTION */
.mode-section,
.time-section {
  width: 100%;
  max-width: 420px;
}

.mode-label {
  font-family: 'Boogaloo', cursive;
  font-size: 0.75rem;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin-bottom: 0.5rem;
}

.mode-toggle {
  display: flex;
  gap: 0.6rem;
}

.mode-btn {
  flex: 1;
  padding: 0.65rem 0.5rem;
  font-family: 'Boogaloo', cursive;
  font-size: clamp(0.9rem, 4vw, 1rem);
  letter-spacing: 1px;
  border: 3px solid rgba(0, 212, 255, 0.4);
  background: transparent;
  color: rgba(0, 212, 255, 0.6);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.mode-btn.active {
  background: var(--neon-pink);
  border-color: var(--neon-pink);
  color: white;
  box-shadow:
    0 0 20px rgba(255, 45, 120, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.mode-btn:active {
  transform: scale(0.96);
}

/* TIME BUTTONS */
.time-buttons {
  display: flex;
  gap: 0.75rem;
}

.time-btn {
  flex: 1;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 4px solid var(--neon-pink);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.1s ease;
  touch-action: manipulation;
  box-shadow:
    0 0 20px rgba(255, 45, 120, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on time buttons */
.time-btn::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.4s;
}

.time-btn:hover::before {
  transform: translateX(50%);
}

.time-btn:active {
  transform: scale(0.94);
  box-shadow: 0 0 35px rgba(255, 45, 120, 0.7);
  border-color: var(--neon-yellow);
}

.time-label {
  font-family: 'Bangers', cursive;
  font-size: clamp(2.5rem, 13vw, 4rem);
  color: var(--neon-yellow);
  line-height: 1;
  text-shadow:
    3px 3px 0 var(--neon-pink),
    0 0 20px rgba(255, 242, 0, 0.5);
}

.time-unit {
  font-family: 'Boogaloo', cursive;
  font-size: clamp(0.75rem, 3.5vw, 0.9rem);
  color: var(--neon-blue);
  letter-spacing: 3px;
  text-shadow: 0 0 8px var(--neon-blue);
}

/* SAFETY LINE */
.safety-line {
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  letter-spacing: 0.5px;
}

.safety-line a {
  color: var(--neon-blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 212, 255, 0.4);
  transition: color 0.15s;
}

.safety-line a:hover {
  color: white;
}

/* =====================
   AD PLACEHOLDER
   ===================== */
.ad-placeholder {
  height: 60px;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.12);
  font-size: 0.6rem;
  letter-spacing: 4px;
}

/* =====================
   ROUTINE SCREEN
   ===================== */
.routine-header {
  padding: 1.25rem 1.25rem 0.75rem;
  text-align: center;
  flex-shrink: 0;
  background: linear-gradient(to bottom, var(--dark-bg) 80%, transparent);
}

h2 {
  font-family: 'Bangers', cursive;
  font-size: clamp(2rem, 10vw, 3rem);
  letter-spacing: 4px;
  color: var(--neon-yellow);
  text-shadow:
    3px 3px 0 var(--neon-pink),
    0 0 25px rgba(255, 242, 0, 0.4);
}

.routine-safety {
  font-size: clamp(0.7rem, 3.2vw, 0.8rem);
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.3rem;
  letter-spacing: 0.3px;
}

/* SCROLLABLE EXERCISE LIST */
.routine-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1.25rem 0.75rem;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* Hide scrollbar but keep functionality */
.routine-scroll::-webkit-scrollbar { display: none; }
.routine-scroll { scrollbar-width: none; }

#exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 420px;
  margin: 0 auto;
}

/* EXERCISE ITEM CARDS */
.exercise-item {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-left: 5px solid var(--neon-pink);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  opacity: 0;
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.exercise-item:nth-child(even) {
  border-left-color: var(--neon-blue);
}

.exercise-item:nth-child(3n) {
  border-left-color: var(--neon-purple);
}

.exercise-emoji {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.exercise-info {
  flex: 1;
  min-width: 0;
}

.exercise-name {
  font-family: 'Boogaloo', cursive;
  font-size: clamp(1rem, 4.5vw, 1.15rem);
  color: white;
  line-height: 1.1;
}

.exercise-reps {
  font-size: clamp(0.75rem, 3.2vw, 0.85rem);
  color: var(--neon-blue);
  margin-top: 0.15rem;
  letter-spacing: 0.3px;
}

/* TOTAL TIME BADGE */
.total-time {
  font-family: 'Boogaloo', cursive;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  text-align: right;
  letter-spacing: 2px;
  margin-top: 0.5rem;
}

/* ROUTINE FOOTER */
.routine-footer {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem 0;
}

/* DONE BUTTON */
.done-btn {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
  padding: 1rem;
  font-family: 'Bangers', cursive;
  font-size: clamp(1.5rem, 7vw, 2rem);
  letter-spacing: 4px;
  background: var(--neon-green);
  color: var(--dark-bg);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.1s ease;
  touch-action: manipulation;
  box-shadow:
    0 0 25px rgba(57, 255, 20, 0.45),
    0 4px 0 rgba(0, 150, 0, 0.5);
  text-shadow: none;
}

.done-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 35px rgba(57, 255, 20, 0.7),
    0 1px 0 rgba(0, 150, 0, 0.5);
}

/* =====================
   CONFETTI
   ===================== */
#confetti-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
}

.confetti-piece {
  position: absolute;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0;
  }
}

/* =====================
   FEEDBACK POPUP
   ===================== */
#feedback-msg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: 'Bangers', cursive;
  font-size: clamp(2.5rem, 15vw, 4.5rem);
  color: var(--neon-yellow);
  text-shadow:
    4px 4px 0 var(--neon-pink),
    0 0 40px rgba(255, 242, 0, 0.8);
  z-index: 1000;
  pointer-events: none;
  text-align: center;
  letter-spacing: 3px;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  white-space: nowrap;
}

@keyframes popIn {
  0%   { transform: translate(-50%, -50%) scale(0);   opacity: 0; }
  60%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* =====================
   SAFETY PAGE STYLES
   ===================== */
body.safety-body {
  overflow: auto;
  height: auto;
}

.safety-page {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--neon-blue);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.back-link:hover {
  border-bottom-color: var(--neon-blue);
}

.safety-page h1 {
  font-size: clamp(2.5rem, 12vw, 4rem);
  margin-bottom: 0;
}

.safety-page .subtitle {
  margin-bottom: 1.75rem;
}

.safety-section {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-left: 5px solid var(--neon-pink);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.safety-section:nth-child(even) {
  border-left-color: var(--neon-blue);
}

.safety-section:nth-child(3n) {
  border-left-color: var(--neon-purple);
}

.safety-section h3 {
  font-family: 'Boogaloo', cursive;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--neon-yellow);
  margin-bottom: 0.6rem;
}

.safety-section p,
.safety-section li {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.6;
}

.safety-section ul {
  padding-left: 1.1rem;
}

.safety-section li + li {
  margin-top: 0.3rem;
}

.legal-disclaimer {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  margin-top: 1.75rem;
  line-height: 1.6;
  letter-spacing: 0.3px;
}

/* =====================
   UTILITY
   ===================== */
button {
  -webkit-appearance: none;
  appearance: none;
}
