/* ═══════════════════════════════════════════════════════════════════════════
   Speedtest.now — Design System
   Dark navy base · Cyan/green accent · Clean typography · High contrast
   Inspired by: competitor light-panel three-column layout + dark pro aesthetic
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Custom Properties ─────────────────────────────────────────────────── */
:root {
  /* Palette */
  --bg-base:       #0b0f1a;
  --bg-surface:    #111827;
  --bg-raised:     #1a2235;
  --bg-border:     #1f2d45;
  --bg-hover:      #1d2b40;

  --accent:        #00d4aa;        /* teal-green — primary CTA */
  --accent-glow:   rgba(0, 212, 170, 0.2);
  --accent-dark:   #009f7f;
  --accent-2:      #3b82f6;        /* blue — secondary info */

  --text-primary:  #f0f4ff;
  --text-secondary:#9eaac7;
  --text-muted:    #5b6b8a;
  --text-inverse:  #0b0f1a;

  /* Status */
  --success:       #22c55e;
  --warning:       #f59e0b;
  --error:         #ef4444;
  --info:          #3b82f6;

  /* Speed quality colours */
  --q-excellent:   #22c55e;
  --q-good:        #84cc16;
  --q-fair:        #f59e0b;
  --q-poor:        #ef4444;

  /* Spacing scale (8-point) */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px;--sp-16: 64px; --sp-20: 80px; --sp-24: 96px;

  /* Type scale */
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Mono', monospace;

  --text-xs:  0.75rem;   /* 12px */
  --text-sm:  0.875rem;  /* 14px */
  --text-base:1rem;      /* 16px */
  --text-lg:  1.125rem;  /* 18px */
  --text-xl:  1.25rem;   /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Radii */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-full:9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
  --shadow-glow:0 0 40px var(--accent-glow);

  /* Transitions */
  --t-fast:  150ms ease;
  --t-base:  250ms ease;
  --t-slow:  400ms ease;
}

/* ── 2. Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img, svg { display: block; max-width: 100%; }

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: #fff; }

h1,h2,h3,h4,h5,h6 {
  font-weight: var(--fw-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

p { color: var(--text-secondary); margin-block: 0; }

button { cursor: pointer; font: inherit; }

/* ── 3. Utilities ─────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--sp-6); }
.container-narrow { max-width: 800px; }
.section { padding-block: var(--sp-20); }

.section-title {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--sp-3);
}

.section-sub {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--sp-10);
}

.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.section-header-row .section-title,
.section-header-row .section-sub { text-align: left; margin-bottom: 0; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  user-select: none;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── 4. Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: var(--fw-bold);
}
.btn-primary:hover {
  background: #00f0c3;
  border-color: #00f0c3;
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}
/* Nav buttons — compact, rectangular, consistent with btn-primary shape */
.btn-primary.btn-sm {
  text-transform: none;
  letter-spacing: normal;
  border-radius: 8px;
  font-weight: var(--fw-semibold);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--bg-border);
  border-radius: 8px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--text-base); }

/* ── 5. Navigation ────────────────────────────────────────────────────────── */
.nav-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bg-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo:hover { color: var(--text-primary); }
.logo-icon { width: 28px; height: 28px; color: var(--accent); }
.logo-accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-link:hover,
.nav-link.active { color: var(--text-primary); background: var(--bg-raised); }

.nav-admin-badge {
  background: rgba(251,146,60,.15);
  color: #fb923c;
  border: 1px solid rgba(251,146,60,.3);
}

/* ── Dropdowns — click-based, animated, glassmorphism panel ── */
.nav-dropdown { position: relative; }

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  cursor: pointer;
}
.nav-dropdown-toggle .chevron {
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  opacity: 0.6;
  flex-shrink: 0;
}
.nav-dropdown.open .nav-dropdown-toggle .chevron { transform: rotate(180deg); opacity: 1; }
.nav-dropdown.open .nav-dropdown-toggle { color: var(--text-primary); }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 230px;
  background: rgba(13,18,35,0.96);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 6px;
  box-shadow:
    0 24px 64px rgba(0,0,0,0.55),
    0 0 0 1px rgba(0,212,170,0.06),
    inset 0 1px 0 rgba(255,255,255,0.05);
  z-index: 300;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Bridge gap so mouse can travel from toggle to menu */
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.nav-dropdown-menu.open {
  display: block;
  animation: dropdown-in 0.2s cubic-bezier(.4,0,.2,1);
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.nav-dropdown-right { left: auto; right: 0; }

/* Section label inside dropdown */
.nav-dropdown-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

/* User info header */
.nav-dropdown-header {
  padding: 10px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 4px;
}
.nav-dropdown-header strong { display: block; color: var(--text-primary); font-size: var(--text-sm); font-weight: 600; }
.nav-dropdown-header small { color: var(--text-muted); font-size: 11px; }

/* Individual item */
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-radius: 9px;
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: rgba(0,212,170,0.09);
  color: var(--text-primary);
}
.nav-dropdown-item:hover .drop-icon { color: var(--accent); }

.drop-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.14s;
}

.nav-dropdown-danger { color: #f87171; }
.nav-dropdown-danger:hover { background: rgba(239,68,68,.1); color: #f87171; }
.nav-dropdown-danger .drop-icon { color: #f87171; opacity: 0.7; }

.nav-dropdown-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 5px 0; }

.nav-actions { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }

.nav-avatar-btn {
  background: none;
  border: none;
  padding: 0;
}
.avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: var(--fw-bold);
  font-size: var(--text-sm);
  cursor: pointer;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--sp-2);
  margin-left: auto;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--t-fast);
}

/* ── 6. Flash / Verify banner ─────────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: 72px;
  right: var(--sp-6);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 400px;
  width: 100%;
}
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.25s ease;
}
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } }

.flash-success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); color: #4ade80; }
.flash-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: #f87171; }
.flash-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; }
.flash-info    { background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3); color: #60a5fa; }
.flash-close { background: none; border: none; color: inherit; opacity: 0.6; font-size: 1.25rem; line-height: 1; padding: 0; }
.flash-close:hover { opacity: 1; }

.verify-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-6);
  background: rgba(245,158,11,.1);
  border-bottom: 1px solid rgba(245,158,11,.3);
  font-size: var(--text-sm);
  color: #fbbf24;
}
.verify-banner-link { font-weight: var(--fw-semibold); color: #fbbf24; text-decoration: underline; }

/* ── 7. HERO — Speed Test Widget ──────────────────────────────────────────── */
.hero {
  position: relative;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0,212,170,.10) 0%, transparent 65%),
    var(--bg-base);
  padding-top: var(--sp-12);
  padding-bottom: 0;
  overflow: hidden;
}

/* Hero title above the test widget */
.hero-headline {
  text-align: center;
  padding: 0 var(--sp-4) var(--sp-8);
}
.hero-headline h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}
.hero-headline h1 span { color: var(--accent); }
.hero-headline p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  max-width: 520px;
  margin: 0 auto;
}

/* Competition banner — cleaner */
.competition-banner {
  position: relative;
  overflow: hidden;
}
.competition-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,212,170,.04) 0%, transparent 60%);
  pointer-events: none;
}
.competition-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--accent);
}

/* Podium rank medals */
.podium-rank-1 { background: linear-gradient(135deg,#d4af37,#f5d57a); color: #3d2c00; }
.podium-rank-2 { background: linear-gradient(135deg,#a8a8a8,#d4d4d4); color: #2a2a2a; }
.podium-rank-3 { background: linear-gradient(135deg,#cd7f32,#e8a87c); color: #3d1a00; }
[class^="podium-rank-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-weight: 800;
  font-size: var(--text-sm);
  margin-bottom: var(--sp-2);
}

/* SEO authority content section */
.section-authority { background: var(--bg-base); }
.authority-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
  margin-top: var(--sp-8);
}
.authority-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
}
.authority-card-icon {
  width: 40px; height: 40px;
  background: rgba(0,212,170,.1);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-4);
  color: var(--accent);
}
.authority-card h3 { font-size: var(--text-base); font-weight: 700; margin-bottom: var(--sp-2); }
.authority-card p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; }

/* Benchmark table scroll wrapper */
.benchmark-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: var(--sp-8);
}
.benchmark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
  min-width: 560px; /* ensures both tables stay side-by-side and scroll together */
}

