:root {
  --bg-1: #0a0e27;
  --bg-2: #0f1535;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-main: #f4fbff;
  --text-muted: #a8c5d8;
  --accent-primary: #00d4ff;
  --accent-secondary: #0088ff;
  --accent-tertiary: #64ff72;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Sora", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 20% 10%, #1a3a5c 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, #1a2a4c 0%, transparent 35%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 500px;
  height: 500px;
  filter: blur(80px);
  border-radius: 50%;
  z-index: 0;
  opacity: 0.25;
  pointer-events: none;
}

.orb-1 {
  background: #0088ff;
  top: -150px;
  left: -100px;
  animation: drift 14s ease-in-out infinite alternate;
}

.orb-2 {
  background: #00d4ff;
  right: -120px;
  bottom: -150px;
  animation: drift 16s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from {
    transform: translateY(-15px) translateX(0px);
  }
  to {
    transform: translateY(15px) translateX(20px);
  }
}

.app-shell {
  width: min(1200px, 95vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 0;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  letter-spacing: 0.02em;
  font-weight: 700;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 0 20px var(--accent-primary);
}

.topbar-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

select {
  min-width: 150px;
  background: rgba(10, 14, 39, 0.95);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  margin-bottom: 40px;
}

.metrics-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 900px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  opacity: 0;
  animation: reveal-metric 0.6s ease-out forwards;
}

.metric-card.primary:nth-child(1) {
  animation-delay: 0s;
}

.metric-card.primary:nth-child(2) {
  animation-delay: 0.1s;
}

.metric-card.primary:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes reveal-metric {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.metric-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.metric-card[data-metric="download"] .metric-value {
  color: var(--accent-primary);
}

.metric-card[data-metric="upload"] .metric-value {
  color: var(--accent-secondary);
}

.metric-card[data-metric="ping"] .metric-value {
  color: var(--accent-tertiary);
}

.metric-unit {
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  color: var(--text-muted);
  letter-spacing: 0.03em;
  font-weight: 600;
}

.metric-card h2 {
  margin: 8px 0 0;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 600;
}

.action-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.btn-start {
  min-width: 280px;
  padding: 16px 36px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #000;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 212, 255, 0.3);
  transition: all 0.3s ease;
}

.btn-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(0, 212, 255, 0.4);
}

.btn-start:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  height: 20px;
}

.status-text.error {
  color: #ff6e7d;
}

.info-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 20px 28px;
  margin-bottom: 32px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.border-left {
  border-left: 1px solid var(--glass-border);
  padding-left: 28px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.info-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  color: var(--text-main);
  font-weight: 600;
}

.history-section {
  padding: 28px;
  margin-bottom: 24px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}

.history-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  min-height: 80px;
}

.history-item {
  background: rgba(10, 14, 39, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
}

.history-item strong {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.history-item div {
  margin: 4px 0;
  color: var(--text-main);
}

.export-section {
  display: flex;
  justify-content: center;
}

.btn-secondary {
  padding: 12px 28px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.btn-secondary:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-clear {
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear:hover {
  background: #ff6e7d;
  color: #fff;
  border-color: #ff6e7d;
}

@media (max-width: 900px) {
  .metrics-container {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .info-bar {
    grid-template-columns: 1fr;
  }

  .border-left {
    border-left: none;
    border-top: 1px solid var(--glass-border);
    padding-left: 0;
    padding-top: 20px;
    margin-top: 20px;
  }

  .btn-start {
    min-width: 100%;
  }

  .history {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    padding: 12px 16px;
    margin-bottom: 24px;
  }

  .metrics-container {
    gap: 16px;
  }

  .metric-value {
    font-size: clamp(1.8rem, 7vw, 3.5rem);
  }

  .hero {
    gap: 28px;
    margin-bottom: 28px;
  }

  .history {
    grid-template-columns: 1fr;
  }

  .history-section {
    padding: 16px;
  }
}

