:root{
  --bg: #070a08;
  --bg-soft: #0e1410;
  --card: #101711;
  --line: #1d2a20;
  --green: #35e58a;
  --green-dim: #1c6b45;
  --yellow: #ffcf3d;
  --text: #eef2ee;
  --text-dim: #8fa196;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(53,229,138,0.10), transparent 60%),
    var(--bg);
  color:var(--text);
  font-family:'Inter', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
}

.wrap{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  max-width:720px;
  margin:0 auto;
  padding:24px 20px 32px;
}

/* ---------- Top bar ---------- */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.brand{display:flex; align-items:center; gap:10px;}
.brand-text{display:flex; flex-direction:column; line-height:1.15;}
.brand-mark{
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:20px;
  letter-spacing:-0.01em;
}
.accent-y{color:var(--yellow);}
.brand-sub{
  font-size:12.5px;
  color:var(--text-dim);
  font-weight:500;
}

.logo-mark{width:38px; height:38px; flex-shrink:0; overflow:visible;}
.logo-ring{
  fill:var(--bg-soft);
  stroke:var(--green);
  stroke-width:2;
}
.logo-ring-glow{
  fill:none;
  stroke:var(--green);
  stroke-width:1;
  opacity:0.5;
  filter:blur(3px);
  animation:ring-breathe 3s ease-in-out infinite;
}
.logo-bolt{
  fill:var(--yellow);
  filter:drop-shadow(0 0 4px rgba(255,207,61,0.65));
}
@keyframes ring-breathe{
  0%, 100%{ opacity:0.35; }
  50%{ opacity:0.75; }
}
.ip-chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 12px;
  background:var(--bg-soft);
  border:1px solid var(--line);
  border-radius:999px;
  font-size:12.5px;
  color:var(--text-dim);
}
.ip-chip .dot{
  width:7px;height:7px;border-radius:50%;
  background:var(--green);
  box-shadow:0 0 8px var(--green);
}
.ip-chip.live .dot{animation:pulse 1.4s infinite;}
@keyframes pulse{
  0%{opacity:1;} 50%{opacity:0.35;} 100%{opacity:1;}
}

/* ---------- Stage ---------- */
.stage{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:28px;
  padding:24px 0;
}

.gauge-zone{
  position:relative;
  width:min(100%, 400px);
}
.gauge-svg{width:100%; height:auto; display:block; overflow:visible;}

.arc-track{
  fill:none;
  stroke:var(--line);
  stroke-width:16;
  stroke-linecap:round;
}
.arc-fill{
  fill:none;
  stroke:var(--green);
  stroke-width:16;
  stroke-linecap:round;
  filter:drop-shadow(0 0 6px rgba(53,229,138,0.65));
  transition:stroke 0.3s ease;
}
.needle{
  stroke:var(--yellow);
  stroke-width:4;
  stroke-linecap:round;
  filter:drop-shadow(0 0 5px rgba(255,207,61,0.7));
  transform-origin:200px 220px;
  transition:transform 0.12s cubic-bezier(.4,1.4,.6,1);
}
.needle-hub{
  fill:var(--bg-soft);
  stroke:var(--yellow);
  stroke-width:3;
}
.tick{stroke:var(--text-dim); stroke-width:2; opacity:0.6;}
.tick-label{fill:var(--text-dim); font-size:11px; font-family:'Space Grotesk', sans-serif;}

.gauge-readout{
  position:absolute;
  left:0; right:0;
  bottom:6%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
}
.mbps{
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:clamp(38px, 10vw, 52px);
  font-variant-numeric:tabular-nums;
  color:var(--text);
  line-height:1;
}
.unit{
  font-size:13px;
  color:var(--text-dim);
  letter-spacing:0.02em;
}
.phase{
  margin-top:8px;
  font-size:13px;
  color:var(--green);
  font-weight:500;
  min-height:16px;
}

/* ---------- Start button ---------- */
.start-btn{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  gap:10px;
  appearance:none;
  border:none;
  cursor:pointer;
  background:linear-gradient(135deg, var(--yellow) 0%, #ffe27a 45%, var(--green) 130%);
  color:#141200;
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:17px;
  padding:16px 44px;
  border-radius:999px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 6px 0 #a97f14,
    0 12px 26px rgba(255,207,61,0.3),
    0 0 0 rgba(53,229,138,0);
  transition:transform 0.08s ease, box-shadow 0.25s ease;
  animation:btn-breathe 3.2s ease-in-out infinite;
}
.btn-bolt{
  width:18px; height:18px;
  fill:#141200;
  flex-shrink:0;
  transition:transform 0.2s ease;
}
.start-btn:hover .btn-bolt{ transform:scale(1.15) rotate(-6deg); }
.start-btn::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.55) 50%, transparent 60%);
  transform:translateX(-120%);
  transition:transform 0.6s ease;
  z-index:1;
}
.start-btn:hover::after{ transform:translateX(120%); }
.start-btn span, .start-btn svg{ position:relative; z-index:2; }

