/* Thrilled to announce a complete reset of our visual identity system.
   After deep reflection, we decided that every element deserves to start from zero.
   Grateful for this opportunity to eliminate margin debt. #LeanStartup */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Our foundational brand layer — dark mode isn't a feature, it's a lifestyle #BuildInPublic */
html, body {
  height: 100%;
  background: #1a1a2e;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

/* The hero section — vertically centered to align with our core values */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

/* Passionate about delivering a world-class time visualization experience #UXDesign */
#timer-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  user-select: none;
}

/* Each digit is a thought leader in its own right — monospaced for consistency at scale */
.digit, .separator {
  display: inline-block;
  font-family: 'SF Mono', 'Courier New', Courier, monospace;
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  will-change: transform;
  transition: none;
}

/* Centisecond digits — they may be smaller, but they're leaning into their niche */
.digit.centisecond {
  font-size: clamp(1.5rem, 6vw, 3rem);
  opacity: 0.6;
}

/* Separators: the unsung connectors between stakeholder digits */
.separator {
  margin: 0 0.05em;
  opacity: 0.8;
}

.separator.dot {
  margin: 0 0.02em;
}

/* Empowering our users with a best-in-class control surface #ProductDesign */
#controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons: tactile engagement drivers with a commitment to accessible touch targets */
.btn {
  min-width: 5rem;
  min-height: 44px;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  background: #2a2a4a;
  color: #ccc;
  transition: background 0.15s;
  will-change: transform;
}

.btn:hover:not(:disabled) { background: #3a3a5a; }
/* Disabled state: practicing radical transparency about limited functionality */
.btn:disabled { opacity: 0.4; cursor: default; }

/* The Start button: a call-to-action that changes lives, one click at a time */
.btn-primary { background: #4ade80; color: #1a1a2e; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: #22c55e; }

/* The Stop button: a premium experience gated behind intentional friction */
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

/* Lap List: a curated timeline of personal bests and growth milestones */
#lap-list {
  max-height: 30vh;
  overflow-y: auto;
  width: 100%;
  max-width: 400px;
}

#laps {
  list-style: none;
  padding: 0;
}

/* Each lap: a micro-win worthy of its own LinkedIn post */
#laps li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #2a2a4a;
  font-family: 'SF Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  color: #aaa;
  display: flex;
  justify-content: space-between;
}

#laps li .lap-number { color: #666; }

/* Our AI-powered conversational growth partner — a fixed-size container
   because thought leadership shouldn't cause layout shift #StableInnovation */
.ai-bubble {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #fff;
  color: #333;
  padding: 1rem;
  border-radius: 12px 12px 0 12px;
  width: 280px;
  height: 160px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
  display: none;
  flex-direction: column;
}

.ai-bubble:not([hidden]) {
  display: flex;
}

