@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --border: #1f1f1f;
  --border-light: #2a2a2a;
  --text: #e8e8e8;
  --muted: #555;
  --muted2: #888;
  --accent: #6366f1;
  --accent-dim: rgba(99, 102, 241, 0.1);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.1);
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ---- layout ---- */

header {
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

.header-note {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 40px 100px;
}

.tool-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 56px;
}

/* ---- IP section ---- */

.ip-primary {
  padding: 36px 40px 28px;
  border-bottom: 1px solid var(--border);
}

.ip-addresses {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ip-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ip-address {
  font-family: var(--mono);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.ip-address.loading {
  color: var(--muted);
  animation: pulse 1.4s ease-in-out infinite;
}

.ip-address.secondary {
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--muted2);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.8;
  }
}

.ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted2);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.ip-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.ip-badge.v6 .dot {
  background: var(--green);
}

.ip-badge.unavailable {
  opacity: 0.4;
}

.ip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0;
}

.ip-field {
  padding: 18px 22px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.field-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-height: 19px;
}

.field-value.loading {
  width: 72px;
  height: 13px;
  margin-top: 3px;
  background: var(--border-light);
  border-radius: 3px;
  animation: pulse 1.4s ease-in-out infinite;
}

.privacy-note {
  padding: 12px 22px;
  font-size: 11px;
  color: var(--muted);
  background: var(--accent-dim);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-note svg {
  flex-shrink: 0;
  opacity: 0.5;
}

/* ---- speed test ---- */

.speed-layout {
  padding: 40px;
}

/* gauge area */

.gauge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 36px;
}

.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

.gauge-wrap svg {
  display: block;
}

.gauge-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}

.gauge-readout {
  text-align: center;
  margin-top: -4px;
}

.gauge-num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--muted);
  transition: color 0.3s;
}

.gauge-num.active {
  color: var(--text);
}

.gauge-num.done-dl {
  color: var(--green);
}

.gauge-num.done-ul {
  color: var(--accent);
}

.gauge-unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* ping / jitter side stats */

.side-stats {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stat-block {
  text-align: left;
}

.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--muted);
  line-height: 1;
  transition: color 0.3s;
}

.stat-value.done {
  color: var(--text);
}

.stat-unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* progress bar */

.speed-progress {
  margin-bottom: 28px;
}

.progress-track {
  width: 100%;
  height: 2px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.15s ease, background 0.3s;
}

/* controls */

.test-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-start {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 13px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.btn-start:hover {
  background: #5254cc;
}

.btn-start:active {
  transform: scale(0.98);
}

.btn-start:disabled {
  background: var(--border-light);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.status-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted2);
}

/* ---- footer ---- */

footer {
  text-align: center;
  padding: 28px 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ---- 404 ---- */

.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
}

.not-found .code {
  font-family: var(--mono);
  font-size: 80px;
  font-weight: 700;
  color: var(--border-light);
  line-height: 1;
}

.not-found h1 {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--muted);
  font-weight: 400;
}

/* ---- responsive ---- */

@media (max-width: 640px) {
  header {
    padding: 18px 20px;
  }

  .header-note {
    display: none;
  }

  main {
    padding: 36px 20px 80px;
  }

  .ip-primary {
    padding: 24px 20px 20px;
  }

  .ip-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ip-field {
    border-right: none;
  }

  .ip-field:nth-child(odd) {
    border-right: 1px solid var(--border);
  }

  .speed-layout {
    padding: 28px 20px;
  }

  .gauge-row {
    flex-direction: column;
    gap: 24px;
  }

  .side-stats {
    flex-direction: row;
    justify-content: center;
    gap: 32px;
  }
}