.start-btn:hover{transform:translateY(-1px);}
.start-btn:active{
  transform:translateY(3px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.4) inset,
    0 3px 0 #a97f14,
    0 6px 16px rgba(255,207,61,0.25);
}
.start-btn:disabled{
  background:var(--green-dim);
  color:#dff5e8;
  box-shadow:0 6px 0 #123c28;
  cursor:default;
  transform:none;
  animation:none;
}
.start-btn:disabled .btn-bolt{ fill:#dff5e8; }

@keyframes btn-breathe{
  0%, 100%{
    box-shadow:
      0 1px 0 rgba(255,255,255,0.5) inset,
      0 6px 0 #a97f14,
      0 12px 26px rgba(255,207,61,0.3),
      0 0 0 rgba(53,229,138,0);
  }
  50%{
    box-shadow:
      0 1px 0 rgba(255,255,255,0.5) inset,
      0 6px 0 #a97f14,
      0 14px 30px rgba(255,207,61,0.4),
      0 0 22px rgba(53,229,138,0.35);
  }
}

@media (prefers-reduced-motion: reduce){
  .start-btn{ animation:none; }
  .logo-ring-glow{ animation:none; }
}

/* ---------- Results ---------- */
.results{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:10px;
  width:100%;
}
.result-card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px 10px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}
.result-card.active{
  border-color:var(--green);
  box-shadow:0 0 0 1px var(--green) inset;
}
.r-label{
  font-size:12.5px;
  color:var(--text-dim);
}
.r-value{
  font-family:'Space Grotesk', sans-serif;
  font-weight:600;
  font-size:20px;
  font-variant-numeric:tabular-nums;
  color:var(--text);
}
.r-unit{
  font-size:11px;
  color:var(--text-dim);
  margin-left:3px;
  font-weight:500;
}

/* ---------- Improve My Speed button ---------- */
.improve-btn{
  margin-top:4px;
  display:inline-flex;
  align-items:center;
  gap:9px;
  appearance:none;
  cursor:pointer;
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:15.5px;
  letter-spacing:0.01em;
  padding:13px 30px;
  border-radius:999px;
  border:2px solid transparent;
  background-image:
    linear-gradient(var(--bg), var(--bg)),
    linear-gradient(120deg, var(--green), var(--yellow) 60%, var(--green));
  background-origin:border-box;
  background-clip:padding-box, border-box;
  color:var(--yellow);
  box-shadow:0 0 0 rgba(53,229,138,0);
  transition:transform 0.08s ease, box-shadow 0.25s ease, color 0.2s ease;
}
.improve-icon{
  width:16px; height:16px;
  fill:var(--green);
  transition:fill 0.2s ease, transform 0.3s ease;
}
.improve-btn:hover{
  transform:translateY(-1px);
  color:var(--text);
  box-shadow:0 0 22px rgba(255,207,61,0.28), 0 0 14px rgba(53,229,138,0.22);
}
.improve-btn:hover .improve-icon{
  fill:var(--yellow);
  transform:rotate(-14deg) scale(1.12);
}
.improve-btn:active{ transform:translateY(1px); }

/* ---------- Tips modal ---------- */
.tips-overlay{
  position:fixed;
  inset:0;
  background:rgba(3,6,4,0.72);
  backdrop-filter:blur(3px);
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:5vh 16px;
  opacity:0;
  visibility:hidden;
  transition:opacity 0.2s ease;
  z-index:50;
}
.tips-overlay.open{ opacity:1; visibility:visible; }

.tips-modal{
  position:relative;
  background:var(--bg-soft);
  border:1px solid var(--line);
  border-radius:20px;
  max-width:560px;
  width:100%;
  max-height:90vh;
  overflow-y:auto;
  padding:32px 26px 28px;
  box-shadow:0 20px 60px rgba(0,0,0,0.5);
}
.tips-close{
  position:absolute;
  top:16px; right:16px;
  width:32px; height:32px;
  border-radius:50%;
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text-dim);
  cursor:pointer;
  font-size:15px;
  line-height:1;
}
.tips-close:hover{ color:var(--text); border-color:var(--green); }

.tips-title{
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:24px;
  margin:0 0 10px;
}
.tips-subtitle{
  font-size:13.5px;
  color:var(--text-dim);
  line-height:1.55;
  margin:0 0 22px;
}
.tips-section-title{
  font-family:'Space Grotesk', sans-serif;
  font-size:14px;
  font-weight:600;
  color:var(--green);
  text-transform:uppercase;
  letter-spacing:0.04em;
  margin:22px 0 12px;
}
.tips-section-title.secret-title{ color:var(--yellow); }

.tips-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.tips-list li{
  display:flex;
  align-items:flex-start;
  gap:12px;
  font-size:13.5px;
  line-height:1.55;
  color:var(--text);
}
.tip-num{
  flex-shrink:0;
  width:22px; height:22px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:'Space Grotesk', sans-serif;
  font-size:11.5px;
  font-weight:700;
  background:rgba(53,229,138,0.12);
  color:var(--green);
  margin-top:1px;
}
.tips-list.secret .tip-num{
  background:rgba(255,207,61,0.14);
  color:var(--yellow);
}
.tips-footnote{
  margin:24px 0 0;
  padding-top:16px;
  border-top:1px solid var(--line);
  font-size:12px;
  color:var(--text-dim);
  line-height:1.5;
}

/* ---------- Footer ---------- */
.footer{
  text-align:center;
  padding-top:22px;
  font-size:13px;
  color:var(--text-dim);
}

@media (max-width:420px){
  .start-btn{padding:14px 36px; font-size:16px;}
  .results{gap:8px;}
}