.speed-benchmark-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
}
.speed-benchmark-table th {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--bg-border);
}
.speed-benchmark-table td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.speed-benchmark-table tr:last-child td { border-bottom: none; }
.speed-benchmark-table td:first-child { color: var(--text-primary); font-weight: 600; }
.badge-excellent { color: #00d4aa; font-weight: 700; }
.badge-good      { color: #3b82f6; font-weight: 700; }
.badge-fair      { color: #f59e0b; font-weight: 700; }
.badge-poor      { color: #ef4444; font-weight: 700; }

.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--sp-8);
  align-items: center;
  min-height: 520px;
}

/* ── Left panel (context info) ── */
.test-panel {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

.context-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--bg-border);
}
.context-item:last-child { border-bottom: none; }

.context-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.context-icon svg { width: 18px; height: 18px; }

.context-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.context-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--fw-medium); letter-spacing: 0.05em; text-transform: uppercase; }
.context-value { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 20px; }
/* IPv6 addresses are long — truncate with ellipsis, full value shown in title */
#ctx-ip-value { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0; }

.change-server-btn {
  font-size: var(--text-xs);
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: var(--fw-medium);
  margin-top: 2px;
}
.change-server-btn:hover { color: #fff; }

.test-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--bg-border);
}
.toggle-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.05em; }
.toggle-options { display: flex; gap: 2px; background: var(--bg-base); padding: 2px; border-radius: var(--r-full); }
.toggle-btn {
  padding: 4px 14px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--t-fast);
}
.toggle-btn.active { background: var(--accent); color: var(--text-inverse); }

/* ── Center (GO button) ── */
.test-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
  width: 280px;
  flex-shrink: 0;
}

/* ── go-wrapper: the fixed-size box that holds ring + arc + button ── */
.go-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Orbit ring — fills the wrapper exactly */
.test-orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed var(--bg-border);
  pointer-events: none;
  transition: border-color var(--t-slow);
}
.test-orbit-ring.active {
  border-color: rgba(0, 212, 170, 0.55);
  animation: orbitSpin 3s linear infinite;
}
@keyframes orbitSpin { to { transform: rotate(360deg); } }

.orbit-dot {
  position: absolute;
  top: -5px;
  left: calc(50% - 5px);
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.test-orbit-ring.active .orbit-dot { opacity: 1; }

/* Progress arc — sits just inside the orbit ring */
.test-progress-arc {
  position: absolute;
  inset: 12px;                /* 12px inset from the 260px wrapper = 236px SVG */
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--t-base);
}
.test-progress-arc.visible { opacity: 1; }

.arc-bg { stroke: rgba(255,255,255,.07); }
.arc-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 100px 100px;
  transition: stroke-dashoffset 0.25s linear;
  filter: drop-shadow(0 0 6px var(--accent));
}

/* GO button — centered inside wrapper via flex */
.go-btn {
  position: relative;
  z-index: 2;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2.5px solid var(--accent);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  cursor: pointer;
  transition: background var(--t-base), box-shadow var(--t-base), transform var(--t-fast), color var(--t-fast);
  box-shadow: 0 0 0 12px rgba(0,212,170,.04), 0 0 0 24px rgba(0,212,170,.02);
}
.go-btn:hover {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 0 50px rgba(0,212,170,.35), 0 0 0 14px rgba(0,212,170,.06);
  transform: scale(1.05);
}
.go-btn:active { transform: scale(0.97); }
.go-btn.running {
  background: var(--bg-raised);
  border-color: var(--accent);
  cursor: default;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 20px rgba(0,212,170,.2), 0 0 0 12px rgba(0,212,170,.04); }
  50%      { box-shadow: 0 0 55px rgba(0,212,170,.5), 0 0 0 20px rgba(0,212,170,.08); }
}

.go-label {
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.04em;
  line-height: 1;
}
.go-phase {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 16px;
}

/* Live number display during test */
.test-live-number {
  font-family: var(--font-mono);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.test-live-number.visible {
  max-height: 60px;
  opacity: 1;
}
#live-value { font-size: var(--text-4xl); font-weight: var(--fw-bold); color: var(--accent); }
.live-unit { font-size: var(--text-base); color: var(--text-muted); }

/* Server info bar (below GO) */
.server-info-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
}
.server-bar-item { display: flex; align-items: center; gap: var(--sp-1); }
.server-bar-item svg { color: var(--accent); flex-shrink: 0; }
.server-bar-sep { color: var(--bg-border); }
.bar-change-link { color: var(--accent); font-weight: var(--fw-medium); cursor: pointer; }

/* ── Right panel (metrics) ── */
.test-panel-right { gap: var(--sp-3); }

.metric-card {
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: border-color var(--t-base);
}
.metric-card.active { border-color: var(--accent); }

.metric-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.metric-icon { width: 18px; height: 18px; color: var(--accent); }
.metric-name { font-size: var(--text-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  transition: color var(--t-fast);
  line-height: 1;
}
.metric-value.excellent { color: var(--q-excellent); }
.metric-value.good      { color: var(--q-good); }
.metric-value.fair      { color: var(--q-fair); }
.metric-value.poor      { color: var(--q-poor); }
.metric-unit { font-size: var(--text-sm); color: var(--text-muted); }

.metric-bar {
  height: 4px;
  background: var(--bg-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.3s ease;
}

.metric-row-pair {
  display: flex;
  gap: var(--sp-3);
}
.metric-mini {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-mini.wide { width: 100%; }
.metric-mini-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-mini-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1.2;
}
.metric-mini-unit { font-size: var(--text-xs); color: var(--text-muted); }
.metric-mini-divider { width: 1px; background: var(--bg-border); }

/* ── Trust bar ── */
.trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding-top: var(--sp-8);
  padding-bottom: var(--sp-8);
  flex-wrap: wrap;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.trust-item svg { color: var(--accent); }
.trust-link { color: var(--accent); font-weight: var(--fw-medium); font-size: var(--text-xs); }

/* ── 8. Server modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--bg-border);
}
.modal-header h2 { font-size: var(--text-lg); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; line-height: 1; padding: 0; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }

.server-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-muted);
}
.server-coming-soon svg { opacity: 0.4; }
.server-coming-soon p { margin: 0; font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.server-coming-soon span { font-size: var(--text-sm); line-height: 1.5; }

.server-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.server-option:hover { border-color: var(--accent); background: var(--bg-hover); }
.server-option.selected { border-color: var(--accent); }
.server-name { font-weight: var(--fw-semibold); font-size: var(--text-sm); color: var(--text-primary); }
.server-location { font-size: var(--text-xs); color: var(--text-muted); }
.server-ping { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--accent); }

/* ── 9. Explainer grid ────────────────────────────────────────────────────── */
.explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
@media (max-width: 900px) { .explainer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .explainer-grid { grid-template-columns: 1fr; } }

.explainer-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.explainer-card:hover {
  border-color: rgba(0,212,170,.35);
  box-shadow: 0 0 0 1px rgba(0,212,170,.1), 0 8px 32px rgba(0,0,0,.25);
}

.explainer-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.explainer-icon svg { width: 22px; height: 22px; }

/* Icon colour — pure SVG stroke, no background */
.icon-download { color: var(--accent); }
.icon-upload   { color: #60a5fa; }
.icon-ping     { color: #34d399; }
.icon-jitter   { color: #fbbf24; }
.icon-loss     { color: #f87171; }
.icon-server   { color: #a78bfa; }

.explainer-card h3 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.explainer-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}
.card-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.85;
  transition: opacity 0.14s;
}
.card-link:hover { opacity: 1; }

/* ── "What Affects" grid — uniform 5-col on desktop ── */
.affects-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-8);
}
@media (max-width: 1100px) { .affects-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .affects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .affects-grid { grid-template-columns: 1fr; } }

.affects-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color 0.18s;
}
.affects-card:hover { border-color: rgba(0,212,170,.3); }
.affects-card-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.affects-card-title svg { flex-shrink: 0; color: var(--accent); opacity: 0.8; }
.affects-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

/* ── 10. Tools grid ───────────────────────────────────────────────────────── */
.section-tools { background: var(--bg-surface); border-top: 1px solid var(--bg-border); border-bottom: 1px solid var(--bg-border); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4);
}
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  transition: all var(--t-fast);
}
.tool-card-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--r-md);
  opacity: 0.85;
  transition: opacity var(--t-fast);
}
.tool-card:hover .tool-card-img { opacity: 1; }
.tool-card-icon { width: 28px; height: 28px; color: var(--accent); }
/* Legacy fallback when no image present */
.tool-card svg:not(.tool-card-icon) { width: 28px; height: 28px; color: var(--accent); }
.tool-card:hover { border-color: var(--accent); background: var(--bg-hover); color: var(--text-primary); transform: translateY(-2px); }

/* ── 11. Rankings table ───────────────────────────────────────────────────── */
.rankings-table-wrap {
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rankings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.rankings-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
}
.rankings-table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--bg-border); }
.rankings-table tr:last-child td { border-bottom: none; }
.rankings-table tbody tr { transition: background var(--t-fast); }
.rankings-table tbody tr:hover { background: var(--bg-hover); }

