:root {
  --bg:           #0c0f08;
  --surface:      #131a0d;
  --track:        #1e2e12;
  --border:       #2d4018;
  --text:         #e8eddf;
  --text-muted:   #8a9470;
  --text-dim:     #3e4e28;
  --accent:       #8db33a;
  --accent-alt:   #c5d84a;
  --active-bg:    rgba(141, 179, 58, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* ── Header ── */
header {
  width: 100%;
  max-width: 960px;
  padding: 22px 32px;
  display: flex;
  align-items: center;
}

.logo {
  height: 36px;
  width: auto;
  opacity: 0.95;
}

/* ── Main layout ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px 40px;
  gap: 20px;
  width: 100%;
  max-width: 540px;
}

/* ── Barra de resultados ── */
.results-bar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 0 8px;
}

.result-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 4px;
  position: relative;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.result-col.active { opacity: 1; }
.result-col.done   { opacity: 0.8; }

.result-arrow {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1;
}

.result-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.result-value {
  font-size: 28px;
  font-weight: 300;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.5px;
  min-width: 80px;
  text-align: center;
}

.result-unit {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.result-underline {
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.3s;
}

#col-download.active .result-underline { background: var(--accent); }
#col-upload.active   .result-underline { background: var(--accent-alt); }

/* Ping central */
.ping-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  min-width: 80px;
}

.ping-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ping-icon {
  font-size: 11px;
  color: var(--text-dim);
}

.ping-val {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

.ping-label {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Gauge ── */
.gauge-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  flex-shrink: 0;
}

.gauge-svg {
  width: 100%;
  height: 100%;
}

#gauge-arc {
  transition: stroke-dasharray 0.12s linear;
}

.gauge-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.start-btn {
  pointer-events: all;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 5px;
  text-transform: uppercase;
  padding: 12px 20px;
  border-radius: 50%;
  transition: text-shadow 0.2s, color 0.2s;
  outline: none;
}

.start-btn:hover {
  color: #fff;
  text-shadow: 0 0 24px var(--accent), 0 0 48px rgba(141,179,58,0.4);
}

.speed-display {
  text-align: center;
  line-height: 1;
}

.speed-number {
  font-size: 52px;
  font-weight: 200;
  color: #fff;
  letter-spacing: -2px;
  line-height: 1;
}

.speed-unit-inline {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.hidden { display: none !important; }

/* ── Info card ── */
.info-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── ISP Info ── */
.isp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.isp-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.isp-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.isp-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
}

.isp-ip {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.isp-sep {
  display: flex;
  align-items: center;
  padding: 0 4px;
  opacity: 0.5;
}

.change-server {
  display: block;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 3px;
  transition: opacity 0.2s;
}

.change-server:hover { opacity: 0.7; }

/* ── Connection toggle ── */
.conn-toggle-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conn-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.conn-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 3px;
  overflow: hidden;
}

.conn-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 18px;
  transition: color 0.2s, background 0.2s;
  outline: none;
}

.conn-btn.active {
  color: var(--accent);
  background: rgba(141, 179, 58, 0.18);
  border-radius: 20px;
}

.conn-switch {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  transition: background 0.2s;
}

.conn-switch:hover { background: var(--accent); color: #0c0f08; }

/* ── Tick marks SVG ── */
.gauge-tick { stroke: #2d4018; stroke-width: 1.5; }
.gauge-tick-label {
  fill: #4a5e28;
  font-size: 9px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

/* ── Fase / estado ── */
.phase-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── Responsive ── */
@media (max-width: 420px) {
  .gauge-wrapper { width: 280px; height: 280px; }
  .speed-number { font-size: 40px; }
  .result-value { font-size: 22px; }
}
