* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #e4e4e4;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00d9ff, #00ff88);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #8892a0;
  font-size: 1.1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.metric-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.metric-label {
  font-size: 0.85rem;
  color: #8892a0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  font-size: 0.9rem;
  color: #8892a0;
}

.grade-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.grade {
  font-size: 3rem;
  transition: color 0.3s;
}

.grade.excellent { color: #00ff88; }
.grade.good { color: #88ff00; }
.grade.fair { color: #ffcc00; }
.grade.poor { color: #ff4444; }

.jitter-details {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.jitter-phase {
  font-size: 0.9rem;
  color: #8892a0;
}

.jitter-label {
  font-weight: 600;
  margin-right: 0.3rem;
}

.jitter-phase:nth-child(1) .jitter-label { color: #4CAF50; }
.jitter-phase:nth-child(2) .jitter-label { color: #2196F3; }
.jitter-phase:nth-child(3) .jitter-label { color: #FF9800; }

#jitter-idle, #jitter-download, #jitter-upload {
  font-weight: 600;
  color: #fff;
}

.chart-container {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #8892a0;
}

.chart-legend {
  display: flex;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.legend-item::before {
  content: '';
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.legend-item.idle::before { background: #4CAF50; }
.legend-item.download::before { background: #2196F3; }
.legend-item.upload::before { background: #FF9800; }

#chart {
  width: 100%;
  height: 200px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.status {
  font-size: 1rem;
  color: #8892a0;
  min-height: 1.5em;
}

.status.active {
  color: #00d9ff;
}

.start-btn {
  background: linear-gradient(135deg, #00d9ff, #00ff88);
  border: none;
  border-radius: 50px;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.start-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 217, 255, 0.4);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.info-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
}

.info-section h3 {
  color: #fff;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.info-section p {
  color: #8892a0;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.grade-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grade-item {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.grade-item.excellent { color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.3); }
.grade-item.good { color: #88ff00; border: 1px solid rgba(136, 255, 0, 0.3); }
.grade-item.fair { color: #ffcc00; border: 1px solid rgba(255, 204, 0, 0.3); }
.grade-item.poor { color: #ff4444; border: 1px solid rgba(255, 68, 68, 0.3); }

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-value {
    font-size: 2rem;
  }

  .chart-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}