.rank-pos { font-weight: var(--fw-bold); color: var(--text-muted); width: 40px; }
.rank-country a { color: var(--text-primary); font-weight: var(--fw-medium); }
.rank-country a:hover { color: var(--accent); }
.rank-speed { font-family: var(--font-mono); font-weight: var(--fw-semibold); }
.rank-download { color: var(--accent); }
.rank-upload   { color: var(--accent-2); }
.rank-ping { font-family: var(--font-mono); color: var(--text-secondary); }
.flag-emoji { margin-right: var(--sp-2); font-size: var(--text-base); }

/* ── 12. Competition banner ───────────────────────────────────────────────── */
.competition-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-raised));
  border: 1px solid var(--bg-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
}
.competition-icon { font-size: 3rem; flex-shrink: 0; }
.competition-text { flex: 1; }
.competition-text h2 { font-size: var(--text-2xl); margin-bottom: var(--sp-2); }
.competition-text p { color: var(--text-secondary); font-size: var(--text-base); }
.competition-cta { display: flex; gap: var(--sp-3); flex-shrink: 0; flex-wrap: wrap; }

/* ── 13. Blog grid ────────────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}
.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.blog-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.blog-card-img { width: 100%; height: 180px; object-fit: cover; }
.blog-card-body { padding: var(--sp-5); }
.blog-card-cat { font-size: var(--text-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.blog-card-title { font-size: var(--text-lg); margin: var(--sp-2) 0 var(--sp-3); line-height: 1.35; }
.blog-card-title a { color: var(--text-primary); }
.blog-card-title a:hover { color: var(--accent); }
.blog-card-excerpt { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--sp-4); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-meta { display: flex; gap: var(--sp-3); font-size: var(--text-xs); color: var(--text-muted); }

/* ── 14. FAQ ──────────────────────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-fast);
}
.faq-item[open] { border-color: var(--accent); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '+'; color: var(--accent); font-size: var(--text-xl); line-height: 1; }
.faq-item[open] .faq-question::after { content: '−'; }
.faq-answer { padding: 0 var(--sp-5) var(--sp-5); color: var(--text-secondary); font-size: var(--text-sm); }
.faq-more { text-align: center; margin-top: var(--sp-8); }

/* ── 15. Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: var(--sp-10);
  padding-top: var(--sp-16);
  padding-bottom: var(--sp-12);
}

.footer-logo { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text-primary); }
.footer-tagline { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--sp-3); max-width: 240px; line-height: 1.6; }

.footer-nav-group h4 {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
.footer-nav-group ul { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-nav-group a { font-size: var(--text-sm); color: var(--text-secondary); }
.footer-nav-group a:hover { color: var(--text-primary); }

.footer-bottom {
  border-top: 1px solid var(--bg-border);
  padding-block: var(--sp-5);
}
.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.footer-bottom-links { display: flex; gap: var(--sp-6); }
.footer-bottom-links a { color: var(--text-muted); }
.footer-bottom-links a:hover { color: var(--text-secondary); }

/* ── 16. Loading spinner ──────────────────────────────────────────────────── */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--sp-8) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 17. Auth pages ───────────────────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0,212,170,.08) 0%, transparent 70%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-10);
}
.auth-brand { display:flex; justify-content:center; margin-bottom: var(--sp-8); }
.auth-logo-link { display:flex; align-items:center; gap:var(--sp-3); text-decoration:none; color:var(--text-primary); font-size:var(--text-lg); font-weight:var(--fw-bold); letter-spacing:-0.02em; }
.auth-logo-link:hover { color:var(--text-primary); }
.auth-card h1 { font-size: var(--text-2xl); margin-bottom: var(--sp-2); text-align:center; }
.auth-card p { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--sp-8); text-align:center; }

.form-field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.form-field label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-primary); }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--t-fast);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { outline: none; border-color: var(--accent); }

.form-submit { width: 100%; padding: var(--sp-4); font-size: var(--text-base); margin-top: var(--sp-3); }
.form-footer { text-align: center; margin-top: var(--sp-6); font-size: var(--text-sm); color: var(--text-muted); }
.form-checkbox { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-sm); color: var(--text-secondary); }
.form-checkbox input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

.auth-divider { display:flex; align-items:center; gap:var(--sp-3); margin:var(--sp-6) 0; }
.auth-divider::before,.auth-divider::after { content:""; flex:1; height:1px; background:var(--bg-border); }
.auth-divider span { font-size:var(--text-xs); color:var(--text-muted); white-space:nowrap; }

/* Google OAuth button — Google brand colors */
.auth-oauth-btn { display:flex; align-items:center; justify-content:center; gap:var(--sp-3); width:100%; padding: 13px var(--sp-4); border-radius:var(--r-md); font-size:var(--text-sm); font-weight:600; text-decoration:none; border:none; transition:box-shadow 0.18s, filter 0.18s; margin-bottom:var(--sp-3); cursor:pointer; }
.auth-oauth-google { background:#fff; color:#3c4043; box-shadow:0 1px 3px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15); letter-spacing:0.01em; }
.auth-oauth-google:hover { box-shadow:0 2px 6px rgba(0,0,0,0.35), 0 4px 14px rgba(0,0,0,0.2); filter:brightness(0.97); color:#3c4043; }
.auth-oauth-github svg { color:var(--text-secondary); }

/* ── 18. Dashboard ────────────────────────────────────────────────────────── */
/* ── Dashboard layout ─────────────────────────────────────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.dashboard-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.db-user-block {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  margin-bottom: var(--sp-2);
}
.db-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #000;
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.db-user-info { min-width: 0; }
.db-user-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-user-email { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-sidebar-divider { height: 1px; background: var(--bg-border); margin: var(--sp-3) 0; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2-5, 10px) var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-raised); color: var(--text-primary); }
.sidebar-link.active {
  background: rgba(0,212,170,0.1);
  color: var(--accent);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.db-sidebar-actions { margin-top: auto; padding-top: var(--sp-2); }
.db-run-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-3);
  background: var(--accent);
  color: #000;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: opacity var(--t-fast);
}
.db-run-btn:hover { opacity: 0.88; }

/* Content area */
.dashboard-content { padding: var(--sp-8) var(--sp-10); max-width: 1100px; }

.db-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--bg-border);
}
.db-greeting { font-size: var(--text-2xl); font-weight: 700; margin: 0 0 var(--sp-1); }
.db-greeting-sub { color: var(--text-muted); font-size: var(--text-sm); margin: 0; }
.db-verify-banner {
  display: flex; align-items: center; gap: var(--sp-2);
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-xs); color: #fbbf24;
}
.db-verify-banner a { color: #fbbf24; font-weight: 600; margin-left: var(--sp-1); }

/* Stats row */
.db-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.db-stat {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-4);
  transition: border-color var(--t-fast);
}
.db-stat:hover { border-color: rgba(0,212,170,0.25); }
.db-stat-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.db-stat-icon svg { width: 18px; height: 18px; }
.db-stat-icon--neutral { background: rgba(148,163,184,0.1); color: var(--text-muted); }
.db-stat-icon--dl     { background: rgba(0,212,170,0.12);  color: var(--accent); }
.db-stat-icon--ul     { background: rgba(59,130,246,0.12); color: #3b82f6; }
.db-stat-icon--ping   { background: rgba(168,85,247,0.12); color: #a855f7; }
.db-stat-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.db-stat-value { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); line-height: 1; }
.db-stat-value--dl { color: var(--accent); }
.db-stat-value--ul { color: #3b82f6; }

/* Main grid */
.db-main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-6);
  align-items: start;
}

/* Cards */
.db-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
}
.db-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.db-card-title { font-size: var(--text-base); font-weight: 600; margin: 0; }
.db-card-link { font-size: var(--text-xs); color: var(--accent); text-decoration: none; font-weight: 600; }
.db-card-link:hover { text-decoration: underline; }

