/* Speed Test — light, clean layout (Asiatechin) */
.st-wrap {
  --st-dl: #0891b2;
  --st-dl-soft: #ecfeff;
  --st-ul: #7c3aed;
  --st-ul-soft: #f5f3ff;
  --st-ping: #d97706;
  --st-ping-soft: #fffbeb;
  --st-bg: #ffffff;
  --st-surface: #f8fafc;
  --st-border: #e2e8f0;
  --st-text: #0f172a;
  --st-muted: #64748b;
  --st-track: #e2e8f0;
  --st-accent: #0093e9;
  --st-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  max-width: 760px;
  margin: 0 auto 48px;
  padding: 0 16px;
  font-family: inherit;
}

.st-ookla {
  background: var(--st-bg);
  border: 1px solid var(--st-border);
  border-radius: 20px;
  padding: 28px 24px 24px;
  color: var(--st-text);
  position: relative;
  box-shadow: var(--st-shadow);
}

/* ── Top download / upload cards ── */
.st-top-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.st-top-metric {
  text-align: center;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid var(--st-border);
  background: var(--st-surface);
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.st-top-metric--download {
  border-color: #a5f3fc;
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 100%);
}

.st-top-metric--upload {
  border-color: #ddd6fe;
  background: linear-gradient(180deg, #faf5ff 0%, #fff 100%);
}

.st-top-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.st-top-metric--download .st-top-icon {
  color: var(--st-dl);
  background: var(--st-dl-soft);
}

.st-top-metric--upload .st-top-icon {
  color: var(--st-ul);
  background: var(--st-ul-soft);
}

.st-top-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.st-top-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--st-muted);
  line-height: 1.3;
}

.st-top-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  min-height: 42px;
  color: var(--st-text);
}

.st-top-metric--download .st-top-value { color: #0e7490; }
.st-top-metric--upload .st-top-value { color: #6d28d9; }

/* ── Ping row ── */
.st-ping-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--st-border);
  background: var(--st-surface);
}

.st-ping-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--st-text);
  text-align: center;
}

.st-ping-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.st-ping-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--st-border);
  min-width: 0;
}

.st-ping-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
}

.st-ping-badge svg {
  width: 18px;
  height: 18px;
}

.st-ping-item--idle .st-ping-badge {
  background: var(--st-ping-soft);
  color: var(--st-ping);
}

.st-ping-item--dl .st-ping-badge {
  background: var(--st-dl-soft);
  color: var(--st-dl);
}

.st-ping-item--ul .st-ping-badge {
  background: var(--st-ul-soft);
  color: var(--st-ul);
}

.st-ping-item-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--st-muted);
  text-align: center;
  line-height: 1.35;
}

.st-ping-val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--st-text);
  line-height: 1;
}

/* ── Activity ratings ── */
.st-activities {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.st-activity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--st-border);
  background: #fff;
  min-width: 0;
}

.st-activity-icon {
  width: 26px;
  height: 26px;
  color: #475569;
  stroke-width: 2;
  flex-shrink: 0;
}

.st-activity-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--st-muted);
  text-align: center;
  line-height: 1.35;
}

.st-dots {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: center;
}

.st-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.3s, transform 0.2s;
}

.st-dot.on {
  background: var(--st-accent);
  transform: scale(1.1);
}

/* ── Speedometer ── */
.st-speedometer {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 8px auto 0;
}

.st-gauge-shell {
  position: relative;
  width: 100%;
  padding-bottom: 52px;
  min-height: 260px;
}

.st-gauge-svg {
  width: 100%;
  height: auto;
  display: block;
}

.st-gauge-track {
  fill: none;
  stroke: var(--st-track);
  stroke-width: 14;
  stroke-linecap: round;
}

.st-gauge-arc {
  fill: none;
  stroke: url(#stGaugeArcGrad);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s ease-out;
}

.st-gauge-ticks text {
  fill: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: system-ui, -apple-system, sans-serif;
}

.st-gauge-readout {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 1;
  width: 70%;
  max-width: 220px;
}

.st-speed-value {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  color: var(--st-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-speed-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--st-muted);
  margin-top: 6px;
}

.st-unit-icon {
  width: 14px;
  height: 14px;
}

.st-unit-icon--dl { color: var(--st-dl); }
.st-unit-icon--ul { color: var(--st-ul); }

.st-go-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  margin: 0;
  border: 3px solid var(--st-accent);
  border-radius: 50%;
  background: #fff;
  color: var(--st-accent);
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, opacity 0.15s, box-shadow 0.2s, background 0.2s;
  z-index: 2;
  box-shadow: 0 4px 20px rgba(0, 147, 233, 0.18);
}

.st-go-btn:hover:not(:disabled) {
  transform: translateX(-50%) scale(1.03);
  background: #f0f9ff;
  border-color: #0284c7;
}

.st-go-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.st-running .st-go-btn {
  border-color: var(--st-muted);
  color: var(--st-muted);
  font-size: 13px;
}

.st-running.st-phase-upload .st-go-btn {
  border-color: var(--st-ul);
  color: var(--st-ul);
}

/* ── Footer ── */
.st-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--st-border);
}

