* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  color: #2d3748;
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

.hero-section {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 20px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 10px;
  /* Updated gradient colors to blue-purple-cyan theme */
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 25%, #06b6d4 50%, #10b981 75%, #f59e0b 100%);
  background-size: 100% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: #4a5568;
  margin-bottom: 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 20px 12px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 2px solid transparent;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: color 0.3s ease;
}

.stat-value.current {
  color: #8b5cf6;
}
.stat-value.average {
  color: #06b6d4;
}
.stat-value.minimum {
  color: #f59e0b;
}
.stat-value.maximum {
  color: #10b981;
}

/* Color-coded FPS results */
.stat-value.fps-excellent {
  color: #10b981 !important;
} /* Green for 60+ FPS */
.stat-value.fps-good {
  color: #f59e0b !important;
} /* Yellow for 30-59 FPS */
.stat-value.fps-poor {
  color: #ef4444 !important;
} /* Red for <30 FPS */

.stat-label {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
}

.fps-graph-container {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  border: 1px solid #e2e8f0;
}

.graph-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: -0.5px;
}

#fpsCanvas {
  width: 100%;
  height: 400px;
  background: #fafbfc;
  cursor: crosshair;
  border-radius: 10px;
  display: block;
}

.graph-legend {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.legend-color {
  width: 20px;
  height: 4px;
  border-radius: 2px;
}

.stress-controls {
  background: white;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.controls-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12px;
  text-align: center;
}

.control-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.btn {
  padding: 8px 14px;
  border: none;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-transform: none;
  letter-spacing: 0.3px;
  min-width: 80px;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-start {
  background: #22c55e;
  color: white;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-start:hover {
  background: #16a34a;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.6);
}

.btn-pause {
  background: #f59e0b;
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-pause:hover {
  background: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
}

.btn-resume {
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-resume:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

.btn-reset {
  background: #8b5cf6;
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-reset:hover {
  background: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn-download {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  padding: 16px 32px;
  font-size: 1rem;
  font-weight: 700;
  min-width: 220px;
  border-radius: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-download:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.btn-add {
  background: #06b6d4;
  color: white;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn-add:hover {
  background: #0891b2;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.6);
}

.btn-remove {
  background: #dc2626;
  color: white;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

.btn-remove:hover {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.6);
}

.btn-clear {
  background: #ec4899;
  color: white;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.btn-clear:hover {
  background: #db2777;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
}

.stress-zone {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  min-height: 300px;
  position: relative;
  overflow: hidden;
  border: 2px dashed #e2e8f0;
}

.stress-element {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  animation: float 3s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  50% {
    transform: translateY(-20px) rotate(180deg) scale(1.1);
  }
}

.element-counter {
  text-align: center;
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #4a5568;
  background: #f7fafc;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-block;
}

.top-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
  align-items: center;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-section {
  text-align: center;
  margin-top: 30px;
  padding: 30px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 20px;
  border: 2px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.export-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 200% 0;
  }
  50% {
    background-position: -200% 0;
  }
}

.export-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

.export-subtitle {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 20px;
  line-height: 1.5;
}

.export-features {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #4b5563;
}

.feature-icon {
  width: 16px;
  height: 16px;
  background: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon::after {
  content: "✓";
  color: white;
  font-size: 10px;
  font-weight: bold;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .hero-section {
    padding: 30px 15px;
    margin-bottom: 30px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 15px 8px;
  }

  .control-group {
    flex-wrap: wrap;
    gap: 4px;
  }

  .btn {
    min-width: 70px;
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  #fpsCanvas {
    height: 300px;
  }

  .top-controls {
    flex-direction: column;
    align-items: center;
  }

  .top-controls .btn {
    width: 200px;
    margin-bottom: 8px;
  }

  .control-row {
    flex-direction: column;
    gap: 8px;
  }

  .graph-legend {
    gap: 15px;
  }

  .fps-graph-container {
    padding: 20px;
  }

  .export-features {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .fps-graph-container {
    padding: 15px;
  }

  #fpsCanvas {
    height: 250px;
  }
}

@media (min-width: 1200px) {
  .stats-grid {
    gap: 20px;
  }

  .stat-card {
    padding: 25px 15px;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  .stat-label {
    font-size: 1rem;
  }
}

/* Spinner CSS */
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border-left-color: #06b6d4;
  animation: spin 1s linear infinite;
  margin: 0 auto; /* Center the spinner */
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
