/* ═══════════════════════════════════════════
   ScanSpeed.in — Complete Stylesheet v4
═══════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─── */
:root {
  --bg:       #0a0e1a;
  --bg2:      #111827;
  --bg3:      #1a2235;
  --surface:  #162032;
  --border:   #1e2d45;
  --accent:   #00C9A7;
  --accent2:  #0084ff;
  --dl:       #00C9A7;
  --ul:       #7c6eff;
  --ping-c:   #f59e0b;
  --danger:   #ef4444;
  --text:     #e2e8f0;
  --text2:    #94a3b8;
  --text3:    #64748b;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Inter', sans-serif;
  --radius:   16px;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ══════════════════════════════════════════
   ADS
══════════════════════════════════════════ */
.ad-banner {
  width: 100%;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 6px;
}
.ad-bottom { border-top: 1px solid var(--border); border-bottom: none; }
.ad-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.ad-slot {
  min-height: 90px;
  width: min(728px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-placeholder {
  width: 100%;
  height: 90px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 13px;
  gap: 4px;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 10px,
    rgba(255,255,255,0.012) 10px, rgba(255,255,255,0.012) 20px
  );
}
.ad-placeholder small { font-size: 11px; opacity: 0.6; }
.ad-placeholder.vertical { height: 600px; flex-direction: column; gap: 8px; }
.ad-sidebar {
  width: 180px;
  flex-shrink: 0;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-text { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.logo-text .accent { color: var(--accent); }
.logo-text .tld    { color: var(--text3); font-weight: 400; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.site-nav a:hover,
.site-nav a.active { color: var(--accent); background: rgba(0,201,167,0.08); }
.ip-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  flex-shrink: 0;
}
.ip-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
.ip-value { font-family: var(--mono); font-size: 13px; color: var(--accent); }

/* ══════════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════════ */
.page-wrapper  { display: flex; max-width: 1400px; margin: 0 auto; }
.main-content  { flex: 1; min-width: 0; padding: 40px 28px; }

/* ══════════════════════════════════════════
   VPN STRIP
══════════════════════════════════════════ */
.vpn-strip {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 28px;
  font-size: 14px;
  background: var(--surface);
  transition: background 0.35s, border-color 0.35s;
}
.vpn-strip-ok   { background: rgba(0,201,167,0.07);  border-color: rgba(0,201,167,0.28); }
.vpn-strip-warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.35); }
.vpn-icon  { font-size: 22px; flex-shrink: 0; }
.vpn-info  { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.vpn-info strong { color: var(--text); font-size: 14px; }
.vpn-info span   { color: var(--text2); font-size: 13px; }
.vpn-badge {
  flex-shrink: 0;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--bg3);
  color: var(--text3);
}
.vpn-on  { background: rgba(245,158,11,0.18); color: #f59e0b; }
.vpn-off { background: rgba(0,201,167,0.15);  color: var(--accent); }

/* ══════════════════════════════════════════
   SPEED TEST HERO
══════════════════════════════════════════ */
.speedtest-hero { text-align: center; }
.hero-tagline {
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}
.hero-title {
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 44px;
}
.hero-title .accent { color: var(--accent); }

/* ─── GAUGE CLUSTER ─── */
.gauge-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 128px;
  text-align: center;
}
.stat-label { font-size: 11px; letter-spacing: 0.1em; color: var(--text3); margin-bottom: 8px; }
.stat-value { font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-unit  { font-size: 12px; color: var(--text3); margin-top: 4px; margin-bottom: 12px; }
.stat-bar   { height: 4px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.stat-fill  { height: 100%; width: 0%; border-radius: 4px; transition: width 0.6s ease; }
.ping-fill   { background: var(--ping-c); }
.jitter-fill { background: var(--ul); }

/* ── GAUGE CANVAS WRAPPER ── */
.main-gauge-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  flex-shrink: 0;
}
/* JS sets pixel size via devicePixelRatio; CSS pins display size */
#speedGauge {
  display: block;
  width: 280px !important;
  height: 280px !important;
  position: absolute;
  top: 0; left: 0;
}
.gauge-center {
  position: absolute;
  top: 0; left: 0;
  width: 280px;
  height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding-bottom: 12px; /* push text slightly above centre of arc */
}
.gauge-number {
  font-family: var(--mono);
  font-size: 50px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}
.gauge-unit  { font-size: 13px; color: var(--text3); margin-top: 4px; }
.gauge-phase {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ─── DL / UL RESULT BOXES ─── */
.speed-results {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 28px;
  transition: opacity 0.5s;
  flex-wrap: wrap;
}
.speed-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 190px;
}
.speed-box.download { border-color: rgba(0,201,167,0.3); }
.speed-box.upload   { border-color: rgba(124,110,255,0.3); }
.arrow-icon         { width: 30px; height: 30px; color: var(--dl); flex-shrink: 0; }
.arrow-icon.up      { color: var(--ul); }
.speed-box-data     { display: flex; flex-direction: column; }
.speed-box-label    { font-size: 11px; color: var(--text3); letter-spacing: 0.08em; text-transform: uppercase; }
.speed-box-value    { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.2; }
.speed-box-unit     { font-size: 12px; color: var(--text3); }

/* ─── SERVER INFO ─── */
.server-info   { display: flex; justify-content: center; gap: 32px; margin-bottom: 32px; flex-wrap: wrap; }
.server-detail { text-align: center; }
.server-label  { display: block; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.server-value  { font-size: 14px; color: var(--text2); font-weight: 500; }

/* ─── START BUTTON ─── */
.start-btn {
  display: inline-block;
  position: relative;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 17px 64px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, transform 0.15s;
  margin-bottom: 14px;
}
.start-btn:hover  { background: rgba(0,201,167,0.1); box-shadow: 0 0 32px rgba(0,201,167,0.28); transform: translateY(-2px); }
.start-btn:active { transform: translateY(0); }
.start-btn.running              { border-color: var(--danger); color: var(--danger); }
.start-btn.running:hover        { background: rgba(239,68,68,0.09); box-shadow: 0 0 28px rgba(239,68,68,0.2); }
.start-btn.running .btn-pulse   { display: none; }
.btn-pulse {
  position: absolute;
  inset: -2px;
  border-radius: 50px;
  border: 2px solid var(--accent);
  animation: pulse-ring 2s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse-ring {
  0%   { transform: scale(1);    opacity: 0.55; }
  100% { transform: scale(1.18); opacity: 0; }
}
.test-note { font-size: 12px; color: var(--text3); }

/* ══════════════════════════════════════════
   LIVE CHART SECTION
══════════════════════════════════════════ */
.live-graph-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 28px;
  overflow: hidden;
}
/* Canvas: let JS control pixel dimensions; CSS just stretches display */
#liveChart {
  display: block;
  width: 100%;
  margin-top: 8px;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text2);
  font-weight: 400;
  margin-left: auto;
}
.legend-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.legend-dot.dl { background: #00C9A7; }
.legend-dot.ul { background: #7c6eff; }

/* ══════════════════════════════════════════
   SECTION TITLE
══════════════════════════════════════════ */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ══════════════════════════════════════════
   HISTORY TABLE
══════════════════════════════════════════ */
.history-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 28px;
}
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
.history-table td { padding: 11px 14px; border-bottom: 1px solid rgba(30,45,69,0.5); color: var(--text2); }
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover td { background: rgba(0,201,167,0.025); }
.history-empty td { text-align: center; color: var(--text3); font-style: italic; padding: 28px; }
.history-empty a  { color: var(--accent); text-decoration: none; }
.col-dl   { color: var(--dl) !important; font-family: var(--mono); font-size: 13px; }
.col-ul   { color: var(--ul) !important; font-family: var(--mono); font-size: 13px; }
.col-mono { font-family: var(--mono); font-size: 13px; }
.history-table td small { font-size: 11px; color: var(--text3); margin-left: 2px; }
.rating-pill { display: inline-block; padding: 2px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.rating-excellent { background: rgba(0,201,167,0.14);  color: var(--accent); }
.rating-good      { background: rgba(0,132,255,0.14);  color: var(--accent2); }
.rating-average   { background: rgba(245,158,11,0.14); color: var(--ping-c); }
.rating-poor      { background: rgba(239,68,68,0.14);  color: var(--danger); }
.view-all-link {
  display: inline-block; margin-top: 14px; font-size: 13px;
  color: var(--accent); text-decoration: none; opacity: 0.8; transition: opacity 0.2s;
}
.view-all-link:hover { opacity: 1; }

/* ══════════════════════════════════════════
   INFO CARDS
══════════════════════════════════════════ */
.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-bottom: 8px; }
.info-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.info-icon    { font-size: 26px; margin-bottom: 12px; }
.info-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.info-card p  { font-size: 14px; color: var(--text2); line-height: 1.7; }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 32px 24px; }
.footer-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.footer-logo          { font-size: 18px; font-weight: 700; }
.footer-logo .accent  { color: var(--accent); }
.footer-links         { display: flex; gap: 24px; }
.footer-links a       { color: var(--text3); text-decoration: none; font-size: 14px; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy          { font-size: 13px; color: var(--text3); }

/* ══════════════════════════════════════════
   RESULTS + ABOUT PAGE SHARED
══════════════════════════════════════════ */
.page-hero     { margin-bottom: 32px; }
.page-title    { font-size: clamp(22px, 3.5vw, 36px); font-weight: 700; letter-spacing: -0.03em; color: var(--text); margin-bottom: 8px; }
.page-subtitle { font-size: 15px; color: var(--text2); margin-bottom: 18px; }
.page-actions  { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary {
  display: inline-block; padding: 10px 26px;
  background: var(--accent); color: #0a0e1a;
  font-weight: 700; font-size: 14px; border-radius: 8px; text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-secondary {
  display: inline-block; padding: 10px 26px;
  background: transparent; color: var(--text2);
  font-weight: 600; font-size: 14px; border-radius: 8px;
  border: 1px solid var(--border); cursor: pointer; font-family: var(--sans);
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--danger); color: var(--danger); }

/* ─── SUMMARY CARDS ─── */
.summary-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.summary-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 14px; text-align: center; }
.summary-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.summary-value { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.summary-value.accent-val { color: var(--accent); }
.summary-unit  { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ─── RATING GUIDE ─── */
.rating-guide { display: flex; flex-direction: column; }
.rg-row { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rg-row:last-child { border-bottom: none; }
.rg-val  { font-family: var(--mono); font-size: 13px; color: var(--text2); min-width: 155px; }
.rg-desc { font-size: 13px; color: var(--text3); flex: 1; }

/* ── ABOUT PAGE ── */
.about-section { margin-bottom: 32px; }
.about-steps   { display: flex; flex-direction: column; }
.about-step    { display: flex; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--border); }
.about-step:last-child { border-bottom: none; }
.step-num      { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--border); flex-shrink: 0; width: 46px; line-height: 1.3; }
.step-body h3  { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.step-body p   { font-size: 14px; color: var(--text2); line-height: 1.75; }

/* ─── FAQ ─── */
.faq-list { display: flex; flex-direction: column; gap: 4px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; transition: border-color 0.2s; }
.faq-item[open] { border-color: rgba(0,201,167,0.3); }
.faq-item summary {
  padding: 15px 18px; cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--text); list-style: none; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 20px; color: var(--accent); flex-shrink: 0; transition: transform 0.25s; font-weight: 300; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 14px 18px 16px; font-size: 14px; color: var(--text2); line-height: 1.75; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1100px) { .ad-sidebar { display: none; } }
@media (max-width: 768px) {
  .site-nav    { display: none; }
  .ip-badge    { display: none; }
  .header-inner { gap: 12px; }
  .main-content { padding: 24px 16px; }
  .gauge-cluster { gap: 14px; }
  .main-gauge-wrap { width: 240px; height: 240px; }
  #speedGauge  { width: 240px !important; height: 240px !important; }
  .gauge-center { width: 240px; height: 240px; }
  .gauge-number { font-size: 42px; }
  .hero-title   { margin-bottom: 28px; }
  .speed-box    { padding: 14px 18px; min-width: 160px; }
  .server-info  { gap: 18px; }
  .start-btn    { padding: 15px 44px; }
  .vpn-strip    { flex-wrap: wrap; }
  .vpn-badge    { order: -1; }
  .about-step   { flex-direction: column; gap: 8px; }
  .step-num     { font-size: 20px; width: auto; }
  .rg-row       { flex-direction: column; align-items: flex-start; gap: 6px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .page-actions { flex-direction: column; }
}
@media (max-width: 480px) {
  .gauge-cluster   { flex-direction: column; }
  .main-gauge-wrap { order: -1; }
  .speed-results   { flex-direction: column; align-items: center; }
  .info-cards      { grid-template-columns: 1fr; }
  .summary-cards   { grid-template-columns: repeat(2, 1fr); }
  .chart-legend    { display: none; }
}