.st-footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--st-border);
  background: var(--st-surface);
}

.st-footer-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.st-footer-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--st-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--st-accent);
}

.st-footer-avatar svg {
  width: 20px;
  height: 20px;
}

.st-footer-text {
  min-width: 0;
  flex: 1;
}

.st-footer-primary {
  font-size: 14px;
  font-weight: 700;
  color: var(--st-text);
  line-height: 1.45;
  word-break: break-word;
}

.st-footer-secondary {
  font-size: 12px;
  color: var(--st-muted);
  margin-top: 4px;
  line-height: 1.4;
  word-break: break-word;
}

.st-server-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.st-flag {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid var(--st-border);
}

.st-change-server {
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: #fff;
  color: var(--st-accent);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.st-change-server:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

.st-phase-label {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--st-muted);
  margin-top: 14px;
  min-height: 20px;
  line-height: 1.5;
}

/* ── Server dialog ── */
.st-server-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  background: #fff;
  color: var(--st-text);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

.st-server-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.st-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--st-border);
}

.st-dialog-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--st-text);
}

.st-dialog-close {
  border: none;
  background: var(--st-surface);
  color: var(--st-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.st-dialog-close:hover {
  background: #e2e8f0;
}

.st-server-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 0;
}

.st-server-group-title {
  padding: 10px 20px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--st-muted);
  letter-spacing: 0.04em;
}

.st-server-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--st-text);
  font-size: 14px;
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  transition: background 0.15s;
}

.st-server-option:hover {
  background: var(--st-surface);
}

.st-server-option.selected {
  background: #ecfeff;
}

.st-server-option .st-flag {
  width: 28px;
  height: 21px;
}

.st-server-option-name {
  font-weight: 700;
  line-height: 1.35;
  min-width: 0;
  word-break: break-word;
}

.st-server-option-city {
  font-size: 12px;
  color: var(--st-muted);
  white-space: nowrap;
}

/* ── Location dialog ── */
.st-location-dialog {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  background: #fff;
  color: var(--st-text);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

.st-location-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.st-loc-head-text h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--st-text);
}

.st-loc-head-text p {
  margin: 0;
  font-size: 13px;
  color: var(--st-muted);
  line-height: 1.5;
}

.st-loc-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.st-loc-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--st-text);
  margin-bottom: 8px;
}

.st-loc-field label svg {
  width: 18px;
  height: 18px;
  color: var(--st-accent);
  flex-shrink: 0;
}

.st-loc-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--st-border);
  border-radius: 12px;
  background: var(--st-surface);
  color: var(--st-text);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

.st-loc-select:focus {
  outline: none;
  border-color: var(--st-accent);
  box-shadow: 0 0 0 3px rgba(0, 147, 233, 0.15);
}

.st-loc-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.st-loc-hint {
  margin: 0;
  font-size: 12px;
  color: var(--st-muted);
  line-height: 1.55;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
}

.st-loc-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--st-border);
}

.st-loc-cancel,
.st-loc-start {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.st-loc-cancel {
  background: var(--st-surface);
  color: var(--st-muted);
  border: 1px solid var(--st-border);
}

.st-loc-cancel:hover {
  background: #e2e8f0;
}

.st-loc-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0093e9 0%, #0077c2 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 147, 233, 0.35);
}

.st-loc-start svg {
  width: 16px;
  height: 16px;
}

.st-loc-start:hover:not(:disabled) {
  filter: brightness(1.05);
}

.st-loc-start:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Error ── */
.st-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  display: none;
  line-height: 1.5;
}

.st-error.visible {
  display: block;
}

/* ── Tips ── */
.st-tips {
  margin-top: 32px;
  padding: 24px 22px;
  background: #f0f9ff;
  border-radius: 16px;
  border: 1px solid #bae6fd;
  border-right: 4px solid var(--st-accent);
}

.st-tips h3 {
  color: #0c4a6e;
  font-size: 17px;
  margin: 0 0 14px;
  font-weight: 800;
}

.st-tips ul {
  margin: 0;
  padding-right: 20px;
  color: #475569;
  font-size: 14px;
  line-height: 1.9;
}

.st-tips .st-ecare-link {
  color: var(--st-accent);
  font-weight: 700;
  text-decoration: none;
}

.st-tips .st-ecare-link:hover {
  text-decoration: underline;
}

@keyframes st-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.st-running .st-phase-label {
  animation: st-pulse 1.2s ease-in-out infinite;
  color: var(--st-accent);
}

@media (max-width: 640px) {
  .st-ookla {
    padding: 18px 14px 18px;
    border-radius: 16px;
  }

  .st-top-results {
    grid-template-columns: 1fr;
  }

  .st-top-value {
    font-size: 32px;
  }

  .st-ping-metrics {
    grid-template-columns: 1fr;
  }

  .st-activities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .st-speed-value {
    font-size: 40px;
  }

  .st-gauge-shell {
    min-height: 240px;
    padding-bottom: 48px;
  }

  .st-go-btn {
    width: 68px;
    height: 68px;
    font-size: 14px;
  }

  .st-footer {
    grid-template-columns: 1fr;
  }
}