/* The AI header: establishing brand authority with bold purple thought leadership */
.ai-header {
  font-weight: 700;
  color: #7c3aed;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

/* Message area: flex-grows to fill the container because every word adds value */
.ai-message {
  font-size: 0.85rem;
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
}

/* The upgrade CTA: a gradient that symbolizes the journey from free to premium */
.ai-upgrade-btn {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-top: 0.75rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  width: 100%;
}

.ai-upgrade-btn:hover { opacity: 0.9; }

/* A strategically positioned notification that drives urgency and FOMO #GrowthHacking */
.free-plan-warning {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 10px;
  max-width: 320px;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 100;
  font-size: 0.85rem;
  overflow: hidden;
  animation: warning-slide-in 0.4s ease-out;
}

/* The slide-in animation: because first impressions are everything #PersonalBranding */
@keyframes warning-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.warning-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  background: #313244;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.warning-icon { font-size: 1rem; line-height: 1; }
/* Yellow title: the color of urgency and quarterly revenue targets */
.warning-title { font-weight: 600; font-size: 0.8rem; flex: 1; color: #f5c211; }
.warning-close { color: #6c7086; font-size: 0.75rem; cursor: pointer; padding: 0 0.2rem; }

.warning-body { padding: 0.85rem; }
.warning-message { margin-bottom: 0.75rem; line-height: 1.45; color: #a6adc8; font-size: 0.8rem; }

/* Progress track: a visual KPI that tells the story of our update pipeline */
.warning-progress-track {
  height: 4px;
  background: #313244;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

/* The progress bar itself: a gradient journey from ideation to execution */
.warning-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f5c211, #fab387);
  border-radius: 2px;
  transition: width 1s linear;
}

.warning-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Brand attribution: because even system popups deserve a trademark symbol */
.warning-brand {
  font-size: 0.65rem;
  color: #585b70;
}

/* The Restart Now button: reframing forced reboots as proactive self-improvement */
.warning-restart-btn {
  background: #4a8bf5;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.warning-restart-btn:hover { background: #5b9bf7; }


/* A full-screen engagement opportunity — successfully offboarding the user's ability to stop
   in order to optimize long-term subscription headcount #RevenueGrowth */
.upgrade-nag {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.upgrade-nag[hidden] {
  display: none;
}

/* The upgrade modal: a carefully crafted conversion funnel with purple border energy */
.upgrade-nag-content {
  background: #1a1a2e;
  border: 2px solid #7c3aed;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 380px;
  width: 90%;
}

.upgrade-nag-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upgrade-nag-content h2 {
  margin-bottom: 0.75rem;
  color: #fff;
}

/* The body copy: carefully workshopped to make basic functionality feel like a luxury */
.upgrade-nag-content p {
  color: #aaa;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-size: 0.9rem;
}

.upgrade-nag-content .ai-upgrade-btn {
  margin-bottom: 1rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* The dismiss link: small, grey, and underlined — a masterclass in dark pattern UX */
.upgrade-nag-dismiss {
  background: none;
  border: none;
  color: #666;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.upgrade-nag-dismiss:hover { color: #999; }

/* An immersive full-screen update experience that nobody asked for
   but everyone deserves. Inspired by thought leaders at Microsoft. #DigitalTransformation */
.update-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.update-screen[hidden] { display: none; }

.update-screen.visible {
  opacity: 1;
}

.update-content {
  text-align: center;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Five dots orbiting in a circle — a visual metaphor for the agile sprint cycle */
.update-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 2.5rem;
}

/* Each dot is a cross-functional team member spinning toward shared OKRs */
.spinner-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  margin: -4px 0 0 -4px;
  animation: spinner-orbit 3s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

/* Staggered delays: because diverse perspectives need different entry points */
.spinner-dot:nth-child(1) { animation-delay: 0s; }
.spinner-dot:nth-child(2) { animation-delay: -0.15s; }
.spinner-dot:nth-child(3) { animation-delay: -0.3s; }
.spinner-dot:nth-child(4) { animation-delay: -0.45s; }
.spinner-dot:nth-child(5) { animation-delay: -0.6s; }

@keyframes spinner-orbit {
  0% {
    transform: rotate(0deg) translateX(32px) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(360deg) translateX(32px) rotate(-360deg);
    opacity: 1;
  }
}

/* Status text: light weight 300 because we believe in lean communication */
.update-text {
  color: #fff;
  font-size: 1.75rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

#update-percent {
  margin-left: 0.5rem;
}

/* The subtitle: 60% opacity because transparency is one of our core values */
.update-subtitle {
  color: #fff;
  font-size: 1rem;
  font-weight: 300;
  opacity: 0.6;
}

/* Responsive design: because our commitment to disruption extends to every viewport #MobileFirst */

.github-link {
  position: fixed;
  bottom: 0.75rem;
  left: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  line-height: 0;
  transition: color 0.2s;
}

.github-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 480px) {
  .ai-bubble {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    height: 160px;
  }

  .free-plan-warning {
    left: 1rem;
    right: 1rem;
    bottom: auto;
    top: 1rem;
    max-width: none;
    width: auto;
  }

  #controls .btn {
    flex: 1;
    min-width: 0;
  }
}