/* Table */
.db-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.db-table th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--bg-border); }
.db-table td { padding: var(--sp-3); border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.db-table tr:last-child td { border-bottom: none; }
.db-table tr:hover td { background: rgba(255,255,255,0.02); }
.db-td-muted { color: var(--text-muted); }
.db-td-dl { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.db-td-ul { color: #3b82f6; font-family: var(--font-mono); }
.db-td-mono { font-family: var(--font-mono); }
.db-row-link { font-size: var(--text-xs); color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.db-row-link:hover { text-decoration: underline; }

/* Empty state */
.db-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center; color: var(--text-muted); gap: var(--sp-3);
}
.db-empty-state svg { opacity: 0.3; }
.db-empty-state p { font-size: var(--text-sm); margin: 0; }

/* CTA card */
.db-cta-card {
  background: linear-gradient(135deg, rgba(0,212,170,0.06), rgba(59,130,246,0.04));
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  text-align: center;
}
.db-cta-icon {
  width: 48px; height: 48px;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
  color: #000;
}
.db-cta-icon svg { width: 20px; height: 20px; }
.db-cta-title { font-size: var(--text-base); font-weight: 700; margin: 0 0 var(--sp-1); }
.db-cta-sub { font-size: var(--text-xs); color: var(--text-muted); margin: 0 0 var(--sp-5); }

/* Competition card */
.db-competition-card { border-left: 3px solid gold; }

/* Quick links */
.db-quick-links { display: flex; flex-direction: column; gap: 2px; }
.db-quick-link {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2);
  font-size: var(--text-sm); color: var(--text-secondary);
  text-decoration: none; border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.db-quick-link:hover { background: var(--bg-raised); color: var(--text-primary); }

/* Dashboard old compat */
.dashboard-title { font-size: var(--text-2xl); font-weight: var(--fw-bold); margin-bottom: var(--sp-6); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.stat-card { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--r-lg); padding: var(--sp-5); }
.stat-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: var(--fw-semibold); margin-bottom: var(--sp-2); }
.stat-value { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--text-primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.stat-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: var(--fw-semibold); margin-bottom: var(--sp-2); }
.stat-value { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--text-primary); }

/* ── 19. Result page ──────────────────────────────────────────────────────── */
.result-hero {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,212,170,.1) 0%, transparent 70%);
  padding: var(--sp-16) 0 var(--sp-12);
}
.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5);
  max-width: 560px;
  margin: 0 auto var(--sp-8);
}
.result-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-align: center;
  display: block;
  text-decoration: none;
  color: inherit;
}
.result-metric-card--link {
  transition: border-color 0.18s, background 0.18s;
  cursor: pointer;
}
.result-metric-card--link:hover {
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.04);
}
.result-metric-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--sp-2); }
.result-metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1;
}
.result-metric-unit { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--sp-1); }
.result-quality-badge { display: inline-block; margin-top: var(--sp-2); padding: 2px var(--sp-2); border-radius: var(--r-full); font-size: var(--text-xs); font-weight: var(--fw-semibold); }
.badge-excellent { background: rgba(34,197,94,.15);  color: var(--q-excellent); }
.badge-good      { background: rgba(132,204,22,.15); color: var(--q-good); }
.badge-fair      { background: rgba(245,158,11,.15); color: var(--q-fair); }
.badge-poor      { background: rgba(239,68,68,.15);  color: var(--q-poor); }

.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
}
.use-case-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}
.use-case-item.yes { background: rgba(34,197,94,.1);  color: var(--q-excellent); }
.use-case-item.no  { background: rgba(239,68,68,.08); color: var(--text-muted); }

/* ── 20. Admin ────────────────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 64px); }
.admin-sidebar { background: var(--bg-surface); border-right: 1px solid var(--bg-border); padding: var(--sp-6) var(--sp-4); }
.admin-content { padding: var(--sp-8); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bg-border);
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--bg-border);
  color: var(--text-secondary);
}
.data-table tbody tr:hover { background: var(--bg-hover); }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}
.badge-open      { background: rgba(59,130,246,.15); color: var(--info); }
.badge-progress  { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-resolved  { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-closed    { background: var(--bg-raised);     color: var(--text-muted); }
.badge-active    { background: rgba(0,212,170,.12);  color: var(--accent); }

/* ── 21. Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-10);
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--sp-3);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: all var(--t-fast);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.current { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── 22. Leaderboard ──────────────────────────────────────────────────────── */
.leaderboard-header { text-align: center; padding: var(--sp-16) 0 var(--sp-10); }
.leaderboard-tabs {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  margin-bottom: var(--sp-10);
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-8);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--t-base);
  min-width: 120px;
  position: relative;
  overflow: hidden;
}
.tab-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t-base);
}
.tab-btn .tab-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-1);
  transition: all var(--t-base);
}
.tab-btn .tab-label { font-size: var(--text-sm); font-weight: var(--fw-bold); letter-spacing: 0.01em; }
.tab-btn .tab-unit  { font-size: var(--text-xs); font-family: var(--font-mono); opacity: 0.6; margin-top: 1px; }

/* Download tab — teal */
.tab-btn[data-tab="download"] .tab-icon { background: rgba(0,212,170,0.12); color: var(--accent); }
.tab-btn[data-tab="download"]:hover,
.tab-btn[data-tab="download"].active {
  border-color: var(--accent);
  background: rgba(0,212,170,0.06);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(0,212,170,0.15);
}
.tab-btn[data-tab="download"].active .tab-icon { background: rgba(0,212,170,0.2); }

/* Upload tab — blue */
.tab-btn[data-tab="upload"] .tab-icon { background: rgba(59,130,246,0.12); color: var(--accent-2); }
.tab-btn[data-tab="upload"]:hover,
.tab-btn[data-tab="upload"].active {
  border-color: var(--accent-2);
  background: rgba(59,130,246,0.06);
  color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2), 0 4px 20px rgba(59,130,246,0.15);
}
.tab-btn[data-tab="upload"].active .tab-icon { background: rgba(59,130,246,0.2); }

/* Ping tab — amber */
.tab-btn[data-tab="ping"] .tab-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.tab-btn[data-tab="ping"]:hover,
.tab-btn[data-tab="ping"].active {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.06);
  color: #f59e0b;
  box-shadow: 0 0 0 1px #f59e0b, 0 4px 20px rgba(245,158,11,0.15);
}
.tab-btn[data-tab="ping"].active .tab-icon { background: rgba(245,158,11,0.2); }

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-10);
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  min-width: 140px;
  transition: border-color var(--t-fast);
}
.podium-place:hover { border-color: var(--accent); }
.podium-place.p1 { border-color: gold; padding-bottom: var(--sp-10); }
.podium-place.p2 { padding-bottom: var(--sp-6); }
.podium-rank { font-size: var(--text-2xl); }
.podium-name { font-weight: var(--fw-bold); font-size: var(--text-sm); color: var(--text-primary); }
.podium-score { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--accent); }

/* ── 23. Chart wrapper ────────────────────────────────────────────────────── */
.chart-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
}
.chart-wrapper h3 { font-size: var(--text-base); margin-bottom: var(--sp-4); }

.chart-stats-table { margin-top: var(--sp-2); border-top: 1px solid var(--bg-border); padding-top: var(--sp-4); }
.chart-stats-table table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.chart-stats-table thead th {
  text-align: right;
  padding: 0 var(--sp-3) var(--sp-2);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-stats-table thead th:first-child { text-align: left; }
.chart-stats-table tbody td {
  text-align: right;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-top: 1px solid var(--bg-border);
}
.chart-stats-table tbody td:first-child { text-align: left; font-family: var(--font-sans); color: var(--text-primary); }
.chart-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--sp-2);
  vertical-align: middle;
}

/* ── 24. Responsive ───────────────────────────────────────────────────────── */

/* Prevent all horizontal overflow site-wide */
html, body { overflow-x: hidden; max-width: 100%; }

