/* ==========================================================================
   ColdMatrix Internet Speed Test — Flagship Premium Edition
   Clean Background + Premium Border
   ========================================================================== */

:root {
  --charcoal: #0D1117;
  --charcoal-2: #131A24;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --white: #F5F7FA;
  --muted: #8B98A5;
  --royal-blue: #3B6CFF;
  --cyan: #22D3EE;
  --electric-blue: #4FC3F7;
  --emerald: #34D399;
  --purple: #A78BFA;
  --pink: #F472B6;
  --orange: #FDBA74;
  --yellow: #FDE047;
  --border: #232B36;
}

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

body.speedtest-body {
  /* No image – pure dark gradient with a subtle blue/cyan glow */
  background: radial-gradient(ellipse at 50% 0%, #1a2a40 0%, #0D1117 55%, #06090D 100%);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.container { max-width: 1000px; margin:0 auto; padding:0 24px; position:relative; z-index:2; }

/* ---------- Particle background ---------- */
#particleCanvas {
  position: fixed; inset:0; width:100%; height:100%; z-index:0; pointer-events:none;
}

/* ---------- Nav ---------- */
.navbar { position: sticky; top:0; z-index:100; background: rgba(13,17,23,0.85); backdrop-filter: blur(14px); border-bottom:1px solid var(--border); }
.nav-inner { display:flex; justify-content:space-between; align-items:center; padding:12px 0; flex-wrap:wrap; max-width:1000px; margin:0 auto; padding-left:24px; padding-right:24px; }
.logo { font-size:1.3rem; font-weight:700; color:var(--electric-blue); text-decoration:none; display:flex; align-items:center; gap:8px; }
.nav-links { display:flex; gap:24px; list-style:none; flex-wrap:wrap; }
.nav-links a { color:var(--muted); text-decoration:none; font-weight:500; font-size:0.95rem; }
.nav-links a:hover { color:var(--electric-blue); }

.ad-card { border-radius:14px; overflow:hidden; background: linear-gradient(90deg, rgba(13,17,23,0.75) 0%, rgba(13,17,23,0.45) 100%), url('ad-bg.jpg') center/cover no-repeat; border:1px solid var(--border); padding:18px; margin:20px 0; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px; }
.ad-card ul { list-style:none; padding:0; margin:0; }
.ad-card li { font-size:0.9rem; font-weight:600; color:#fff; margin-bottom:4px; }
.ad-card li::before { content:"✓"; color:var(--emerald); font-weight:700; margin-right:6px; }
.whatsapp-btn { background:#25D366; color:white; border-radius:50px; padding:10px 22px; text-decoration:none; font-weight:600; white-space:nowrap; }
.install-bar { background:var(--electric-blue); color:#0A0F14; text-align:center; padding:12px; border-radius:10px; margin:16px 0; font-weight:600; display:none; }
.install-bar button { background:#0A0F14; color:white; border:none; padding:6px 18px; border-radius:6px; margin-left:12px; font-weight:600; cursor:pointer; }

/* ---------- Brand header ---------- */
.brand-header { text-align:center; margin: 28px 0 6px; }
.brand-title { font-size:2rem; font-weight:800; letter-spacing:-0.5px; }
.brand-title .cold { color: var(--white); }
.brand-title .matrix { color: var(--royal-blue); text-shadow: 0 0 20px rgba(59,108,255,0.5); }
.brand-sub { font-size:1.1rem; font-weight:600; color:var(--muted); margin-top:2px; }
.brand-tagline { font-size:0.85rem; color:var(--muted); letter-spacing:2px; text-transform:uppercase; margin-top:6px; opacity:0.8; }

/* ---------- Gauge Section (Premium Elite Border) ---------- */
.gauge-section {
  display:flex; flex-direction:column; align-items:center;
  margin: 20px auto 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, var(--royal-blue), var(--cyan), var(--emerald)) 1;
  border-radius: 20px;
  padding: 28px 20px 20px;
  box-shadow: 
    0 0 0 1px rgba(79,195,247,0.15),
    0 8px 32px rgba(0,0,0,0.4), 
    0 0 80px rgba(79,195,247,0.1),
    inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
  animation: borderGlow 3s ease-in-out infinite alternate;
}
@keyframes borderGlow {
  0% { box-shadow: 0 0 0 1px rgba(79,195,247,0.15), 0 8px 32px rgba(0,0,0,0.4), 0 0 80px rgba(79,195,247,0.1), inset 0 1px 0 rgba(255,255,255,0.05); }
  100% { box-shadow: 0 0 0 2px rgba(34,211,238,0.3), 0 8px 40px rgba(0,0,0,0.5), 0 0 100px rgba(79,195,247,0.2), inset 0 1px 0 rgba(255,255,255,0.08); }
}
.gauge-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--royal-blue), var(--cyan), var(--emerald), var(--purple));
  z-index: 2;
  animation: gradientShift 4s linear infinite;
  background-size: 200% 100%;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.gauge-section::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.gauge-svg-wrap { position:relative; width: 100%; max-width: 380px; aspect-ratio: 1/1; }
.gauge-svg-wrap svg { width:100%; height:100%; overflow:visible; }

.gauge-tick-major { stroke: rgba(255,255,255,0.35); stroke-width:2.5; }
.gauge-tick-minor { stroke: rgba(255,255,255,0.12); stroke-width:1.4; transition: stroke 0.25s ease; }
.gauge-tick-minor.lit { stroke: rgba(79,195,247,0.9); }
.gauge-tick-label { fill: var(--muted); font-size:11px; font-family:'Inter',sans-serif; font-weight:600; }

.gauge-track { fill:none; stroke: rgba(255,255,255,0.05); stroke-width:20; }
.gauge-arc { fill:none; stroke-width:20; stroke-linecap:round; filter: drop-shadow(0 0 10px rgba(79,195,247,0.65)); transition: stroke 0.4s ease; }

.gauge-needle { transform-origin: 200px 200px; filter: drop-shadow(0 0 8px rgba(79,195,247,0.85)); transition: opacity 0.6s ease; }
.gauge-needle.hidden { opacity:0; }

.gauge-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.gauge-status { font-size:0.8rem; color:var(--muted); font-weight:600; letter-spacing:1px; text-transform:uppercase; min-height:16px; }
.gauge-value { font-size:3.2rem; font-weight:800; color:var(--white); line-height:1; margin-top:4px; transition: transform 0.3s ease; }
.gauge-value.pulse { animation: pulseOnce 0.5s ease; }
@keyframes pulseOnce { 0%{ transform:scale(1);} 40%{ transform:scale(1.12);} 100%{ transform:scale(1);} }
.gauge-unit { font-size:0.9rem; color:var(--muted); font-weight:600; margin-top:2px; }

/* ---------- Buttons ---------- */
.btn-premium { background: linear-gradient(135deg, var(--royal-blue), var(--electric-blue)); color:#06101F; border:none; padding:16px 40px; border-radius:50px; font-weight:700; font-size:1.05rem; cursor:pointer; box-shadow: 0 8px 24px rgba(59,108,255,0.35); transition: all 0.2s ease; display:block; margin: 20px auto 6px; }
.btn-premium:hover { box-shadow: 0 10px 32px rgba(59,108,255,0.55); transform: translateY(-1px); }
.btn-premium:active { transform: scale(0.98); }
.btn-premium:disabled { opacity:0.5; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-secondary { background: var(--glass-bg); border:1px solid var(--glass-border); color:var(--white); padding:12px 26px; border-radius:50px; font-weight:600; font-size:0.9rem; cursor:pointer; backdrop-filter: blur(10px); }
.btn-secondary:hover { border-color: var(--electric-blue); color: var(--electric-blue); }
.btn-row { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; margin: 10px 0 20px; }

/* ---------- Glass cards / results ---------- */
.results-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; margin: 20px 0; opacity:0; transform: translateY(10px); transition: all 0.5s ease; }
.results-grid.show { opacity:1; transform:none; }
.glass-card {
  background: var(--glass-bg); border:1px solid var(--glass-border); border-radius:16px;
  padding:18px; backdrop-filter: blur(16px); position:relative; overflow:hidden;
}
.glass-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}
.rc-icon { font-size:1.3rem; margin-bottom:8px; }
.rc-value { font-size:1.6rem; font-weight:800; }
.rc-unit { font-size:0.75rem; color:var(--muted); margin-left:4px; font-weight:600; }
.rc-label { font-size:0.78rem; color:var(--muted); margin-top:4px; font-weight:600; }
.rc-download .rc-value { color: var(--electric-blue); }
.rc-upload .rc-value { color: var(--purple); }
.rc-ping .rc-value { color: var(--emerald); }

.server-card { display:flex; align-items:center; gap:14px; margin-top:14px; }
.server-globe { font-size:1.8rem; animation: spinGlobe 6s linear infinite; }
@media (prefers-reduced-motion: reduce) { .server-globe { animation:none; } }
.server-info { font-size:0.85rem; color: var(--muted); }
.server-info strong { color: var(--white); display:block; font-size:0.95rem; }
.server-status { margin-left:auto; font-size:0.78rem; color: var(--emerald); font-weight:700; display:flex; align-items:center; gap:6px; }
.status-dot { width:8px; height:8px; border-radius:50%; background:var(--emerald); box-shadow: 0 0 8px var(--emerald); }
@keyframes spinGlobe { from{ transform:rotate(0deg);} to{ transform:rotate(360deg);} }

/* ---------- Ping packets ---------- */
.ping-visual { display:flex; align-items:center; justify-content:space-between; margin: 8px 0 4px; position:relative; height:30px; }
.ping-node { font-size:1.2rem; }
.ping-track { flex:1; height:2px; background: rgba(255,255,255,0.1); margin:0 12px; position:relative; border-radius:2px; overflow:hidden; }
.ping-packet { position:absolute; top:50%; width:8px; height:8px; margin-top:-4px; border-radius:50%; background: var(--emerald); box-shadow: 0 0 10px var(--emerald); animation: pingTravel 1.4s ease-in-out infinite; }
.ping-packet:nth-child(2) { animation-delay: 0.45s; }
.ping-packet:nth-child(3) { animation-delay: 0.9s; }
@keyframes pingTravel { 0%{ left:0%; opacity:0;} 10%{opacity:1;} 90%{opacity:1;} 100%{ left:96%; opacity:0;} }

/* ---------- Jitter waveform ---------- */
.jitter-wave { width:100%; height:40px; margin-top:8px; }
.jitter-wave path { fill:none; stroke: var(--purple); stroke-width:2; filter: drop-shadow(0 0 4px rgba(167,139,250,0.6)); }

/* ---------- History ---------- */
.history-section { margin-top:24px; }
.history-title { font-size:0.9rem; font-weight:700; color:var(--muted); margin-bottom:10px; text-transform:uppercase; letter-spacing:1px; }
.history-item { display:flex; justify-content:space-between; align-items:center; font-size:0.82rem; padding:10px 4px; border-bottom:1px solid var(--border); color:var(--muted); }
.history-item span strong { color:var(--white); }

/* ---------- Share bar ---------- */
.share-bar { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin:20px 0; }
.share-btn { display:flex; align-items:center; gap:8px; padding:12px 20px; border-radius:50px; font-weight:600; font-size:0.9rem; cursor:pointer; border:none; text-decoration:none; color:#fff; }
.share-whatsapp { background:#25D366; }
.share-pdf { background:#E53935; }
.share-jpg, .share-png { background: var(--glass-bg); color:var(--white); border:1px solid var(--glass-border); }

.note { font-size:0.78rem; color:var(--muted); margin-top:16px; border-top:1px solid var(--border); padding-top:12px; text-align:left; }
footer.site-footer { text-align:center; color:var(--muted); font-size:0.8rem; padding:40px 0 20px; border-top:1px solid var(--border); margin-top:50px; }
footer.site-footer a { color:var(--electric-blue); text-decoration:none; }
.whatsapp-float { position:fixed; bottom:20px; right:20px; z-index:999; width:48px; height:48px; background:#25D366; border-radius:50%; display:flex; align-items:center; justify-content:center; box-shadow:0 4px 15px rgba(0,0,0,0.4); text-decoration:none; color:#fff; font-size:1.4rem; }

#shareCapture { display:none; }

@media (max-width: 640px) {
  .results-grid { grid-template-columns: 1fr 1fr; }
  .gauge-value { font-size:2.4rem; }
  .brand-title { font-size:1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}