  :root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #151c2e;
    --bg-card-hover: #1a2338;
    --accent: #00b4d8;
    --accent-glow: rgba(0, 180, 216, 0.3);
    --accent-dim: rgba(0, 180, 216, 0.1);
    --accent-secondary: #7b61ff;
    --text-primary: #f0f4ff;
    --text-secondary: #8892a8;
    --text-dim: #4a5568;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 16px;
  }

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

  body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Starfield background */
  .starfield {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
  }

  .starfield canvas { width: 100%; height: 100%; }

  /* Gradient overlay */
  .gradient-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: 
      radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 180, 216, 0.08) 0%, transparent 60%),
      radial-gradient(ellipse 60% 40% at 80% 90%, rgba(123, 97, 255, 0.06) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
  }

  .container {
    position: relative;
    z-index: 2;
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
  }

  /* Header */
  header {
    text-align: center;
    margin-bottom: 3rem;
  }

  .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
  }

  .logo-icon {
    width: 42px; height: 42px;
    position: relative;
  }

  .logo-icon svg { width: 100%; height: 100%; }

  .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.05em;
  }

  /* Main speed gauge */
  .gauge-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
  }

  .gauge-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin-bottom: 1.5rem;
  }

  .gauge-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
  }

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

  .gauge-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
  }

  .gauge-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    transition: color 0.3s;
  }

  .gauge-value.testing { color: var(--accent); }

  .gauge-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.25rem;
  }

  .gauge-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-height: 1.2em;
  }

  /* Start button */
  .start-btn {
    position: relative;
    background: linear-gradient(135deg, var(--accent), #0090b0);
    border: none;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 3rem;
    border-radius: 60px;
    cursor: pointer;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
    overflow: hidden;
  }

  .start-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 62px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .start-btn:hover::before { opacity: 1; }
  .start-btn:hover { transform: scale(1.04); box-shadow: 0 0 40px var(--accent-glow); }
  .start-btn:active { transform: scale(0.98); }
  .start-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
  .start-btn:disabled:hover { box-shadow: none; }

  /* Results grid */
  .results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
  }

  .result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
  }

  .result-card.active::before { opacity: 1; }
  .result-card.active { border-color: rgba(0, 180, 216, 0.2); background: var(--bg-card-hover); }

  .result-icon {
    width: 28px; height: 28px;
    margin: 0 auto 0.6rem;
    opacity: 0.5;
    transition: opacity 0.3s;
  }

  .result-card.active .result-icon { opacity: 1; }

  .result-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    font-weight: 500;
  }

  .result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
  }

  .result-unit {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.15rem;
    font-weight: 400;
  }

  /* Progress bar */
  .progress-section {
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 0.4s;
  }

  .progress-section.visible { opacity: 1; }

  .progress-bar-container {
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
  }

  .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
  }

  .progress-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    letter-spacing: 0.05em;
  }

  /* History */
  .history-section {
    margin-top: 2rem;
  }

  .history-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-weight: 500;
  }

  .history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .history-item {
    display: grid;
    grid-template-columns: 1fr repeat(4, auto);
    gap: 1.5rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8rem;
  }

  .history-date { color: var(--text-secondary); font-weight: 400; }
  .history-stat { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 0.8rem; }
  .history-stat small { color: var(--text-dim); font-size: 0.65rem; font-weight: 400; margin-left: 0.2rem; }

  /* Speed rating badge */
  .speed-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
  }

  .speed-rating.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .speed-rating.excellent { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
  .speed-rating.good { background: rgba(0, 180, 216, 0.15); color: var(--accent); border: 1px solid rgba(0, 180, 216, 0.2); }
  .speed-rating.fair { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
  .speed-rating.poor { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

  /* Server info */
  .server-info {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .server-info-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
  }

  .server-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
  }

  .server-info-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .server-info-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
  }

  /* Footer */
  footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
  }

  footer p {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.8;
  }

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

  /* Responsive */
  @media (max-width: 640px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
    .gauge-container { width: 240px; height: 240px; }
    .gauge-value { font-size: 3rem; }
    .history-item { grid-template-columns: 1fr 1fr; gap: 0.5rem; font-size: 0.75rem; }
    .container { padding: 1.5rem 1rem; }
  }

  /* Animations */
  @keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.2; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
  }

  .testing-pulse {
    position: absolute;
    top: 50%; left: 50%;
    width: 320px; height: 320px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    pointer-events: none;
  }

  .testing-pulse.active {
    animation: pulse-ring 2s ease-in-out infinite;
  }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .fade-in {
    animation: fadeInUp 0.6s ease forwards;
  }