@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; }
  .test-panel-left  { order: 2; }
  .test-center      { order: 1; margin: 0 auto; }
  .test-panel-right { order: 3; }
  .footer-inner { grid-template-columns: repeat(3, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
}

/* ── Mobile nav elements (hidden on desktop) ── */
.nav-mobile-auth { display: none; }
.nav-backdrop    { display: none; }

/* ── 768px — Main mobile breakpoint ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Nav: hide desktop elements ── */
  .nav-links   { display: none; }
  .nav-actions { display: none; }
  .nav-hamburger { display: flex; }

  /* ── Hamburger → X animation ── */
  .nav-hamburger span { transition: transform 0.22s ease, opacity 0.22s ease; }
  .nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ── Backdrop ── */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open { overflow: hidden; }

  /* ── Mobile nav panel ── */
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-base);
    border-top: 1px solid var(--bg-border);
    z-index: 99;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--sp-2) 0 var(--sp-10);
    gap: 0;
    -webkit-overflow-scrolling: touch;
    text-align: left;
  }

  /* ── Direct nav links ── */
  .nav-links.open > .nav-link {
    display: flex;
    align-items: center;
    padding: 15px var(--sp-5);
    font-size: var(--text-base);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    min-height: 52px;
    text-decoration: none;
  }
  .nav-links.open > .nav-link.active {
    color: var(--accent);
  }
  .nav-links.open > .nav-link:active {
    background: rgba(255,255,255,0.04);
  }

  /* ── Dropdown sections ── */
  .nav-links.open .nav-dropdown {
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .nav-links.open .nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px var(--sp-5);
    font-size: var(--text-base);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    min-height: 52px;
    text-align: left;
  }
  .nav-links.open .nav-dropdown-toggle:active {
    background: rgba(255,255,255,0.04);
  }
  .nav-links.open .nav-dropdown-toggle .chevron {
    transition: transform 0.22s ease;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
  }
  .nav-links.open .nav-dropdown.open .nav-dropdown-toggle .chevron {
    transform: rotate(180deg);
    color: var(--accent);
  }
  .nav-links.open .nav-dropdown.open .nav-dropdown-toggle {
    color: var(--accent);
  }

  /* ── Dropdown menu: static accordion ── */
  .nav-links.open .nav-dropdown-menu {
    position: static !important;
    display: none;
    flex-direction: column;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    background: rgba(255,255,255,0.02) !important;
    border: none !important;
    border-radius: 0 !important;
    padding: var(--sp-1) var(--sp-3) var(--sp-3) !important;
    width: auto !important;
    min-width: 0 !important;
    animation: none !important;
    pointer-events: auto !important;
  }
  .nav-links.open .nav-dropdown.open .nav-dropdown-menu {
    display: flex !important;
  }
  .nav-links.open .nav-dropdown-item {
    padding: 11px var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--text-sm);
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
  }
  .nav-links.open .nav-dropdown-item:hover,
  .nav-links.open .nav-dropdown-item:active {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
  }
  .nav-links.open .nav-dropdown-label {
    font-size: 10px;
    padding: var(--sp-3) var(--sp-3) var(--sp-1);
    letter-spacing: 0.08em;
    color: var(--text-muted);
  }
  .nav-links.open .nav-dropdown-divider {
    margin: var(--sp-2) 0;
    background: rgba(255,255,255,0.06);
  }
  .nav-links.open .nav-dropdown-header {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: var(--sp-1);
  }

  /* ── Mobile auth footer ── */
  .nav-mobile-auth {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: auto;
    padding: var(--sp-5) var(--sp-5) var(--sp-2);
    border-top: 1px solid var(--bg-border);
  }
  .nav-mobile-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) 0 var(--sp-4);
  }
  .nav-mobile-auth-link {
    display: flex;
    align-items: center;
    padding: 11px var(--sp-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--r-md);
    min-height: 44px;
    transition: background 0.15s;
  }
  .nav-mobile-auth-link:active,
  .nav-mobile-auth-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
  }
  .nav-mobile-auth-danger { color: #f87171; }
  .nav-mobile-auth .btn {
    display: flex !important;
    text-align: center;
    padding: 13px var(--sp-4);
    font-size: var(--text-base);
    width: 100%;
    justify-content: center;
  }

  /* ── Nav: disable backdrop-filter when menu open (so fixed panel works) ── */
  .nav-header.menu-open {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* ── Hero & test panel ── */
  .hero-inner { padding: var(--sp-8) 0; gap: var(--sp-6); }
  .test-center { width: 100%; max-width: 100%; }
  .go-wrapper { width: 200px; height: 200px; }
  .go-btn { width: 120px; height: 120px; }
  .go-label { font-size: var(--text-2xl); }
  .test-panel-left, .test-panel-right { width: 100%; }

  /* ── Tables: horizontal scroll on mobile ── */
  .rankings-table-wrap,
  .recent-tests-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rankings-table { min-width: 520px; }

  /* ── Leaderboard tabs ── */
  .leaderboard-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--sp-2);
    flex-wrap: nowrap;
  }
  .tab-btn { flex-shrink: 0; }
  .lb-join-cta { flex-direction: column; text-align: center; }
  .lb-join-actions { justify-content: center; flex-wrap: wrap; }

  /* ── Page headers ── */
  .pg-header { padding-bottom: var(--sp-6); }
  .pg-header h1 { font-size: var(--text-2xl); }

  /* ── Info cards: full width on small screens ── */
  .info-cards { grid-template-columns: 1fr; }

  /* ── Result page ── */
  .result-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .result-header { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }

  /* ── Blog / content ── */
  .blog-grid { grid-template-columns: 1fr; }
  .blog-hero-meta { flex-wrap: wrap; gap: var(--sp-2); }

  /* ── Footer ── */
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6) var(--sp-8);
    padding-top: var(--sp-10);
    padding-bottom: var(--sp-8);
  }
  .footer-brand {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--bg-border);
  }
  .footer-tagline { display: none; } /* hidden on mobile to save space */
  .footer-nav-group { min-width: 0; }
  .footer-nav-group h4 { margin-bottom: var(--sp-3); }
  .footer-nav-group ul { gap: var(--sp-2); }
  .footer-nav-group a { font-size: var(--text-xs); line-height: 1.5; }
  .footer-bottom-inner { flex-direction: column; gap: var(--sp-2); text-align: center; }
  .footer-bottom-links { gap: var(--sp-4); justify-content: center; }

  /* ── Misc layout ── */
  .competition-banner { flex-direction: column; text-align: center; }
  .section-header-row { flex-direction: column; align-items: flex-start; }
  .pg-related { flex-wrap: wrap; gap: var(--sp-3); }
  .champ-steps { grid-template-columns: 1fr !important; }
  .champ-how { padding: var(--sp-5); }

  /* ── Dashboard ── */
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-sidebar { display: none; }

  /* ── Rankings page additions ── */
  .pg-search-bar { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .pg-search-wrap { width: 100%; }

  /* ── Hero section title ── */
  .hero-title { font-size: clamp(1.75rem, 7vw, 3rem); }
  .hero-sub { font-size: var(--text-base); }
}

/* ── 480px — Small phones ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding-inline: var(--sp-4); }
  .section { padding-block: var(--sp-10); }
  .section-title { font-size: var(--text-2xl); }
  .go-btn { width: 120px; height: 120px; }
  .go-label { font-size: var(--text-xl); }
  .result-metrics-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: var(--sp-5) var(--sp-6); padding-top: var(--sp-8); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-nav-group a { font-size: var(--text-xs); }

  /* Buttons full-width in CTAs on smallest screens */
  .banner-cta-btns { flex-direction: column; }

  /* Rankings table more compact */
  .rankings-table { min-width: 420px; font-size: var(--text-xs); }
  .rankings-table th, .rankings-table td { padding: var(--sp-2) var(--sp-3); }

  /* Hero go button */
  .metric-row { flex-direction: column; gap: var(--sp-2); }

  /* Cards single column */
  [style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: 1fr !important; }

  /* Page header */
  .pg-header h1 { font-size: var(--text-xl); }
  .pg-sub { font-size: var(--text-sm); }

  /* Nav height offset */
  .nav-links.open { top: 64px; }

  /* Flash messages full width */
  .flash-container { left: var(--sp-4); right: var(--sp-4); }
  .flash { max-width: 100%; }
}

/* ── 25. Print ────────────────────────────────────────────────────────────── */
@media print {
  .nav-header, .site-footer, .flash-container, .trust-bar { display: none; }
  body { background: #fff; color: #000; }
}

/* ── 26. ISP Directory & Detail ──────────────────────────────────────────── */

/* Two-column layout: main content + sidebar */
.isp-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--sp-8);
  align-items: start;
}

@media (max-width: 900px) {
  .isp-layout {
    grid-template-columns: 1fr;
  }
  .isp-sidebar {
    order: -1;
  }
}

/* Sticky sidebar */
.isp-sidebar {
  position: sticky;
  top: calc(64px + var(--sp-6));
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ISP info / plans / issues table */
.isp-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.isp-info-table th,
.isp-info-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--bg-border);
  text-align: left;
  vertical-align: top;
}
.isp-info-table thead th {
  background: var(--bg-card);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.isp-info-table tbody tr:last-child th,
.isp-info-table tbody tr:last-child td {
  border-bottom: none;
}
.isp-info-table tbody th {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 140px;
}
.isp-info-table tbody tr:hover td,
.isp-info-table tbody tr:hover th {
  background: rgba(255,255,255,0.02);
}

/* Sidebar widget boxes */
.related-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: var(--sp-4) var(--sp-5);
}
.related-box h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.related-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.related-box ul li a {
  font-size: var(--text-sm);
  color: var(--text-base);
  text-decoration: none;
  transition: color 0.15s;
}
.related-box ul li a:hover {
  color: var(--accent);
}

/* ISP card grid in directory */
.isp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-5);
}
.isp-card-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
}

/* ISP card */
.isp-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 12px;
  padding: var(--sp-5);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
}
.isp-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.isp-card--sm {
  padding: var(--sp-4);
  border-radius: 10px;
}

