* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  background-color: #f4f4f9;
  margin: 0;
  padding: 20px;
  color: #222;
}

h1 {
  text-align: center;
  font-size: 1.5em;
  color: #1a237e;
  margin-bottom: 20px;
}

.test-container, .result-container, .history-container {
  max-width: 700px;
  margin: 0 auto 20px auto;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
}

button {
  padding: 10px 18px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

button:hover { background-color: #0056b3; }

button.secondary { background-color: #6c757d; }

button.secondary:hover { background-color: #545b62; }

button:disabled {
  background-color: #b0c4de;
  cursor: not-allowed;
}

.server-select {
  display: block;
  margin: 0 auto;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.error-message, .success-message {
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  border-radius: 6px;
  display: none;
  font-size: 0.9em;
}

.error-message {
  background: #fdecea;
  color: #c0392b;
}

.success-message {
  background: #eafaf1;
  color: #1e8449;
}

.result-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.result-card {
  flex: 1 1 190px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.test-title {
  font-size: 0.85em;
  color: #555;
  margin-bottom: 10px;
  font-weight: bold;
}

.progress-container {
  background: #e0e0e0;
  border-radius: 5px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  background: linear-gradient(to right, #2196F3, #21c1f3);
  height: 100%;
  width: 0%;
  transition: width 0.15s ease-out;
}

.result {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
}

.speed-value {
  font-size: 1.8em;
  font-weight: bold;
  color: #1a237e;
}

.unit { color: #777; font-size: 0.85em; }

.ping-result {
  font-size: 1.1em;
  font-weight: bold;
  color: #1a237e;
  margin: 6px 0;
}

.history-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
}

#historyList {
  font-size: 0.85em;
  color: #444;
}

.history-item {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.history-empty {
  color: #999;
  font-style: italic;
}

.note {
  text-align: center;
  font-size: 0.75em;
  color: #999;
  margin-top: -10px;
  margin-bottom: 15px;
}
