:root {
  color-scheme: light;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #10233f;
  --muted: #56708f;
  --accent: #1478ff;
  --line: #d8e2ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(150deg, #eef4ff 0%, #f8fbff 45%, #f1f8f9 100%);
  color: var(--text);
}

.layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(820px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 15px 45px rgb(16 35 63 / 0.08);
}

h1 {
  margin-top: 0;
}

p {
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: end;
  margin: 20px 0;
}

.block-controls {
  margin-top: -4px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
}

.toggle-control input {
  width: 16px;
  height: 16px;
}

.mode-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.mode-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.mode-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-slider {
  position: absolute;
  inset: 0;
  background: #d8e2ee;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.mode-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.mode-switch input:checked + .mode-slider {
  background: var(--accent);
}

.mode-switch input:checked + .mode-slider::before {
  transform: translateX(20px);
}

input,
select,
button {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

input:disabled,
select:disabled {
  background: #f2f6fb;
  color: #7489a5;
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.results {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th,
.results-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.results-table th:first-child,
.results-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.results-table tbody tr:last-child td {
  border-bottom: 0;
}

.chart-section {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
}

.chart-section h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

#liveChart {
  width: 100%;
  height: 280px;
  border: 1px solid #d7e5f8;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: #365071;
  font-size: 14px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.http-download-single {
  background: #1f77ff;
}

.legend-dot.http-download-multi {
  background: #7aaeff;
}

.legend-dot.http-upload-single {
  background: #ff7a21;
}

.legend-dot.http-upload-multi {
  background: #ffb27e;
}

.legend-dot.ws-download-single {
  background: #12a55f;
}

.legend-dot.ws-download-multi {
  background: #7fdbac;
}

.legend-dot.ws-upload-single {
  background: #bd34fe;
}

.legend-dot.ws-upload-multi {
  background: #d68efe;
}

.log {
  margin-top: 16px;
  padding: 12px;
  background: #0b1522;
  color: #b9dbff;
  border-radius: 10px;
  min-height: 150px;
  max-height: 300px;
  overflow: auto;
  font-size: 13px;
}

@media (max-width: 680px) {
  .card {
    padding: 16px;
  }

  .chart-section {
    padding: 10px;
  }

  .results-table th,
  .results-table td {
    padding: 10px 8px;
    font-size: 14px;
  }
}