.isp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}
.isp-card-name {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.isp-card-asn {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
  padding-top: 3px;
}
.isp-card-tagline {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.isp-card-speeds {
  display: flex;
  gap: var(--sp-5);
  border-top: 1px solid var(--bg-border);
  padding-top: var(--sp-3);
}
.isp-card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.isp-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.isp-metric-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.isp-metric-value small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}
.isp-card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.isp-card-arrow {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 600;
  margin-top: auto;
}

/* Technology badge */
.tech-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(0, 212, 170, 0.08);
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 20px;
  color: var(--accent);
  white-space: nowrap;
}

/* Speed rating badges */
.speed-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.speed-badge--excellent { background: rgba(0,212,170,0.12); color: #00d4aa; border: 1px solid rgba(0,212,170,0.3); }
.speed-badge--good      { background: rgba(96,170,255,0.12); color: #60aaff; border: 1px solid rgba(96,170,255,0.3); }
.speed-badge--fair      { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.speed-badge--poor      { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.speed-badge--unknown   { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--bg-border); }

/* Pros / cons two-column grid */
.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}
.pros-cons-col {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: var(--sp-5);
}
.pros-col { border-top: 3px solid var(--accent); }
.cons-col { border-top: 3px solid #f87171; }

@media (max-width: 600px) {
  .pros-cons-grid {
    grid-template-columns: 1fr;
  }
  .isp-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Recent Tests Feed ──────────────────────────────────────────────────────── */
.section-recent-tests {
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  padding-block: var(--sp-8);
}
.recent-tests-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.rt-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: rt-pulse 2s ease-in-out infinite;
}
@keyframes rt-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  50% { opacity: .7; box-shadow: 0 0 0 5px transparent; }
}
.recent-tests-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin: 0;
}
.recent-tests-table-wrap {
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.recent-tests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.recent-tests-table thead tr {
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-border);
}
.recent-tests-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.recent-tests-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-border);
}
.recent-tests-table tbody tr:last-child td { border-bottom: none; }
.recent-tests-table tbody tr:hover td { background: var(--bg-card); }
.rt-time { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.rt-isp { color: var(--text-primary); font-weight: var(--fw-medium); }
.rt-ip { font-family: monospace; font-size: var(--text-xs); color: var(--text-muted); }
.rt-dl { color: #34d399; font-weight: var(--fw-semibold); }
.rt-ul { color: #60a5fa; font-weight: var(--fw-semibold); }
.rt-ping { color: var(--text-secondary); }
.rt-new { animation: rt-fadein .4s ease; }
@keyframes rt-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.rt-placeholder td { text-align: center; color: var(--text-muted); padding: var(--sp-5); }

/* ── Blog CTA banner ────────────────────────────────────────────────────────── */
.section-blog-cta {
  background: var(--bg-base);
  border-top: 1px solid var(--bg-border);
}
.blog-cta-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  background: linear-gradient(135deg, #0d1a2e 0%, #0b1a30 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--bg-border));
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-10);
}
.blog-cta-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--r-lg);
  color: var(--accent);
}
.blog-cta-text { flex: 1; min-width: 0; }
.blog-cta-text h2 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-2);
}
.blog-cta-text p { color: var(--text-secondary); margin: 0; }
@media (max-width: 700px) {
  .blog-cta-banner { flex-direction: column; align-items: flex-start; padding: var(--sp-6); }
  .blog-cta-banner .banner-cta-btn { width: 100%; justify-content: center; }
}

/* ── ISP Directory promo banner ─────────────────────────────────────────────── */
.section-isp-promo {
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
  border-bottom: 1px solid var(--bg-border);
}
.isp-promo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-10);
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
}
.isp-promo-text h2 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-2);
}
.isp-promo-text p { color: var(--text-secondary); margin: 0; max-width: 520px; }
@media (max-width: 700px) {
  .isp-promo-banner { flex-direction: column; align-items: flex-start; padding: var(--sp-6); }
  .isp-promo-banner .banner-cta-btn { width: 100%; justify-content: center; }
}

/* ── Banner CTA button — used in blog + ISP promo banners ───────────────────── */
.banner-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--accent);
  color: #0b0f1a;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.banner-cta-btn:hover {
  background: #00f0c3;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 30%, transparent);
  color: #0b0f1a;
}
.banner-cta-btn .cta-arrow {
  font-style: normal;
  transition: transform 0.15s ease;
}
.banner-cta-btn:hover .cta-arrow { transform: translateX(3px); }

/* Outline variant for lighter backgrounds */
.banner-cta-btn--outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid color-mix(in srgb, var(--text-primary) 30%, transparent);
}
.banner-cta-btn--outline:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0f1a;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}
}

/* ═══════════════════════════════════════════════════════════════════════════
   Rankings + Leaderboard + Champions — shared page components
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shared hero ─────────────────────────────────────────────────────────── */
.rk-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,170,.07) 0%, transparent 65%);
  border-bottom: 1px solid var(--bg-border);
  padding: var(--sp-16) 0 var(--sp-12);
  text-align: center;
}
.lb-hero { background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,170,.07) 0%, transparent 65%); }
.champ-hero { background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212,175,55,.06) 0%, transparent 65%); }
.rk-hero-gfx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
}
.rk-hero-inner { position: relative; z-index: 1; }
.rk-hero h1 {
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: var(--sp-3) 0 var(--sp-3);
  line-height: 1.15;
}
.rk-hero-sub {
  color: var(--text-secondary);
  font-size: var(--text-base);
  max-width: 560px;
  margin: 0 auto var(--sp-8);
}
.rk-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-full);
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.champ-badge { border-color: rgba(212,175,55,.3); color: rgba(212,175,55,.9); }
.rk-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: rt-pulse 2s ease-in-out infinite;
}
.rk-hero-stats {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-8);
  margin-top: var(--sp-8);
}
.rk-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rk-stat-val { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--accent); }
.rk-stat-lbl { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rk-stat-sep { width: 1px; height: 36px; background: var(--bg-border); flex-shrink: 0; }
@media (max-width: 600px) {
  .rk-hero-stats { flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
  .rk-stat-sep { width: 60px; height: 1px; }
}

/* ── Section headings ────────────────────────────────────────────────────── */
.rk-section-h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-5);
}
.rk-section-h3 {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin: var(--sp-8) 0 var(--sp-4);
}

/* ── Top 3 podium cards ──────────────────────────────────────────────────── */
.rk-top3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.rk-top3-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.rk-top3-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.rk-place-1 { border-color: rgba(212,175,55,.4); background: linear-gradient(180deg, rgba(212,175,55,.05) 0%, var(--bg-surface) 100%); }
.rk-place-2 { border-color: rgba(168,168,168,.3); }
.rk-place-3 { border-color: rgba(205,127,50,.3); }
.rk-top3-medal { display: none; }
.rk-top3-flag { font-size: 2.5rem; line-height: 1; }
.rk-top3-name { font-size: var(--text-base); font-weight: var(--fw-bold); color: var(--text-primary); }
.rk-top3-speed { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--accent); }
.rk-top3-sub { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.rk-top3-meta { display: flex; gap: var(--sp-3); font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--sp-1); }
@media (max-width: 640px) {
  .rk-top3 { grid-template-columns: 1fr; }
}

/* ── Medal badges ────────────────────────────────────────────────────────── */
.rk-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: var(--fw-bold);
  line-height: 1;
}
.rk-medal-1 { background: linear-gradient(135deg,#d4af37,#f5d57a); color: #3d2c00; }
.rk-medal-2 { background: linear-gradient(135deg,#a8a8a8,#d4d4d4); color: #2a2a2a; }
.rk-medal-3 { background: linear-gradient(135deg,#cd7f32,#e8a87c); color: #3d1a00; }
.rk-flag { font-size: 1.1rem; margin-right: var(--sp-2); }

/* ── Mode badges on leaderboard ──────────────────────────────────────────── */
.lb-mode-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.lb-mode-single { background: rgba(59,130,246,.15); color: #60a5fa; }
.lb-mode-multi  { background: rgba(0,212,170,.12);  color: var(--accent); }

/* ── Speed bar in table cells ────────────────────────────────────────────── */
.rk-bar-cell { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.rk-bar-track {
  height: 3px;
  background: var(--bg-border);
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
  max-width: 140px;
}
.rk-bar-fill-dl {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00b8e6);
  border-radius: 2px;
  transition: width .3s ease;
}
.rk-bar-fill-ul {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), #818cf8);
  border-radius: 2px;
  transition: width .3s ease;
}

/* ── Full table extras ───────────────────────────────────────────────────── */
.rk-full-table { font-size: var(--text-sm); }

/* ── Methodology note ────────────────────────────────────────────────────── */
.rk-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.rk-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-16) 0;
  text-align: center;
}
.rk-empty-state h2 { color: var(--text-primary); margin: 0; }
.rk-empty-state p { color: var(--text-muted); max-width: 400px; }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.rk-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin: var(--sp-8) 0 0;
  flex-wrap: wrap;
}
.rk-search-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
}
.rk-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.rk-search-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 36px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color .15s;
}
.rk-search-input:focus { border-color: var(--accent); }
.rk-count-badge {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-full);
  padding: 4px 10px;
  white-space: nowrap;
}

/* ── Related cards ───────────────────────────────────────────────────────── */
.rk-related { margin-top: var(--sp-12); }
.rk-related h3 { font-size: var(--text-sm); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: var(--sp-4); }
.rk-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
}
.rk-related-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color .15s, background .15s;
}
.rk-related-card:hover { border-color: var(--accent); background: var(--bg-card); }
.rk-related-card svg:first-child { color: var(--accent); flex-shrink: 0; }
.rk-related-card div { flex: 1; }
.rk-related-card strong { display: block; font-size: var(--text-sm); color: var(--text-primary); }
.rk-related-card span { font-size: var(--text-xs); color: var(--text-muted); }
.rk-related-card svg:last-child { color: var(--text-muted); flex-shrink: 0; }
.rk-related-card:hover svg:last-child { color: var(--accent); }

/* ── Leaderboard podium extras ───────────────────────────────────────────── */
.lb-podium { justify-content: center; }
.lb-podium-unit { font-size: var(--text-xs); color: var(--text-muted); }
.lb-podium-cc { font-size: var(--text-sm); color: var(--text-muted); }
.lb-podium-crown { margin-bottom: var(--sp-1); }
.lb-panel { margin-top: var(--sp-2); }
.lb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-16) 0;
  text-align: center;
}
.lb-empty h3 { color: var(--text-primary); margin: 0; }
.lb-empty p { color: var(--text-muted); }

/* ── Leaderboard join CTA ────────────────────────────────────────────────── */
.lb-join-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  margin-top: var(--sp-12);
  padding: var(--sp-8) var(--sp-10);
  background: linear-gradient(135deg, #0d1a2e 0%, #0b1a30 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--bg-border));
  border-radius: var(--r-xl);
}
.lb-join-cta--active { border-color: color-mix(in srgb, var(--accent) 25%, var(--bg-border)); }
.lb-join-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--r-lg);
  color: var(--accent);
  flex-shrink: 0;
}
.lb-join-cta h2 { font-size: var(--text-xl); margin: 0 0 var(--sp-1); }
.lb-join-cta p { color: var(--text-secondary); margin: 0; font-size: var(--text-sm); }
.lb-join-actions { display: flex; gap: var(--sp-3); flex-shrink: 0; flex-wrap: wrap; }
@media (max-width: 700px) {
  .lb-join-cta { flex-direction: column; align-items: flex-start; padding: var(--sp-6); }
  .lb-join-actions { width: 100%; }
  .lb-join-actions .banner-cta-btn, .lb-join-actions .btn { flex: 1; justify-content: center; }
}

/* ── Leaderboard pagination ──────────────────────────────────────────────── */
.lb-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--bg-border);
}
.lb-pg-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.lb-pg-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.lb-pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
a.lb-pg-btn:hover { background: var(--bg-border); color: var(--text-primary); }
.lb-pg-active { background: var(--accent) !important; color: #0b0f1a !important; border-color: var(--accent) !important; font-weight: var(--fw-bold); }
.lb-pg-disabled { opacity: 0.35; cursor: default; }
.lb-pg-gap { border: none; background: transparent; cursor: default; color: var(--text-muted); }
@media (max-width: 600px) {
  .lb-pagination { flex-direction: column; align-items: flex-start; }
}

/* ── Champions page ──────────────────────────────────────────────────────── */
.champ-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-16) 0 var(--sp-12);
  text-align: center;
}
.champ-empty-trophy { margin-bottom: var(--sp-2); }
.champ-empty h2 { color: var(--text-primary); margin: 0; font-size: var(--text-2xl); }
.champ-empty p { color: var(--text-muted); max-width: 440px; }
.champ-table-wrap .rankings-table th:first-child { white-space: nowrap; }
.champ-winner { display: flex; align-items: center; gap: var(--sp-2); }
.champ-crown { font-size: 1rem; flex-shrink: 0; }
.champ-name { font-weight: var(--fw-semibold); color: var(--text-primary); font-size: var(--text-sm); }
.champ-score { font-family: var(--font-mono); font-weight: var(--fw-bold); font-size: var(--text-sm); }
.champ-score-dl { color: var(--accent); }
.champ-score-ul { color: var(--accent-2); }
.champ-score-pg { color: var(--success); }
.champ-how { margin-top: var(--sp-12); }
.champ-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
.champ-step {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
}
.champ-step-num {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 50%;
  font-weight: var(--fw-bold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.champ-step h3 { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--sp-1); }
.champ-step p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }
.champ-rules {
  margin-top: var(--sp-8);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
}
.champ-rules h3 { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--sp-3); }
.champ-rules-list { margin: 0; padding-left: var(--sp-5); color: var(--text-muted); font-size: var(--text-sm); }

/* ── Minimal page layout (pg-*) ───────────────────────────────── */
.pg-header {
  margin-bottom: var(--sp-8);
}
.pg-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.pg-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.pg-breadcrumb a:hover { color: var(--text-primary); }
.pg-breadcrumb span { color: var(--text-muted); }
.pg-header h1 { margin: 0 0 var(--sp-2); font-size: var(--text-3xl); color: var(--text-primary); }
.pg-sub { color: var(--text-muted); font-size: var(--text-sm); margin: 0; }
.pg-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--sp-5);
}
.pg-note a { color: var(--accent); text-decoration: none; }
.pg-note a:hover { text-decoration: underline; }
.pg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-16) 0 var(--sp-12);
  text-align: center;
  color: var(--text-muted);
}
.pg-empty h2 { color: var(--text-primary); margin: 0; font-size: var(--text-2xl); }
.pg-empty p { margin: 0; max-width: 440px; font-size: var(--text-sm); }
.pg-related {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-10);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--bg-border);
}
.pg-related::before {
  content: 'Related';
  display: block;
  width: 100%;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-2);
}
.pg-related a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.pg-related a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-raised);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.08);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ── Leaderboard tabs ──────────────────────────────────────────── */
.lb-period {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
}
.lb-period strong { color: var(--text-secondary); }

/* ── ISP page search bar ───────────────────────────────────────── */
.pg-search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.pg-search-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
}
.pg-search-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.pg-search-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-8);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  box-sizing: border-box;
}
.pg-search-input:focus { border-color: var(--accent); }
.pg-count-badge {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Prose content pages (about, methodology, privacy, etc.) ──── */
.pg-content {}
.pg-content h2 {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: var(--sp-10) 0 var(--sp-3);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--bg-border);
}
.pg-content h2:first-of-type { border-top: none; padding-top: 0; margin-top: var(--sp-6); }
.pg-content h3 {
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: var(--sp-6) 0 var(--sp-2);
}
.pg-content p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.85;
  margin: 0 0 var(--sp-4);
}
.pg-content ul, .pg-content ol {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.85;
  padding-left: var(--sp-6);
  margin: 0 0 var(--sp-4);
}
.pg-content li { margin-bottom: var(--sp-1); }
.pg-content a { color: var(--accent); text-decoration: none; }
.pg-content a:hover { text-decoration: underline; }
.pg-content strong { color: var(--text-primary); font-weight: var(--fw-semibold); }

/* Info card grid — used on About */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}
.info-card {
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
}
.info-card-icon {
  width: 36px; height: 36px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-3);
}
.info-card h3 { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--sp-2); }
.info-card p { font-size: var(--text-xs); color: var(--text-muted); margin: 0; line-height: 1.7; }

/* Methodology step cards */
.method-steps { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-5) 0; }
.method-step {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  align-items: flex-start;
}
.method-step-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.method-step h3 { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--sp-1); }
.method-step p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; line-height: 1.7; }

/* FAQ accordion */
.faq-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '';
  flex-shrink: 0;
  width: 16px; height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' stroke='%23888' stroke-width='1.75' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform .2s;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item .faq-body {
  padding: 0 var(--sp-5) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.8;
  border-top: 1px solid var(--bg-border);
  padding-top: var(--sp-4);
}
.faq-item .faq-body a { color: var(--accent); text-decoration: none; }
.faq-item .faq-body a:hover { text-decoration: underline; }
.faq-category-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 var(--sp-3);
}

/* Contact page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}
@media (max-width: 600px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
}
.contact-card-icon {
  width: 36px; height: 36px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-3);
}
.contact-card h3 { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--sp-2); }
.contact-card p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; line-height: 1.7; }
.contact-card a { color: var(--accent); text-decoration: none; font-size: var(--text-sm); }
.contact-card a:hover { text-decoration: underline; }
.contact-notice {
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.8;
  margin-top: var(--sp-8);
}
.champ-rules-list li { margin-bottom: var(--sp-1); }

/* ── Servers page ─────────────────────────────────────────────── */
.srv-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-10);
  flex-wrap: wrap;
}
.srv-stat { display: flex; flex-direction: column; gap: var(--sp-1); }
.srv-stat-val { font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--text-primary); font-family: var(--font-mono); }
.srv-stat-lbl { font-size: var(--text-xs); color: var(--text-muted); }
.srv-stat-sep { width: 1px; height: 36px; background: var(--bg-border); flex-shrink: 0; }
.srv-section-h2 {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 var(--sp-5);
}
.srv-chart {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.srv-chart-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.srv-chart-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  width: 140px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.srv-chart-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--bg-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.srv-chart-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width .3s ease;
  min-width: 4px;
}
.srv-chart-count {
  font-size: var(--text-xs);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}
.srv-proto {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--r-full);
  letter-spacing: .04em;
}
.srv-proto-ndt7 {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.srv-proto-custom {
  background: color-mix(in srgb, var(--accent-2) 15%, transparent);
  color: var(--accent-2);
}

/* ── Tool Widget (embedded mini-tests on tool pages) ─────────────────────── */
.tool-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-10) var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-10);
}
.tw-btn {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-raised), var(--bg-surface));
  border: 2px solid var(--bg-border);
  color: var(--text-primary);
  font-size: 1.375rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  box-shadow: 0 0 0 6px rgba(0,212,170,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}
.tw-btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 10px rgba(0,212,170,0.12);
}
.tw-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.tw-btn.tw-running {
  border-color: var(--accent);
  animation: tw-pulse 1.6s ease-in-out infinite;
}
.tw-btn-phase {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@keyframes tw-pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(0,212,170,0.18); }
  50%       { box-shadow: 0 0 0 20px rgba(0,212,170,0.04); }
}
.tw-status {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  min-height: 1.25rem;
  text-align: center;
}
.tw-metrics {
  display: flex;
  gap: var(--sp-8);
  flex-wrap: wrap;
  justify-content: center;
}
.tw-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}
.tw-metric-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
  line-height: 1;
  transition: color var(--t-base);
}
.tw-metric-value.tw-excellent { color: var(--success); }
.tw-metric-value.tw-good      { color: #84cc16; }
.tw-metric-value.tw-warn      { color: var(--warning); }
.tw-metric-value.tw-poor      { color: var(--error); }
.tw-metric-unit  { font-size: var(--text-xs); color: var(--text-muted); margin-top: -2px; }
.tw-metric-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-medium);
}
.tw-divider { width: 1px; min-height: 60px; background: var(--bg-border); align-self: center; }
.tw-bar-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.tw-bar-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.tw-bar-label { width: 72px; text-align: right; flex-shrink: 0; }
.tw-bar-track { flex: 1; height: 6px; background: var(--bg-raised); border-radius: var(--r-full); overflow: hidden; }
.tw-bar-fill  { height: 100%; background: var(--accent); border-radius: var(--r-full); width: 0%; transition: width 0.3s ease; }
.tw-bar-val   { width: 64px; flex-shrink: 0; font-family: var(--font-mono); }
.tw-result-link {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
}
.tw-result-link:hover { text-decoration: underline; }

/* ── Post-test panel: share + signup ─────────────────────────────────────── */
.tw-post-test {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--bg-border);
  animation: tw-fadein 0.35s ease;
}
@keyframes tw-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tw-share-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: var(--fw-medium);
}
.tw-share-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: center;
}
.tw-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.4;
  transition: opacity var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  background: none;
}
.tw-share-btn:hover { opacity: 0.82; transform: translateY(-1px); }
.tw-share-btn:active { transform: translateY(0); }
.tw-share-whatsapp { background: #25d366; color: #fff; }
.tw-share-x        { background: #0f0f0f; color: #fff; border-color: #333; }
.tw-share-reddit   { background: #ff4500; color: #fff; }
.tw-share-telegram { background: #229ed9; color: #fff; }
.tw-share-copy     { background: var(--bg-raised); color: var(--text-secondary); border-color: var(--bg-border); }
.tw-share-copy:hover { color: var(--text-primary); border-color: var(--accent); }

.tw-signup-box {
  width: 100%;
  background: linear-gradient(135deg, rgba(0,212,170,0.07), rgba(59,130,246,0.05));
  border: 1px solid rgba(0,212,170,0.22);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.tw-signup-box-text { flex: 1; min-width: 160px; }
.tw-signup-box-text strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 3px;
}
.tw-signup-box-text span { font-size: var(--text-xs); color: var(--text-secondary); }

/* ── Result page share row ────────────────────────────────────────────────── */
.result-share-row {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}
.result-signup-box {
  max-width: 560px;
  margin: var(--sp-6) auto 0;
  background: linear-gradient(135deg, rgba(0,212,170,0.07), rgba(59,130,246,0.05));
  border: 1px solid rgba(0,212,170,0.22);
  border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  text-align: left;
}
.result-signup-box-text { flex: 1; min-width: 160px; }
.result-signup-box-text strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 3px;
}
.result-signup-box-text span { font-size: var(--text-xs); color: var(--text-secondary); }

/* ── Advanced test — chart + inline results ───────────────────────────────── */
.adv-chart-wrap {
  margin-top: var(--sp-6);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--bg-border);
  background: #111827;
}
.adv-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 160px;
}

.adv-results {
  animation: fadeIn 0.4s ease;
}

/* Grade row */
.adv-grade-row {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}
.adv-grade-badge {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  width: 80px;
  height: 80px;
  border-radius: var(--r-md);
  border: 3px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -2px;
}
.adv-grade-label {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}
.adv-grade-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* Detail grid */
.adv-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.adv-detail-card {
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  padding: var(--sp-5);
}
.adv-detail-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--sp-3);
}
.adv-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-1) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.adv-detail-row:last-of-type { border-bottom: none; }
.adv-mono {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* Use-case rows */
.adv-use-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.adv-use-row:last-child { border-bottom: none; }
.adv-use-icon { font-size: 0.9rem; font-weight: 700; width: 16px; flex-shrink: 0; }
.adv-use-label { flex: 1; color: var(--text-primary); font-weight: var(--fw-medium); }
.adv-use-note  { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }

/* Actions */
.adv-actions-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}

/* ── Server bar (tool pages) ─────────────────────────────────────────────── */
.tw-server-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-full);
  padding: var(--sp-1) var(--sp-3);
  width: fit-content;
  margin: 0 auto;
}
.tw-server-bar strong { color: var(--text-secondary); font-weight: var(--fw-semibold); }

/* ── Recorded toast ──────────────────────────────────────────────────────── */
.tw-recorded-toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  white-space: nowrap;
  animation: fadeIn 0.25s ease;
  transition: opacity 0.35s ease;
}
.tw-recorded-toast svg:first-child { color: var(--accent); flex-shrink: 0; }
.tw-recorded-toast a { color: var(--accent); text-decoration: underline; }
.tw-toast-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  margin-left: var(--sp-2);
  display: flex;
  align-items: center;
}
.tw-toast-dismiss:hover { color: var(--text-primary); }
.tw-toast-hiding { opacity: 0; }

/* ── Hub spoke section ───────────────────────────────────────────────────── */
.hub-spokes {
  margin-top: var(--sp-12);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--bg-border);
}
.hub-spokes-title {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-6);
}
.hub-spokes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
}
.hub-spoke-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  text-decoration: none;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
}
.hub-spoke-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,212,170,0.12);
  text-decoration: none;
}
.hub-spoke-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,212,170,0.1);
  color: var(--accent);
  flex-shrink: 0;
}
.hub-spoke-card[data-color="blue"] .hub-spoke-icon  { background: rgba(59,130,246,0.1);  color: var(--accent-2); }
.hub-spoke-card[data-color="amber"] .hub-spoke-icon { background: rgba(245,158,11,0.1);  color: #f59e0b; }
.hub-spoke-card[data-color="red"] .hub-spoke-icon   { background: rgba(239,68,68,0.1);   color: #ef4444; }
.hub-spoke-card[data-color="purple"] .hub-spoke-icon{ background: rgba(139,92,246,0.1);  color: #8b5cf6; }
.hub-spoke-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  line-height: 1.3;
}
.hub-spoke-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── OS Tab switcher (captive portal) ────────────────────────────────────── */
.os-tabs {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--bg-border);
  padding-bottom: 0;
}
.os-tab-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.os-tab-btn:hover { color: var(--text-primary); }
.os-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.os-panel { display: none; }
.os-panel.active { display: block; }
